/*! For license information please see main.9944ba03.js.LICENSE.txt */ (()=>{var e={5(e){e.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=90)}({17:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r=i(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var i=t.match(e);return i&&i.length>0&&i[1]||""},e.getSecondMatch=function(e,t){var i=t.match(e);return i&&i.length>1&&i[2]||""},e.matchAndReturnConst=function(e,t,i){if(e.test(t))return i},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});t.push(0);var i=t[0],r=t[1];if(10===i)switch(r){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(i){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,i,r){void 0===r&&(r=!1);var n=e.getVersionPrecision(t),s=e.getVersionPrecision(i),a=Math.max(n,s),o=0,c=e.map([t,i],function(t){var i=a-e.getVersionPrecision(t),r=t+new Array(i+1).join(".0");return e.map(r.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(r&&(o=a-Math.min(n,s)),a-=1;a>=o;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===o)return 0;a-=1}else if(c[0][a]1?n-1:0),a=1;a0){var a=Object.keys(i),c=o.default.find(a,function(e){return t.isOS(e)});if(c){var l=this.satisfies(i[c]);if(void 0!==l)return l}var d=o.default.find(a,function(e){return t.isPlatform(e)});if(d){var h=this.satisfies(i[d]);if(void 0!==h)return h}}if(s>0){var u=Object.keys(n),p=o.default.find(u,function(e){return t.isBrowser(e,!0)});if(void 0!==p)return this.compareVersion(n[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var i=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),n=o.default.getBrowserTypeByAlias(r);return t&&n&&(r=n.toLowerCase()),r===i},t.compareVersion=function(e){var t=[0],i=e,r=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(r=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(r=!0,i=e.substr(1)),t.indexOf(o.default.compareVersions(n,i,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=l,e.exports=t.default},92:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,n=(r=i(17))&&r.__esModule?r:{default:r},s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},i=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},i=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},i=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},i=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},i=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},i=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},i=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},i=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},i=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},i=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},i=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},i=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},i=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},i=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},i=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},i=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},i=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},i=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},i=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},i=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},i=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},i=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},i=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},i=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},i=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},i=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},i=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},i=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},i=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},i=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},i=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},i=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},i=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return i&&(t.version=i),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},i=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},i=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},i=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},i=n.default.getFirstMatch(s,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},i=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},i=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},i=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},i=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},i=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},i=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},i=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),s=n.default.getFirstMatch(/se ([\d.]+)x/i,e),a=i||r||s;return a&&(t.version=a),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},i=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},i=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},i=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},i=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t={name:"Android Browser"},i=n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},i=n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},i=n.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,n=(r=i(17))&&r.__esModule?r:{default:r},s=i(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=n.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:i}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},i=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=n.default.getMacOSVersionName(t),r={name:s.OS_MAP.MacOS,version:t};return i&&(r.versionName=i),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=n.default.getAndroidVersionName(t),r={name:s.OS_MAP.Android,version:t};return i&&(r.versionName=i),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),i={name:s.OS_MAP.WebOS};return t&&t.length&&(i.version=t),i}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,n=(r=i(17))&&r.__esModule?r:{default:r},s=i(18),a=[{test:[/googlebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/amazonbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/yahoo/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",i={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(i.model=t),i}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),i=e.test(/like (ipod|iphone)/i);return t&&!i},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),i={type:s.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(i.model=t),i}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,i){"use strict";t.__esModule=!0,t.default=void 0;var r,n=(r=i(17))&&r.__esModule?r:{default:r},s=i(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},i=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},i=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=e.test(/gecko/i),i=e.test(/like gecko/i);return t&&!i},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},i=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},i=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];t.default=a,e.exports=t.default}})},31(e,t,i){"use strict";i.d(t,{A:()=>DT});var r,n={};i.r(n),i.d(n,{clearInterval:()=>me,clearTimeout:()=>ve,setInterval:()=>be,setTimeout:()=>ke});var s=new Uint8Array(16);function a(){if(!r&&!(r="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(s)}const o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const c=function(e){return"string"===typeof e&&o.test(e)};for(var l=[],d=0;d<256;++d)l.push((d+256).toString(16).substr(1));const h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!c(i))throw TypeError("Stringified UUID is invalid");return i};const u=function(e,t,i){var r=(e=e||{}).random||(e.rng||a)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return h(r)};var p=i(5),g=i.n(p);const f=Symbol.for("protobuf-ts/message-type");function m(e){let t=!1;const i=[];for(let r=0;r2&&void 0!==arguments[2]&&arguments[2];if(t<0)return!0;if(null===e||void 0===e||"object"!=typeof e)return!1;this.prepare();let r=Object.keys(e),n=this.data;if(r.length!r.includes(e)))return!1;if(!i&&r.some(e=>!n.known.includes(e)))return!1;if(t<1)return!0;for(const s of n.oneofs){const r=e[s];if(!w(r))return!1;if(void 0===r.oneofKind)continue;const n=this.fields.find(e=>e.localName===r.oneofKind);if(!n)return!1;if(!this.field(r[r.oneofKind],n,i,t))return!1}for(const s of this.fields)if(void 0===s.oneof&&!this.field(e[s.localName],s,i,t))return!1;return!0}field(e,t,i,r){let n=t.repeat;switch(t.kind){case"scalar":return void 0===e?t.opt:n?this.scalars(e,t.T,r,t.L):this.scalar(e,t.T,t.L);case"enum":return void 0===e?t.opt:n?this.scalars(e,v.INT32,r):this.scalar(e,v.INT32);case"message":return void 0===e||(n?this.messages(e,t.T(),i,r):this.message(e,t.T(),i,r));case"map":if("object"!=typeof e||null===e)return!1;if(r<2)return!0;if(!this.mapKeys(e,t.K,r))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,r,t.V.L);case"enum":return this.scalars(Object.values(e),v.INT32,r);case"message":return this.messages(Object.values(e),t.V.T(),i,r)}}return!0}message(e,t,i,r){return i?t.isAssignable(e,r):t.is(e,r)}messages(e,t,i,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(i){for(let n=0;nparseInt(e)),t,i);case v.BOOL:return this.scalars(r.slice(0,i).map(e=>"true"==e||"false"!=e&&e),t,i);default:return this.scalars(r,t,i,b.STRING)}}}function x(e){let t=typeof e;if("object"==t){if(Array.isArray(e))return"array";if(null===e)return"null"}return t}function E(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}let T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),_=[];for(let OT=0;OT>4,0==(128&i))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(t|=(127&i)<>>s,n=!(r>>>7==0&&0==t),a=255&(n?128|r:r);if(i.push(a),!n)return}const r=e>>>28&15|(7&t)<<4,n=!(t>>3==0);if(i.push(255&(n?128|r:r)),n){for(let e=3;e<31;e+=7){const r=t>>>e,n=!(r>>>7==0),s=255&(n?128|r:r);if(i.push(s),!n)return}i.push(t>>>31&1)}}_["-".charCodeAt(0)]=T.indexOf("+"),_["_".charCodeAt(0)]=T.indexOf("/");const A=4294967296;function R(e){let t="-"==e[0];t&&(e=e.slice(1));const i=1e6;let r=0,n=0;function s(t,s){const a=Number(e.slice(t,s));n*=i,r=r*i+a,r>=A&&(n+=r/A|0,r%=A)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[t,r,n]}function L(e,t){if(t>>>0<=2097151)return""+(A*t+(e>>>0));let i=(e>>>24|t<<8)>>>0&16777215,r=t>>16&65535,n=(16777215&e)+6777216*i+6710656*r,s=i+8147497*r,a=2*r,o=1e7;function c(e,t){let i=e?String(e):"";return t?"0000000".slice(i.length)+i:i}return n>=o&&(s+=Math.floor(n/o),n%=o),s>=o&&(a+=Math.floor(s/o),s%=o),c(a,0)+c(s,a)+c(n,1)}function I(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let i=0;i<9;i++)t.push(127&e|128),e>>=7;t.push(1)}}function M(){let e=this.buf[this.pos++],t=127&e;if(0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,0==(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let i=5;0!==(128&e)&&i<10;i++)e=this.buf[this.pos++];if(0!=(128&e))throw new Error("invalid varint");return this.assertBounds(),t>>>0}let D;function O(e){if(!e)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}!function(){const e=new DataView(new ArrayBuffer(8)),t=void 0!==globalThis.BigInt&&"function"===typeof e.getBigInt64&&"function"===typeof e.getBigUint64&&"function"===typeof e.setBigInt64&&"function"===typeof e.setBigUint64;D=t?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:e}:void 0}();const N=/^-?[0-9]+$/,U=4294967296,F=2147483648;class j{constructor(e,t){this.lo=0|e,this.hi=0|t}isZero(){return 0==this.lo&&0==this.hi}toNumber(){let e=this.hi*U+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class B extends j{static from(e){if(D)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=D.C(e);case"number":if(0===e)return this.ZERO;e=D.C(e);case"bigint":if(!e)return this.ZERO;if(eD.UMAX)throw new Error("ulong too large");return D.V.setBigUint64(0,e,!0),new B(D.V.getInt32(0,!0),D.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!N.test(e))throw new Error("string is no integer");let[t,i,r]=R(e);if(t)throw new Error("signed value for ulong");return new B(i,r);case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new B(e,e/U)}throw new Error("unknown value "+typeof e)}toString(){return D?this.toBigInt().toString():L(this.lo,this.hi)}toBigInt(){return O(D),D.V.setInt32(0,this.lo,!0),D.V.setInt32(4,this.hi,!0),D.V.getBigUint64(0,!0)}}B.ZERO=new B(0,0);class V extends j{static from(e){if(D)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=D.C(e);case"number":if(0===e)return this.ZERO;e=D.C(e);case"bigint":if(!e)return this.ZERO;if(eD.MAX)throw new Error("signed long too large");return D.V.setBigInt64(0,e,!0),new V(D.V.getInt32(0,!0),D.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!N.test(e))throw new Error("string is no integer");let[t,i,r]=R(e);if(t){if(r>F||r==F&&0!=i)throw new Error("signed long too small")}else if(r>=F)throw new Error("signed long too large");let n=new V(i,r);return t?n.negate():n;case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new V(e,e/U):new V(-e,-e/U).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return 0!==(this.hi&F)}negate(){let e=~this.hi,t=this.lo;return t?t=1+~t:e+=1,new V(t,e)}toString(){if(D)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+L(e.lo,e.hi)}return L(this.lo,this.hi)}toBigInt(){return O(D),D.V.setInt32(0,this.lo,!0),D.V.setInt32(4,this.hi,!0),D.V.getBigInt64(0,!0)}}function z(e,t){if(!e)throw new Error(t)}V.ZERO=new V(0,0);function H(e){if("number"!==typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function $(e){if("number"!==typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function G(e){if("number"!==typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}function W(e,t){switch(t){case b.BIGINT:return e.toBigInt();case b.NUMBER:return e.toNumber();default:return e.toString()}}class q{constructor(e){this.info=e}prepare(){var e;if(void 0===this.fMap){this.fMap={};const t=null!==(e=this.info.fields)&&void 0!==e?e:[];for(const e of t)this.fMap[e.name]=e,this.fMap[e.jsonName]=e,this.fMap[e.localName]=e}}assert(e,t,i){if(!e){let e=x(i);throw"number"!=e&&"boolean"!=e||(e=i.toString()),new Error("Cannot parse JSON ".concat(e," for ").concat(this.info.typeName,"#").concat(t))}}read(e,t,i){this.prepare();const r=[];for(const[n,s]of Object.entries(e)){const e=this.fMap[n];if(!e){if(!i.ignoreUnknownFields)throw new Error("Found unknown field while reading ".concat(this.info.typeName," from JSON format. JSON key: ").concat(n));continue}const a=e.localName;let o;if(e.oneof){if(null===s&&("enum"!==e.kind||"google.protobuf.NullValue"!==e.T()[0]))continue;if(r.includes(e.oneof))throw new Error('Multiple members of the oneof group "'.concat(e.oneof,'" of ').concat(this.info.typeName," are present in JSON."));r.push(e.oneof),o=t[e.oneof]={oneofKind:a}}else o=t;if("map"==e.kind){if(null===s)continue;this.assert(E(s),e.name,s);const t=o[a];for(const[r,n]of Object.entries(s)){let s;switch(this.assert(null!==n,e.name+" map value",null),e.V.kind){case"message":s=e.V.T().internalJsonRead(n,i);break;case"enum":if(s=this.enum(e.V.T(),n,e.name,i.ignoreUnknownFields),!1===s)continue;break;case"scalar":s=this.scalar(n,e.V.T,e.V.L,e.name)}this.assert(void 0!==s,e.name+" map value",n);let a=r;e.K==v.BOOL&&(a="true"==a||"false"!=a&&a),a=this.scalar(a,e.K,b.STRING,e.name).toString(),t[a]=s}}else if(e.repeat){if(null===s)continue;this.assert(Array.isArray(s),e.name,s);const t=o[a];for(const r of s){let n;switch(this.assert(null!==r,e.name,null),e.kind){case"message":n=e.T().internalJsonRead(r,i);break;case"enum":if(n=this.enum(e.T(),r,e.name,i.ignoreUnknownFields),!1===n)continue;break;case"scalar":n=this.scalar(r,e.T,e.L,e.name)}this.assert(void 0!==n,e.name,s),t.push(n)}}else switch(e.kind){case"message":if(null===s&&"google.protobuf.Value"!=e.T().typeName){this.assert(void 0===e.oneof,e.name+" (oneof member)",null);continue}o[a]=e.T().internalJsonRead(s,i,o[a]);break;case"enum":if(null===s)continue;let t=this.enum(e.T(),s,e.name,i.ignoreUnknownFields);if(!1===t)continue;o[a]=t;break;case"scalar":if(null===s)continue;o[a]=this.scalar(s,e.T,e.L,e.name)}}}enum(e,t,i,r){if("google.protobuf.NullValue"==e[0]&&z(null===t||"NULL_VALUE"===t,"Unable to parse field ".concat(this.info.typeName,"#").concat(i,", enum ").concat(e[0]," only accepts null.")),null===t)return 0;switch(typeof t){case"number":return z(Number.isInteger(t),"Unable to parse field ".concat(this.info.typeName,"#").concat(i,", enum can only be integral number, got ").concat(t,".")),t;case"string":let n=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(n=t.substring(e[2].length));let s=e[1][n];return("undefined"!==typeof s||!r)&&(z("number"==typeof s,"Unable to parse field ".concat(this.info.typeName,"#").concat(i,", enum ").concat(e[0],' has no value for "').concat(t,'".')),s)}z(!1,"Unable to parse field ".concat(this.info.typeName,"#").concat(i,", cannot parse enum value from ").concat(typeof t,'".'))}scalar(e,t,i,r){let n;try{switch(t){case v.DOUBLE:case v.FLOAT:if(null===e)return 0;if("NaN"===e)return Number.NaN;if("Infinity"===e)return Number.POSITIVE_INFINITY;if("-Infinity"===e)return Number.NEGATIVE_INFINITY;if(""===e){n="empty string";break}if("string"==typeof e&&e.trim().length!==e.length){n="extra whitespace";break}if("string"!=typeof e&&"number"!=typeof e)break;let r=Number(e);if(Number.isNaN(r)){n="not a number";break}if(!Number.isFinite(r)){n="too large or small";break}return t==v.FLOAT&&G(r),r;case v.INT32:case v.FIXED32:case v.SFIXED32:case v.SINT32:case v.UINT32:if(null===e)return 0;let s;if("number"==typeof e?s=e:""===e?n="empty string":"string"==typeof e&&(e.trim().length!==e.length?n="extra whitespace":s=Number(e)),void 0===s)break;return t==v.UINT32?$(s):H(s),s;case v.INT64:case v.SFIXED64:case v.SINT64:if(null===e)return W(V.ZERO,i);if("number"!=typeof e&&"string"!=typeof e)break;return W(V.from(e),i);case v.FIXED64:case v.UINT64:if(null===e)return W(B.ZERO,i);if("number"!=typeof e&&"string"!=typeof e)break;return W(B.from(e),i);case v.BOOL:if(null===e)return!1;if("boolean"!==typeof e)break;return e;case v.STRING:if(null===e)return"";if("string"!==typeof e){n="extra whitespace";break}try{encodeURIComponent(e)}catch(n){n="invalid UTF8";break}return e;case v.BYTES:if(null===e||""===e)return new Uint8Array(0);if("string"!==typeof e)break;return function(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let i,r=new Uint8Array(t),n=0,s=0,a=0;for(let o=0;o>4,a=i,s=2;break;case 2:r[n++]=(15&a)<<4|(60&i)>>2,a=i,s=3;break;case 3:r[n++]=(3&a)<<6|i,s=0}}if(1==s)throw Error("invalid base64 string.");return r.subarray(0,n)}(e)}}catch(s){n=s.message}this.assert(!1,r+(n?" - "+n:""),e)}}class K{constructor(e){var t;this.fields=null!==(t=e.fields)&&void 0!==t?t:[]}write(e,t){const i={},r=e;for(const n of this.fields){if(!n.oneof){let e=this.field(n,r[n.localName],t);void 0!==e&&(i[t.useProtoFieldName?n.name:n.jsonName]=e);continue}const e=r[n.oneof];if(e.oneofKind!==n.localName)continue;const s="scalar"==n.kind||"enum"==n.kind?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t;let a=this.field(n,e[n.localName],s);z(void 0!==a),i[t.useProtoFieldName?n.name:n.jsonName]=a}return i}field(e,t,i){let r;if("map"==e.kind){z("object"==typeof t&&null!==t);const n={};switch(e.V.kind){case"scalar":for(const[i,a]of Object.entries(t)){const t=this.scalar(e.V.T,a,e.name,!1,!0);z(void 0!==t),n[i.toString()]=t}break;case"message":const r=e.V.T();for(const[a,o]of Object.entries(t)){const t=this.message(r,o,e.name,i);z(void 0!==t),n[a.toString()]=t}break;case"enum":const s=e.V.T();for(const[a,o]of Object.entries(t)){z(void 0===o||"number"==typeof o);const t=this.enum(s,o,e.name,!1,!0,i.enumAsInteger);z(void 0!==t),n[a.toString()]=t}}(i.emitDefaultValues||Object.keys(n).length>0)&&(r=n)}else if(e.repeat){z(Array.isArray(t));const n=[];switch(e.kind){case"scalar":for(let i=0;i0||i.emitDefaultValues)&&(r=n)}else switch(e.kind){case"scalar":r=this.scalar(e.T,t,e.name,e.opt,i.emitDefaultValues);break;case"enum":r=this.enum(e.T(),t,e.name,e.opt,i.emitDefaultValues,i.enumAsInteger);break;case"message":r=this.message(e.T(),t,e.name,i)}return r}enum(e,t,i,r,n,s){if("google.protobuf.NullValue"==e[0])return n||r?null:void 0;if(void 0!==t){if(0!==t||n||r)return z("number"==typeof t),z(Number.isInteger(t)),s||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}else z(r)}message(e,t,i,r){return void 0===t?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,t,i,r,n){if(void 0===t)return void z(r);const s=n||r;switch(e){case v.INT32:case v.SFIXED32:case v.SINT32:return 0===t?s?0:void 0:(H(t),t);case v.FIXED32:case v.UINT32:return 0===t?s?0:void 0:($(t),t);case v.FLOAT:G(t);case v.DOUBLE:return 0===t?s?0:void 0:(z("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case v.STRING:return""===t?s?"":void 0:(z("string"==typeof t),t);case v.BOOL:return!1===t?!s&&void 0:(z("boolean"==typeof t),t);case v.UINT64:case v.FIXED64:z("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let e=B.from(t);if(e.isZero()&&!s)return;return e.toString();case v.INT64:case v.SFIXED64:case v.SINT64:z("number"==typeof t||"string"==typeof t||"bigint"==typeof t);let i=V.from(t);if(i.isZero()&&!s)return;return i.toString();case v.BYTES:return z(t instanceof Uint8Array),t.byteLength?function(e){let t,i="",r=0,n=0;for(let s=0;s>2],n=(3&t)<<4,r=1;break;case 1:i+=T[n|t>>4],n=(15&t)<<2,r=2;break;case 2:i+=T[n|t>>6],i+=T[63&t],r=0}return r&&(i+=T[n],i+="=",1==r&&(i+="=")),i}(t):s?"":void 0}}}var Z,Y;function J(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.STRING;switch(e){case v.BOOL:return!1;case v.UINT64:case v.FIXED64:return W(B.ZERO,t);case v.INT64:case v.SFIXED64:case v.SINT64:return W(V.ZERO,t);case v.DOUBLE:case v.FLOAT:return 0;case v.BYTES:return new Uint8Array(0);case v.STRING:return"";default:return 0}}!function(e){e.symbol=Symbol.for("protobuf-ts/unknown"),e.onRead=(i,r,n,s,a)=>{(t(r)?r[e.symbol]:r[e.symbol]=[]).push({no:n,wireType:s,data:a})},e.onWrite=(t,i,r)=>{for(let{no:n,wireType:s,data:a}of e.list(i))r.tag(n,s).raw(a)},e.list=(i,r)=>{if(t(i)){let t=i[e.symbol];return r?t.filter(e=>e.no==r):t}return[]},e.last=(t,i)=>e.list(t,i).slice(-1)[0];const t=t=>t&&Array.isArray(t[e.symbol])}(Z||(Z={})),function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(Y||(Y={}));class Q{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const t=null!==(e=this.info.fields)&&void 0!==e?e:[];this.fieldNoToField=new Map(t.map(e=>[e.no,e]))}}read(e,t,i,r){this.prepare();const n=void 0===r?e.len:e.pos+r;for(;e.pose.no-t.no)}}write(e,t,i){this.prepare();for(const n of this.fields){let r,s,a=n.repeat,o=n.localName;if(n.oneof){const t=e[n.oneof];if(t.oneofKind!==o)continue;r=t[o],s=!0}else r=e[o],s=!1;switch(n.kind){case"scalar":case"enum":let e="enum"==n.kind?v.INT32:n.T;if(a)if(z(Array.isArray(r)),a==k.PACKED)this.packed(t,e,n.no,r);else for(const i of r)this.scalar(t,e,n.no,i,!0);else void 0===r?z(n.opt):this.scalar(t,e,n.no,r,s||n.opt);break;case"message":if(a){z(Array.isArray(r));for(const e of r)this.message(t,i,n.T(),n.no,e)}else this.message(t,i,n.T(),n.no,r);break;case"map":z("object"==typeof r&&null!==r);for(const[s,a]of Object.entries(r))this.mapEntry(t,i,n,s,a)}}let r=i.writeUnknownFields;!1!==r&&(!0===r?Z.onWrite:r)(this.info.typeName,e,t)}mapEntry(e,t,i,r,n){e.tag(i.no,Y.LengthDelimited),e.fork();let s=r;switch(i.K){case v.INT32:case v.FIXED32:case v.UINT32:case v.SFIXED32:case v.SINT32:s=Number.parseInt(r);break;case v.BOOL:z("true"==r||"false"==r),s="true"==r}switch(this.scalar(e,i.K,1,s,!0),i.V.kind){case"scalar":this.scalar(e,i.V.T,2,n,!0);break;case"enum":this.scalar(e,v.INT32,2,n,!0);break;case"message":this.message(e,t,i.V.T(),2,n)}e.join()}message(e,t,i,r,n){void 0!==n&&(i.internalBinaryWrite(n,e.tag(r,Y.LengthDelimited).fork(),t),e.join())}scalar(e,t,i,r,n){let[s,a,o]=this.scalarInfo(t,r);o&&!n||(e.tag(i,s),e[a](r))}packed(e,t,i,r){if(!r.length)return;z(t!==v.BYTES&&t!==v.STRING),e.tag(i,Y.LengthDelimited),e.fork();let[,n]=this.scalarInfo(t);for(let s=0;snew ce};class ce{constructor(e){this.stack=[],this.textEncoder=null!==e&&void 0!==e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for($(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return H(e),I(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){G(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){$(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){H(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return H(e),I(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),r=V.from(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),r=B.from(e);return i.setInt32(0,r.lo,!0),i.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=V.from(e);return C(t.lo,t.hi,this.buf),this}sint64(e){let t=V.from(e),i=t.hi>>31;return C(t.lo<<1^i,(t.hi<<1|t.lo>>>31)^i,this.buf),this}uint64(e){let t=B.from(e);return C(t.lo,t.hi,this.buf),this}}const le={readUnknownField:!0,readerFactory:e=>new de(e)};class de{constructor(e,t){this.varint64=P,this.uint32=M,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!==t&&void 0!==t?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,i=7&e;if(t<=0||i<0||i>5)throw new Error("illegal tag: field no "+t+" wire type "+i);return[t,i]}skip(e){let t=this.pos;switch(e){case Y.Varint:for(;128&this.buf[this.pos++];);break;case Y.Bit64:this.pos+=4;case Y.Bit32:this.pos+=4;break;case Y.LengthDelimited:let t=this.uint32();this.pos+=t;break;case Y.StartGroup:let i;for(;(i=this.tag()[1])!==Y.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return new V(...this.varint64())}uint64(){return new B(...this.varint64())}sint64(){let[e,t]=this.varint64(),i=-(1&e);return e=(e>>>1|(1&t)<<31)^i,t=t>>>1^i,new V(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new B(this.sfixed32(),this.sfixed32())}sfixed64(){return new V(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}const he=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),ue=he[f]={};class pe{constructor(e,t,i){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(y),this.options=null!==i&&void 0!==i?i:{},ue.value=this,this.messagePrototype=Object.create(null,he),this.refTypeCheck=new S(this),this.refJsonReader=new q(this),this.refJsonWriter=new K(this),this.refBinReader=new Q(this),this.refBinWriter=new X(this)}create(e){let t=function(e){const t=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},f,{value:e});for(let i of e.fields){let e=i.localName;if(!i.opt)if(i.oneof)t[i.oneof]={oneofKind:void 0};else if(i.repeat)t[e]=[];else switch(i.kind){case"scalar":t[e]=J(i.T,i.L);break;case"enum":t[e]=0;break;case"map":t[e]={}}}return t}(this);return void 0!==e&&ee(this,t,e),t}clone(e){let t=this.create();return ee(this,t,e),t}equals(e,t){return function(e,t,i){if(t===i)return!0;if(!t||!i)return!1;for(let r of e.fields){let e=r.localName,n=r.oneof?t[r.oneof][e]:t[e],s=r.oneof?i[r.oneof][e]:i[e];switch(r.kind){case"enum":case"scalar":let e="enum"==r.kind?v.INT32:r.T;if(!(r.repeat?se(e,n,s):ne(e,n,s)))return!1;break;case"map":if(!("message"==r.V.kind?ae(r.V.T(),re(n),re(s)):se("enum"==r.V.kind?v.INT32:r.V.T,re(n),re(s))))return!1;break;case"message":let t=r.T();if(!(r.repeat?ae(t,n,s):t.equals(n,s)))return!1}}return!0}(this,e,t)}is(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.defaultCheckDepth;return this.refTypeCheck.is(e,t,!1)}isAssignable(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.defaultCheckDepth;return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){ee(this,e,t)}fromBinary(e,t){let i=function(e){return e?Object.assign(Object.assign({},le),e):le}(t);return this.internalBinaryRead(i.readerFactory(e),e.byteLength,i)}fromJson(e,t){return this.internalJsonRead(e,function(e){return e?Object.assign(Object.assign({},ie),e):ie}(t))}fromJsonString(e,t){let i=JSON.parse(e);return this.fromJson(i,t)}toJson(e,t){return this.internalJsonWrite(e,function(e){return e?Object.assign(Object.assign({},te),e):te}(t))}toJsonString(e,t){var i;let r=this.toJson(e,t);return JSON.stringify(r,null,null!==(i=null===t||void 0===t?void 0:t.prettySpaces)&&void 0!==i?i:0)}toBinary(e,t){let i=function(e){return e?Object.assign(Object.assign({},oe),e):oe}(t);return this.internalBinaryWrite(e,i.writerFactory(),i).finish()}internalJsonRead(e,t,i){if(null!==e&&"object"==typeof e&&!Array.isArray(e)){let r=null!==i&&void 0!==i?i:this.create();return this.refJsonReader.read(e,r,t),r}throw new Error("Unable to parse message ".concat(this.typeName," from JSON ").concat(x(e),"."))}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,i){return this.refBinWriter.write(e,t,i),t}internalBinaryRead(e,t,i,r){let n=null!==r&&void 0!==r?r:this.create();return this.refBinReader.read(e,n,i,t),n}}var ge=i(9136);const fe=((e,t)=>{let i=null;return()=>{if(null!==i)return i;const r=new Blob([t],{type:"application/javascript; charset=utf-8"}),n=URL.createObjectURL(r);return i=e(n),setTimeout(()=>URL.revokeObjectURL(n)),i}})(e=>{const t=new Map([[0,()=>{}]]),i=new Map([[0,()=>{}]]),r=new Map,n=new Worker(e);n.addEventListener("message",e=>{let{data:n}=e;if(void 0!==(s=n).method&&"call"===s.method){const{params:{timerId:e,timerType:s}}=n;if("interval"===s){const i=t.get(e);if("number"===typeof i){const t=r.get(i);if(void 0===t||t.timerId!==e||t.timerType!==s)throw new Error("The timer is in an undefined state.")}else{if("undefined"===typeof i)throw new Error("The timer is in an undefined state.");i()}}else if("timeout"===s){const t=i.get(e);if("number"===typeof t){const i=r.get(t);if(void 0===i||i.timerId!==e||i.timerType!==s)throw new Error("The timer is in an undefined state.")}else{if("undefined"===typeof t)throw new Error("The timer is in an undefined state.");t(),i.delete(e)}}}else{if(!(e=>null===e.error&&"number"===typeof e.id)(n)){const{error:{message:e}}=n;throw new Error(e)}{const{id:e}=n,s=r.get(e);if(void 0===s)throw new Error("The timer is in an undefined state.");const{timerId:a,timerType:o}=s;r.delete(e),"interval"===o?t.delete(a):i.delete(a)}}var s});return{clearInterval:e=>{const i=(0,ge.generateUniqueNumber)(r);r.set(i,{timerId:e,timerType:"interval"}),t.set(e,i),n.postMessage({id:i,method:"clear",params:{timerId:e,timerType:"interval"}})},clearTimeout:e=>{const t=(0,ge.generateUniqueNumber)(r);r.set(t,{timerId:e,timerType:"timeout"}),i.set(e,t),n.postMessage({id:t,method:"clear",params:{timerId:e,timerType:"timeout"}})},setInterval:function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=(0,ge.generateUniqueNumber)(t);return t.set(r,()=>{e(),"function"===typeof t.get(r)&&n.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:r,timerType:"interval"}})}),n.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:r,timerType:"interval"}}),r},setTimeout:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=(0,ge.generateUniqueNumber)(i);return i.set(r,e),n.postMessage({id:null,method:"set",params:{delay:t,now:performance.now(),timerId:r,timerType:"timeout"}}),r}}},'(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error(\'There is no interval scheduled with the given id "\'.concat(t,\'".\'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error(\'The given type "\'.concat(i,\'" is not supported\'));(e=>{const r=t.get(e);if(void 0===r)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error(\'The given method "\'.concat(s.method,\'" is not supported\'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error(\'The given type "\'.concat(d,\'" is not supported\'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();'),me=e=>fe().clearInterval(e),ve=e=>fe().clearTimeout(e),be=(e,t)=>fe().setInterval(e,t),ke=(e,t)=>fe().setTimeout(e,t);var ye=i(9640);e=i.hmd(e);var we=Object.defineProperty,Se=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Ee=Object.getOwnPropertySymbols,Te=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Ce=Reflect.get,Ae=Math.pow,Re=(e,t,i)=>t in e?we(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Le=(e,t)=>{for(var i in t||(t={}))_e.call(t,i)&&Re(e,i,t[i]);if(Ee)for(var i of Ee(t))Pe.call(t,i)&&Re(e,i,t[i]);return e},Ie=(e,t)=>Se(e,xe(t)),Me=(e,t)=>{var i={};for(var r in e)_e.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&Ee)for(var r of Ee(e))t.indexOf(r)<0&&Pe.call(e,r)&&(i[r]=e[r]);return i},De=(e,t,i)=>(Re(e,"symbol"!=typeof t?t+"":t,i),i),Oe=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ne=(e,t,i)=>(Oe(e,t,"read from private field"),i?i.call(e):t.get(e)),Ue=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Fe=(e,t,i,r)=>(Oe(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),je=(e,t,i)=>(Oe(e,t,"access private method"),i),Be=(e,t,i)=>new Promise((r,n)=>{var s=e=>{try{o(i.next(e))}catch(t){n(t)}},a=e=>{try{o(i.throw(e))}catch(t){n(t)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,a);o((i=i.apply(e,t)).next())});Array.prototype.at||Object.assign(Array.prototype,{at:function(e){const{length:t}=this,i=e>=0?e:t+e;return i<0||i>=t?void 0:this[i]}}),String.prototype.at||Object.assign(String.prototype,{at:function(e){const{length:t}=this,i=e>=0?e:t+e;return i<0||i>=t?void 0:this[i]}});const Ve="chrome",ze="opera",He="firefox",$e="iexplorer",Ge="safari",We="nwjs",qe="electron",Ke="react-native",Ze="unknown",Ye={Chrome:Ve,Chromium:Ve,Opera:ze,Firefox:He,"Internet Explorer":$e,Safari:Ge};function Je(){const{userAgent:e}=navigator;if(e.match(/Electron/)){const t=e.match(/Electron\/([\d.]+)/)[1];return{name:qe,version:t}}return null}function Qe(){const{userAgent:e}=navigator;if(e.match(/JitsiMeetNW/)){const t=e.match(/JitsiMeetNW\/([\d.]+)/)[1];return{name:We,version:t}}}function Xe(){const e=navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);let t;if(e||"ReactNative"===navigator.product)return e&&e.length>2&&(e[1],t=e[2]),t||(t="unknown"),{name:Ke,version:t}}function et(e){let t;const i=[Xe,Je,Qe];for(let n=0;n72&&(t.name=Ve,t.version=i)}else t.name=Ve,t.version=e.match(/Chrome\/([\d.]+)/)[1];return t}(),t||{name:Ze,version:void 0})}class tt{constructor(){De(this,"_bowser"),De(this,"_name"),De(this,"_version"),De(this,"getDeviceInfo",()=>({isMobile:this.isMobile(),browserName:this._bowser.getBrowserName(),osName:this._bowser.getOSName(),browserVersion:this._bowser.getBrowserVersion(),osVersionName:this._bowser.getOSVersion(),engineName:this._bowser.getEngineName()}))}init(e){let t,i;if(this._bowser=g().getParser(navigator.userAgent),"undefined"==typeof e){const e=et(this._bowser);t=e.name,i=e.version}else e.name in Ye?(t=Ye[e.name],i=e.version):(t=Ze,i=void 0);this._name=t,this._version=i}getName(){return this._name}isChrome(){return this._name===Ve}isOpera(){return this._name===ze}isFirefox(){return this._name===He}isIExplorer(){return this._name===$e}isSafari(){return this._name===Ge}isNWJS(){return this._name===We}isElectron(){return this._name===qe}isReactNative(){return this._name===Ke||!0===navigator.isReactNative}getVersion(){return this._version}isMobile(){return"mobile"===this._bowser.getPlatformType()}_checkCondition(e){if(this._version)return this._bowser.satisfies(e)}isVersionGreaterThan(e){return this._checkCondition({[this._name]:">".concat(e)})}isVersionLessThan(e){return this._checkCondition({[this._name]:"<".concat(e)})}isVersionEqualTo(e){return this._checkCondition({[this._name]:"~".concat(e)})}}const it=new class extends tt{doesVideoMuteByStreamRemove(){return this.isChromiumBased()||this.isWebKitBased()}supportsP2P(){return!this.usesUnifiedPlan()}isChromiumBased(){return this.isChrome()||this.isElectron()||this.isNWJS()||this.isOpera()}isWebKitBased(){return this._bowser.isEngine("webkit")&&"undefined"!=typeof navigator.mediaDevices&&"undefined"!=typeof navigator.mediaDevices.getUserMedia&&"undefined"!=typeof window.RTCRtpTransceiver&&Object.keys(RTCRtpTransceiver.prototype).indexOf("currentDirection")>-1}isSupported(){return"undefined"!=typeof RTCPeerConnection}isUserInteractionRequiredForUnmute(){return this.isFirefox()&&this.isVersionLessThan("68")}supportsVideoMuteOnConnInterrupted(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}supportsBandwidthStatistics(){return!this.isFirefox()&&!this.isWebKitBased()}supportsCodecPreferences(){return this.usesUnifiedPlan()&&"undefined"!=typeof window.RTCRtpTransceiver&&Object.keys(window.RTCRtpTransceiver.prototype).indexOf("setCodecPreferences")>-1&&Object.keys(RTCRtpSender.prototype).indexOf("getCapabilities")>-1&&!this.isWebKitBased()}supportsDeviceChangeEvent(){return navigator.mediaDevices&&"undefined"!=typeof navigator.mediaDevices.ondevicechange&&"undefined"!=typeof navigator.mediaDevices.addEventListener}supportsLocalCandidateRttStatistics(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}supportsPerformanceObserver(){return"undefined"!=typeof window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes.indexOf("longtask")>-1}supportsReceiverStats(){return"undefined"!=typeof window.RTCRtpReceiver&&Object.keys(RTCRtpReceiver.prototype).indexOf("getSynchronizationSources")>-1}supportsRTTStatistics(){return!this.isFirefox()}usesPlanB(){return!this.usesUnifiedPlan()}usesSdpMungingForSimulcast(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}usesUnifiedPlan(){return!(!this.isFirefox()&&!this.isWebKitBased())}usesNewGumFlow(){return!!(this.isChromiumBased()||this.isFirefox()||this.isWebKitBased())}usesAdapter(){return this.usesNewGumFlow()}usesRidsForSimulcast(){return!1}supportsGetDisplayMedia(){return"undefined"!=typeof navigator.getDisplayMedia||"undefined"!=typeof navigator.mediaDevices&&"undefined"!=typeof navigator.mediaDevices.getDisplayMedia}supportsInsertableStreams(){if("undefined"==typeof window.RTCRtpSender||!window.RTCRtpSender.prototype.createEncodedStreams&&!window.RTCRtpSender.prototype.createEncodedVideoStreams)return!1;const e=new ReadableStream;try{return window.postMessage(e,"*",[e]),!0}catch(t){return!1}}supportsAudioRed(){return Boolean(window.RTCRtpSender&&window.RTCRtpSender.getCapabilities&&window.RTCRtpSender.getCapabilities("audio").codecs.some(e=>"audio/red"===e.mimeType)&&window.RTCRtpReceiver&&window.RTCRtpReceiver.getCapabilities&&window.RTCRtpReceiver.getCapabilities("audio").codecs.some(e=>"audio/red"===e.mimeType))}supportsSdpSemantics(){return this.isChromiumBased()}_getChromiumBasedVersion(){if(this.isChromiumBased()){if(this.isNWJS())return Number.parseInt(process.versions.chromium,10);const e=navigator.userAgent;if(e.match(/Chrome/))return Number.parseInt(e.match(/Chrome\/([\d.]+)/)[1],10)}return-1}isIOSMobile(){return this.isMobile&&"iOS"===this._bowser.getOSName()}};var rt,nt={},st={get exports(){return nt},set exports(e){nt=e}},at="object"==typeof Reflect?Reflect:null,ot=at&&"function"==typeof at.apply?at.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};rt=at&&"function"==typeof at.ownKeys?at.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ct=Number.isNaN||function(e){return e!==e};function lt(){lt.init.call(this)}st.exports=lt,nt.once=function(e,t){return new Promise(function(i,r){function n(i){e.removeListener(t,s),r(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}St(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&St(e,"error",t,i)}(e,n,{once:!0})})},lt.EventEmitter=lt,lt.prototype._events=void 0,lt.prototype._eventsCount=0,lt.prototype._maxListeners=void 0;var dt,ht,ut,pt=10;function gt(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function ft(e){return void 0===e._maxListeners?lt.defaultMaxListeners:e._maxListeners}function mt(e,t,i,r){var n,s,a;if(gt(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),a=s[t]),void 0===a)a=s[t]=i,++e._eventsCount;else if("function"==typeof a?a=s[t]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(n=ft(e))>0&&a.length>n&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=a.length,function(e){console&&console.warn&&console.warn(e)}(o)}return e}function vt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function bt(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=vt.bind(r);return n.listener=i,r.wrapFn=n,n}function kt(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=n[e];if(void 0===o)return!1;if("function"==typeof o)ot(o,this,t);else{var c=o.length,l=wt(o,c);for(i=0;i=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},lt.prototype.listeners=function(e){return kt(this,e,!0)},lt.prototype.rawListeners=function(e){return kt(this,e,!1)},lt.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):yt.call(e,t)},lt.prototype.listenerCount=yt,lt.prototype.eventNames=function(){return this._eventsCount>0?rt(this._events):[]},(ht=dt||(dt={}))[ht.MAJOR_EVENT=0]="MAJOR_EVENT",ht[ht.MINOR_EVENT=1]="MINOR_EVENT",function(e){e.PRECALL_TEST_BEGIN="precall_begin",e.PRECALL_TEST_COMPLETE="precall_end",e.CALL_JOIN_BEGIN="call_join",e.NET_QUALITY_TEST_BEGIN="net_quality_test_begin",e.NET_QUALITY_TEST_END="net_quality_test_end",e.WEBSOCKET_CONNECTED="websocket_connected",e.TRANSPORT_CONNECTED="transport_connected",e.AUDIO_ON="audio_on",e.AUDIO_OFF="audio_off",e.VIDEO_ON="video_on",e.VIDEO_OFF="video_off",e.PARTICIPANT_ROLE="participant_role",e.PING_STAT="ping_stat",e.DISCONNECT="disconnect",e.RECONNECT_ATTEMPT="reconnect_attempt",e.SCREENSHARE_START_REQUESTED="screenshare_start_requested",e.SCREENSHARE_STARTED="screenshare_started",e.SCREENSHARE_STOPPED="screenshare_stopped",e.TAB_CHANGE="tab_change",e.BROWSER_BACKGROUNDED="browser_backgrounded",e.BROWSER_FOREGROUNDED="browser_foregrounded",e.DOMINANT_SPEAKER="dominant_speaker",e.AUDIO_DEVICES_UPDATES="audio_devices_updates",e.VIDEO_DEVICES_UPDATES="video_devices_updates",e.SPEAKER_DEVICES_UPDATES="speaker_devices_updates",e.SELECTED_MICROHPONE_UPDATE="selected_microphone_update",e.SELECTED_CAMERA_UPDATE="selected_camera_update",e.SELECTED_SPEAKER_UPDATE="selected_speaker_update",e.EXPECTED_VIDEO_RESOLUTION="expected_video_resolution",e.EXPECTED_SCREENSHARE_RESOLUTION="expected_screenshare_resolution",e.MEDIA_PERMISSION="media_permission",e.LEGACY_SWITCH="legacy_switch",e.AUDIO_PLAY_FAILED="audio_play_failed",e.VIDEO_PLAY_FAILED="video_play_failed",e.AUDIO_TRACK_MUTED="audio_track_muted",e.VIDEO_TRACK_MUTED="video_track_muted",e.IVS_PLAYER_REBUFFERING="ivs_player_rebuffering",e.IVS_PLAYER_AUDIO_BLOCKED="ivs_player_audio_blocked",e.IVS_PLAYER_PLAYBACK_BLOCKED="ivs_player_playback_blocked",e.IVS_PLAYER_ERROR="ivs_player_error",e.IVS_PLAYER_RECOVERABLE_ERROR="ivs_player_recoverable_error",e.IVS_PLAYER_WORKER_ERROR="ivs_player_worker_error",e.IVS_PLAYER_NETWORK_UNAVAILABLE="ivs_player_network_unavailable",e.LIVESTREAM_LATENCY="livestream_latency",e.IVS_PLAYER_ANALYTICS_EVENT="ivs_player_analytics_event",e.IVS_PLAYER_PLAYBACK_RATE_CHANGED="ivs_player_playback_rate_changed",e.IVS_PLAYER_QUALITY_CHANGED="ivs_player_quality_changed",e.IVS_PLAYER_INITIALIZED="ivs_player_initialized"}(ut||(ut={}));const xt=new Map([[ut.PRECALL_TEST_BEGIN,dt.MINOR_EVENT],[ut.PRECALL_TEST_COMPLETE,dt.MINOR_EVENT],[ut.CALL_JOIN_BEGIN,dt.MAJOR_EVENT],[ut.NET_QUALITY_TEST_BEGIN,dt.MINOR_EVENT],[ut.NET_QUALITY_TEST_END,dt.MINOR_EVENT],[ut.WEBSOCKET_CONNECTED,dt.MINOR_EVENT],[ut.TRANSPORT_CONNECTED,dt.MAJOR_EVENT],[ut.AUDIO_ON,dt.MINOR_EVENT],[ut.AUDIO_OFF,dt.MINOR_EVENT],[ut.VIDEO_ON,dt.MINOR_EVENT],[ut.VIDEO_OFF,dt.MINOR_EVENT],[ut.PARTICIPANT_ROLE,dt.MINOR_EVENT],[ut.PING_STAT,dt.MAJOR_EVENT],[ut.DISCONNECT,dt.MAJOR_EVENT],[ut.RECONNECT_ATTEMPT,dt.MAJOR_EVENT],[ut.SCREENSHARE_START_REQUESTED,dt.MINOR_EVENT],[ut.SCREENSHARE_STARTED,dt.MINOR_EVENT],[ut.SCREENSHARE_STOPPED,dt.MINOR_EVENT],[ut.TAB_CHANGE,dt.MINOR_EVENT],[ut.BROWSER_BACKGROUNDED,dt.MINOR_EVENT],[ut.BROWSER_FOREGROUNDED,dt.MINOR_EVENT],[ut.DOMINANT_SPEAKER,dt.MINOR_EVENT],[ut.AUDIO_DEVICES_UPDATES,dt.MINOR_EVENT],[ut.VIDEO_DEVICES_UPDATES,dt.MINOR_EVENT],[ut.SPEAKER_DEVICES_UPDATES,dt.MINOR_EVENT],[ut.SELECTED_MICROHPONE_UPDATE,dt.MINOR_EVENT],[ut.SELECTED_CAMERA_UPDATE,dt.MINOR_EVENT],[ut.SELECTED_SPEAKER_UPDATE,dt.MINOR_EVENT],[ut.MEDIA_PERMISSION,dt.MINOR_EVENT],[ut.LEGACY_SWITCH,dt.MINOR_EVENT],[ut.AUDIO_PLAY_FAILED,dt.MINOR_EVENT],[ut.VIDEO_PLAY_FAILED,dt.MINOR_EVENT],[ut.AUDIO_TRACK_MUTED,dt.MINOR_EVENT],[ut.VIDEO_TRACK_MUTED,dt.MINOR_EVENT],[ut.IVS_PLAYER_REBUFFERING,dt.MAJOR_EVENT],[ut.IVS_PLAYER_AUDIO_BLOCKED,dt.MAJOR_EVENT],[ut.IVS_PLAYER_PLAYBACK_BLOCKED,dt.MAJOR_EVENT],[ut.IVS_PLAYER_ERROR,dt.MAJOR_EVENT],[ut.IVS_PLAYER_RECOVERABLE_ERROR,dt.MAJOR_EVENT],[ut.IVS_PLAYER_WORKER_ERROR,dt.MAJOR_EVENT],[ut.IVS_PLAYER_NETWORK_UNAVAILABLE,dt.MAJOR_EVENT],[ut.LIVESTREAM_LATENCY,dt.MAJOR_EVENT],[ut.IVS_PLAYER_ANALYTICS_EVENT,dt.MINOR_EVENT],[ut.IVS_PLAYER_PLAYBACK_RATE_CHANGED,dt.MINOR_EVENT],[ut.IVS_PLAYER_QUALITY_CHANGED,dt.MINOR_EVENT],[ut.IVS_PLAYER_INITIALIZED,dt.MINOR_EVENT],[ut.EXPECTED_VIDEO_RESOLUTION,dt.MINOR_EVENT],[ut.EXPECTED_SCREENSHARE_RESOLUTION,dt.MINOR_EVENT]]);class Et{constructor(){De(this,"events"),this.events=[]}add(e){this.events.push(e)}flush(){return{entries:this.events.splice(0,25)}}}class Tt extends nt{constructor(e){let{logger:t,peerId:i,apiHostnames:r}=e;super(),De(this,"logger"),De(this,"peerId"),De(this,"eventStore"),De(this,"apiEndpoint"),this.logger=t,this.peerId=i,this.apiEndpoint="https://".concat(r.daCollector,"/api/v1/message"),this.eventStore=new Et}sendEventsChunkToServer(e){return Be(this,null,function*(){var t;const i={payload:e,peerId:this.peerId};try{return yield fetch(this.apiEndpoint,{method:"POST",body:JSON.stringify(i)}),!0}catch(r){return this.logger.error("callStats::sendEventsChunkToServer::catch",{error:r}),null==(t=e.entries)||t.forEach(e=>{this.eventStore.add(e)}),!1}})}callEvent(e){e.timestamp=new Date,this.eventStore.add(e),this.emit(e.event,e.metaData),xt.get(e.event)===dt.MAJOR_EVENT&&this.flush()}flush(){return Be(this,null,function*(){var e;const t=this.eventStore.flush();return!(null==(e=null==t?void 0:t.entries)||!e.length)&&(yield this.sendEventsChunkToServer(t),!0)})}}var _t;!function(e){e.CHROMIUM="chromum",e.FIREFOX="firefox",e.SAFARI="safari"}(_t||(_t={}));const Pt={DEVEL:"devel",PREPROD:"preprod",PROD:"prod"};var Ct,At;function Rt(e){return e?e.split(".").slice(0,2).concat(["0","0"]).join("."):""}function Lt(e){let{packetsLost:t,packetsSent:i}=e;return i>0?100*t/i:0}function It(e){let{packetsLost:t,packetsReceived:i}=e;return i+t>0?100*t/(i+t):0}!function(e){e.AUDIO="AUDIO",e.VIDEO="VIDEO",e.SPEAKER="SPEAKER",e.SCREENSHARE="SCREENSHARE"}(Ct||(Ct={})),function(e){e[e.INIT=0]="INIT",e[e.ACCEPTED=1]="ACCEPTED",e[e.DENIED=2]="DENIED",e[e.SYS_DENIED=3]="SYS_DENIED",e[e.FAILED=4]="FAILED",e[e.NOTFOUND=5]="NOTFOUND",e[e.NOT_APPLICABLE=6]="NOT_APPLICABLE"}(At||(At={}));const Mt=.02,Dt=.03;function Ot(e){let{stat:t,weight:i,rangeMin:r,rangeMax:n,rangeRankingDirection:s}=e;return null==t?i:r===n?"UP"===s?t<=r?i:0:t>=n?i:0:"UP"===s?(1-Math.max(Math.min(n,Math.abs(t))-r,0)/(n-r))*i:"DOWN"===s?Math.max(Math.min(n,Math.abs(t))-r,0)/(n-r)*i:i}function Nt(e){let{isLowQualityVideo:t,isVideoStuck:i,isVideoLagging:r,jitterQuality:n,packetsLostQuality:s}=e;const a=(t?.85:1)*(r?.7:1)*(i?.5:1)*.8+n*s*.2;return Math.round(100*(a+Number.EPSILON))/100}function Ut(e){let{packetsLost:t,packetsSent:i}=e;return i>0?100*t/i:0}function Ft(e){let{packetsLost:t,packetsSent:i,jitter:r}=e;return Ot({stat:Ut({packetsLost:t,packetsSent:i}),weight:.7,rangeMin:0,rangeMax:10,rangeRankingDirection:"UP"})+Ot({stat:r,weight:.3,rangeMin:Mt,rangeMax:Dt,rangeRankingDirection:"UP"})}function jt(e){let{frameWidth:t,framesPerSecond:i,packetsLost:r,packetsSent:n,jitter:s,isScreenShare:a,framesEncoded:o}=e;const c=Ot({stat:Ut({packetsLost:r,packetsSent:n}),weight:1,rangeMin:0,rangeMax:10,rangeRankingDirection:"UP"}),l=Ot({stat:s,weight:1,rangeMin:Mt,rangeMax:Dt,rangeRankingDirection:"UP"}),d=function(e){let{frameWidth:t,isScreenShare:i}=e;return t<(i?720:240)}({frameWidth:t,isScreenShare:a}),h=function(e){let{framesPerSecond:t,isScreenShare:i}=e;return t<(i?3:8)}({framesPerSecond:i,isScreenShare:a}),u=function(e){let{framesEncoded:t}=e;return 0===t}({framesEncoded:o,isScreenShare:a});return Nt({isLowQualityVideo:d,isVideoLagging:h,isVideoStuck:u,jitterQuality:l,packetsLostQuality:c})}function Bt(e){let{packetsLost:t,packetsReceived:i}=e;return i+t>0?100*t/(i+t):0}function Vt(e){let{concealmentEvents:t,packetsLost:i,packetsReceived:r,jitter:n}=e;return Ot({stat:t,weight:.2,rangeMin:0,rangeMax:3,rangeRankingDirection:"UP"})+Ot({stat:Bt({packetsLost:i,packetsReceived:r}),weight:.5,rangeMin:0,rangeMax:10,rangeRankingDirection:"UP"})+Ot({stat:n,weight:.3,rangeMin:Mt,rangeMax:Dt,rangeRankingDirection:"UP"})}function zt(e){let{frameWidth:t,framesPerSecond:i,packetsLost:r,packetsReceived:n,jitter:s,isScreenShare:a,framesDecoded:o}=e;const c=Ot({stat:Bt({packetsLost:r,packetsReceived:n}),weight:1,rangeMin:0,rangeMax:10,rangeRankingDirection:"UP"}),l=Ot({stat:s,weight:1,rangeMin:Mt,rangeMax:Dt,rangeRankingDirection:"UP"}),d=function(e){let{frameWidth:t,isScreenShare:i}=e;return t<(i?720:240)}({frameWidth:t,isScreenShare:a}),h=function(e){let{framesPerSecond:t,isScreenShare:i}=e;return t<(i?3:8)}({framesPerSecond:i,isScreenShare:a}),u=function(e){let{framesDecoded:t}=e;return 0===t}({framesDecoded:o,isScreenShare:a});return Nt({isLowQualityVideo:d,isVideoLagging:h,isVideoStuck:u,jitterQuality:l,packetsLostQuality:c})}class Ht{constructor(e){De(this,"pc1"),De(this,"pc2"),De(this,"constrainVideoBitrateKbps"),De(this,"constrainOfferToRemoveVideoFec",!1),De(this,"iceCandidateFilter");const t=new RTCPeerConnection(e),i=new RTCPeerConnection(e);this.pc1=t,this.pc2=i,this.iceCandidateFilter=Ht.noFilter,this.pc1.addEventListener("icecandidate",this.onIceCandidate.bind(this,this.pc2)),this.pc2.addEventListener("icecandidate",this.onIceCandidate.bind(this,this.pc1))}static parseCandidate(e){const t="candidate:",i=e.indexOf(t)+10,r=e.substr(i).split(" ");return{type:r[7],protocol:r[2],address:r[4]}}static isNotHostCandidate(e){return"host"!==e.type}static isHost(e){return"host"===e.type}static isRelay(e){return"relay"===e.type}static isReflexive(e){return"srflx"===e.type}static noFilter(e){return!0}onIceCandidate(e,t){if(t.candidate){const i=Ht.parseCandidate(t.candidate.candidate);this.iceCandidateFilter(i)&&e.addIceCandidate(t.candidate)}}setIceCandidateFilter(e){this.iceCandidateFilter=e}constrainVideoBitrate(e){this.constrainVideoBitrateKbps=e}disableVideoFec(){this.constrainOfferToRemoveVideoFec=!0}gotOffer(e){this.constrainOfferToRemoveVideoFec&&(e.sdp=e.sdp.replace(/(m=video 1 [^\r]+)(116 117)(\r\n)/g,"$1\r\n"),e.sdp=e.sdp.replace(/a=rtpmap:116 red\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=rtpmap:117 ulpfec\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=rtpmap:98 rtx\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=fmtp:98 apt=116\r\n/g,"")),this.pc1.setLocalDescription(e),this.pc2.setRemoteDescription(e),this.pc2.createAnswer().then(this.gotAnswer.bind(this),this.reportFatal.bind(this))}gotAnswer(e){this.constrainVideoBitrateKbps&&(e.sdp=e.sdp.replace(/a=mid:video\r\n/g,"a=mid:video\r\nb=AS:".concat(this.constrainVideoBitrateKbps,"\r\n"))),this.pc2.setLocalDescription(e),this.pc1.setRemoteDescription(e)}establishConnection(){this.pc1.createOffer().then(this.gotOffer.bind(this),this.reportFatal.bind(this))}reportFatal(e){console.error("Error:",e)}getRoundTripTime(){return Be(this,null,function*(){const[e,t]=yield Promise.all([this.pc1.getStats(),this.pc2.getStats()]);let i,r;if(e.forEach(e=>{"candidate-pair"===e.type&&!0===e.nominated&&e.bytesSent>0&&(i=e)}),t.forEach(e=>{"candidate-pair"===e.type&&!0===e.nominated&&e.bytesReceived>0&&(r=e)}),i&&r)try{if(i.currentRoundTripTime&&r.currentRoundTripTime)return{rtt:i.currentRoundTripTime,backendRTT:r.currentRoundTripTime};const e=(r.lastPacketReceivedTimestamp-i.lastPacketSentTimestamp)/1e3;return{rtt:e,backendRTT:e}}catch(n){return}})}close(){this.pc1.close(),this.pc2.close()}}class $t extends nt{constructor(e){super(),De(this,"call"),De(this,"timeOut"),this.call=new Ht(e)}start(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;this.call.establishConnection(),this.timeOut=setTimeout(this.testFailed.bind(this),e)}testComplete(e){clearTimeout(this.timeOut),this.call.close(),this.emit("done",e)}testFailed(e){this.call.close(),this.emit("failed",e)}}class Gt extends $t{constructor(e){super(e),De(this,"senderChannel"),De(this,"recieveChannel"),De(this,"startTime"),De(this,"lastBitrateMeasureTime"),De(this,"sentPayloadBytes",0),De(this,"recievedPayloadBytes",0),De(this,"lastReceivedPayloadBytes",0),De(this,"stopSending",!1),De(this,"testProgress",0),De(this,"samplePacket",""),De(this,"finalBitrateSum",0),De(this,"bitRateSampels",0),De(this,"maxNumberOfPacketsToSend",0),De(this,"bytesToKeepBuffered",0),De(this,"testDurationSeconds",5),this.call.setIceCandidateFilter(Ht.isNotHostCandidate),this.senderChannel=this.call.pc1.createDataChannel(null);for(let t=0;t<262144;t+=1)this.samplePacket+="h";this.maxNumberOfPacketsToSend=1,this.bytesToKeepBuffered=1024*this.maxNumberOfPacketsToSend,this.testDurationSeconds=4,this.senderChannel.addEventListener("open",this.sendingStep.bind(this)),this.call.pc2.addEventListener("datachannel",this.onRecieverChannel.bind(this))}sendingStep(){const e=new Date;this.startTime||(this.startTime=e,this.lastBitrateMeasureTime=e);for(let r=0;r!==this.maxNumberOfPacketsToSend&&!(this.senderChannel.bufferedAmount>=this.bytesToKeepBuffered);r+=1){this.sentPayloadBytes+=this.samplePacket.length;try{this.senderChannel.send(this.samplePacket)}catch(i){}}const t=e.getTime()-this.startTime.getTime();t>=1e3*this.testDurationSeconds?(this.stopSending=!0,this.testProgress=100):(this.testProgress=t/(10*this.testDurationSeconds),setTimeout(this.sendingStep.bind(this),1))}onMessageRecieved(e){this.recievedPayloadBytes+=e.data.length;const t=new Date,i=t.getTime()-this.lastBitrateMeasureTime.getTime();if(i>=1e3){const e=8*(this.recievedPayloadBytes-this.lastReceivedPayloadBytes)/(i/1e3);this.finalBitrateSum+=e,this.bitRateSampels+=1,this.lastReceivedPayloadBytes=this.recievedPayloadBytes,this.lastBitrateMeasureTime=t}if(this.stopSending&&this.sentPayloadBytes===this.recievedPayloadBytes){const e=this.finalBitrateSum/this.bitRateSampels;this.testComplete({throughput:Math.round(.001*e)})}}testComplete(e){this.call.getRoundTripTime().then(t=>{let{rtt:i,backendRTT:r}=t;return super.testComplete({RTT:i,backendRTT:r,throughput:e.throughput})})}onRecieverChannel(e){this.recieveChannel=e.channel,this.recieveChannel.addEventListener("message",this.onMessageRecieved.bind(this))}}class Wt extends $t{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ht.noFilter;super(e),De(this,"ch1"),De(this,"ch2"),this.call.setIceCandidateFilter(t);const i=this.call.pc1.createDataChannel(null);this.ch1=i,i.addEventListener("open",()=>{i.send("hello")}),i.addEventListener("message",this.onCh1Recieve.bind(this)),this.call.pc2.addEventListener("datachannel",this.dataChannelHandler.bind(this))}onCh1Recieve(e){"world"!==e.data?this.hangup("Invalid data transmitted."):this.testComplete({connectivity:!0})}onCh2Recieve(e){if("hello"!==e.data)this.hangup("Invalid data transmitted.");else try{this.ch2.send("world")}catch(t){}}dataChannelHandler(e){const t=e.channel;this.ch2=t,t.addEventListener("message",this.onCh2Recieve.bind(this))}hangup(e){this.testFailed(e)}}class qt extends Wt{constructor(e){super(e,Ht.isHost)}}class Kt extends Wt{constructor(e){super(e,Ht.isRelay)}}class Zt extends Wt{constructor(e){super(e,Ht.isReflexive)}}const Yt=new class{constructor(){De(this,"ipInformation",null)}getIPDetails(e){return Be(this,arguments,function(e){var t=this;let{peerId:i,apiHostnames:r,logger:n}=e;return function*(){var e,s,a;if(!t.ipInformation){try{const i="https://".concat(r.location),n=yield(yield fetch(i)).json();if((null==(e=n.loc)?void 0:e.length)>5)return t.ipInformation=n,null!=(s=t.ipInformation)&&s.ip&&(t.ipInformation.ip=Rt(t.ipInformation.ip)),n;throw Error("Insufficient data")}catch(o){n.error("callstats::ipDetails:: failed to fetch ip using location service",{error:o})}try{const e=yield fetch("https://".concat(r.locationLegacy,"/?token=3c493932b0624c&peerId=").concat(i),{method:"POST"});t.ipInformation=yield e.json(),null!=(a=t.ipInformation)&&a.ip&&(t.ipInformation.ip=Rt(t.ipInformation.ip))}catch(o){n.error("callstats::ipDetails:: failed to fetch ip using legacy location service",{error:o})}}return t.ipInformation}()})}resetCache(){this.ipInformation=null}},Jt=[{urls:"turn:turn.dyte.in:443?transport=tcp",username:"dyte",credential:"dytein",credentialType:"password"},{urls:"turn:turn.dyte.in:3478?transport=udp",username:"dyte",credential:"dytein",credentialType:"password"}];function Qt(e){const[t,i]=e.split(",");return{coords:{latitude:Number(t),longitude:Number(i)}}}class Xt{constructor(){De(this,"transport"),De(this,"candidatePair"),De(this,"outboundVideoRtp",new Map),De(this,"inboundVideoRtp",new Map),De(this,"outboundAudioRtp",new Map),De(this,"inboundAudioRtp",new Map),De(this,"remoteInboundRtp",new Map),De(this,"producerStreamMap",new Map),De(this,"consumerStreamMap",new Map),De(this,"staleProducerStreamMap",!1),De(this,"staleConsumerStreamMap",!1)}}class ei extends nt{constructor(){super(),De(this,"observer"),De(this,"outboundProducerMap",new Map),De(this,"inboundConsumerMap",new Map),De(this,"consumerPeerIdMap",new Map),De(this,"pausedConsumerMap",new Map),De(this,"pausedProducerMap",new Map),De(this,"overallProducingTransportsStatsMap",{}),De(this,"overallConsumingTransportsStatsMap",{}),De(this,"overallConsumersStatsMap",{}),De(this,"overallProducersStatsMap",{}),De(this,"videoProducerToStatsMap",new Map),De(this,"audioProducerToStatsMap",new Map),De(this,"videoConsumerToStatsMap",new Map),De(this,"audioConsumerToStatsMap",new Map),De(this,"consumerIdsWithFreezedVideo",new Set),De(this,"consumerIdsWithFreezedAudio",new Set),De(this,"producerIdsWithFreezedVideo",new Set),De(this,"producerIdsWithFreezedAudio",new Set),De(this,"freezedProducingTransportIds",new Set),De(this,"freezedConsumingTransportIds",new Set),De(this,"screenShareProducers",new Set),De(this,"screenShareConsumers",new Set),De(this,"ipDetails"),De(this,"callStatsInstance"),this.observer=new nt}registerProducer(e){return Be(this,null,function*(){yield this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),!0===e.appData.screenShare&&this.screenShareProducers.add(e.id)})}pauseProducer(e){this.pausedProducerMap.set(e,{lastReportCalculated:!1})}resumeProducer(e){this.pausedProducerMap.delete(e)}processInboundConsumerVideoStats(e,t,i){var r,n;const s=(null==(n=null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.consumerSharedMediaStatesMap)?void 0:n.get(e))||{};t.totalVideoPacketsReceived===i.packetsReceived?(this.consumerIdsWithFreezedVideo.add(e),this.callStatsInstance&&s.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","pause",e))):(t.totalVideoPacketsReceived=i.packetsReceived,this.consumerIdsWithFreezedVideo.has(e)&&(this.consumerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&s.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","resume",e))))}processInboundConsumerAudioStats(e,t,i){var r,n;const s=(null==(n=null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.consumerSharedMediaStatesMap)?void 0:n.get(e))||{};t.totalAudioPacketsReceived===i.packetsReceived?(this.consumerIdsWithFreezedAudio.add(e),this.callStatsInstance&&s.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","pause",e))):(t.totalAudioPacketsReceived=i.packetsReceived,this.consumerIdsWithFreezedAudio.has(e)&&(this.consumerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&s.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","resume",e))))}processOutboundProducerVideoStats(e,t,i){var r;const n=(null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.currentUserMediaStates)||{};t.totalVideoPacketsSent===i.packetsSent?(this.producerIdsWithFreezedVideo.add(e),this.callStatsInstance&&n.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","pause",e))):(t.totalVideoPacketsSent=i.packetsSent,this.producerIdsWithFreezedVideo.has(e)&&(this.producerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&n.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","resume",e))))}processOutboundProducerAudioStats(e,t,i){var r;const n=(null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.currentUserMediaStates)||{};t.totalAudioPacketsSent===i.packetsSent?(this.producerIdsWithFreezedAudio.add(e),this.callStatsInstance&&n.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","pause",e))):(t.totalAudioPacketsSent=i.packetsSent,this.producerIdsWithFreezedAudio.has(e)&&(this.producerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&n.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","resume",e))))}processProducingTransportStats(e,t,i){var r;const n=(null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.currentUserMediaStates)||{},{audio:s,video:a,screen:o}=n,c=s||a||o;t.totalPacketsSent===i.packetsSent?(this.freezedProducingTransportIds.add(e),this.callStatsInstance&&c&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","pause",e))):(t.totalPacketsSent=i.packetsSent,this.freezedProducingTransportIds.has(e)&&(this.freezedProducingTransportIds.delete(e),this.callStatsInstance&&c&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","resume",e))))}processConsumingTransportStats(e,t,i){var r,n;const s=!!Array.from((null==(n=null==(r=null==this?void 0:this.callStatsInstance)?void 0:r.consumerSharedMediaStatesMap)?void 0:n.values())||[]).reduce((e,t)=>e||t.audio||t.video||t.screen,!1);t.totalPacketsReceived===i.packetsSent?(this.freezedConsumingTransportIds.add(e),this.callStatsInstance&&s&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","pause",e))):(t.totalPacketsReceived=i.packetsSent,this.freezedConsumingTransportIds.has(e)&&(this.freezedConsumingTransportIds.delete(e),this.callStatsInstance&&s&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","resume",e))))}registerConsumer(e){return Be(this,null,function*(){yield this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),!0===e.appData.screenShare&&this.screenShareConsumers.add(e.id)})}pauseConsumer(e){this.pausedConsumerMap.set(e,{lastReportCalculated:!1})}resumeConsumer(e){this.pausedConsumerMap.delete(e)}generateProducerStreamMap(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){const i=yield e.getStats(),r=t?this.getProducerStatsFromReport(this.parseRTCReport(i,["outbound-rtp","remote-inbound-rtp"],!1,e.id))[0]:void 0;for(const t of i.values())if("outbound-rtp"===t.type)this.outboundProducerMap.set(t.id,e.id);return r})}generateConsumerStreamMap(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){const i=yield e.getStats(),r=t?this.getConsumerStatsFromReport(this.parseRTCReport(i,["inbound-rtp"],!1,e.id))[0]:void 0;for(const t of i.values())if("inbound-rtp"===t.type)this.inboundConsumerMap.set(t.id,e.id);return r})}deregisterProducer(e){this.outboundProducerMap.forEach((t,i)=>{t===e.id&&this.outboundProducerMap.delete(i)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.inboundConsumerMap.forEach((t,i)=>{t===e.id&&this.inboundConsumerMap.delete(i)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var t;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:null!=(t=e.relayProtocol)?t:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}getWorkingSimulcastVideoStats(e){return e.find(e=>{const t=e.framesEncoded>0,i=e.packetsSent>0,r=e.frameWidth&&e.frameHeight;return t&&i&&!!r})||e[e.length-1]}parseRTCReport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;var s,a,o,c,l,d,h,u,p,g,f,m,v;const b=e,k=new Xt,y=t.length?new Set(t):void 0,w=[],S=[],x=[],E=new Map,T=new Map;for(const P of b.values()){if(y){if(0===y.size)break;if(!y.has(P.type))continue;i&&y.delete(P.type)}switch(P.type){case"local-candidate":w.push(this.getIceCandidateStats(P));break;case"remote-candidate":S.push(this.getIceCandidateStats(P));break;case"candidate-pair":{const{nominated:e}=P,{selected:t}=P,i=P,r={nominated:null!=e?e:t,currentRoundTripTime:i.currentRoundTripTime,totalRoundTripTime:i.totalRoundTripTime,bytesReceived:i.bytesReceived,bytesSent:i.bytesSent,availableOutgoingBitrate:i.availableOutgoingBitrate,availableIncomingBitrate:i.availableIncomingBitrate,lastPacketReceivedTimestamp:i.lastPacketReceivedTimestamp,lastPacketSentTimestamp:i.lastPacketSentTimestamp,localCandidateId:i.localCandidateId,remoteCandidateId:i.remoteCandidateId,bytesDiscardedOnSend:i.bytesDiscardedOnSend,packetsSent:i.packetsSent,packetsReceived:i.packetsReceived,packetsDiscardedOnSend:i.packetsDiscardedOnSend};x.push(r),(!0===P.nominated||!0===P.selected)&&(k.candidatePair=r);break}case"transport":{const e=P;n&&(n.producing&&(this.overallProducingTransportsStatsMap[n.id]||(this.overallProducingTransportsStatsMap[n.id]={totalPacketsSent:0})),n.consuming&&(this.overallConsumingTransportsStatsMap[n.id]||(this.overallConsumingTransportsStatsMap[n.id]={totalPacketsReceived:0})));const t={bytesReceived:e.bytesReceived,bytesSent:e.bytesSent,packetsSent:e.packetsSent,packetsReceived:e.packetsReceived,dtlsCipher:e.dtlsCipher,dtlsState:e.dtlsState,iceRole:e.iceRole};if(k.transport=t,n){if(n.producing){const e=this.overallProducingTransportsStatsMap[n.id];this.processProducingTransportStats(n.id,e,t)}if(n.consuming){const e=this.overallConsumingTransportsStatsMap[n.id];this.processConsumingTransportStats(n.id,e,t)}}break}case"remote-inbound-rtp":{const e=P,t={jitter:e.jitter,fractionLost:e.fractionLost,roundTripTime:e.roundTripTime,roundTripTimeMeasurements:e.roundTripTimeMeasurements,totalRoundTripTime:e.totalRoundTripTime,packetsLost:e.packetsLost};k.remoteInboundRtp.set(e.localId,t);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(P.id))break;const e=P,t=r||this.outboundProducerMap.get(P.id),i=this.pausedProducerMap.get(t);if(i){if(!0===i.lastReportCalculated)break;this.pausedProducerMap.set(t,{lastReportCalculated:!0})}this.overallProducersStatsMap[t]||(this.overallProducersStatsMap[t]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const n=this.overallProducersStatsMap[t];if(["video","audio"].includes(e.mediaType)||["video","audio"].includes(e.kind)){if(!this.outboundProducerMap.has(P.id)){k.staleProducerStreamMap=!0;break}const i=this.callStatsInstance.producers.get(t);if("ended"===(null==(s=null==i?void 0:i.track)?void 0:s.readyState))break;k.producerStreamMap.has(t)||k.producerStreamMap.set(t,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const r={bytesSent:e.bytesSent,packetsSent:e.packetsSent,nackCount:e.nackCount,ssrc:e.ssrc,mid:e.mid,active:e.active,codecId:e.codecId,headerBytesSent:e.headerBytesSent||0,totalPacketSendDelay:e.totalPacketSendDelay||0};if("video"===e.mediaType||"video"===e.kind){const i=e,s=Le({frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesEncoded:i.framesEncoded,framesDropped:i.framesDropped,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,keyFramesEncoded:i.keyFramesEncoded,firCount:i.firCount,encoderImplementation:i.encoderImplementation,hugeFramesSent:i.hugeFramesSent,pliCount:i.pliCount,qpSum:i.qpSum,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,totalEncodeTime:i.targetBitrate,totalPacketSendDelay:i.totalPacketSendDelay,retransmittedBytesSent:i.retransmittedBytesSent,retransmittedPacketsSent:i.retransmittedPacketsSent,scalabilityMode:i.scalabilityMode,powerEfficientEncoder:i.powerEfficientEncoder},r);k.outboundVideoRtp.set(P.id,s),k.producerStreamMap.get(t).outboundVideoRtpId.push(P.id),this.processOutboundProducerVideoStats(t,n,s)}else if("audio"===e.mediaType||"audio"===e.kind){const i=e,s=Le({retransmittedBytesSent:i.retransmittedBytesSent,retransmittedPacketsSent:i.retransmittedPacketsSent},r);k.outboundAudioRtp.set(P.id,s),k.producerStreamMap.get(t).outboundAudioRtpId.push(P.id),this.processOutboundProducerAudioStats(t,n,s)}}else this.callStatsInstance.logger.error("Callstats: Unknown Outbound-rtp. mediatype: ".concat(e.mediaType," kind: ").concat(e.kind));break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(P.id))break;const e=P,t=r||this.inboundConsumerMap.get(P.id),i=this.pausedConsumerMap.get(t);if(i){if(!0===i.lastReportCalculated)break;this.pausedConsumerMap.set(t,{lastReportCalculated:!0})}if(1234===e.ssrc)break;this.overallConsumersStatsMap[t]||(this.overallConsumersStatsMap[t]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const n=this.overallConsumersStatsMap[t];if(["video","audio"].includes(e.mediaType)||["video","audio"].includes(e.kind)){if(!this.inboundConsumerMap.has(P.id)){k.staleConsumerStreamMap=!0;break}k.consumerStreamMap.has(t)||k.consumerStreamMap.set(t,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const i={bytesReceived:e.bytesReceived,packetsReceived:e.packetsReceived,packetsLost:e.packetsLost>=0?e.packetsLost:0,jitter:e.jitter,nackCount:e.nackCount,jitterBufferDelay:e.jitterBufferDelay,jitterBufferEmittedCount:e.jitterBufferEmittedCount,lastPacketReceivedTimestamp:e.lastPacketReceivedTimestamp,ssrc:e.ssrc,mid:e.mid,codecId:e.codecId,headerBytesReceived:e.headerBytesReceived||0,packetsDiscarded:e.packetsDiscarded||0,jitterBufferMinimumDelay:e.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:e.jitterBufferTargetDelay||0};if("video"===e.mediaType||"video"===e.kind){const r=e,s=Le({frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped,framesPerSecond:r.framesPerSecond,framesReceived:r.framesReceived,keyFramesDecoded:r.keyFramesDecoded,firCount:r.firCount,decoderImplementation:r.decoderImplementation,pliCount:r.pliCount,totalProcessingDelay:r.totalProcessingDelay,qpSum:r.qpSum||0,totalAssemblyTime:r.totalAssemblyTime||0,totalDecodeTime:r.totalDecodeTime||0,totalFreezesDuration:r.totalFreezesDuration||0,totalInterFrameDelay:r.totalInterFrameDelay||0,totalPausesDuration:r.totalPausesDuration||0,totalSquaredInterFrameDelay:r.totalSquaredInterFrameDelay||0,freezeCount:r.freezeCount||0,pauseCount:r.pauseCount||0,powerEfficientDecoder:r.powerEfficientDecoder},i);s.score=zt({frameWidth:s.frameWidth||0,framesDecoded:(s.framesDecoded||0)-((null==(a=this.videoConsumerToStatsMap.get(t))?void 0:a.framesDecoded)||0),framesPerSecond:s.framesPerSecond||0,packetsLost:(s.packetsLost||0)-((null==(o=this.videoConsumerToStatsMap.get(t))?void 0:o.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(c=this.videoConsumerToStatsMap.get(t))?void 0:c.packetsReceived)||0),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t)}),T.set(t,{score:+(10*s.score).toFixed(),frameWidth:s.frameWidth||0,frameHeight:s.frameHeight||0,framesPerSecond:s.framesPerSecond||0,packetsLostPercentage:It({packetsLost:(s.packetsLost||0)-((null==(l=this.videoConsumerToStatsMap.get(t))?void 0:l.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(d=this.videoConsumerToStatsMap.get(t))?void 0:d.packetsReceived)||0)}),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t),bitrate:8*((s.bytesReceived||0)-((null==(h=this.videoConsumerToStatsMap.get(t))?void 0:h.bytesReceived)||0))/7}),this.videoConsumerToStatsMap.set(t,s),k.inboundVideoRtp.set(P.id,s),k.consumerStreamMap.get(t).inboundVideoRtpId.push(P.id),this.processInboundConsumerVideoStats(t,n,s)}else if("audio"===e.mediaType||"audio"===e.kind){const r=e,s=Le({audioLevel:r.audioLevel,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration,totalSamplesReceived:r.totalSamplesReceived,fecPacketsDiscarded:r.fecPacketsDiscarded||0,fecPacketsReceived:r.fecPacketsReceived||0,insertedSamplesForDeceleration:r.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:r.removedSamplesForAcceleration||0,silentConcealedSamples:r.silentConcealedSamples||0,playoutId:r.playoutId},i);s.score=Vt({concealmentEvents:(s.concealmentEvents||0)-((null==(u=this.audioConsumerToStatsMap.get(t))?void 0:u.concealmentEvents)||0),packetsLost:(s.packetsLost||0)-((null==(p=this.audioConsumerToStatsMap.get(t))?void 0:p.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(g=this.audioConsumerToStatsMap.get(t))?void 0:g.packetsReceived)||0),jitter:s.jitter||0}),T.set(t,{score:+(10*s.score).toFixed(),packetsLostPercentage:It({packetsLost:(s.packetsLost||0)-((null==(f=this.audioConsumerToStatsMap.get(t))?void 0:f.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(m=this.audioConsumerToStatsMap.get(t))?void 0:m.packetsReceived)||0)}),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t),bitrate:8*((s.bytesReceived||0)-((null==(v=this.audioConsumerToStatsMap.get(t))?void 0:v.bytesReceived)||0))/7}),this.audioConsumerToStatsMap.set(t,s),k.inboundAudioRtp.set(P.id,s),k.consumerStreamMap.get(t).inboundAudioRtpId.push(P.id),this.processInboundConsumerAudioStats(t,n,s)}}else this.callStatsInstance.logger.error("Callstats: Unknown Inbound-rtp. mediatype: ".concat(e.mediaType," kind: ").concat(e.kind));break}}}if(k.producerStreamMap.forEach((e,t)=>{var i,r,n,s,a,o,c,l,d,h,u,p,g,f,m,v,b,y,w,S,x,T,_;if(e.outboundVideoRtpId.length>0){const g=[];e.outboundVideoRtpId.forEach(e=>{g.push(k.outboundVideoRtp.get(e))});const f=this.getWorkingSimulcastVideoStats(g);f.score=jt({frameWidth:f.frameWidth||0,framesPerSecond:f.framesPerSecond||0,jitter:(null==(i=f.remoteData)?void 0:i.jitter)||0,isScreenShare:this.screenShareProducers.has(t),packetsSent:(f.packetsSent||0)-((null==(r=this.videoProducerToStatsMap.get(t))?void 0:r.packetsSent)||0),packetsLost:((null==(n=f.remoteData)?void 0:n.packetsLost)||0)-((null==(a=null==(s=this.videoProducerToStatsMap.get(t))?void 0:s.remoteData)?void 0:a.packetsLost)||0),framesEncoded:(f.framesEncoded||0)-((null==(o=this.videoProducerToStatsMap.get(t))?void 0:o.framesEncoded)||0)}),E.set(t,{score:+(10*f.score).toFixed(),frameWidth:f.frameWidth||0,frameHeight:f.frameHeight||0,framesPerSecond:f.framesPerSecond||0,jitter:(null==(c=f.remoteData)?void 0:c.jitter)||0,isScreenShare:this.screenShareProducers.has(t),packetsLostPercentage:Lt({packetsSent:(f.packetsSent||0)-((null==(l=this.videoProducerToStatsMap.get(t))?void 0:l.packetsSent)||0),packetsLost:((null==(d=f.remoteData)?void 0:d.packetsLost)||0)-((null==(u=null==(h=this.videoProducerToStatsMap.get(t))?void 0:h.remoteData)?void 0:u.packetsLost)||0)}),bitrate:8*((f.bytesSent||0)-((null==(p=this.videoProducerToStatsMap.get(t))?void 0:p.bytesSent)||0))/7,cpuLimitations:"cpu"===f.qualityLimitationReason,bandwidthLimitations:"bandwidth"===f.qualityLimitationReason}),this.videoProducerToStatsMap.set(t,f)}else if(e.outboundAudioRtpId.length>0){const i=k.outboundAudioRtp.get(e.outboundAudioRtpId[0]);i.score=Ft({packetsSent:(i.packetsSent||0)-((null==(g=this.audioProducerToStatsMap.get(t))?void 0:g.packetsSent)||0),packetsLost:((null==(f=i.remoteData)?void 0:f.packetsLost)||0)-((null==(v=null==(m=this.audioProducerToStatsMap.get(t))?void 0:m.remoteData)?void 0:v.packetsLost)||0),jitter:(null==(b=i.remoteData)?void 0:b.jitter)||0}),E.set(t,{score:+(10*i.score).toFixed(),bitrate:8*((i.bytesSent||0)-((null==(y=this.audioProducerToStatsMap.get(t))?void 0:y.bytesSent)||0))/7,packetsLostPercentage:Lt({packetsSent:(i.packetsSent||0)-((null==(w=this.audioProducerToStatsMap.get(t))?void 0:w.packetsSent)||0),packetsLost:((null==(S=i.remoteData)?void 0:S.packetsLost)||0)-((null==(T=null==(x=this.audioProducerToStatsMap.get(t))?void 0:x.remoteData)?void 0:T.packetsLost)||0)}),jitter:(null==(_=i.remoteData)?void 0:_.jitter)||0,isScreenShare:this.screenShareProducers.has(t)}),this.audioProducerToStatsMap.set(t,i)}}),x.forEach(e=>{const t=w.find(t=>t.id===e.localCandidateId?(e.localCandidateId=t.id,t):null),i=S.find(t=>t.id===e.remoteCandidateId?(e.remoteCandidateId=t.id,t):null);t&&(e.localCandidateType=t.type,e.localCandidateAddress=Rt(t.address),e.localCandidatePort=t.port,e.localCandidateProtocol=t.protocol,e.localCandidateUrl=t.url,e.localCandidateNetworkType=t.networkType,e.localCandidateRelatedAddress=Rt(t.relatedAddress),e.localCandidateRelatedPort=t.relatedPort),i&&(e.remoteCandidateType=i.type,e.remoteCandidateAddress=Rt(i.address),e.remoteCandidatePort=i.port,e.remoteCandidateProtocol=i.protocol,e.remoteCandidateUrl=i.url)}),k.candidatePair&&(k.transport?(k.transport.totalRoundTripTime=k.candidatePair.totalRoundTripTime,k.transport.availableOutgoingBitrate=k.candidatePair.availableOutgoingBitrate,k.transport.availableIncomingBitrate=k.candidatePair.availableIncomingBitrate,k.transport.roundTripTime=k.candidatePair.currentRoundTripTime):k.transport={bytesReceived:k.candidatePair.bytesReceived,bytesSent:k.candidatePair.bytesSent,totalRoundTripTime:k.candidatePair.totalRoundTripTime,availableOutgoingBitrate:k.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:k.candidatePair.availableIncomingBitrate,roundTripTime:k.candidatePair.currentRoundTripTime}),k.transport&&(k.transport.candidatePairs=x),k.transport&&!k.transport.roundTripTime){let e=0,t=0;k.remoteInboundRtp.forEach((i,r)=>{i.roundTripTime&&i.roundTripTime>e&&(e=i.roundTripTime,t=i.totalRoundTripTime)}),k.transport.roundTripTime=e,k.transport.totalRoundTripTime=t}if(T.size>0)try{this.observer.emit("consumer_score",T)}catch(_){}if(E.size>0)try{this.observer.emit("producer_score",E)}catch(_){}return k}getProducersReport(e){return Be(this,null,function*(){const t=e.map(e=>this.generateProducerStreamMap(e,!0));return t.length>0?Promise.all(t):void 0})}getConsumersReport(e){return Be(this,null,function*(){const t=e.map(e=>this.generateConsumerStreamMap(e,!0));return t.length>0?Promise.all(t):void 0})}getTransportReport(e){return Be(this,null,function*(){return e.getStats()})}getProcessedStats(e,t,i){return Be(this,null,function*(){const r=yield this.getTransportReport(e),n={producing:i,consuming:t,id:e.id},s=r,a=this.parseRTCReport(s,["transport","candidate-pair","inbound-rtp","outbound-rtp","remote-inbound-rtp","local-candidate","remote-candidate"],!1,void 0,n);if(!a)return;return{transportReport:{stats:a.transport,transportId:e.id,consuming:t,producing:i},producerReport:a.staleProducerStreamMap?void 0:this.getProducerStatsFromReport(a),consumerReport:a.staleConsumerStreamMap?void 0:this.getConsumerStatsFromReport(a)}})}getProducerStatsFromReport(e){const t=[];try{e.producerStreamMap.forEach((i,r)=>{var n,s;t.push({producerId:r,videoStats:i.outboundVideoRtpId.map(t=>e.outboundVideoRtp.get(t)),audioStats:i.outboundAudioRtpId.map(t=>e.outboundAudioRtp.get(t)),appData:(null==(s=null==(n=this.callStatsInstance.producers)?void 0:n.get(r))?void 0:s.appData)||null})})}catch(d){this.callStatsInstance.logger.error("callStats::measurements::getProducerStatsFromReport",{error:{reason:d.reason,message:d.message}})}return t}getConsumerStatsFromReport(e){const t=[];try{e.consumerStreamMap.forEach((i,r)=>{const{peerId:n,producerId:s,appData:a}=this.consumerPeerIdMap.get(r);t.push({consumerId:r,peerId:n,producerId:s,appData:a,videoStats:i.inboundVideoRtpId.map(t=>e.inboundVideoRtp.get(t)),audioStats:i.inboundAudioRtpId.map(t=>e.inboundAudioRtp.get(t))})})}catch(d){console.error("getConsumersReport: ",d,e)}return t}getUserLocation(){return Be(this,null,function*(){return new Promise((e,t)=>{try{navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{e(t)}):t()}catch(d){t(d)}})})}getConnectivity(e){return Be(this,null,function*(){try{const t={iceServers:e||Jt},i=new Promise((e,i)=>{try{const i=new qt(t);i.addListener("done",e),i.addListener("failed",()=>{e({connectivity:!1})}),i.start(2e3)}catch(r){i(r)}}),r=new Promise((e,i)=>{try{const i=new Kt(t);i.addListener("done",e),i.addListener("failed",()=>{e({connectivity:!1})}),i.start(2e3)}catch(r){i(r)}}),n=new Promise((e,i)=>{try{const i=new Zt(t);i.addListener("done",e),i.addListener("failed",()=>{e({connectivity:!1})}),i.start(2e3)}catch(r){i(r)}}),[s,a,o]=yield Promise.all([i,r,n]);return{host:null==s?void 0:s.connectivity,relay:null==a?void 0:a.connectivity,reflexive:null==o?void 0:o.connectivity}}catch(t){return{host:!1,relay:!1,reflexive:!1}}})}getThroughput(e){return Be(this,null,function*(){try{const t=yield new Promise((t,i)=>{try{const r=new Gt({iceServers:e||Jt});r.addListener("done",t),r.addListener("failed",i),r.start(1e4)}catch(r){i(r)}});return{throughput:t.throughput,fractionalLoss:0,RTT:t.RTT,jitter:0,backendRTT:t.backendRTT}}catch(t){return}})}getIPDetails(){return Be(this,null,function*(){var e,t;try{return this.ipDetails||(this.ipDetails=yield Yt.getIPDetails({peerId:null==(e=this.callStatsInstance)?void 0:e.peerId,apiHostnames:null==(t=this.callStatsInstance)?void 0:t.apiHostnames,logger:this.callStatsInstance.logger})),this.ipDetails}catch(d){return}})}getNetworkQuality(e){return Be(this,null,function*(){const[t,i]=yield Promise.all([this.getConnectivity(e),this.getThroughput(e)]);return{connectivity:t,throughput:null==i?void 0:i.throughput,fractionalLoss:null==i?void 0:i.fractionalLoss,RTT:null==i?void 0:i.RTT,jitter:null==i?void 0:i.jitter,backendRTT:null==i?void 0:i.backendRTT}})}getNetworkInfo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){var i,r;if(t){const e=yield this.getIPDetails();return{ipDetails:e,effectiveNetworkType:null==(i=navigator.connection)?void 0:i.effectiveType,location:null!=e&&e.loc?Qt(null==e?void 0:e.loc):void 0}}const[n,s,a]=yield Promise.all([this.getConnectivity(e),this.getThroughput(e),this.getIPDetails()]);return{ipDetails:a,effectiveNetworkType:null==(r=navigator.connection)?void 0:r.effectiveType,location:null!=a&&a.loc?Qt(null==a?void 0:a.loc):void 0,turnConnectivity:!!n&&(n.host||n.relay||n.reflexive),connectivity:n,throughput:null==s?void 0:s.throughput,fractionalLoss:null==s?void 0:s.fractionalLoss,RTT:null==s?void 0:s.RTT,jitter:null==s?void 0:s.jitter,backendRTT:null==s?void 0:s.backendRTT}})}}class ti extends ei{}class ii extends ei{constructor(){super(...arguments),De(this,"producerMap",new Map),De(this,"consumerMap",new Map)}registerProducer(e){return Be(this,null,function*(){this.producerMap.set(e.id,e),yield this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),!0===e.appData.screenShare&&this.screenShareProducers.add(e.id)})}registerConsumer(e){return Be(this,null,function*(){this.consumerMap.set(e.id,e),yield this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),!0===e.appData.screenShare&&this.screenShareConsumers.add(e.id)})}generateConsumerStreamMap(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){const i=yield e.getStats(),r=this.parseRTCReport(i,["inbound-rtp"],!1,e.id),n=[...r.consumerStreamMap.values()][0],s=t?this.getConsumerStatsFromParsedConsumerStats(r,n,e.id):void 0;for(const t of i.values())if("inbound-rtp"===t.type)this.inboundConsumerMap.set(t.id,e.id);return s})}deregisterProducer(e){this.producerMap.delete(e.id),this.outboundProducerMap.forEach((t,i)=>{t===e.id&&this.outboundProducerMap.delete(i)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.consumerMap.delete(e.id),this.inboundConsumerMap.forEach((t,i)=>{t===e.id&&this.inboundConsumerMap.delete(i)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var t;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:null!=(t=e.relayProtocol)?t:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}parseRTCReport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;var s,a,o,c,l,d,h,u,p,g,f,m,v;const b=e,k=new Xt,y=t.length?new Set(t):void 0,w=[],S=[],x=[],E=new Map,T=new Map;for(const P of b.values()){if(y){if(0===y.size)break;if(!y.has(P.type))continue;i&&y.delete(P.type)}switch(P.type){case"local-candidate":w.push(this.getIceCandidateStats(P));break;case"remote-candidate":S.push(this.getIceCandidateStats(P));break;case"candidate-pair":{const{nominated:e}=P,{selected:t}=P,i=P,r={nominated:null!=e?e:t,currentRoundTripTime:i.currentRoundTripTime,totalRoundTripTime:i.totalRoundTripTime,bytesReceived:i.bytesReceived,bytesSent:i.bytesSent,availableOutgoingBitrate:i.availableOutgoingBitrate,availableIncomingBitrate:i.availableIncomingBitrate,lastPacketReceivedTimestamp:i.lastPacketReceivedTimestamp,lastPacketSentTimestamp:i.lastPacketSentTimestamp,localCandidateId:i.localCandidateId,remoteCandidateId:i.remoteCandidateId,bytesDiscardedOnSend:i.bytesDiscardedOnSend,packetsSent:i.packetsSent,packetsReceived:i.packetsReceived,packetsDiscardedOnSend:i.packetsDiscardedOnSend};x.push(r),(!0===P.nominated||!0===P.selected)&&(k.candidatePair=r);break}case"transport":{const e=P;n&&(n.producing&&(this.overallProducingTransportsStatsMap[n.id]||(this.overallProducingTransportsStatsMap[n.id]={totalPacketsSent:0})),n.consuming&&(this.overallConsumingTransportsStatsMap[n.id]||(this.overallConsumingTransportsStatsMap[n.id]={totalPacketsReceived:0})));const t={bytesReceived:e.bytesReceived,bytesSent:e.bytesSent,packetsSent:e.packetsSent,packetsReceived:e.packetsReceived,dtlsCipher:e.dtlsCipher,dtlsState:e.dtlsState,iceRole:e.iceRole};if(k.transport=t,n){if(n.producing){const e=this.overallProducingTransportsStatsMap[n.id];this.processProducingTransportStats(n.id,e,t)}if(n.consuming){const e=this.overallConsumingTransportsStatsMap[n.id];this.processConsumingTransportStats(n.id,e,t)}}break}case"remote-inbound-rtp":{const e=P,t={jitter:e.jitter,fractionLost:e.fractionLost,roundTripTime:e.roundTripTime,roundTripTimeMeasurements:e.roundTripTimeMeasurements,totalRoundTripTime:e.totalRoundTripTime,packetsLost:e.packetsLost};k.remoteInboundRtp.set(e.localId,t);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(P.id))break;const e=P,t=r||this.outboundProducerMap.get(P.id),i=this.pausedProducerMap.get(t);if(i){if(!0===i.lastReportCalculated)break;this.pausedProducerMap.set(t,{lastReportCalculated:!0})}this.overallProducersStatsMap[t]||(this.overallProducersStatsMap[t]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const n=this.overallProducersStatsMap[t];if(["video","audio"].includes(e.mediaType)||["video","audio"].includes(e.kind)){if(!this.outboundProducerMap.has(P.id)){k.staleProducerStreamMap=!0;break}const i=this.callStatsInstance.producers.get(t);if("ended"===(null==(s=null==i?void 0:i.track)?void 0:s.readyState))break;k.producerStreamMap.has(t)||k.producerStreamMap.set(t,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const r={bytesSent:e.bytesSent,packetsSent:e.packetsSent,nackCount:e.nackCount,ssrc:e.ssrc,mid:e.mid,active:e.active,codecId:e.codecId,headerBytesSent:e.headerBytesSent||0,totalPacketSendDelay:e.totalPacketSendDelay||0};if("video"===e.mediaType||"video"===e.kind){const i=e,s=Le({frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesEncoded:i.framesEncoded,framesDropped:i.framesDropped?i.framesDropped:i.droppedFrames,framesPerSecond:i.framesPerSecond?i.framesPerSecond:i.framerateMean,framesSent:i.framesSent,keyFramesEncoded:i.keyFramesEncoded,firCount:i.firCount,encoderImplementation:i.encoderImplementation,hugeFramesSent:i.hugeFramesSent,pliCount:i.pliCount,qpSum:i.qpSum,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,totalEncodeTime:i.totalEncodeTime,totalPacketSendDelay:i.totalEncodeTime,retransmittedBytesSent:i.retransmittedBytesSent,retransmittedPacketsSent:i.retransmittedPacketsSent,scalabilityMode:i.scalabilityMode,powerEfficientEncoder:i.powerEfficientEncoder},r);k.outboundVideoRtp.set(P.id,s),k.producerStreamMap.get(t).outboundVideoRtpId.push(P.id),this.processOutboundProducerVideoStats(t,n,s)}else if("audio"===e.mediaType||"audio"===e.kind){const i=e,s=Le({retransmittedBytesSent:i.retransmittedBytesSent,retransmittedPacketsSent:i.retransmittedPacketsSent},r);k.outboundAudioRtp.set(P.id,s),k.producerStreamMap.get(t).outboundAudioRtpId.push(P.id),this.processOutboundProducerAudioStats(t,n,s)}}else this.callStatsInstance.logger.error("Callstats: Unknown Outbound-rtp. mediatype: ".concat(e.mediaType," kind: ").concat(e.kind));break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(P.id))break;const e=P,t=r||this.inboundConsumerMap.get(P.id),i=this.pausedConsumerMap.get(t);if(i){if(!0===i.lastReportCalculated)break;this.pausedConsumerMap.set(t,{lastReportCalculated:!0})}if(1234===e.ssrc)break;this.overallConsumersStatsMap[t]||(this.overallConsumersStatsMap[t]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const n=this.overallConsumersStatsMap[t];if(["video","audio"].includes(e.mediaType)||["video","audio"].includes(e.kind)){if(!this.inboundConsumerMap.has(P.id)){k.staleConsumerStreamMap=!0;break}k.consumerStreamMap.has(t)||k.consumerStreamMap.set(t,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const i={bytesReceived:e.bytesReceived,packetsReceived:e.packetsReceived,packetsLost:e.packetsLost>=0?e.packetsLost:0,jitter:e.jitter,nackCount:e.nackCount,jitterBufferDelay:e.jitterBufferDelay,jitterBufferEmittedCount:e.jitterBufferEmittedCount,lastPacketReceivedTimestamp:e.lastPacketReceivedTimestamp,ssrc:e.ssrc,mid:e.mid,codecId:e.codecId,headerBytesReceived:e.headerBytesReceived||0,packetsDiscarded:e.packetsDiscarded||0,jitterBufferMinimumDelay:e.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:e.jitterBufferTargetDelay||0};if("video"===e.mediaType||"video"===e.kind){const r=e,s=Le({frameHeight:r.frameHeight,frameWidth:r.frameWidth,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped?r.framesDropped:r.droppedFrames,framesPerSecond:r.framesPerSecond?r.framesPerSecond:r.framerateMean,framesReceived:r.framesReceived,keyFramesDecoded:r.keyFramesDecoded,firCount:r.firCount,decoderImplementation:r.decoderImplementation,pliCount:r.pliCount,totalProcessingDelay:r.totalProcessingDelay,qpSum:r.qpSum||0,totalAssemblyTime:r.totalAssemblyTime||0,totalDecodeTime:r.totalDecodeTime||0,totalFreezesDuration:r.totalFreezesDuration||0,totalInterFrameDelay:r.totalInterFrameDelay||0,totalPausesDuration:r.totalPausesDuration||0,totalSquaredInterFrameDelay:r.totalSquaredInterFrameDelay||0,freezeCount:r.freezeCount||0,pauseCount:r.pauseCount||0,powerEfficientDecoder:r.powerEfficientDecoder},i);s.score=zt({frameWidth:s.frameWidth||0,framesDecoded:(s.framesDecoded||0)-((null==(a=this.videoConsumerToStatsMap.get(t))?void 0:a.framesDecoded)||0),framesPerSecond:s.framesPerSecond||0,packetsLost:(s.packetsLost||0)-((null==(o=this.videoConsumerToStatsMap.get(t))?void 0:o.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(c=this.videoConsumerToStatsMap.get(t))?void 0:c.packetsReceived)||0),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t)}),T.set(t,{score:+(10*s.score).toFixed(),frameWidth:s.frameWidth||0,frameHeight:s.frameHeight||0,framesPerSecond:s.framesPerSecond||0,packetsLostPercentage:It({packetsLost:(s.packetsLost||0)-((null==(l=this.videoConsumerToStatsMap.get(t))?void 0:l.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(d=this.videoConsumerToStatsMap.get(t))?void 0:d.packetsReceived)||0)}),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t),bitrate:8*((s.bytesReceived||0)-((null==(h=this.videoConsumerToStatsMap.get(t))?void 0:h.bytesReceived)||0))/7}),this.videoConsumerToStatsMap.set(t,s),k.inboundVideoRtp.set(P.id,s),k.consumerStreamMap.get(t).inboundVideoRtpId.push(P.id),this.processInboundConsumerVideoStats(t,n,s)}else if("audio"===e.mediaType||"audio"===e.kind){const r=e,s=Le({audioLevel:r.audioLevel,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration,totalSamplesReceived:r.totalSamplesReceived,fecPacketsDiscarded:r.fecPacketsDiscarded||0,fecPacketsReceived:r.fecPacketsReceived||0,insertedSamplesForDeceleration:r.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:r.removedSamplesForAcceleration||0,silentConcealedSamples:r.silentConcealedSamples||0,playoutId:r.playoutId},i);s.score=Vt({concealmentEvents:(s.concealmentEvents||0)-((null==(u=this.audioConsumerToStatsMap.get(t))?void 0:u.concealmentEvents)||0),packetsLost:(s.packetsLost||0)-((null==(p=this.audioConsumerToStatsMap.get(t))?void 0:p.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(g=this.audioConsumerToStatsMap.get(t))?void 0:g.packetsReceived)||0),jitter:s.jitter||0}),T.set(t,{score:+(10*s.score).toFixed(),packetsLostPercentage:It({packetsLost:(s.packetsLost||0)-((null==(f=this.audioConsumerToStatsMap.get(t))?void 0:f.packetsLost)||0),packetsReceived:(s.packetsReceived||0)-((null==(m=this.audioConsumerToStatsMap.get(t))?void 0:m.packetsReceived)||0)}),jitter:s.jitter||0,isScreenShare:this.screenShareConsumers.has(t),bitrate:8*((s.bytesReceived||0)-((null==(v=this.audioConsumerToStatsMap.get(t))?void 0:v.bytesReceived)||0))/7}),this.audioConsumerToStatsMap.set(t,s),k.inboundAudioRtp.set(P.id,s),k.consumerStreamMap.get(t).inboundAudioRtpId.push(P.id),this.processInboundConsumerAudioStats(t,n,s)}}else this.callStatsInstance.logger.error("Callstats: Unknown Inbound-rtp. mediatype: ".concat(e.mediaType," kind: ").concat(e.kind));break}}}if(k.producerStreamMap.forEach((e,t)=>{var i,r,n,s,a,o,c,l,d,h,u,p,g,f,m,v,b,y,w,S,x,T,_;if(e.outboundVideoRtpId.length>0){const g=[];e.outboundVideoRtpId.forEach(e=>{g.push(k.outboundVideoRtp.get(e))});const f=this.getWorkingSimulcastVideoStats(g);f.score=jt({frameWidth:f.frameWidth||0,framesPerSecond:f.framesPerSecond||0,jitter:(null==(i=f.remoteData)?void 0:i.jitter)||0,isScreenShare:this.screenShareProducers.has(t),packetsSent:(f.packetsSent||0)-((null==(r=this.videoProducerToStatsMap.get(t))?void 0:r.packetsSent)||0),packetsLost:((null==(n=f.remoteData)?void 0:n.packetsLost)||0)-((null==(a=null==(s=this.videoProducerToStatsMap.get(t))?void 0:s.remoteData)?void 0:a.packetsLost)||0),framesEncoded:(f.framesEncoded||0)-((null==(o=this.videoProducerToStatsMap.get(t))?void 0:o.framesEncoded)||0)}),E.set(t,{score:+(10*f.score).toFixed(),frameWidth:f.frameWidth||0,frameHeight:f.frameHeight||0,framesPerSecond:f.framesPerSecond||0,jitter:(null==(c=f.remoteData)?void 0:c.jitter)||0,isScreenShare:this.screenShareProducers.has(t),packetsLostPercentage:Lt({packetsSent:(f.packetsSent||0)-((null==(l=this.videoProducerToStatsMap.get(t))?void 0:l.packetsSent)||0),packetsLost:((null==(d=f.remoteData)?void 0:d.packetsLost)||0)-((null==(u=null==(h=this.videoProducerToStatsMap.get(t))?void 0:h.remoteData)?void 0:u.packetsLost)||0)}),bitrate:8*((f.bytesSent||0)-((null==(p=this.videoProducerToStatsMap.get(t))?void 0:p.bytesSent)||0))/7,cpuLimitations:"cpu"===f.qualityLimitationReason,bandwidthLimitations:"bandwidth"===f.qualityLimitationReason}),this.videoProducerToStatsMap.set(t,f)}else if(e.outboundAudioRtpId.length>0){const i=k.outboundAudioRtp.get(e.outboundAudioRtpId[0]);i.score=Ft({packetsSent:(i.packetsSent||0)-((null==(g=this.audioProducerToStatsMap.get(t))?void 0:g.packetsSent)||0),packetsLost:((null==(f=i.remoteData)?void 0:f.packetsLost)||0)-((null==(v=null==(m=this.audioProducerToStatsMap.get(t))?void 0:m.remoteData)?void 0:v.packetsLost)||0),jitter:(null==(b=i.remoteData)?void 0:b.jitter)||0}),E.set(t,{score:+(10*i.score).toFixed(),bitrate:8*((i.bytesSent||0)-((null==(y=this.audioProducerToStatsMap.get(t))?void 0:y.bytesSent)||0))/7,packetsLostPercentage:Lt({packetsSent:(i.packetsSent||0)-((null==(w=this.audioProducerToStatsMap.get(t))?void 0:w.packetsSent)||0),packetsLost:((null==(S=i.remoteData)?void 0:S.packetsLost)||0)-((null==(T=null==(x=this.audioProducerToStatsMap.get(t))?void 0:x.remoteData)?void 0:T.packetsLost)||0)}),jitter:(null==(_=i.remoteData)?void 0:_.jitter)||0,isScreenShare:this.screenShareProducers.has(t)}),this.audioProducerToStatsMap.set(t,i)}}),x.forEach(e=>{const t=w.find(t=>t.id===e.localCandidateId?(e.localCandidateId=t.id,t):null),i=S.find(t=>t.id===e.remoteCandidateId?(e.remoteCandidateId=t.id,t):null);t&&(e.localCandidateType=t.type,e.localCandidateAddress=Rt(t.address),e.localCandidatePort=t.port,e.localCandidateProtocol=t.protocol,e.localCandidateUrl=t.url,e.localCandidateNetworkType=t.networkType,e.localCandidateRelatedAddress=Rt(t.relatedAddress),e.localCandidateRelatedPort=t.relatedPort),i&&(e.remoteCandidateType=i.type,e.remoteCandidateAddress=Rt(i.address),e.remoteCandidatePort=i.port,e.remoteCandidateProtocol=i.protocol,e.remoteCandidateUrl=i.url)}),k.candidatePair&&(k.transport?(k.transport.bytesReceived=k.candidatePair.bytesReceived,k.transport.bytesSent=k.candidatePair.bytesSent,k.transport.totalRoundTripTime=k.candidatePair.totalRoundTripTime,k.transport.availableOutgoingBitrate=k.candidatePair.availableOutgoingBitrate,k.transport.availableIncomingBitrate=k.candidatePair.availableIncomingBitrate,k.transport.roundTripTime=k.candidatePair.currentRoundTripTime):k.transport={bytesReceived:k.candidatePair.bytesReceived,bytesSent:k.candidatePair.bytesSent,totalRoundTripTime:k.candidatePair.totalRoundTripTime,availableOutgoingBitrate:k.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:k.candidatePair.availableIncomingBitrate,roundTripTime:k.candidatePair.currentRoundTripTime}),k.transport&&(k.transport.candidatePairs=x),k.transport&&!k.transport.roundTripTime){let e=0,t=0;k.remoteInboundRtp.forEach((i,r)=>{i.roundTripTime&&i.roundTripTime>e&&(e=i.roundTripTime,t=i.totalRoundTripTime)}),k.transport.roundTripTime=e,k.transport.totalRoundTripTime=t}if(T.size>0)try{this.observer.emit("consumer_score",T)}catch(_){}if(E.size>0)try{this.observer.emit("producer_score",E)}catch(_){}return k}getProducerStatsFromReport(e){const t=[];try{e.producerStreamMap.forEach((i,r)=>{const n=this.producerMap.get(r),s=n.track.getSettings(),a=i.outboundVideoRtpId.map(t=>{const i=e.outboundVideoRtp.get(t);return i.frameHeight||(i.frameHeight=s.height,i.frameWidth=s.width,i.framesPerSecond=s.frameRate),i}),o={producerId:r,appData:n.appData,videoStats:a,audioStats:i.outboundAudioRtpId.map(t=>e.outboundAudioRtp.get(t))};t.push(o)})}catch(d){console.error("getProducersReport: ",d,e)}return t}getConsumerStatsFromParsedConsumerStats(e,t,i){let r;try{const{peerId:n,producerId:s,appData:a}=this.consumerPeerIdMap.get(i),o=null==t?void 0:t.inboundVideoRtpId.map(t=>{const r=this.consumerMap.get(i).track.getSettings(),n=e.inboundVideoRtp.get(t);return n.frameHeight||(n.frameHeight=r.height,n.frameWidth=r.width,n.framesPerSecond=r.frameRate),n});r={consumerId:i,peerId:n,producerId:s,appData:a,videoStats:o,audioStats:null==t?void 0:t.inboundAudioRtpId.map(t=>e.inboundAudioRtp.get(t))}}catch(n){console.error("getConsumerStatsFromParsedConsumerStats: ",n,e)}return r}getConsumerStatsFromReport(e){const t=[];try{e.consumerStreamMap.forEach((i,r)=>{t.push(this.getConsumerStatsFromParsedConsumerStats(e,i,r))})}catch(d){console.error("getConsumerStatsFromReport: ",d,e)}return t}}class ri extends ii{}function ni(e,t,i,r){if(null!=e&&e.logger&&e.logger.error("Callstats::handleError",{error:r}),!("function"==typeof i&&r instanceof t))throw r;i.call(null,r,e)}function si(e,t,i){const r=e.value;return e.value=function(){try{for(var e=arguments.length,n=new Array(e),s=0;s{ni(this,t,i,e)}):a}catch(a){ni(this,t,i,a)}return null},e}const ai=(e,t)=>(i,r,n)=>{const s=n.value;return n.value=function(){try{for(var i=arguments.length,r=new Array(i),n=0;n{ni(this,e,t,i)}):a}catch(a){ni(this,e,t,a)}return null},n};var oi=globalThis&&globalThis.__decorate||function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ci=console;let li=class extends nt{constructor(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Blink",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pt.PROD,i=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,n=arguments.length>6?arguments[6]:void 0;switch(super(),De(this,"observer"),De(this,"eventHandler"),De(this,"measurements"),De(this,"producingTransport"),De(this,"consumingTransport"),De(this,"producers",new Map),De(this,"consumers",new Map),De(this,"iceServers"),De(this,"connectionInfoPromise"),De(this,"pingStatsTimeout"),De(this,"logger"),De(this,"env"),De(this,"apiHostnames"),De(this,"peerId"),De(this,"consumerSharedMediaStatesMap",new Map),De(this,"currentUserMediaStates",{}),this.env=t,this.apiHostnames=n,this.logger=i,this.peerId=r,this.eventHandler=new Tt({logger:i,peerId:r,apiHostnames:n}),this.logger.debug("callStats::engineName: ",{engineName:e}),e){case"Blink":this.measurements=new ti;break;case"Gecko":this.measurements=new ii;break;case"WebKit":this.measurements=new ri;break;default:throw Error("Unknown engineName! ".concat(e))}this.measurements.callStatsInstance=this,this.registerProducer=this.registerProducer.bind(this),this.registerConsumer=this.registerConsumer.bind(this),this.observer=new nt,this.measurements.observer.on("consumer_score",e=>{i.debug("callStats::consumer_score ".concat([...e.entries()])),this.eventHandler.emit("consumer_score",e)}),this.measurements.observer.on("producer_score",e=>{i.debug("callStats::producer_score ".concat([...e.entries()])),this.eventHandler.emit("producer_score",e)})}registerIceServers(e){this.iceServers=e}registerConsumer(e){var t;this.consumerSharedMediaStatesMap.has(e.id)||this.consumerSharedMediaStatesMap.set(e.id,{}),this.consumers.set(e.id,e),this.measurements.registerConsumer(e),this.logger.debug("callStats::registerConsumer",{consumerId:e.id,consumerkind:e.kind,isScreenShare:!(null==(t=e.appData)||!t.screenShare)}),e.on("close",this.deRegisterConsumer.bind(this,e))}registerProducer(e){var t;this.producers.set(e.id,e),this.measurements.registerProducer(e),this.logger.debug("callStats::registerProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!(null==(t=e.appData)||!t.screenShare)}),e.on("close",this.deRegisterProducer.bind(this,e))}sendConsumerSharedMediaStateEvent(e,t){this.consumerSharedMediaStatesMap.has(e)||this.consumerSharedMediaStatesMap.set(e,{});const i=this.consumerSharedMediaStatesMap.get(e);this.consumerSharedMediaStatesMap.set(e,Object.assign(i,t))}registerProducingTransport(e){var t;this.producingTransport=e,e.on("close",this.disconnectProducingTransport.bind(this,e)),e.on("disconnect",this.disconnectProducingTransport.bind(this,e)),Array.from((null==(t=e._producers)?void 0:t.values())||[]).forEach(e=>{this.registerProducer(e)}),e.on("newproducer",this.registerProducer)}registerConsumingTransport(e){var t;this.consumingTransport=e,e.on("close",this.disconnectConsumingTransport.bind(this,e)),e.on("disconnect",this.disconnectConsumingTransport.bind(this,e)),Array.from((null==(t=e._consumers)?void 0:t.values())||[]).forEach(e=>{this.registerConsumer(e)}),e.on("newconsumer",this.registerConsumer)}deRegisterConsumer(e){this.consumers.delete(e.id)}deRegisterProducer(e){var t;this.producers.delete(e.id),this.logger.debug("callStats::deRegisterProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!(null==(t=e.appData)||!t.screenShare)})}disconnectConsumingTransport(){this.consumingTransport=void 0}disconnectProducingTransport(){this.producingTransport=void 0}callEvent(e){this.eventHandler.callEvent(e)}sendPreCallTestBeginEvent(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;this.connectionInfoPromise=this.measurements.getNetworkInfo(this.iceServers,e),this.eventHandler.callEvent({event:ut.PRECALL_TEST_BEGIN,timestamp:t}),this.connectionInfoPromise&&this.connectionInfoPromise.then(e=>{this.eventHandler.callEvent({event:ut.PRECALL_TEST_COMPLETE,metaData:{connectionInfo:e},timestamp:t})})}sendScreenShareToggleEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;this.currentUserMediaStates.screen=e,this.eventHandler.callEvent({event:e?ut.SCREENSHARE_STARTED:ut.SCREENSHARE_STOPPED,metaData:{ssrc:t},timestamp:i})}sendScreenShareRequestedEvent(e){this.eventHandler.callEvent({event:ut.SCREENSHARE_START_REQUESTED,timestamp:e})}sendActiveSpeakerEvent(e,t){this.eventHandler.callEvent({event:ut.DOMINANT_SPEAKER,metaData:{peerId:e},timestamp:t})}devices(e,t,i){this.eventHandler.callEvent({event:e===Ct.AUDIO&&ut.AUDIO_DEVICES_UPDATES||e===Ct.VIDEO&&ut.VIDEO_DEVICES_UPDATES||e===Ct.SPEAKER&&ut.SPEAKER_DEVICES_UPDATES,metaData:{deviceList:t},timestamp:i})}selectedDevice(e,t,i){this.eventHandler.callEvent({event:e===Ct.AUDIO&&ut.SELECTED_MICROHPONE_UPDATE||e===Ct.VIDEO&&ut.SELECTED_CAMERA_UPDATE||e===Ct.SPEAKER&&ut.SELECTED_SPEAKER_UPDATE,metaData:{device:t},timestamp:i})}mediaPermission(e,t,i){this.eventHandler.callEvent({event:ut.MEDIA_PERMISSION,metaData:{deviceType:e,permission:t},timestamp:i})}mediaPlaybackFailed(e,t){this.eventHandler.callEvent({event:e===Ct.AUDIO&&ut.AUDIO_PLAY_FAILED||e===Ct.VIDEO&&ut.VIDEO_PLAY_FAILED,metaData:{deviceType:e},timestamp:t})}mediaTrackMuted(e,t){this.eventHandler.callEvent({event:e===Ct.AUDIO&&ut.AUDIO_TRACK_MUTED||e===Ct.VIDEO&&ut.VIDEO_TRACK_MUTED,metaData:{deviceType:e},timestamp:t})}tabChanged(e,t){this.eventHandler.callEvent({event:ut.TAB_CHANGE,metaData:{isMeetingsTabActive:e},timestamp:t})}browserBackgrounded(e){this.eventHandler.callEvent({event:ut.BROWSER_BACKGROUNDED,timestamp:e})}browserForegrounded(e){this.eventHandler.callEvent({event:ut.BROWSER_FOREGROUNDED,timestamp:e})}legacySwitch(e,t){this.eventHandler.callEvent({event:ut.LEGACY_SWITCH,metadata:{on:e},timestamp:t})}getPreCallTestResults(){return Be(this,null,function*(){return this.connectionInfoPromise})}sendCallJoinBeginEvent(e,t){(e=Ie(Le({},e),{meetingEnv:this.env})).deviceInfo=Ie(Le({},e.deviceInfo),{userAgent:navigator.userAgent,cpus:navigator.hardwareConcurrency,memory:navigator.deviceMemory}),this.eventHandler.callEvent({event:ut.CALL_JOIN_BEGIN,metaData:{peerMetaData:e},timestamp:t})}sendNetworkQualityTestBeginEvent(e,t){this.eventHandler.callEvent({event:ut.NET_QUALITY_TEST_BEGIN,timestamp:t}),new Promise((t,i)=>Be(this,null,function*(){const r=[];try{for(const t of e)try{if(t.iceServers&&t.iceServers.length>0){const e=yield this.measurements.getNetworkQuality(t.iceServers);r.push(Ie(Le({},t),{networkResults:e}))}}catch(n){console.warn("Error handling ",n)}t({regionData:r})}catch(s){console.warn("Error in callstats, ",s),i(s)}})).then(e=>{this.eventHandler.callEvent({event:ut.NET_QUALITY_TEST_END,timestamp:t,metaData:e})})}sendWebSocketConnectedEvent(e){this.eventHandler.callEvent({event:ut.WEBSOCKET_CONNECTED,timestamp:e})}sendTransportConnectedEvent(e){this.eventHandler.callEvent({event:ut.TRANSPORT_CONNECTED,timestamp:e})}sendAudioToggleEvent(e,t){let i;this.currentUserMediaStates.audio=e,i=e?ut.AUDIO_ON:ut.AUDIO_OFF,this.eventHandler.callEvent({event:i,timestamp:t})}sendVideoToggleEvent(e,t){let i;this.currentUserMediaStates.video=e,i=e?ut.VIDEO_ON:ut.VIDEO_OFF,this.eventHandler.callEvent({event:i,timestamp:t})}sendParticipantRoleToggleEvent(e,t){this.eventHandler.callEvent({event:ut.PARTICIPANT_ROLE,timestamp:t,metaData:e})}startPingStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7e3;this.sendPingStatsEvent(!1,new Date),this.pingStatsTimeout=setInterval(this.sendPingStatsEvent.bind(this),e)}stopPingStats(){clearInterval(this.pingStatsTimeout)}sendPingStatsEvent(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;return Be(this,null,function*(){let i,r;if(this.producingTransport&&(i=yield this.measurements.getProcessedStats(this.producingTransport,!1,!0),!i||null==i||!i.producerReport)){this.logger.debug("callStats::sendPingStatsEvent::staleProducingTransport",{disclaimer:"Stale producer? Regenerating Stream Maps!"});const e=yield this.measurements.getProducersReport([...this.producers.values()]);i&&e?i.producerReport=e:(i=yield this.measurements.getProcessedStats(this.producingTransport,!1,!0),(!i||null==i||!i.producerReport)&&this.logger.debug("callStats::sendPingStatsEvent::noProducingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}if(this.consumingTransport&&(r=yield this.measurements.getProcessedStats(this.consumingTransport,!0,!1),!r||!r.consumerReport)){this.logger.debug("callStats::sendPingStatsEvent::staleConsumingTransport",{disclaimer:"Stale consumer? Regenerating Stream Maps!"});const e=yield this.measurements.getConsumersReport([...this.consumers.values()]);r&&e?r.consumerReport=e:(r=yield this.measurements.getProcessedStats(this.consumingTransport,!0,!1),(!r||!r.consumerReport)&&this.logger.debug("callStats::sendPingStatsEvent::noConsumingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}const n={producingTransportStats:i?null==i?void 0:i.transportReport:void 0,consumingTransportStats:r?null==r?void 0:r.transportReport:void 0,producerStats:[].concat((null==i?void 0:i.producerReport)||[]).concat((null==r?void 0:r.producerReport)||[]),consumerStats:[].concat((null==r?void 0:r.consumerReport)||[]).concat((null==i?void 0:i.consumerReport)||[])};e&&0===n.producerStats.length&&0===n.consumerStats.length?yield this.eventHandler.flush():this.eventHandler.callEvent({event:ut.PING_STAT,metaData:n,timestamp:t})})}sendIVSPlayerRebufferEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_REBUFFERING,timestamp:e})}sendIVSPlayerAudioBlockEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_AUDIO_BLOCKED,timestamp:e})}sendIVSPlayerPlaybackBlockedEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_PLAYBACK_BLOCKED,timestamp:e})}sendIVSPlayerNetworkUnavailableEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_NETWORK_UNAVAILABLE,timestamp:e})}sendIVSPlayerInitializedEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_INITIALIZED,timestamp:e})}sendIVSPlayerWorkerErrorEvent(e){this.eventHandler.callEvent({event:ut.IVS_PLAYER_WORKER_ERROR,timestamp:e})}sendIVSPlayerErrorEvent(e,t){this.eventHandler.callEvent({event:ut.IVS_PLAYER_ERROR,timestamp:t,metaData:e})}sendIVSPlayerRecoverableErrorEvent(e,t){this.eventHandler.callEvent({event:ut.IVS_PLAYER_RECOVERABLE_ERROR,timestamp:t,metaData:e})}sendIVSPlayerAnalyticsEvent(e,t){this.eventHandler.callEvent({event:ut.IVS_PLAYER_ANALYTICS_EVENT,timestamp:t,metaData:e})}sendIVSPlayerPlaybackRateChangedEvent(e,t){this.eventHandler.callEvent({event:ut.IVS_PLAYER_PLAYBACK_RATE_CHANGED,timestamp:t,metaData:{updatedPlaybackRate:e}})}sendIVSPlayerQualityChanged(e,t){this.eventHandler.callEvent({event:ut.IVS_PLAYER_QUALITY_CHANGED,timestamp:t,metaData:e})}sendPlayerLiveLatency(e,t){this.eventHandler.callEvent({event:ut.LIVESTREAM_LATENCY,timestamp:t,metaData:{latency:e}})}sendDisconnectEvent(e){this.eventHandler.callEvent({event:ut.DISCONNECT,timestamp:e})}sendReconnectEvent(e){this.eventHandler.callEvent({event:ut.RECONNECT_ATTEMPT,timestamp:e})}expectedVideoResolution(e,t,i){this.eventHandler.callEvent({event:ut.EXPECTED_VIDEO_RESOLUTION,timestamp:i,metaData:{frameWidth:e,frameHeight:t}})}expectedScreenshareResolution(e,t,i){this.eventHandler.callEvent({event:ut.EXPECTED_SCREENSHARE_RESOLUTION,timestamp:i,metaData:{frameWidth:e,frameHeight:t}})}};oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"registerIceServers",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"registerConsumer",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"registerProducer",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendConsumerSharedMediaStateEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"registerProducingTransport",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"registerConsumingTransport",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"deRegisterConsumer",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"deRegisterProducer",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"disconnectConsumingTransport",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"disconnectProducingTransport",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendPreCallTestBeginEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendScreenShareToggleEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendScreenShareRequestedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendActiveSpeakerEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"devices",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"selectedDevice",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"mediaPermission",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"mediaPlaybackFailed",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"mediaTrackMuted",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"tabChanged",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"browserBackgrounded",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"browserForegrounded",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"legacySwitch",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"getPreCallTestResults",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendCallJoinBeginEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendNetworkQualityTestBeginEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendWebSocketConnectedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendTransportConnectedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendAudioToggleEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendVideoToggleEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendParticipantRoleToggleEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"startPingStats",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"stopPingStats",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendPingStatsEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerRebufferEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerAudioBlockEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerPlaybackBlockedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerNetworkUnavailableEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerInitializedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerWorkerErrorEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerErrorEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerRecoverableErrorEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerAnalyticsEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerPlaybackRateChangedEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendIVSPlayerQualityChanged",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendPlayerLiveLatency",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendDisconnectEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"sendReconnectEvent",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"expectedVideoResolution",null),oi([ai(TypeError,(e,t)=>ci.error(t,e))],li.prototype,"expectedScreenshareResolution",null),li=oi([((e,t)=>(i,r,n)=>{if(n)return si(n,e,t);for(const s of Reflect.ownKeys(i.prototype).filter(e=>"constructor"!==e)){const r=Object.getOwnPropertyDescriptor(i.prototype,s);r.value instanceof Function&&Object.defineProperty(i.prototype,s,si(r,e,t))}})(TypeError,(e,t)=>ci.error(t,e))],li);const di=li;class hi extends nt{constructor(){super(...arguments),De(this,"stats"),De(this,"peerId"),De(this,"backend"),De(this,"iceServers"),De(this,"initialized",!1),De(this,"stalled",!1),De(this,"ipInformation"),De(this,"logger")}initialize(e){return Be(this,arguments,function(e){var t=this;let{peerId:i,engineName:r,env:n=Pt.PROD,iceServers:s,apiBase:a="https://api.cluster.dyte.in",flags:o,logger:c=console,apiHostnames:l,skipConnectivityChecks:d=!1}=e;return function*(){var e,h,u;try{t.peerId=i,t.logger=c,t.ipInformation=yield Yt.getIPDetails({peerId:i,apiHostnames:l,logger:c}),t.backend=new di(a,r,n,o,c,i,l),t.iceServers=s,null==(e=t.backend)||e.registerIceServers(t.iceServers),t.initialized=!0,null==(u=null==(h=t.backend)?void 0:h.eventHandler)||u.emit("initialized",t.ipInformation),t.emit("initialized",t.ipInformation),t.startPreCallTest(d)}catch(p){t.logger.error("callStats::CallStatsIntegration: ",{error:p}),t.stallCallStats()}}()})}configureSendTransport(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.registerProducingTransport(e)})}configureRecvTransport(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.registerConsumingTransport(e)})}candidateRegionalNetworkQualityTest(e){return Be(this,null,function*(){const t=new Date;this.onSafeInitialization(()=>{var i;try{null==(i=this.backend)||i.sendNetworkQualityTestBeginEvent(e,t)}catch(r){this.logger.error("callStats::sendNetworkQualityTestBeginEvent",{error:{reason:r.reason}})}})})}roomJoined(e){return Be(this,null,function*(){const t=new Date;this.onSafeInitialization(()=>{var i,r;null==(i=this.backend)||i.sendCallJoinBeginEvent(e,t),this.backend,null==(r=this.backend)||r.startPingStats()})})}audioOff(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.sendAudioToggleEvent(!1,e)})}audioOn(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.sendAudioToggleEvent(!0,e)})}videoOff(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.sendVideoToggleEvent(!1,e)})}videoOn(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.sendVideoToggleEvent(!0,e)})}callEnded(){const e=new Date;this.onSafeInitialization(()=>{var t,i;null==(t=this.backend)||t.stopPingStats(),null==(i=this.backend)||i.sendDisconnectEvent(e)})}screenShareStart(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendScreenShareToggleEvent(!0,e,t)})}consumerSharedMediaState(e,t){this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendConsumerSharedMediaStateEvent(e,t)})}screenShareStop(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendScreenShareToggleEvent(!1,e,t)})}screenShareRequested(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.sendScreenShareRequestedEvent(e)})}activeSpeaker(e){if(e!==this.peerId)return;const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendActiveSpeakerEvent(e,t)})}devices(e,t){const i=new Date;this.onSafeInitialization(()=>{var r;null==(r=this.backend)||r.devices(e,t,i)})}selectedDevice(e,t){const i=new Date;this.onSafeInitialization(()=>{var r;null==(r=this.backend)||r.selectedDevice(e,t,i)})}mediaPermission(e,t){const i=new Date;this.onSafeInitialization(()=>{var r;null==(r=this.backend)||r.mediaPermission(e,t,i)})}mediaPlaybackFailed(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.mediaPlaybackFailed(e,t)})}mediaTrackMuted(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.mediaTrackMuted(e,t)})}tabChanged(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.tabChanged(e,t)})}browserBackgrounded(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.browserBackgrounded(e)})}browserForegrounded(){const e=new Date;this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.browserForegrounded(e)})}legacySwitch(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.legacySwitch(e,t)})}startPreCallTest(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Be(this,null,function*(){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendPreCallTestBeginEvent(e,t)})})}onPreCallTestResults(e){return this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.once("precall_end",e)}),e}onReceivingConsumerAudioStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("consumer_audio_status",e)})}onReceivingConsumerVideoStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("consumer_video_status",e)})}onReceivingProducerAudioStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("producer_audio_status",e)})}onReceivingProducerVideoStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("producer_video_status",e)})}onReceivingProducingTransportStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("producing_transport_status",e)})}onReceivingConsumingTransportStatus(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("consuming_transport_status",e)})}onProducerScore(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("producer_score",e)})}onConsumerScore(e){this.onSafeInitialization(()=>{var t;null==(t=this.backend)||t.eventHandler.on("consumer_score",e)})}onSafeInitialization(e){if(this.initialized)e(this.ipInformation,!1);else if(!this.stalled){const t=t=>{e(t,!0)};return this.once("initialized",t),t}return()=>{}}removeInitializationListener(e){this.removeListener("initialized",e)}stallCallStats(){this.stalled=!0,this.removeAllListeners("initialized")}ivsPlayerEvent(e,t){const i=new Date;this.onSafeInitialization(()=>{var r,n,s,a,o,c,l,d,h,u,p;switch(e){case"PlayerRebuffering":null==(r=this.backend)||r.sendIVSPlayerRebufferEvent(i);break;case"PlayerAudioBlocked":null==(n=this.backend)||n.sendIVSPlayerAudioBlockEvent(i);break;case"PlayerPlaybackBlocked":null==(s=this.backend)||s.sendIVSPlayerPlaybackBlockedEvent(i);break;case"PlayerNetworkUnavailable":null==(a=this.backend)||a.sendIVSPlayerNetworkUnavailableEvent(i);break;case"PlayerInitialized":null==(o=this.backend)||o.sendIVSPlayerInitializedEvent(i);break;case"PlayerWorkerError":null==(c=this.backend)||c.sendIVSPlayerWorkerErrorEvent(i);break;case"PlayerError":null==(l=this.backend)||l.sendIVSPlayerErrorEvent(t,i);break;case"PlayerRecoverableError":null==(d=this.backend)||d.sendIVSPlayerRecoverableErrorEvent(t,i);break;case"PlayerAnalyticsEvent":null==(h=this.backend)||h.sendIVSPlayerAnalyticsEvent(t,i);break;case"PlayerPlaybackRateChanged":null==(u=this.backend)||u.sendIVSPlayerPlaybackRateChangedEvent(t,i);break;case"PlayerQualityChanged":null==(p=this.backend)||p.sendIVSPlayerQualityChanged(t,i)}})}livestreamLatency(e){const t=new Date;this.onSafeInitialization(()=>{var i;null==(i=this.backend)||i.sendPlayerLiveLatency(e,t)})}expectedVideoResolution(e,t){const i=new Date;this.onSafeInitialization(()=>{var r;null==(r=this.backend)||r.expectedVideoResolution(e,t,i)})}expectedScreenshareResolution(e,t){const i=new Date;this.onSafeInitialization(()=>{var r;null==(r=this.backend)||r.expectedScreenshareResolution(e,t,i)})}}function ui(e,t){return e===t||e!==e&&t!==t}function pi(e,t){for(var i=e.length;i--;)if(ui(e[i][0],t))return i;return-1}(new hi).setMaxListeners(30);var gi=Array.prototype.splice;function fi(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t-1},fi.prototype.set=function(e,t){var i=this.__data__,r=pi(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};const mi="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;var vi="object"==typeof self&&self&&self.Object===Object&&self;const bi=mi||vi||Function("return this")();const ki=bi.Symbol;var yi=Object.prototype,wi=yi.hasOwnProperty,Si=yi.toString,xi=ki?ki.toStringTag:void 0;var Ei=Object.prototype.toString;var Ti=ki?ki.toStringTag:void 0;function _i(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ti&&Ti in Object(e)?function(e){var t=wi.call(e,xi),i=e[xi];try{e[xi]=void 0;var r=!0}catch(s){}var n=Si.call(e);return r&&(t?e[xi]=i:delete e[xi]),n}(e):function(e){return Ei.call(e)}(e)}function Pi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ci(e){if(!Pi(e))return!1;var t=_i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}const Ai=bi["__core-js_shared__"];var Ri=function(){var e=/[^.]+$/.exec(Ai&&Ai.keys&&Ai.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var Li=Function.prototype.toString;function Ii(e){if(null!=e){try{return Li.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Mi=/^\[object .+?Constructor\]$/,Di=Function.prototype,Oi=Object.prototype,Ni=Di.toString,Ui=Oi.hasOwnProperty,Fi=RegExp("^"+Ni.call(Ui).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ji(e){return!(!Pi(e)||function(e){return!!Ri&&Ri in e}(e))&&(Ci(e)?Fi:Mi).test(Ii(e))}function Bi(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return ji(i)?i:void 0}const Vi=Bi(bi,"Map");const zi=Bi(Object,"create");var Hi=Object.prototype.hasOwnProperty;var $i=Object.prototype.hasOwnProperty;function Gi(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}var mr={};function vr(e){return function(t){return e(t)}}mr["[object Float32Array]"]=mr["[object Float64Array]"]=mr["[object Int8Array]"]=mr["[object Int16Array]"]=mr["[object Int32Array]"]=mr["[object Uint8Array]"]=mr["[object Uint8ClampedArray]"]=mr["[object Uint16Array]"]=mr["[object Uint32Array]"]=!0,mr["[object Arguments]"]=mr["[object Array]"]=mr["[object ArrayBuffer]"]=mr["[object Boolean]"]=mr["[object DataView]"]=mr["[object Date]"]=mr["[object Error]"]=mr["[object Function]"]=mr["[object Map]"]=mr["[object Number]"]=mr["[object Object]"]=mr["[object RegExp]"]=mr["[object Set]"]=mr["[object String]"]=mr["[object WeakMap]"]=!1;var br="object"==typeof exports&&exports&&!exports.nodeType&&exports,kr=br&&e&&!e.nodeType&&e,yr=kr&&kr.exports===br&&mi.process;const wr=function(){try{return kr&&kr.require&&kr.require("util").types||yr&&yr.binding&&yr.binding("util")}catch(e){}}();var Sr=wr&&wr.isTypedArray,xr=Sr?vr(Sr):function(e){return tr(e)&&fr(e.length)&&!!mr[_i(e)]};const Er=xr;var Tr=Object.prototype.hasOwnProperty;function _r(e,t){var i=cr(e),r=!i&&or(e),n=!i&&!r&&ur(e),s=!i&&!r&&!n&&Er(e),a=i||r||n||s,o=a?function(e,t){for(var i=-1,r=Array(e);++i{for(var i in t)as(e,i,{get:t[i],enumerable:!0})})({},{permissions:()=>ds,theme:()=>hs});var os,cs=(e=>(e.GroupCall="GROUP_CALL",e.Webinar="WEBINAR",e.AudioRoom="AUDIO_ROOM",e.Livestream="LIVESTREAM",e.Chat="CHAT",e))(cs||{}),ls=(e=>(e.Allowed="ALLOWED",e.NotAllowed="NOT_ALLOWED",e.CanRequest="CAN_REQUEST",e))(ls||{}),ds={view_type:"GROUP_CALL",accept_waiting_requests:!1,accept_present_requests:!1,request_produce:!1,can_allow_participant_audio:!1,can_allow_participant_screensharing:!1,can_allow_participant_video:!1,can_spotlight:!1,request_kick_participant:!1,kick_participant:!1,pin_participant:!1,can_edit_display_name:!1,can_record:!1,can_livestream:!1,can_present:!0,waiting_room_type:"SKIP_ON_ACCEPT",recorder_type:"NONE",plugins:{can_close:!0,can_start:!0},polls:{can_create:!0,can_vote:!0,can_view:!0},produce:{video:{allow:!0,quality:"vga",frame_rate:24},audio:!0,screenshare:{allow:!0,quality:"hd",frame_rate:5}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1}},connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},reactions:!1,hidden_participant:!1,is_recorder:!1,show_participant_list:!0,can_change_participant_role:!1,can_change_theme:!1,max_screenshare_count:1},hs={setup_screen:{is_enabled:!0},alone_here:{is_enabled:!0},waiting_room:{is_enabled:!1,enable_preview:!0},control_bar:{is_enabled:!0,elements:{plugins:!0,screenshare:!0,invite:!0,participants:!0,chat:!0,reactions:!1,polls:!0,fullscreen:!0,layout:!0}},header:{is_enabled:!0,elements:{timer:!0,title:!0,participant_count:!0,change_layout:!0}},pip_mode:!0,auto_tune:!0,grid:{multi:{maxVideoCount:6,videoFit:"cover"},single:{maxVideoCount:6,videoFit:"cover"},defaultView:"multi"},controls:{pip_toggle:!1}},us="hXgU8Wc8pwuGNq9ms5q9Hh";function ps(){const e={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(t=>{e[t.feature.name]={enabled:t.enabled,value:t.feature_state_value}}),e}"undefined"!=typeof process&&null!=(os=null==process?void 0:{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BASE_URL:"https://stocomoapi.motilaloswal.com/api/",REACT_APP_CLIENT_URL:"https://stocomo.motilaloswal.com",REACT_APP_EMBED_URL:"https://stocomo.motilaloswal.com"})&&os.FLAGSMITH_ENVIRONMENT_KEY&&(us={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BASE_URL:"https://stocomoapi.motilaloswal.com/api/",REACT_APP_CLIENT_URL:"https://stocomo.motilaloswal.com",REACT_APP_EMBED_URL:"https://stocomo.motilaloswal.com"}.FLAGSMITH_ENVIRONMENT_KEY);var gs=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:us;De(this,"flags",{}),De(this,"environmentKey",null),this.environmentKey=e}identifyAndFetchFlagsWithRetry(e){return Be(this,arguments,function(e){var t=this;let{primaryEndpoint:i,secondaryEndpoint:r,forceEvaluate:n,timeout:s,uniqueIdentifier:a,traitsObj:o,logger:c}=e;return function*(){const e=JSON.parse(JSON.stringify(o)),l=Object.entries(e).map(e=>({trait_key:e[0],trait_value:e[1]})),d=[i,r,r];for(const i of d)try{const e=new AbortController,r=setTimeout(()=>e.abort(),s),o="_"+(Math.random()+1).toString(36).substring(2),c=yield fetch("https://".concat(i,"/api/v1/identities/"),{method:"POST",headers:{"Content-Type":"application/json","X-Environment-Key":t.environmentKey},body:JSON.stringify({identifier:a+(n?o:""),traits:l}),signal:e.signal});if(clearTimeout(r),!c.ok)throw new Error("Request failed with status ".concat(c.status));return ps((yield c.json()).flags||[])}catch(h){c.error("Flagsmith identify failed!!",{error:h,url:i})}return{}}()})}identify(e){return Be(this,arguments,function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"edge.api.flagsmith.com",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:console;return function*(){return t.flags=yield t.identifyAndFetchFlagsWithRetry({traitsObj:i,uniqueIdentifier:e,forceEvaluate:r,timeout:n,primaryEndpoint:s,secondaryEndpoint:"edge.api.flagsmith.com",logger:a}),t.flags}()})}getValue(e){return this.flags&&this.flags[e]&&this.flags[e].value}hasFeature(e){return this.flags&&this.flags[e]&&this.flags[e].enabled}getAllFlags(){return this.flags}},fs=new gs;var ms=[-2,-1,0,1,2],vs=[0,1,2,3,4];var bs=(e,t,i)=>{let r,n,s;if(0==t)r=n=s=i;else{const a=(e,t,i)=>(i<0&&(i+=1),i>1&&(i-=1),i<.16666666666666666?e+6*(t-e)*i:i<.5?t:i<.6666666666666666?e+(t-e)*(.6666666666666666-i)*6:e),o=i<.5?i*(1+t):i+t-i*t,c=2*i-o;r=a(c,o,e+1/3),n=a(c,o,e),s=a(c,o,e-1/3)}return[Math.round(255*r),Math.round(255*n),Math.round(255*s)]},ks=(e,t,i)=>{const r=e=>e.toString(16).padStart(2,"0");return"#".concat(r(e)).concat(r(t)).concat(r(i))},ys=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ms,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.4;const r=[],[n,s,a]=function(e){let t="0",i="0",r="0";return 4==(e=e.trim()).length?(t="0x"+e[1]+e[1],i="0x"+e[2]+e[2],r="0x"+e[3]+e[3]):e.length>6&&(t="0x"+e[1]+e[2],i="0x"+e[3]+e[4],r="0x"+e[5]+e[6]),[+t,+i,+r]}(e),[o,c,l]=((e,t,i)=>{e/=255,t/=255,i/=255;const r=Math.max(e,t,i),n=Math.min(e,t,i);let s,a;const o=(r+n)/2;if(r==n)s=a=0;else{const c=r-n;switch(a=o>.5?c/(2-r-n):c/(r+n),r){case e:s=(t-i)/c+(t70?i=.8:d>60?i=.9:d<10?i=.075:d<42&&(i=.3);const h=t.findIndex(e=>0===e);if(-1===h)throw new Error("Invalid reducer provided, it must contain atleast one zero");const u=(100-d)/(5-h),p=d/(h+1);for(const g of t){let e;e=g<0?d+g*p*i:g>0?d+g*u*i:d;const[t,n,s]=bs(o,c,e/100);r.push(ks(t,n,s))}return r},ws={background:{1e3:"#252525",900:"#2F2F2F",800:"#323232",700:"#3E3E3E",600:"#4A4A4A"},text:"#F5F5F5","video-bg":"#1C1C1C"},Ss={background:{1e3:"#FFFFFF",900:"#F5F5F5",800:"#EBEBEB",700:"#E0E0E0",600:"#D6D6D6"},text:"#111111","text-on-brand":"#ffffff","video-bg":"#DADADA"},xs={border_radius:"rounded",border_width:"thin",spacing_base:4,theme:"dark",colors:{brand:(e=>{const[t,i,r,n,s]=ys(e,ms);return{300:t,400:i,500:r,600:n,700:s}})("#2160FD"),background:(e=>{if("#FFFFFF"===e)return Ss.background;if("#000000"===e)return ws.background;const[t,i,r,n,s]=ys(e,vs);return{1e3:t,900:i,800:r,700:n,600:s}})("#141414"),danger:"#FF2D2D",text:"#EEEEEE",text_on_brand:"#EEEEEE",success:"#62A504",video_bg:"#191919",warning:"#FFCD07"}};function Es(){return zn(xs)}var Ts={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED",can_consume:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED",can_consume:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1},channel:{can_create:"ALL",can_delete:"ALL",can_update:"ALL",can_read_all:!1},message:{can_delete:"ALL",can_edit:"ALL",delete_cutoff_time_seconds:0,edit_cutoff_time_seconds:0}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{oldTheme:{setup_screen:{is_enabled:!1},alone_here:{is_enabled:!1},waiting_room:{is_enabled:!1,enable_preview:!0},control_bar:{is_enabled:!0,elements:{plugins:!0,screenshare:!0,invite:!1,participants:!0,chat:!0,reactions:!1,polls:!0,fullscreen:!0,layout:!0}},header:{is_enabled:!0,elements:{timer:!0,title:!0,participant_count:!0,change_layout:!0}},pip_mode:!0,auto_tune:!0,colors:{primary:"#2160FD",secondary:"#1A1A1A",text:"#EEEEEE",background:"#1A1A1A",textPrimary:"#EEEEEE",videoBackground:"#1A1A1A"},dimensions:{mode:"fillParent"},grid:{multi:{maxVideoCount:6,videoFit:"cover"},single:{maxVideoCount:6,videoFit:"cover"},defaultView:"MULTI"},controls:{pip_toggle:!1},plugins:[]},design_tokens:Es(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:24},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"hybrid"};var _s,Ps,Cs,As={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{design_tokens:Es(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:24},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"2.0.0"};function Rs(){return zn(As)}class Ls{constructor(){Ue(this,_s,void 0)}get telemetry(){var e;return null==(e=Ne(this,_s))?void 0:e.getValue("telemetry")}init(e){Fe(this,_s,e)}info(e,t,i){var r;null==(r=this.telemetry)||r.addLogInCurrentSpan("info",e,t,i)}error(e,t,i){var r;null==(r=this.telemetry)||r.addLogInCurrentSpan("error",e,t,i)}debug(e,t,i){var r;null==(r=this.telemetry)||r.addLogInCurrentSpan("debug",e,t,i)}log(e,t,i){var r;null==(r=this.telemetry)||r.addLogInCurrentSpan("log",e,t,i)}warn(e,t,i){var r;null==(r=this.telemetry)||r.addLogInCurrentSpan("warn",e,t,i)}}_s=new WeakMap;const Is=class extends nt.EventEmitter{constructor(e){super(),Ue(this,Ps,void 0),Ue(this,Cs,void 0),De(this,"asyncPromiseTimeout"),De(this,"logger"),this.logger=e,Fe(this,Ps,new Map),Fe(this,Cs,new Map),this.asyncPromiseTimeout=8e3}emitAsync(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;rnew Promise(t=>{Ne(this,Ps).get(e).push(t)}));((e,t,i)=>Ce(Te(e),i,t))(Is.prototype,this,"emit").call(this,e,...i),yield Promise.race([Promise.all(t),new Promise((t,i)=>setTimeout(()=>i(new Error("emitAsync failed to resolve for event ".concat(e,"."))),this.asyncPromiseTimeout))]),Ne(this,Ps).delete(e)})}onAsync(e,t){var i=this;const r=Ne(this,Ps),n=function(){for(var n=arguments.length,s=new Array(n),a=0;a0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Gs);const qs=Ws;function Ks(e){return e!==e}function Zs(e,t){return!!(null==e?0:e.length)&&function(e,t,i){return t===t?function(e,t,i){for(var r=i-1,n=e.length;++r-1}var Ys=Math.max;function Js(e,t){return qs(function(e,t,i){return t=Ys(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,s=Ys(r.length-t,0),a=Array(s);++no))return!1;var l=s.get(e),d=s.get(t);if(l&&d)return l==t&&d==e;var h=-1,u=!0,p=2&i?new ra:void 0;for(s.set(e,t),s.set(t,e);++h=t||i<0||h&&e-l>=s}function f(){var e=Pa();if(g(e))return m(e);o=setTimeout(f,function(e){var i=t-(e-c);return h?Aa(i,s-(e-l)):i}(e))}function m(e){return o=void 0,u&&r?p(e):(r=n=void 0,a)}function v(){var e=Pa(),i=g(e);if(r=arguments,n=this,c=e,i){if(void 0===o)return function(e){return l=e,o=setTimeout(f,t),d?p(e):a}(c);if(h)return clearTimeout(o),o=setTimeout(f,t),p(c)}return void 0===o&&(o=setTimeout(f,t)),a}return t=Vs(t)||0,Pi(i)&&(d=!!i.leading,s=(h="maxWait"in i)?Ca(Vs(i.maxWait)||0,t):s,u="trailing"in i?!!i.trailing:u),v.cancel=function(){void 0!==o&&clearTimeout(o),l=0,r=c=n=o=void 0},v.flush=function(){return void 0===o?a:m(Pa())},v}function La(e,t,i){(void 0!==i&&!ui(e[t],i)||void 0===i&&!(t in e))&&Ji(e,t,i)}function Ia(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Ma(e,t,i,r,n,s,a){var o=Ia(e,i),c=Ia(t,i),l=a.get(c);if(l)La(e,i,l);else{var d=s?s(o,c,i+"",e,t,a):void 0,h=void 0===d;if(h){var u=cr(c),p=!u&&ur(c),g=!u&&!p&&Er(c);d=c,u||p||g?cr(o)?d=o:function(e){return tr(e)&&Mr(e)}(o)?d=Hr(o):p?(h=!1,d=zr(c,!0)):g?(h=!1,d=Tn(c,!0)):d=[]:function(e){if(!tr(e)||"[object Object]"!=_i(e))return!1;var t=Yr(e);if(null===t)return!0;var i=ta.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&ea.call(i)==ia}(c)||or(c)?(d=o,or(o)?d=function(e){return er(e,Ur(e))}(o):(!Pi(o)||Ci(o))&&(d=Rn(c))):h=!1}h&&(a.set(c,d),n(d,c,r,s,a),a.delete(c)),La(e,i,d)}}function Da(e,t,i,r,n){e!==t&&_a(t,function(s,a){if(n||(n=new Ki),Pi(s))Ma(e,t,a,i,Da,r,n);else{var o=r?r(Ia(e,a),s,a+"",e,t,n):void 0;void 0===o&&(o=s),La(e,a,o)}},Ur)}function Oa(e,t,i){for(var r=-1,n=null==e?0:e.length;++r1?i[n-1]:void 0,a=n>2?i[2]:void 0;for(s=e.length>3&&"function"==typeof s?(n--,s):void 0,a&&function(e,t,i){if(!Pi(i))return!1;var r=typeof t;return!!("number"==r?Mr(i)&&gr(t,i.length):"string"==r&&t in i)&&ui(i[t],e)}(i[0],i[1],a)&&(s=n<3?void 0:s,n=1),t=Object(t);++r=200){var l=t?null:Ba(e);if(l)return ca(l);a=!1,n=sa,c=new ra}else c=t?[]:o;e:for(;++r(e.PARTICIPANT="PARTICIPANT",e.PEER="PEER",e.CLIENT="CLIENT",e))(Ha||{});const $a="propagate_kick_across_rooms",Ga="refresh_id_on_disconnection",Wa="skip_otel_traces",qa="enable_cf_simulcast",Ka="cf_transport_force_relay_on_ice_failed",Za="log_level",Ya="v1_plugins",Ja="feat_livestream",Qa="feat_paginated_chat",Xa="val_min_framerate",eo="screenshare_err_hack",to="screenshare_constraints_retry",io="video_constraints",ro="screenshare_constraints",no="feat_chat_sdk",so="chat_search",ao="obs_quality",oo="allow_safari_media_middlewares",co="exp_reshare",lo="skip_setting_in_use_device",ho="precall_bandwidth_test",uo="debug_socket_join",po="force_relay",go="force_video_codec",fo="track_hint",mo="override_simulcast_dynamic",vo="precreate_producers",bo="disable_opus_dtx_cf",ko="enable_audio_activity_debug_logs",yo="disable_layer_switch";function wo(e){const t={};return"number"==typeof(null==e?void 0:e.code)&&(t.code=e.code),"string"==typeof(null==e?void 0:e.code)&&(t.code=e.code.substring(0,100)),"string"==typeof(null==e?void 0:e.name)&&(t.name=e.name.substring(0,500)),"string"==typeof(null==e?void 0:e.message)&&(t.message=e.message.substring(0,500)),"string"==typeof(null==e?void 0:e.reason)&&(t.reason=e.reason.substring(0,500)),"string"==typeof(null==e?void 0:e.stack)&&(t.stack=e.stack.substring(0,500)),t}const So={audio:!0,video:!0,screenshareAudio:!0,screenshareVideo:!0},xo={baseURL:"http://localhost:5000",createdAt:"2021-08-05T10:49:56.602Z",description:"Develop plugins locally",id:"09259e3b-7be8-46f6-9801-106bf1866e1c",name:"Localhost Dev",organizationId:"4ad15a19-80e2-4105-bf43-48039fd2963e",picture:"https://dyte-uploads.s3.ap-south-1.amazonaws.com/dyte.png",private:!1,published:!0,staggered:!1,tags:["#localhost","#dev"],type:"self_hosted",updatedAt:"2021-08-05T10:50:07.681Z"},Eo={pip:!0,poll:!0,chat:!0,stage:!0,theme:!0,plugin:!0,tracing:!0,internals:!0,recording:!0,livestream:!0,participant:!0,connectedMeetings:!0,devTools:{logs:!1}};function To(e,t){const i=e.getValue("overrides");return!(!i||!i[t])&&i[t]}function _o(e){let{servicePrefix:t,baseURI:i}=e;return"".concat(t,".").concat(i)}function Po(e){const t=e.getValue("baseURI");return{location:_o({servicePrefix:"location",baseURI:t}),locationLegacy:_o({servicePrefix:"location-legacy",baseURI:t}),daCollector:_o({servicePrefix:"da-collector",baseURI:t.replace("realtime.cloudflare.com","dyte.io")})}}const Co=e=>{if(!e)return;if(!e.startsWith("{t(e)});const t=new Blob([e],{type:"image/svg+xml"}),i=new Image,r=window.URL.createObjectURL(t);return new Promise((e,t)=>{i.onload=()=>{e(i),window.URL.revokeObjectURL(r)},i.onerror=()=>{t(),window.URL.revokeObjectURL(r)},i.src=r})},Ao={logs:"https://api-silos.dyte.io/otel/logs",mock:{url:"https://mock.dyte.io",domain:"mock.dyte.io",app:"https://app.dyte.io/v2/meeting",stagingApp:"https://app.devel.dyte.io/v2/meeting"},apiBase:{prod:"https://api.dyte.io",staging:"https://api.devel.dyte.io",prodAlternate:"https://api.cluster.dyte.in"},baseURI:{prod:"dyte.io",staging:"devel.dyte.io"}};function Ro(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.getOwnPropertyNames(e).forEach(r=>{var n;if([null,void 0,NaN].includes(e[r])||t&&((null==(n=t.match(/\./g))?void 0:n.length)||0)>=10)return;const s=t?"".concat(t,".").concat(r):r;"object"==typeof e[r]?Ro(e[r],s,i):["number","string","boolean"].includes(typeof e[r])&&(i[s]=e[r])}),i}function Lo(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const n={};try{const e=JSON.stringify(i),t=Ro(JSON.parse(e),r),n=JSON.stringify(t);return JSON.parse(n)}catch(s){const e=wo(s);n["".concat(r,".error.message")]=e.message||"",n["".concat(r,".error.stack")]=e.stack||"",n["".concat(r,".error.reason")]=e.reason||"",n["".concat(r,".error.source")]="safelyFlattenObjForOpenTelemetry"}return n}const Io=class{constructor(){De(this,"logsCache",[]),De(this,"logsProcessorTimer"),De(this,"tracingEnabled",!0),De(this,"initialized",!1),De(this,"logsProcessingInterval",7e3),De(this,"logExclusionList",["message","websocket/message","roomMessage","websocket/room-message","websocket/room-legacy-mode","chatMessage","websocket/new-chat-message","websocket/no-active-speaker","websocket/selected-peers","websocket/active-speaker","ping","websocket/new-consumer","websocket/producer-score","websocket/consumer-score","websocket/plugin-event","websocket/plugin-data","websocket/plugin-internal-data"]),De(this,"meetingMetadata",{})}get logsEndpoint(){const e=Do.getContext(this.meetingMetadata.peerId);return"https://".concat(_o({servicePrefix:"api-silos",baseURI:e.getValue("baseURI")}),"/otel/logs")}resetPeerId(e){this.meetingMetadata.peerId=e}init(e,t,i){this.tracingEnabled=!0,this.initialized=!1,this.logsCache=[];const r=e.getValue("peerId");this.meetingMetadata=t,this.tracingEnabled=i,this.meetingMetadata.peerId=r,this.meetingMetadata.sdkVersion=e.getValue("sdkVersion");const{RNDeviceInfoImpl:n}=navigator;this.meetingMetadata.deviceInfo=navigator.isReactNative?null==n?void 0:n.getDeviceInfo():it.getDeviceInfo(),this.meetingMetadata.visitedUrl=!navigator.isReactNative&&"undefined"!=typeof window&&window.location.href,this.logsProcessorTimer=setInterval(this.processCachedLogs.bind(this),this.logsProcessingInterval),i&&(this.initialized=!0)}static trace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return(i,r,n)=>{const s=n.value;return n.value=function(){var i;const r=null==this?void 0:this.telemetry;for(var n=arguments.length,a=new Array(n),o=0;o{const t=performance.now();t-c>10&&r.addLogInCurrentSpan("info","".concat(e,"_timing"),{execTime:t-c,country:Io.location.country})}).catch(()=>{const t=performance.now();r.addLogInCurrentSpan("info","".concat(e,"_timing"),{execTime:t-c})}),l},n}}injectContext(e){var t;const i=u().replace(/-/g,"").substring(0,16),r=null==(t=this.meetingMetadata.peerId)?void 0:t.replace(/-/g,"");e.TRACEPARENT="00-".concat(r,"-").concat(i,"-01")}addLogInCurrentSpan(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];null!=i&&i.error&&Object.assign(i,{error:wo(i.error)});const n=Do.getContext(this.meetingMetadata.peerId);if(function(e){var t,i,r;const n="undefined"!=typeof navigator&&!navigator.isReactNative&&"undefined"!=typeof window&&(null==(t=window.location.host)?void 0:t.includes(Ao.baseURI.staging)),s=!(null==(r=null==(i=null==e?void 0:e.getValue("modules"))?void 0:i.devTools)||!r.logs);return n||s}(n)&&(function(e){if(null==e)return!0;if(Mr(e)&&(cr(e)||"string"==typeof e||"function"==typeof e.splice||ur(e)||Er(e)||or(e)))return!e.length;var t=bn(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Cr(e))return!Ir(e).length;for(var i in e)if(Na.call(e,i))return!1;return!0}(i)?console[e]("InternalLogs:: ",e,t):console[e]("InternalLogs:: ",e,t,i)),function(e,t){var i;if(null!=e&&e.getValue("flagsmith").hasFeature(Za)){let r=(null==(i=e.getValue("flagsmith").getValue(Za))?void 0:i.toString())||"all";if(r=r.toLowerCase().trim(),"off"===r)return!1;if("all"!==r){const e=["debug","log","info","warn","error"];if(e.indexOf(t){this.addLogInCurrentSpan("error","opentelemetry::sendOtelLogToNewRelic_failed",{error:wo(t)}),this.logsCache.push(...e)})}processCachedLogs(){const e=this.logsCache.splice(0,25);null!=e&&e.length&&this.sendOtelLogsToNewRelic(e)}destruct(){clearInterval(this.logsProcessorTimer),this.processCachedLogs()}};let Mo=Io;De(Mo,"location",{country:void 0});const Do=new class{constructor(){De(this,"contexts",new Map),De(this,"mostRecentPeerId",null)}createContext(e,t){if(this.contexts.has(e))return this.contexts.get(e);const i=new Mo,r=new Ls;this.contexts.set(e,function(e){const t=Le({},e),i=new Map,r=e=>{var r;null==(r=i.get(e))||r.forEach(i=>{try{i(t[e])}catch(r){}})};return{subscribe:(e,t)=>(i.has(e)||i.set(e,new Set),i.get(e).add(t),()=>{var r;return null==(r=i.get(e))?void 0:r.delete(t)}),unsubscribe:(e,t)=>{var r;null==(r=i.get(e))||r.delete(t)},notify:r,setValue:function(e,i){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t[e]=i,n&&r(e)},getValue:e=>t[e],getAllValues:()=>t}}(t)),this.contexts.get(e).setValue("peerSessionStore",new Ms(r));const n=new hi;return n.setMaxListeners(50),this.contexts.get(e).setValue("logger",r),this.contexts.get(e).setValue("telemetry",i),this.contexts.get(e).setValue("callstats",n),this.contexts.get(e).setValue("flagsmith",function(e){return new gs(e)}()),this.mostRecentPeerId=e,this.contexts.get(e)}remapContext(e,t){const i=t.getValue("peerId");i!==e&&(t.setValue("peerId",e),this.mostRecentPeerId=e,this.contexts.set(e,t),this.contexts.delete(i))}getContext(e){return this.contexts.get(e)}getMostRecentPeerId(){return this.mostRecentPeerId}},Oo={"00":"Client","01":"Controller","02":"RoomNodeClient","03":"HiveNodeClient","04":"SocketService","05":"Chat","06":"Plugin","07":"Polls","08":"Meta","09":"Preset",10:"Recording",11:"Self",12:"Participant",13:"Spotlight",14:"Remote Request",15:"Webinar",16:"LocalMediaHandler",17:"End-End Encryption",18:"AI",19:"Livestream",20:"Stage"},No={"0000":"Internal exception.","0001":"Failed to initialize.","0002":"Failed to join room.","0003":"Failed to leave room.","0004":"Invalid auth token","0010":"Browser not supported","0011":"HTTP Network Error","0012":"Websocket Network Error","0013":"Rate Limited","0100":"Internal exception","0101":"Permission denied","0102":"Prerequisite module missing","0200":"Internal exception.","0300":"Internal exception","0400":"Internal exception","0404":"Missing prerequisites to establish a websocket connection","0500":"Internal exception","0501":"Permission denied.","0502":"Invalid message body.","0503":"Text Message is too large","0504":"Message not found by the given id","0505":"Action not permitted without joining room","0506":"Message search is disabled","0510":"Invalid channel name.","0600":"Internal exception","0601":"Permission denied.","0602":"Auth token not set for plugin","0603":"Iframe was not provided","0700":"Internal exception","0705":"Action not permitted without joining room","0800":"Internal exception","0801":"Permission denied","0900":"Internal exception","0904":"Could not load preset",1e3:"Internal exception",1001:"Permission denied",1004:"Could not find specified recording",1005:"Action not permitted in given recording state",1100:"Internal exception",1101:"Permission denied",1102:"Unsupported",1103:"Name cannot be empty",1104:"No device selected while calling meeting.self.setDevice",1105:"Action not permitted without joining room",1106:"Can't set currently used device",1200:"Internal exception",1201:"Permission denied",1202:"Invalid page number was requested",1203:"Invalid participant count per page was requested",1204:"No participants exists with the given UserIds",1205:"Action not permitted without joining room",1206:"Manual Subscription Mode was not ACTIVATED",1207:"Invalid view mode",1208:"Manual Subscription not enabled for organization",1209:"Broadcast message type must be a non-empty string",1300:"Internal exception",1400:"Internal exception",1402:"No existing remote requests",1403:"No peer exists with given id",1500:"Internal exception",1600:"Internal exception",1601:"Failed to get audio track",1602:"Failed to get video track",1603:"Incorrect device",1604:"Failed to change device",1605:"Failed to get audio & video track",1606:"No audio input devices are available",1607:"No video input devices are available",1608:"No audio output devices (speakers) are available",1609:"Failed to fetch list of media devices",1610:"No media track exists",1611:"Failed to unmute track",1612:"Failed to get screenshare tracks",1701:"Crypto error",1800:"Internal exception",1801:"Can't fetch transcript file",1900:"Internal exception",1901:"Permission denied.",1902:"Livestream that has not yet started, can't be stopped",2e3:"Internal exception",2001:"Permission denied",2002:"Unsupported",2003:"Stage is disabled",2004:"Method not implemented",2005:"Action not permitted without joining room",2006:"Action not permitted in current stage status",9900:"Internal exception"};Object.keys(No).forEach(e=>{No[e]="{".concat(Oo[e.slice(0,2)],"} ").concat(No[e])});class Uo extends Error{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(e),De(this,"code"),this.code=t,this.name="ClientError",this.message="[ERR".concat(this.code,"]: ").concat(No[this.code],"\n").concat(this.message);try{let e=r&&!!i;t&&t.endsWith("00")&&i&&(e=!0),e&&i.error("ClientError",{error:{message:this.message,name:this.name,code:t}});const s=Do.getContext(Do.getMostRecentPeerId());if(s){const e=s.getValue("onError");try{e(this)}catch(n){}}"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("ClientError",{detail:this}))}catch(s){}}}function Fo(e,t,i,r){if(r instanceof Uo)throw r;if(r instanceof t){const e=new Uo(r.message,i);throw e.stack=r.stack,e}throw r}function jo(e,t,i){if(!e.value){const r=e.get,n=e.set;return r&&(e.get=function(){try{return r.apply(this)}catch(e){Fo(0,t,i,e)}}),n&&(e.set=function(e){try{return n.apply(this,[e])}catch(r){Fo(0,t,i,r)}}),e}const r=e.value;return e.value=function(){try{for(var e=arguments.length,n=new Array(e),s=0;s{Fo(0,t,i,e)}):a}catch(a){Fo(0,t,i,a)}},e}const Bo=e=>function(e,t){return(i,r,n)=>{if(n)return jo(n,e,t);for(const s of Reflect.ownKeys(i.prototype).filter(e=>"constructor"!==e)){const r=Object.getOwnPropertyDescriptor(i.prototype,s);(r.value instanceof Function||r.get instanceof Function||r.set instanceof Function)&&Object.defineProperty(i.prototype,s,jo(r,e,t))}}}(Error,e);var Vo=(e=>(e.NEW_PRODUCER="NEW_PRODUCER",e.ROOM_NODE_CONNECTION_ERROR="ROOM_NODE_CONNECTION_ERROR",e.SOCKET_SERVICE_ROOM_JOINED="SOCKET_SERVICE_ROOM_JOINED",e.SOCKET_SERVICE_RECONNECTED="SOCKET_SERVICE_RECONNECTED",e.SOCKET_SERVICE_DISCONNECTED="SOCKET_SERVICE_DISCONNECTED",e.SOCKET_SERVICE_FAILED="SOCKET_SERVICE_FAILED",e.SOCKET_STATE_UPDATE="SOCKET_STATE_UPDATE",e.ROOM_NODE_RECONNECTED="ROOM_NODE_RECONNECTED",e.ROOM_NODE_DISCONNECTED="ROOM_NODE_DISCONNECTED",e.ROOM_NODE_FAILED="ROOM_NODE_FAILED",e.TRANSPORT_STATE_UPDATE="TRANSPORT_STATE_UPDATE",e.PRODUCER_SCORE_UPDATE="PRODUCER_SCORE_UPDATE",e.CONSUMER_SCORE_UPDATE="CONSUMER_SCORE_UPDATE",e.PRODUCER_STATUS_UPDATE="PRODUCER_STATUS_UPDATE",e.CONSUMER_STATUS_UPDATE="CONSUMER_STATUS_UPDATE",e.LOW_CONSUMER_SCORE="LOW_CONSUMER_SCORE",e.MEDIA_PERMISSION_ERROR="MEDIA_PERMISSION_ERROR",e.MEDIA_PERMISSION_UPDATE="MEDIA_PERMISSION_UPDATE",e.MESSAGE="websocket/message",e.ROOM_MESSAGE="websocket/room-message",e.PEER_JOINED_INTERNAL="peer/joined-internal",e.PEER_CLOSED="websocket/peer-closed",e.CONSUMER_CLOSED="websocket/consumer-closed",e.CONSUMER_PAUSED="websocket/consumer-paused",e.CONSUMER_RESUMED="websocket/consumer-resumed",e.PRODUCER_CLOSED="websocket/producer-closed",e.NEW_CONSUMER="websocket/new-consumer",e.PRODUCER_SCORE="websocket/producer-score",e.CONSUMER_SCORE="websocket/consumer-score",e.PRODUCER_TOGGLE="cf/producer-toggle",e.UPDATE_ACTIVE="media/update-active",e.RESET_PRODUCER_STATE="cf/reset-producer-state",e.ROOM_STATE="sockethub/room-state",e.GET_STAGE_REQUESTS="GET_STAGE_REQUESTS",e.UPDATE_STAGE_REQUESTS="UPDATE_STAGE_REQUESTS",e.KICK_PEER="KICK_PEER",e.UPDATE_PEER_STAGE_STATUS="UPDATE_PEER_STAGE_STATUS",e.JOIN_MEDIA_ROOM="JOIN_MEDIA_ROOM",e.LEAVE_MEDIA_ROOM="LEAVE_MEDIA_ROOM",e.PIP_HANGUP="PIP_HANGUP",e.E2EE_ACTIVE_PRODUCER="E2EE_ACTIVE_PRODUCER",e.E2EE_INACTIVE_PRODUCER="E2EE_INACTIVE_PRODUCER",e.E2EE_ACTIVE_CONSUMER="E2EE_ACTIVE_CONSUMER",e.E2EE_INACTIVE_CONSUMER="E2EE_INACTIVE_CONSUMER",e.SOCKET_PEERS="SOCKET_PEERS",e.UPDATE_PERMISSIONS="UPDATE_PERMISSIONS",e.MAX_SPATIAL_LAYER_CHANGE="MAX_SPATIAL_LAYER_CHANGE",e.MUTE_SELF="MUTE_SELF",e.MUTE_SELF_VIDEO="MUTE_SELF_VIDEO",e))(Vo||{});class zo extends nt.EventEmitter{constructor(e){super(),De(this,"logger"),this.logger=e,super.setMaxListeners(25)}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r25&&t%25===0&&(null==(i=this.logger)||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(r){}return super.on(e,t)}addListener(e,t){var i;try{const t=this.listenerCount(e);t>25&&t%25===0&&(null==(i=this.logger)||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(r){}return super.addListener(e,t)}off(e,t){return super.off(e,t)}once(e,t){return super.once(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeListener(e,t){return super.removeListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}class Ho extends nt.EventEmitter{constructor(e){super(),De(this,"logger"),this.logger=e,super.setMaxListeners(25)}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r25&&t%25===0&&(null==(i=this.logger)||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(r){}return super.on(e,t)}addListener(e,t){var i;try{const t=this.listenerCount(e);t>25&&t%25===0&&(null==(i=this.logger)||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(r){}return super.addListener(e,t)}off(e,t){return super.off(e,t)}once(e,t){return super.once(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeListener(e,t){return super.removeListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}function $o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e.replace(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/g,"").trim().split(/\s+/).slice(0,t).map(e=>e.charAt(0)).join("").toUpperCase()}const Go=(e,t,i,r,n,s)=>{const a=n,o=s,c=Math.min(i/a,r/o);let l,d,h,u,p=a*c,g=o*c,f=1;return pa&&(h=a),u>o&&(u=o),[l,d,h,u,e,t,i,r]};var Wo,qo,Ko,Zo,Yo,Jo,Qo,Xo,ec,tc,ic,rc,nc;const sc=class extends Ho{constructor(e,t,i,r){var n;super(e.getValue("logger")),n=this,Ue(this,Wo,void 0),Ue(this,qo,void 0),Ue(this,Ko,void 0),Ue(this,Zo,void 0),Ue(this,Yo,{height:1080,width:1920}),Ue(this,Jo,{brand:"#2160FD",background:"#141414",text:"#000000",videoBackground:"#191919",textOnBrand:"#EEEEEE"}),Ue(this,Qo,void 0),Ue(this,Xo,{}),Ue(this,ec,void 0),Ue(this,tc,void 0),Ue(this,ic,void 0),Ue(this,rc,void 0),Ue(this,nc,!1),De(this,"cleanupEventListeners",()=>{Ne(this,qo).unsubscribe("stageStatus",this.handlePipMediaControls),Ne(this,ec).removeListener("videoUpdate",this.onSelfVideoUpdateListener),Ne(this,ec).removeListener("audioUpdate",this.onSelfAudioUpdateListener),Ne(this,ec).removeListener("roomLeft",()=>this.disable())}),De(this,"enablePipMediaControls",()=>{this.mountAudioEvents(),this.mountVideoEvents()}),De(this,"onSelfVideoUpdateListener",e=>{let{videoEnabled:t}=e;this.updateMediaSession("CAMERA",t)}),De(this,"onSelfAudioUpdateListener",e=>{let{audioEnabled:t}=e;this.updateMediaSession("MIC",t)}),De(this,"handlePipMediaControls",e=>{"ON_STAGE"===e?this.enablePipMediaControls():this.unmountEvents()}),De(this,"eventCallback",e=>{"CAMERA"===e&&(Ne(this,ec).videoEnabled?Ne(this,ec).disableVideo():Ne(this,ec).enableVideo(),this.emit("cameraToggled")),"MIC"===e&&(Ne(this,ec).audioEnabled?Ne(this,ec).disableAudio():Ne(this,ec).enableAudio(),this.emit("micToggled")),"END"===e&&(Ne(this,qo).getValue("peerSessionStore").emit(Vo.PIP_HANGUP),this.cleanupEventListeners(),this.emit("hangup"),this.cleanup())}),De(this,"unmountEvents",()=>{void 0===navigator.mediaSession||void 0===navigator.mediaSession.setCameraActive||(navigator.mediaSession.setActionHandler("togglemicrophone",void 0),navigator.mediaSession.setActionHandler("togglecamera",void 0))}),De(this,"animate",()=>{this.isActive||"active"!==Ne(this,rc)?(void 0!==Ne(this,Xo)&&this.paintCanvas(),void 0!==Ne(this,Qo)&&Fe(this,Qo,requestAnimationFrame(()=>this.animate()))):this.disable(!0)}),De(this,"disable",function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Fe(n,rc,"idle"),n.cleanupEventListeners(),cancelAnimationFrame(Ne(n,Qo)),!0!==e&&document.body.removeChild(Ne(n,Ko)),Fe(n,Qo,void 0),document.pictureInPictureElement&&document.exitPictureInPicture()}),Fe(this,qo,e),Fe(this,rc,"idle"),Fe(this,ec,t),Fe(this,Jo,{brand:t.config.designTokens.colors.brand[500],background:t.config.designTokens.colors.background[1e3],text:t.config.designTokens.colors.text,videoBackground:t.config.designTokens.colors.videoBg,textOnBrand:t.config.designTokens.colors.textOnBrand}),i&&this.setupIcon("pin",i),r&&this.setupIcon("handRaise",r)}static _init(e,t){return Be(this,null,function*(){let i,r;try{i=yield Co(''),r=yield Co('')}catch(n){}return new sc(e,t,i,r)})}setupIcon(e,t){return Be(this,null,function*(){switch(e){case"handRaise":Fe(this,ic,t);break;case"pin":Fe(this,tc,t)}})}overrideIcon(e,t){return Be(this,null,function*(){switch(e){case"handRaise":Fe(this,ic,yield Co(t));break;case"pin":Fe(this,tc,yield Co(t))}})}constructImage(e){const t=new Image,i=new Blob([e],{type:"image/svg+xml"}),r=window.URL.createObjectURL(i);return new Promise(e=>{t.onload=()=>{e(t),window.URL.revokeObjectURL(r)},t.src=r})}createVideoContainer(){Fe(this,Ko,document.createElement("div")),Ne(this,Ko).style.width="0.1px",Ne(this,Ko).style.height="0.1px",Ne(this,Ko).style.overflow="hidden",Ne(this,Ko).style.position="absolute",Ne(this,Ko).style.bottom="0",Ne(this,Ko).style.right="0",Ne(this,Ko).style.opacity="0",Ne(this,Ko).appendChild(Ne(this,Zo))}setupEventListeners(){Ne(this,qo).subscribe("stageStatus",this.handlePipMediaControls),Ne(this,ec).addListener("videoUpdate",this.onSelfVideoUpdateListener),Ne(this,ec).addListener("audioUpdate",this.onSelfAudioUpdateListener),Ne(this,ec).addListener("roomLeft",()=>this.disable())}createCanvas(){const e=document.createElement("canvas");e.height=Ne(this,Yo).height,e.width=Ne(this,Yo).width,Fe(this,Wo,e)}setupMediaSessionEvents(){void 0===navigator.mediaSession||void 0===navigator.mediaSession.setCameraActive||(navigator.mediaSession.setActionHandler("hangup",()=>{this.eventCallback("END")}),this.mountAudioEvents(),this.mountVideoEvents())}mountAudioEvents(){void 0===navigator.mediaSession||void 0===navigator.mediaSession.setMicrophoneActive||Ne(this,ec).permissions.canProduceAudio&&navigator.mediaSession.setActionHandler("togglemicrophone",()=>{this.eventCallback("MIC")})}mountVideoEvents(){void 0===navigator.mediaSession||void 0===navigator.mediaSession.setCameraActive||Ne(this,ec).permissions.canProduceVideo&&navigator.mediaSession.setActionHandler("togglecamera",()=>{this.eventCallback("CAMERA")})}getSources(){const e=Object.values(Ne(this,Xo)).reduce((e,t)=>(e[t.pinned?"pinned":"regular"].push(t),e),{pinned:[],regular:[]});return[...e.pinned,...e.regular]}drawEmptyTile(e,t,i,r){if(void 0===Ne(this,Wo))return;const n=Ne(this,Wo).getContext("2d"),s=Ne(this,Wo).width,a=t-0,o=i-0,c=Math.floor(s/a),l=e%c*(a+0)+0,d=Math.floor(e/c)*(o+0)+0,{displayText:h,image:u}=null!=r?r:{};n.fillStyle=h||u?Ne(this,Jo).videoBackground:Ne(this,Jo).background,n.strokeStyle=Ne(this,Jo).brand,n.beginPath(),n.moveTo(l+0,d),n.arcTo(l+a,d,l+a,d+0,0),n.arcTo(l+a,d+o,l+a-0,d+o,0),n.arcTo(l,d+o,l,d+o-0,0),n.arcTo(l,d,l+0,d,0),n.closePath(),n.fill(),n.stroke();const p=a/6,g=a/2+l,f=o/2+d;n.save(),(h||u)&&(n.beginPath(),n.arc(g,f,p,0,2*Math.PI),n.fillStyle=Ne(this,Jo).brand,n.fill(),u?(n.clip(),n.drawImage(u,g-p,f-p,2*p,2*p),n.restore()):h&&(n.fillStyle=Ne(this,Jo).textOnBrand,n.font="".concat(p/2,"px sans-serif"),n.textAlign="center",n.textBaseline="middle",n.fillText(h,g,f)),this.drawIcons(r,l,d,Math.max(a,o)))}drawIcons(e,t,i,r){const n=Math.min(Math.max(.15*r,100),200),s=.2*n,a=.2*n;let o=t+s;const c=i+s,l=e=>{const t=Ne(this,Wo).getContext("2d");t.save(),t.fillStyle=Ne(this,Jo).background,t.beginPath(),t.moveTo(o+a,c),t.arcTo(o+n,c,o+n,c+a,a),t.arcTo(o+n,c+n,o+n-a,c+n,a),t.arcTo(o,c+n,o,c+n-a,a),t.arcTo(o,c,o+a,c,a),t.closePath(),t.fill(),"string"==typeof e?(t.font="".concat(n/1.5,"px sans-serif"),t.fillStyle=Ne(this,Jo).text,t.textAlign="center",t.textBaseline="top",t.fillText(e,n/2+o,c+s)):t.drawImage(e,o+s,c+s,n-2*s,n-2*s),o+=n+s,t.restore()};e.pinned&&l(Ne(this,tc)),e.handRaised&&l(Ne(this,ic)),e.reaction&&l(e.reaction)}drawTile(e,t,i){var r,n;if(void 0===Ne(this,Wo))return;const s=Ne(this,Wo).getContext("2d"),a=this.getSources();let o=0,c=0;for(;o0?e+1:e);const[t,i]=this.calcGridElemSize(e);this.drawTile(t,i,e)}isSupported(){var e;return!!window.chrome&&document.pictureInPictureEnabled&&"LIVESTREAM"!==(null==(e=Ne(this,ec).config)?void 0:e.viewType)}get isActive(){return null!==document.pictureInPictureElement}cleanup(){if(Fe(this,nc,!1),this.isSupported()&&void 0!==document.exitPictureInPicture&&null!==document.pictureInPictureElement&&document.exitPictureInPicture(),Ne(this,Ko))try{document.body.removeChild(Ne(this,Ko))}catch(e){}this.removeAllSources(),Fe(this,Wo,void 0),Fe(this,Zo,void 0),Fe(this,Qo,void 0)}init(){let{height:e,width:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.isSupported())throw this.logger.error("Pip.unsupported"),new Error("Picture-in-picture is not available in this environment");if(Ne(this,nc))return;Fe(this,nc,!0),this.createCanvas(),this.setupMediaSessionEvents();const i=document.createElement("video");Fe(this,Yo,{height:null!=e?e:1080,width:null!=t?t:1920}),i.height=Ne(this,Yo).height,i.width=Ne(this,Yo).width,i.autoplay=!0,i.muted=!0,i.srcObject=Ne(this,Wo).captureStream(24),Fe(this,Zo,i),Ne(this,Zo).onloadedmetadata=()=>{try{this.emit("pipStarted"),Ne(this,Zo).onleavepictureinpicture=()=>{this.emit("pipEnded")}}catch(e){this.emit("pipEnded")}},this.createVideoContainer(),this.paintCanvas()}updateMediaSession(e,t){void 0!==navigator.mediaSession&&("CAMERA"===e&&void 0!==navigator.mediaSession.setCameraActive&&navigator.mediaSession.setCameraActive(t),"MIC"===e&&void 0!==navigator.mediaSession.setMicrophoneActive&&navigator.mediaSession.setMicrophoneActive(t))}enableSource(e){void 0!==Ne(this,Xo)[e]&&(Ne(this,Xo)[e].enabled=!0)}disableSource(e){void 0!==Ne(this,Xo)[e]&&(Ne(this,Xo)[e].enabled=!1)}generateAvatar(e,t){return Be(this,null,function*(){if(!t)return;const i=new Image;try{const r=yield(yield fetch(t)).blob(),n=window.URL.createObjectURL(r);i.onload=()=>{this.updateSource(e,{image:i}),window.URL.revokeObjectURL(n)},i.src=n}catch(r){this.logger.error("Pip::GenerateAvatar",{error:r})}})}addSource(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];this.logger.debug("Pip::AddSource",{pip:{id:e,handRaised:a}}),Ne(this,Xo)[e]={id:e,element:t,enabled:i,pinned:r,displayText:n?$o(n):void 0,imageUrl:s,handRaised:a},s&&this.generateAvatar(e,s)}updateSource(e,t){this.logger.info("Pip::UpdateSource",{pip:{id:e,handRaised:t.handRaised,reaction:t.reaction}});const i=Ne(this,Xo)[e];i&&(Ne(this,Xo)[e]=Le(Le({},i),t))}removeSource(e){delete Ne(this,Xo)[e]}removePinnedSource(){Object.values(Ne(this,Xo)).forEach(e=>{e.pinned&&this.removeSource(e.id)})}removeAllSources(){Fe(this,Xo,{})}enable(){Fe(this,rc,"activating"),this.setupEventListeners(),this.updateMediaSession("CAMERA",Ne(this,ec).videoEnabled),this.updateMediaSession("MIC",Ne(this,ec).audioEnabled),document.body.appendChild(Ne(this,Ko)),Fe(this,Qo,requestAnimationFrame(()=>this.animate())),Ne(this,Zo).onloadedmetadata=()=>{Ne(this,Zo).requestPictureInPicture().then(()=>{Fe(this,rc,"active")})},4===Ne(this,Zo).readyState&&Ne(this,Zo).requestPictureInPicture().then(()=>{Fe(this,rc,"active")})}};let ac=sc;var oc,cc;Wo=new WeakMap,qo=new WeakMap,Ko=new WeakMap,Zo=new WeakMap,Yo=new WeakMap,Jo=new WeakMap,Qo=new WeakMap,Xo=new WeakMap,ec=new WeakMap,tc=new WeakMap,ic=new WeakMap,rc=new WeakMap,nc=new WeakMap,function(e){e[e.PUBLISHER=0]="PUBLISHER",e[e.SUBSCRIBER=1]="SUBSCRIBER"}(oc||(oc={})),function(e){e[e.AUDIO=0]="AUDIO",e[e.VIDEO=1]="VIDEO"}(cc||(cc={}));const lc=new class extends pe{constructor(){super("media.Codec",[{no:1,name:"channels",kind:"scalar",opt:!0,T:5},{no:2,name:"clock_rate",kind:"scalar",T:5},{no:3,name:"mime_type",kind:"scalar",T:9},{no:4,name:"sdp_fmtp_line",kind:"scalar",opt:!0,T:9},{no:5,name:"payload_type",kind:"scalar",opt:!0,T:13}])}};const dc=new class extends pe{constructor(){super("media.HeaderExtension",[{no:1,name:"direction",kind:"scalar",opt:!0,T:9},{no:2,name:"uri",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.Fingerprint",[{no:1,name:"algorithm",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}])}};const hc=new class extends pe{constructor(){super("media.SessionDescription",[{no:1,name:"target",kind:"enum",T:()=>["media.Target",oc]},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"sdp",kind:"scalar",T:9}])}};const uc=new class extends pe{constructor(){super("media.ProducerPayload",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"msid",kind:"scalar",T:9},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"mime_type",kind:"scalar",opt:!0,T:9}])}};const pc=new class extends pe{constructor(){super("media.CreateTransportRequest",[{no:1,name:"consuming",kind:"scalar",T:8},{no:2,name:"force_tcp",kind:"scalar",opt:!0,T:8},{no:3,name:"description",kind:"message",T:()=>hc},{no:4,name:"private_ice",kind:"scalar",opt:!0,T:8},{no:5,name:"producers",kind:"message",repeat:1,T:()=>uc}])}};const gc=new class extends pe{constructor(){super("media.AudioActivityRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"energy",kind:"scalar",T:5},{no:3,name:"silent",kind:"scalar",T:8}])}};const fc=new class extends pe{constructor(){super("media.CreateTransportResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>hc},{no:3,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:4,name:"producer_ids",kind:"scalar",repeat:2,T:9}])}};const mc=new class extends pe{constructor(){super("media.RenegotiateRequest",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>hc}])}};new class extends pe{constructor(){super("media.RenegotiateResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>hc}])}};const vc=new class extends pe{constructor(){super("media.NestedScore",[{no:1,name:"encoding_idx",kind:"scalar",T:5},{no:2,name:"rid",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5},{no:4,name:"ssrc",kind:"scalar",T:3,L:0}])}};const bc=new class extends pe{constructor(){super("media.ProducerTrack",[{no:1,name:"track_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9},{no:3,name:"stream_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.ProducerEntry",[{no:1,name:"producing_transport_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.ConsumerEntry",[{no:1,name:"consuming_transport_id",kind:"scalar",T:9},{no:2,name:"consumer_id",kind:"scalar",T:9}])}};const kc=new class extends pe{constructor(){super("media.ProducerState",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"kind",kind:"enum",T:()=>["media.ProducerKind",cc]},{no:3,name:"pause",kind:"scalar",T:8},{no:4,name:"screen_share",kind:"scalar",T:8},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"codec",kind:"message",T:()=>lc}])}};const yc=new class extends pe{constructor(){super("media.ConsumerState",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>kc},{no:3,name:"producer_track",kind:"message",T:()=>bc},{no:4,name:"error_code",kind:"scalar",opt:!0,T:9}])}};const wc=new class extends pe{constructor(){super("media.ProducerIdToConsumerMap",[{no:1,name:"map",kind:"map",K:9,V:{kind:"message",T:()=>yc}}])}};const Sc=new class extends pe{constructor(){super("media.PeerRtpCapabilitites",[{no:1,name:"sender",kind:"message",T:()=>Ec},{no:2,name:"receiver",kind:"message",T:()=>Ec}])}};const xc=new class extends pe{constructor(){super("media.RtpCapability",[{no:1,name:"codecs",kind:"message",repeat:1,T:()=>lc},{no:2,name:"header_extensions",kind:"message",repeat:1,T:()=>dc}])}};const Ec=new class extends pe{constructor(){super("media.RtpCapabilitites",[{no:1,name:"audio",kind:"message",T:()=>xc},{no:2,name:"video",kind:"message",T:()=>xc}])}};const Tc=new class extends pe{constructor(){super("media.PreferredCodec",[{no:1,name:"audio",kind:"scalar",opt:!0,T:9},{no:2,name:"video",kind:"scalar",opt:!0,T:9}])}};const _c=new class extends pe{constructor(){super("media.Simulcast",[{no:1,name:"preferred_rid",kind:"scalar",opt:!0,T:9},{no:2,name:"priority_ordering",kind:"scalar",opt:!0,T:9},{no:3,name:"rid_not_available",kind:"scalar",opt:!0,T:9}])}};const Pc=new class extends pe{constructor(){super("media.edge.GeoLocation",[{no:1,name:"latitude",kind:"scalar",T:2},{no:2,name:"longitude",kind:"scalar",T:2},{no:3,name:"region",kind:"scalar",opt:!0,T:9}])}};const Cc=new class extends pe{constructor(){super("media.edge.PeerJoinRequest",[{no:1,name:"display_name",kind:"scalar",opt:!0,T:9},{no:2,name:"prejoined",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:5,name:"preset",kind:"scalar",opt:!0,T:12},{no:6,name:"user_id",kind:"scalar",opt:!0,T:9},{no:7,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:8,name:"location",kind:"message",T:()=>Pc},{no:9,name:"capabilities",kind:"message",T:()=>Sc}])}};const Ac=new class extends pe{constructor(){super("media.edge.PeerJoinCompleteRequest",[])}};const Rc=new class extends pe{constructor(){super("media.edge.PeerLeaveRequest",[{no:1,name:"close_room",kind:"scalar",T:8}])}};new class extends pe{constructor(){super("media.edge.ConsumeMultipleProducerRequest",[{no:1,name:"producer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8}])}};const Lc=new class extends pe{constructor(){super("media.edge.ConsumePeerRequest",[{no:1,name:"producing_peer_id",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8},{no:3,name:"producer_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preferred_codec",kind:"message",T:()=>Tc},{no:5,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:6,name:"simulcast",kind:"message",T:()=>_c}])}};const Ic=new class extends pe{constructor(){super("media.edge.ConsumePeersRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Lc},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}};const Mc=new class extends pe{constructor(){super("media.edge.UpdateConsumerSimulcastConfigRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"simulcast",kind:"message",T:()=>_c},{no:3,name:"producing_transport_id",kind:"scalar",T:9},{no:4,name:"mid",kind:"scalar",T:9}])}};const Dc=new class extends pe{constructor(){super("media.edge.UpdateConsumersSimulcastConfigRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Mc},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}};const Oc=new class extends pe{constructor(){super("media.edge.ProducerCreateRequest",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"description",kind:"message",T:()=>hc},{no:5,name:"msid",kind:"scalar",T:9},{no:6,name:"app_data",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}};new class extends pe{constructor(){super("media.edge.SelectedPeersRequest",[])}};const Nc=new class extends pe{constructor(){super("media.edge.GlobalPeerPinningRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};const Uc=new class extends pe{constructor(){super("media.edge.ProducerToggleRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}};new class extends pe{constructor(){super("media.edge.ConsumerToggleRequest",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}};const Fc=new class extends pe{constructor(){super("media.edge.ProducerCloseRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>hc},{no:3,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}};const jc=new class extends pe{constructor(){super("media.edge.ConsumerCloseRequest",[{no:1,name:"consumer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"description",kind:"message",T:()=>hc},{no:3,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}};new class extends pe{constructor(){super("media.edge.KickPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};const Bc=new class extends pe{constructor(){super("media.edge.KickAllPeersRequest",[{no:1,name:"propagate_kick_across_rooms",kind:"scalar",T:8}])}};const Vc=new class extends pe{constructor(){super("media.edge.PeerDisplayNameEditRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}};const zc=new class extends pe{constructor(){super("media.edge.HostMediaControlForPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"audio",kind:"scalar",T:8},{no:3,name:"video",kind:"scalar",T:8},{no:4,name:"scree_share",kind:"scalar",T:8}])}};const Hc=new class extends pe{constructor(){super("media.edge.HostMediaControlForAllPeerRequest",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8}])}};const $c=new class extends pe{constructor(){super("media.edge.GetRoomStateResponse",[{no:1,name:"display_title",kind:"scalar",T:9},{no:2,name:"locked_mode",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"room_name",kind:"scalar",T:9},{no:5,name:"current_peer_id",kind:"scalar",T:9},{no:6,name:"is_recording",kind:"scalar",opt:!0,T:8},{no:7,name:"recorder_participant_id",kind:"scalar",opt:!0,T:9},{no:8,name:"pinned_peer_ids",kind:"scalar",repeat:2,T:9}])}};const Gc=new class extends pe{constructor(){super("media.edge.ErrorResponse",[{no:1,name:"error_message",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:5}])}};new class extends pe{constructor(){super("media.edge.EmptyResponse",[])}};const Wc=new class extends pe{constructor(){super("media.edge.RoomParticipants",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"producer_states",kind:"message",repeat:1,T:()=>kc},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"user_id",kind:"scalar",opt:!0,T:9},{no:5,name:"capabilities",kind:"message",T:()=>Sc}])}};const qc=new class extends pe{constructor(){super("media.edge.SelectedPeersResponse",[{no:1,name:"audio_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"compulsory_peers",kind:"scalar",repeat:2,T:9}])}};const Kc=new class extends pe{constructor(){super("media.edge.SelectedPeersDiffEntry",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"priority",kind:"scalar",T:5}])}};const Zc=new class extends pe{constructor(){super("media.edge.SelectedPeersDiffResponse",[{no:1,name:"entries",kind:"message",repeat:1,T:()=>Kc}])}};new class extends pe{constructor(){super("media.edge.PeerJoinResponse",[])}};const Yc=new class extends pe{constructor(){super("media.edge.PeerJoinCompleteResponse",[{no:1,name:"room_state",kind:"message",T:()=>$c},{no:2,name:"participants",kind:"message",repeat:1,T:()=>Wc},{no:3,name:"selected_peers",kind:"message",T:()=>qc},{no:4,name:"max_preferred_streams",kind:"scalar",T:5}])}};const Jc=new class extends pe{constructor(){super("media.edge.PeerLeaveResponse",[{no:1,name:"closed",kind:"scalar",T:8}])}};new class extends pe{constructor(){super("media.edge.ConsumeMultipleProducerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>wc}])}};const Qc=new class extends pe{constructor(){super("media.edge.ConsumePeerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>wc},{no:3,name:"description",kind:"message",T:()=>hc}])}};const Xc=new class extends pe{constructor(){super("media.edge.ProducerCreateResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"producer_id",kind:"scalar",T:9},{no:4,name:"description",kind:"message",T:()=>hc}])}};new class extends pe{constructor(){super("media.edge.ProducerScoreResponse",[{no:1,name:"responseid",kind:"scalar",T:9},{no:2,name:"score",kind:"message",T:()=>vc}])}};new class extends pe{constructor(){super("media.edge.ActiveSpeakerResponse",[{no:1,name:"responsepeer_id",kind:"scalar",T:9},{no:2,name:"volume",kind:"scalar",T:5}])}};new class extends pe{constructor(){super("media.edge.NoActiveSpeakerResponse",[])}};new class extends pe{constructor(){super("media.edge.ProducerToggleResponse",[])}};new class extends pe{constructor(){super("media.edge.ConsumerToggleResponse",[])}};const el=new class extends pe{constructor(){super("media.edge.ProducerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>hc}])}};const tl=new class extends pe{constructor(){super("media.edge.ConsumerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>hc}])}};new class extends pe{constructor(){super("media.edge.GlobalPeerPinningResponse",[])}};new class extends pe{constructor(){super("media.edge.KickPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.KickAllPeersResponse",[{no:1,name:"status",kind:"scalar",T:9}])}};const il=new class extends pe{constructor(){super("media.edge.HostMediaControlForPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}};const rl=new class extends pe{constructor(){super("media.edge.HostMediaControlForAllPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}};const nl=new class extends pe{constructor(){super("media.edge.PeerDisplayNameEditResponse",[{no:1,name:"status",kind:"scalar",T:9}])}};const sl=new class extends pe{constructor(){super("media.edge.PeerJoinBroadcastResponse",[{no:1,name:"participant",kind:"message",T:()=>Wc}])}};const al=new class extends pe{constructor(){super("media.edge.TrackSubscriptionKind",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8}])}};const ol=new class extends pe{constructor(){super("media.edge.TrackSubscription",[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"webcam",kind:"message",T:()=>al},{no:3,name:"screenshare",kind:"message",T:()=>al}])}};new class extends pe{constructor(){super("media.edge.PeerProducingTransportCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"transport_details",kind:"message",T:()=>fc},{no:3,name:"track_subscriptions",kind:"message",repeat:1,T:()=>ol}])}};const cl=new class extends pe{constructor(){super("media.edge.PeerProducerCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>kc}])}};const ll=new class extends pe{constructor(){super("media.edge.PeerProducerToggleBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>kc},{no:3,name:"initiator_participant_id",kind:"scalar",opt:!0,T:9}])}};const dl=new class extends pe{constructor(){super("media.edge.PeerProducerCloseBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>kc}])}};const hl=new class extends pe{constructor(){super("media.edge.PeerLeaveBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};const ul=new class extends pe{constructor(){super("media.edge.GlobalPeerPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.GlobalPeerUnPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.RecordingStartedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.RecordingStoppedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.PeerDisplayNameEditBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.PeerPingRequestBroadcastResponse",[{no:1,name:"password",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("media.edge.MediaRoomTerminationBroadcastResponse",[{no:1,name:"reason",kind:"scalar",T:9}])}};const pl=new class extends pe{constructor(){super("socket.ai.MeetingTranscript",[{no:1,name:"meeting_id",kind:"scalar",T:9},{no:2,name:"transcript",kind:"scalar",T:9},{no:3,name:"is_partial",kind:"scalar",T:8}])}};new class extends pe{constructor(){super("socket.api.BaseSocketHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9}])}};const gl=new class extends pe{constructor(){super("socket.api.ErrorMessage",[{no:1,name:"code",kind:"scalar",opt:!0,T:5},{no:2,name:"message",kind:"scalar",T:9}])}};var fl,ml,vl,bl,kl;!function(e){e[e.BROWSER=0]="BROWSER",e[e.TRACK=1]="TRACK",e[e.COMPOSITE=2]="COMPOSITE"}(fl||(fl={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ON_STAGE=1]="ON_STAGE",e[e.APPROVED_STAGE=2]="APPROVED_STAGE",e[e.REQUESTED_STAGE=3]="REQUESTED_STAGE",e[e.OFF_STAGE=4]="OFF_STAGE"}(ml||(ml={})),function(e){e[e.NONE=0]="NONE",e[e.RECORDER=1]="RECORDER",e[e.LIVESTREAMER=2]="LIVESTREAMER"}(vl||(vl={})),function(e){e[e.PEERS=0]="PEERS",e[e.ROOMS=1]="ROOMS"}(bl||(bl={})),function(e){e[e.HIVE=0]="HIVE",e[e.CHAT=1]="CHAT",e[e.PING=2]="PING"}(kl||(kl={}));const yl=new class extends pe{constructor(){super("socket.room.PeerFlags",[{no:1,name:"preset_name",kind:"scalar",T:9},{no:2,name:"recorder_type",kind:"scalar",T:9},{no:3,name:"hidden_participant",kind:"scalar",T:8}])}};const wl=new class extends pe{constructor(){super("socket.room.Peer",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",ml,"STAGE_TYPE_"]},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:7,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:8,name:"waitlisted",kind:"scalar",T:8},{no:9,name:"flags",kind:"message",T:()=>yl}])}};const Sl=new class extends pe{constructor(){super("socket.room.PeerInfoResponse",[{no:1,name:"peer",kind:"message",T:()=>wl}])}};const xl=new class extends pe{constructor(){super("socket.room.PeerStatusUpdate",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",ml,"STAGE_TYPE_"]}])}};const El=new class extends pe{constructor(){super("socket.room.RoomPeersInfoRequest",[{no:1,name:"seach_query",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5},{no:3,name:"offset",kind:"scalar",T:5}])}};const Tl=new class extends pe{constructor(){super("socket.room.RoomPeersInfoResponse",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>wl}])}};const _l=new class extends pe{constructor(){super("socket.room.RoomPeerCountResponse",[{no:1,name:"count",kind:"scalar",T:4,L:2}])}};const Pl=new class extends pe{constructor(){super("socket.room.Room",[{no:1,name:"room_id",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:4,name:"created_at",kind:"scalar",T:4,L:2},{no:5,name:"active_recordings",kind:"message",repeat:1,T:()=>Cl},{no:6,name:"room_uuid",kind:"scalar",opt:!0,T:9}])}};const Cl=new class extends pe{constructor(){super("socket.room.ActiveRecording",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",fl]},{no:3,name:"recording_status",kind:"scalar",T:9}])}};const Al=new class extends pe{constructor(){super("socket.room.RoomInfoResponse",[{no:1,name:"room",kind:"message",T:()=>Pl}])}};const Rl=new class extends pe{constructor(){super("socket.room.GetPeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("socket.room.UpdatePeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9}])}};const Ll=new class extends pe{constructor(){super("socket.room.JoinRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>wl},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:5,name:"use_hive",kind:"scalar",opt:!0,T:8},{no:6,name:"preset",kind:"scalar",opt:!0,T:12},{no:7,name:"capabilities",kind:"enum",repeat:1,T:()=>["socket.room.Capabilities",kl,"CAPABILITIES_"]},{no:8,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}};const Il=new class extends pe{constructor(){super("socket.room.LeaveRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>wl},{no:2,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}};new class extends pe{constructor(){super("socket.room.UpdateRoomInfoRequest",[{no:1,name:"room",kind:"message",T:()=>Pl}])}};new class extends pe{constructor(){super("socket.room.GetConnectedRoomsDumpRequest",[])}};const Ml=new class extends pe{constructor(){super("socket.room.ServiceError",[{no:1,name:"message",kind:"scalar",opt:!0,T:9},{no:2,name:"code",kind:"scalar",opt:!0,T:9}])}};const Dl=new class extends pe{constructor(){super("socket.room.ConnectedMeetingPeer",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:5,name:"display_picture_url",kind:"scalar",opt:!0,T:9}])}};const Ol=new class extends pe{constructor(){super("socket.room.ConnectedMeetingDump",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Dl}])}};const Nl=new class extends pe{constructor(){super("socket.room.GetConnectedRoomsDumpResponse",[{no:1,name:"parent_meeting",kind:"message",T:()=>Ol},{no:2,name:"meetings",kind:"message",repeat:1,T:()=>Ol}])}};const Ul=new class extends pe{constructor(){super("socket.room.CreateRoomRequestPayload",[{no:1,name:"title",kind:"scalar",opt:!0,T:9}])}};const Fl=new class extends pe{constructor(){super("socket.room.CreateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>Ul}])}};const jl=new class extends pe{constructor(){super("socket.room.CreateRoomResponsePayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ml}])}};const Bl=new class extends pe{constructor(){super("socket.room.CreateConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>jl}])}};const Vl=new class extends pe{constructor(){super("socket.room.UpdateRoomRequestPayload",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9}])}};new class extends pe{constructor(){super("socket.room.UpdateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>Vl}])}};const zl=new class extends pe{constructor(){super("socket.room.DisableRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9}])}};const Hl=new class extends pe{constructor(){super("socket.room.DisableConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>zl}])}};const $l=new class extends pe{constructor(){super("socket.room.DisableConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>Gl}])}};const Gl=new class extends pe{constructor(){super("socket.room.DisableConnectedRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"status",kind:"scalar",opt:!0,T:9},{no:3,name:"title",kind:"scalar",opt:!0,T:9},{no:4,name:"error",kind:"message",T:()=>Ml}])}};const Wl=new class extends pe{constructor(){super("socket.room.MovePeerPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"preset_id",kind:"scalar",opt:!0,T:9}])}};const ql=new class extends pe{constructor(){super("socket.room.MovePeersBetweenRoomsRequest",[{no:1,name:"source_meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"destination_meeting_id",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Wl}])}};const Kl=new class extends pe{constructor(){super("socket.room.MovedPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ml}])}};new class extends pe{constructor(){super("socket.room.MovePeersBetweenRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>Kl}])}};const Zl=new class extends pe{constructor(){super("socket.room.TransferPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"auth_token",kind:"scalar",opt:!0,T:9}])}};const Yl=new class extends pe{constructor(){super("socket.room.GetAllAddedParticipantsResponse",[{no:1,name:"participants",kind:"message",repeat:1,T:()=>Jl}])}};const Jl=new class extends pe{constructor(){super("socket.room.AddedParticipant",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}};const Ql=new class extends pe{constructor(){super("socket.room.RemoveParticipantsRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}};const Xl=new class extends pe{constructor(){super("socket.room.BroadcastMessage",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"timestamp",kind:"scalar",T:4,L:2},{no:4,name:"ids",kind:"scalar",repeat:2,T:9},{no:5,name:"broadcast_type",kind:"enum",opt:!0,T:()=>["socket.room.BroadcastType",bl,"BROADCAST_TYPE_"]}])}};const ed=new class extends pe{constructor(){super("socket.room.AcceptWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const td=new class extends pe{constructor(){super("socket.room.DenyWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const id=new class extends pe{constructor(){super("socket.room.WaitingRoomRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"picture",kind:"scalar",opt:!0,T:9},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_name",kind:"scalar",opt:!0,T:9}])}};const rd=new class extends pe{constructor(){super("socket.room.GetWaitingRoomRequests",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>id}])}};const nd=new class extends pe{constructor(){super("socket.room.GetRoomStageStateResponse",[{no:1,name:"on_stage_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"approved_stage_peers",kind:"scalar",repeat:2,T:9},{no:3,name:"requested_stage_peers",kind:"scalar",repeat:2,T:9}])}};var sd,ad;!function(e){e[e.NONE=0]="NONE",e[e.SKIP=1]="SKIP",e[e.ON_PRIVILEGED_USER_ENTRY=2]="ON_PRIVILEGED_USER_ENTRY",e[e.SKIP_ON_ACCEPT=3]="SKIP_ON_ACCEPT"}(sd||(sd={})),function(e){e[e.NONE=0]="NONE",e[e.ALLOWED=1]="ALLOWED",e[e.NOT_ALLOWED=2]="NOT_ALLOWED",e[e.CAN_REQUEST=3]="CAN_REQUEST"}(ad||(ad={}));const od=new class extends pe{constructor(){super("socket.preset.PollsPermissionUpdate",[{no:1,name:"can_create",kind:"scalar",opt:!0,T:8},{no:2,name:"can_vote",kind:"scalar",opt:!0,T:8},{no:3,name:"can_view",kind:"scalar",opt:!0,T:8}])}};const cd=new class extends pe{constructor(){super("socket.preset.PluginsPermissionsUpdate",[{no:1,name:"can_close",kind:"scalar",opt:!0,T:8},{no:2,name:"can_start",kind:"scalar",opt:!0,T:8}])}};const ld=new class extends pe{constructor(){super("socket.preset.PublicChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"text",kind:"scalar",opt:!0,T:8},{no:3,name:"files",kind:"scalar",opt:!0,T:8}])}};const dd=new class extends pe{constructor(){super("socket.preset.PrivateChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"can_receive",kind:"scalar",opt:!0,T:8},{no:3,name:"text",kind:"scalar",opt:!0,T:8},{no:4,name:"files",kind:"scalar",opt:!0,T:8}])}};const hd=new class extends pe{constructor(){super("socket.preset.ChatPermissionUpdate",[{no:1,name:"public",kind:"message",T:()=>ld},{no:2,name:"private",kind:"message",T:()=>dd}])}};const ud=new class extends pe{constructor(){super("socket.preset.ConnectedMeetingPermissionUpdate",[{no:1,name:"can_alter_connected_meetings",kind:"scalar",opt:!0,T:8},{no:2,name:"can_switch_to_parent_meeting",kind:"scalar",opt:!0,T:8},{no:3,name:"can_switch_connected_meetings",kind:"scalar",opt:!0,T:8}])}};const pd=new class extends pe{constructor(){super("socket.preset.StreamPermission",[{no:1,name:"can_produce",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",ad,"STREAM_PERMISSION_TYPE_"]},{no:2,name:"can_consume",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",ad,"STREAM_PERMISSION_TYPE_"]}])}};const gd=new class extends pe{constructor(){super("socket.preset.MediaPermissionUpdate",[{no:1,name:"video",kind:"message",T:()=>pd},{no:2,name:"audio",kind:"message",T:()=>pd},{no:3,name:"screenshare",kind:"message",T:()=>pd}])}};const fd=new class extends pe{constructor(){super("socket.preset.PresetUpdates",[{no:1,name:"polls",kind:"message",T:()=>od},{no:2,name:"plugins",kind:"message",T:()=>cd},{no:3,name:"chat",kind:"message",T:()=>hd},{no:4,name:"accept_waiting_requests",kind:"scalar",opt:!0,T:8},{no:5,name:"can_accept_production_requests",kind:"scalar",opt:!0,T:8},{no:6,name:"can_edit_display_name",kind:"scalar",opt:!0,T:8},{no:7,name:"can_record",kind:"scalar",opt:!0,T:8},{no:8,name:"can_livestream",kind:"scalar",opt:!0,T:8},{no:9,name:"can_spotlight",kind:"scalar",opt:!0,T:8},{no:10,name:"disable_participant_audio",kind:"scalar",opt:!0,T:8},{no:11,name:"disable_participant_screensharing",kind:"scalar",opt:!0,T:8},{no:12,name:"disable_participant_video",kind:"scalar",opt:!0,T:8},{no:13,name:"kick_participant",kind:"scalar",opt:!0,T:8},{no:14,name:"pin_participant",kind:"scalar",opt:!0,T:8},{no:15,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:16,name:"waiting_room_type",kind:"enum",opt:!0,T:()=>["socket.preset.WaitingRoomType",sd,"WAITING_ROOM_TYPE_"]},{no:17,name:"is_recorder",kind:"scalar",opt:!0,T:8},{no:18,name:"recorder_type",kind:"enum",opt:!0,T:()=>["socket.room.RecorderType",vl,"RECORDER_TYPE_"]},{no:19,name:"hidden_participant",kind:"scalar",opt:!0,T:8},{no:20,name:"show_participant_list",kind:"scalar",opt:!0,T:8},{no:21,name:"can_change_participant_permissions",kind:"scalar",opt:!0,T:8},{no:22,name:"connected_meetings",kind:"message",T:()=>ud},{no:23,name:"media",kind:"message",T:()=>gd}])}};const md=new class extends pe{constructor(){super("socket.preset.ReadPeersPresetRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const vd=new class extends pe{constructor(){super("socket.preset.PeerPreset",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"preset",kind:"scalar",T:12}])}};const bd=new class extends pe{constructor(){super("socket.preset.ReadPeersPresetResponse",[{no:1,name:"peer_presets",kind:"message",repeat:1,T:()=>vd}])}};const kd=new class extends pe{constructor(){super("socket.preset.UpdatePeerPreset",[{no:1,name:"user_ids",kind:"scalar",T:9},{no:2,name:"patch",kind:"message",T:()=>fd}])}};const yd=new class extends pe{constructor(){super("socket.preset.UpdatePeersPresetRequest",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>kd}])}};const wd=new class extends pe{constructor(){super("socket.preset.UpdatePeersPresetResponse",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>kd}])}};const Sd=new class extends pe{constructor(){super("socket.preset.PeerUserIDMap",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("socket.preset.BulkUpdatePeerPresetRequest",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>Sd},{no:2,name:"patch",kind:"message",T:()=>fd}])}};new class extends pe{constructor(){super("socket.preset.BulkUpdatePeerPresetResponse",[{no:2,name:"patch",kind:"message",T:()=>fd}])}};const xd=new class extends pe{constructor(){super("socket.chat.ChatMessage",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"user_id",kind:"scalar",T:9},{no:4,name:"display_name",kind:"scalar",T:9},{no:5,name:"pinned",kind:"scalar",T:8},{no:6,name:"is_edited",kind:"scalar",T:8},{no:7,name:"payload_type",kind:"scalar",T:5},{no:8,name:"payload",kind:"scalar",T:9},{no:10,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:11,name:"created_at",kind:"scalar",T:4,L:2},{no:12,name:"created_at_ms",kind:"scalar",opt:!0,T:4,L:2},{no:13,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:14,name:"channel_index",kind:"scalar",opt:!0,T:9}])}};const Ed=new class extends pe{constructor(){super("socket.chat.GetPaginatedChatMessageRoomRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Td=new class extends pe{constructor(){super("socket.chat.GetPaginatedChatMessageRoomResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>xd},{no:2,name:"next",kind:"scalar",T:8}])}};const _d=new class extends pe{constructor(){super("socket.chat.GetChatMessagesResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>xd}])}};const Pd=new class extends pe{constructor(){super("socket.chat.SendChatMessageToRoomRequest",[{no:1,name:"payload_type",kind:"scalar",T:5},{no:2,name:"payload",kind:"scalar",T:9}])}};const Cd=new class extends pe{constructor(){super("socket.chat.SendChatMessageToRoomResponse",[{no:1,name:"message",kind:"message",T:()=>xd}])}};const Ad=new class extends pe{constructor(){super("socket.chat.SendChatMessageToPeersRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}};const Rd=new class extends pe{constructor(){super("socket.chat.SendChatMessageToPeersResponse",[{no:1,name:"message",kind:"message",T:()=>xd}])}};const Ld=new class extends pe{constructor(){super("socket.chat.SendChatMessageToChannelRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}};new class extends pe{constructor(){super("socket.chat.SendChatMessageToChannelResponse",[{no:1,name:"message",kind:"message",T:()=>xd}])}};const Id=new class extends pe{constructor(){super("socket.chat.EditChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",opt:!0,T:5},{no:3,name:"payload",kind:"scalar",opt:!0,T:9},{no:4,name:"pinned",kind:"scalar",opt:!0,T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Md=new class extends pe{constructor(){super("socket.chat.PinChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Dd=new class extends pe{constructor(){super("socket.chat.PinChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Od=new class extends pe{constructor(){super("socket.chat.EditChatMessageResponse",[{no:1,name:"message",kind:"message",T:()=>xd}])}};const Nd=new class extends pe{constructor(){super("socket.chat.DeleteChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Ud=new class extends pe{constructor(){super("socket.chat.DeleteChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}};const Fd=new class extends pe{constructor(){super("socket.chat.SearchChatMessagesRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:6,name:"search_term",kind:"scalar",T:9}])}};const jd=new class extends pe{constructor(){super("socket.chat.MarkChannelIndexAsReadRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"channel_index",kind:"scalar",T:9}])}};const Bd=new class extends pe{constructor(){super("socket.chat.MarkChannelIndexAsReadResponse",[{no:1,name:"channel_index",kind:"scalar",T:9}])}};const Vd=new class extends pe{constructor(){super("socket.chat.CreateChatChannelRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8}])}};const zd=new class extends pe{constructor(){super("socket.chat.UpdateChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:4,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:5,name:"visibility",kind:"scalar",opt:!0,T:9},{no:6,name:"is_direct_message",kind:"scalar",opt:!0,T:8}])}};new class extends pe{constructor(){super("socket.chat.CreateChatChannelResponse",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}};const Hd=new class extends pe{constructor(){super("socket.chat.GetChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}};const $d=new class extends pe{constructor(){super("socket.chat.LatestMessageAndUnreadCount",[{no:1,name:"message",kind:"message",T:()=>xd},{no:2,name:"unread_count",kind:"scalar",T:4,L:2}])}};const Gd=new class extends pe{constructor(){super("socket.chat.ChatChannel",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8},{no:6,name:"latest_message_and_unread_count",kind:"message",T:()=>$d},{no:7,name:"target_user_ids",kind:"scalar",repeat:2,T:9}])}};const Wd=new class extends pe{constructor(){super("socket.chat.GetChatChannelResponse",[{no:1,name:"chat_channels",kind:"message",repeat:1,T:()=>Gd}])}};const qd=new class extends pe{constructor(){super("socket.chat.ChannelMember",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}};const Kd=new class extends pe{constructor(){super("socket.chat.GetChatChannelMembersResponse",[{no:1,name:"channel_members",kind:"message",repeat:1,T:()=>qd}])}};const Zd=new class extends pe{constructor(){super("socket.plugin.AddPluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}};const Yd=new class extends pe{constructor(){super("socket.plugin.RemovePluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}};const Jd=new class extends pe{constructor(){super("socket.plugin.EnablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}};const Qd=new class extends pe{constructor(){super("socket.plugin.DisablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}};const Xd=new class extends pe{constructor(){super("socket.plugin.EnablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}};const eh=new class extends pe{constructor(){super("socket.plugin.DisablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}};const th=new class extends pe{constructor(){super("socket.plugin.PluginEventToRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}};const ih=new class extends pe{constructor(){super("socket.plugin.PluginEventToPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"plugin_data",kind:"scalar",T:12}])}};const rh=new class extends pe{constructor(){super("socket.plugin.StoreKeys",[{no:1,name:"store_key",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",opt:!0,T:12}])}};const nh=new class extends pe{constructor(){super("socket.plugin.PluginStoreInsertKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"insert_keys",kind:"message",repeat:1,T:()=>rh}])}};const sh=new class extends pe{constructor(){super("socket.plugin.PluginStoreGetKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"get_keys",kind:"message",repeat:1,T:()=>rh}])}};const ah=new class extends pe{constructor(){super("socket.plugin.PluginStoreDeleteKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"delete_keys",kind:"message",repeat:1,T:()=>rh}])}};const oh=new class extends pe{constructor(){super("socket.plugin.PluginStoreDeleteRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9}])}};const ch=new class extends pe{constructor(){super("socket.plugin.EnablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"enabled_by",kind:"scalar",T:9}])}};const lh=new class extends pe{constructor(){super("socket.plugin.EnablePluginsResponse",[{no:1,name:"plugins",kind:"message",repeat:1,T:()=>ch}])}};const dh=new class extends pe{constructor(){super("socket.plugin.DisablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"disabled_by",kind:"scalar",T:9}])}};const hh=new class extends pe{constructor(){super("socket.plugin.PluginStoreItem",[{no:1,name:"timestamp",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"store_key",kind:"scalar",T:9},{no:4,name:"payload",kind:"scalar",T:12}])}};const uh=new class extends pe{constructor(){super("socket.plugin.PluginStoreResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"store_items",kind:"message",repeat:1,T:()=>hh}])}};const ph=new class extends pe{constructor(){super("socket.plugin.PluginEventResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}};const gh=new class extends pe{constructor(){super("socket.livestreaming.LiveStreamingEvent",[{no:1,name:"livestream_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",T:9},{no:5,name:"playback_url",kind:"scalar",T:9},{no:6,name:"org_id",kind:"scalar",T:9},{no:7,name:"room_name",kind:"scalar",T:9},{no:8,name:"room_uuid",kind:"scalar",T:9},{no:9,name:"status",kind:"scalar",T:9},{no:10,name:"manual_ingest",kind:"scalar",opt:!0,T:8}])}};const fh=new class extends pe{constructor(){super("socket.livestreaming.GetStagePeersResponse",[{no:1,name:"stage_peers",kind:"scalar",repeat:2,T:9}])}};const mh=new class extends pe{constructor(){super("socket.livestreaming.StageRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9}])}};const vh=new class extends pe{constructor(){super("socket.livestreaming.GetStageRequestsResponse",[{no:1,name:"stage_requests",kind:"message",repeat:1,T:()=>mh}])}};const bh=new class extends pe{constructor(){super("socket.livestreaming.GrantStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const kh=new class extends pe{constructor(){super("socket.livestreaming.DenyStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const yh=new class extends pe{constructor(){super("socket.livestreaming.LeaveStageRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}};const wh=new class extends pe{constructor(){super("socket.polls.Poll",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"created_by",kind:"scalar",T:9},{no:3,name:"created_by_user_id",kind:"scalar",T:9},{no:4,name:"question",kind:"scalar",T:9},{no:5,name:"options",kind:"message",repeat:1,T:()=>Sh},{no:6,name:"hide_votes",kind:"scalar",T:8},{no:7,name:"anonymous",kind:"scalar",T:8},{no:8,name:"votes",kind:"scalar",repeat:2,T:9}])}};const Sh=new class extends pe{constructor(){super("socket.polls.PollOption",[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"count",kind:"scalar",opt:!0,T:4,L:2},{no:3,name:"votes",kind:"message",repeat:1,T:()=>xh}])}};const xh=new class extends pe{constructor(){super("socket.polls.PollVote",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9}])}};const Eh=new class extends pe{constructor(){super("socket.polls.NewPollRequest",[{no:1,name:"question",kind:"scalar",T:9},{no:2,name:"options",kind:"scalar",repeat:2,T:9},{no:3,name:"anonymous",kind:"scalar",T:8},{no:4,name:"hide_votes",kind:"scalar",T:8},{no:5,name:"created_by",kind:"scalar",opt:!0,T:9},{no:6,name:"created_by_user_id",kind:"scalar",opt:!0,T:9}])}};const Th=new class extends pe{constructor(){super("socket.polls.VotePollRequest",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"index",kind:"scalar",T:4,L:2}])}};const _h=new class extends pe{constructor(){super("socket.polls.UpdatePollResponse",[{no:1,name:"poll",kind:"message",T:()=>wh}])}};const Ph=new class extends pe{constructor(){super("socket.polls.GetPollsResponse",[{no:1,name:"polls",kind:"message",repeat:1,T:()=>wh}])}};const Ch=new class extends pe{constructor(){super("socket.recording.RecordingEvent",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",fl]}])}};new class extends pe{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){const e=this.create(),t=Date.now();return e.seconds=V.from(Math.floor(t/1e3)).toBigInt(),e.nanos=t%1e3*1e6,e}toDate(e){return new Date(1e3*V.from(e.seconds).toNumber()+Math.ceil(e.nanos/1e6))}fromDate(e){const t=this.create(),i=e.getTime();return t.seconds=V.from(Math.floor(i/1e3)).toBigInt(),t.nanos=i%1e3*1e6,t}internalJsonWrite(e,t){let i=1e3*V.from(e.seconds).toNumber();if(iDate.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let r="Z";if(e.nanos>0){let t=(e.nanos+1e9).toString().substring(1);r="000000"===t.substring(3)?"."+t.substring(0,3)+"Z":"000"===t.substring(6)?"."+t.substring(0,6)+"Z":"."+t+"Z"}return new Date(i).toISOString().replace(".000Z",r)}internalJsonRead(e,t,i){if("string"!=typeof e)throw new Error("Unable to parse Timestamp from JSON "+x(e)+".");let r=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!r)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let n=Date.parse(r[1]+"-"+r[2]+"-"+r[3]+"T"+r[4]+":"+r[5]+":"+r[6]+(r[8]?r[8]:"Z"));if(Number.isNaN(n))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(nDate.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return i||(i=this.create()),i.seconds=V.from(n/1e3).toBigInt(),i.nanos=0,r[7]&&(i.nanos=parseInt("1"+r[7]+"0".repeat(9-r[7].length))-1e9),i}};const Ah=new class extends pe{constructor(){super("common.BaseHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9},{no:9,name:"room_object_id",kind:"scalar",opt:!0,T:9},{no:10,name:"preset",kind:"scalar",opt:!0,T:9},{no:11,name:"use_start_session",kind:"scalar",opt:!0,T:8}])}};new class extends pe{constructor(){super("common.BulkedHubMessage",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>Ah}])}};new class extends pe{constructor(){super("common.CFWorkersResponse",[{no:1,name:"responses",kind:"message",repeat:1,T:()=>Ah},{no:2,name:"broadcast_responses",kind:"message",repeat:1,T:()=>Ah}])}};const Rh={unknown:0,createWebRTCTransport:1,produce:2,consume:3,toggleProducer:4,toggleConsumer:5,closeProducer:6,closeConsumer:7,updateConsumersSimulcastConfig:8,joinRoom:16,leaveRoom:17,selectedPeer:18,globalPinPeer:19,selfJoinComplete:20,peerJoinedBroadcast:25,peerLeaveBroadcast:26,peerProducerCreateBroadcast:27,peerProducerToggleBroadcast:28,peerProducerCloseBroadcast:29,globalPeerPinBroadcast:30,recordingStartedBroadcast:31,recordingStoppedBroadcast:32,peerDisplayNameEditBroadcast:33,mediaRoomTerminationBroadcastResponse:36,selectedPeerDiff:40,renegotiateSessionDescription:50,errorResponse:60,kickPeer:90,kickAll:91,changeDisplayName:92,hostControlPeer:93,hostControlAllPeers:94,audioActivity:100};function Lh(e,t){return Object.keys(t).reduce((i,r)=>(i[r]=(e<<16)+t[r],i),{})}function Ih(e,t){return Object.keys(e).reduce((i,r)=>(i[r]=t|e[r],i),{})}const Mh=Lh(0,{getPeerInfo:0,updatePeerInfo:1,getRoomPeersInfo:2,joinRoom:3,leaveRoom:4,getRoomInfo:5,updateRoomInfo:6,closeRoom:7,startedLivestream:8,stoppedLivestream:9,erroredLivestream:10,getStagePeers:11,getStageRequests:12,requestStageAccess:13,cancelStageRequest:14,grantStageAccess:15,denyStageAccess:16,roomPeerCount:17,joinStage:18,leaveStage:19,getConnectedRoomsDump:20,createConnectedRooms:21,deleteConnectedRooms:22,movePeers:23,transferPeer:24,movedPeer:25,connectedRoomsUpdated:26,connectedRoomsDeleted:27,getAllAddedParticipants:28,broadcastMessage:29,kick:30,kickAll:31,transcript:32,getWaitingRoomRequests:33,acceptWaitingRoomRequests:34,waitingRoomRequestAccepted:35,denyWaitingRoomRequests:36,waitingRoomRequestDenied:37,peerStageStatusUpdate:38,broadcastToEntity:39,recordingStarted:40,recordingStopped:41,recordingPaused:42,getRoomStageState:43,livestreamingInvoked:44}),Dh=Lh(1,{getMessages:0,sendMessageToRoom:1,sendMessageToPeers:2,editMessage:3,deleteMessage:4,getPaginatedMessages:5,sendMessageToChannel:6,searchChannelMessages:7,getAllChatChannels:8,markChannelIndexAsRead:9,pinMessage:10}),Oh=Lh(2,{getPlugins:0,addPlugin:1,enablePluginForRoom:2,disablePluginForPeers:3,enablePluginForPeers:4,disablePluginForRoom:5,removePlugin:6,customPluginEventToRoom:7,customPluginEventToPeers:8,storeInsertKeys:9,storeGetKeys:10,storeDeleteKeys:11,storeDelete:12}),Nh=Lh(3,{createPoll:0,getPolls:1,votePoll:2,updatePoll:3}),Uh=Lh(4,{createChatChannel:0,getChatChannel:1,deprecatedGetAllChatChannels:2,getChannelMembers:3,updateChatChannel:4}),Fh=Ih(Rh,16777216),jh=Ih(Rh,50331648),Bh=Lh(5,{getUserPresets:0,updateUserPreset:1});var Vh,zh,Hh,$h=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,Wh=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Gh(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&$h(t,i,s),s};const qh=(Hh=class{constructor(e,t){Ue(this,Vh,void 0),Ue(this,zh,void 0),Fe(this,Vh,t),Fe(this,zh,e)}get telemetry(){return Ne(this,zh).getValue("telemetry")}get logger(){return Ne(this,zh).getValue("logger")}createChannel(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"public",n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return Be(this,null,function*(){const s={displayName:e,targetUserIds:t,displayPictureUrl:i,visibility:r,isDirectMessage:n};n&&(s.visibility="private");const a=yield Ne(this,Vh).sendMessagePromise(Uh.createChatChannel,Vd.toBinary(s)),o=Wd.fromBinary(a.payload).chatChannels;return qh.formatChannel(o[0])})}updateChannel(e,t){return Be(this,null,function*(){const i=yield Ne(this,Vh).sendMessagePromise(Uh.updateChatChannel,zd.toBinary({chatChannelId:e,targetUserIds:t.memberIds,displayName:t.displayName,displayPictureUrl:t.displayPictureUrl,visibility:t.visibility})),r=Wd.fromBinary(i.payload).chatChannels;return qh.formatChannel(r[0])})}static formatChannel(e){var t;const{latestMessageAndUnreadCount:i}=e,r=Ie(Le({},e),{id:e.chatChannelId,memberIds:e.targetUserIds,unreadCount:null!=(t=null==i?void 0:i.unreadCount)?t:0});return null!=i&&i.message&&(r.latestMessage=ju.formatSocketPeerMessage(i.message)),delete r.chatChannelId,delete r.targetUserIds,delete r.latestMessageAndUnreadCount,r}getChannelMembers(e){return Be(this,null,function*(){try{const t=yield Ne(this,Vh).sendMessagePromise(Uh.getChannelMembers,Hd.toBinary({chatChannelId:e}));return Kd.fromBinary(t.payload).channelMembers.map(e=>{var t=e,{id:i}=t,r=Me(t,["id"]);return Ie(Le({},r),{userId:i})})}catch(t){return[]}})}on(e,t){let i,r;switch(e){case Uh.createChatChannel:case Uh.updateChatChannel:i=Wd.fromBinary.bind(Wd),r=Wd.create()}i?Ne(this,Vh).on(e,e=>{let{payload:n}=e,s=r;try{s=i(n)}catch(a){this.logger.error("ChatChannelSocketHandler::on::binary_decode_error",{error:a})}return t(s)}):this.logger.warn("ChatChannelSocketHandler::Event ".concat(e," is not recognized"))}},Vh=new WeakMap,zh=new WeakMap,Hh);let Kh=qh;Wh([Mo.trace("ChatChannelHandler.createChannel")],Kh.prototype,"createChannel",1),Wh([Mo.trace("ChatChannelHandler.updateChannel")],Kh.prototype,"updateChannel",1),Wh([Mo.trace("ChatChannelHandler.getChannelMembers")],Kh.prototype,"getChannelMembers",1);var Zh,Yh,Jh=Object.defineProperty,Qh=Object.getOwnPropertyDescriptor,Xh=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Qh(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Jh(t,i,s),s},eu=(e=>(e[e.TEXT=0]="TEXT",e[e.IMAGE=1]="IMAGE",e[e.FILE=2]="FILE",e[e.CUSTOM=3]="CUSTOM",e))(eu||{});class tu{constructor(e,t){Ue(this,Zh,void 0),Ue(this,Yh,void 0),Fe(this,Zh,t),Fe(this,Yh,e)}get telemetry(){return Ne(this,Yh).getValue("telemetry")}get logger(){return Ne(this,Yh).getValue("logger")}getChatMessages(){return Ne(this,Zh).sendMessagePromise(Dh.getMessages)}getChatMessagesPaginated(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return Be(this,null,function*(){const s={timeStamp:e,size:t,from:r,reversed:i,channelId:n},a=yield Ne(this,Zh).sendMessagePromise(Dh.getPaginatedMessages,Ed.toBinary(s));return a.payload?Td.fromBinary(a.payload):{messages:[],next:!1}})}sendMessageToRoom(e,t){const i={payloadType:t,payload:e};Ne(this,Zh).sendMessage(Dh.sendMessageToRoom,Pd.toBinary(i))}sendMessageToPeers(e,t,i){const r={payloadType:t,peerIds:i,payload:e};Ne(this,Zh).sendMessage(Dh.sendMessageToPeers,Ad.toBinary(r))}sendMessageToChannel(e,t,i){const r={payloadType:t,channelId:i,payload:e};Ne(this,Zh).sendMessage(Dh.sendMessageToChannel,Ld.toBinary(r))}sendMessage(e,t,i,r){r&&this.sendMessageToChannel(e,t,r),i&&i.length>0?this.sendMessageToPeers(e,t,i):this.sendMessageToRoom(e,t)}editMessage(e,t,i,r,n){return Be(this,null,function*(){const s={chatId:e,payloadType:i,payload:t};r&&(s.channelId=r),void 0!==n&&(s.pinned=n);const a=yield Ne(this,Zh).sendMessagePromise(Dh.editMessage,Id.toBinary(s));return Od.fromBinary(a.payload).message})}deleteMessage(e,t){return Be(this,null,function*(){const i={chatId:e};t&&(i.channelId=t);const r=yield Ne(this,Zh).sendMessagePromise(Dh.deleteMessage,Nd.toBinary(i)),n=Ud.fromBinary(r.payload);return Le({id:n.chatId},n.channelId?{channelId:n.channelId}:{})})}searchMessages(e,t){return Be(this,null,function*(){var i,r,n;const s={searchTerm:e,timeStamp:null!=(i=t.timestamp)?i:Date.now(),size:null!=(r=t.size)?r:75,from:0,reversed:null==(n=t.reversed)||n};t.channelId&&(s.channelId=t.channelId);try{const e=yield Ne(this,Zh).sendMessagePromise(Dh.searchChannelMessages,Fd.toBinary(s));return _d.fromBinary(e.payload).messages}catch(a){return[]}})}getAllChannels(){return Be(this,null,function*(){try{const e=yield Ne(this,Zh).sendMessagePromise(Dh.getAllChatChannels);return Wd.fromBinary(e.payload).chatChannels.map(Kh.formatChannel)}catch(e){return[]}})}markLastReadMessage(e,t){return Be(this,null,function*(){const i=yield Ne(this,Zh).sendMessagePromise(Dh.markChannelIndexAsRead,jd.toBinary({channelId:e,userId:t.userId,channelIndex:t.channelIndex}));return Bd.fromBinary(i.payload).channelIndex})}setPinState(e,t){return Be(this,null,function*(){const i={chatId:e.id,pinned:t,channelId:e.channelId},r=yield Ne(this,Zh).sendMessagePromise(Dh.pinMessage,Md.toBinary(i));return Dd.fromBinary(r.payload)})}on(e,t){let i,r;switch(e){case Dh.sendMessageToRoom:i=Cd.fromBinary.bind(Cd),r=Cd.create();break;case Dh.sendMessageToPeers:i=Rd.fromBinary.bind(Rd),r=Rd.create();break;case Dh.editMessage:i=Od.fromBinary.bind(Od),r=Od.create();break;case Dh.pinMessage:i=Dd.fromBinary.bind(Dd),r=Dd.create();break;case Dh.deleteMessage:i=Ud.fromBinary.bind(Ud),r=Ud.create()}i?Ne(this,Zh).on(e,e=>{let{payload:n}=e,s=r;try{s=i(n)}catch(a){this.logger.error("chatSocketHandler::on::binary_decode_error",{error:a})}return t(s)}):this.logger.warn("ChatSocketHandler::Event ".concat(e," is not recognized"))}}function iu(e){if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>iu(e));const t={};return Object.keys(e).forEach(i=>{const r=c(i)?i:function(e){return e.replace(/([-_]\w)/g,e=>e[1].toUpperCase())}(i);t[r]=iu(e[i])}),t}function ru(e){if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>ru(e));const t={};return Object.keys(e).forEach(i=>{const r=c(i)?i:function(e){return e.replace(/[A-Z]/g,e=>"_".concat(e.toLowerCase()))}(i);t[r]=e[i]}),t}function nu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==e?{}:(Object.getOwnPropertyNames(e).forEach(i=>{if("function"!=typeof e[i]){if("object"==typeof e[i])return void nu(e[i],t[i]={});t[i]=e[i]}}),t)}Zh=new WeakMap,Yh=new WeakMap,Xh([Mo.trace("SocketService.getChatMessages")],tu.prototype,"getChatMessages",1),Xh([Mo.trace("SocketService.getChatMessagesPaginated")],tu.prototype,"getChatMessagesPaginated",1),Xh([Mo.trace("SocketService.sendMessageToRoom")],tu.prototype,"sendMessageToRoom",1),Xh([Mo.trace("SocketService.sendMessageToPeers")],tu.prototype,"sendMessageToPeers",1),Xh([Mo.trace("SocketService.sendMessageToChannel")],tu.prototype,"sendMessageToChannel",1),Xh([Mo.trace("SocketService.sendMessage")],tu.prototype,"sendMessage",1),Xh([Mo.trace("SocketService.editMessage")],tu.prototype,"editMessage",1),Xh([Mo.trace("SocketService.deleteMessage")],tu.prototype,"deleteMessage",1),Xh([Mo.trace("SocketService.searchMessages")],tu.prototype,"searchMessages",1),Xh([Mo.trace("SocketService.getAllChannels")],tu.prototype,"getAllChannels",1),Xh([Mo.trace("SocketService.markLastReadMessage")],tu.prototype,"markLastReadMessage",1);class su{constructor(e){De(this,"defaults"),this.defaults={baseURL:e.baseURL,headers:{common:{}},timeout:e.timeout,retry:e.retry,retryDelay:e.retryDelay}}buildURL(e,t){const{baseURL:i}=this.defaults,r=e.startsWith("http")?e:"".concat(i).concat(e.startsWith("/")?e:"/".concat(e));if(t){const e=new URLSearchParams;return Object.entries(t).forEach(t=>{let[i,r]=t;e.append(i,r)}),"".concat(r).concat(r.includes("?")?"&":"?").concat(e.toString())}return r}request(e){return Be(this,null,function*(){var t;const i=(null==(t=e.method)?void 0:t.toUpperCase())||"GET",r=this.buildURL(e.url||"",e.params),n=Le(Le({},this.defaults.headers.common),e.headers);"GET"!==i&&"HEAD"!==i&&e.data&&!n["Content-Type"]&&(n["Content-Type"]="application/json");const s="application/json"===n["Content-Type"]?JSON.stringify(e.data):e.data,a={method:i,headers:n,body:"GET"!==i&&"HEAD"!==i&&e.data?s:void 0},o=e.timeout||this.defaults.timeout,c=void 0!==e.retry?e.retry:this.defaults.retry,l=e.retryDelay||this.defaults.retryDelay;try{const t=new AbortController,i=setTimeout(()=>t.abort(),o);a.signal=t.signal;const n=yield fetch(r,a);clearTimeout(i);let s=null;const c=n.headers.get("content-type");s=c&&c.includes("application/json")?yield n.json():yield n.text();const l={};n.headers.forEach((e,t)=>{l[t]=e});const d={data:s,status:n.status,statusText:n.statusText,headers:l,config:e};if(!n.ok)throw d;return d}catch(d){if(d instanceof Error&&c>0)return yield new Promise(e=>setTimeout(e,l)),this.defaults.baseURL===Ao.apiBase.prod?this.defaults.baseURL=Ao.apiBase.prodAlternate:this.defaults.baseURL===Ao.apiBase.prodAlternate&&(this.defaults.baseURL=Ao.apiBase.prod),this.request(Ie(Le({},e),{retry:c-1}));throw d}})}get(e){return Be(this,arguments,function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){return t.request(Ie(Le({},i),{method:"GET",url:e}))}()})}post(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){return i.request(Ie(Le({},r),{method:"POST",url:e,data:t}))}()})}put(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){return i.request(Ie(Le({},r),{method:"PUT",url:e,data:t}))}()})}}const au=3,ou=30,cu=8e3;class lu{constructor(e,t){De(this,"ipInfo"),De(this,"fetchClient"),De(this,"requests"),De(this,"roomName"),De(this,"roomUUID"),De(this,"authToken"),De(this,"organizationId"),De(this,"iceServers"),De(this,"pluginInformation"),De(this,"userDetails"),De(this,"roomDetails"),De(this,"context"),this.context=e;const{timeout:i=cu,retry:r=au,retryDelay:n=ou,baseURL:s=Ao.apiBase.prod,authToken:a,cachedUserDetails:o}=t||{};this.iceServers=null==o?void 0:o.iceServers,this.pluginInformation=null==o?void 0:o.pluginInformation,this.userDetails=null==o?void 0:o.userDetails,this.roomDetails=null==o?void 0:o.roomDetails,this.requests=new su({baseURL:s,timeout:i,retry:r,retryDelay:n,responseType:"json"}),this.fetchClient=new su({baseURL:"",timeout:i,retry:r,retryDelay:n,responseType:"json"}),this.setAuthToken(a,{bearer:!0});const c=this.requests.request.bind(this.requests);this.requests.request=t=>Be(this,null,function*(){var i,r,n,s,a;const o=e.getValue("telemetry");try{o.injectContext(this.requests.defaults.headers.common);const e=yield c(t);return t.url!==o.logsEndpoint&&this.logger.debug("xhr::fetch",{networkCall:{status:e.status,statusText:e.statusText,baseURL:t.baseURL||this.requests.defaults.baseURL,url:t.url,method:t.method}}),e}catch(l){throw l?((null==(i=l.config)?void 0:i.url)!==o.logsEndpoint&&this.logger.error("xhr::fetch",{error:l,networkCall:{status:l.status,statusText:l.statusText,baseURL:(null==(r=l.config)?void 0:r.baseURL)||this.requests.defaults.baseURL,url:null==(n=l.config)?void 0:n.url,retries:null==(s=l.config)?void 0:s.retry,method:null==(a=l.config)?void 0:a.method,isOnline:navigator.onLine?"online":"offline"}}),new Uo(l.message||"Network request failed","0011")):new Uo("Unknown network error occurred","0011")}})}get peerId(){return this.context.getValue("peerId")}get logger(){return this.context.getValue("logger")}setAuthToken(e,t){const{bearer:i}=t||{};this.authToken=e,this.requests.defaults.headers.common.Authorization=i?"Bearer ".concat(e):e}setHeader(e,t){this.requests.defaults.headers.common[e]=t}setRoomName(e){this.roomName=e}setRoomUUID(e){this.roomUUID=e}setOrganizationId(e){this.organizationId=e}}var du=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,uu=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?hu(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&du(t,i,s),s};class pu extends lu{constructor(e,t){super(e,t),De(this,"telemetry"),this.telemetry=e.getValue("telemetry"),this.setHeader("x-realtimekit-version",e.getValue("sdkVersion"))}getIPDetails(){return Be(this,null,function*(){var e;const{peerId:t}=this;try{const i=yield Yt.getIPDetails({peerId:t,apiHostnames:Po(this.context),logger:Ls});if(this.logger.log("ipInfo",{ipInfo:i}),(null==(e=null==i?void 0:i.loc)?void 0:e.length)>5)return i;throw Error("Insufficient data")}catch(d){return void this.logger.warn("APIClient.getIPDetails Failed to get ip details",{error:{name:d.name,message:d.message}})}})}getICEServers(){return Be(this,null,function*(){if(this.iceServers)return this.iceServers;const{success:e,iceServers:t}=(yield this.requests.get("/iceservers")).data;return e?((null==t?void 0:t.length)>0&&(this.iceServers=t),t):void 0})}getPlugins(){return Be(this,null,function*(){var e,t,i,r,n,s,a;if(this.pluginInformation)return this.pluginInformation;const{plugins:o}=(yield this.requests.get("/v2/plugins/user")).data.data,c=(null==(t=null==(e=this.context.getValue("flagsmith").getValue(Ya))?void 0:e.toString())?void 0:t.split(","))||[],l=o.reduce((e,t)=>(e[c.includes(t.id)?"v1":"v2"].push(Ie(Le({},t),{name:t.name.replace("v2","")})),e),{v1:[],v2:[]});return null!=(n=null==(r=null==(i=this.context.getValue("modules"))?void 0:i.devTools)?void 0:r.plugins)&&n.length&&(null==(a=null==(s=this.context.getValue("modules"))?void 0:s.devTools)||a.plugins.forEach(e=>{var t,i,r;const n=Ie(Le({},xo),{tags:[...xo.tags],baseUrl:"http://localhost:".concat(e.port),name:e.name,picture:null!=(t=e.picture)?t:xo.picture,createdAt:(new Date).toISOString(),updatedAt:(new Date).toISOString(),id:e.id,organizationId:this.organizationId,description:null!=(i=e.description)?i:xo.description,staggered:null!=(r=e.staggered)?r:xo.staggered});l.v2.push(n)})),l.v2})}getPluginDetails(e){return Be(this,null,function*(){const{plugin:t}=(yield this.requests.get("/v2/plugins/view/".concat(e))).data.data;return t})}getPluginConfig(e){return Be(this,null,function*(){return(yield this.fetchClient.get("".concat(e,"/dyte-config.json"))).data})}authorizePlugin(e){return Be(this,null,function*(){const t={peerId:this.peerId},{token:i}=(yield this.requests.post("/v2/plugins/authorize/".concat(e),t)).data.data;return i})}getPresignedUrls(e,t){return Be(this,null,function*(){const i=To(this.context,"chat_upload_expiry"),r={roomUUID:this.roomUUID,filename:e,expiry:"number"==typeof i?i:void 0};this.context.getValue("flagsmith").hasFeature(no)&&(r.viewType=t);const{getLocation:n,putLocation:s}=(yield this.requests.post("/v1/meetings/genPreSignedUploadUrl",r)).data.data;return{getLocation:n,putLocation:s}})}uploadFile(e,t){return Be(this,null,function*(){if(navigator.isReactNative&&"uri"in e)try{yield fetch(t,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:{uri:e.uri,name:e.name}})}catch(d){this.logger.error("sendFileMessage::".concat(d))}else yield this.fetchClient.put(t,e,{headers:{"Content-Type":e.type}})})}startLivestreaming(e){return Be(this,arguments,function(e){var t=this;let{manualIngestion:i}=e;return function*(){const e=iu(yield t.requests.post("/v2/meetings/".concat(t.context.getValue("meetingId"),"/livestreams"),{manual_ingest:!!i})).data.data;return{playbackUrl:e.playbackUrl,status:e.status,manualIngest:e.manualIngest,ingestionCredentials:e.streamKey?{ingestionServer:e.ingestServer,streamKey:e.streamKey}:null}}()})}stopLivestreaming(){return Be(this,null,function*(){return this.requests.post("/v2/meetings/".concat(this.context.getValue("meetingId"),"/active-livestream/stop"))})}getActiveLivestream(){return Be(this,null,function*(){const e=iu((yield this.requests.get("/v2/meetings/".concat(this.context.getValue("meetingId"),"/active-livestream"))).data.data);return{playbackUrl:e.playbackUrl,status:e.status,manualIngest:e.manualIngest,ingestionCredentials:e.streamKey?{ingestionServer:e.ingestServer,streamKey:e.streamKey}:null}})}getUserDetails(){return Be(this,null,function*(){if(this.userDetails)return this.userDetails;return iu((yield this.requests.get("v2/internals/participant-details")).data.data)})}startRecording(e,t){return Be(this,null,function*(){return(yield this.requests.post("/v2/recordings",Ie(Le({},ru(e)),{meeting_id:this.context.getValue("meetingId"),allow_multiple_recordings:!!t}))).data.data.id})}updateRecording(e,t){return Be(this,null,function*(){return this.requests.put("v2/recordings/".concat(e),{action:t})})}getActiveRecording(){return Be(this,null,function*(){const{status:e,id:t}=(yield this.requests.get("v2/recordings/active-recording/".concat(this.context.getValue("meetingId")))).data.data;return{status:e,id:t}})}getActiveTranscript(){return Be(this,null,function*(){const{transcript_download_url:e}=(yield this.requests.get("v2/meetings/".concat(this.context.getValue("meetingId"),"/active-transcript"))).data.data;try{return{transcript:(yield this.fetchClient.get(e)).data}}catch(t){throw new Uo("Cant fetch transcript s3 url","1801")}})}getRoomNodeData(){return Be(this,null,function*(){const e=yield this.getIPDetails();if(this.ipInfo=e,this.roomDetails)return this.roomDetails;const{title:t}=iu((yield this.requests.post("v2/internals/rooms",{ip_information:e})).data.data);return{meetingTitle:t}})}}let gu;function fu(){return gu}uu([Mo.trace("APIClient.getIPDetails")],pu.prototype,"getIPDetails",1),uu([Mo.trace("APIClient.getICEServers")],pu.prototype,"getICEServers",1),uu([Mo.trace("APIClient.getPlugins")],pu.prototype,"getPlugins",1),uu([Mo.trace("APIClient.startLivestreaming")],pu.prototype,"startLivestreaming",1),uu([Mo.trace("APIClient.stopLivestreaming")],pu.prototype,"stopLivestreaming",1),uu([Mo.trace("APIClient.getActiveLivestream")],pu.prototype,"getActiveLivestream",1),uu([Mo.trace("APIClient.getUserDetails")],pu.prototype,"getUserDetails",1),uu([Mo.trace("APIClient.startRecording")],pu.prototype,"startRecording",1),uu([Mo.trace("APIClient.stopRecording")],pu.prototype,"updateRecording",1),uu([Mo.trace("APIClient.getActiveRecording")],pu.prototype,"getActiveRecording",1),uu([Mo.trace("APIClient.getActiveTranscript")],pu.prototype,"getActiveTranscript",1),uu([Mo.trace("APIClient.getRoomNodeData")],pu.prototype,"getRoomNodeData",1);const mu={maxInvocations:5,period:1};function vu(e,t){return function(i,r,n){const s=n.value;let a=0,o=Date.now();return n.value=function(){const i=Date.now(),r=t?this[t]:e;if(i-o>1e3*r.period&&(o=i,a=0),a>=r.maxInvocations)throw new Uo("Method rate limit ".concat(r.maxInvocations," invocations/").concat(r.period,"sec exceeded"),"0013");for(var n=arguments.length,c=new Array(n),l=0;l{for(var n,s=r>1?void 0:r?ku(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&bu(t,i,s),s};const wu=["text","image","file","custom","poll"],Su={maxInvocations:180,period:60};var xu,Eu,Tu,_u,Pu,Cu,Au,Ru,Lu,Iu;let Mu=(Iu=class extends Ho{constructor(e,t,i,r,n){super(e.getValue("logger")),Ue(this,Cu),Ue(this,Ru),De(this,"messages"),De(this,"channels",[]),Ue(this,xu,void 0),Ue(this,Eu,void 0),Ue(this,Tu,void 0),Ue(this,_u,void 0),Ue(this,Pu,void 0),De(this,"maxTextLimit",2e3),Fe(this,Pu,e),Fe(this,Tu,t),Fe(this,_u,i),Fe(this,xu,r),Fe(this,Eu,n),this.messages=[]}get telemetry(){return Ne(this,Pu).getValue("telemetry")}setMaxTextLimit(e){this.maxTextLimit=e}sendMessageInternal(e,t,i){return Be(this,arguments,function(e,t,i){var r=this;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function*(){switch(e.type){case"text":{const s=n.replyTo&&"text"===n.replyTo.type?function(e,t){return"
".concat(t.replace(/
[.\s\S]*<\/blockquote>\n\n/m,""),"
\n\n").concat(e)}(e.message,n.replyTo.message):e.message;yield r.sendTextMessageInternal(s,t,i);break}case"image":yield r.sendImageMessageInternal(e.image,t,i);break;case"file":yield r.sendFileMessageInternal(e.file,t,i);break;default:r.logger.error("sendMessage::message_type_not_supported",{chat:{messageType:e.type}})}}()})}sendTextMessageInternal(e,t,i){return Be(this,null,function*(){var r,n,s,a,o,c;if(e.length>this.maxTextLimit)throw new Uo("Max character limit breached","0503");if(t&&t.length>0){if(null==(r=Ne(this,xu).permissions)||!r.chatPrivate.canSend||null==(n=Ne(this,xu).permissions)||!n.chatPrivate.text)throw this.logger.error("sendTextMessage::private_chat_permission_denied"),new Uo("Could not send message to private chat.","0501")}else if(null==(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)||!a.canSend||null==(c=null==(o=Ne(this,xu).permissions)?void 0:o.chatPublic)||!c.text)throw this.logger.error("sendTextMessage::public_chat_permission_denied"),new Uo("Could not send message to public chat.","0501");if(!e)throw this.logger.error("sendTextMessage::message_can_not_be_empty"),new Uo("Message can not be empty.","0502");if(i)return void Ne(this,Tu).sendMessageToChannel(e,eu.TEXT,i);let l=[];t&&t.length>0&&(t.push(Ne(this,xu).id),l=Ne(this,Eu).joined.toArray().filter(e=>t.includes(e.id)).map(e=>e.userId),l.push(Ne(this,xu).userId)),Ne(this,Tu).sendMessage(e,eu.TEXT,t)})}sendImageMessageInternal(e,t,i){return Be(this,null,function*(){var r,n,s,a,o,c;if(t&&t.length>0){if(null==(r=Ne(this,xu).permissions)||!r.chatPrivate.canSend||null==(n=Ne(this,xu).permissions)||!n.chatPrivate.files)return void this.logger.error("sendImageMessage::private_chat_permission_denied")}else if(null==(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)||!a.canSend||null==(c=null==(o=Ne(this,xu).permissions)?void 0:o.chatPublic)||!c.files)return void this.logger.error("sendImageMessage::permission_denied");if(e)if(["image/gif","image/jpeg","image/png"].includes(e.type))try{const r=fu(),{getLocation:n,putLocation:s}=yield r.getPresignedUrls(e.name,Ne(this,xu).config.viewType);if(yield r.uploadFile(e,s),i)return void Ne(this,Tu).sendMessageToChannel(n,eu.IMAGE,i);let a=[];t&&t.length>0&&(t.push(Ne(this,xu).id),a=Ne(this,Eu).joined.toArray().filter(e=>t.includes(e.id)).map(e=>e.userId),a.push(Ne(this,xu).userId)),Ne(this,Tu).sendMessage(n,eu.IMAGE,t)}catch(l){throw new Uo("Error sending image message.","0500",this.logger)}else this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:e.type}});else this.logger.error("sendImageMessage::required_argument_image_can_not_be_empty")})}sendFileMessageInternal(e,t,i){return Be(this,null,function*(){var r,n,s,a,o,c;if(t&&t.length>0){if(null==(r=Ne(this,xu).permissions)||!r.chatPrivate.canSend||null==(n=Ne(this,xu).permissions)||!n.chatPrivate.files)return void this.logger.error("sendFileMessage::private_chat_permission_denied")}else if(null==(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)||!a.canSend||null==(c=null==(o=Ne(this,xu).permissions)?void 0:o.chatPublic)||!c.files)return void this.logger.error("sendFileMessage::permission_denied");if(e)try{const r=fu(),{getLocation:n,putLocation:s}=yield r.getPresignedUrls(e.name,Ne(this,xu).config.viewType);if(yield r.uploadFile(e,s),i)return void Ne(this,Tu).sendMessageToChannel(JSON.stringify({link:n,name:e.name,size:"size"in e?e.size:0}),eu.FILE,i);let a=[];t&&t.length>0&&(t.push(Ne(this,xu).id),a=Ne(this,Eu).joined.toArray().filter(e=>t.includes(e.id)).map(e=>e.userId),a.push(Ne(this,xu).userId));const o=JSON.stringify({link:n,name:e.name,size:"size"in e?e.size:0});Ne(this,Tu).sendMessage(o,eu.FILE,t)}catch(l){throw new Uo("Error sending file message.","0500",this.logger)}else this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty")})}get rateLimits(){return Su}updateRateLimits(e,t){Su.maxInvocations=e,Su.period=t}sendTextMessage(e,t){return Be(this,null,function*(){return this.sendTextMessageInternal(e,t)})}sendCustomMessage(e,t){return Be(this,null,function*(){var i,r,n,s,a,o,c,l,d,h,u,p,g,f,m;if(t&&t.length>0){if(null==(i=Ne(this,xu).permissions)||!i.chatPrivate.canSend||null==(r=Ne(this,xu).permissions)||!r.chatPrivate.files||null==(n=Ne(this,xu).permissions)||!n.chatPrivate.text)return void this.logger.error("sendCustomMessage::private_chat_permission_denied")}else if(null==(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)||!a.canSend||null==(c=null==(o=Ne(this,xu).permissions)?void 0:o.chatPublic)||!c.files||null==(d=null==(l=Ne(this,xu).permissions)?void 0:l.chatPublic)||!d.text)return void this.logger.error("sendCustomMessage::permission_denied");const v=e=>Be(this,null,function*(){try{if("string"==typeof e)return{link:e};const t=fu(),{getLocation:i,putLocation:r}=yield t.getPresignedUrls(e.name,Ne(this,xu).config.viewType);return yield t.uploadFile(e,r),{link:i,type:e.type,name:e.name,size:e.size}}catch(t){throw new Uo("Error sending image message.","0500",this.logger)}}),b=Ie(Le({},e),{files:yield Promise.all(null==(u=null!=(h=e.files)?h:[])?void 0:u.map(e=>Be(this,null,function*(){return v(e)}))),images:yield Promise.all(null==(g=null!=(p=e.images)?p:[])?void 0:g.map(e=>Be(this,null,function*(){return v(e)}))),videos:yield Promise.all(null==(m=null!=(f=e.videos)?f:[])?void 0:m.map(e=>Be(this,null,function*(){return v(e)})))});Ne(this,Tu).sendMessage(JSON.stringify(b),eu.CUSTOM,t)})}sendImageMessage(e,t){return Be(this,null,function*(){return this.sendImageMessageInternal(e,t)})}sendFileMessage(e,t){return Be(this,null,function*(){return this.sendFileMessageInternal(e,t)})}sendMessage(e,t){return Be(this,null,function*(){return this.sendMessageInternal(e,t)})}editTextMessage(e,t,i){return Be(this,null,function*(){var r,n,s,a,o,c;if("NONE"===(null==(n=null==(r=Ne(this,xu).permissions)?void 0:r.chatMessage)?void 0:n.canEdit))throw new Uo("Not permitted to edit messages","0501");null!=(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)&&a.canSend&&null!=(c=null==(o=Ne(this,xu).permissions)?void 0:o.chatPublic)&&c.text?t?Ne(this,Tu).editMessage(e,t,eu.TEXT,i):this.logger.error("editTextMessage::message_can_not_be_empty"):this.logger.error("editTextMessage::permission_denied")})}editImageMessage(e,t,i){return Be(this,null,function*(){var r,n,s,a;if(null!=(n=null==(r=Ne(this,xu).permissions)?void 0:r.chatPublic)&&n.canSend&&null!=(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)&&a.files)if(t)if(["image/gif","image/jpeg","image/png"].includes(t.type))try{const r=fu(),{getLocation:n,putLocation:s}=yield r.getPresignedUrls(t.name,Ne(this,xu).config.viewType);yield r.uploadFile(t,s),Ne(this,Tu).editMessage(e,n,eu.IMAGE,i)}catch(o){throw new Uo("Error editing image message.","0500",this.logger)}else this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:t.type}});else this.logger.error("editImageMessage::required_argument_image_can_not_be_empty");else this.logger.error("editImageMessage::permission_denied")})}editFileMessage(e,t,i){return Be(this,null,function*(){var r,n,s,a;if(null!=(n=null==(r=Ne(this,xu).permissions)?void 0:r.chatPublic)&&n.canSend&&null!=(a=null==(s=Ne(this,xu).permissions)?void 0:s.chatPublic)&&a.files)if(t)try{const r=fu(),{getLocation:n,putLocation:s}=yield r.getPresignedUrls(t.name,Ne(this,xu).config.viewType);yield r.uploadFile(t,s),Ne(this,Tu).editMessage(e,JSON.stringify({link:n,name:t.name,size:"size"in t?t.size:0}),eu.FILE,i)}catch(o){throw new Uo("Error editing file message.","0500",this.logger)}else this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty");else this.logger.error("sendFileMessage::permission_denied")})}editMessage(e,t,i){return Be(this,null,function*(){switch(t.type){case"text":this.editTextMessage(e,t.message,i);break;case"image":this.editImageMessage(e,t.image,i);break;case"file":this.editFileMessage(e,t.file,i);break;default:this.logger.error("editMessage::message_type_not_supported",{chat:{messageType:t.type}})}})}deleteMessage(e,t){return Be(this,null,function*(){var i,r;if("NONE"===(null==(r=null==(i=Ne(this,xu).permissions)?void 0:i.chatMessage)?void 0:r.canDelete))throw new Uo("Not permitted to delete messages","0501");Ne(this,Tu).deleteMessage(e,t)})}getMessagesByUser(e){return this.messages.filter(t=>t.userId===e)}getMessagesByType(e){return this.messages.filter(t=>t.type===e)}pin(e){return Be(this,null,function*(){if(!Ne(this,Ru,Lu))throw new Uo("Can`t pin message without joining room","0505");if(!Ne(this,xu).permissions.pinParticipant)throw new Uo("You do not have permission to pin messages.","0501");const t=this.messages.find(t=>t.id===e);if(!t)throw new Uo("No message found with id: ".concat(e),"0504");Ne(this,Tu).setPinState(t,!0)})}unpin(e){return Be(this,null,function*(){if(!Ne(this,Ru,Lu))throw new Uo("Can`t unpin message without joining room","0505");if(!Ne(this,xu).permissions.pinParticipant)throw new Uo("You do not have permission to unpin messages.","0501");const t=this.messages.find(t=>t.id===e);if(!t)throw new Uo("No message found with id: ".concat(e),"0504");Ne(this,Tu).setPinState(t,!1)})}getMessages(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return Be(this,null,function*(){const s=yield Ne(this,Tu).getChatMessagesPaginated(e,t,i,r,n);return{messages:s.messages.map(e=>ju.formatSocketPeerMessage(e)),next:s.next}})}createChannel(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){var n;const s=null==(n=Ne(i,xu).permissions)?void 0:n.chatChannel;if(s){if("NONE"===s.canCreate)throw new Uo("Not permitted to create channels","0501");if("public"===r.visibility&&"PUBLIC"!==s.canCreate&&"ALL"!==s.canCreate)throw new Uo("Not permitted to create public channels","0501");if("private"===r.visibility&&"PRIVATE"!==s.canCreate&&"ALL"!==s.canCreate)throw new Uo("Not permitted to create private channels","0501")}if(!e||0===e.trim().length)throw new Uo("channel name cannot be empty.","0510");const a=[...new Set([...t,Ne(i,xu).userId])];return yield Ne(i,_u).createChannel(e.trim(),a,r.displayPictureUrl,r.visibility,r.isDirectMessage)}()})}updateChannel(e,t){var i,r,n,s,a;const o=this.channels.find(t=>t.id===e),c=null==(i=Ne(this,xu).permissions)?void 0:i.chatChannel;if(c){if("NONE"===c.canUpdate)throw new Uo("Not permitted to update channels","0501");if("public"===o.visibility&&"PUBLIC"!==c.canUpdate&&"ALL"!==c.canUpdate)throw new Uo("Not permitted to update public channels","0501");if("private"===o.visibility&&"PRIVATE"!==c.canUpdate&&"ALL"!==c.canUpdate)throw new Uo("Not permitted to update private channels","0501")}const l={memberIds:null!=(r=t.memberIds)?r:o.memberIds,displayName:null!=(n=t.displayName)?n:o.displayName,displayPictureUrl:null!=(s=t.displayPictureUrl)?s:o.displayPictureUrl,visibility:null!=(a=t.visibility)?a:o.visibility};return Ne(this,_u).updateChannel(e,l)}sendMessageToChannel(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){return i.sendMessageInternal(e,null,t,r)}()})}getChannelMembers(e){return Be(this,null,function*(){return Ne(this,_u).getChannelMembers(e)})}searchMessages(e){return Be(this,arguments,function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){if(!Ne(t,Pu).getValue("flagsmith").hasFeature(so))throw new Uo("searchMessages is temporarily disabled!","0506");return(yield Ne(t,Tu).searchMessages(e,i)).map(ju.formatSocketPeerMessage)}()})}markLastReadMessage(e,t){return Be(this,null,function*(){yield Ne(this,Tu).markLastReadMessage(e,t);const i=this.channels.find(t=>t.id===e);if(i){const t=Ie(Le({},i),{unreadCount:0});this.channels=this.channels.map(i=>i.id===e?t:i),this.emit("channelMessageUpdate",t)}})}get pinned(){return this.messages.filter(e=>e.pinned)}},xu=new WeakMap,Eu=new WeakMap,Tu=new WeakMap,_u=new WeakMap,Pu=new WeakMap,Cu=new WeakSet,Au=function(){return Ne(this,Pu).getValue("connectionHandler")},Ru=new WeakSet,Lu=function(){return!0===Ne(this,Cu,Au).socketJoined},Iu);yu([Mo.trace("Chat.sendTextMessage"),vu(Su)],Mu.prototype,"sendTextMessage",1),yu([Mo.trace("Chat.sendImageMessage"),vu({maxInvocations:20,period:60})],Mu.prototype,"sendImageMessage",1),yu([Mo.trace("Chat.sendFileMessage"),vu({maxInvocations:20,period:60})],Mu.prototype,"sendFileMessage",1),yu([Mo.trace("Chat.sendMessage"),vu({maxInvocations:180,period:60})],Mu.prototype,"sendMessage",1),yu([Mo.trace("Chat.editTextMessage")],Mu.prototype,"editTextMessage",1),yu([Mo.trace("Chat.editImageMessage")],Mu.prototype,"editImageMessage",1),yu([Mo.trace("Chat.editFileMessage")],Mu.prototype,"editFileMessage",1),yu([Mo.trace("Chat.editMessage")],Mu.prototype,"editMessage",1),yu([Mo.trace("Chat.deleteMessage")],Mu.prototype,"deleteMessage",1),yu([Mo.trace("Chat.createChannel")],Mu.prototype,"createChannel",1),yu([Mo.trace("Chat.updateChannel")],Mu.prototype,"updateChannel",1),yu([Mo.trace("Chat.sendMessageToChannel")],Mu.prototype,"sendMessageToChannel",1),yu([Mo.trace("Chat.getChannelMembers")],Mu.prototype,"getChannelMembers",1),yu([Mo.trace("Chat.searchMessages")],Mu.prototype,"searchMessages",1),yu([Mo.trace("Chat.markLastReadMessage")],Mu.prototype,"markLastReadMessage",1),Mu=yu([Bo("0500")],Mu);var Du,Ou,Nu=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor;const Fu=(Ou=class{constructor(e,t,i,r,n){De(this,"chat"),De(this,"chatSocketHandler"),De(this,"chatChannelSocketHandler"),De(this,"self"),Ue(this,Du,void 0),Fe(this,Du,e),this.chatSocketHandler=t,this.chatChannelSocketHandler=i,this.chat=new Mu(e,t,i,r,n),this.self=r,this.setupEvents()}get telemetry(){return Ne(this,Du).getValue("telemetry")}get logger(){return Ne(this,Du).getValue("logger")}static init(e,t,i,r,n){return Be(this,null,function*(){return new Fu(e,t,i,r,n)})}static formatMessage(e){return Ie(Le({},e),{time:new Date(e.time),type:wu[e.type]})}static formatSocketPeerMessage(e){const t=1e3*e.createdAt,i={displayName:e.displayName,id:e.chatId,time:t,timeMs:e.createdAtMs,type:e.payloadType,isEdited:e.isEdited,userId:e.userId,targetUserIds:e.targetUserIds,channelId:e.channelId,channelIndex:e.channelIndex,message:"",link:"",name:"",html:"",images:[],videos:[],files:[],size:0,pinned:e.pinned};switch(i.type){case eu.TEXT:i.message=e.payload;break;case eu.IMAGE:i.link=e.payload;break;case eu.FILE:{const{link:t,name:r,size:n}=JSON.parse(e.payload);i.link=t,i.name=r,i.size=n;break}case eu.CUSTOM:{const{html:t,images:r,message:n,videos:s,files:a}=JSON.parse(e.payload);i.message=n,i.html=t,i.images=r,i.videos=s,i.files=a;break}}return Fu.formatMessage(i)}getChatMessages(){return Be(this,null,function*(){if("LIVESTREAM"===this.self.config.viewType||"CHAT"===this.self.config.viewType||Ne(this,Du).getValue("flagsmith").hasFeature(Qa))return;const e=yield this.chatSocketHandler.getChatMessages();if(null==e||!e.payload)return;const t=_d.fromBinary(e.payload).messages;this.chat.messages=t.map(e=>Fu.formatSocketPeerMessage(e))})}setupEvents(){Ne(this,Du).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>Be(this,null,function*(){this.getChatMessages()})),this.chatSocketHandler.on(Dh.sendMessageToRoom,e=>{const t=Fu.formatSocketPeerMessage(e.message);if(t.channelId){const e=this.chat.channels.find(e=>e.id===t.channelId);e&&(e.latestMessage=t,e.unreadCount+=1,this.chat.emit("channelMessageUpdate",e))}else this.chat.messages=[...this.chat.messages,t];this.chat.emit("chatUpdate",{action:"add",message:t,messages:this.chat.messages})}),this.chatSocketHandler.on(Dh.sendMessageToPeers,e=>{const t=Fu.formatSocketPeerMessage(e.message);this.chat.messages=[...this.chat.messages,t],this.chat.emit("chatUpdate",{action:"add",message:t,messages:this.chat.messages})}),this.chatSocketHandler.on(Dh.editMessage,e=>{const t=Fu.formatSocketPeerMessage(e.message);if(t.channelId)return void this.chat.emit("chatUpdate",{action:"edit",message:t,messages:this.chat.messages});const i=this.chat.messages.findIndex(e=>e.id===t.id);-1!==i&&(this.chat.messages[i]=t,this.chat.emit("chatUpdate",{action:"edit",message:t,messages:this.chat.messages}))}),this.chatSocketHandler.on(Dh.deleteMessage,e=>{if(e.channelId)return void this.chat.emit("chatUpdate",{action:"delete",message:{id:e.chatId,channelId:e.channelId},messages:this.chat.messages});const t=this.chat.messages.findIndex(t=>t.id===e.chatId);if(-1===t)return;const[i]=this.chat.messages.splice(t,1);this.chat.emit("chatUpdate",{action:"delete",message:i,messages:this.chat.messages})}),this.chatChannelSocketHandler.on(Uh.createChatChannel,e=>{const[t]=e.chatChannels,i=Kh.formatChannel(t);this.chat.channels.push(i),this.chat.emit("channelCreate",i)}),this.chatSocketHandler.on(Dh.pinMessage,e=>{const t=this.chat.messages.findIndex(t=>t.id===e.chatId);if(-1===t)return;const i=this.chat.messages[t];i.pinned=e.pinned,this.chat.messages[t]=i,this.chat.emit("chatUpdate",{action:"edit",message:i,messages:this.chat.messages})}),this.chatChannelSocketHandler.on(Uh.updateChatChannel,e=>{const[t]=e.chatChannels,i=Kh.formatChannel(t);this.chat.channels=this.chat.channels.map(e=>e.id===i.id?i:e),this.chat.emit("channelUpdate",i)})}},Du=new WeakMap,Ou);let ju=Fu;((e,t,i,r)=>{for(var n,s=r>1?void 0:r?Uu(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&Nu(t,i,s)})([Mo.trace("ChatController.setupEvents")],ju.prototype,"setupEvents",1);var Bu,Vu,zu,Hu,$u,Gu,Wu,qu,Ku=Object.defineProperty,Zu=Object.getOwnPropertyDescriptor;let Yu=(qu=class extends Ho{constructor(e,t,i){super(e.getValue("logger")),Ue(this,Bu),Ue(this,zu),De(this,"items"),Ue(this,$u,void 0),Ue(this,Gu,void 0),Ue(this,Wu,void 0),Fe(this,Wu,e),Fe(this,$u,t),Fe(this,Gu,i),this.items=[]}create(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Be(this,null,function*(){if(!Ne(this,zu,Hu))throw new Uo("Can't create polls without joining room","0705");Ne(this,$u).permissions.polls.canCreate?e&&t?t.length<2?this.logger.error("Polls::there_must_be_at_least_two_options",{polls:{hasQuestion:!!e,optionsLength:t.length}}):yield Ne(this,Gu).createPoll(e,t,i,r):this.logger.error("Polls::question_and_options_can_not_be_empty",{polls:{hasQuestion:!!e,optionsLength:null==t?void 0:t.length}}):this.logger.error("Polls::create::permission_denied")})}vote(e,t){return Be(this,null,function*(){Ne(this,$u).permissions.polls.canVote?yield Ne(this,Gu).votePoll(e,t):this.logger.error("Polls::vote::permission_denied")})}},Bu=new WeakSet,Vu=function(){return Ne(this,Wu).getValue("connectionHandler")},zu=new WeakSet,Hu=function(){var e;return!0===(null==(e=Ne(this,Bu,Vu))?void 0:e.socketJoined)},$u=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,qu);Yu=((e,t,i,r)=>{for(var n,s=r>1?void 0:r?Zu(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Ku(t,i,s),s})([Bo("0700")],Yu);var Ju,Qu,Xu,ep,tp=Object.defineProperty,ip=Object.getOwnPropertyDescriptor;const rp=(ep=class{constructor(e,t,i){De(this,"polls"),Ue(this,Ju,void 0),Ue(this,Qu,void 0),Ue(this,Xu,void 0),this.polls=new Yu(e,t,i),Fe(this,Qu,t),Fe(this,Ju,e),Fe(this,Xu,i),this.setupEvents()}get telemetry(){return Ne(this,Ju).getValue("telemetry")}get logger(){return Ne(this,Ju).getValue("logger")}static init(e,t,i){return Be(this,null,function*(){return new rp(e,t,i)})}canViewPolls(){return Ne(this,Qu).permissions.polls.canView}setupEvents(){const e={[Nh.createPoll]:e=>{e.poll&&this.updatePoll(rp.formatSocketServicePoll(e.poll))},[Nh.updatePoll]:e=>{e.poll&&this.updatePoll(rp.formatSocketServicePoll(e.poll))},[Nh.votePoll]:e=>{e.poll&&this.updatePoll(rp.formatSocketServicePoll(e.poll))}},t=()=>{Ne(this,Ju).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(e).map(Number).forEach(t=>{Ne(this,Xu).on(t,e[t])})},i=()=>{Ne(this,Ju).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(e).map(Number).forEach(e=>{Ne(this,Xu).removeListeners(e)})};Ne(this,Qu).permissions.on("permissionsUpdate",e=>Be(this,null,function*(){var r;null!=e&&e.polls&&(null!=(r=null==e?void 0:e.polls)&&r.canView?(yield this.getPolls(),t()):(this.polls.items=[],i()))})),this.canViewPolls()&&t()}updatePoll(e){if(!this.canViewPolls())return;const t=this.polls.items.findIndex(t=>t.id===e.id);if(t>-1){const i=JSON.stringify(this.polls.items[t]);return this.polls.items[t]=e,void(i!==JSON.stringify(e)&&this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!1}))}this.polls.items=[...this.polls.items,e],this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!0})}getPolls(){return Be(this,null,function*(){const e=yield Ne(this,Xu).getPolls();if(null==e||!e.payload)return;const{polls:t}=Ph.fromBinary(e.payload);this.polls.items=t.map(e=>rp.formatSocketServicePoll(e))})}static formatSocketServicePoll(e){const t=e.options.map(e=>({count:e.count,text:e.text,votes:e.votes.map(e=>({id:e.userId,name:e.name}))}));return{anonymous:e.anonymous,createdBy:e.createdBy,createdByUserId:e.createdByUserId,hideVotes:e.hideVotes,id:e.pollId,options:t,question:e.question,voted:e.votes}}},Ju=new WeakMap,Qu=new WeakMap,Xu=new WeakMap,ep);let np=rp;((e,t,i,r)=>{for(var n,s=r>1?void 0:r?ip(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&tp(t,i,s)})([Mo.trace("PollController.setupEvents")],np.prototype,"setupEvents",1);var sp,ap,op,cp,lp,dp,hp=Object.defineProperty,up=Object.getOwnPropertyDescriptor,pp=(e=>(e[e.User=0]="User",e[e.Meeting=1]="Meeting",e))(pp||{});let gp=(dp=class extends Ho{constructor(e,t,i,r,n){super(e.getValue("logger")),Ue(this,ap),De(this,"selfActiveTab"),De(this,"broadcastTabChanges"),Ue(this,sp,void 0),Ue(this,cp,void 0),Ue(this,lp,void 0),De(this,"viewType"),De(this,"meetingStartedTimestamp"),De(this,"meetingTitle"),De(this,"sessionId"),Fe(this,sp,e),Fe(this,cp,t),this.viewType=i,Fe(this,lp,r),this.meetingTitle=n,this.broadcastTabChanges=t.permissions.canSpotlight}get socketState(){return Ne(this,ap,op).socketState}get mediaState(){return Ne(this,ap,op).mediaState}get meetingId(){return Ne(this,sp).getValue("meetingId")}setBroadcastTabChanges(e){if(!Ne(this,cp).permissions.canSpotlight)throw this.logger.error("Spotlight::setSpotlighted::permission_denied"),new Uo("User does not have permission to toggle spotlight","0801");this.broadcastTabChanges=e,this.emit("broadcastTabChangesUpdate",this.broadcastTabChanges),this.broadcastTabChanges&&this.assertActiveTabToRoom()}setSelfActiveTab(e,t){var i;this.logger.info("Spotlight::setActiveTab",{spotlight:{currentTab:{id:e.id,type:e.type}}}),this.selfActiveTab=e,0===t&&this.emit("selfTabUpdate",e),null!=(i=Ne(this,cp).permissions)&&i.canSpotlight&&this.broadcastTabChanges&&0===t&&this.assertActiveTabToRoom()}assertActiveTabToRoom(){Ne(this,lp).broadcastMessage("spotlight",{userId:Ne(this,cp).userId,currentTab:this.selfActiveTab})}},sp=new WeakMap,ap=new WeakSet,op=function(){return Ne(this,sp).getValue("connectionHandler")},cp=new WeakMap,lp=new WeakMap,dp);gp=((e,t,i,r)=>{for(var n,s=r>1?void 0:r?up(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&hp(t,i,s),s})([Bo("0800")],gp);var fp,mp,vp=Object.defineProperty,bp=Object.getOwnPropertyDescriptor,kp=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?bp(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&vp(t,i,s),s};let yp=(mp=class extends Ho{constructor(e){super(e.getValue("logger")),De(this,"transcripts"),Ue(this,fp,void 0),Fe(this,fp,e),this.transcripts=[]}get telemetry(){return Ne(this,fp).getValue("telemetry")}static init(e,t){return Be(this,null,function*(){const i=new yp(e),r=e.getValue("logger");try{t&&i.getActiveTranscript()}catch(n){r.error("Error fetching active transcriptions ",n)}return i})}static parseTranscript(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const[[i,r,n,s,a,o]]=function(e){let t="",i=[""];const r=[i];let n,s=0,a=0,o=!0;for(n of e)'"'===n?(o&&n===t&&(i[s]+=n),o=!o):","===n&&o?n=i[++s]="":"\n"===n&&o?("\r"===t&&(i[s]=i[s].slice(0,-1)),i=r[++a]=[n=""],s=0):i[s]+=n,t=n;return r}(e);return{id:u(),name:a,peerId:r,userId:n,customParticipantId:s,transcript:o,isPartialTranscript:t,date:new Date(1e3*parseInt(i,10))}}static parseTranscripts(e){return e?e.split("\n").map(e=>yp.parseTranscript(e,!1)).filter(Boolean):[]}getActiveTranscript(){return Be(this,null,function*(){try{const e=fu(),{transcript:t}=yield e.getActiveTranscript();this.transcripts=yp.parseTranscripts(t)}catch(e){}})}onTranscript(e){return Be(this,null,function*(){var t;const i=this.transcripts.filter(t=>{let{peerId:i}=t;return i===e.peerId});if(null!=(t=null==i?void 0:i.at(-1))&&t.isPartialTranscript){const t=i.at(-1);return t.transcript=e.transcript,t.isPartialTranscript=e.isPartialTranscript,void this.emit("transcript",t)}this.transcripts=[...this.transcripts,e],this.emit("transcript",e)})}},fp=new WeakMap,mp);kp([Mo.trace("Ai.getActiveTranscript")],yp.prototype,"getActiveTranscript",1),yp=kp([Bo("0000")],yp);var wp,Sp,xp,Ep,Tp=Object.defineProperty,_p=Object.getOwnPropertyDescriptor;const Pp=(Ep=class{constructor(e,t,i,r,n,s){De(this,"meta"),De(this,"ai"),Ue(this,wp,void 0),Ue(this,Sp,void 0),De(this,"aiSocketHandler"),Ue(this,xp,void 0),Fe(this,xp,e),this.meta=new gp(e,t,t.config.viewType,i,s),this.ai=r,Fe(this,wp,t),Fe(this,Sp,i),this.aiSocketHandler=n,t.config.viewType!==cs.Chat&&this.setupEvents()}get telemetry(){return Ne(this,xp).getValue("telemetry")}get logger(){return Ne(this,xp).getValue("logger")}static init(e,t,i,r,n){return Be(this,null,function*(){const s=yield yp.init(e,t.permissions.transcriptionEnabled);return new Pp(e,t,i,s,r,n)})}conditionallySetActiveTab(e){var t;null!=e&&e.currentTab&&(null==(t=this.meta.selfActiveTab)?void 0:t.id)!==e.currentTab.id&&(this.meta.setSelfActiveTab(e.currentTab,pp.Meeting),this.meta.emit("activeTabUpdate",e.currentTab))}setupEvents(){Ne(this,xp).getValue("peerSessionStore").on(Vo.TRANSPORT_STATE_UPDATE,e=>{this.meta.emit("mediaConnectionUpdate",e)}),Ne(this,xp).getValue("peerSessionStore").on(Vo.SOCKET_STATE_UPDATE,e=>{this.meta.emit("socketConnectionUpdate",e)}),Ne(this,xp).getValue("peerSessionStore").on(Vo.ROOM_STATE,e=>{let{createdAt:t,roomUuid:i}=e;const r=this.meta.meetingStartedTimestamp;if(i&&(this.meta.sessionId=i),t&&!r){const e=new Date(1e3*t);this.meta.meetingStartedTimestamp=e,this.meta.emit("meetingStartTimeUpdate",{meetingStartedTimestamp:this.meta.meetingStartedTimestamp})}}),Ne(this,xp).getValue("peerSessionStore").on(Vo.PRODUCER_SCORE_UPDATE,e=>{let{score:t}=e;t<5&&this.meta.emit("poorConnection",{score:t})}),Ne(this,wp).permissions.canSpotlight&&(this.logger.info("MetaController::Asserting Spotlight"),this.meta.selfActiveTab&&Ne(this,Sp).broadcastMessage("spotlight",{userId:Ne(this,wp).userId,currentTab:this.meta.selfActiveTab})),Ne(this,xp).getValue("peerSessionStore").on(Vo.PEER_JOINED_INTERNAL,e=>Be(this,null,function*(){Ne(this,wp).permissions.canSpotlight&&this.meta.selfActiveTab&&Ne(this,Sp).broadcastToPeers("spotlight",[e.id],{userId:Ne(this,wp).userId,currentTab:this.meta.selfActiveTab})})),Ne(this,xp).getValue("peerSessionStore").on(Vo.ROOM_MESSAGE,e=>{var t,i;let r;if("type"in e){if("spotlight"!==e.type)return;r=Le(Le({},e),e.payload)}else{if(!("roomMessageType"in e))return;if("spotlight"!==e.roomMessageType)return;r=e}this.logger.info("Spotlight Assertion Received",{spotlight:{spotlighter:{id:r.userId},currentTab:{id:null==(t=r.currentTab)?void 0:t.id,type:null==(i=r.currentTab)?void 0:i.type}}}),this.conditionallySetActiveTab(r)}),Ne(this,xp).getValue("peerSessionStore").on(Vo.MESSAGE,e=>{var t,i;let r;if("type"in e){if("spotlight"!==e.type)return;r=Le(Le({},e),e.payload)}else{if(!("roomMessageType"in e))return;if("spotlight"!==e.roomMessageType)return;r=e}this.logger.info("Spotlight Assertion Received",{spotlight:{spotlighter:{id:r.userId},currentTab:{id:null==(t=r.currentTab)?void 0:t.id,type:null==(i=r.currentTab)?void 0:i.type}}}),this.conditionallySetActiveTab(r)}),this.aiSocketHandler.on(Mh.transcript,e=>{const{meetingId:t,transcript:i,isPartial:r}=e;let n;try{n=yp.parseTranscript(i,r)}catch(c){this.logger.error("Failed to parse transcript: ".concat(i),c)}if(!n)return void this.logger.warn("Received empty transcript data");this.ai.onTranscript(n),this.meta.emit("transcript",n);const{peerId:s,name:a,transcript:o}=n;this.logger.debug("".concat(t," Received transcript for peer ").concat(s," - ").concat(a,": ").concat(o))})}},wp=new WeakMap,Sp=new WeakMap,xp=new WeakMap,Ep);let Cp=Pp;((e,t,i,r)=>{for(var n,s=r>1?void 0:r?_p(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&Tp(t,i,s)})([Mo.trace("MetaController.setupEvents")],Cp.prototype,"setupEvents",1);const Ap={},Rp={executeWithLock(e){let{methodName:t,lockName:i,timeout:r}=e;return(e,n,s)=>{const a=s.value;return s.value=function(){for(var e,n,s=arguments.length,o=new Array(s),c=0;cdelete Ap[d],r),p=a.apply(this,o);return Promise.resolve(p).then(()=>{delete Ap[d],clearTimeout(u)}).catch(()=>{delete Ap[d],clearTimeout(u)}),p},s}}};var Lp,Ip,Mp,Dp,Op,Np,Up,Fp,jp,Bp,Vp=Object.defineProperty,zp=Object.getOwnPropertyDescriptor,Hp=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?zp(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Vp(t,i,s),s};class $p extends Ho{constructor(e,t,i,r,n){super(e.getValue("logger")),Ue(this,Up),Ue(this,jp),Ue(this,Lp,void 0),Ue(this,Ip,void 0),Ue(this,Mp,void 0),Ue(this,Dp,void 0),Ue(this,Op,void 0),Ue(this,Np,void 0),Fe(this,Np,e),Fe(this,Lp,r),Fe(this,Ip,n),Fe(this,Mp,t),Fe(this,Dp,i),Fe(this,Op,[]),this.setupEvents()}get telemetry(){return Ne(this,Np).getValue("telemetry")}get status(){return Ne(this,Np).getValue("stageStatus")}setupEvents(){const e={[Vo.GET_STAGE_REQUESTS]:e=>Be(this,null,function*(){Fe(this,Op,e)}),[Vo.UPDATE_STAGE_REQUESTS]:e=>Be(this,[e],function(e){var t=this;let{add:i}=e;return function*(){const e=Ne(t,Op).length,{stageRequests:r}=t.getAccessRequests();(i||r.length>e)&&t.emit("newStageRequest",{count:r.length}),t.emit("stageAccessRequestUpdate",r)}()})},t=()=>{Object.entries(e).forEach(e=>{let[t,i]=e;Ne(this,Np).getValue("peerSessionStore").onAsync(t,i)})},i=()=>{Object.entries(e).forEach(e=>{let[t,i]=e;Ne(this,Np).getValue("peerSessionStore").removeListener(t,i)})};Ne(this,Mp).permissions.on("permissionsUpdate",e=>{const{canAcceptProductionRequests:r}=e;void 0!==r&&(Ne(this,Mp).permissions.acceptStageRequests?(t(),Ne(this,Lp).getStageRequests()):(i(),Fe(this,Op,[]),this.emit("stageAccessRequestUpdate",Ne(this,Op))))}),Ne(this,Mp).permissions.acceptStageRequests&&t()}getAccessRequests(){if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if(!Ne(this,Mp).permissions.acceptStageRequests)throw this.logger.error("Stage::get_access_request::permission_denied"),new Uo("You do not have permission to perform this action","2001");const e=Ne(this,Dp).joined.toArray().filter(e=>"REQUESTED_TO_JOIN_STAGE"===e.stageStatus).map(e=>({displayName:e.name,userId:e.userId,peerId:e.id}));return Fe(this,Op,e),{stageRequests:Ne(this,Op)}}requestAccess(){return Be(this,null,function*(){if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if("OFF_STAGE"!==this.status)throw new Uo("Unable to request access you are currently ".concat(this.status),"2006");Ne(this,Mp).permissions.stageAccess!==ls.Allowed?(Ne(this,Lp).requestAccess(),je(this,jp,Bp).call(this,"REQUESTED_TO_JOIN_STAGE")):je(this,jp,Bp).call(this,"ACCEPTED_TO_JOIN_STAGE")})}cancelRequestAccess(){return Be(this,null,function*(){if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");Ne(this,Lp).cancelRequestAccess(),je(this,jp,Bp).call(this,"OFF_STAGE")})}grantAccess(e){if(!Ne(this,Mp).roomJoined)throw new Uo("Can`t grant for participant without joining room");if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if(!Ne(this,Mp).permissions.acceptStageRequests)throw this.logger.error("Stage::grant_access::permission_denied"),new Uo("You do not have permission to perform this action","2001");return Ne(this,Lp).grantAccess(e)}denyAccess(e){if(!Ne(this,Mp).roomJoined)throw new Uo("Can`t rejectRequestToJoinStage for participant without joining room","2005");if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if(!Ne(this,Mp).permissions.acceptStageRequests)throw this.logger.error("Stage::deny_access::permission_denied"),new Uo("You do not have permission to perform this action","2001");return Ne(this,Lp).denyAccess(e)}get peerId(){return Ne(this,Np).getValue("peerId")}join(){return Be(this,null,function*(){const e=Ne(this,Np).getValue("viewType");if("ON_STAGE"===this.status)throw new Uo("You are already on stage.","2006");if("ACCEPTED_TO_JOIN_STAGE"!==this.status||Ne(this,Mp).permissions.stageAccess===ls.NotAllowed)throw new Uo("Unable to join stage you are currently ".concat(this.status),"2006");Ne(this,Np).setValue("stageStatus","ON_STAGE",!1),yield Ne(this,Lp).joinStage(),e!==cs.Livestream?(Ne(this,Np).notify("stageStatus"),Ne(this,Mp).audioEnabled&&Ne(this,Up,Fp).shareMic(Ne(this,Mp).audioTrack),Ne(this,Mp).videoEnabled&&Ne(this,Up,Fp).shareWebcam(Ne(this,Mp).videoTrack)):yield Ne(this,Np).getValue("selfController").joinRoom()})}leave(){return Be(this,null,function*(){if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if("ON_STAGE"!==this.status&&"ACCEPTED_TO_JOIN_STAGE"!==this.status)throw new Uo("Unable to leave stage you are currently ".concat(this.status),"2006");Ne(this,Mp).setIsPinned(!1),Ne(this,Np).setValue("stageStatus","OFF_STAGE",!1),yield Ne(this,Lp).leaveStage(Ne(this,Mp).userId);try{yield Ne(this,Np).getValue("peerSessionStore").emitAsync(Vo.LEAVE_MEDIA_ROOM,"stageLeft")}catch(e){this.logger.error("Stage::leave::emitAsync::failed",{error:e})}Ne(this,Np).notify("stageStatus")})}kick(e){return Be(this,null,function*(){if(!Ne(this,Mp).roomJoined)throw new Uo("Can`t kick participant without joining room","2005");if(!Ne(this,Mp).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new Uo("Stage is disabled","2003");if(!Ne(this,Mp).permissions.acceptStageRequests)throw this.logger.error("Stage::kick::permission_denied"),new Uo("You do not have permissions for kick","2001");return Ne(this,Lp).kick(e)})}}function Gp(e){switch(e){case ml.UNSPECIFIED:return"OFF_STAGE";case ml.REQUESTED_STAGE:return"REQUESTED_TO_JOIN_STAGE";case ml.APPROVED_STAGE:return"ACCEPTED_TO_JOIN_STAGE";case ml.OFF_STAGE:return"OFF_STAGE";case ml.ON_STAGE:return"ON_STAGE";default:return"OFF_STAGE"}}Lp=new WeakMap,Ip=new WeakMap,Mp=new WeakMap,Dp=new WeakMap,Op=new WeakMap,Np=new WeakMap,Up=new WeakSet,Fp=function(){return Ne(this,Np).getValue("roomNodeClient")},jp=new WeakSet,Bp=function(e){return Be(this,null,function*(){this.status!==e&&Ne(this,Np).setValue("stageStatus",e)})},Hp([Mo.trace("Stage.getStageRequests")],$p.prototype,"getAccessRequests",1),Hp([Mo.trace("Stage.requestAccess")],$p.prototype,"requestAccess",1),Hp([Mo.trace("Stage.cancelRequestAccess")],$p.prototype,"cancelRequestAccess",1),Hp([Mo.trace("Stage.grantAccess")],$p.prototype,"grantAccess",1),Hp([Mo.trace("Stage.denyAccess")],$p.prototype,"denyAccess",1),Hp([Rp.executeWithLock({methodName:"joinStage",lockName:"Stage.join",timeout:5e3}),Mo.trace("Stage.joinStage")],$p.prototype,"join",1),Hp([Mo.trace("Stage.leaveStage")],$p.prototype,"leave",1);var Wp,qp,Kp,Zp,Yp,Jp=Object.defineProperty,Qp=Object.getOwnPropertyDescriptor;class Xp{constructor(e,t,i,r,n){De(this,"stage"),Ue(this,Wp,void 0),Ue(this,qp,void 0),Ue(this,Kp,void 0),Ue(this,Zp,0),Ue(this,Yp,void 0),Fe(this,Yp,e),this.stage=new $p(e,r,n,t,i),Fe(this,Kp,t),Fe(this,Wp,r),Fe(this,qp,n),this.setupEvents()}get telemetry(){return Ne(this,Yp).getValue("telemetry")}get logger(){return Ne(this,Yp).getValue("logger")}setupEvents(){Ne(this,Yp).subscribe("stageStatus",e=>{this.stage.emit("stageStatusUpdate",e)}),Ne(this,Kp).on(Mh.grantStageAccess,()=>{Ne(this,Wp).permissions.stageAccess!==ls.Allowed&&(this.stage.emit("stageRequestApproved"),this.setStageStatus("ACCEPTED_TO_JOIN_STAGE"))}),Ne(this,Kp).on(Mh.peerStageStatusUpdate,e=>{void 0!==e&&(e.peerId===Ne(this,Wp).id?this.selfStageStatusHandler(e):this.peerStageStatusHandler(e))}),Ne(this,Kp).on(Mh.denyStageAccess,()=>{Ne(this,Wp).permissions.stageAccess!==ls.Allowed&&(this.stage.emit("stageRequestRejected"),this.setStageStatus("OFF_STAGE"))}),Ne(this,Kp).on(Mh.getStageRequests,e=>Be(this,null,function*(){var t;if(Ne(this,Wp).permissions.stageAccess!==ls.Allowed)return;const i=null!=(t=null==e?void 0:e.stageRequests)?t:[];yield Ne(this,Yp).getValue("peerSessionStore").emitAsync(Vo.GET_STAGE_REQUESTS,i),Ne(this,Zp)0&&this.stage.emit("newStageRequest",{count:i.length}),Fe(this,Zp,i.length),this.stage.emit("stageAccessRequestUpdate",i)}))}getCurrentStageRequests(){return Ne(this,qp).joined.toArray().filter(e=>"REQUESTED_TO_JOIN_STAGE"===e.stageStatus).map(e=>({displayName:e.name,userId:e.userId,peerId:e.id}))}setStageStatus(e){return Be(this,null,function*(){this.stage.status!==e&&Ne(this,Yp).setValue("stageStatus",e)})}selfStageStatusHandler(e){const t=Gp(e.stageType),i=Ne(this,Yp).getValue("stageStatus");if(i!==t)switch(e.stageType){case 1:Ne(this,Yp).setValue("stageStatus","ACCEPTED_TO_JOIN_STAGE",!1),this.stage.join();break;case 2:case 3:this.setStageStatus(i);break;default:Ne(this,Yp).setValue("stageStatus","ACCEPTED_TO_JOIN_STAGE",!1),this.stage.leave()}}peerStageStatusHandler(e){return Be(this,null,function*(){const t=Ne(this,qp).joined.get(e.peerId),i="ACTIVE_GRID"===Ne(this,qp).viewMode;if(t){switch(e.stageType){case 1:t.setStageStatus("ON_STAGE"),i&&Ne(this,Yp).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:Ne(this,qp).viewMode,page:Ne(this,qp).currentPage});break;case 2:t.setStageStatus("ACCEPTED_TO_JOIN_STAGE");break;case 3:t.setStageStatus("REQUESTED_TO_JOIN_STAGE");break;default:t.setStageStatus("OFF_STAGE"),i&&Ne(this,Yp).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:Ne(this,qp).viewMode,page:Ne(this,qp).currentPage})}Ne(this,Yp).getValue("peerSessionStore").emit(Vo.UPDATE_PEER_STAGE_STATUS,{id:t.id,status:t.stageStatus})}else this.logger.warn("err::peerStageStatusUpdate: participant not found")})}}Wp=new WeakMap,qp=new WeakMap,Kp=new WeakMap,Zp=new WeakMap,Yp=new WeakMap,((e,t,i,r)=>{for(var n,s=r>1?void 0:r?Qp(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&Jp(t,i,s)})([Mo.trace("Stage.setupEvents")],Xp.prototype,"setupEvents",1);var eg=Object.defineProperty,tg=Object.getOwnPropertyDescriptor,ig=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?tg(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&eg(t,i,s),s};const rg=14,ng=15,sg=16,ag=17,og=18,cg=19,lg=20,dg=22,hg=23,ug=24,pg=25,gg=26;var fg,mg,vg,bg,kg,yg,wg,Sg,xg;let Eg=(xg=class extends zo{constructor(e,t,i,r,n,s,a){let{baseURL:o,createdAt:c,description:l,id:d,name:h,organizationId:u,picture:p,private:g,published:f,staggered:m,tags:v,type:b,updatedAt:k}=t;super(e.getValue("logger")),Ue(this,fg,void 0),De(this,"baseURL"),De(this,"createdAt"),De(this,"description"),De(this,"id"),De(this,"name"),Ue(this,mg,void 0),Ue(this,vg,void 0),Ue(this,bg,void 0),De(this,"organizationId"),De(this,"picture"),De(this,"private"),De(this,"published"),De(this,"staggered"),De(this,"tags"),De(this,"type"),De(this,"updatedAt"),Ue(this,kg,void 0),De(this,"config"),Ue(this,yg,void 0),De(this,"active"),De(this,"iframes"),De(this,"enabledBy"),Ue(this,wg,void 0),Ue(this,Sg,void 0),Fe(this,wg,e),this.baseURL=o,this.createdAt=new Date(c),this.description=l,this.id=d,this.name=h,Fe(this,mg,r),this.organizationId=u,this.picture=p,this.private=g,this.published=f,this.staggered=m,this.tags=v,this.type=b,this.updatedAt=new Date(k),this.active=!1,this.iframes=new Map,Fe(this,fg,i),Fe(this,vg,n),Fe(this,bg,s),this.enabledBy="",Fe(this,Sg,a)}get telemetry(){return Ne(this,wg).getValue("telemetry")}sendIframeEvent(e){this.iframes.size&&this.iframes.forEach(t=>{const{iframe:i}=t;i&&(navigator.isReactNative?i.postMessage(JSON.stringify(e)):i.contentWindow.postMessage(e,"*"))})}handleIframeMessage(e){return Be(this,null,function*(){var t;if(!this.active)return;const i=e,{payload:r,uuid:n,type:s}=i;switch(s){case Oh.customPluginEventToRoom:Ne(this,fg).customPluginEventToRoom(this.id,r,n);break;case Oh.customPluginEventToPeers:Ne(this,fg).customPluginEventToPeers(this.id,r.peerIds,r,n);break;case Oh.enablePluginForRoom:Ne(this,fg).enablePluginForRoom(this.id,n);break;case Oh.enablePluginForPeers:Ne(this,fg).enablePluginForPeers(this.id,r.peerIds,n);break;case Oh.disablePluginForRoom:Ne(this,fg).disablePluginForRoom(this.id,n);break;case Oh.disablePluginForPeers:Ne(this,fg).disablePluginForPeers(this.id,r.peerIds,n);break;case Oh.storeInsertKeys:Ne(this,fg).storeInsertKeys(this.id,r.store,r.insertKeys,n);break;case Oh.storeGetKeys:Ne(this,fg).storeGetKeys(this.id,r.store,r.getKeys,n);break;case Oh.storeDeleteKeys:Ne(this,fg).storeDeleteKeys(this.id,r.store,r.deleteKeys,n);break;case Oh.storeDelete:Ne(this,fg).storeDelete(this.id,r.store,n);break;case sg:{const{messagePayload:e,peerIds:t}=r;if(!Ne(this,bg))return void this.sendIframeEvent({type:sg,uuid:i.uuid,payload:{error:"Chat is disabled for this room."}});try{yield Ne(this,bg).sendMessage(e,t),this.sendIframeEvent({type:sg,uuid:i.uuid,payload:{success:!0}})}catch(a){this.sendIframeEvent({type:sg,uuid:i.uuid,payload:{error:a}})}break}case rg:{let e;const{peerId:n}=r,s=Ie(Le({},Ne(this,mg)),{id:Ne(this,mg).id,isRecorder:null==(t=Ne(this,mg).permissions)?void 0:t.isRecorder,isHidden:Ne(this,mg).permissions.hiddenParticipant,stageStatus:Ne(this,mg).stageStatus});n?(e=Ne(this,vg).joined.get(r.peerId),Ne(this,mg).id===n&&(e=s)):e=s,this.sendIframeEvent({type:rg,payload:{peer:e&&nu(e)},uuid:i.uuid});break}case ng:{const e=Ne(this,vg).joined.toArray().map(e=>nu(e));this.sendIframeEvent({type:ng,payload:{peers:e},uuid:i.uuid});break}case cg:this.sendIframeEvent({type:cg,payload:{enabledBy:this.enabledBy},uuid:i.uuid});break;case og:this.sendIframeEvent({type:og,payload:{displayTitle:Ne(this,Sg)},uuid:i.uuid});break;case ag:this.sendIframeEvent({type:ag,payload:{roomName:Ne(this,wg).getValue("meetingId")},uuid:i.uuid});break;case lg:this.emit(i.payload.eventName,i.payload.data)}})}sendData(e){this.active&&(this.logger.info("Plugin::SendData",{plugin:{id:this.id,name:this.name,data:{eventName:e.eventName}}}),this.sendIframeEvent({type:ug,uuid:"",payload:e}))}removePluginView(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";var t;const{iframe:i,listener:r}=null!=(t=this.iframes.get(e))?t:{};(i||r)&&(navigator.isReactNative?i.props.onMessage=void 0:window.removeEventListener("message",r),this.iframes.delete(e))}addPluginView(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";var i;if(!Ne(this,yg))throw this.logger.error("Plugin::addPluginView::no_auth_token_set_for_plugin"),new Uo("No auth token set for plugin.","0602");if(!e)throw this.logger.error("Plugin::addPluginView::iframe_was_not_provided"),new Uo("Iframe was not provided.","0603");this.removePluginView(t);const r=e,n=new URL(this.baseURL),s={auth:Ne(this,yg),parent:navigator.isReactNative?this.baseURL:window.location.origin,backend:Ne(this,wg).getValue("apiBase"),pluginId:this.id,roomName:null!=(i=Ne(this,wg).getValue("meetingId"))?i:"",displayTitle:Ne(this,Sg)};if(Object.keys(s).forEach(e=>{n.searchParams.set(e,s[e])}),r.src=n.href,r.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",r.title=t,navigator.isReactNative)r.props.onMessage=e=>{this.handleIframeMessage(JSON.parse(e.nativeEvent.data))},this.iframes.set(t,{iframe:r});else{const i=t=>Be(this,null,function*(){t.source===e.contentWindow&&(yield this.handleIframeMessage(t.data))});window.addEventListener("message",i),this.iframes.set(t,{iframe:r,listener:i})}}setActive(e){var t,i;this.active=e,e?this.emit("stateUpdate",{active:this.active,pluginId:this.id,bind:this.addPluginView.bind(this),views:null==(t=this.config)?void 0:t.views}):(this.active=!1,this.emit("stateUpdate",{active:this.active,pluginId:this.id,views:null==(i=this.config)?void 0:i.views}))}activateForSelf(){return Be(this,null,function*(){const e=fu(),t=yield e.authorizePlugin(this.id);Fe(this,yg,t),Fe(this,kg,new Date);try{const t=yield e.getPluginConfig(this.baseURL);this.config=t}catch(i){this.logger.error("Plugin::activateForSelf",{error:i})}this.setActive(!0),this.emit("enabled")})}deactivateForSelf(){Array.from(this.iframes.keys()).forEach(e=>{this.removePluginView(e)}),Fe(this,kg,void 0),this.iframes.clear(),this.setActive(!1),this.emit("closed")}enable(){return Be(this,null,function*(){return this.activateForSelf()})}disable(){return this.deactivateForSelf()}activate(){return Be(this,null,function*(){var e,t;this.active||null!=(t=null==(e=Ne(this,mg).permissions)?void 0:e.plugins)&&t.canStart&&(Ne(this,fg).addPlugin(this.id,this.staggered),Fe(this,kg,new Date),this.logger.info("plugin::activated",{plugin:{id:this.id,enabledBy:this.enabledBy,name:this.name}}))})}deactivate(){return Be(this,null,function*(){var e,t;this.active&&((null==(t=null==(e=Ne(this,mg).permissions)?void 0:e.plugins)||!t.canClose)&&this.enabledBy!==Ne(this,mg).id||(Ne(this,fg).removePlugin(this.id),this.logger.info("plugin::deactivated",{plugin:{id:this.id,name:this.name,duration:Ne(this,kg)?(new Date).getTime()-Ne(this,kg).getTime():0}}),Fe(this,kg,void 0)))})}},fg=new WeakMap,mg=new WeakMap,vg=new WeakMap,bg=new WeakMap,kg=new WeakMap,yg=new WeakMap,wg=new WeakMap,Sg=new WeakMap,xg);var Tg,_g;ig([vu({maxInvocations:5,period:1})],Eg.prototype,"sendData",1),ig([Mo.trace("Plugin.activatePlugin")],Eg.prototype,"activate",1),ig([Mo.trace("Plugin.deactivatePlugin")],Eg.prototype,"deactivate",1),Eg=ig([Bo("0600")],Eg);class Pg extends Map{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const{onAddEvent:i,onDeleteEvent:r,onClearEvent:n}=e;super(),Ue(this,Tg,void 0),Ue(this,_g,void 0),De(this,"onAddEvent"),De(this,"onDeleteEvent"),De(this,"onClearEvent"),Fe(this,Tg,new zo(t)),this.onAddEvent=i,this.onDeleteEvent=r,this.onClearEvent=n,Fe(this,_g,new Map)}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1])||arguments[1];return this.set(e.id,e,t)}set(e,t){var i=this;let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=super.set(e,t),s=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.get(e);if(!r)return!1;r.removeListener("*",Ne(this,_g).get(e));const n=super.delete(e);return i&&r.removeAllListeners(),t&&Ne(this,Tg).emit(this.onDeleteEvent,r),n}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.forEach(e=>{e.removeListener("*",Ne(this,_g).get(e.id)),t&&e.removeAllListeners()});const i=super.clear();return e&&Ne(this,Tg).emit(this.onClearEvent),i}toArray(){return Array.from(this.values())}}Tg=new WeakMap,_g=new WeakMap;class Cg extends Pg{constructor(e){super({onAddEvent:"pluginAdded",onDeleteEvent:"pluginDeleted"},e)}add(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return super.add(e,t)}delete(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return super.delete(e,t,i)}}var Ag=Object.defineProperty,Rg=Object.getOwnPropertyDescriptor;let Lg=class{constructor(e){De(this,"all"),De(this,"active"),this.all=new Cg(e),this.active=new Cg(e)}};Lg=((e,t,i,r)=>{for(var n,s=r>1?void 0:r?Rg(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Ag(t,i,s),s})([Bo("0600")],Lg);var Ig,Mg,Dg,Og,Ng=Object.defineProperty,Ug=Object.getOwnPropertyDescriptor,Fg=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Ug(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Ng(t,i,s),s};const jg=(Og=class{constructor(e,t,i,r){De(this,"plugins"),Ue(this,Ig,void 0),Ue(this,Mg,void 0),Ue(this,Dg,void 0),Fe(this,Ig,t),Fe(this,Mg,i),Fe(this,Dg,e),this.plugins=r,this.setupEvents()}get telemetry(){return Ne(this,Dg).getValue("telemetry")}get logger(){return Ne(this,Dg).getValue("logger")}static init(e,t,i,r,n,s,a,o){return Be(this,null,function*(){const c=e.getValue("logger"),l=new Lg(c);return t.forEach(t=>{const r=new Eg(e,t,i,s,a,n,o);l.all.add(r)}),new jg(e,i,r,l)})}getRoomPlugins(){return Be(this,null,function*(){var e;const{plugins:t}=yield Ne(this,Ig).getActivePlugins();null==(e=this.plugins.active)||e.toArray().forEach(e=>{this.disablePlugin({id:e.id})}),yield Promise.all(t.map(e=>this.enablePlugin({id:e.pluginId,enabledBy:e.enabledBy})))})}enablePlugin(e){return Be(this,arguments,function(e){var t=this;let{id:i,enabledBy:r}=e;return function*(){const e=t.plugins.all.get(i);e&&(yield e.activateForSelf(),e.enabledBy=r)}()})}disablePlugin(e){return Be(this,arguments,function(e){var t=this;let{id:i}=e;return function*(){const e=t.plugins.all.get(i);e&&e.deactivateForSelf()}()})}sendIframeEvent(e,t,i,r){const n=this.plugins.all.get(t);n&&n.sendIframeEvent({type:e,uuid:i,payload:r})}broadcastIframeEvent(e,t){this.plugins.active.forEach(i=>{this.sendIframeEvent(e,i.id,"",t)})}setupEvents(){this.plugins.all.on("stateUpdate",e=>{let{active:t,id:i}=e;t?this.plugins.active.add(this.plugins.all.get(i)):this.plugins.active.delete(i)}),Ne(this,Dg).getValue("peerSessionStore").onAsync(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>Be(this,null,function*(){yield this.getRoomPlugins(),this.logger.debug("[SOCKET_SERVICE_ROOM_JOINED] resolved request to fetch plugins.")})),Ne(this,Ig).on(Oh.addPlugin,e=>Be(this,null,function*(){var t;const i=e.pluginId;null!=(t=this.plugins.all.get(i))&&t.active||(yield this.enablePlugin({id:i,enabledBy:e.enabledBy}))})),Ne(this,Ig).on(Oh.removePlugin,e=>Be(this,null,function*(){var t;const i=e.pluginId;null!=(t=this.plugins.all.get(i))&&t.active&&(yield this.disablePlugin({id:i}))})),[Oh.enablePluginForPeers,Oh.enablePluginForRoom].forEach(e=>{Ne(this,Ig).on(e,(t,i)=>Be(this,null,function*(){this.sendIframeEvent(e,t.pluginId,i,{enabledBy:t.enabledBy})}))}),[Oh.disablePluginForPeers,Oh.disablePluginForRoom].forEach(e=>{Ne(this,Ig).on(e,(t,i)=>Be(this,null,function*(){this.sendIframeEvent(e,t.pluginId,i,{disabledBy:t.disabledBy})}))}),[Oh.customPluginEventToPeers,Oh.customPluginEventToRoom].forEach(e=>{Ne(this,Ig).on(e,(t,i)=>Be(this,null,function*(){this.sendIframeEvent(e,t.pluginId,i,{data:JSON.parse((new TextDecoder).decode(t.pluginData))})}))}),[Oh.storeInsertKeys,Oh.storeGetKeys,Oh.storeDeleteKeys].forEach(e=>{Ne(this,Ig).on(e,(t,i)=>Be(this,null,function*(){var r;const n=null==(r=t.storeItems)?void 0:r.map(e=>{var t;return{timestamp:e.timestamp,peerId:e.peerId,payload:JSON.parse(null!=(t=e.payload)&&t.length?(new TextDecoder).decode(e.payload):"{}"),key:e.storeKey}});this.sendIframeEvent(e,t.pluginId,i,{storeName:t.storeName,storeItems:n})}))}),Ne(this,Ig).on(Oh.storeDelete,(e,t)=>Be(this,null,function*(){this.sendIframeEvent(Oh.storeDelete,e.pluginId,t,{storeName:e.storeName})})),Ne(this,Mg).on(Dh.sendMessageToPeers,e=>{const t=null==ju?void 0:ju.formatSocketPeerMessage(e.message);this.broadcastIframeEvent(sg,{message:t})}),Ne(this,Mg).on(Dh.sendMessageToRoom,e=>{const t=null==ju?void 0:ju.formatSocketPeerMessage(e.message);this.broadcastIframeEvent(sg,{message:t})}),Ne(this,Dg).getValue("peerSessionStore").on(Vo.PEER_JOINED_INTERNAL,e=>{const t=nu(e);this.broadcastIframeEvent(dg,t)}),Ne(this,Dg).getValue("peerSessionStore").on(Vo.PEER_CLOSED,e=>{this.broadcastIframeEvent(hg,e)}),Ne(this,Dg).getValue("peerSessionStore").on(Vo.UPDATE_PEER_STAGE_STATUS,e=>{this.broadcastIframeEvent(gg,e)}),Ne(this,Dg).subscribe("stageStatus",e=>{this.broadcastIframeEvent(pg,e)})}},Ig=new WeakMap,Mg=new WeakMap,Dg=new WeakMap,Og);let Bg=jg;var Vg;Fg([Mo.trace("PluginController.getRoomPlugins")],Bg.prototype,"getRoomPlugins",1),Fg([Mo.trace("PluginController.enableForSelf")],Bg.prototype,"enablePlugin",1),Fg([Mo.trace("PluginController.disableForSelf")],Bg.prototype,"disablePlugin",1),Fg([Mo.trace("PluginController.setupEvents")],Bg.prototype,"setupEvents",1);class zg{constructor(e){De(this,"mediaJoined"),De(this,"socketJoined"),De(this,"socketJoinAttempted"),De(this,"mediaJoinAttempted"),De(this,"socketState"),De(this,"mediaState"),Ue(this,Vg,void 0),this.mediaJoined=!1,this.socketJoined=!1,this.socketJoinAttempted=!1,this.mediaJoinAttempted=!1,this.socketState={state:void 0,reconnected:!1,reconnectionAttempt:void 0},this.mediaState={recv:void 0,send:void 0},Fe(this,Vg,e)}get joinAttempted(){return this.mediaJoinAttempted||this.socketJoinAttempted}get roomJoined(){return this.mediaJoined&&this.socketJoined}updateSocketConnectionState(e,t){let i;const{reconnected:r}=this.socketState;switch(e){case"connected":i={state:"connected",reconnected:r,reconnectionAttempt:void 0};break;case"disconnected":i={state:"disconnected",reconnected:!1,reconnectionAttempt:0},this.socketJoined=!1;break;case"reconnected":i={state:"connected",reconnected:!0,reconnectionAttempt:void 0};break;case"reconnecting":i={state:"reconnecting",reconnected:r,reconnectionAttempt:0};break;case"reconnectAttempt":i={state:"reconnecting",reconnected:r,reconnectionAttempt:t};break;case"failed":i={state:"failed",reconnected:r,reconnectionAttempt:void 0},this.socketJoined=!1}i&&(Ne(this,Vg).getValue("peerSessionStore").emit(Vo.SOCKET_STATE_UPDATE,i),this.socketState=i)}}Vg=new WeakMap;var Hg,$g,Gg,Wg,qg,Kg=Object.defineProperty,Zg=Object.getOwnPropertyDescriptor,Yg=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Zg(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Kg(t,i,s),s};let Jg=(qg=class extends Ho{constructor(e,t){super(e.getValue("logger")),Ue(this,Gg),Ue(this,Hg,void 0),Ue(this,$g,void 0),De(this,"recordingPeerIds",[]),De(this,"recordings",[]),Fe(this,$g,e),Fe(this,Hg,t)}get recordingState(){return this.recordings.some(e=>"RECORDING"===e.state)?"RECORDING":this.recordings.some(e=>"PAUSED"===e.state)?"PAUSED":this.recordings.some(e=>"STARTING"===e.state)?"STARTING":this.recordings.some(e=>"STOPPING"===e.state)?"STOPPING":"IDLE"}get telemetry(){return Ne(this,$g).getValue("telemetry")}updateRecordings(e){this.recordings=e,this.emit("recordingUpdate",this.recordingState)}start(e){return Be(this,null,function*(){if(!Ne(this,Hg).permissions.canRecord)throw this.logger.error("Recording::start::permission_denied"),new Uo("User does not have permission to start recording","1001");if(!0!==(null==e?void 0:e.allowMultiple)&&("STARTING"===this.recordingState||"RECORDING"===this.recordingState||"STOPPING"===this.recordingState))throw this.logger.error("Recording::start::recording_in_progress",{recording:{state:this.recordingState}}),new Uo("Cant start recording, recordingState irregular: ".concat(this.recordingState),"1005");try{const t=fu(),{recording:i={}}=Ne(this,$g).getValue("defaults"),r=yield t.startRecording(i,null==e?void 0:e.allowMultiple);this.updateRecordings([...this.recordings,{id:r,state:"STARTING",type:"BROWSER"}])}catch(t){throw this.logger.error("Recording::stop::recording_failed_to_start",{error:t}),new Uo("Error while starting recording","1000",this.logger)}})}stop(e){return Be(this,null,function*(){yield je(this,Gg,Wg).call(this,"stop",["RECORDING","PAUSED"],e)})}pause(e){return Be(this,null,function*(){yield je(this,Gg,Wg).call(this,"pause",["RECORDING"],e)})}resume(e){return Be(this,null,function*(){yield je(this,Gg,Wg).call(this,"resume",["PAUSED"],e)})}},Hg=new WeakMap,$g=new WeakMap,Gg=new WeakSet,Wg=function(e,t,i){return Be(this,null,function*(){if(!Ne(this,Hg).permissions.canRecord)throw this.logger.error("Recording::stop::permission_denied"),new Uo("User does not have permission to stop recording","1001");let r=[];if(void 0!==i){const e=this.recordings.find(e=>e.id===i);if(void 0===e)throw new Uo("Could not find the specified recording","1004");if(t.includes(e.state))return void this.logger.error("Recording::stop::recording_not_in_expected_state",{recording:{state:e.state}});r.push(e)}else r=this.recordings.filter(e=>t.includes(e.state));r.forEach(t=>Be(this,null,function*(){const i=t.state;"stop"===e&&(t.state="STOPPING",this.emit("recordingUpdate","STOPPING"));try{yield fu().updateRecording(t.id,e)}catch(r){throw this.logger.error("Recording::stop::recording_failed_to_stop",{error:r}),t.state!==i&&(t.state=i,this.emit("recordingUpdate",i)),new Uo("Error while stopping recording","1000",this.logger)}}))})},qg);Yg([Mo.trace("Recording.start")],Jg.prototype,"start",1),Yg([Mo.trace("Recording.stop")],Jg.prototype,"stop",1),Yg([Mo.trace("Recording.stop")],Jg.prototype,"pause",1),Yg([Mo.trace("Recording.stop")],Jg.prototype,"resume",1),Jg=Yg([Bo("1000")],Jg);var Qg,Xg,ef=Object.defineProperty,tf=Object.getOwnPropertyDescriptor;class rf{constructor(e,t,i){De(this,"recording"),De(this,"room"),Ue(this,Qg,void 0),Fe(this,Qg,e),this.recording=new Jg(e,t),this.room=i,this.setupEvents()}get telemetry(){return Ne(this,Qg).getValue("telemetry")}get logger(){return Ne(this,Qg).getValue("logger")}getRecordingTypeFromProtoType(e){let t;switch(e){case fl.BROWSER:t="BROWSER";break;case fl.COMPOSITE:t="COMPOSITE";break;case fl.TRACK:t="TRACK";break;default:t="BROWSER"}return t}setupEvents(){Ne(this,Qg).getValue("peerSessionStore").on(Vo.ROOM_STATE,e=>{0!==e.activeRecordings.length?this.recording.updateRecordings(e.activeRecordings.map(e=>{const t=this.getRecordingTypeFromProtoType(e.recordingType);return{id:e.recordingId,state:e.recordingStatus,type:t}})):this.recording.recordings.length&&this.recording.updateRecordings([])}),this.room.on(Mh.recordingStarted,e=>{let t=!1;const i=[...this.recording.recordings];if(i.forEach(i=>{i.id===e.recordingId&&(t=!0,i.state="RECORDING")}),!1===t){const t=this.getRecordingTypeFromProtoType(e.recordingType);i.push({id:e.recordingId,state:"RECORDING",type:t})}this.recording.updateRecordings(i)}),this.room.on(Mh.recordingPaused,e=>{const t=[...this.recording.recordings];t.forEach(t=>{t.id===e.recordingId&&(t.state="PAUSED")}),this.recording.updateRecordings(t)}),this.room.on(Mh.recordingStopped,e=>{const t=[...this.recording.recordings.filter(t=>t.id!==e.recordingId)];this.recording.updateRecordings(t)})}}Qg=new WeakMap,((e,t,i,r)=>{for(var n,s=r>1?void 0:r?tf(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&ef(t,i,s)})([Mo.trace("RecordingController.setupEvents")],rf.prototype,"setupEvents",1);class nf{constructor(e){Ue(this,Xg,void 0),Fe(this,Xg,e)}hasFeature(e){var t;return null!=(t=Ne(this,Xg).getValue("flagsmith").hasFeature(e))&&t}getFeatureValue(e){return Ne(this,Xg).getValue("flagsmith").getValue(e)}getAllFeatures(){return Ne(this,Xg).getValue("flagsmith").getAllFlags()}}Xg=new WeakMap;class sf{constructor(e,t,i){De(this,"logger"),De(this,"features"),De(this,"browserSpecs"),De(this,"callStats"),this.logger=e,this.features=t,this.browserSpecs=it,this.callStats=i}static init(e){return new sf(e.getValue("logger"),new nf(e),e.getValue("callstats"))}}class af{constructor(e){De(this,"internals"),this.internals=e}static init(e){return Be(this,null,function*(){const t=sf.init(e);return new af(t)})}}var of,cf,lf,df,hf,uf,pf,gf=Object.defineProperty,ff=Object.getOwnPropertyDescriptor,mf=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?ff(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&gf(t,i,s),s};class vf extends zo{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yf,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];super(e.getValue("logger")),Ue(this,of,void 0),Ue(this,cf,void 0),Ue(this,lf,void 0),Ue(this,df,void 0),Ue(this,hf,void 0),Ue(this,uf,void 0),Ue(this,pf,void 0),De(this,"audioUpdateInProgress"),De(this,"videoUpdateInProgress"),Fe(this,pf,e),this.audioUpdateInProgress=!1,this.videoUpdateInProgress=!1,Fe(this,of,new Vf(e,t)),Fe(this,cf,new sm(e,Ne(this,of),void 0,i)),Fe(this,lf,new mm(e,Ne(this,of),void 0,i)),Fe(this,hf,new lm(Ne(this,pf),Ne(this,of))),Fe(this,df,new om(e,Ne(this,of))),Fe(this,uf,r),Ne(this,cf).on("trackMuted",this.onAudioTrackMuted.bind(this)),Ne(this,cf).on("trackChanged",this.onAudioTrackChanged.bind(this)),Ne(this,lf).on("trackChanged",this.onVideoTrackChanged.bind(this)),Ne(this,lf).on("trackEnded",this.onVideoTrackEnded.bind(this)),Ne(this,hf).on("trackEnded",this.onScreenShareEnded.bind(this)),this.onVisibilityChange=this.onVisibilityChange.bind(this),document.addEventListener("visibilitychange",this.onVisibilityChange)}get telemetry(){return Ne(this,pf).getValue("telemetry")}set context(e){Fe(this,pf,e)}onVisibilityChange(){return Be(this,null,function*(){Ne(this,pf).getValue("callstats").tabChanged("visible"===document.visibilityState),"visible"!==document.visibilityState?Ne(this,pf).getValue("callstats").browserBackgrounded():(Ne(this,pf).getValue("callstats").browserForegrounded(),yield this.setupSpeaker())})}repopulateAvailableDevices(){return Be(this,null,function*(){return!0})}setupStreams(e){return Be(this,arguments,function(e){var t=this;let{audio:i,video:r}=e;return function*(){var e;let n,s;if(i?Ne(t,pf).getValue("callstats").audioOn():Ne(t,pf).getValue("callstats").audioOff(),r?Ne(t,pf).getValue("callstats").videoOn():Ne(t,pf).getValue("callstats").videoOff(),i&&r)try{const e=yield Ne(t,of).getAudioAndVideoTrack(Ne(t,cf).userSelectedDevice,Ne(t,lf).userSelectedDevice);n=e.audioTrack,s=e.videoTrack}catch(a){t.logger.error("LocalMediaHandler::init::Failed to get audio video tracks",{error:a})}if(!n&&i)try{n=yield Ne(t,of).getAudioTrack(!1,Ne(t,cf).userSelectedDevice)}catch(a){t.logger.error("LocalMediaHandler::init::Failed to get audio track",{error:a})}if(!s&&r)try{s=yield Ne(t,of).getVideoTrack(Ne(t,lf).userSelectedDevice)}catch(a){t.logger.error("LocalMediaHandler::init::Failed to get video track",{error:a})}i&&!n&&Ne(t,pf).getValue("callstats").audioOff(),r&&!s&&Ne(t,pf).getValue("callstats").videoOff(),yield Ne(t,cf).setMediaTrack(n),yield Ne(t,lf).setMediaTrack(s);try{yield t.setupSpeaker()}catch(a){}if(s){const e=yield t.getDeviceById(s.getSettings().deviceId);Ne(t,pf).getValue("callstats").selectedDevice("VIDEO",e)}if(n){const e=yield t.getDeviceById(n.getSettings().deviceId);Ne(t,pf).getValue("callstats").selectedDevice("AUDIO",e)}null!=(e=Ne(t,df).currentDevice)&&e.deviceId&&Ne(t,pf).getValue("callstats").selectedDevice("SPEAKER",Ne(t,df).currentDevice),Ne(t,of).onDeviceChange((e,i,r)=>{t.onDeviceChange(i,r)})}()})}getCurrentDevices(){return{audio:Ne(this,cf).currentDevice,video:Ne(this,lf).currentDevice,speaker:Ne(this,df).currentDevice}}get permissions(){return Ne(this,of).permissions}getAllDevices(){return Ne(this,of).getAvailableDevices()}getDeviceById(e,t){return Ne(this,of).getDevice(e)}onAudioTrackMuted(){this.emit("AUDIO_TRACK_SILENT")}onAudioTrackChanged(){this.emit("AUDIO_TRACK_CHANGE")}get rawAudioTrack(){return Ne(this,cf).mediaTrack}get audioTrack(){return Ne(this,cf).transformedMediaTrack}get audioEnabled(){return Ne(this,cf).trackEnabled}enableAudio(e){return Be(this,null,function*(){if(!this.audioUpdateInProgress){this.audioUpdateInProgress=!0;try{e?yield Ne(this,cf).enableTrack(!1,e):yield Ne(this,cf).unmuteTrack()}catch(t){}finally{this.audioUpdateInProgress=!1}}})}disableAudio(){Ne(this,cf).mediaTrack&&!Ne(this,cf).isCustomTrack?Ne(this,cf).muteTrack():Ne(this,cf).disableTrack()}getAudioDevices(e){return Ne(this,of).getAudioInputDevices(e)}setAudioDevice(e,t){return Be(this,arguments,function(e,t){var i=this;let{saveDevicePreference:r}=t;return function*(){yield Ne(i,cf).setDevice(e,{saveDevicePreference:r}),null!=e&&e.deviceId&&Ne(i,pf).getValue("callstats").selectedDevice("AUDIO",e),i.emit("AUDIO_TRACK_CHANGE"),i.emit("DEVICE_CHANGE",{device:e})}()})}setupSpeaker(){return Be(this,null,function*(){const{speaker:e}=this.getCurrentDevices();yield Ne(this,df).setPreferredSpeaker();const{speaker:t}=this.getCurrentDevices();(null==e?void 0:e.deviceId)!==(null==t?void 0:t.deviceId)&&t&&this.emit("DEVICE_CHANGE",{device:t})})}setSpeakerDevice(e,t){return Be(this,arguments,function(e,t){var i=this;let{saveDevicePreference:r}=t;return function*(){yield Ne(i,df).setupSpeaker(e,{saveDevicePreference:r}),null!=e&&e.deviceId&&Ne(i,pf).getValue("callstats").selectedDevice("SPEAKER",e),i.emit("DEVICE_CHANGE",{device:e})}()})}onVideoTrackChanged(){this.emit("VIDEO_TRACK_CHANGE")}onVideoTrackEnded(){this.emit("VIDEO_TRACK_CHANGE")}get rawVideoTrack(){return Ne(this,lf).mediaTrack}get videoTrack(){return Ne(this,lf).transformedMediaTrack}get videoEnabled(){return Ne(this,lf).trackEnabled}enableVideo(e){return Be(this,null,function*(){if(!this.videoUpdateInProgress){this.videoUpdateInProgress=!0;try{e?yield Ne(this,lf).enableTrack(!1,e):yield Ne(this,lf).unmuteTrack()}catch(t){}finally{this.videoUpdateInProgress=!1}}})}disableVideo(){Ne(this,lf).disableTrack()}getVideoDevices(e){return Ne(this,of).getVideoInputDevices(e)}setVideoDevice(e,t){return Be(this,arguments,function(e,t){var i=this;let{saveDevicePreference:r}=t;return function*(){yield Ne(i,lf).setDevice(e,{saveDevicePreference:r}),null!=e&&e.deviceId&&Ne(i,pf).getValue("callstats").selectedDevice("VIDEO",e),i.emit("VIDEO_TRACK_CHANGE"),i.emit("DEVICE_CHANGE",{device:e})}()})}updateVideoConstraints(e){return Be(this,null,function*(){yield Ne(this,lf).updateConstraints(e)})}onScreenShareEnded(){this.emit("SCREENSHARE_ENDED")}get screenShareTracks(){return{audio:Ne(this,hf).audioMediaTrack,video:Ne(this,hf).videoMediaTrack}}get screenShareEnabled(){return Ne(this,hf).trackEnabled}enableScreenShare(){return Be(this,null,function*(){yield Ne(this,hf).enableScreenShare()})}disableScreenShare(){return Be(this,null,function*(){Ne(this,hf).disableScreenShare()})}updateScreenshareConstraints(e){return Be(this,null,function*(){yield Ne(this,hf).updateConstraints(e)})}getSpeakerDevices(e){return Ne(this,of).getAudioOutputDevices(e)}addAudioMiddleware(e){return Ne(this,cf).addMiddleware(e)}removeAudioMiddleware(e){return Ne(this,cf).removeMiddleware(e)}removeAllAudioMiddlewares(){return Ne(this,cf).removeAllMiddlewares()}addVideoMiddleware(e){return Ne(this,lf).addMiddleware(e)}removeVideoMiddleware(e){return Ne(this,lf).removeMiddleware(e)}removeAllVideoMiddlewares(){return Ne(this,lf).removeAllMiddlewares()}setVideoMiddlewareGlobalConfig(e){return Ne(this,lf).setVideoMiddlewareGlobalConfig(e)}destruct(){Ne(this,cf).disableTrack(),Ne(this,lf).disableTrack(),Ne(this,lf).terminateMiddlewareWebWorker(),Ne(this,hf).disableScreenShare(),Ne(this,of).destruct()}onDeviceChange(e,t){return Be(this,null,function*(){var i,r;if(this.emit("DEVICE_LIST_UPDATED",e),t||!Ne(this,uf))return;let n=!1;null==(i=null==e?void 0:e.added)||i.reverse().forEach(e=>Be(this,null,function*(){var t;e&&!yf(e)&&("audioinput"===e.kind&&!0===(null==(t=this.audioTrack)?void 0:t.enabled)?yield this.setAudioDevice(e,{saveDevicePreference:!1}):"audiooutput"===e.kind&&(n=!0,yield this.setSpeakerDevice(e,{saveDevicePreference:!1})))})),n||null==(r=null==e?void 0:e.removed)||r.forEach(e=>Be(this,null,function*(){var t;if("audiooutput"===e.kind&&(null==(t=this.getCurrentDevices().speaker)?void 0:t.deviceId)===e.deviceId){const e=yield this.getSpeakerDevices();(null==e?void 0:e.length)>0&&(yield this.setSpeakerDevice(e[0],{saveDevicePreference:!1}))}}))})}removeAllTracks(){this.destruct()}removeAudioTrack(){Ne(this,cf).disableTrack()}removeVideoTrack(){Ne(this,lf).disableTrack(),Ne(this,lf).terminateMiddlewareWebWorker()}removeDocumentEventListeners(){return Be(this,null,function*(){document.removeEventListener("visibilitychange",this.onVisibilityChange)})}}function bf(e,t,i){switch(!0){case it.isChromiumBased():return"NotAllowedError"===t?i.includes("by system")?"SYSTEM_DENIED":"screenshare"===e?"CANCELED":"DENIED":"COULD_NOT_START";case it.isSafari():return"NotAllowedError"===t?"DENIED":"COULD_NOT_START";case it.isFirefox():switch(t){case"NotFoundError":case"NotReadableError":return"SYSTEM_DENIED";case"NotAllowedError":return"DENIED";default:return"COULD_NOT_START"}default:return"COULD_NOT_START"}}of=new WeakMap,cf=new WeakMap,lf=new WeakMap,df=new WeakMap,hf=new WeakMap,uf=new WeakMap,pf=new WeakMap,mf([Mo.trace("MediaHandler.setupStreams")],vf.prototype,"setupStreams",1),mf([Mo.trace("MediaHandler.enableAudio")],vf.prototype,"enableAudio",1),mf([Mo.trace("MediaHandler.disableAudio")],vf.prototype,"disableAudio",1),mf([Mo.trace("MediaHandler.setAudioDevice")],vf.prototype,"setAudioDevice",1),mf([Mo.trace("MediaHandler.enableVideo")],vf.prototype,"enableVideo",1),mf([Mo.trace("MediaHandler.disableVideo")],vf.prototype,"disableVideo",1),mf([Mo.trace("MediaHandler.setVideoDevice")],vf.prototype,"setVideoDevice",1),mf([Mo.trace("MediaHandler.updateVideoConstraints")],vf.prototype,"updateVideoConstraints",1),mf([Mo.trace("MediaHandler.enableScreenShare")],vf.prototype,"enableScreenShare",1),mf([Mo.trace("MediaHandler.disableScreenShare")],vf.prototype,"disableScreenShare",1),mf([Mo.trace("MediaHandler.updateScreenshareConstraints")],vf.prototype,"updateScreenshareConstraints",1),mf([Mo.trace("MediaHandler.destruct")],vf.prototype,"destruct",1),mf([Mo.trace("MediaHandler.onDeviceChange")],vf.prototype,"onDeviceChange",1);const kf=["virtual","emulator","krisp","solstice conference","teams","loom","zoom","manycam","blackhole","displayport","xsplit","wirecast","vMix","elgato","epiphan","voice changer","voicemod","morphvoxx"];function yf(e){var t,i;const r=null==(t=e.label)?void 0:t.toLowerCase();return!("macOS"!==(null==(i=it._bowser)?void 0:i.getOSName())||!r.includes("iphone"))||kf.some(e=>null==r?void 0:r.includes(e))}var wf,Sf;class xf{constructor(e){Ue(this,wf,void 0),Ue(this,Sf,void 0),Fe(this,Sf,e)}get logger(){return Ne(this,Sf).getValue("logger")}terminateMiddlewareWebWorker(){if(Ne(this,wf))try{me(Ne(this,wf)),Fe(this,wf,void 0)}catch(e){this.logger.debug("WorkerTimers::terminateMiddlewareWebWorker::failed")}}getTransformedVideoTrack(e,t,i){return Be(this,null,function*(){if(null==e||!e.length)return t;const r=document.createElement("canvas"),s=yield Promise.all(null==e?void 0:e.map(e=>e({canvas:r,WorkerTimers:n})));if(i.disablePerFrameCanvasRendering){const e=r.captureStream().getVideoTracks()[0];return Object.defineProperty(e,"originalSettings",{value:t.getSettings()}),e}const a=document.createElement("video"),o=new MediaStream;o.addTrack(t);const c=r.getContext("2d");a.srcObject=o,a.autoplay=!0,this.terminateMiddlewareWebWorker();const l=()=>Be(this,null,function*(){if(!1===t.enabled||"ended"===t.readyState)return this.terminateMiddlewareWebWorker(),a.remove(),void r.remove();try{c.drawImage(a,0,0);for(let e=0;e{r.width=a.width||t.getSettings().width,r.height=a.width||t.getSettings().height,Fe(this,wf,be(l,50))},!1);const d=r.captureStream().getVideoTracks()[0];return Object.defineProperty(d,"originalSettings",{value:t.getSettings()}),d})}}wf=new WeakMap,Sf=new WeakMap;const Ef={gross:{width:{ideal:192},height:{ideal:144}},qvga:{width:{ideal:384},height:{ideal:288}},pvga:{width:{ideal:480},height:{ideal:360}},vga:{width:{ideal:640},height:{ideal:480}},hd:{width:{ideal:1280},height:{ideal:720}},hd_cropped:{width:{ideal:900},height:{ideal:720}},fhd:{width:{ideal:1920},height:{ideal:1080}}},Tf=[[320,[{rid:"q",maxBitrate:25e4,maxFramerate:24,scalabilityMode:"L1T1"}]],[640,[{rid:"q",scaleResolutionDownBy:2,maxBitrate:25e4,maxFramerate:24,scalabilityMode:"L1T1"},{rid:"h",maxBitrate:7e5,maxFramerate:30,scalabilityMode:"L1T1"}]],[1280,[{rid:"q",scaleResolutionDownBy:2,maxBitrate:5e5,maxFramerate:24,scalabilityMode:"L1T1"},{rid:"h",maxBitrate:13e5,maxFramerate:30,scalabilityMode:"L1T1"}]],[1920,[{rid:"q",scaleResolutionDownBy:2,maxBitrate:9e5,maxFramerate:24,scalabilityMode:"L1T1"},{rid:"h",maxBitrate:15e5,maxFramerate:30,scalabilityMode:"L1T1"}]]];var _f=(e=>(e.WEBCAM="webcam",e.WEBCAM_BACKUP="webcam_backup",e.MIC="mic",e.SCREENSHARE_VIDEO="screenshare_video",e.SCREENSHARE_AUDIO="screenshare_audio",e))(_f||{});const Pf=iu(zn(Ts).config.media);var Cf,Af;class Rf{constructor(e,t){Ue(this,Cf,void 0),Ue(this,Af,void 0),De(this,"getScreenShareConstraints",()=>{var e,t,i,r,n,s,a,o,c,l,d;const h=null==(e=Ne(this,Cf))?void 0:e.screenshare,u=null!=(i=null==(t=null==h?void 0:h.width)?void 0:t.max)?i:1920,p=null!=(n=null==(r=null==h?void 0:h.height)?void 0:r.max)?n:1080,g=null!=(a=null==(s=null==h?void 0:h.frameRate)?void 0:s.max)?a:5;let f=null!=(c=null==(o=null==h?void 0:h.frameRate)?void 0:o.ideal)?c:5;const m=null==h?void 0:h.displaySurface,v=null==h?void 0:h.selfBrowserSurface;Ne(this,Af).getValue("flagsmith").getValue(Xa)&&(f=parseInt(null==(l=Ne(this,Af).getValue("flagsmith").getValue(Xa))?void 0:l.toString(),10));let b={width:{max:u},height:{max:p},frameRate:{ideal:f,max:g}};if(Ne(this,Af).getValue("flagsmith").hasFeature(ro)){const e=null==(d=Ne(this,Af).getValue("flagsmith").getValue(ro))?void 0:d.toString();b=JSON.parse(e)}return void 0!==m&&["monitor","browser","window"].includes(m)&&(b=Ie(Le({},b),{displaySurface:m})),void 0!==v&&(b=Ie(Le({},b),{selfBrowserSurface:v})),{audio:!0,video:b}}),De(this,"getAudioConstraints",e=>{var t,i,r,n,s,a,o;const c={},l=null==(t=Ne(this,Cf))?void 0:t.audio,d=null!=l&&l.enableStereo?2:1;return it.isFirefox()||it.isWebKitBased()?(c.audio={deviceId:e,autoGainControl:null==(i=null==l?void 0:l.autoGainControl)||i,echoCancellation:null==(r=null==l?void 0:l.echoCancellation)||r,noiseSuppression:null==(n=null==l?void 0:l.noiseSupression)||n,channelCount:d},c):(c.audio={autoGainControl:null==(s=null==l?void 0:l.autoGainControl)||s,echoCancellation:null==(a=null==l?void 0:l.echoCancellation)||a,noiseSuppression:null==(o=null==l?void 0:l.noiseSupression)||o,channelCount:d},e&&(c.audio.deviceId={exact:e}),c)}),De(this,"getVideoConstraints",e=>{var t,i,r,n;const s={},a=null==(t=Ne(this,Cf))?void 0:t.video;let o=Ef.vga;if("string"==typeof a?o=Ef[a]:void 0!==a&&(o.height.ideal=a.height.ideal,o.width.ideal=a.width.ideal),o.frameRate={ideal:null!=(r=null==(i=o.frameRate)?void 0:i.ideal)?r:24},it.isChromiumBased()&&(o.frameRate.max=30),Ne(this,Af).getValue("flagsmith").hasFeature(io)){const e=null==(n=Ne(this,Af).getValue("flagsmith").getValue(io))?void 0:n.toString();o=JSON.parse(e)}return s.video=o,"boolean"==typeof s.video||(e?s.video.deviceId={exact:e}:s.video.facingMode="user"),s}),Fe(this,Af,e),Fe(this,Cf,t)}getUpdatedVideoConstraints(e){return e}}Cf=new WeakMap,Af=new WeakMap;class Lf extends Error{constructor(e,t,i){super(t),De(this,"constraints"),De(this,"name"),this.name=e,this.constraints=i}}class If{constructor(){De(this,"permissions"),this.permissions={audio:"NOT_REQUESTED",video:"NOT_REQUESTED",screenshare:"NOT_REQUESTED"}}getAudioInputDevices(e){return Be(this,null,function*(){let t=e;return e||(t=yield this.getAvailableDevices()),t.filter(e=>"audioinput"===e.kind)})}getVideoInputDevices(e){return Be(this,null,function*(){let t=e;return e||(t=yield this.getAvailableDevices()),t.filter(e=>"videoinput"===e.kind)})}getAudioOutputDevices(e){return Be(this,null,function*(){let t=e;return e||(t=yield this.getAvailableDevices()),t.filter(e=>"audiooutput"===e.kind)})}}var Mf,Df,Of,Nf,Uf=Object.defineProperty,Ff=Object.getOwnPropertyDescriptor,jf=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Ff(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Uf(t,i,s),s};let Bf=(Nf=class extends If{constructor(e,t){super(),Ue(this,Mf,void 0),Ue(this,Df,void 0),Ue(this,Of,void 0),Fe(this,Of,e),Fe(this,Df,new Rf(e,t)),Fe(this,Mf,new AbortController)}get telemetry(){return Ne(this,Of).getValue("telemetry")}get logger(){return Ne(this,Of).getValue("logger")}get constraintsBuilder(){return Ne(this,Df)}destruct(){return Be(this,null,function*(){var e;null==(e=Ne(this,Mf))||e.abort()})}handlePermissionErrors(e,t){const i=bf(e,t.name,t.message);return this.permissions[e]=i,Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_ERROR,{message:i,constraints:t.constraints,kind:e}),i}getAudioAndVideoTrack(e,t){return Be(this,null,function*(){var i,r,n,s;try{const a=yield this.getAudioInputDevices(),o=yield this.getVideoInputDevices(),c=!(null==a||!a.find(t=>t.deviceId===e));let l;e&&c?l=e:a&&null!=(i=a[0])&&i.deviceId&&(l=null==(r=a[0])?void 0:r.deviceId);const d=!(null==o||!o.find(e=>e.deviceId===t));let h;t&&d?h=t:o&&null!=(n=o[0])&&n.deviceId&&(h=null==(s=o[0])?void 0:s.deviceId);const u={audio:Ne(this,Df).getAudioConstraints(l).audio,video:Ne(this,Df).getVideoConstraints(h).video};this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(u)});const p=yield navigator.mediaDevices.getUserMedia(u);this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(u)});const g=p.getAudioTracks()[0];let f=p.getVideoTracks()[0];if(this.permissions.audio="ACCEPTED",this.permissions.video="ACCEPTED",Ne(this,Of).getValue("flagsmith").hasFeature(ao)&&f.label.includes("OBS Virtual")){const e=(yield this.getVideoInputDevices()).find(e=>e.label.includes("OBS Virtual"));f=yield this.getVideoTrack(e.deviceId)}return Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"}),Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"}),{audioTrack:g,videoTrack:f}}catch(a){throw this.logger.error("WebMediaInterface.getAudioAndVideoTrack",{error:a}),new Uo("Couldnt fetch audio and video track","1605")}})}getAudioTrack(e,t){return Be(this,null,function*(){var i,r;let n=yield this.getAudioInputDevices();if(null==n||!n.length)throw this.permissions.audio="NO_DEVICES_AVAILABLE",Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"}),new Uo("No audio devices available","1606");const s=!(null==n||!n.find(e=>e.deviceId===t));let a;t&&s?a=t:null!=(i=n[0])&&i.deviceId&&(a=null==(r=n[0])?void 0:r.deviceId);const o=e=>Be(this,null,function*(){let t;try{n=n.filter(t=>t.deviceId!==e),t=Ne(this,Df).getAudioConstraints(e),this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(t)});const[i]=(yield navigator.mediaDevices.getUserMedia(t)).getAudioTracks();return this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(t)}),i}catch(i){const e=bf("audio",i.name,i.message),r=new Lf(i.name,i.message,t);if("COULD_NOT_START"===e){const e=n.shift();if(!e)throw r;this.logger.info("getAudioTrack::gum_failed",{constraints:JSON.stringify(t),error:i});const s=Ne(this,Df).getAudioConstraints(e.deviceId);return this.logger.info("getAudioTrack::retrying_gum_for_next_device",{constraints:JSON.stringify(s)}),o(e.deviceId)}throw r}});try{const t=yield o(a);return t.enabled=!e,"ACCEPTED"!==this.permissions.audio&&(this.permissions.audio="ACCEPTED",Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"})),t}catch(c){throw c.constraints&&this.handlePermissionErrors("audio",c),new Uo(c.message,"1601")}})}getVideoTrack(e){return Be(this,null,function*(){var t,i,r;const n=Ne(this,Of).getValue("flagsmith").hasFeature(ao),s=null==(t=yield this.getCurrentDeviceLabel(e))?void 0:t.includes("OBS Virtual"),a=n&&s,o=yield this.getVideoInputDevices();if(null==o||!o.length)throw this.permissions.video="NO_DEVICES_AVAILABLE",Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"}),new Uo("No video devices available","1607");const c=!(null==o||!o.find(t=>t.deviceId===e));let l;e&&c?l=e:null!=(i=o[0])&&i.deviceId&&(l=null==(r=o[0])?void 0:r.deviceId);const d=e=>Be(this,null,function*(){try{let t=e;const{video:i}=t;a&&"boolean"!=typeof i&&(t={video:{deviceId:i.deviceId}}),this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(t)});const[r]=(yield navigator.mediaDevices.getUserMedia(t)).getVideoTracks();if(a&&"boolean"!=typeof i&&"object"==typeof i.width){const{width:e,height:t}=r.getSettings(),{ideal:n}=i.width;r.applyConstraints({width:{ideal:n},height:{ideal:Math.floor(t*n/e)},frameRate:i.frameRate})}return this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(t)}),r}catch(t){const i=bf("video",t.name,t.message),r=new Lf(t.name,t.message,e);if("COULD_NOT_START"===i){const i=o.shift();if(!i)throw r;this.logger.info("getVideoTrack::gum_failed",{constraints:JSON.stringify(e),error:t});const n=Ne(this,Df).getVideoConstraints(i.deviceId);return this.logger.info("getVideoTrack::retrying_gum_for_next_device",{constraints:JSON.stringify(n)}),d({video:n.video})}throw r}});try{const e=Ne(this,Df).getVideoConstraints(l),t=yield d(e);return"ACCEPTED"!==this.permissions.video&&(this.permissions.video="ACCEPTED",Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"})),t}catch(h){throw h.constraints&&this.handlePermissionErrors("video",h),new Uo(h.message,"1602")}})}getScreenShareTracks(){return Be(this,null,function*(){const e=t=>Be(this,null,function*(){try{this.logger.info("getDisplayMediaWithoutTimeout::requesting_display_media",{constraints:JSON.stringify(t)}),Ne(this,Of).getValue("callstats").screenShareRequested();const e=yield navigator.mediaDevices.getDisplayMedia(t);return this.logger.info("getDisplayMediaWithoutTimeout::received_display_media",{constraints:JSON.stringify(t)}),e}catch(i){const r=bf("video",i.name,i.message),n=new Lf(i.name,i.message,t),s={video:!0};if(function(e,t){return va(e,t)}(t,s)||!Ne(this,Of).getValue("flagsmith").hasFeature(to))throw n;if("COULD_NOT_START"===r)return e(s);throw n}});try{const t=Ne(this,Df).getScreenShareConstraints(),i=yield e(t);return"ACCEPTED"!==this.permissions.screenshare&&(this.permissions.screenshare="ACCEPTED",Ne(this,Of).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.permissions.screenshare,kind:"screenshare"})),{audioTrack:i.getAudioTracks()[0],videoTrack:i.getVideoTracks()[0]}}catch(t){throw t.constraints&&this.handlePermissionErrors("screenshare",t),new Uo(t.message,"1612")}})}getCurrentDeviceLabel(e){return Be(this,null,function*(){const t=yield this.getDevice(e||"default");return null==t?void 0:t.label})}enumerateDevicesWithExternalFirst(){return Be(this,null,function*(){const e=yield navigator.mediaDevices.enumerateDevices(),t=e=>{var t;const i=(null==(t=e.label)?void 0:t.toLowerCase())||"";return yf(e)?4:i.includes("airpods")||i.includes("airdopes")||i.includes("bluetooth")||i.includes("wireless")||i.includes("headphones")||i.includes("headset")||i.includes("earbuds")||i.includes("usb")||i.includes("external")?0:"default"===e.deviceId||i.includes("default")?1:i.includes("built-in")||i.includes("internal")?2:3},i=e=>{var t;if("videoinput"!==e.kind)return!1;const i=(null==(t=e.label)?void 0:t.toLowerCase())||"";return!!(i.includes("front")||i.includes("user")||i.includes("selfie"))||!(i.includes("back")||i.includes("rear")||i.includes("environment"))};return e.sort((e,r)=>{var n,s;const a=t(e),o=t(r);if(a!==o)return a-o;const c="default"===e.deviceId||(null==(n=e.label)?void 0:n.toLowerCase().includes("default")),l="default"===r.deviceId||(null==(s=r.label)?void 0:s.toLowerCase().includes("default"));if(c&&!l)return-1;if(!c&&l)return 1;if("videoinput"===e.kind&&"videoinput"===r.kind){const t=i(e),n=i(r);if(t&&!n)return-1;if(!t&&n)return 1}return 0})})}getAvailableDevices(){return Be(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst())||[]}catch(e){return this.logger.error("enumerate_devices_failed",{error:e}),[]}})}getAvailableDevicesByKind(e){return Be(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst()).filter(t=>{let{kind:i}=t;return e===i})}catch(t){throw this.logger.error("enumerate_devices_failed",{error:t}),new Uo("Failed to get available devices by kind","1609")}})}getDevice(e){return Be(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst()).filter(t=>t.deviceId===e)[0]}catch(t){throw this.logger.error("enumerate_devices_failed",{error:t}),new Uo("Failed to get device","1609")}})}onDeviceChange(e){return Be(this,null,function*(){if(it.supportsDeviceChangeEvent()){let t=yield this.getAvailableDevices();navigator.mediaDevices.addEventListener("devicechange",i=>Be(this,null,function*(){var r,n;const s=e=>"".concat(e.kind,"-").concat(e.label,"-").concat(e.deviceId,"-").concat(e.groupId),a=new Set(t.map(e=>s(e))),o=yield this.getAvailableDevices(),c=new Set(o.map(e=>s(e))),l={added:o.filter(e=>!a.has(s(e))),removed:t.filter(e=>!c.has(s(e))),devices:o};if(t=o,null!=(r=l.added)&&r.length||null!=(n=l.removed)&&n.length){this.logger.info("repopulated_full_device_list",{devices:JSON.stringify(o)});const t=[...l.added,...l.removed];t.some(e=>"audioinput"===e.kind)&&Ne(this,Of).getValue("callstats").devices("AUDIO",null==o?void 0:o.filter(e=>"audioinput"===e.kind)),t.some(e=>"videoinput"===e.kind)&&Ne(this,Of).getValue("callstats").devices("VIDEO",null==o?void 0:o.filter(e=>"videoinput"===e.kind)),t.some(e=>"audiooutput"===e.kind)&&Ne(this,Of).getValue("callstats").devices("SPEAKER",null==o?void 0:o.filter(e=>"audiooutput"===e.kind)),e(i,l,!1)}}),{signal:Ne(this,Mf).signal})}})}},Mf=new WeakMap,Df=new WeakMap,Of=new WeakMap,Nf);jf([Mo.trace("WebMediaInterface.destruct")],Bf.prototype,"destruct",1),jf([Mo.trace("WebMediaInterface.handlePermissionErrors")],Bf.prototype,"handlePermissionErrors",1),jf([Mo.trace("WebMediaInterface.getAudioAndVideoTrack")],Bf.prototype,"getAudioAndVideoTrack",1),jf([Mo.trace("WebMediaInterface.getAudioTrack")],Bf.prototype,"getAudioTrack",1),jf([Mo.trace("WebMediaInterface.getVideoTrack")],Bf.prototype,"getVideoTrack",1),jf([Mo.trace("WebMediaInterface.getScreenShareTracks")],Bf.prototype,"getScreenShareTracks",1),jf([Mo.trace("WebMediaInterface.getAvailableDevices")],Bf.prototype,"getAvailableDevices",1),jf([Mo.trace("WebMediaInterface.getAvailableDevicesByKind")],Bf.prototype,"getAvailableDevicesByKind",1),jf([Mo.trace("WebMediaInterface.getDevice")],Bf.prototype,"getDevice",1),jf([Mo.trace("WebMediaInterface.onDeviceChange")],Bf.prototype,"onDeviceChange",1),Bf=jf([Bo("1600")],Bf);const Vf=Bf,zf=(e,t,i)=>{try{localStorage.setItem(e,t)}catch(r){null==i||i.error("LocalStorage::setItem::crashed",{error:r,localStorage:{key:e,value:t}})}},Hf=(e,t)=>{try{return localStorage.getItem(e)}catch(i){null==t||t.error("LocalStorage::getItem::crashed",{error:i,localStorage:{key:e}})}return null},$f=(e,t,i)=>{const r="number"==typeof i?i:250,n=e.createMediaStreamSource(t),s=e.createAnalyser();s.fftSize=2048,n.connect(s);const a=new Uint8Array(s.fftSize);let o=!1;return setTimeout(()=>{o=!0},r),function e(){return o?Promise.resolve(!0):(s.getByteTimeDomainData(a),a.some(e=>128!==e&&0!==e)?Promise.resolve(!1):function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise(t=>setTimeout(t,e))}().then(e))}().then(e=>(n.disconnect(),e),e=>{throw n.disconnect(),e})},Gf="undefined"!=typeof AudioContext?AudioContext:null;class Wf{constructor(e){De(this,"_AudioContext"),De(this,"audioContext"),De(this,"_audioContextRefContainers");const t=Le({AudioContext:Gf},e);Object.defineProperties(this,{_AudioContext:{value:t.AudioContext},audioContext:{value:null,writable:!0},_audioContextRefContainers:{value:new Set},AudioContextProvider:{enumerable:!0,value:Wf}})}getOrCreate(e){if(!this._audioContextRefContainers.has(e)&&(this._audioContextRefContainers.add(e),this._AudioContext&&!this.audioContext))try{this.audioContext=new this._AudioContext}catch(t){}return this.audioContext}release(e){this._audioContextRefContainers.has(e)&&(this._audioContextRefContainers.delete(e),!this._audioContextRefContainers.size&&this.audioContext&&(this.audioContext.close(),this.audioContext=null))}}const qf=new Wf;function Kf(e,t){return Be(this,null,function*(){const i=new Audio,r=new MediaStream;r.addTrack(t),i.srcObject=r;let n=!1;try{const t=i.play();t&&(yield t),n=yield function(e){const t={},i=qf.getOrCreate(t);let r=3;return function t(){return r-=1,$f(i,e.srcObject,250).then(e=>!!e&&(!(r>0)||t())).catch(()=>!0)}().finally(()=>{qf.release(t)})}(i),n&&e.info("checkIfAudioTrackIsSilent::silence_detected")}catch(s){e.error("checkIfAudioTrackIsSilent::failed_to_detect_silence",{error:s})}finally{i.pause(),i.remove()}return n})}var Zf=Object.defineProperty,Yf=Object.getOwnPropertyDescriptor,Jf=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Yf(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Zf(t,i,s),s};let Qf=class extends zo{constructor(e,t,i,r){var n;super(e.getValue("logger")),De(this,"constructorName",this.constructor.name),De(this,"userSelectedDevice"),De(this,"mediaInterface"),De(this,"isNonPreferredDevice"),De(this,"_mediaTrack"),De(this,"transformedMediaTrack"),De(this,"middlewares",[]),De(this,"currentDevice"),De(this,"userPreferredDeviceKey","Realtimekit::".concat(this.constructorName,"::UserDeviceID")),De(this,"setUserPreferredDevice",e=>zf(this.userPreferredDeviceKey,e,this.logger)),De(this,"getUserPreferredDevice",()=>Hf(this.userPreferredDeviceKey,this.logger)),De(this,"isCustomTrack",!1),De(this,"context"),this.context=e,this.mediaInterface=t,i&&this.setMediaTrack(i),this.userSelectedDevice=null!=(n=this.getUserPreferredDevice())?n:void 0,this.isNonPreferredDevice=r,this.onTrackEnded=this.onTrackEnded.bind(this),this.onTrackMuted=this.onTrackMuted.bind(this)}get telemetry(){return this.context.getValue("telemetry")}disableTrack(){var e,t;this.removeMediaTrackListeners(),this.isCustomTrack||null==(e=this._mediaTrack)||e.stop(),this._mediaTrack=void 0,null==(t=this.transformedMediaTrack)||t.stop(),this.transformedMediaTrack=void 0}get mediaTrack(){return this._mediaTrack}setMediaTrack(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){const i=e=>{this.logger.error("".concat(this.constructorName,".setMediaTrack.error"),{error:e})};try{this.disableTrack()}catch(d){i(d)}this._mediaTrack=yield this.conditionallyChangeTrack(e,t),yield this.setTransformedTrack();try{this.addMediaTrackListeners(),yield this.setCurrentDevice()}catch(d){i(d)}})}get trackEnabled(){return!!this.mediaTrack&&"live"===this.mediaTrack.readyState&&this.mediaTrack.enabled}muteTrack(){this.mediaTrack?(this.transformedMediaTrack&&(this.transformedMediaTrack.enabled=!1),this.mediaTrack.enabled=!1):this.logger.warn("BaseMediaHandler.muteTrack Tried muting with no track present")}unmuteTrack(){return Be(this,null,function*(){try{this.mediaTrack?this.mediaTrack.enabled=!0:yield this.enableTrack(!1)}catch(e){throw this.logger.error("".concat(this.constructorName,".unmuteTrack.error"),{error:e}),this.disableTrack(),new Uo("Failed to unmute track","1611")}})}getCurrentDeviceId(){var e;const{kind:t}=this.mediaTrack;if("audio"===t){const{deviceId:t}=this.mediaTrack.getSettings();if(t)return t;const i=this.mediaTrack.getConstraints();return this.userSelectedDevice?(i&&"object"==typeof i.deviceId&&"exact"in i.deviceId?i.deviceId.exact:i.deviceId)||(null==(e=null==i?void 0:i.advanced)?void 0:e[0].deviceId)||"default":this.mediaTrack.getSettings().deviceId}return this.mediaTrack.getSettings().deviceId}setCurrentDevice(){return Be(this,null,function*(){var e;if(!this.mediaTrack)return void(this.currentDevice=void 0);const t=this.getCurrentDeviceId();(null==(e=this.currentDevice)?void 0:e.deviceId)!==t&&(this.currentDevice=yield this.mediaInterface.getDevice(t))})}setDevice(e,t){return Be(this,arguments,function(e,t){var i=this;let{saveDevicePreference:r}=t;return function*(){if(!e)throw i.logger.warn("".concat(i.constructorName,".setDevice No device received")),new Uo("No device received!","1603");i.userSelectedDevice=e.deviceId,r&&i.setUserPreferredDevice(e.deviceId),yield i.onSetDevice(e)}()})}addMiddleware(e){return Be(this,null,function*(){if(it.isWebKitBased()&&!fs.hasFeature(oo))return{success:!1,message:"Middlewares are not supported in this WebKit engine based browser."};if(this.middlewares.includes(e))return{success:!1,message:"This middleware has been applied, already. Skipping."};try{return this.middlewares.push(e),this.trackEnabled&&(yield this.setTransformedTrack()),{success:!0,message:"Successfully added the middleware."}}catch(t){return this.logger.error("While adding middleware",{error:t}),this.removeMiddleware(e),{success:!1,message:null==t?void 0:t.message}}})}removeMiddleware(e){return Be(this,null,function*(){const t=this.middlewares.indexOf(e,0);if(t>-1)try{return this.middlewares.splice(t,1),yield this.setTransformedTrack(!0),{success:!0,message:"Successfully removed the middleware."}}catch(i){return this.logger.error("While removing middleware",{error:i}),{success:!1,message:null==i?void 0:i.message}}return{success:!1,message:"No such middleware was found. Skipping."}})}removeAllMiddlewares(){return Be(this,null,function*(){var e;if(null!=(e=this.middlewares)&&e.length)try{return this.middlewares=[],yield this.setTransformedTrack(!0),{success:!0,message:"Successfully removed all the middlewares."}}catch(t){return this.logger.error("While removing all the middlewares",{error:t}),{success:!1,message:null==t?void 0:t.message}}return{success:!1,message:"No middlewares were found. Skipping."}})}addMediaTrackListeners(){var e,t,i;this.mediaTrack&&(this.logger.info("".concat(this.constructorName,".addMediaTrackListeners for deviceId ").concat(null==(t=null==(e=this.mediaTrack)?void 0:e.getSettings())?void 0:t.deviceId," of type ").concat(null==(i=this.mediaTrack)?void 0:i.kind)),this.mediaTrack.addEventListener("ended",this.onTrackEnded),this.mediaTrack.addEventListener("mute",this.onTrackMuted))}removeMediaTrackListeners(){var e,t,i;this.mediaTrack&&(this.logger.info("".concat(this.constructorName,".removeMediaTrackListeners for deviceId ").concat(null==(t=null==(e=this.mediaTrack)?void 0:e.getSettings())?void 0:t.deviceId," of type ").concat(null==(i=this.mediaTrack)?void 0:i.kind)),this.logger.info("".concat(this.constructorName,".removeMediaTrackListeners")),this.mediaTrack.removeEventListener("ended",this.onTrackEnded),this.mediaTrack.removeEventListener("mute",this.onTrackMuted))}};Jf([Mo.trace("BaseMediaHandler.unmuteTrack")],Qf.prototype,"unmuteTrack",1),Qf=Jf([Bo("1600")],Qf);const Xf=Qf;var em=Object.defineProperty,tm=Object.getOwnPropertyDescriptor,im=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?tm(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&em(t,i,s),s};const rm="[Realtimekit]nonSilentDeviceLabels";class nm extends Xf{onSetDevice(e){return Be(this,null,function*(){if(!e)throw this.logger.warn("AudioMediaHandler.setDevice No device received"),new Uo("No device received!","1603");if("audioinput"!==e.kind)throw this.logger.warn("AudioMediaHandler.setDevice Received non audio device"),new Uo("Non audio device received while setting device!","1603");try{const e=this.trackEnabled;this.disableTrack(),yield this.setMediaTrack(yield this.mediaInterface.getAudioTrack(!e,this.userSelectedDevice))}catch(t){throw this.logger.error("AudioMediaHandler.setDevice.error",{error:t}),this.disableTrack(),new Uo(t.message,"1604")}})}enableTrack(e,t){return Be(this,null,function*(){if(this.trackEnabled)return void this.logger.warn("AudioMediaHandler.enableTrack Track already enabled!");if(t)return this.isCustomTrack=!0,void(yield this.setMediaTrack(t,!0));this.isCustomTrack=!1;const i=yield this.mediaInterface.getAudioTrack(e,this.userSelectedDevice);yield this.setMediaTrack(i)})}setTransformedTrack(e){return Be(this,null,function*(){var t;if(e||null!=(t=this.middlewares)&&t.length)try{this.transformedMediaTrack=yield function(e,t,i){return Be(this,null,function*(){if(null==t||!t.length)return i;const r=e.getValue("logger"),n=new AudioContext,s=yield Promise.all(null==t?void 0:t.map(e=>e(n))),a=n.createMediaStreamSource(new MediaStream([i])),o=n.createMediaStreamDestination();try{let e=a;for(let t=0;t1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){var i;if(!e||this.userSelectedDevice||t)return e;let r=e;const n=yield this.mediaInterface.getAudioInputDevices(),s=this.isNonPreferredDevice?n.filter(e=>e&&!this.isNonPreferredDevice(e)):n;if(null==s||!s.length)return r;s.find(t=>t.deviceId===e.getSettings().deviceId)||(r.stop(),this.logger.info("localmediahandler::setupstreams::found_audio_non_preferred"),r=yield this.mediaInterface.getAudioTrack(!1,s[0].deviceId));const a=JSON.parse(Hf(rm,this.logger));if(null!=a&&a.devices.some(e=>e.label===r.label))return r;if(!(yield Kf(this.logger,r))){const e=null!=(i=null==a?void 0:a.devices.concat({label:r.label}))?i:[{label:r.label}];return zf(rm,JSON.stringify({devices:e}),this.logger),r}this.logger.info("AudioMediaHandler.conditionallyChangeTrack.DetectedSilentTrack");const o=r.getSettings().deviceId;return s.filter(e=>e.deviceId!==o).some(e=>Be(this,null,function*(){var t;if(r=yield this.mediaInterface.getAudioTrack(!1,e.deviceId),!(yield Kf(this.logger,r))){const e=null!=(t=null==a?void 0:a.devices.concat({label:r.label}))?t:[{label:r.label}];return zf(rm,JSON.stringify({devices:e}),this.logger),this.logger.info("AudioMediaHandler.conditionallyChangeTrack.SuccesfullyChangedTrack"),!0}return this.logger.info("AudioMediaHandler.conditionallyChangeTrack.AnotherSilentTrackFound"),!1})),r})}}im([Mo.trace("AudioMediaHandler.setTransformedTrack")],nm.prototype,"setTransformedTrack",1),im([Mo.trace("AudioMediaHandler.onTrackEnded")],nm.prototype,"onTrackEnded",1),im([Mo.trace("AudioMediaHandler.conditionallyChangeTrack")],nm.prototype,"conditionallyChangeTrack",1);const sm=nm;var am;am=new WeakMap;const om=class{constructor(e,t){Ue(this,am,void 0),De(this,"currentDevice"),De(this,"userPreferredDeviceKey","Realtimekit::speaker::UserDeviceID"),De(this,"logger"),De(this,"setUserPreferredDevice",e=>zf(this.userPreferredDeviceKey,e,this.logger)),De(this,"getUserPreferredDevice",()=>Hf(this.userPreferredDeviceKey,this.logger)),Fe(this,am,t),this.logger=e.getValue("logger")}setPreferredSpeaker(){return Be(this,null,function*(){const e=this.getUserPreferredDevice(),t=yield Ne(this,am).getAudioOutputDevices(),i=null==t?void 0:t.find(t=>t.deviceId===e);yield this.setupSpeaker(i,{saveDevicePreference:!1})})}setupSpeaker(e,t){return Be(this,arguments,function(e,t){var i=this;let{saveDevicePreference:r}=t;return function*(){var t,n;if(!(Ne(i,am)instanceof Vf))return;let s=e;if(e||([s]=(yield Ne(i,am).getAvailableDevicesByKind("audiooutput")).filter(e=>!yf(e))),!s)throw new Uo("No speaker found","1608");if((null==(t=i.currentDevice)?void 0:t.deviceId)===s.deviceId)return;r&&i.setUserPreferredDevice(s.deviceId),i.currentDevice=s;const a=document.querySelectorAll("audio");null!=(n=a[0])&&n.setSinkId&&a.forEach(e=>Be(i,null,function*(){if("undefined"!=typeof e.sinkId&&this.currentDevice.deviceId&&e.sinkId!==this.currentDevice.deviceId)try{yield e.setSinkId(this.currentDevice.deviceId)}catch(t){}}))}()})}};var cm;cm=new WeakMap;const lm=class extends zo{constructor(e,t){super(e.getValue("logger")),De(this,"mediaInterface"),De(this,"audioMediaTrack"),De(this,"videoMediaTrack"),Ue(this,cm,void 0),Fe(this,cm,e),this.mediaInterface=t}get trackEnabled(){return!!this.videoMediaTrack}enableScreenShare(){return Be(this,null,function*(){var e,t;try{const{audioTrack:i,videoTrack:r}=yield this.mediaInterface.getScreenShareTracks();if(this.audioMediaTrack=i,this.videoMediaTrack=r,this.addMediaTrackListeners(),"ACCEPTED"===(null==(t=null==(e=this.mediaInterface)?void 0:e.permissions)?void 0:t.screenshare))return;this.mediaInterface.permissions&&(this.mediaInterface.permissions.screenshare="ACCEPTED",Ne(this,cm).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,{message:this.mediaInterface.permissions.screenshare,kind:"screenshare"}))}catch(d){}})}disableScreenShare(){var e,t;this.removeMediaTrackListeners(),null==(e=this.audioMediaTrack)||e.stop(),null==(t=this.videoMediaTrack)||t.stop(),this.videoMediaTrack=void 0,this.audioMediaTrack=void 0}updateConstraints(e){return Be(this,null,function*(){if(!this.videoMediaTrack)throw new Uo("No media track enabled!","1610");const t=this.mediaInterface;if(!t.constraintsBuilder)throw new Uo("update constraints not supported for non web clients","1100",this.logger);try{this.videoMediaTrack.applyConstraints(t.constraintsBuilder.getUpdatedVideoConstraints(e)),this.addMediaTrackListeners()}catch(d){this.logger.error("ScreenShareHandler.updateConstraints.error",{error:d})}})}addMediaTrackListeners(){var e,t;null==(e=this.videoMediaTrack)||e.addEventListener("ended",this.onTrackEnded.bind(this)),it.isWebKitBased()&&(null==(t=this.videoMediaTrack)||t.addEventListener("mute",this.onTrackEnded.bind(this)))}removeMediaTrackListeners(){var e,t;null==(e=this.videoMediaTrack)||e.removeEventListener("ended",this.onTrackEnded),null==(t=this.videoMediaTrack)||t.removeEventListener("mute",this.onTrackEnded)}onTrackEnded(){this.emit("trackEnded")}};var dm,hm,um=Object.defineProperty,pm=Object.getOwnPropertyDescriptor,gm=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?pm(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&um(t,i,s),s};class fm extends Xf{constructor(e,t,i,r){super(e,t,i,r),Ue(this,dm,void 0),Ue(this,hm,{disablePerFrameCanvasRendering:!1}),Fe(this,dm,new xf(e))}onSetDevice(e){return Be(this,null,function*(){if(!e)throw this.logger.warn("VideoMediaHandler.setDevice No device received"),new Uo("No device received!","1603");if("videoinput"!==e.kind)throw this.logger.warn("VideoMediaHandler.setDevice Received non video device",{devices:[e]}),new Uo("Non video device received while setting video device!","1603");if(!this.mediaTrack||!this.mediaTrack.enabled)return this.logger.warn("VideoMediaHandler.setDevice Tried switching device with video disabled",{devices:[e]}),void(this.currentDevice=e);try{this.disableTrack(),yield this.setMediaTrack(yield this.mediaInterface.getVideoTrack(this.userSelectedDevice))}catch(t){throw this.logger.error("VideoMediaHandler.setDevice.error",{error:t}),this.disableTrack(),new Uo("Failed to change device","1600",this.logger)}})}enableTrack(e,t){return Be(this,null,function*(){if(this.trackEnabled)return void this.logger.warn("VideoMediaHandler.enableTrack Track already enabled!");if(t)return this.isCustomTrack=!0,void(yield this.setMediaTrack(t,!0));this.isCustomTrack=!1;const e=yield this.mediaInterface.getVideoTrack(this.userSelectedDevice);yield this.setMediaTrack(e)})}setTransformedTrack(e){return Be(this,null,function*(){var t;if(e||null!=(t=this.middlewares)&&t.length)try{this.transformedMediaTrack=yield Ne(this,dm).getTransformedVideoTrack(this.middlewares,this.mediaTrack,Ne(this,hm)),this.emit("trackChanged")}catch(d){this.logger.error("VideoMediaHandler.setTransformedTrack",{error:d}),this.transformedMediaTrack=this.mediaTrack}else this.transformedMediaTrack=this.mediaTrack})}setVideoMiddlewareGlobalConfig(e){return Be(this,null,function*(){Fe(this,hm,e)})}updateConstraints(e){return Be(this,null,function*(){if(!this._mediaTrack)throw new Uo("No media track enabled!","1610");const t=this.mediaInterface;if(!t.constraintsBuilder)throw new Uo("update constraints not supported for non web clients","1100",this.logger);try{this._mediaTrack.applyConstraints(t.constraintsBuilder.getUpdatedVideoConstraints(e)),yield this.setTransformedTrack(),this.addMediaTrackListeners(),yield this.setCurrentDevice()}catch(d){this.logger.error("VideoMediaHandler.updateConstraints.error",{error:d})}})}terminateMiddlewareWebWorker(){Ne(this,dm).terminateMiddlewareWebWorker()}onTrackEnded(){return Be(this,null,function*(){this.logger.info("VideoMediaHandler.TrackEnded"),this.disableTrack(),this.emit("trackEnded")})}onTrackMuted(){this.logger.info("VideoMediaHandler.TrackMuted"),this.emit("trackMuted")}conditionallyChangeTrack(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Be(this,null,function*(){if(!e||this.userSelectedDevice||t)return e;let i=e;const r=yield this.mediaInterface.getVideoInputDevices(),n=this.isNonPreferredDevice?r.filter(e=>!this.isNonPreferredDevice(e)):r;return!(null!=n&&n.length)||window.FAST_RTK||n.find(t=>t.deviceId===e.getSettings().deviceId)||(i.stop(),this.logger.info("localmediahandler::setupstreams::found_video_non_preferred"),i=yield this.mediaInterface.getVideoTrack(n[0].deviceId)),i})}}dm=new WeakMap,hm=new WeakMap,gm([Mo.trace("VideoMediaHandler.setTransformedTrack")],fm.prototype,"setTransformedTrack",1),gm([Mo.trace("VideoMediaHandler.setVideoMiddlewareGlobalConfig")],fm.prototype,"setVideoMiddlewareGlobalConfig",1),gm([Mo.trace("VideoMediaHandler.onTrackEnded")],fm.prototype,"onTrackEnded",1),gm([Mo.trace("VideoMediaHandler.conditionallyChangeTrack")],fm.prototype,"conditionallyChangeTrack",1);const mm=fm,vm=iu(Rs());var bm,km,ym,wm;const Sm=class{constructor(e){if(Ue(this,bm,void 0),Ue(this,km,void 0),Ue(this,ym,void 0),Ue(this,wm,void 0),!e)throw new Uo("Could not load preset.","0904");Fe(this,bm,e.config),Fe(this,ym,e.name),Fe(this,km,e.ui||iu(Rs().ui)),Fe(this,wm,e.permissions.plugins.config)}static fromResponse(e){return new Sm(e)}static default(){return new Sm(vm)}static init(e){return new Sm(!e||(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])?vm:e)}get setupScreen(){return{isEnabled:!0}}get waitingRoom(){return{isEnabled:!0}}get controlBar(){return{isEnabled:!0,elements:{chat:!0,fullscreen:!0,invite:!1,layout:!1,participants:!0,plugins:!0,polls:!0,reactions:!1,screenshare:!0}}}get header(){return{isEnabled:!0,elements:{logo:Ne(this,km).designTokens.logo,timer:!0,title:!0,participantCount:!0,changeLayout:!1}}}get pipMode(){return!0}get viewType(){return Ne(this,bm).viewType}get livestreamViewerQualities(){return Ne(this,bm).livestreamViewerQualities||[]}get maxVideoStreams(){return Ne(this,bm).maxVideoStreams}get maxScreenShareCount(){return Ne(this,bm).maxScreenshareCount}get plugins(){return[]}get disabledPlugins(){return Object.keys(Ne(this,wm)).filter(e=>Ne(this,wm)[e].disabled)}get designTokens(){return Ne(this,km).designTokens}get configDiff(){return Ne(this,km).configDiff}get mediaConstraints(){var e,t,i,r,n,s,a,o,c,l,d,h,u,p,g,f,m,v,b,k,y,w,S,x;return{audio:{enableStereo:null!=(r=null==(i=null==(t=null==(e=Ne(this,bm))?void 0:e.media)?void 0:t.audio)?void 0:i.enableStereo)?r:Pf.audio.enableStereo,enableHighBitrate:null!=(o=null==(a=null==(s=null==(n=Ne(this,bm))?void 0:n.media)?void 0:s.audio)?void 0:a.enableHighBitrate)?o:Pf.audio.enableHighBitrate},video:{quality:null!=(h=null==(d=null==(l=null==(c=Ne(this,bm))?void 0:c.media)?void 0:l.video)?void 0:d.quality)?h:Pf.video.quality,frameRate:null!=(f=null==(g=null==(p=null==(u=Ne(this,bm))?void 0:u.media)?void 0:p.video)?void 0:g.frameRate)?f:Pf.video.frameRate},screenshare:{quality:null!=(k=null==(b=null==(v=null==(m=Ne(this,bm))?void 0:m.media)?void 0:v.screenshare)?void 0:b.quality)?k:Pf.screenshare.quality,frameRate:null!=(x=null==(S=null==(w=null==(y=Ne(this,bm))?void 0:y.media)?void 0:w.screenshare)?void 0:S.frameRate)?x:Pf.screenshare.frameRate}}}get name(){return Ne(this,ym)}};let xm=Sm;bm=new WeakMap,km=new WeakMap,ym=new WeakMap,wm=new WeakMap;var Em,Tm,_m=Object.defineProperty,Pm=Object.getOwnPropertyDescriptor,Cm=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Pm(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&_m(t,i,s),s};class Am extends Ho{constructor(e,t){super(e.getValue("logger")),Ue(this,Em,void 0),De(this,"state","IDLE"),De(this,"playbackUrl"),De(this,"ingestionCredentials"),De(this,"viewerCount"),Ue(this,Tm,void 0),Fe(this,Em,t),Fe(this,Tm,e),this.viewerCount=0}get telemetry(){return Ne(this,Tm).getValue("telemetry")}setLivestreamState(e){const t=this.state;this.state=e,t!==e&&this.emitCurrentLivestreamState()}emitCurrentLivestreamState(){this.emit("livestreamUpdate",this.state)}start(){return Be(this,arguments,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{manualIngestion:!1};return function*(){if(!Ne(e,Em).permissions.canLivestream)throw e.logger.error("Livestream::start::permission_denied"),new Uo("User does not have permission to start livestreaming","1901");e.setLivestreamState("STARTING");try{const i=fu(),{playbackUrl:r,ingestionCredentials:n}=yield i.startLivestreaming(t);e.playbackUrl=r,e.ingestionCredentials=n,null!=t&&t.manualIngestion&&e.setLivestreamState("WAITING_ON_MANUAL_INGESTION")}catch(i){throw e.logger.error("Recording::stop::livestream_failed_to_start",{error:i}),e.setLivestreamState("IDLE"),new Uo("Error while starting livestream","1900",e.logger)}}()})}stop(){return Be(this,null,function*(){if(!Ne(this,Em).permissions.canLivestream)throw this.logger.error("Livestream::stop::permission_denied"),new Uo("User does not have permission to stop livestreaming","1901");if("LIVESTREAMING"!==this.state&&"WAITING_ON_MANUAL_INGESTION"!==this.state)throw this.logger.error("Livestream::stop::inconsistent_state"),new Uo("Livestream not started yet","1902");try{this.setLivestreamState("STOPPING"),yield fu().stopLivestreaming()}catch(e){throw this.logger.error("Livestream::stop::livestream_failed_to_stop",{error:e}),this.setLivestreamState("STOPPING"),new Uo("Error while stopping livestream","1900",this.logger)}})}}Em=new WeakMap,Tm=new WeakMap,Cm([Mo.trace("livestream.start")],Am.prototype,"start",1),Cm([Mo.trace("livestream.stop")],Am.prototype,"stop",1);var Rm,Lm,Im,Mm,Dm=Object.defineProperty,Om=Object.getOwnPropertyDescriptor;class Nm{constructor(e,t,i){De(this,"livestream"),Ue(this,Rm,void 0),Ue(this,Lm,void 0),Ue(this,Im,void 0),Ue(this,Mm,void 0),Fe(this,Mm,e),Fe(this,Lm,t),this.livestream=new Am(e,t),Fe(this,Im,i),this.setupEvents()}get logger(){return Ne(this,Mm).getValue("logger")}get telemetry(){return Ne(this,Mm).getValue("telemetry")}fetchInitialLivestreamingState(){return Be(this,null,function*(){const e=fu(),{status:t,playbackUrl:i,manualIngest:r,ingestionCredentials:n}=yield e.getActiveLivestream();this.livestream.playbackUrl=i,this.livestream.ingestionCredentials=n,"LIVE"===t&&this.livestream.setLivestreamState("LIVESTREAMING"),"INVOKED"===t&&r&&this.livestream.setLivestreamState("WAITING_ON_MANUAL_INGESTION")})}setupEvents(){Ne(this,Im).on(Mh.startedLivestream,e=>Be(this,null,function*(){this.livestream.playbackUrl=e.playbackUrl,this.livestream.setLivestreamState("LIVESTREAMING");try{Ne(this,Lm).permissions.canLivestream&&(yield this.fetchInitialLivestreamingState())}catch(t){this.logger.error("Error: LivestreamController.fetchLivestream during startedLivestream re-fetch")}})),Ne(this,Im).on(Mh.livestreamingInvoked,e=>Be(this,null,function*(){if(e.manualIngest){this.livestream.setLivestreamState("WAITING_ON_MANUAL_INGESTION");try{Ne(this,Lm).permissions.canLivestream&&(yield this.fetchInitialLivestreamingState())}catch(t){this.logger.error("Error: LivestreamController.fetchLivestream during livestreamingInvoked re-fetch")}}})),Ne(this,Im).on(Mh.stoppedLivestream,()=>{this.livestream.setLivestreamState("IDLE"),this.livestream.playbackUrl=void 0,this.livestream.ingestionCredentials=void 0}),Ne(this,Im).on(Mh.erroredLivestream,()=>{this.livestream.setLivestreamState("IDLE"),this.livestream.playbackUrl=void 0}),Ne(this,Im).on(Mh.roomPeerCount,e=>{this.livestream.viewerCount=e.count,this.livestream.emit("viewerCountUpdate",e.count)}),Ne(this,Mm).getValue("peerSessionStore").on(Vo.PEER_JOINED_INTERNAL,e=>Be(this,null,function*(){var t;!0===(null==(t=e.flags)?void 0:t.hiddenParticipant)&&"LIVESTREAMER"===e.recorderType&&(Fe(this,Rm,e.id),this.livestream.setLivestreamState("LIVESTREAMING"))})),Ne(this,Mm).getValue("peerSessionStore").on(Vo.PEER_CLOSED,e=>{e.id===Ne(this,Rm)&&(Fe(this,Rm,void 0),this.livestream.setLivestreamState("IDLE"))}),Ne(this,Mm).getValue("peerSessionStore").onAsync(Vo.LEAVE_MEDIA_ROOM,()=>Be(this,null,function*(){if(!this.livestream.playbackUrl){this.logger.info("Fetching livestreaming state on leave stage");try{yield this.fetchInitialLivestreamingState()}catch(e){this.logger.error("Failed to fetch livestreaming state on leave stage",{error:e})}}})),Ne(this,Mm).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>Be(this,null,function*(){try{yield this.fetchInitialLivestreamingState()}catch(e){this.logger.error("Error: LivestreamController.fetchLivestream")}}))}}Rm=new WeakMap,Lm=new WeakMap,Im=new WeakMap,Mm=new WeakMap,((e,t,i,r)=>{for(var n,s=r>1?void 0:r?Om(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&Dm(t,i,s)})([Mo.trace("LivestreamController.setupEvents")],Nm.prototype,"setupEvents",1);var Um,Fm,jm,Bm,Vm,zm,Hm,$m,Gm,Wm,qm,Km,Zm,Ym=Object.defineProperty,Jm=Object.getOwnPropertyDescriptor,Qm=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Jm(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Ym(t,i,s),s};class Xm{constructor(e){let{name:t,socketHandler:i,meetingId:r}=e;Ue(this,Bm),De(this,"name",""),Ue(this,Um,{}),Ue(this,Fm,""),Ue(this,jm,void 0),De(this,"rateLimitConfig",{maxInvocations:5,period:1}),De(this,"bulkRateLimitConfig",{maxInvocations:5,period:1}),De(this,"listeners",{}),this.name=t,Fe(this,jm,i),Fe(this,Fm,r)}set(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Be(this,null,function*(){Ne(this,Um)[e]=t,i&&this.remoteSet(e,t),r&&(this.listeners[e]&&this.listeners[e].forEach(t=>t({[e]:Ne(this,Um)[e]})),this.listeners["*"]&&this.listeners["*"].forEach(t=>t({[e]:Ne(this,Um)[e]})))})}remoteSet(e,t){Ne(this,jm).storeInsertKeys(Ne(this,Fm),this.name,[{key:e,payload:t}])}bulkSet(e){return Be(this,null,function*(){e.forEach(e=>{let{key:t,payload:i}=e;Ne(this,Um)[t]=i}),Ne(this,jm).storeInsertKeys(Ne(this,Fm),this.name,e)})}update(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Be(this,null,function*(){je(this,Bm,Vm).call(this,e,t,i)})}delete(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Be(this,null,function*(){if(Ne(this,Um)[e]&&delete Ne(this,Um)[e],t)return Ne(this,jm).storeDeleteKeys(Ne(this,Fm),this.name,[{key:e}]);i&&(this.listeners[e]&&(this.listeners[e].forEach(t=>t({[e]:void 0})),delete this.listeners[e]),this.listeners["*"]&&this.listeners["*"].forEach(t=>t({[e]:void 0})))})}bulkDelete(e){return Be(this,null,function*(){return e.forEach(e=>{let{key:t}=e;Ne(this,Um)[t]&&delete Ne(this,Um)[t]}),Ne(this,jm).storeDeleteKeys(Ne(this,Fm),this.name,e)})}get(e){if(Ne(this,Um)[e])return Ne(this,Um)[e]}getAll(){return Ne(this,Um)}get rateLimits(){return this.rateLimitConfig}updateRateLimits(e,t){this.rateLimitConfig.maxInvocations=e,this.rateLimitConfig.period=t}get bulkRateLimits(){return this.bulkRateLimitConfig}updateBulkRateLimits(e,t){this.bulkRateLimitConfig.maxInvocations=e,this.bulkRateLimitConfig.period=t}subscribe(e,t){this.listeners[e]?this.listeners[e].push(t):this.listeners[e]=[t]}unsubscribe(e,t){var i;t?this.listeners[e]=(null==(i=this.listeners[e])?void 0:i.filter(e=>e!==t))||[]:this.listeners[e]&&delete this.listeners[e]}populate(e){Fe(this,Um,e)}}Um=new WeakMap,Fm=new WeakMap,jm=new WeakMap,Bm=new WeakSet,Vm=function(e,t){let i,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=Ne(this,Um)[e],s=Object.prototype.toString.call(t),a=Object.prototype.toString.call(n);if(s===a){switch(a){case"[object Array]":i=[...n,...t];break;case"[object Object]":i=Le(Le({},n),t);break;case"[object Map]":i=new Map([...n,...t]);break;case"[object Set]":i=new Set([...n,...t]);break;default:i=t}this.set(e,i,r)}else this.set(e,t)},Qm([vu(mu,"rateLimitConfig")],Xm.prototype,"remoteSet",1),Qm([vu(mu,"bulkRateLimitConfig")],Xm.prototype,"bulkSet",1),Qm([vu(mu,"rateLimitConfig")],Xm.prototype,"update",1),Qm([vu(mu,"rateLimitConfig")],Xm.prototype,"delete",1),Qm([vu(mu,"bulkRateLimitConfig")],Xm.prototype,"bulkDelete",1);class ev{constructor(e,t){Ue(this,$m),Ue(this,Km),De(this,"stores",new Map),Ue(this,zm,void 0),Ue(this,Hm,""),Ue(this,Wm,void 0),Ue(this,qm,new Map),Fe(this,zm,t),Fe(this,Hm,e.getValue("meetingId")),Fe(this,Wm,e),je(this,Km,Zm).call(this)}create(e){const t=new Xm({name:e,socketHandler:Ne(this,zm),meetingId:Ne(this,Hm)});return Ne(this,zm).storeGetKeys(Ne(this,Hm),e,[]),new Promise((i,r)=>{const n=setTimeout(()=>r(Error("Failed")),3e3);Ne(this,qm).set(e,{rejectTimeout:n,resolve:i,store:t})})}}function tv(e){var t,i,r,n,s,a,o,c,l,d,h,u,p;return e?{media:{audio:{enabled:e.audioEnabled,trackId:null==(t=e.audioTrack)?void 0:t.id,permission:"mediaPermissions"in e?null==(i=e.mediaPermissions)?void 0:i.audio:null},video:{enabled:e.videoEnabled,trackId:null==(r=e.videoTrack)?void 0:r.id,permission:"mediaPermissions"in e?null==(n=e.mediaPermissions)?void 0:n.video:null},screenshare:{enabled:e.screenShareEnabled,permission:"mediaPermissions"in e?null==(s=e.mediaPermissions)?void 0:s.screenshare:null,audio:{enabled:null==(o=null==(a=e.screenShareTracks)?void 0:a.audio)?void 0:o.enabled,trackId:null==(l=null==(c=e.screenShareTracks)?void 0:c.audio)?void 0:l.id},video:{enabled:null==(h=null==(d=e.screenShareTracks)?void 0:d.video)?void 0:h.enabled,trackId:null==(p=null==(u=e.screenShareTracks)?void 0:u.video)?void 0:p.id}}}}:{}}zm=new WeakMap,Hm=new WeakMap,$m=new WeakSet,Gm=function(){return Ne(this,Wm).getValue("peerId")},Wm=new WeakMap,qm=new WeakMap,Km=new WeakSet,Zm=function(){[Oh.storeInsertKeys,Oh.storeGetKeys,Oh.storeDeleteKeys].forEach(e=>{Ne(this,zm).on(e,t=>Be(this,null,function*(){var i,r;if(t.pluginId!==Ne(this,Hm))return;const n=null==(i=t.storeItems)?void 0:i.map(e=>{var t;return{timestamp:e.timestamp,peerId:e.peerId,payload:JSON.parse(null!=(t=e.payload)&&t.length?(new TextDecoder).decode(e.payload):"{}"),key:e.storeKey}});if(e===Oh.storeGetKeys){const e=Ne(this,qm).get(t.storeName),i=this.stores.get(t.storeName)||(null==e?void 0:e.store);return Ne(this,qm).get(t.storeName)&&(this.stores.set(t.storeName,e.store),e.resolve(i),clearTimeout(e.rejectTimeout),Ne(this,qm).delete(t.storeName)),void n.forEach(e=>{i.set(e.key,e.payload,!1,!1)})}const s=this.stores.get(t.storeName)||(null==(r=Ne(this,qm).get(t.storeName))?void 0:r.store);void 0!==s&&(e===Oh.storeInsertKeys&&n.forEach(e=>{let{key:t,peerId:i,payload:r}=e;i!==Ne(this,$m,Gm)&&s.set(t,r,!1,!0)}),e===Oh.storeDeleteKeys&&n.forEach(e=>{let{key:t,peerId:i}=e;i!==Ne(this,$m,Gm)&&s.delete(t,!1,!0)}))}))})};var iv=Object.defineProperty,rv=Object.getOwnPropertyDescriptor,nv=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?rv(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&iv(t,i,s),s};var sv,av,ov,cv,lv,dv,hv,uv,pv,gv,fv,mv,vv,bv,kv,yv,wv,Sv,xv,Ev,Tv,_v,Pv,Cv,Av;let Rv=(Av=class extends Ho{constructor(e,t,i,r){super(e.getValue("logger")),Ue(this,cv),Ue(this,dv),Ue(this,uv),Ue(this,gv),Ue(this,kv),Ue(this,xv),Ue(this,Tv),Ue(this,Pv),De(this,"id"),De(this,"userId"),De(this,"name"),De(this,"picture"),De(this,"isHost"),De(this,"customParticipantId"),De(this,"flags"),De(this,"device"),De(this,"videoTrack"),De(this,"audioTrack"),De(this,"screenShareTracks"),De(this,"videoEnabled"),De(this,"audioEnabled"),De(this,"screenShareEnabled"),De(this,"producers"),De(this,"manualProducerConfig"),Ue(this,sv,void 0),De(this,"supportsRemoteControl",!1),Ue(this,av,void 0),De(this,"presetName"),Ue(this,ov,void 0),Ue(this,mv,void 0),Ue(this,vv,void 0),Ue(this,bv,new Map),Ue(this,wv,1),Ue(this,Sv,Ra(e=>{if(!this.videoTrack)return;const{clientWidth:t,clientHeight:i}=e,{width:r,height:n}=this.videoTrack.getSettings();if(!r||!n)return;const s=n/i,a=r/t,o=Math.max(s,a);o>1.2&&1===Ne(this,wv)?(Fe(this,wv,0),Ne(this,ov).getValue("peerSessionStore").emit(Vo.MAX_SPATIAL_LAYER_CHANGE,{peerId:this.id,maxSpatialLayer:Ne(this,wv)})):o<.8&&0===Ne(this,wv)&&(Fe(this,wv,1),Ne(this,ov).getValue("peerSessionStore").emit(Vo.MAX_SPATIAL_LAYER_CHANGE,{peerId:this.id,maxSpatialLayer:Ne(this,wv)}))},2e3)),Fe(this,ov,e);const{id:n,userId:s,displayName:a,device:o,picture:c,isHost:l,flags:d,clientSpecificId:h,stageStatus:u,customParticipantId:p,audioMuted:g,audioTrack:f,videoEnabled:m=!1,videoTrack:v,producers:b,metadata:k}=t;this.id=n,this.userId=s,this.name=a,this.device=o,this.picture=c,this.isHost=l,this.flags=d,this.manualProducerConfig=So,Fe(this,av,null!=u?u:"ON_STAGE"),this.customParticipantId=null!=p?p:h,this.audioEnabled=!g,this.audioTrack=f,this.videoEnabled=m,this.videoTrack=v,this.screenShareTracks={audio:void 0,video:void 0},this.producers=null!=b?b:[],this.presetName=null==k?void 0:k.preset_name,Fe(this,sv,!1),Fe(this,mv,i),Fe(this,vv,r),this.setupEvents(),this.updateVideo=this.updateVideo.bind(this),je(this,xv,Ev).call(this)}get clientSpecificId(){return this.customParticipantId}get stageStatus(){return Ne(this,av)}get telemetry(){return Ne(this,ov).getValue("telemetry")}setVideoEnabled(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.videoEnabled=e,t&&(this.logger.info("Participant::setVideoEnabled::videoUpdate",Le({},tv(this))),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}))}setAudioEnabled(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.audioEnabled=e,t&&(this.logger.info("Participant::setAudioEnabled::audioUpdate",Le({},tv(this))),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack}))}setScreenShareEnabled(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.screenShareEnabled=e,t&&this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})}setupEvents(){this.on("videoUpdate",je(this,xv,Ev)),Ne(this,dv,hv)&&(this.on("audioUpdate",je(this,Tv,_v)),this.on("screenShareUpdate",je(this,Pv,Cv)))}pin(){return Be(this,null,function*(){if(!Ne(this,uv,pv))throw new Uo("Can`t pin participant without joining room","1205");if(!Ne(this,mv).permissions.pinParticipant)throw new Uo("You do not have permission to pin participants.","1201");return Ne(this,cv,lv).pinPeer(this.id)})}unpin(){return Be(this,null,function*(){if(!Ne(this,uv,pv))throw new Uo("Can`t unpin participant without joining room","1205");if(!Ne(this,mv).permissions.pinParticipant)throw new Uo("You do not have permission to unpin participants.","1201");return Ne(this,cv,lv).pinPeer(null)})}setIsPinned(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i;Fe(this,sv,e);const r=e?"pinned":"unpinned";null==(i=Ne(this,kv,yv))||i.updateSource(this.id,{pinned:e}),t&&this.emit(r,this)}disableAudio(){return Be(this,null,function*(){const e=this.id;if(this.logger.info("Participant::disable_audio",{participant:{id:e}}),!Ne(this,uv,pv))throw new Uo("Can`t disable participant audio without joining room","1205");if(Ne(this,mv).permissions.canDisableParticipantAudio)return Ne(this,cv,lv).disableAudio(e);throw this.logger.error("Participant::unauthorized_disable_audio",{participant:{id:e}}),new Uo("Unauthorized: User does not have permission to disable participant audio.","1201")})}kick(){return Be(this,null,function*(){const e=this.id;if(this.logger.info("Participant::kick",{participant:{id:e}}),!Ne(this,gv,fv))throw new Uo("Can`t kick participant without joining room","1205");if(!Ne(this,mv).permissions.kickParticipant)throw this.logger.error("Participant::unauthorized_kick",{participant:{id:e}}),new Uo("Unauthorized: User does not have permission to kick participants.","1201");yield Ne(this,ov).getValue("peerSessionStore").emitAsync(Vo.KICK_PEER,{peerId:e})})}disableVideo(){return Be(this,null,function*(){const e=this.id;if(this.logger.info("Participant::disable_video",{participant:{id:e}}),!Ne(this,uv,pv))throw new Uo("Can`t disable participant video without joining room","1205");if(Ne(this,mv).permissions.canDisableParticipantVideo)return Ne(this,cv,lv).disableVideo(e);throw this.logger.error("Participant::unauthorized_disable_video",{participant:{id:e}}),new Uo("Unauthorized: User does not have permission to disable participant video.","1201")})}getPermissions(){return Be(this,null,function*(){return Ne(this,vv).getUserPermissions(this.userId)})}setStageStatus(e){Fe(this,av,e),this.emit("stageStatusUpdate",this)}get isPinned(){return Ne(this,sv)}registerVideoElement(e){var t,i,r,n;if(!e)return;let s;null==(i=null==(t=Ne(this,bv).get(e))?void 0:t.observer)||i.disconnect(),"ResizeObserver"in window&&(s=new ResizeObserver(()=>Ne(this,Sv).call(this,e)),s.observe(e)),Ne(this,bv).set(e,{observer:s}),this.updateVideo(e),null==(n=Ne(this,kv,yv))||n.addSource(this.id,e,this.videoEnabled,this.isPinned,this.name,this.picture,null!=(r=this.raised)&&r)}deregisterVideoElement(e){var t,i,r,n;e?(e.srcObject=void 0,null==(r=null==(i=Ne(this,bv).get(e))?void 0:i.observer)||r.disconnect(),Ne(this,bv).delete(e),null==(n=Ne(this,kv,yv))||n.removeSource(this.id)):null==(t=Ne(this,kv,yv))||t.removeSource(this.id)}updateVideo(e){var t;if(this.videoEnabled){if(null==this.videoTrack)return;const i=null==(t=e.srcObject)?void 0:t.getTracks()[0];if((null==i?void 0:i.id)===this.videoTrack.id)return;const r=new MediaStream;r.addTrack(this.videoTrack),e.srcObject=r}else e.srcObject=void 0;e.style.display=this.videoEnabled?"block":"none"}},sv=new WeakMap,av=new WeakMap,ov=new WeakMap,cv=new WeakSet,lv=function(){return Ne(this,ov).getValue("roomNodeClient")},dv=new WeakSet,hv=function(){return Ne(this,ov).getValue("audioPlayback")},uv=new WeakSet,pv=function(){return Ne(this,ov).getValue("connectionHandler").mediaJoined},gv=new WeakSet,fv=function(){return Ne(this,ov).getValue("connectionHandler").socketJoined},mv=new WeakMap,vv=new WeakMap,bv=new WeakMap,kv=new WeakSet,yv=function(){return Ne(this,ov).getValue("pip")},wv=new WeakMap,Sv=new WeakMap,xv=new WeakSet,Ev=function(){Array.from(Ne(this,bv).keys()).forEach(this.updateVideo)},Tv=new WeakSet,_v=function(){var e,t;this.audioEnabled&&this.audioTrack?null==(e=Ne(this,dv,hv))||e.addParticipantTrack(this.id,this.audioTrack):null==(t=Ne(this,dv,hv))||t.removeParticipantTrack(this.id)},Pv=new WeakSet,Cv=function(){var e,t;this.screenShareEnabled&&this.screenShareTracks.audio?null==(e=Ne(this,dv,hv))||e.addParticipantTrack("screenshare-".concat(this.id),this.screenShareTracks.audio):null==(t=Ne(this,dv,hv))||t.removeParticipantTrack("screenshare-".concat(this.id))},Av);nv([Mo.trace("Participant.disableAudio")],Rv.prototype,"disableAudio",1),nv([Mo.trace("Participant.kick")],Rv.prototype,"kick",1),nv([Mo.trace("Participant.disableVideo")],Rv.prototype,"disableVideo",1),nv([Mo.trace("Participant.getPermissions")],Rv.prototype,"getPermissions",1),nv([Mo.trace("Participant.setStageStatus")],Rv.prototype,"setStageStatus",1),Rv=nv([Bo("1200")],Rv);class Lv extends Pg{constructor(e,t){const{onAddEvent:i="participantJoined",onDeleteEvent:r="participantLeft",onClearEvent:n="participantsCleared"}=null!=t?t:{};super({onAddEvent:i,onDeleteEvent:r,onClearEvent:n},e)}add(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.has(e.id)&&!1===Object.is(this.get(e.id),e)&&this.delete(e.id),super.add(e,t)}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return super.clear(e,t)}delete(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return super.delete(e,t,i)}}var Iv;class Mv extends zo{constructor(e){super(e),Ue(this,Iv,void 0),Fe(this,Iv,new Map)}__set(e,t){return Ne(this,Iv).set(e,t)}__clear(){return Ne(this,Iv).clear()}get(e){return Ne(this,Iv).get(e)}toArray(){return Array.from(Ne(this,Iv).values())}}Iv=new WeakMap;class Dv{constructor(){De(this,"_orderedArray"),De(this,"_map"),this._map=new Map,this._orderedArray=[]}add(e,t){if(!this._map.has(e))return this._map.set(e,{peerId:e,priority:t}),this._orderedArray.splice(Math.max(t-1,0),0,e),this.index(e);const i=this.index(e);this.delete(e);const r=this.add(e,t);return i!==r?r:-1}delete(e){if(this._map.has(e)){const t=this.index(e);this._map.delete(e),this._orderedArray.splice(t,1)}}index(e){return this._map.has(e)?this._orderedArray.indexOf(e):-1}[Symbol.iterator](){return this._orderedArray[Symbol.iterator]()}}const Ov=new class{constructor(){De(this,"_activeSpeakerPeers"),De(this,"_compulsoryPeers"),this._activeSpeakerPeers=new Dv,this._compulsoryPeers=new Set}add(e,t,i){if(!e)return-1;if(t<0)return this._compulsoryPeers.add(e),0;const r=i.getValue("logger");if(this.compulsoryPeers.includes(e)&&(t>0||246267631===t)){if(r.info("SelectedPeer::removing_compulsory_peer",{selectedPeer:{peerId:e}}),this._removeFromCompulsoryPeer(e),246267631===t)return-1}else if(229490415===t)return this.delete(e,i),-1;return this._activeSpeakerPeers.add(e,t)}delete(e,t){const i=null==t?void 0:t.getValue("logger");null==i||i.info("SelectedPeer::deleting_peer_from_selectedPeer",{selectedPeer:{peerId:e}}),this._removeFromCompulsoryPeer(e),this._activeSpeakerPeers.delete(e)}index(e){return this._activeSpeakerPeers.index(e)}get peers(){return Array.from(new Set(this.compulsoryPeers.concat(this.activeSpeakerPeers)))}get compulsoryPeers(){return Array.from(this._compulsoryPeers.values())}get activeSpeakerPeers(){return Array.from(this._activeSpeakerPeers)}_removeFromCompulsoryPeer(e){this._compulsoryPeers.delete(e)}};var Nv=Object.defineProperty,Uv=Object.getOwnPropertyDescriptor,Fv=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Uv(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Nv(t,i,s),s};const jv=["ACTIVE_GRID","PAGINATED","MANUAL"];var Bv,Vv,zv,Hv,$v,Gv,Wv,qv,Kv,Zv;let Yv=(Zv=class extends Ho{constructor(e,t,i){const r=e.getValue("logger");super(r),Ue(this,Vv),Ue(this,Hv),Ue(this,Gv),De(this,"waitlisted"),De(this,"joined"),De(this,"active"),De(this,"videoSubscribed"),De(this,"audioSubscribed"),De(this,"pinned"),De(this,"all"),Ue(this,Bv,void 0),Ue(this,qv,void 0),Ue(this,Kv,void 0),De(this,"rateLimitConfig",{maxInvocations:5,period:1}),De(this,"viewMode"),De(this,"currentPage"),De(this,"lastActiveSpeaker"),De(this,"selectedPeers",Ov),Fe(this,Bv,e),Fe(this,qv,t),Fe(this,Kv,i),this.waitlisted=new Lv(r),this.joined=new Lv(r),this.videoSubscribed=new Lv(r),this.audioSubscribed=new Lv(r),this.active=this.videoSubscribed,this.pinned=new Lv(r),this.all=new Mv(r),this.viewMode="ACTIVE_GRID",this.currentPage=0,this.setupEvents()}get pip(){return Ne(this,Bv).getValue("pip")}get rateLimits(){return this.rateLimitConfig}updateRateLimits(e,t){this.rateLimitConfig.maxInvocations=e,this.rateLimitConfig.period=t}get telemetry(){return Ne(this,Bv).getValue("telemetry")}setupEvents(){Ne(this,Bv).getValue("peerSessionStore").on(Vo.E2EE_ACTIVE_CONSUMER,e=>{let{peerId:t}=e;var i;!0!==(null==(i=Ne(this,Bv).getValue("modules").e2ee)?void 0:i.enabled)&&this.emit("media_decode_error",{reason:"Got encrypted media for participantId ".concat(t,", but encryption wasn't enabled in init.defaults"),code:"1702"})});const e=Ne(this,Bv).getValue("audioPlayback");e&&this.audioSubscribed.on("participantLeft",t=>{e.removeParticipantTrack(t.id)})}get count(){return this.joined.size}get maxActiveParticipantsCount(){var e;return null==(e=Ne(this,Bv))?void 0:e.getValue("maxPreferredStreams")}setMaxActiveParticipantsCount(e){if(e<0||e>24)throw new Uo("0 <= Max active participants count limit <= 24","1203");Ne(this,Bv).setValue("maxPreferredStreams",e),Ne(this,Gv,Wv)&&Ne(this,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.viewMode,page:this.currentPage})}get pageCount(){if("PAGINATED"===this.viewMode){const e=this.selectedPeers.compulsoryPeers.length,t=this.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus);return Math.ceil((t.length-e)/Math.max(this.maxActiveParticipantsCount-e,1))}return 0}acceptWaitingRoomRequest(e){var t,i;if(!Ne(this,Hv,$v))throw new Uo("Can`t accept waiting room request without joining room","1205");const r=null!=(i=null==(t=this.waitlisted.get(e))?void 0:t.userId)?i:e;return Ne(this,Kv).acceptWaitingRoomRequest([r])}acceptAllWaitingRoomRequest(e){return Be(this,null,function*(){const t=e.map(e=>{var t,i;return null!=(i=null==(t=this.waitlisted.get(e))?void 0:t.userId)?i:e});return Ne(this,Kv).acceptWaitingRoomRequest(t)})}rejectWaitingRoomRequest(e){return Be(this,null,function*(){var t,i;if(!Ne(this,Hv,$v))throw new Uo("Can`t reject waiting room request without joining room","1205");const r=null!=(i=null==(t=this.waitlisted.get(e))?void 0:t.userId)?i:e;Ne(this,Kv).rejectWaitingRoomRequest([r])})}setViewMode(e){return Be(this,null,function*(){if(this.logger.info("Participants::set_view_mode",{pageNavigation:{viewMode:e,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),t=e,!jv.includes(t))throw this.logger.error("Participants::setViewMode::invalid_view_mode",{pageNavigation:{viewMode:e,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),new Uo("Invalid view mode: ".concat(e,". Try ACTIVE_GRID, PAGINATED or MANUAL."),"1207");var t;this.viewMode!==e?(this.viewMode=e,"PAGINATED"===e?(this.currentPage=1,Ne(this,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:e,page:this.currentPage})):("ACTIVE_GRID"===e||"MANUAL"===e)&&(this.currentPage=0,Ne(this,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:e,page:this.currentPage})),this.emit("viewModeChanged",{viewMode:e,currentPage:this.currentPage,pageCount:this.pageCount})):this.logger.info("Participants::setViewMode::view_mode_same_as_previous")})}subscribe(e){return Be(this,arguments,function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["audio","video","screenshareAudio","screenshareVideo"];return function*(){if("MANUAL"!==t.viewMode)throw new Uo("MANUAL subscription mode was not activated.","1206");e.forEach(e=>{const r=t.joined.get(e);r&&(i.includes("audio")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{audio:!0}),t.audioSubscribed.has(r.id)||t.audioSubscribed.add(r)),i.includes("video")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{video:!0}),t.videoSubscribed.has(r.id)||t.videoSubscribed.add(r)),i.includes("screenshareAudio")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{screenshareAudio:!0}),t.audioSubscribed.has(r.id)||t.audioSubscribed.add(r)),i.includes("screenshareVideo")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{screenshareVideo:!0}),t.videoSubscribed.has(r.id)||t.videoSubscribed.add(r)))}),Ne(t,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:t.viewMode,page:t.currentPage})}()})}unsubscribe(e){return Be(this,arguments,function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["audio","video","screenshareAudio","screenshareVideo"];return function*(){if("MANUAL"!==t.viewMode)throw new Uo("MANUAL subscription mode was not activated.","1206");e.forEach(e=>{const r=t.joined.get(e);r&&(i.includes("audio")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{audio:!1}),r.manualProducerConfig.screenshareAudio||t.audioSubscribed.delete(r.id)),i.includes("video")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{video:!1}),r.manualProducerConfig.screenshareVideo||t.videoSubscribed.delete(r.id)),i.includes("screenshareAudio")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{screenshareAudio:!1}),r.manualProducerConfig.audio||t.audioSubscribed.delete(r.id)),i.includes("screenshareVideo")&&(r.manualProducerConfig=Ie(Le({},r.manualProducerConfig),{screenshareVideo:!1}),r.manualProducerConfig.video||t.videoSubscribed.delete(r.id)))}),Ne(t,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:t.viewMode,page:t.currentPage})}()})}getPeerIdsForCurrentPage(){this.logger.info("Participants::getPeerIdsForCurrentPage()",{pageNavigation:{viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}});const{compulsoryPeers:e}=this.selectedPeers,t=e.filter(e=>this.joined.has(e)),i=Array.from(this.pinned.keys()).filter(e=>!t.includes(e)),r=Array.from(this.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus).map(e=>e.id)),n=Math.max((this.currentPage-1)*(this.maxActiveParticipantsCount-t.length-i.length)),s=this.currentPage*(this.maxActiveParticipantsCount-t.length-i.length);return t.concat(i,r.slice(n,s))}setPage(e){return Be(this,null,function*(){if(this.logger.info("Participants::set_page",{pageNavigation:{settingPage:e,viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),"PAGINATED"===this.viewMode){if(!Number.isInteger(e))throw this.logger.error("Participants::invalid_page_number"),new Uo("Invalid page: ".concat(e,". Page must be an integer and greater than 0 and less than or equal to .pageCount"),"1202");this.currentPage=e,Ne(this,Bv).getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.viewMode,page:e}),this.emit("pageChanged",{viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount})}})}disableAllAudio(e){return Be(this,null,function*(){if(this.logger.info("Participants::disable_all_audio",{actions:{disableAllAudio:{allowUnmute:e}}}),!Ne(this,Gv,Wv))throw new Uo("Can`t disable all audio without joining room","1205");if(Ne(this,qv).permissions.canAllowParticipantAudio)return Ne(this,Vv,zv).muteAll(e);throw this.logger.error("Participants::unauthorized_disable_all_audio",{actions:{disableAllAudio:{allowUnmute:e}}}),new Uo("Unauthorized: User does not have permission to disable peer audio.","1201")})}disableAllVideo(){return Be(this,null,function*(){if(this.logger.info("Participants::disable_all_video"),!Ne(this,Gv,Wv))throw new Uo("Can`t disable all video without joining room","1205");if(Ne(this,qv).permissions.canAllowParticipantVideo)return Ne(this,Vv,zv).muteAllVideo();throw this.logger.error("Participants::unauthorized_disable_all_video"),new Uo("Unauthorized: User does not have permission to disable peer video.","1201")})}disableAudio(e){return Be(this,null,function*(){this.joined.get(e).disableAudio()})}disableVideo(e){return Be(this,null,function*(){this.joined.get(e).disableVideo()})}kick(e){return Be(this,null,function*(){yield Ne(this,Bv).getValue("peerSessionStore").emitAsync(Vo.KICK_PEER,{peerId:e})})}kickAll(){return Be(this,null,function*(){if(this.logger.info("Participants::kick_all"),"LIVESTREAM"!==Ne(this,Bv).getValue("viewType")&&!Ne(this,Hv,$v))throw new Uo("Can`t kick all without joining room","1205");if(!Ne(this,qv).permissions.kickParticipant)throw this.logger.error("Participants::unauthorized_kick_all"),new Uo("Unauthorized: User does not have permission to kick peers.","1201");const e=Ne(this,Bv).getValue("flagsmith").hasFeature($a);Ne(this,Kv).kickAll(e)})}broadcastMessage(e,t,i){return Be(this,null,function*(){if(this.logger.info("Participants::broadcastMessage"),!Ne(this,Hv,$v))throw new Uo("Can`t broadcast message without joining room","1205");if(null==e||!e.trim())throw new Uo("`type` must be a non-empty string.","1209");if(i)if("meetingIds"in i)yield Ne(this,Kv).broadcastToMeetings(e,i.meetingIds,t);else{let r=[];r="participantIds"in i?i.participantIds:this.joined.toArray().filter(e=>{var t;return null==(t=i.presetNames)?void 0:t.includes(e.presetName)}).map(e=>e.id),yield Ne(this,Kv).broadcastToPeers(e,r,t)}else yield Ne(this,Kv).broadcastMessage(e,t)})}getAllJoinedPeers(e,t,i){return Be(this,null,function*(){return(yield Ne(this,Kv).getRoomPeers(e,t,i)).peers.map(sb.formatSocketPeerMessage)})}updatePermissions(e,t){return Be(this,null,function*(){const i=this.joined.toArray().filter(t=>e.includes(t.id)).map(e=>e.userId),r=[...new Set(i)];if(!r.length)throw new Uo("Cannot update permissions, no valid userIDs found","1204");Ne(this,Kv).updatePermissions(r,t)})}getParticipantsInMeetingPreJoin(){return Be(this,null,function*(){return Ne(this,Kv).getRoomPeersNonPaginated()})}},Bv=new WeakMap,Vv=new WeakSet,zv=function(){return Ne(this,Bv).getValue("roomNodeClient")},Hv=new WeakSet,$v=function(){var e;return!0===(null==(e=Ne(this,Bv).getValue("connectionHandler"))?void 0:e.socketJoined)},Gv=new WeakSet,Wv=function(){var e;return!0===(null==(e=Ne(this,Bv).getValue("connectionHandler"))?void 0:e.mediaJoined)},qv=new WeakMap,Kv=new WeakMap,Zv);Fv([Mo.trace("Participants.setViewMode")],Yv.prototype,"setViewMode",1),Fv([Mo.trace("Participants.setPage")],Yv.prototype,"setPage",1),Fv([Mo.trace("Participants.disableAllAudio")],Yv.prototype,"disableAllAudio",1),Fv([Mo.trace("Participants.disableAllVideo")],Yv.prototype,"disableAllVideo",1),Fv([Mo.trace("Participants.disablePeerAudio")],Yv.prototype,"disableAudio",1),Fv([Mo.trace("Participants.disablePeerVideo")],Yv.prototype,"disableVideo",1),Fv([Mo.trace("Participants.kickPeer")],Yv.prototype,"kick",1),Fv([Mo.trace("Participants.kickAll")],Yv.prototype,"kickAll",1),Fv([Mo.trace("Participants.broadcastMessage"),vu(mu,"rateLimitConfig")],Yv.prototype,"broadcastMessage",1),Fv([Mo.trace("Participants.getAllJoinedPeers"),vu({maxInvocations:10,period:60})],Yv.prototype,"getAllJoinedPeers",1),Fv([Mo.trace("Participant.updatePermissions"),vu({maxInvocations:1e3,period:60})],Yv.prototype,"updatePermissions",1),Fv([Mo.trace("Participants.getParticipantsInMeetingPreJoin")],Yv.prototype,"getParticipantsInMeetingPreJoin",1),Yv=Fv([Bo("1200")],Yv);var Jv,Qv,Xv,eb,tb=Object.defineProperty,ib=Object.getOwnPropertyDescriptor,rb=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?ib(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&tb(t,i,s),s};const nb=(eb=class{constructor(e,t,i){De(this,"participants"),De(this,"self"),De(this,"selectedPeers",Ov),De(this,"maxSpatialLayerUpdates",new Map),De(this,"consumerPeerMap"),De(this,"events"),De(this,"roomSocketHandler"),De(this,"context"),De(this,"videoPeerConsumerMap",new Map),Ue(this,Jv,{mode:"ACTIVE_GRID",page:0}),Ue(this,Qv,!1),Ue(this,Xv,!1),De(this,"updateConsumerSpatialLayers",Ra(()=>{const e={},t=new Map(this.maxSpatialLayerUpdates);this.maxSpatialLayerUpdates.clear(),Array.from(t.entries()).forEach(t=>{let[i,r]=t;void 0===e[r]&&(e[r]={layer:r,consumerIds:[]}),e[r].consumerIds.push(i)}),Object.keys(e).forEach(t=>{const i=e[t];this.logger.log("Switching max spatial layer to ".concat(i.layer),{consumerIds:i.consumerIds}),this.roomNodeClient.switchConsumersToLayer(i.consumerIds,i.layer)})},2e3)),De(this,"updateConsumers",(e,t)=>Be(this,null,function*(){this.logger.info("updateConsumers: Starting consumer updates - AddProducers: ".concat(e.length,", RemoveProducers: ").concat(t.length,", ConsumersSyncing: ").concat(Ne(this,Qv)));try{0!==e.length&&(this.logger.info("updateConsumers: Creating consumers for ".concat(e.length," producers: [").concat(e.map(e=>e.producerId).join(", "),"]")),yield this.roomNodeClient.createConsumers(e),this.logger.info("updateConsumers: Successfully created consumers."))}catch(i){this.logger.error("updateConsumers: Error creating consumers",{error:i})}try{0!==t.length&&(this.logger.info("updateConsumers: Closing consumers for ".concat(t.length," producers: [").concat(t.map(e=>e.producerId).join(", "),"]")),yield this.roomNodeClient.closeConsumers(t),this.logger.info("updateConsumers: Successfully closed consumers."))}catch(i){this.logger.error("updateConsumers: Error closing consumers",{error:i})}this.logger.info("updateConsumers: Completed consumer updates.")})),this.context=e,this.roomSocketHandler=i,this.participants=new Yv(e,t,this.roomSocketHandler),this.self=t,this.consumerPeerMap=new Map,this.events=jh,"CHAT"!==t.config.viewType&&this.setupEventsGlobal(),this.setupEvents()}get roomNodeClient(){return this.context.getValue("roomNodeClient")}get mediaJoined(){var e;return!0===(null==(e=this.roomNodeClient)?void 0:e.mediaJoined)}get pip(){return this.context.getValue("pip")}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}setupEvents(){this.roomSocketHandler.on(Mh.getWaitingRoomRequests,this.waitingRoomRequestHandler.bind(this)),this.context.getValue("peerSessionStore").on(Vo.SOCKET_PEERS,e=>Be(this,null,function*(){const t=this.context.getValue("flagsmith").hasFeature(uo);if(t){const t=e&&(null==e?void 0:e.length)<20?{peers:JSON.stringify(e.map(e=>e.peerId))}:void 0;this.logger.info("Processing socket peers",t)}null==e||e.forEach(e=>{e.waitlisted||this.onParticipantSocketJoined(this.createParticipantObjFromSocketPeer(e))}),t&&this.logger.info("Processed socket peers")})),this.roomSocketHandler.on(this.events.peerJoinedBroadcast,e=>{let{participant:t}=e;this.logger.info("PEER_INFO:::MEDIA_JOIN",{participant:{id:t.peerId,maskedName:[...(null==t?void 0:t.displayName)||""].map((e,t)=>t%2?"*":e).join("")}}),this.logger.info("events.peerJoinedBroadcast",{peers:t.peerId}),this.onParticipantMediaJoined(t.peerId,t.producerStates,t.capabilities)}),this.roomSocketHandler.on(this.events.selfJoinComplete,e=>{let{participants:t,selectedPeers:i,roomState:r}=e;if(this.context.getValue("flagsmith").hasFeature(uo)){const e=t&&(null==t?void 0:t.length)<20?{peers:JSON.stringify(t.map(e=>e.peerId))}:void 0;this.logger.info("events.selfJoinComplete",e)}t.forEach(e=>{let{peerId:t,producerStates:i,capabilities:r}=e;return this.onParticipantMediaJoined(t,i,r)});const{audioPeers:n,compulsoryPeers:s}=null!=i?i:{};0!==r.pinnedPeerIds.length&&this.onParticipantPinned(r.pinnedPeerIds[0]),this.computeActivateParticipants(null!=n?n:[],s),this.logger.info("selfJoinComplete: Emitting UPDATE_ACTIVE with createAllConsumers=true"),this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{createAllConsumers:!0})}),this.context.getValue("peerSessionStore").on(Vo.MAX_SPATIAL_LAYER_CHANGE,e=>{let{peerId:t,maxSpatialLayer:i}=e;const r=this.videoPeerConsumerMap.get(t);r&&(this.context.getValue("flagsmith").hasFeature(yo)||(this.maxSpatialLayerUpdates.set(r,i),this.updateConsumerSpatialLayers()))}),this.context.getValue("peerSessionStore").on(Vo.NEW_PRODUCER,e=>{let{peerId:t,producer:i}=e;const r=this.participants.joined.get(t);r?(r.producers.push(i),this.logger.info("ParticipantController::NEW_PRODUCER::producer_added_to_participant",{producer:{id:null==i?void 0:i.producerId,peerId:t,kind:null==i?void 0:i.kind,status:"not_initialized",appData:{screenShare:null==i?void 0:i.screenShare}}}),"audio"===(null==i?void 0:i.kind)&&this.participants.audioSubscribed.get(t)||"video"===(null==i?void 0:i.kind)&&this.participants.videoSubscribed.get(t)||null!=i&&i.screenShare?(this.logger.info("NEW_PRODUCER: scheduling syncConsumer (AUTO mode) - Producer: ".concat(i.producerId,", Peer: ").concat(t,", Kind: ").concat(i.kind,", ScreenShare: ").concat(i.screenShare,", ConsumersSyncing: ").concat(Ne(this,Qv),", VideoSub: ").concat("video"===i.kind?this.participants.videoSubscribed.has(t):"N/A",", AudioSub: ").concat("audio"===i.kind?this.participants.audioSubscribed.has(t):"N/A")),this.scheduleSyncConsumers({source:"NEW_PRODUCER_AUTO"})):this.logger.info("ParticipantController::NEW_PRODUCER::not_consuming_producer_auto",{producer:{id:null==i?void 0:i.producerId,peerId:t,kind:null==i?void 0:i.kind,status:"UNKNOWN",appData:{screenShare:null==i?void 0:i.screenShare}}})):this.logger.warn("ParticipantController::NEW_PRODUCER::participant not found",{producer:{id:null==i?void 0:i.producerId,kind:null==i?void 0:i.kind,status:"not_initialized",appData:{screenShare:null==i?void 0:i.screenShare}},participant:{id:t}})}),this.context.getValue("peerSessionStore").on(Vo.PRODUCER_CLOSED,e=>{let{peerId:t,producerId:i}=e;const r=this.participants.joined.get(t);r?r.producers=r.producers.filter(e=>e.producerId!==i):this.logger.warn("ParticipantController::NEW_PRODUCER::participant not found",{participant:{id:t}})}),this.context.getValue("peerSessionStore").on(Vo.PRODUCER_TOGGLE,e=>{let{peerId:t,producerId:i,paused:r,kind:n}=e;const s=this.participants.joined.get(t);if(s){"audio"===n&&s.setAudioEnabled(!r);const e=s.producers.find(e=>e.producerId===i);e&&(e.pause=r),"video"===n&&this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})}}),this.roomSocketHandler.on(this.events.globalPeerPinBroadcast,e=>{let t;if(e&&(t=e.participantId),!this.mediaJoined)return;const i=t;this.onParticipantPinned(i);const r=this.participants.joined.get(i);r&&(this.logger.info("globalPeerPinBroadcast: Scheduling audio/video consumer sync for pinned participant ".concat(i," - ProducerCount: ").concat(r.producers.length,", ConsumersSyncing: ").concat(Ne(this,Qv),", ProducerIds: [").concat(r.producers.map(e=>e.producerId).join(", "),"]")),this.scheduleSyncConsumers({source:"GLOBAL_PEER_PIN"}))}),this.roomSocketHandler.on(this.events.selectedPeer,e=>{let{audioPeers:t,compulsoryPeers:i}=e;this.mediaJoined&&this.onSelectedPeers(i.concat(t))}),this.roomSocketHandler.on(this.events.selectedPeerDiff,e=>{let{entries:t}=e;if(!this.mediaJoined)return;const i=t.map(e=>({peerId:e.peerId,priority:e.priority}));this.updateActiveParticipantsWithPriorities(i,!0)})}waitingRoomRequestHandler(e){const t=e.requests.filter(e=>!this.participants.waitlisted.toArray().find(t=>t.userId===e.userId)),i=this.participants.waitlisted.toArray().filter(t=>!e.requests.find(e=>e.userId===t.userId));t.forEach(e=>this.participants.waitlisted.add(new Rv(this.context,{id:e.peerId,displayName:e.displayName,audioMuted:!0,videoEnabled:!1,audioTrack:void 0,videoTrack:void 0,stageStatus:"OFF_STAGE",userId:e.userId,flags:{},isHost:!1,customParticipantId:e.customParticipantId,picture:e.picture,metadata:{preset_name:e.presetName}},this.self,this.roomSocketHandler))),i.forEach(e=>this.participants.waitlisted.delete(e.id))}get maxPreferredStreams(){return this.participants.maxActiveParticipantsCount}selectPagePeers(e){const{compulsoryPeers:t}=this.selectedPeers,i=t.filter(e=>this.participants.joined.has(e)),r=Array.from(this.participants.pinned.keys()).filter(e=>!i.includes(e)),n=Array.from(this.participants.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus).map(e=>e.id)),s=Math.max((e-1)*(this.maxPreferredStreams-i.length-r.length)),a=e*(this.maxPreferredStreams-i.length-r.length);return i.concat(r,n.slice(s,a))}selectActivePeers(e){const t=new Map,i=Array.from(this.participants.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus).map(e=>(t.set(e.id,!0),e.id))),r=this.selectedPeers.peers,n=this.participants.pinned.toArray().reduce((e,t)=>("ON_STAGE"!==t.stageStatus?this.participants.pinned.delete(t.id):e.push(t.id),e),[]),s=e-("ON_STAGE"===this.self.stageStatus?1:0),a=new Set(r.concat(n).filter(e=>e!==this.self.id&&t.has(e)));let o=Array.from(a);const c=s-a.size;if(c>=0){const e=i.filter(e=>!a.has(e)&&e!==this.self.id).slice(0,c);o=Array.from(a).concat(e)}else o=o.slice(0,s);return o}updateMediaSubscribedMaps(e,t){const{page:i}=null!=t?t:{};e&&Ne(this,Jv).mode!==e&&(Ne(this,Jv).mode=e),i&&Ne(this,Jv).page!==i&&(Ne(this,Jv).page=i);const{mode:r,page:n}=Ne(this,Jv);switch(r){case"PAGINATED":{if(!n)return;const e=this.selectPagePeers(n),t=this.selectActivePeers(this.participants.maxActiveParticipantsCount+4);this.updateParticipantsMap(this.participants.videoSubscribed,e),this.updateParticipantsMap(this.participants.audioSubscribed,t),this.logger.debug("ParticipantController::updateActive::updating_current_page_peers",{peerIds:e});break}case"ACTIVE_GRID":{const e=this.selectActivePeers(this.participants.maxActiveParticipantsCount),t=this.selectActivePeers(this.participants.maxActiveParticipantsCount+4);this.updateParticipantsMapMinReplacement(this.participants.videoSubscribed,e),this.updateParticipantsMap(this.participants.audioSubscribed,t);break}case"MANUAL":break;default:throw new Error("View mode ".concat(e," not supported"))}}scheduleSyncConsumers(e){return Be(this,arguments,function(e){var t=this;let{source:i}=e;return function*(){var e,r,n;const s="PAGINATED"!==(null==(e=Ne(t,Jv))?void 0:e.mode)||Ne(t,Qv)?0:200;t.logger.info("scheduleSyncConsumers():: Source: ".concat(i,", ViewMode: ").concat(null==(r=Ne(t,Jv))?void 0:r.mode,", ConsumersSyncing: ").concat(Ne(t,Qv),", Delay: ").concat(s,", Page: ").concat(null==(n=Ne(t,Jv))?void 0:n.page)),setTimeout(()=>t.syncConsumers(),s)}()})}syncConsumers(){return Be(this,null,function*(){var e,t,i,r,n;if("connected"!==(null==(i=null==(t=null==(e=this.context.getValue("connectionHandler"))?void 0:e.mediaState)?void 0:t.recv)?void 0:i.state))return void this.logger.info("syncConsumers: Connection not ready, exiting.");if(Ne(this,Qv))return Fe(this,Xv,!0),void this.logger.info("syncConsumers: Sync in progress, marking resyncRequired=true and exiting.");this.logger.info("syncConsumers: Starting sync operation."),Fe(this,Qv,!0),Fe(this,Xv,!1);let s=[];this.participants.videoSubscribed.forEach(e=>{var t,i;const r=this.participants.joined.get(e.id),n=null!=(i=null==(t=e.producers)?void 0:t.filter(e=>"video"===e.kind))?i:[];r&&null!=n&&n.length&&n.forEach(e=>{var t,i,n,a;const o=(null==(i=null==(t=r.manualProducerConfig)?void 0:t.video)||i)&&"video"===e.kind&&!e.screenShare,c=(null==(a=null==(n=r.manualProducerConfig)?void 0:n.screenshareVideo)||a)&&"video"===e.kind&&e.screenShare;(o||c)&&(e.pause||s.push(e))})}),this.participants.audioSubscribed.forEach(e=>{var t,i;const r=this.participants.joined.get(e.id),n=null!=(i=null==(t=e.producers)?void 0:t.filter(e=>"audio"===e.kind))?i:[];r&&null!=n&&n.length&&n.forEach(e=>{var t,i,n,a;const o=(null==(i=null==(t=r.manualProducerConfig)?void 0:t.audio)||i)&&"audio"===e.kind&&!e.screenShare,c=(null==(a=null==(n=r.manualProducerConfig)?void 0:n.screenshareAudio)||a)&&"audio"===e.kind&&e.screenShare;(o||c)&&s.push(e)})}),s=za(s,e=>e.producerId);const a=new Map;s.forEach(e=>{a.set(e.producerId,e)});const o=null==(r=this.roomNodeClient)?void 0:r.getConsumers(),c=s.filter(e=>!(null!=o&&o.has(e.producerId))),l=[];let d=Array.from(null!=(n=null==o?void 0:o.values())?n:[]).map(e=>e.peerId);d=function(e){return e&&e.length?Va(e):[]}(d),null==d||d.forEach(e=>{var t;const i=this.participants.joined.get(e);i?null!=(t=i.producers)&&t.length&&i.producers.forEach(e=>{const t=e.consumer&&o.has(e.consumer.id);!a.has(e.producerId)&&(o.has(e.producerId)||t)&&l.push(e)}):this.logger.warn("Peer with ".concat(e," doesn't exist in joined list but producers of it are being consumed."))}),this.logger.info("syncConsumers: Computed changes - AddProducers: ".concat(c.length," [").concat(c.map(e=>e.producerId).join(", "),"], RemoveProducers: ").concat(l.length," [").concat(l.map(e=>e.producerId).join(", "),"]").substring(0,5e3));try{c.length>0||l.length>0?(this.logger.info("syncConsumers: Calling updateConsumers with changes. Adding ".concat(c.length," and removing ").concat(l.length,".")),yield this.updateConsumers(c,l),this.logger.info("syncConsumers: updateConsumers completed successfully.")):this.logger.info("syncConsumers: No changes needed, skipping updateConsumers.")}catch(h){this.logger.error("syncConsumers: updateConsumers failed with error.",{error:h})}finally{this.logger.info("syncConsumers: Setting consumersSyncing=false and completing sync."),Fe(this,Qv,!1)}Ne(this,Xv)&&(this.logger.info("syncConsumers: Resync required, calling syncConsumers again."),this.syncConsumers())})}computeActivateParticipants(e,t){const i=e.map((e,t)=>({peerId:e,priority:t+1})),r=null==t?void 0:t.map((e,t)=>({peerId:e,priority:-(t+1)}));i.push(...null!=r?r:[]),i.length>0&&this.updateActiveParticipantsWithPriorities(i)}createParticipantObjFromSocketPeer(e){const t=nb.formatSocketPeerMessage(e);return new Rv(this.context,Ie(Le({},t),{isHost:!1,videoEnabled:!1,audioMuted:!0,videoTrack:void 0,audioTrack:void 0}),this.self,this.roomSocketHandler)}updatePipSource(e,t){var i,r;t?null==(i=this.pip)||i.enableSource(e):null==(r=this.pip)||r.disableSource(e)}onParticipantMediaJoined(e,t,i){if(!this.mediaJoined||e===this.self.id)return;const r=this.participants.joined.get(e);r?(this.logger.info("PEER_INFO:::SOCKET_ON_MEDIA_JOIN",{participant:{id:r.id,maskedName:[...(null==r?void 0:r.name)||""].map((e,t)=>t%2?"*":e).join("")}}),this.logger.info("onParticipantMediaJoined: peer ".concat(e," has joined media room. Processing.")),t.forEach(t=>{t.kind!==cc.AUDIO||t.screenShare?t.kind===cc.VIDEO&&!t.screenShare&&(r.setVideoEnabled(!t.pause),this.updatePipSource(r.id,!t.pause)):r.setAudioEnabled(!t.pause),r.producers.push(Ie(Le({},t),{producingTransportId:t.producingTransportId,kind:t.kind===cc.AUDIO?"audio":"video",producingPeerId:e,mimeType:t.mimeType}))}),this.roomNodeClient.handlePeerCapabilities(e,i),this.context.getValue("flagsmith").hasFeature(go)||this.roomNodeClient.shareWebcam(this.self.videoTrack),this.logger.info("onParticipantMediaJoined: Emitting UPDATE_ACTIVE for peer ".concat(e)),this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})):this.logger.warn("Received media.peerJoinedBroadcast for non-existent peer ".concat(e))}updateParticipantsMapMinReplacement(e,t){const i=Array.from(e.keys()),r=new Map(e),n=new Set(t),s=[];i.forEach((e,t)=>{(!n.has(e)||!this.participants.joined.get(e))&&s.push(t)}),t.forEach(r=>{if(e.get(r))return;if(i.length{i.splice(e,1)}),Array.from(e.keys()).forEach(t=>{e.delete(t,!n.has(t))}),i.forEach(t=>{this.participants.joined.get(t)?e.add(this.participants.joined.get(t),!r.get(t)):this.logger.warn("updateActiveParticipants::participant_not_in_joined_list",{participant:{id:t}})}),e.emit("participantsUpdate")}updateParticipantsMap(e,t){Array.from(e.keys()).forEach(i=>{t.includes(i)||e.delete(i,!0)}),t.forEach(t=>{e.get(t)||e.add(this.participants.joined.get(t),!0)}),e.emit("participantsUpdate")}updatePinnedParticipants(){this.participants.pinned.forEach(e=>{e.setIsPinned(!1),this.participants.pinned.delete(e.id)})}setupEventsGlobal(){var e=this;this.roomSocketHandler.on(Mh.joinRoom,e=>{let{peer:t}=e;if(!t.waitlisted){const e=this.context.getValue("flagsmith").hasFeature(uo);e&&this.logger.info("Processing socket join",{peers:t.peerId}),this.onParticipantSocketJoined(this.createParticipantObjFromSocketPeer(t)),e&&this.logger.info("Processed socket join",{peers:t.peerId})}}),this.roomSocketHandler.on(Mh.leaveRoom,e=>{const{peerId:t}=e.peer;this.selectedPeers.delete(t,this.context),this.onParticipantLeave(t)}),this.context.getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_ROOM_JOINED,()=>{this.self.permissions.acceptWaitingRequests&&this.roomSocketHandler.getWaitingRoomRequests()}),this.self.permissions.on("permissionsUpdate",e=>{const{acceptWaitingRequests:t}=e;void 0!==t&&(t?this.roomSocketHandler.getWaitingRoomRequests():this.participants.waitlisted.clear())}),this.context.getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_DISCONNECTED,()=>{this.participants.joined.clear(),this.participants.videoSubscribed.clear(),this.participants.audioSubscribed.clear(),this.participants.pinned.clear(),this.participants.currentPage=0,this.participants.viewMode="ACTIVE_GRID",this.participants.emit("viewModeChanged",{viewMode:"ACTIVE_GRID",currentPage:this.participants.currentPage,pageCount:this.participants.pageCount})}),this.context.getValue("peerSessionStore").on(Vo.CONSUMER_PAUSED,e=>{let{id:t}=e;this.processConsumerPaused(t)}),this.context.getValue("peerSessionStore").on(Vo.CONSUMER_RESUMED,e=>{let{id:t}=e;this.processConsumerResumed(t)}),this.context.getValue("peerSessionStore").on(Vo.NEW_CONSUMER,e=>{let{id:t}=e;this.processNewConsumer(t)}),this.context.getValue("peerSessionStore").on(Vo.CONSUMER_CLOSED,e=>{let{id:t}=e;this.processConsumerClosed(t)}),this.context.getValue("peerSessionStore").on(Vo.ROOM_MESSAGE,e=>Be(this,[e],function(e){var t=this;let{payload:i,type:r,timestamp:n}=e;return function*(){t.participants.emit("broadcastedMessage",{type:r,payload:i,timestamp:n})}()})),this.context.getValue("peerSessionStore").on(Vo.MESSAGE,e=>Be(this,[e],function(e){var t=this;let{payload:i,type:r,timestamp:n}=e;return function*(){"spotlight"!==r&&t.participants.emit("broadcastedMessage",{type:r,payload:i,timestamp:n})}()})),this.context.getValue("peerSessionStore").on(Vo.LOW_CONSUMER_SCORE,e=>{let{peerId:t,score:i,kind:r}=e;const n=this.participants.joined.get(t);n&&(n.emit("poorConnection",{score:i,kind:r}),this.participants.emit("poorConnection",{participantId:t,score:i,kind:r}))}),this.context.getValue("peerSessionStore").on(Vo.CONSUMER_SCORE_UPDATE,e=>{let{score:t,kind:i,appData:r,peerId:n,scoreStats:s}=e;var a;const o="video"===i&&null!=(a=null==r?void 0:r.screenShare)&&a,c=this.participants.joined.get(n);c&&(c.emit("mediaScoreUpdate",{kind:i,isScreenshare:o,score:t,participantId:n,scoreStats:s}),this.participants.emit("mediaScoreUpdate",{kind:i,isScreenshare:o,score:t,participantId:n,scoreStats:s}))}),this.context.getValue("peerSessionStore").onAsync(Vo.KICK_PEER,e=>Be(this,[e],function(e){var t=this;let{peerId:i}=e;return function*(){const e=t.participants.joined.get(i);t.roomNodeClient.kick(i),yield t.roomSocketHandler.kick(i),e?e.emit("kicked"):t.participants.joined.emit("kicked",{id:i})}()})),this.context.getValue("peerSessionStore").on(Vo.UPDATE_ACTIVE,function(){for(var t=arguments.length,i=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:{viewMode:"ACTIVE_GRID",page:0,createAllConsumers:!1};return function*(){e.logger.info("UPDATE_ACTIVE event received - viewMode: ".concat(Ne(e,Jv).mode,", page: ").concat(i,", CreateAllConsumers: ").concat(r)),r&&(e.logger.info("UPDATE_ACTIVE viewMode: ".concat(t,", Page: ").concat(i,", Removing existing subscriptions.")),e.participants.videoSubscribed.clear(),e.participants.audioSubscribed.clear()),e.updateMediaSubscribedMaps(t,{page:i}),e.scheduleSyncConsumers({source:"UPDATE_ACTIVE"})}()})})}onParticipantPinned(e){return Be(this,null,function*(){if(!e)return this.self.isPinned&&this.self.setIsPinned(!1),void(0!==this.participants.pinned.size&&this.updatePinnedParticipants());if(e===this.self.id)return 0!==this.participants.pinned.size&&this.updatePinnedParticipants(),void this.self.setIsPinned(!0);const t=this.participants.joined.get(e);this.self.isPinned&&this.self.setIsPinned(!1),this.updatePinnedParticipants(),t.setIsPinned(!0),this.participants.pinned.add(t)})}onParticipantSocketJoined(e){return Be(this,null,function*(){var t,i,r;this.logger.info("onParticipantSocketJoined: peer ".concat(e.id," has joined socket edge. Processing.")),this.self.id!==e.id&&!(null!=(t=e.flags)&&t.recorder)&&!(null!=(i=e.flags)&&i.hidden_participant)&&!(null!=(r=e.flags)&&r.hiddenParticipant)&&(this.participants.videoSubscribed.delete(e.id),this.participants.audioSubscribed.delete(e.id),this.participants.joined.add(e),this.participants.waitlisted.delete(e.id),"REQUESTED_TO_JOIN_STAGE"===e.stageStatus&&this.context.getValue("peerSessionStore").emit(Vo.UPDATE_STAGE_REQUESTS,{request:{displayName:e.name,userId:e.userId,peerId:e.id},add:!0})),this.context.getValue("peerSessionStore").emit(Vo.PEER_JOINED_INTERNAL,e)})}onParticipantLeave(e){return Be(this,null,function*(){const t=this.participants.joined.get(e);this.participants.joined.delete(e,!0,!0),this.participants.pinned.delete(e,!0,!0),this.participants.waitlisted.delete(e,!0,!0),this.roomNodeClient&&(this.roomNodeClient.handlePeerLeaving(e),this.roomNodeClient.closeConsumers(null==t?void 0:t.producers)),t&&"REQUESTED_TO_JOIN_STAGE"===t.stageStatus&&this.context.getValue("peerSessionStore").emit(Vo.UPDATE_STAGE_REQUESTS,{request:{displayName:t.name,userId:t.userId,peerId:t.id},add:!1});const{currentPage:i}=this.participants,r=this.maxPreferredStreams*(i-1),n=this.participants.videoSubscribed.get(e);"MANUAL"===this.participants.viewMode?this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:i}):0===r?this.participants.setViewMode("ACTIVE_GRID"):this.participants.joined.size<=r?2===i?this.participants.setViewMode("ACTIVE_GRID"):this.participants.setPage(i-1):n&&this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:i})})}processMedia(e){var t;const i=this.roomNodeClient.getConsumers(),{peerId:r,kind:n,appData:s,track:a,producerId:o,rtpReceiver:c,paused:l,localId:d}=null!=(t=i.get(e))?t:{};if(!r)return this.logger.warn("processMedia::Peer ID is undefined",{consumer:{id:e,kind:n,peerId:r,appData:{supportsRemoteControl:!(null==s||!s.supportsRemoteControl),screenShare:!(null==s||!s.screenShare)},remotelyPaused:l,producerId:o}}),{};const h=s;return"video"===n&&!0!==h.screenShare&&this.videoPeerConsumerMap.set(r,e),this.logger.info("ParticipantController::processMedia",{consumer:{id:e,peerId:r,kind:n,appData:h,remotelyPaused:l,producerId:o}}),this.consumerPeerMap.set(e,{type:n,peerId:r,appData:h,remotelyPaused:l,producerId:o}),{peerId:r,kind:n,appData:h,remotelyPaused:l,track:a,producerId:o,rtpReceiver:c,localId:d}}processConsumerClosed(e){const{peerId:t,type:i,appData:r,remotelyPaused:n,producerId:s}=this.consumerPeerMap.get(e)||{},a=this.participants.joined.get(t);if(this.logger.info("ParticipantController::processConsumerClosed",{consumer:{id:e,peerId:t,appData:r,kind:i,remotelyPaused:n,producerId:s}}),this.consumerPeerMap.delete(e),"video"===i&&!0!==r.screenShare&&this.videoPeerConsumerMap.delete(t),!a)return;const o=a.producers.find(e=>e.producerId===s);o&&(o.consumer={id:e,peerId:t,kind:void 0,appData:r,paused:n,producerId:s,rtpReceiver:void 0,localId:void 0});const c=[];r&&r.screenShare?(a.setScreenShareEnabled(!1),this.context.getValue("callstats").consumerSharedMediaState(e,{screen:!1}),a.screenShareTracks.video&&c.push(a.screenShareTracks.video.id),a.screenShareTracks.audio&&c.push(a.screenShareTracks.audio.id),a.screenShareTracks={audio:void 0,video:void 0}):"audio"===i?(a.setAudioEnabled(!1),a.audioTrack&&c.push(a.audioTrack.id),this.context.getValue("callstats").consumerSharedMediaState(e,{audio:!1}),a.audioTrack=void 0):"video"===i&&(a.setVideoEnabled(!1),this.updatePipSource(a.id,!1),a.videoTrack&&c.push(a.videoTrack.id),this.context.getValue("callstats").consumerSharedMediaState(e,{video:!1}),a.videoTrack=void 0),r.e2ee&&c.forEach(e=>{this.context.getValue("peerSessionStore").emit(Vo.E2EE_INACTIVE_CONSUMER,{peerId:t,trackId:e})})}processConsumerResumed(e){var t;const i=this.processMedia(e),{peerId:r,kind:n,appData:s,track:a,remotelyPaused:o,producerId:c,rtpReceiver:l,localId:d}=i;if(!r)return;this.logger.info("ParticipantController::processConsumerResumed",{consumer:{id:e,peerId:r,kind:n,appData:s,remotelyPaused:o,producerId:c}});const h=this.participants.joined.get(r);if(!h)return;const u=h.producers.find(e=>e.producerId===c);if(u&&(u.consumer={id:e,peerId:r,kind:n,appData:s,paused:o,producerId:c,rtpReceiver:l,localId:d}),s.e2ee&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_ACTIVE_CONSUMER,{peerId:r,rtpReceiver:l,track:a}),s.screenShare)return"video"===n?h.screenShareTracks.video=a:"audio"===n&&(h.screenShareTracks.audio=a),h.setScreenShareEnabled(!0),void(null==(t=this.context)||t.getValue("callstats").consumerSharedMediaState(e,{screen:!0}));"video"===n?(h.videoTrack=a,h.setVideoEnabled(!0),this.updatePipSource(h.id,!0),this.context.getValue("callstats").consumerSharedMediaState(e,{video:!0})):"audio"===n&&(h.audioTrack=a,h.setAudioEnabled(h.audioEnabled),this.context.getValue("callstats").consumerSharedMediaState(e,{audio:h.audioEnabled}))}processConsumerPaused(e){this.logger.info("ParticipantController::processConsumerPaused called for consumerId: ".concat(e));const{peerId:t,kind:i,track:r,appData:n,remotelyPaused:s,producerId:a,rtpReceiver:o,localId:c}=this.processMedia(e);if(!t)return;this.logger.info("ParticipantController::processConsumerPaused",{consumer:{id:e,peerId:t,kind:i,appData:n,remotelyPaused:s,producerId:a}});const l=this.participants.joined.get(t);if(!l)return;const d=l.producers.find(e=>e.producerId===a);d&&(d.consumer={id:e,peerId:t,kind:i,appData:n,paused:s,producerId:a,rtpReceiver:o,localId:c}),r&&n.e2ee&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_INACTIVE_CONSUMER,{peerId:t,trackId:r.id}),"video"===i?(l.videoTrack=r,l.setVideoEnabled(!1),this.updatePipSource(l.id,!1),this.context.getValue("callstats").consumerSharedMediaState(e,{video:!1})):"audio"===i&&(l.audioTrack=r,l.setAudioEnabled(l.audioEnabled),this.context.getValue("callstats").consumerSharedMediaState(e,{audio:l.audioEnabled}))}processNewConsumer(e){const{peerId:t,kind:i,remotelyPaused:r,track:n,appData:s,producerId:a,rtpReceiver:o,localId:c}=this.processMedia(e);if(!t)return;this.logger.info("ParticipantController::processNewConsumer",{consumer:{id:e,peerId:t,kind:i,remotelyPaused:r,appData:s,producerId:a}});const l=this.participants.joined.get(t);if(!l)return;const d=l.producers.find(e=>e.producerId===a);if(d&&(d.consumer={id:e,peerId:t,kind:i,appData:s,paused:r,producerId:a,rtpReceiver:o,localId:c}),s.screenShare)return"video"===i?l.screenShareTracks.video=n:"audio"===i&&(l.screenShareTracks.audio=n),(!r||this.self.permissions.isRecorder||this.context.getValue("flagsmith").hasFeature(eo))&&l.setScreenShareEnabled(!0),s.supportsRemoteControl&&(l.supportsRemoteControl=!0),this.participants.broadcastMessage("screenshareConsumerCreated",{producerId:a,peerId:t,screenShare:!0,consumerId:e,consumerPeerId:this.self.id}),void this.logger.info("ParticipantController::newScreenshareConsumer::screenshareConsumerCreated",{consumer:{id:e,peerId:t,kind:i,remotelyPaused:r,appData:s,producerId:a}});"video"===i?(l.videoTrack=n,r||(l.setVideoEnabled(!0),this.updatePipSource(l.id,!0)),this.context.getValue("callstats").consumerSharedMediaState(e,{video:!r})):"audio"===i&&(l.audioTrack=n,r||l.setAudioEnabled(!0),this.context.getValue("callstats").consumerSharedMediaState(e,{audio:!r})),!r&&s.e2ee&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_ACTIVE_CONSUMER,{peerId:t,rtpReceiver:o,track:n})}static formatSocketPeerMessage(e){var t,i,r,n,s,a;if(!e)return;const o=Gp(e.stageType);return{id:e.peerId,userId:e.userId,name:e.displayName,displayName:e.displayName,stageType:o,customParticipantId:e.customParticipantId,presetId:e.presetId,picture:e.displayPictureUrl,waitlisted:e.waitlisted,stageStatus:o,metadata:{preset_name:null==(t=e.flags)?void 0:t.presetName},recorderType:null==(i=e.flags)?void 0:i.recorderType,flags:{hiddenParticipant:null==(r=e.flags)?void 0:r.hiddenParticipant,hidden_participant:null==(n=e.flags)?void 0:n.hiddenParticipant,recorder:void 0!==(null==(s=e.flags)?void 0:s.recorderType)&&"NONE"!==(null==(a=e.flags)?void 0:a.recorderType)}}}onSelectedPeers(e,t){return Be(this,null,function*(){"ACTIVE_GRID"===this.participants.viewMode&&this.computeActivateParticipants(e,t)})}updateActiveParticipantsWithPriorities(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("MANUAL"===this.participants.viewMode)return;if(!this.mediaJoined)return void this.logger.warn("Skipped::ParticipantController::updateActiveParticipantsWithPriorities",{roomJoined:this.mediaJoined});e.forEach(e=>{this.selectedPeers.add(e.peerId,e.priority,this.context)});const i=this.selectedPeers.activeSpeakerPeers.at(0);void 0!==i&&i!==this.participants.lastActiveSpeaker&&(this.participants.lastActiveSpeaker=i,this.participants.emit("activeSpeaker",{peerId:i,volume:1})),t&&this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})}},Jv=new WeakMap,Qv=new WeakMap,Xv=new WeakMap,eb);let sb=nb;rb([Mo.trace("ParticipantController.setupEvents")],sb.prototype,"setupEvents",1),rb([Mo.trace("ParticipantController.setupEvents")],sb.prototype,"setupEventsGlobal",1),rb([Mo.trace("ParticipantController.processMedia")],sb.prototype,"processMedia",1),rb([Mo.trace("ParticipantController.processConsumerClosed")],sb.prototype,"processConsumerClosed",1),rb([Mo.trace("ParticipantController.processConsumerResumed")],sb.prototype,"processConsumerResumed",1),rb([Mo.trace("ParticipantController.processConsumerPaused")],sb.prototype,"processConsumerPaused",1),rb([Mo.trace("ParticipantController.processNewConsumer")],sb.prototype,"processNewConsumer",1);const ab=iu(Rs().permissions);var ob,cb,lb,db,hb,ub;const pb=class extends Ho{constructor(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(super(e.getValue("logger")),Ue(this,hb),Ue(this,ob,void 0),Ue(this,cb,void 0),Ue(this,lb,void 0),Ue(this,db,e=>{var t,i,r;const n=e,{chat:s,connectedMeetings:a,plugins:o,polls:c,media:l}=n,d=Me(n,["chat","connectedMeetings","plugins","polls","media"]);if(s&&(s.private&&Fa(Ne(this,ob).chat.private,s.private),s.public&&Fa(Ne(this,ob).chat.public,s.public),this.emit("chatUpdate")),a&&Fa(Ne(this,ob).connectedMeetings,a),l){const e=e=>{switch(e){case ad.NONE:case ad.ALLOWED:return ls.Allowed;case ad.NOT_ALLOWED:return ls.NotAllowed;case ad.CAN_REQUEST:return ls.CanRequest;default:return}},n={audio:void 0,video:void 0,screenshare:void 0};null!=(t=l.audio)&&t.canProduce&&(n.audio={canProduce:e(l.audio.canProduce)}),null!=(i=l.video)&&i.canProduce&&(n.video={canProduce:e(l.video.canProduce)}),null!=(r=l.screenshare)&&r.canProduce&&(n.screenshare={canProduce:e(l.screenshare.canProduce)}),Fa(Ne(this,ob).media,n)}o&&(Fa(Ne(this,ob).plugins,o),this.emit("pluginsUpdate")),c&&(Fa(Ne(this,ob).polls,c),this.emit("pollsUpdate")),0!==Object.keys(d).length&&Fa(Ne(this,ob),d),this.emit("permissionsUpdate",e)}),!t)throw this.logger.error("PermissionPreset::load_preset_permissions_failed"),new Uo("Could not load preset permissions.","0904");Fe(this,lb,e),Fe(this,cb,i),Fe(this,ob,t),r&&this.setupEvents()}setupEvents(){Ne(this,lb).getValue("peerSessionStore").on(Vo.UPDATE_PERMISSIONS,Ne(this,db))}static fromResponse(e,t,i){return new pb(i,e,t,!0)}static default(e,t){return new pb(e,ab,t)}static init(e,t,i){let r;return r=i?new pb(e,i,t,!0):new pb(e,ab,t),r}get mediaRoomType(){return"CF"}get stageEnabled(){var e;return(null==(e=Ne(this,ob))?void 0:e.stageEnabled)||Ne(this,cb)===cs.Webinar||Ne(this,cb)===cs.Livestream}get acceptStageRequests(){var e,t;return!!this.stageEnabled&&((null==(e=Ne(this,ob))?void 0:e.acceptStageRequests)||(null==(t=Ne(this,ob))?void 0:t.canAcceptProductionRequests))}get stageAccess(){var e,t,i;return(null==(e=Ne(this,ob))?void 0:e.stageAccess)===ls.NotAllowed?ls.NotAllowed:(null==(t=Ne(this,ob))?void 0:t.stageAccess)===ls.CanRequest?ls.CanRequest:(null==(i=Ne(this,ob))?void 0:i.stageAccess)===ls.Allowed||Ne(this,ob).media.audio.canProduce===ls.Allowed||Ne(this,ob).media.video.canProduce===ls.Allowed||Ne(this,ob).media.screenshare.canProduce===ls.Allowed?ls.Allowed:Ne(this,ob).media.audio.canProduce===ls.CanRequest||Ne(this,ob).media.video.canProduce===ls.CanRequest||Ne(this,ob).media.screenshare.canProduce===ls.CanRequest?ls.CanRequest:ls.NotAllowed}get acceptWaitingRequests(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.acceptWaitingRequests)?t:ab.acceptWaitingRequests}get requestProduceVideo(){var e,t,i;return(null==(i=null==(t=null==(e=Ne(this,ob))?void 0:e.media)?void 0:t.video)?void 0:i.canProduce)===ls.CanRequest}get requestProduceAudio(){var e,t,i;return(null==(i=null==(t=null==(e=Ne(this,ob))?void 0:e.media)?void 0:t.audio)?void 0:i.canProduce)===ls.CanRequest}get requestProduceScreenshare(){var e,t,i;return(null==(i=null==(t=null==(e=Ne(this,ob))?void 0:e.media)?void 0:t.screenshare)?void 0:i.canProduce)===ls.CanRequest}get canAllowParticipantAudio(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.disableParticipantAudio)?t:ab.disableParticipantAudio}get canAllowParticipantScreensharing(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.canAcceptProductionRequests)?t:ab.canAcceptProductionRequests}get canAllowParticipantVideo(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.disableParticipantVideo)?t:ab.disableParticipantVideo}get canDisableParticipantAudio(){return this.canAllowParticipantAudio}get canDisableParticipantVideo(){return this.canAllowParticipantVideo}get kickParticipant(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.kickParticipant)?t:ab.kickParticipant}get pinParticipant(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.pinParticipant)?t:ab.pinParticipant}get canRecord(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.canRecord)?t:ab.canRecord}get waitingRoomType(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.waitingRoomType)?t:ab.waitingRoomType}get waitingRoomBehaviour(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.waitingRoomType)?t:ab.waitingRoomType}get plugins(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.plugins)?t:ab.plugins}get polls(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.polls)?t:ab.polls}get produceVideo(){return this.canProduceVideo}get requestProduce(){return Ne(this,ob).media.audio.canProduce===ls.CanRequest||Ne(this,ob).media.video.canProduce===ls.CanRequest||Ne(this,ob).media.screenshare.canProduce===ls.CanRequest}get canProduceVideo(){var e;const t=null!=(e=Ne(this,ob).media.video.canProduce)?e:ab.media.video.canProduce;return!this.stageEnabled||"ACCEPTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)&&"ON_STAGE"!==Ne(this,hb,ub)||t!==ls.CanRequest?!this.stageEnabled||"OFF_STAGE"!==Ne(this,hb,ub)&&"REQUESTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)||t!==ls.Allowed?t:ls.NotAllowed:ls.Allowed}get produceScreenshare(){return this.canProduceScreenshare}get canProduceScreenshare(){var e;const t=null!=(e=Ne(this,ob).media.screenshare.canProduce)?e:ab.media.screenshare.canProduce;return!this.stageEnabled||"ACCEPTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)&&"ON_STAGE"!==Ne(this,hb,ub)||t!==ls.CanRequest?!this.stageEnabled||"OFF_STAGE"!==Ne(this,hb,ub)&&"REQUESTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)||t!==ls.Allowed?t:ls.NotAllowed:ls.Allowed}get produceAudio(){return this.canProduceAudio}get canProduceAudio(){var e;const t=null!=(e=Ne(this,ob).media.audio.canProduce)?e:ab.media.audio.canProduce;return!this.stageEnabled||"ACCEPTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)&&"ON_STAGE"!==Ne(this,hb,ub)||t!==ls.CanRequest?!this.stageEnabled||"OFF_STAGE"!==Ne(this,hb,ub)&&"REQUESTED_TO_JOIN_STAGE"!==Ne(this,hb,ub)||t!==ls.Allowed?t:ls.NotAllowed:ls.Allowed}get chatPublic(){var e,t,i;return null!=(i=null==(t=null==(e=Ne(this,ob))?void 0:e.chat)?void 0:t.public)?i:ab.chat.public}get chatPrivate(){var e,t,i;return null!=(i=null==(t=null==(e=Ne(this,ob))?void 0:e.chat)?void 0:t.private)?i:ab.chat.private}get chatChannel(){var e,t,i;return null!=(i=null==(t=null==(e=Ne(this,ob))?void 0:e.chat)?void 0:t.channel)?i:ab.chat.channel}get chatMessage(){var e,t,i;return null!=(i=null==(t=null==(e=Ne(this,ob))?void 0:e.chat)?void 0:t.message)?i:ab.chat.message}get connectedMeetings(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.connectedMeetings)?t:null==ab?void 0:ab.connectedMeetings}get hiddenParticipant(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.hiddenParticipant)?t:ab.hiddenParticipant}get showParticipantList(){var e;return null!=(e=Ne(this,ob).showParticipantList)?e:ab.showParticipantList}get canChangeParticipantRole(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.canChangeParticipantPermissions)?t:ab.canChangeParticipantPermissions}get canChangeParticipantPermissions(){var e,t;return null!=(t=null==(e=Ne(this,ob))?void 0:e.canChangeParticipantPermissions)?t:ab.canChangeParticipantPermissions}get canChangeTheme(){return!1}get canPresent(){return Ne(this,ob).media.audio.canProduce===ls.Allowed||Ne(this,ob).media.video.canProduce===ls.Allowed||Ne(this,ob).media.screenshare.canProduce===ls.Allowed}get acceptPresentRequests(){return this.acceptStageRequests}get canEditDisplayName(){var e;return null!=(e=Ne(this,ob).canEditDisplayName)&&e}get maxScreenShareCount(){return 1}get isRecorder(){return Ne(this,ob).isRecorder}get canSpotlight(){return Ne(this,ob).canSpotlight}get canLivestream(){return Ne(this,ob).canLivestream}get transcriptionEnabled(){return Ne(this,ob).transcriptionEnabled}};let gb=pb;var fb;ob=new WeakMap,cb=new WeakMap,lb=new WeakMap,db=new WeakMap,hb=new WeakSet,ub=function(){return Ne(this,lb).getValue("stageStatus")};class mb extends Ho{constructor(e,t){super(t),De(this,"localMediaHandler"),Ue(this,fb,void 0),Fe(this,fb,e)}updatePermission(){return Be(this,null,function*(){var e,t;const i=(e,t)=>{this.mediaPermissions[e]=t;const i={message:this.mediaPermissions[e],kind:e};"DENIED"===t?Ne(this,fb).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_ERROR,i):Ne(this,fb).getValue("peerSessionStore").emit(Vo.MEDIA_PERMISSION_UPDATE,i)};if("firefox"===it.getName())return;const r=yield null==(e=null==navigator?void 0:navigator.permissions)?void 0:e.query({name:"microphone"}),n=yield null==(t=null==navigator?void 0:navigator.permissions)?void 0:t.query({name:"camera"}),s=(e,t)=>{switch(t){case"granted":i(e,"ACCEPTED");break;case"denied":i(e,"DENIED");break;case"prompt":i(e,"NOT_REQUESTED")}this.localMediaHandler.repopulateAvailableDevices()};r&&(r.onchange=()=>s("audio",r.state)),n&&(n.onchange=()=>s("video",n.state))})}populateMediaPermissionsInCallstats(e){return Be(this,arguments,function(e){var t=this;let{message:i,kind:r}=e;return function*(){var e,n,s,a;switch(r){case"audio":null==(e=Ne(t,fb))||e.getValue("callstats").mediaPermission("AUDIO",i),null==(n=Ne(t,fb))||n.getValue("callstats").mediaPermission("SPEAKER",i);break;case"video":null==(s=Ne(t,fb))||s.getValue("callstats").mediaPermission("VIDEO",i);break;case"screenshare":null==(a=Ne(t,fb))||a.getValue("callstats").mediaPermission("SCREENSHARE",i)}}()})}get peerId(){var e;return null==(e=Ne(this,fb))?void 0:e.getValue("peerId")}init(){return Be(this,arguments,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function*(){var n,s,a,o,c,l,d;if(it.init(),r&&Fe(e,fb,r),!e.localMediaHandler)try{let h=!0;if(null!=(n=null==r?void 0:r.getValue("defaults"))&&n.mediaHandler)h=!1,e.localMediaHandler=r.getValue("defaults").mediaHandler.localMediaHandler;else if(navigator.RNLocalMediaHandlerImpl){const{RNLocalMediaHandlerImpl:i}=navigator;e.localMediaHandler=yield i.init(t)}else e.localMediaHandler=new vf(r,t.constraints,null==(s=null==r?void 0:r.getValue("defaults"))?void 0:s.isNonPreferredDevice,null==(a=null==r?void 0:r.getValue("defaults"))?void 0:a.autoSwitchAudioDevice);if(null==r||r.getValue("peerSessionStore").on(Vo.MEDIA_PERMISSION_UPDATE,t=>Be(e,null,function*(){if(this.populateMediaPermissionsInCallstats({message:t.message,kind:t.kind}),"NOT_REQUESTED"===t.message)switch(null==t?void 0:t.kind){case"audio":this.rawAudioTrack&&(this.logger.info("Disabling audio due to media permission update"),this.disableAudio());break;case"video":this.rawVideoTrack&&(this.logger.info("Disabling video due to media permission update"),this.disableVideo())}this.emit("mediaPermissionUpdate",t)})),null==r||r.getValue("peerSessionStore").on(Vo.MEDIA_PERMISSION_ERROR,t=>Be(e,null,function*(){const{kind:e,message:i,constraints:r}=t;this.populateMediaPermissionsInCallstats({message:i,kind:e}),"audio"===e?(this.logger.info("Disabling audio due to media permission error skipping: ".concat(this.localMediaHandler.audioUpdateInProgress)),!1===this.localMediaHandler.audioUpdateInProgress&&this.disableAudio()):"video"===e&&(this.logger.info("Disabling video due to media permission error skipping: ".concat(this.localMediaHandler.videoUpdateInProgress)),!1===this.localMediaHandler.videoUpdateInProgress&&this.disableVideo()),this.logger.error("SelfController::mediaPermissionError",{error:{message:i},constraints:r,mediaPermissionsErrors:{kind:e,message:i}}),this.emit("mediaPermissionError",t),this.emit("mediaPermissionUpdate",{message:i,kind:e})})),h){e.logger.info("Setting up SelfMedia streams using media handler. audio:".concat(null==(o=null==t?void 0:t.audio)||o," video:").concat(null==(c=null==t?void 0:t.video)||c));const r=e.localMediaHandler.setupStreams({video:null==(l=null==t?void 0:t.video)||l,audio:null==(d=null==t?void 0:t.audio)||d});i||(yield r)}}catch(h){e.logger.error("Self::init::Failed To Setup Streams",{error:{name:h.name,message:h.message}})}}()})}set context(e){Fe(this,fb,e),this.localMediaHandler.context=e}get audioTrack(){return this.localMediaHandler.audioTrack}get rawAudioTrack(){return this.localMediaHandler.rawAudioTrack}get mediaPermissions(){return this.localMediaHandler.permissions}addAudioMiddleware(e){return Be(this,null,function*(){return this.localMediaHandler.addAudioMiddleware(e)})}removeAudioMiddleware(e){return Be(this,null,function*(){return this.localMediaHandler.removeAudioMiddleware(e)})}removeAllAudioMiddlewares(){return Be(this,null,function*(){return this.localMediaHandler.removeAllAudioMiddlewares()})}get videoTrack(){return this.localMediaHandler.videoTrack}get rawVideoTrack(){return this.localMediaHandler.rawVideoTrack}addVideoMiddleware(e){return Be(this,null,function*(){return this.localMediaHandler.addVideoMiddleware(e)})}setVideoMiddlewareGlobalConfig(){return Be(this,arguments,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{disablePerFrameCanvasRendering:!1};return function*(){return e.localMediaHandler.setVideoMiddlewareGlobalConfig(t)}()})}removeVideoMiddleware(e){return Be(this,null,function*(){return this.localMediaHandler.removeVideoMiddleware(e)})}removeAllVideoMiddlewares(){return Be(this,null,function*(){return this.localMediaHandler.removeAllVideoMiddlewares()})}get screenShareTracks(){return this.localMediaHandler.screenShareTracks}get audioEnabled(){return this.localMediaHandler.audioEnabled}get videoEnabled(){return this.localMediaHandler.videoEnabled}get screenShareEnabled(){return this.localMediaHandler.screenShareEnabled}enableAudio(){return Be(this,null,function*(){yield this.localMediaHandler.enableAudio(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})}enableVideo(){return Be(this,null,function*(){yield this.localMediaHandler.enableVideo(),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})}disableAudio(){return Be(this,null,function*(){this.localMediaHandler.disableAudio(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})}enableScreenShare(){return Be(this,null,function*(){yield this.localMediaHandler.enableScreenShare(),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})})}disableScreenShare(){return Be(this,null,function*(){yield this.localMediaHandler.disableScreenShare(),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})})}disableVideo(){return Be(this,null,function*(){yield this.localMediaHandler.disableVideo(),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})}getCurrentDevices(){return this.localMediaHandler.getCurrentDevices()}getAudioDevices(){return Be(this,null,function*(){return yield this.localMediaHandler.getAudioDevices()})}getVideoDevices(){return Be(this,null,function*(){return yield this.localMediaHandler.getVideoDevices()})}getSpeakerDevices(){return Be(this,null,function*(){return yield this.localMediaHandler.getSpeakerDevices()})}getDeviceById(e,t){let i;return"audio"===t?i="audioinput":"video"===t?i="videoinput":"speaker"===t&&(i="audiooutput"),this.localMediaHandler.getDeviceById(e,i)}setDevice(e){return Be(this,null,function*(){switch(e.kind){case"audioinput":try{yield this.localMediaHandler.setAudioDevice(e,{saveDevicePreference:!0})}catch(t){}finally{this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}break;case"audiooutput":yield this.localMediaHandler.setSpeakerDevice(e,{saveDevicePreference:!0});break;case"videoinput":try{yield this.localMediaHandler.setVideoDevice(e,{saveDevicePreference:!0})}catch(t){}finally{this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})}}this.emit("deviceUpdate",{device:e})})}}fb=new WeakMap;var vb,bb,kb,yb,wb,Sb,xb,Eb,Tb,_b,Pb,Cb,Ab,Rb,Lb,Ib,Mb,Db=Object.defineProperty,Ob=Object.getOwnPropertyDescriptor,Nb=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Ob(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Db(t,i,s),s};let Ub=(Mb=class extends mb{constructor(e,t,i,r,n){var s;const a=e.getValue("logger");super(e,a),Ue(this,wb),Ue(this,xb),Ue(this,Tb),Ue(this,Pb),Ue(this,Lb),De(this,"name"),De(this,"picture"),De(this,"customParticipantId"),De(this,"waitlistStatus"),Ue(this,vb,void 0),Ue(this,bb,void 0),Ue(this,kb,void 0),De(this,"role"),De(this,"userId"),De(this,"organizationId"),De(this,"supportsRemoteControl",!1),De(this,"device"),Ue(this,yb,void 0),De(this,"hidden",!1),De(this,"presetName"),De(this,"roomState","init"),Ue(this,Ab,new Set),Ue(this,Rb,new Set),Fe(this,yb,e),this.userId=t.id,this.name=t.name,this.picture=t.picture,this.customParticipantId=null!=(s=t.customParticipantId)?s:t.clientSpecificId,this.waitlistStatus="none",Fe(this,bb,i),Fe(this,vb,r),this.hidden=!1,Fe(this,kb,!1),this.organizationId=t.organizationId,this.supportsRemoteControl=it.isElectron(),this.device=it.getDeviceInfo(),this.presetName=n,r.viewType!==cs.Chat&&this.updatePermission(),this.updateVideo=this.updateVideo.bind(this),je(this,Lb,Ib).call(this)}get telemetry(){return Ne(this,yb).getValue("telemetry")}get stageStatus(){return Ne(this,yb).getValue("stageStatus")}get producers(){var e,t;return Array.from(null!=(t=null==(e=Ne(this,xb,Eb).getProducers())?void 0:e.values())?t:[])}get id(){return this.peerId}get peerId(){return Ne(this,yb).getValue("peerId")}static __init__(e,t,i,r,n){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return Be(this,null,function*(){var a,o,c,l,d,h;let u=null==(o=null==(a=e.getValue("defaults"))?void 0:a.audio)||o,p=null==(l=null==(c=e.getValue("defaults"))?void 0:c.video)||l;"ALLOWED"!==i.canProduceAudio&&(u=!1),"ALLOWED"!==i.canProduceVideo&&(p=!1);const g=new Ub(e,t,i,r,n);if(r.viewType===cs.Chat)return g;const f=function(e){var t,i;const r={};return e.audio&&(r.audio={enableStereo:null!=(t=e.audio.enableStereo)&&t,enableHighBitrate:null!=(i=e.audio.enableHighBitrate)&&i}),r.video=e.video.quality,r}(r.mediaConstraints);Fa(f,null==(d=e.getValue("defaults"))?void 0:d.mediaConfiguration);const m=null==(h=e.getValue("defaults"))?void 0:h.mediaHandler;return m&&(m.context=e),yield g.init({audio:u,video:p,constraints:f},s,e),g.setupEvents(),g})}cleanupEvents(){this.removeAllListeners("videoUpdate"),this.localMediaHandler.removeAllListeners("AUDIO_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("VIDEO_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("DEVICE_CHANGE"),this.localMediaHandler.removeAllListeners("DEVICE_LIST_UPDATED"),this.localMediaHandler.removeAllListeners("SCREENSHARE_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("SCREENSHARE_ENDED"),this.localMediaHandler.removeAllListeners("AUDIO_TRACK_SILENT"),this.localMediaHandler.removeAllListeners("FORCE_MUTE_AUDIO"),this.localMediaHandler.removeAllListeners("FORCE_MUTE_VIDEO"),Ne(this,bb).removeAllListeners("permissionsUpdate")}setupEvents(){this.on("videoUpdate",je(this,Lb,Ib));const e=Ne(this,Tb,_b);e&&e.onError(e=>{this.emit("autoplayError",e)}),this.localMediaHandler.on("AUDIO_TRACK_CHANGE",()=>Be(this,null,function*(){if(this.logger.info("Self::setupEvents::AUDIO_TRACK_CHANGE",Le({},tv(this))),Ne(this,Pb,Cb)&&this.audioEnabled)try{yield Ne(this,xb,Eb).shareMic(this.audioTrack)}catch(e){this.logger.error("Self::setupEvents::Error while sharing mic",{error:e}),this.localMediaHandler.disableAudio()}this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})),this.localMediaHandler.on("VIDEO_TRACK_CHANGE",()=>Be(this,null,function*(){if(this.logger.info("Self::setupEvents::VIDEO_TRACK_CHANGE",Le({},tv(this))),Ne(this,Pb,Cb)&&void 0===this.rawVideoTrack)this.logger.info("Self::VIDEO_TRACK_CHANGE::Forcing_disable_video"),this.disableVideo();else if(this.videoEnabled&&Ne(this,Pb,Cb))try{const e=yield Ne(this,xb,Eb).shareWebcam(this.videoTrack);e&&e.id!==this.videoTrack.id&&Ne(this,yb).getValue("flagsmith").hasFeature(co)&&(yield Ne(this,xb,Eb).shareWebcam(this.videoTrack))}catch(e){this.logger.error("Self::setupEvents::failed shareWebcam",{error:e}),this.videoEnabled&&(yield this.localMediaHandler.disableVideo())}this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})),this.localMediaHandler.on("DEVICE_CHANGE",e=>Be(this,[e],function(e){var t=this;let{device:i}=e;return function*(){var e;t.emit("deviceUpdate",{device:i}),"audiooutput"===i.kind&&"function"==typeof HTMLAudioElement.prototype.setSinkId&&(null==(e=Ne(t,Tb,_b))||e.setSpeakerDevice(i.deviceId))}()})),this.localMediaHandler.on("DEVICE_LIST_UPDATED",e=>{this.emit("deviceListUpdate",e)}),this.localMediaHandler.on("SCREENSHARE_TRACK_CHANGE",()=>Be(this,null,function*(){if(Ne(this,Pb,Cb)){if(this.screenShareEnabled)try{yield Ne(this,xb,Eb).shareScreen(this.screenShareTracks)}catch(e){this.logger.error("Self::setupEvents::Error while sharing screen",{error:e}),this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare())}this.logger.info("Self::setupEvents::SCREENSHARE_TRACK_CHANGE",Le({},tv(this))),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})}else this.logger.error("Self.SCREENSHARE_TRACK_CHANGE.LocalMediaInitialized_WithoutRoomNode")})),this.localMediaHandler.on("SCREENSHARE_ENDED",()=>Be(this,null,function*(){this.logger.log("Disabling screenshare due to SCREENSHARE_ENDED"),yield this.disableScreenShare(),this.logger.info("Self::setupEvents::SCREENSHARE_ENDED",Le({},tv(this)))})),this.localMediaHandler.on("AUDIO_TRACK_SILENT",()=>{var e;null==(e=Ne(this,yb))||e.getValue("callstats").mediaTrackMuted("AUDIO")}),this.localMediaHandler.on("FORCE_MUTE_AUDIO",()=>{this.disableAudio()}),this.localMediaHandler.on("FORCE_MUTE_VIDEO",()=>Be(this,null,function*(){var e;Ne(this,Pb,Cb)&&(yield Ne(this,xb,Eb).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),null==(e=Ne(this,yb))||e.getValue("callstats").videoOff()})),Ne(this,bb).on("permissionsUpdate",e=>{var t,i,r;null!=(t=null==e?void 0:e.media)&&t.audio&&Ne(this,bb).canProduceAudio!==ls.Allowed&&(this.disableAudio(),this.logger.info("Disabled audio due to dynamic preset change: canProduceAudio: ".concat(this.permissions.canProduceAudio))),null!=(i=null==e?void 0:e.media)&&i.video&&Ne(this,bb).canProduceVideo!==ls.Allowed&&(this.disableVideo(),this.logger.info("Disabled video due to dynamic preset change: canProduceVideo: ".concat(this.permissions.canProduceVideo))),null!=(r=null==e?void 0:e.media)&&r.screenshare&&Ne(this,bb).canProduceScreenshare!==ls.Allowed&&(this.disableScreenShare(),this.logger.info("Disabled screenshare due to dynamic preset change: canProduceScreenshare: ".concat(this.permissions.canProduceScreenshare)))})}get permissions(){return Ne(this,bb)}get config(){return Ne(this,vb)}get roomJoined(){var e;return Ne(this,vb).viewType===cs.Livestream&&"ON_STAGE"!==this.stageStatus?!0===(null==(e=Ne(this,yb).getValue("connectionHandler"))?void 0:e.socketJoined):Ne(this,Pb,Cb)}setName(e){if(!e)throw new Uo("Name cannot be empty.","1103");this.name=e}setupTracks(){return Be(this,arguments,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){t.forceReset,yield e.disableAudio(),yield e.disableVideo(),e.localMediaHandler.removeAudioTrack(),e.localMediaHandler.removeVideoTrack(),t.audio&&(yield e.enableAudio()),t.video&&(yield e.enableVideo())}()})}destructMediaHandler(){return Be(this,null,function*(){return this.localMediaHandler.destruct()})}removeDocumentEventListeners(){return Be(this,null,function*(){return this.localMediaHandler.removeDocumentEventListeners()})}enableAudio(e){return Be(this,null,function*(){var t;if(this.permissions.canProduceAudio!==ls.NotAllowed&&(Ne(this,bb).canProduceAudio!==ls.CanRequest||"OFF_STAGE"!==this.stageStatus&&"REQUESTED_TO_JOIN_STAGE"!==this.stageStatus)&&!this.audioEnabled){if(null==(t=Ne(this,yb))||t.getValue("callstats").audioOn(),yield this.localMediaHandler.enableAudio(e),Ne(this,Pb,Cb)&&"ON_STAGE"===this.stageStatus){if(this.audioTrack)try{yield Ne(this,xb,Eb).shareMic(this.audioTrack)}catch(i){this.logger.error("Self::enableAudio::Error while sharing mic",{error:i}),this.localMediaHandler.disableAudio()}if(!this.audioEnabled)return}this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}})}enableVideo(e){return Be(this,null,function*(){var t;if(Ne(this,bb).canProduceVideo!==ls.NotAllowed&&(Ne(this,bb).canProduceVideo!==ls.CanRequest||"OFF_STAGE"!==this.stageStatus&&"REQUESTED_TO_JOIN_STAGE"!==this.stageStatus)&&!this.videoEnabled){if(null==(t=Ne(this,yb))||t.getValue("callstats").videoOn(),yield this.localMediaHandler.enableVideo(e),Ne(this,Pb,Cb)&&"ON_STAGE"===this.stageStatus)try{yield Ne(this,xb,Eb).shareWebcam(this.videoTrack)}catch(i){this.logger.error("Self::enableVideo::Error while sharing video",{error:i}),this.videoEnabled&&this.localMediaHandler.disableVideo()}this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),this.logger.info("Self.enableVideo",Le({},tv(this)))}})}updateVideoConstraints(e){return Be(this,null,function*(){if(!this.localMediaHandler.updateVideoConstraints)throw new Uo("Unsupported","1102");yield this.localMediaHandler.updateVideoConstraints(e)})}enableScreenShare(){return Be(this,null,function*(){if(!Ne(this,Pb,Cb))throw new Uo("Can`t enable screenshare without joining room","1105");if(Ne(this,bb).canProduceScreenshare!==ls.NotAllowed&&(Ne(this,bb).canProduceScreenshare!==ls.CanRequest||"OFF_STAGE"!==this.stageStatus&&"REQUESTED_TO_JOIN_STAGE"!==this.stageStatus)&&!this.screenShareEnabled&&(yield this.localMediaHandler.enableScreenShare(),this.screenShareTracks.audio||this.screenShareTracks.video)){try{yield Ne(this,xb,Eb).shareScreen(this.screenShareTracks)}catch(e){this.logger.error("Self::enableScreenShare::Error while sharing screen",{error:e}),this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare())}this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})}})}updateScreenshareConstraints(e){return Be(this,null,function*(){if(!this.localMediaHandler.updateScreenshareConstraints)throw new Uo("Unsupported","1102");yield this.localMediaHandler.updateScreenshareConstraints(e)})}disableAudio(){return Be(this,null,function*(){var e;this.audioEnabled&&(this.localMediaHandler.disableAudio(),Ne(this,Pb,Cb)&&Ne(this,xb,Eb).muteSelf(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack}),null==(e=Ne(this,yb))||e.getValue("callstats").audioOff())})}disableVideo(){return Be(this,null,function*(){var e;this.videoEnabled&&(yield this.localMediaHandler.disableVideo(),Ne(this,Pb,Cb)&&(yield Ne(this,xb,Eb).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),null==(e=Ne(this,yb))||e.getValue("callstats").videoOff())})}disableScreenShare(){return Be(this,null,function*(){this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare(),Ne(this,Pb,Cb)&&(yield Ne(this,xb,Eb).disableScreenShare()),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks}))})}getAllDevices(){return this.localMediaHandler.getAllDevices()}setIsPinned(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i;Fe(this,kb,e);const r=e?"pinned":"unpinned";null==(i=Ne(this,wb,Sb))||i.updateSource(this.id,{pinned:e}),t&&this.emit(r,this)}get isPinned(){return Ne(this,kb)}pin(){return Be(this,null,function*(){if(!Ne(this,Pb,Cb))throw new Uo("Can`t pin participants without joining room","1105");return this.show(),Ne(this,xb,Eb).pinPeer(this.id)})}unpin(){return Be(this,null,function*(){if(!Ne(this,Pb,Cb))throw new Uo("Can`t unpin participants without joining room","1105");return Ne(this,xb,Eb).pinPeer(null)})}hide(){return Be(this,null,function*(){if(!Ne(this,Pb,Cb))throw new Uo("Can`t toggle participant tile without joining room","1105");this.hidden=!0,this.emit("toggleTile",{hidden:this.hidden})})}show(){if(!Ne(this,Pb,Cb))throw new Uo("Can`t toggle participant tile without joining room","1105");this.hidden=!1,this.emit("toggleTile",{hidden:this.hidden})}setDevice(e){return Be(this,null,function*(){var t,i,r;if(!e)throw new Uo("No device selected","1104");const n=this.getCurrentDevices();if(e.deviceId&&((null==(t=null==n?void 0:n.audio)?void 0:t.deviceId)===e.deviceId||(null==(i=null==n?void 0:n.video)?void 0:i.deviceId)===e.deviceId||(null==(r=null==n?void 0:n.speaker)?void 0:r.deviceId)===e.deviceId)&&(this.logger.warn("Self.setDevice.setting_to_in_use_device",{devices:[e]}),Ne(this,yb).getValue("flagsmith").hasFeature(lo)))throw new Uo("Cannot set device currently in use","1106");switch(e.kind){case"audioinput":try{yield this.localMediaHandler.setAudioDevice(e,{saveDevicePreference:!0})}catch(s){Ne(this,Pb,Cb)&&(yield Ne(this,xb,Eb).muteSelf()),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}break;case"audiooutput":yield this.localMediaHandler.setSpeakerDevice(e,{saveDevicePreference:!0});break;case"videoinput":try{yield this.localMediaHandler.setVideoDevice(e,{saveDevicePreference:!0})}catch(s){Ne(this,Pb,Cb)&&(yield Ne(this,xb,Eb).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})}}})}cleanUpTracks(){var e,t,i,r;null==(e=this.audioTrack)||e.stop(),null==(t=this.rawAudioTrack)||t.stop(),null==(i=this.videoTrack)||i.stop(),null==(r=this.rawVideoTrack)||r.stop()}playAudio(){var e;return null==(e=Ne(this,Tb,_b))?void 0:e.play()}registerVideoElement(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;e&&(t?Ne(this,Ab).add(e):Ne(this,Rb).add(e),this.updateVideo(e),t||null==(r=Ne(this,wb,Sb))||r.addSource(this.id,e,this.videoEnabled,this.isPinned,this.name,this.picture,null!=(i=this.raised)&&i))}deregisterVideoElement(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e?(e.srcObject=void 0,t?Ne(this,Ab).delete(e):(Ne(this,Rb).delete(e),Ne(this,wb,Sb).removeSource(this.id))):Ne(this,wb,Sb).removeSource(this.id)}updateVideo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r,n;if(this.videoEnabled){if(null==this.videoTrack)return;const n=null==(i=e.srcObject)?void 0:i.getTracks()[0];if((null==n?void 0:n.id)===this.videoTrack.id)return;const s=new MediaStream;s.addTrack(this.videoTrack),e.srcObject=s,t||null==(r=Ne(this,wb,Sb))||r.enableSource(this.id)}else e.srcObject=void 0,t||null==(n=Ne(this,wb,Sb))||n.disableSource(this.id);e.style.display=this.videoEnabled?"block":"none"}},vb=new WeakMap,bb=new WeakMap,kb=new WeakMap,yb=new WeakMap,wb=new WeakSet,Sb=function(){return Ne(this,yb).getValue("pip")},xb=new WeakSet,Eb=function(){return Ne(this,yb).getValue("roomNodeClient")},Tb=new WeakSet,_b=function(){return Ne(this,yb).getValue("audioPlayback")},Pb=new WeakSet,Cb=function(){var e;return!0===(null==(e=Ne(this,yb).getValue("connectionHandler"))?void 0:e.mediaJoined)},Ab=new WeakMap,Rb=new WeakMap,Lb=new WeakSet,Ib=function(){Array.from(Ne(this,Rb)).forEach(e=>this.updateVideo(e,!1)),Array.from(Ne(this,Ab)).forEach(e=>this.updateVideo(e,!0))},Mb);Nb([Mo.trace("Self.cleanupEvents")],Ub.prototype,"cleanupEvents",1),Nb([Mo.trace("Self.setupEvents")],Ub.prototype,"setupEvents",1),Nb([Mo.trace("Self.setupTracks")],Ub.prototype,"setupTracks",1),Nb([Mo.trace("Self.destructMediaHandler")],Ub.prototype,"destructMediaHandler",1),Nb([Mo.trace("Self.removeDocumentEventListeners")],Ub.prototype,"removeDocumentEventListeners",1),Nb([Rp.executeWithLock({methodName:"meeting.self.enableAudio",lockName:"Self.toggleAudio",timeout:3e3}),Mo.trace("Self.enableAudio")],Ub.prototype,"enableAudio",1),Nb([Rp.executeWithLock({methodName:"meeting.self.enableVideo",lockName:"Self.toggleVideo",timeout:3e3}),Mo.trace("Self.enableVideo")],Ub.prototype,"enableVideo",1),Nb([Mo.trace("Self.updateVideoConstraints")],Ub.prototype,"updateVideoConstraints",1),Nb([Mo.trace("Self.enableScreenShare"),Rp.executeWithLock({methodName:"meeting.self.enableScreenShare",lockName:"Self.toggleScreenShare",timeout:3e3})],Ub.prototype,"enableScreenShare",1),Nb([Mo.trace("Self.updateScreenshareConstraints")],Ub.prototype,"updateScreenshareConstraints",1),Nb([Rp.executeWithLock({methodName:"meeting.self.disableAudio",lockName:"Self.toggleAudio",timeout:3e3}),Mo.trace("Self.disableAudio")],Ub.prototype,"disableAudio",1),Nb([Rp.executeWithLock({methodName:"meeting.self.disableVideo",lockName:"Self.toggleVideo",timeout:3e3}),Mo.trace("Self.disableVideo")],Ub.prototype,"disableVideo",1),Nb([Rp.executeWithLock({methodName:"meeting.self.disableScreenShare",lockName:"Self.toggleScreenShare",timeout:3e3}),Mo.trace("Self.disableScreenShare")],Ub.prototype,"disableScreenShare",1),Nb([Mo.trace("Self.setDevice")],Ub.prototype,"setDevice",1),Ub=Nb([Bo("1100")],Ub);class Fb extends Error{constructor(e){super(null!=e?e:"AwaitQueue stopped"),this.name="AwaitQueueStoppedError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Fb)}}class jb extends Error{constructor(e){super(null!=e?e:"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,jb)}}var Bb;class Vb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];De(this,"pendingTasks",new Map),De(this,"nextTaskId",0),De(this,"stopping",!1),Ue(this,Bb,void 0),this.log=t,Fe(this,Bb,{info:t&&e?e.info:()=>{}})}get size(){return this.pendingTasks.size}push(e,t,i){return Be(this,null,function*(){if(t=null!=t?t:e.name,"function"!=typeof e)throw new TypeError("given task is not a function");if(t)try{Object.defineProperty(e,"name",{value:t})}catch(d){}return new Promise((r,n)=>{const s={id:this.nextTaskId++,task:e,metadata:i,name:t,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:e=>{if(s.completed)return;s.completed=!0,this.pendingTasks.delete(s.id),r(e);const[t]=this.pendingTasks.values();t&&!t.executedAt&&this.execute(t)},reject:e=>{if(!s.completed&&(s.completed=!0,this.pendingTasks.delete(s.id),n(e),!this.stopping)){const[e]=this.pendingTasks.values();e&&!e.executedAt&&this.execute(e)}}};this.pendingTasks.set(s.id,s),1===this.pendingTasks.size&&this.execute(s)})})}stop(){this.stopping=!0;for(const e of this.pendingTasks.values())e.reject(new Fb);this.stopping=!1}remove(e){const t=Array.from(this.pendingTasks.values())[e];t&&t.reject(new jb)}get(e){return Array.from(this.pendingTasks.values())[e]}dump(){const e=Date.now();let t=0;return Array.from(this.pendingTasks.values()).map(i=>({idx:t++,task:i.task,name:i.name,enqueuedTime:i.executedAt?i.executedAt-i.enqueuedAt:e-i.enqueuedAt,executionTime:i.executedAt?e-i.executedAt:0}))}execute(e){return Be(this,null,function*(){if(e.executedAt)throw new Error("task already being executed");e.executedAt=Date.now();try{const t=this.pendingTasks.size,i=yield e.task(),r=Date.now();Ne(this,Bb).info("AwaitQueue.push(".concat(e.name,")_timings"),{awaitQueueTask:{id:e.id,metadata:e.metadata,queueSizeAtStart:t,execTime:(r-e.executedAt)/1e3,taskStartTime:(e.executedAt-e.enqueuedAt)/1e3}}),e.resolve(i)}catch(t){e.reject(t)}})}}Bb=new WeakMap;class zb extends Uo{constructor(e){super(e),this.name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,zb):this.stack=new Error(e).stack}}class Hb extends Uo{constructor(e){super(e),this.name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,Hb):this.stack=new Error(e).stack}}class $b extends Uo{constructor(e){super(e),this.name="TransportConnectionError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,Hb):this.stack=new Error(e).stack}}const Gb=e=>new Promise(t=>setTimeout(t,e));function Wb(e,t){return Be(this,null,function*(){return new Promise((i,r)=>Be(this,null,function*(){const{strategy:n,maxRetryCount:s,delayTime:a}=Le({strategy:"linear",maxRetryCount:3,delayTime:10},t);let o,c=0,l=!1;const d=e=>{l=!0,r(e)};for(;c({channels:e.channels,clockRate:e.clockRate,mimeType:e.mimeType,sdpFmtpLine:e.sdpFmtpLine}))}function Kb(e){return e.map(e=>({uri:e.uri}))}function Zb(e){return{codecs:qb(e.codecs),headerExtensions:Kb(e.headerExtensions?e.headerExtensions:[])}}var Yb;class Jb{constructor(e){Ue(this,Yb,void 0),De(this,"events"),Fe(this,Yb,e),this.events=jh}joinRoom(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;return Be(this,null,function*(){const s={roomUuid:e,displayName:t,prejoined:r,capabilities:i};return n&&(s.location=n),(yield Ne(this,Yb).sendMessagePromiseWithTimeout({event:this.events.joinRoom,protobuf:Cc.toBinary(s),timeout:5e3})).payload})}connectTransport(e){return Be(this,null,function*(){const t=(yield Ne(this,Yb).sendMessagePromise(this.events.createWebRTCTransport,pc.toBinary(e))).payload,{transportId:i,description:r,producerIds:n}=fc.fromBinary(t);return{transportId:i,answer:{sdp:null==r?void 0:r.sdp,type:r.type},producerIds:n}})}produce(e){return Be(this,null,function*(){var t,i;const r=(yield Ne(this,Yb).sendMessagePromise(this.events.produce,Oc.toBinary(e))).payload,n=Xc.fromBinary(r);return{answer:{sdp:null==(t=null==n?void 0:n.description)?void 0:t.sdp,type:null==(i=null==n?void 0:n.description)?void 0:i.type},producerId:n.producerId}})}consume(e){return Be(this,null,function*(){const t=(yield Ne(this,Yb).sendMessagePromise(this.events.consume,Ic.toBinary(e))).payload,{consumerIdsMap:{map:i},description:r}=Qc.fromBinary(t);return{consumerStateMap:i,sessionDescription:r}})}closeProducer(e){return Be(this,null,function*(){const t=(yield Ne(this,Yb).sendMessagePromise(this.events.closeProducer,Fc.toBinary(e))).payload,{description:i}=el.fromBinary(t);return i})}closeConsumer(e){return Be(this,null,function*(){return(yield Ne(this,Yb).sendMessagePromise(this.events.closeConsumer,jc.toBinary(e))).payload})}updateConsumersSimulcastConfig(e){return Be(this,null,function*(){return(yield Ne(this,Yb).sendMessagePromise(this.events.updateConsumersSimulcastConfig,Dc.toBinary(e))).payload})}hostControlForPeer(e,t){return Be(this,null,function*(){const i={audio:"audio"===t,screeShare:!1,video:"video"===t,participantId:e},r=(yield Ne(this,Yb).sendMessagePromise(this.events.hostControlPeer,zc.toBinary(i))).payload;if(!r)return!1;const{status:n}=il.fromBinary(r);return"success"===n})}hostControlForAll(e){return Be(this,null,function*(){const t={audio:"audio"===e,screenShare:!1,video:"video"===e},i=(yield Ne(this,Yb).sendMessagePromise(this.events.hostControlAllPeers,Hc.toBinary(t))).payload;if(!i)return!1;const{status:r}=rl.fromBinary(i);return"success"===r})}kickAll(){return Be(this,null,function*(){Ne(this,Yb).sendMessagePromise(Mh.kickAll,Bc.toBinary({propagateKickAcrossRooms:!1}))})}kickPeer(e){return Be(this,null,function*(){Ne(this,Yb).sendMessagePromise(Mh.kick,Ql.toBinary(e))})}changeDisplayName(e){return Be(this,null,function*(){const t=(yield Ne(this,Yb).sendMessagePromise(this.events.changeDisplayName,Vc.toBinary(e))).payload;if(!t)return!1;const{status:i}=nl.fromBinary(t);return"success"===i})}notifySelfJoinComplete(){return Be(this,null,function*(){const e=(yield Ne(this,Yb).sendMessagePromise(this.events.selfJoinComplete,Ac.toBinary({}))).payload;return Yc.fromBinary(e)})}audioActivity(e){return Be(this,null,function*(){Ne(this,Yb).sendMessage(this.events.audioActivity,gc.toBinary(e))})}}Yb=new WeakMap;var Qb,Xb,ek,tk,ik,rk,nk,sk,ak,ok,ck,lk,dk,hk,uk,pk,gk,fk,mk,vk,bk,kk,yk,wk,Sk=(e=>(e.NEW="new",e.CONNECTING="connecting",e.RECONNECTING="reconnecting",e.DISCONNECTED="disconnected",e.CONNECTED="connected",e.FAILED="failed",e.CLOSED="closed",e))(Sk||{});class xk extends nt.EventEmitter{constructor(e){super(),Ue(this,Qb,void 0),Fe(this,Qb,e),this.setMaxListeners(1/0)}get logger(){return Ne(this,Qb).getValue("logger")}safeEmit(e){const t=this.listenerCount(e);try{for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n1?t-1:0),r=1;r2?i-2:0),n=2;n{setTimeout(n,t,"event request timeout");try{this.emit(e.toString(),...r,i,n)}catch(s){this.logger.error("EnhancedEventEmitter:: safeEmitAsPromise() | event listener for event ".concat(e.toString()," threw an error [event:%s]:%o"),{error:s}),n(s)}})})}}Qb=new WeakMap;class Ek extends xk{constructor(){super(...arguments),De(this,"_sendWebStream",new MediaStream),De(this,"_sendScreenShareStream",new MediaStream),De(this,"_direction"),De(this,"pc"),De(this,"_transportReady",!1),De(this,"_mapMidTransceiver",new Map),De(this,"enableHighBitrate",!1),De(this,"enableStereo",!1),De(this,"enableDtx",!0)}get midTransceiverMap(){return this._mapMidTransceiver}close(){if(this.logger.debug("".concat(this.name,"::close()")),this.pc)try{this.pc.close()}catch(e){this.logger.error("".concat(this.name,"::pc.close()"),{error:e})}}restartIce(){return Be(this,null,function*(){this.logger.debug("".concat(this.name,"::restartIce()"));const e=yield this.pc.createOffer({iceRestart:!0});return this.logger.debug("".concat(this.name,"::restartIce() | calling pc.setLocalDescription() [offer:").concat(JSON.stringify(e),"]")),{offerSdp:e,callback:e=>Be(this,null,function*(){this.logger.info("".concat(this.name,"::restartIce() | calling pc.setRemoteDescription() [answer:").concat(JSON.stringify(e),"]")),yield this.pc.setRemoteDescription(e)})}})}init(e){let{direction:t,iceServers:i,iceTransportPolicy:r,additionalSettings:n,proprietaryConstraints:s,onTrackHandler:a}=e;this.logger.debug("HandlerInterface::init()"),this._direction=t,this.pc=new RTCPeerConnection(Le({iceServers:i||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},n),s),a&&this.pc.addEventListener("track",e=>{a(e)}),this._addEventListeners()}connect(){return Be(this,null,function*(){this.pc.addTransceiver("audio",{direction:"sendonly"}),this.pc.addTransceiver("video",{direction:"sendonly"});const e=yield this.pc.createOffer();return yield this.pc.setLocalDescription(e),this.logger.info("connect offer: ".concat(JSON.stringify(e))),{offerSdp:e,callback:e=>Be(this,null,function*(){this.logger.debug("".concat(this.name,"::connect() | calling pc.setRemoteDescription() [answer:").concat(JSON.stringify(e),"]")),yield this.pc.setRemoteDescription(e)})}})}getTransportStats(){return Be(this,null,function*(){return this.pc.getStats()})}_assertSendDirection(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}getReceiverStats(e){return Be(this,null,function*(){this._assertRecvDirection();const t=this.midTransceiverMap.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.receiver.getStats()})}stopSending(e){return Be(this,null,function*(){this._assertSendDirection(),this.logger.debug("stopSending() [localId:".concat(e,"]"));const t=this.midTransceiverMap.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");t.sender.replaceTrack(null),this.pc.removeTrack(t.sender),t.direction="inactive";const i=yield this.pc.createOffer();return this.logger.debug("stopSending() | calling pc.setLocalDescription() [offer:".concat(JSON.stringify(i),"]")),yield this.pc.setLocalDescription(i),{offerSdp:i,callback:t=>Be(this,null,function*(){this.logger.debug("stopSending() | calling pc.setRemoteDescription() [answer:".concat(JSON.stringify(t),"]")),yield this.pc.setRemoteDescription(t),this.midTransceiverMap.delete(e)})}})}replaceTrack(e,t){return Be(this,null,function*(){this._assertSendDirection(),t?this.logger.debug("replaceTrack() [localId:".concat(e,", track.id:").concat(t.id,"]")):this.logger.debug("replaceTrack() [localId:".concat(e,", no track]"));const i=this.midTransceiverMap.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");yield i.sender.replaceTrack(t)})}setMaxSpatialLayer(e,t){return Be(this,null,function*(){this._assertSendDirection(),this.logger.debug("setMaxSpatialLayer() [localId:".concat(e,", spatialLayer:").concat(t,"]"));const i=this.midTransceiverMap.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach((e,i)=>{e.active=i<=t}),yield i.sender.setParameters(r)})}setRtpEncodingParameters(e,t){return Be(this,null,function*(){this._assertSendDirection(),this.logger.debug("setRtpEncodingParameters() [localId:".concat(e,", params:").concat(JSON.stringify(t),"]"));const i=this.midTransceiverMap.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters();r.encodings.forEach((e,i)=>{r.encodings[i]=Le(Le({},e),t)}),yield i.sender.setParameters(r)})}getSenderStats(e){this._assertSendDirection();const t=this.midTransceiverMap.get(e);if(!t)throw new Error("associated RTCRtpTransceiver not found");return t.sender.getStats()}_addEventListeners(){this.pc.addEventListener("icecandidate",e=>{e.candidate&&this.emit("@icecandidate",{candidate:e.candidate})}),this.pc.addEventListener("iceconnectionstatechange",()=>{switch(this.pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected"),this._transportReady=!0;break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed");break;default:this.logger.warn("unknown state")}}),this.pc.addEventListener("negotiationneeded",()=>{this.emit("@negotiationneeded",{}),this.logger.debug("negotiationneeded")}),this.pc.addEventListener("icegatheringstatechange",()=>{switch(this.pc.iceGatheringState){case"gathering":this.logger.debug("icegatheringstatechange | gathering"),this.emit("@icegatheringstatechange","gathering");break;case"complete":this.logger.debug("icegatheringstatechange | complete"),this.emit("@icegatheringstatechange","complete");break;default:this.logger.warn("unknown state")}}),this.pc.addEventListener("icecandidateerror",e=>{this.logger.warn("icecandidateerror",{error:{code:e.errorCode,message:e.errorText}})}),this.pc.addEventListener("datachannel",e=>{this.logger.info("data channel created: ",{rtcChannel:{label:e.channel.label}});const{channel:t}=e;t.onopen=()=>{this.logger.info("data channel open: ",{rtcChannel:{label:e.channel.label}}),this.safeEmit("dc_open",e.channel)},t.onclose=()=>{this.logger.warn("data channel closed: ",{rtcChannel:{label:e.channel.label}})},t.onerror=()=>{this.logger.error("data channel error: ",{rtcChannel:{label:e.channel.label}})}}),this.addCustomEventListeners()}addCustomEventListeners(){}}class Tk extends Ek{static createFactory(e){return()=>new Tk(e)}get name(){return"Chrome74"}init(e){let{direction:t,iceServers:i,iceTransportPolicy:r,additionalSettings:n,proprietaryConstraints:s,onTrackHandler:a}=e;this._direction=t,this.pc=new RTCPeerConnection(Le({iceServers:i||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"},n),s),a&&this.pc.addEventListener("track",e=>{a(e)}),this._addEventListeners()}send(e){return Be(this,arguments,function(e){var t=this;let{track:i,encodings:r,codecOptions:n,screenShare:s}=e;return function*(){t._assertSendDirection();const e=t.pc.addTransceiver(i,{direction:"sendonly",streams:[s?t._sendScreenShareStream:t._sendWebStream],sendEncodings:r});if(!navigator.isReactNative){t.logger.debug("creating new transceiver");const r=RTCRtpSender.getCapabilities("string"==typeof i?i:i.kind);t.logger.info("senders available params: ".concat(JSON.stringify(r)));const s=[];n&&n.length&&n.forEach(e=>{var i;const n=r.codecs.find(t=>t.mimeType.includes(e.name));if(e.parameters){t.logger.debug("codecOption.parameters:".concat(JSON.stringify(e.parameters)));const r=(null==(i=n.sdpFmtpLine)?void 0:i.split(";"))||[];r.push(...e.parameters);const s=Array.from(new Set(r).values());n.sdpFmtpLine=s.join(";")}s.push(n)}),t.logger.info("selected codecs: ".concat(JSON.stringify(s))),e.setCodecPreferences(s)}const a=yield t.pc.createOffer();if(yield t.pc.setLocalDescription(a),n&&n.findIndex(e=>{let{name:t}=e;return"opus"===t})>=0){const{enableDtx:e,enableStereo:i}=t,r=t.enableHighBitrate?i?128e3:64e3:i?64e3:32e3;a.sdp=a.sdp.replace("minptime=10;useinbandfec=1","minptime=10;useinbandfec=1;".concat(e?"usedtx=1;":"").concat(i?"stereo=1;sprop-stereo=1;":"","maxaveragebitrate=").concat(r)),a.sdp+="a=rtcp-fb:111 nack\r\n"}t.midTransceiverMap.set(e.mid,e);return t.logger.debug("send() | calling pc.setLocalDescription() [offer: ".concat(JSON.stringify(a,void 0,2),"]")),{offerSdp:a,callback:i=>Be(t,null,function*(){return this.logger.debug("send() | calling pc.setRemoteDescription() [answer:".concat(JSON.stringify(i),"]")),yield this.pc.setRemoteDescription(i),e.mid}),sender:e.sender,mid:e.mid}}()})}addCustomEventListeners(){this.pc.addEventListener("datachannel",e=>{const{channel:t}=e;t.onmessage=t=>{this.safeEmit("datachannel",e.channel,String.fromCharCode(...new Uint8Array(t.data)))}})}}class _k extends Ek{constructor(e,t){super(e),De(this,"supportsSendEncodings",!1),this.supportsSendEncodings=t.supportsSendEncodings}static createFactory(e,t){return()=>new _k(e,t)}get name(){return"Firefox60"}send(e){return Be(this,arguments,function(e){var t=this;let{track:i,encodings:r,codecOptions:n,screenShare:s}=e;return function*(){t._assertSendDirection();const e=t.supportsSendEncodings&&void 0!==r?{sendEncodings:r}:{},a=t.pc.addTransceiver(i,Le({direction:"sendonly",streams:[s?t._sendScreenShareStream:t._sendWebStream]},e));if(!t.supportsSendEncodings&&r){r.reverse();const e=a.sender.getParameters();e.encodings=r,yield a.sender.setParameters(e)}const o=yield t.pc.createOffer();if(o.sdp=((e,t)=>{var i;const r=ye.qg(e),n=r.media[r.media.length-1],s=n.rtp.filter(e=>t.some(t=>t.name===e.codec)),a=n.fmtp.filter(e=>s.some(t=>t.payload===e.payload)),o=null==(i=n.rtcpFb)?void 0:i.filter(e=>s.some(t=>t.payload===e.payload)),c=s.map(e=>e.payload);return r.media[r.media.length-1].rtp=s,r.media[r.media.length-1].fmtp=a,r.media[r.media.length-1].rtcpFb=o,r.media[r.media.length-1].payloads=c.join(" "),ye.M9(r)})(o.sdp,n),t.logger.debug("send() | calling pc.setLocalDescription() [offer:".concat(JSON.stringify(o),"]")),yield t.pc.setLocalDescription(o),"audio"===i||"audio"===i.kind){const{enableDtx:e,enableStereo:i}=t,r=t.enableHighBitrate?i?128e3:64e3:i?64e3:32e3;o.sdp=o.sdp.replace("minptime=10;useinbandfec=1","minptime=10;useinbandfec=1;".concat(e?"usedtx=1;":"").concat(i?"stereo=1;sprop-stereo=1;":"","maxaveragebitrate=").concat(r))}return t.midTransceiverMap.set(a.mid,a),{offerSdp:o,callback:e=>Be(t,null,function*(){return this.logger.debug("send() | calling pc.setRemoteDescription() [answer:".concat(JSON.stringify(e),"]")),yield this.pc.setRemoteDescription(e),a.mid}),sender:a.sender,mid:a.mid}}()})}setMaxSpatialLayer(e,t){return Be(this,null,function*(){this._assertSendDirection(),this.logger.debug("setMaxSpatialLayer() [localId:".concat(e,", spatialLayer:").concat(t,"]"));const i=this.midTransceiverMap.get(e);if(!i)throw new Error("associated RTCRtpTransceiver not found");const r=i.sender.getParameters(),n=r.encodings.length-1-t;r.encodings.forEach((e,t)=>{e.active=t>=n}),yield i.sender.setParameters(r)})}addCustomEventListeners(){this.pc.addEventListener("datachannel",e=>{const{channel:t}=e;t.onmessage=t=>Be(this,null,function*(){const i=yield t.data.arrayBuffer();this.safeEmit("datachannel",e.channel,String.fromCharCode(...new Uint8Array(i)))})})}}class Pk extends Ek{static createFactory(e){return()=>new Pk(e)}get name(){return"Safari12"}send(e){return Be(this,arguments,function(e){var t=this;let{track:i,encodings:r,codecOptions:n,screenShare:s}=e;return function*(){t._assertSendDirection(),t.logger.debug("Safari12::creating new transceiver");const e=t.pc.addTransceiver(i,{direction:"sendonly",streams:[s?t._sendScreenShareStream:t._sendWebStream],sendEncodings:r}),a=RTCRtpSender.getCapabilities("string"==typeof i?i:i.kind);t.logger.info("Safari12::senders available params: ".concat(JSON.stringify(a)));const o=[];n&&n.length>0&&n.forEach(e=>{var i;const r=a.codecs.find(t=>t.mimeType.includes(e.name));if(e.parameters){t.logger.info("Safari12::codecOption.parameters:, ".concat(JSON.stringify(e.parameters)));const n=(null==(i=r.sdpFmtpLine)?void 0:i.split(";"))||[];n.push(...e.parameters);const s=[...new Set(n).values()];r.sdpFmtpLine=s.join(";")}o.push(r)}),t.logger.info("Safari12::selected codecs: ".concat(JSON.stringify(o))),e.setCodecPreferences(o);const c=yield t.pc.createOffer();if(yield t.pc.setLocalDescription(c),"audio"===i||"audio"===i.kind){const{enableStereo:e,enableDtx:i}=t,r=t.enableHighBitrate?e?128e3:64e3:e?64e3:32e3;c.sdp=c.sdp.replace("minptime=10;useinbandfec=1","minptime=10;useinbandfec=1;".concat(i?"usedtx=1;":"").concat(e?"stereo=1;sprop-stereo=1;":"","maxaveragebitrate=").concat(r))}return t.midTransceiverMap.set(e.mid,e),{offerSdp:c,callback:i=>Be(t,null,function*(){return this.logger.debug("Safari12::send() | calling pc.setRemoteDescription() [answer:".concat(JSON.stringify(i),"]")),yield this.pc.setRemoteDescription(i),e.mid}),sender:e.sender,mid:e.mid}}()})}addCustomEventListeners(){this.pc.ondatachannel=e=>{const{channel:t}=e;t.onmessage=t=>Be(this,null,function*(){const i=String.fromCharCode(...new Uint8Array(t.data));this.safeEmit("datachannel",e.channel,i)})}}}class Ck extends xk{constructor(e,t){var i;super(e),Ue(this,rk),Ue(this,sk),Ue(this,ok),Ue(this,lk),De(this,"rtpReceiver"),De(this,"id"),De(this,"localId"),De(this,"producerId"),De(this,"producingTransportId"),De(this,"mimeType"),De(this,"track"),De(this,"peerId"),De(this,"appData"),De(this,"transceiver"),Ue(this,Xb,void 0),Ue(this,ek,void 0),Ue(this,tk,void 0),Ue(this,ik,void 0),this.id=t.id,this.localId=t.localId,Fe(this,Xb,t.handler),this.appData=t.appData,this.peerId=t.producingPeerId,this.producingTransportId=t.producingTransportId,Fe(this,tk,!1),this.producerId=t.producerId,this.track=t.track,Fe(this,ek,null!=(i=t.paused)&&i),this.mimeType=t.mimeType,this.transceiver=t.transceiver,this.rtpReceiver=t.rtpReceiver,je(this,ok,ck).call(this),Fe(this,ik,e)}get closed(){return Ne(this,tk)}get kind(){return this.track.kind}get paused(){return Ne(this,ek)}close(e,t){Ne(this,tk)||(this.logger.debug("Consumer::close() ".concat(e?"with reason ".concat(e):""),Ne(this,rk,nk)),Fe(this,tk,!0),t&&(je(this,lk,dk).call(this),this.transceiver.stop()),this.safeEmit("close",e))}getStats(){return Be(this,null,function*(){if(Ne(this,tk))throw new Hb("closed");return Ne(this,Xb).getReceiverStats(this.localId)})}pause(){this.logger.debug("consumer::pause()",Ne(this,rk,nk)),Ne(this,tk)?this.logger.error("consumer::pause() | Consumer closed",Ne(this,rk,nk)):(Fe(this,ek,!0),this.track.enabled=!1,this.safeEmit("pause"))}resume(){this.logger.debug("consumer::resume()",Ne(this,rk,nk)),Ne(this,tk)?this.logger.error("Consumer::resume() | Consumer closed",Ne(this,rk,nk)):(Fe(this,ek,!1),this.track.enabled=!0,this.safeEmit("resume"))}}Xb=new WeakMap,ek=new WeakMap,tk=new WeakMap,ik=new WeakMap,rk=new WeakSet,nk=function(){return{consumer:{id:this.id,appData:this.appData,peerId:this.peerId,kind:this.kind}}},sk=new WeakSet,ak=function(){this.logger.debug('Consumer::track "ended" event',Ne(this,rk,nk)),this.safeEmit("trackended")},ok=new WeakSet,ck=function(){this.track.addEventListener("ended",je(this,sk,ak).bind(this))},lk=new WeakSet,dk=function(){try{this.track.removeEventListener("ended",je(this,sk,ak)),this.track.stop()}catch(e){this.logger.error("Consumer::destroyTrack()",Ie(Le({},Ne(this,rk,nk)),{error:e}))}};class Ak extends xk{constructor(e,t){var i,r;super(e),Ue(this,yk),De(this,"id"),De(this,"localId"),Ue(this,hk,void 0),De(this,"kind"),De(this,"appData"),De(this,"rtpSender"),Ue(this,uk,void 0),Ue(this,pk,void 0),Ue(this,gk,void 0),Ue(this,fk,!1),Ue(this,mk,void 0),Ue(this,vk,void 0),Ue(this,bk,void 0),Ue(this,kk,void 0),this.id=t.id,this.localId=t.localId,Fe(this,mk,t.track),this.kind=null==(i=t.track)?void 0:i.kind,Fe(this,vk,!!t.disableTrackOnPause&&!(null!=(r=t.track)&&r.enabled)),Fe(this,bk,void 0),Fe(this,uk,t.stopTracks),Fe(this,pk,t.disableTrackOnPause),Fe(this,gk,t.zeroRtpOnPause),this.appData=t.appData||{},this._onTrackEnded=this._onTrackEnded.bind(this),Fe(this,hk,t.handler),this.rtpSender=t.rtpSender,this._handleTrack(),Fe(this,kk,e)}get closed(){return Ne(this,fk)}get track(){return Ne(this,mk)}get paused(){return Ne(this,vk)}get maxSpatialLayer(){return Ne(this,bk)}close(e){return Be(this,null,function*(){if(Ne(this,fk))return;if(this.logger.debug("Producer::close() ".concat(e?"with reason ".concat(e):""),Ne(this,yk,wk)),Fe(this,fk,!0),this._destroyTrack(),e===jk)return void this.safeEmit("close",{reason:e});const{offerSdp:t,callback:i}=yield Ne(this,hk).stopSending(this.localId),{answer:r}=yield this.safeEmitAsPromise("close",{offer:t,reason:e});i(r)})}getStats(){return Be(this,null,function*(){if(Ne(this,fk))throw new Hb("closed");return Ne(this,hk).getSenderStats(this.localId)})}pause(){this.logger.debug("Producer::pause()",Ne(this,yk,wk)),Ne(this,fk)&&this.logger.error("Producer::pause() | Producer closed",Ne(this,yk,wk)),Fe(this,vk,!0),Ne(this,mk)&&Ne(this,pk)&&(Ne(this,mk).enabled=!1),Ne(this,gk)&&Ne(this,hk).replaceTrack(this.localId,null),this.emit("pause")}resume(){this.logger.debug("Producer::resume()",Ne(this,yk,wk)),Ne(this,fk)?this.logger.error("Producer::resume() | Producer closed",Ne(this,yk,wk)):(Fe(this,vk,!1),Ne(this,mk)&&Ne(this,pk)&&(Ne(this,mk).enabled=!0),Ne(this,gk)&&Ne(this,hk).replaceTrack(this.localId,Ne(this,mk)),this.emit("resume"))}replaceTrack(e){return Be(this,arguments,function(e){var t=this;let{track:i}=e;return function*(){if(t.logger.debug("Producer::replaceTrack() trackId: ".concat(null==i?void 0:i.id),Ne(t,yk,wk)),Ne(t,fk)){if(i&&Ne(t,uk))try{i.stop()}catch(d){t.logger.error("Producer::replaceTrack",Ie(Le({},Ne(t,yk,wk)),{error:d}))}throw new Hb("closed")}if(i&&"ended"===i.readyState)throw new Hb("track ended");i!==Ne(t,mk)?((!Ne(t,gk)||!Ne(t,vk))&&(yield Ne(t,hk).replaceTrack(t.localId,i)),t._destroyTrack(),Fe(t,mk,i),t._handleTrack()):t.logger.debug("replaceTrack() | same track, ignored trackId: ".concat(i.id),Ne(t,yk,wk))}()})}setMaxSpatialLayer(e){return Be(this,null,function*(){if(Ne(this,fk))throw new Hb("closed");if("video"!==this.kind)throw new zb("not a video Producer");if("number"!=typeof e)throw new TypeError("invalid spatialLayer");yield Ne(this,hk).setMaxSpatialLayer(this.localId,e),Fe(this,bk,e)})}setRtpEncodingParameters(e){return Be(this,null,function*(){if(Ne(this,fk))throw new Hb("closed");if("object"!=typeof e)throw new TypeError("invalid params");yield Ne(this,hk).setRtpEncodingParameters(this.localId,e)})}_onTrackEnded(){this.logger.debug('Producer::track "ended" event trackId: '.concat(this.track.id),Ne(this,yk,wk)),this.safeEmit("trackended",this.track.id)}_handleTrack(){Ne(this,mk)&&Ne(this,mk).addEventListener("ended",this._onTrackEnded)}_destroyTrack(){var e;if(Ne(this,mk))try{Ne(this,mk).removeEventListener("ended",this._onTrackEnded),Ne(this,uk)&&Ne(this,mk).stop()}catch(t){this.logger.error("Producer::_destroyTrack trackId: ".concat(null==(e=this.track)?void 0:e.id),Ie(Le({},Ne(this,yk,wk)),{error:t}))}}}function Rk(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function Lk(e){return Math.random().toString(36).substring(2,2+e)}hk=new WeakMap,uk=new WeakMap,pk=new WeakMap,gk=new WeakMap,fk=new WeakMap,mk=new WeakMap,vk=new WeakMap,bk=new WeakMap,kk=new WeakMap,yk=new WeakSet,wk=function(){return{producer:{id:this.id,appData:this.appData,kind:this.kind}}};function Ik(e){const t=e;return delete t.payload._bolt,t}function Mk(e){var t,i;return function(e){return e.payload&&Rk(e.payload)}(e)&&null!=(i=null==(t=e.payload._bolt)?void 0:t.id)?i:""}var Dk,Ok,Nk;const Uk=class extends nt.EventEmitter{constructor(e,t,i,r){var n;super(),n=this,De(this,"channel"),De(this,"queue"),De(this,"serverProtocolVersion"),Ue(this,Dk,new Map),Ue(this,Ok,void 0),Ue(this,Nk,void 0),De(this,"respond",function(e,t){let i;i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?Uk.createErrorResponse(e,t):Uk.createResponse(e,t),n.channel.send(JSON.stringify(i))}),De(this,"notify",e=>{const t=Uk.createNotification(e);this.channel.send(JSON.stringify(t))}),De(this,"request",e=>Be(this,null,function*(){const t=Uk.createRequest(e),i=new Promise((e,i)=>{const{id:r}=t.payload._bolt,n={id:r,method:t.type,resolve:t=>{this.queue.delete(r)&&(clearTimeout(n.timer),e(t))},timer:setTimeout(()=>{this.queue.delete(r)&&i(new Error("request timeout for message id: ".concat(r)))},2e4),cancel:e=>{this.queue.delete(r)&&(clearTimeout(n.timer),i(e))}};this.queue.set(r,n)});return this.channel.send(JSON.stringify(t)),i})),De(this,"send",e=>{const t=JSON.stringify(e);if(t.length>16384){const e=16184,i=Math.ceil(t.length/e),r=[];for(let s=0;s{var t;Ne(this,Dk).has(e.id)||Ne(this,Dk).set(e.id,[]);const i=Ne(this,Dk).get(e.id);if(i[e.chunkIndex]=e,(null==i?void 0:i.length)===e.count&&!i.some(e=>void 0===e)){const i=Ne(this,Dk).get(e.id),r=null==i?void 0:i.reduce((e,t)=>e+t.chunk,"");Ne(this,Dk).delete(e.id);const n=JSON.parse(r);if(!n.payload||!Rk(n.payload))throw new Error("corrupted incoming message over dc",{cause:{code:"CORRUPT_DC_MESSAGE",values:n}});if(this.processBoltHandshake(n))return;if(this.serverProtocolVersion=null==(t=n.payload._bolt)?void 0:t.version,!this.processResponseMsg(n))return n}}),De(this,"processResponseMsg",e=>{const{id:t}=e.payload._bolt,i=this.queue.get(t);return!!i&&(Ne(this,Nk).debug("resolving pending request with id: ".concat(t,", complete response: ").concat(JSON.stringify(e))),"error"===e.type?i.cancel(Ik(e)):i.resolve(Ik(e)),!0)}),De(this,"processBoltHandshake",e=>{var t,i;return("_bolt"===e.type||"handshake"===e.type)&&(this.respond(null!=(i=null==(t=e.payload._bolt)?void 0:t.id)?i:Lk(8),{type:"_bolt",payload:{message:"pong"}}),!0)}),this.label=i,this.transportId=r,Fe(this,Ok,e),Fe(this,Nk,e.getValue("logger")),this.channel=t,this.queue=new Map}};let Fk=Uk;Dk=new WeakMap,Ok=new WeakMap,Nk=new WeakMap,De(Fk,"createRequest",e=>{var t;if(null!=(t=e.payload)&&t._bolt)throw new Error("rpc fields are internal values");return{type:e.type,payload:Ie(Le({},e.payload),{_bolt:{id:Lk(8),type:"REQUEST",version:1}})}}),De(Fk,"createResponse",(e,t)=>{var i;if(null!=(i=t.payload)&&i._bolt)throw new Error("rpc fields are internal values");return{type:t.type,payload:Ie(Le({},t.payload),{_bolt:{id:e,type:"RESPONSE",version:1}})}}),De(Fk,"createNotification",e=>{var t;if(null!=(t=e.payload)&&t._bolt)throw new Error("rpc fields are internal values");return{type:e.type,payload:Ie(Le({},e.payload),{bolt:{id:Lk(8),type:"NOTIFY",version:1}})}}),De(Fk,"createErrorResponse",(e,t)=>({type:"error",payload:{error:t.message,_bolt:{id:e,type:"RESPONSE",version:1}}}));const jk="transport closed";var Bk;const Vk=class extends xk{constructor(e,t){let{id:i,direction:r,handlerFactory:n,iceServers:s,iceTransportPolicy:a,proprietaryConstraints:o,additionalSettings:c,appData:l,config:d}=t;var h,u,p;super(e),De(this,"awaitQueue"),De(this,"observer"),De(this,"id"),De(this,"serverId"),De(this,"direction"),De(this,"maxSctpMessageSize"),De(this,"handler"),De(this,"connectionState","new"),De(this,"producers"),De(this,"consumers"),De(this,"datachannels"),De(this,"connected",!1),De(this,"eventsDCReadyPromise"),De(this,"eventsDCReadyPromiseResolver"),De(this,"eventsDCFailureTimer"),De(this,"transportConnectionPromise"),De(this,"consumerTrackEvents"),De(this,"unknownTracksMap"),De(this,"appData"),Ue(this,Bk,void 0),Fe(this,Bk,e);const g=e.getValue("logger");g.debug("constructor() [id: ".concat(i,", direction: ").concat(r,"]")),this.id=i,this.direction=r;const f=function(e,t){return"undefined"==typeof e?t:"undefined"!=typeof window&&Object.getOwnPropertyDescriptor(window,"structuredClone")?structuredClone(e):JSON.parse(JSON.stringify(e))}(c,{});delete f.iceServers,delete f.iceTransportPolicy,delete f.bundlePolicy,delete f.rtcpMuxPolicy,delete f.sdpSemantics,this.producers=new Map,this.consumers=new Map,this.datachannels=new Map,this.consumerTrackEvents=new Map,this.unknownTracksMap=new Map,this.awaitQueue=new Vb(g,!0),this.handler=n(),this.handler.enableHighBitrate=null!=(h=null==d?void 0:d.enableHighBitrate)&&h,this.handler.enableStereo=null!=(u=null==d?void 0:d.enableStereo)&&u,this.handler.enableDtx=null==(p=null==d?void 0:d.enableDtx)||p,this.handler.init({onTrackHandler:this._ontrack.bind(this),direction:r,iceServers:s,iceTransportPolicy:a,additionalSettings:c,proprietaryConstraints:o}),this.appData=l||{},this.transportConnectionPromise=new Promise(e=>{this.once("connected",()=>{e(!0)}),this.once("disconnect",()=>{e(!1)}),this.once("close",()=>{e(!1)})}),this.eventsDCReadyPromise=new Promise(e=>{this.eventsDCReadyPromiseResolver=e}),this.handler.on("@connectionstatechange",e=>{e!==this.connectionState&&(this.logger.debug("connection state changed to ".concat(e)),this.connectionState=e,"connected"===e&&(this.connected=!0,this.emit("connected")),"disconnected"===e&&(this.connected=!1,this.emit("disconnect")),("failed"===e||"closed"===e)&&(this.connected=!1,this.emit("close")),this.closed||this.safeEmit("connectionstatechange",e))}),this.handler.on("@icecandidate",e=>{let{candidate:t}=e;this.closed||this.safeEmit("icecandidate",t)}),this.handler.on("dc_open",e=>{let t=this.datachannels.get(e.label);t||(t||(t=new Fk(Ne(this,Bk),e,e.label,this.serverId),this.datachannels.set(e.label,t)),this.eventsDCFailureTimer=setTimeout(()=>{"events"===e.label&&(this.eventsDCReadyPromiseResolver(!1),this.safeEmit("dc_error",e.label))},5e3))}),this.handler.on("datachannel",(e,t)=>{"events"===e.label&&(this.eventsDCReadyPromiseResolver(!0),this.eventsDCFailureTimer&&clearTimeout(this.eventsDCFailureTimer));const i=this.datachannels.get(e.label);if(i)try{const r=JSON.parse(t);this.logger.debug("datachannel message chunk recieved",{dataChannelMessageChunk:{id:r.id,count:r.count,chunkIndex:r.chunkIndex,chunk:r.chunk,transprtId:this.serverId}});const n=i.processMessage(r);if(!n)return;this.logger.debug("datachannel message with id:".concat(r.id," on transport:").concat(this.serverId,"complete - ").concat(JSON.stringify(n))),this.emit("datachannel:".concat(e.label),i.label,n)}catch(r){this.logger.error("error parsing message",{error:r})}else this.logger.error("unregistered datachannel for message",{rtcChannel:{label:e.label,message:t}})})}get closed(){return"closed"===this.connectionState}setServerId(e){this.serverId=e}getDatachannel(e){return this.datachannels.get(e)}get isEventsDCReady(){return this.eventsDCReadyPromise}close(){this.closed||(this.logger.debug("Transport close called"),this.connectionState="closed",this.awaitQueue.stop(),this.awaitQueue=void 0,this.connected=!1,this.handler.close(),Array.from(this.producers.values()).forEach(e=>{e.close(jk).catch(()=>{})}),this.producers.clear(),Array.from(this.consumers.values()).forEach(e=>{e.close(jk)}),this.consumers.clear(),this.consumerTrackEvents.clear(),this.emit("close"))}getStats(){return Be(this,null,function*(){if(this.closed)throw new Hb("closed");return this.handler.getTransportStats()})}connect(e){return Be(this,null,function*(){try{if(yield this.awaitQueue.push(()=>Be(this,null,function*(){const{offerSdp:t,callback:i}=yield this.handler.connect(),{transportId:r,answer:n}=yield e(t);this.setServerId(r),yield i(n)})),!(yield this.transportConnectionPromise))throw new Error("ice connection failed")}catch(t){throw this.logger.error("transport failed to connect:",{error:t}),t}})}restartIce(){return Be(this,null,function*(){if(this.logger.debug("restartIce()"),this.closed)throw new Hb("closed");return this.handler.restartIce()})}canProduce(e){return Be(this,null,function*(){const{track:t,appData:i}=e;if(!t)throw new TypeError("missing track");if("send"!==this.direction)throw new zb("not a sending Transport");if("ended"===t.readyState)throw new Hb("track ended");if(i&&"object"!=typeof i)throw new TypeError("if given, appData must be an object");if(!(yield this.transportConnectionPromise))throw new $b("transport not connected");return!0})}produce(e,t){return Be(this,null,function*(){if(!(yield this.canProduce(e)))throw new Error("Cannot produce");const{track:i,encodings:r,codecOptions:n,stopTracks:s=!0,disableTrackOnPause:a=!0,zeroRtpOnPause:o=!1,appData:c={}}=e;this.logger.debug("produce() [track:".concat(i.id,"]"));const{producerId:l,localId:d,rtpSender:h}=yield this.awaitQueue.push(()=>Be(this,null,function*(){const{offerSdp:e,callback:s,sender:o,mid:l}=yield this.handler.send({track:i,encodings:r,codecOptions:n,screenShare:null==c?void 0:c.screenShare}),{answer:d,producerId:h}=yield t({offer:e,kind:i.kind,paused:!!a&&(!i.enabled||Object.hasOwn(i,"fakeTracks")),appData:Ie(Le({},c||{}),{mid:l}),codecOptions:n,producingTransportId:this.serverId});return{producerId:h,localId:yield s(d),rtpSender:o}}),"Transport.produce");return this.createProducerObject({id:l,localId:d,track:i,stopTracks:s,disableTrackOnPause:a,zeroRtpOnPause:o,appData:c,handler:this.handler,rtpSender:h})})}createProducerObject(e){return Be(this,null,function*(){const t=new Ak(Ne(this,Bk),e);return this.producers.set(t.id,t),t.once("close",()=>{this.producers.delete(t.id)}),this.emit("newproducer",t),t})}closeProducer(e){return Be(this,null,function*(){yield this.awaitQueue.push(e.close.bind(e),"Transport.closeProducer")})}canConsume(){return Be(this,null,function*(){if(this.closed)throw new Hb("closed");if("recv"!==this.direction)throw new zb("not a receiving transport");if(!(yield this.transportConnectionPromise))throw new $b("transport not connected");return!0})}consume(e,t,i){return Be(this,null,function*(){return this.awaitQueue.push(()=>Be(this,null,function*(){const r={},{consumerStates:n,sessionDescription:s,failedProducers:a}=yield t(e);n.forEach((e,t)=>{r[t]=this.createConsumerObjectAndWaitForTrack(Ie(Le({},e),{producerId:t}))}),s&&(this.logger.info("Session description found, sending negotiation request"),yield i(s));const o=[];return yield Promise.all(Object.entries(r).map(e=>{let[t,i]=e;return i.then(e=>o.push(e)).catch(()=>{this.logger.error("Failed to create consumer object, producer: ".concat(t),{error:{message:"This should not happen"},transport:{serverId:this.serverId}})})})),{consumers:o,failedProducers:a}}),"Transport.consume",{producersLength:e.length})})}static parseCodecAndFmtpMappings(e,t){const i=ye.qg(e.sdp),r={};return i.media.forEach(e=>{t.includes(e.mid.toString())&&(r[e.mid.toString()]={rtp:e.rtp,fmtp:e.fmtp,payloads:e.payloads,rtcpFb:e.rtcpFb})}),r}static setCodecAndFmtpMappings(e,t,i){const r=ye.qg(e.sdp);return r.media=r.media.map(e=>{if(t.includes(e.mid.toString())){const t=Le({},e);return t.rtp=i[e.mid.toString()].rtp,t.fmtp=i[e.mid.toString()].fmtp,t.payloads=i[e.mid.toString()].payloads,t.rtcpFb=i[e.mid.toString()].rtcpFb,t}return e}),Ie(Le({},e),{sdp:ye.M9(r)})}static parseHeaderExtensionMappings(e){const t=ye.qg(e.sdp),i={};return t.media.forEach(e=>{i[e.mid]=e.ext}),i}static setHeaderExtensionMappings(e,t){const i=ye.qg(e.sdp);return i.media=i.media.map(e=>{const i=Le({},e);return i.ext=t[e.mid],i}),Ie(Le({},e),{sdp:ye.M9(i)})}closeConsumers(e,t){return Be(this,null,function*(){try{const i=e.map(e=>e.transceiver.mid),r=Vk.parseCodecAndFmtpMappings(this.handler.pc.remoteDescription,i),n=Vk.parseHeaderExtensionMappings(this.handler.pc.remoteDescription);this.logger.info("Stopping transceivers",{consumerIds:e.map(e=>{let{id:t}=e;return t})}),e.forEach(e=>e.close(void 0,!0));let s=yield this.handler.pc.createOffer();this.logger.info("Created offer for closing consumers",{sdp:s.sdp}),s=Vk.setCodecAndFmtpMappings(s,i,r),s=Vk.setHeaderExtensionMappings(s,n),this.logger.info("Updated codec and fmtp mappings in close consumer offer",{sdp:s.sdp}),yield this.setLocalDescription(s),this.logger.info("Successfully set local description in close consumers");const a=yield t(e,s);this.logger.info("Received answer in close consumers",{sdp:a.sdp}),yield this.setRemoteDescription(a),this.logger.info("Remote description was set successfully in close consumers",{sdp:a.sdp})}catch(d){this.logger.error("Failed to close consumers",{error:d})}})}setRemoteOffer(e){return Be(this,null,function*(){try{this.logger.info("Received offer from SFU",{sdp:e.sdp}),yield this.setRemoteDescription(e);const t=yield this.handler.pc.createAnswer();this.logger.info("Created answer corresponding to received offer",{sdp:t.sdp});const i=ye.qg(t.sdp);return i.media=i.media.map(e=>{if("audio"===e.type){const t=Le({},e),i=t.fmtp.find(e=>111===e.payload);return i&&(i.config+=";stereo=1;sprop-stereo=1"),t.rtcpFb||(t.rtcpFb=[]),t.rtcpFb.some(e=>"nack"===e.type)||t.rtcpFb.push({payload:parseInt(t.payloads,10),type:"nack"}),t}return e}),t.sdp=ye.M9(i),this.logger.info("Setting munged SDP",{sdp:t.sdp}),yield this.setLocalDescription(t),this.logger.info("Successfully set local description",{sdp:t.sdp}),t}catch(t){throw this.logger.error("Set remote offer failed",{error:t}),t}})}_ontrack(e){const{track:t,transceiver:i}=e;this.logger.info("track event received [trackId: ".concat(t.id,"] [mid: ").concat(i.mid,"]"));const r="".concat(i.mid,":").concat(t.kind);t.addEventListener("ended",()=>{this.logger.info("rtc consumer track ended [trackId: ".concat(t.id,"]")),this.unknownTracksMap.delete(r)});const n=this.consumerTrackEvents.get(r);n?(n(t,i),this.consumerTrackEvents.delete(r)):(this.logger.warn("track event handler not found ".concat(r)),this.unknownTracksMap.set(r,e))}sendErrorOverDC(e,t,i){const r=this.getDatachannel(e);if(!r)throw new Error("datachannel not found",{cause:{code:"DC_NOT_FOUND",values:{label:e}}});r.respond(t,i,!0)}sendResponseOverDC(e,t,i){const r=this.getDatachannel(e);if(!r)throw new Error("datachannel not found",{cause:{code:"DC_NOT_FOUND",values:{label:e}}});r.respond(t,i)}createConsumerObjectAndWaitForTrack(e){return Be(this,null,function*(){const{consumerId:t,producerId:i,producingPeerId:r,producingTransportId:n,streamId:s,paused:a,screenShare:o,appData:c,kind:l,mimeType:d}=e,h="".concat(s,":").concat(l),u=Ie(Le({},e),{name:"consumer creation task error",message:"consumer creation failed"});return new Promise((e,s)=>Be(this,null,function*(){const p=setTimeout(()=>{this.logger.warn("Timed out waiting for track event ".concat(h," producingPeerId: ").concat(r)),this.consumerTrackEvents.delete(h),u.isTimedout=!0,s(u)},5e3),g=(h,g)=>{try{if("ended"===h.readyState)clearTimeout(p),s(u);else{const s=h;s.enabled=!0,this.handler.midTransceiverMap.set(g.mid,g);const u=new Ck(Ne(this,Bk),{id:t,localId:g.mid,transceiver:g,track:s,paused:a,producerId:i,producingPeerId:r,producingTransportId:n,handler:this.handler,appData:Ie(Le({},c),{screenShare:o,peerId:r}),rtpReceiver:g.receiver,mimeType:d});this.consumers.set(t,u),u.once("close",()=>{this.consumers.delete(u.id),this.handler.midTransceiverMap.delete(g.mid)}),this.logger.info("consumer created for ",{consumer:{id:t,kind:l,appData:{screenShare:o},peerId:r,producerId:i}}),this.emit("newconsumer",u),clearTimeout(p),e(u)}}catch(f){this.logger.warn("error while creating consumer:",f),clearTimeout(p),s(u)}},f=this.unknownTracksMap.get(h);f?(this.logger.info("track event already received [trackId: ".concat(f.track.id,"] [mid: ").concat(f.transceiver.mid,"]")),this.unknownTracksMap.delete(h),g(f.track,f.transceiver)):(this.logger.info("Registering onTrack handler for key ".concat(h," [producingPeerId: ").concat(r,"]")),this.consumerTrackEvents.set(h,g))}))})}setRemoteDescription(e){return Be(this,null,function*(){yield this.handler.pc.setRemoteDescription(e)})}setLocalDescription(e){return Be(this,null,function*(){this.logger.debug("".concat(this.direction,"() {transportId: ").concat(this.serverId,"} | calling pc.setLocalDescription() [offer:").concat(JSON.stringify(e),"]")),yield this.handler.pc.setLocalDescription(e)})}sendDataChannelMessage(e,t){return Be(this,null,function*(){const i=this.getDatachannel(e);if(!i)throw function(e,t){const i=new Error(t);return i.name=e,i}("DC_NOT_READY","".concat(e," datachannel not ready"));const r=(yield i.request(t)).payload;return this.logger.info("sendDataChannelMessage::response ".concat(JSON.stringify(r))),r})}};let zk=Vk;var Hk,$k;Bk=new WeakMap;class Gk{constructor(e){let{handlerName:t,handlerFactory:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};De(this,"handlerFactory"),Ue(this,Hk,void 0),Ue(this,$k,void 0);const r=e.getValue("logger");if(r.debug("constructor()"),Fe(this,Hk,e),Fe(this,$k,r),t&&i)throw new TypeError("just one of handlerName or handlerInterface can be given");if(i)this.handlerFactory=i;else{if(t)Ne(this,$k).debug("Device::constructor() | handler given: ".concat(t));else{if(t=function(e){if("object"==typeof navigator&&"ReactNative"===navigator.product)return"undefined"==typeof RTCPeerConnection?void e.warn("Device::this._detectDevice() | unsupported ReactNative without RTCPeerConnection"):(e.debug("Device::this._detectDevice() | ReactNative handler chosen"),"Chrome74");if("object"==typeof navigator&&"string"==typeof navigator.userAgent){const t=navigator.userAgent,i=g().getParser(t),r=i.getEngine();if(i.satisfies({chrome:">=74",chromium:">=74","microsoft edge":">=88"}))return"Chrome74";if(i.satisfies({chrome:">=55",chromium:">=55"}))return;if(i.satisfies({firefox:">=110"}))return"Firefox110";if(i.satisfies({firefox:">=60"}))return"Firefox60";if(i.satisfies({ios:{OS:">=14.3",firefox:">=30.0"}})||i.satisfies({safari:">=12.0"})&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(i.satisfies({safari:">=11"})||i.satisfies({"microsoft edge":">=11"})&&i.satisfies({"microsoft edge":"<=18"}))return;if(r.name&&"blink"===r.name.toLowerCase()){const e=t.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);return e?Number(e[1])>=74?"Chrome74":void 0:"Chrome74"}return"webkit"===r.name.toLowerCase()&&"ios"===i.getOS().name.toLowerCase()?"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")?"Safari12":void 0:void e.warn("Device::this._detectDevice() | browser not supported")}e.warn("Device::this._detectDevice() | unknown device")}(Ne(this,$k)),!t)throw new Error("device not supported");Ne(this,$k).debug("Device::constructor() | detected handler: ".concat(t))}switch(t){case"Chrome74":this.handlerFactory=Tk.createFactory(Ne(this,Hk));break;case"Safari12":this.handlerFactory=Pk.createFactory(Ne(this,Hk));break;case"Firefox60":this.handlerFactory=_k.createFactory(Ne(this,Hk),{supportsSendEncodings:!1});break;case"Firefox110":this.handlerFactory=_k.createFactory(Ne(this,Hk),{supportsSendEncodings:!0});break;default:throw new TypeError('unknown handlerName "'.concat(t,'"'))}}}createTransport(e){const t=u();return new zk(Ne(this,Hk),Ie(Le({id:t},e),{handlerFactory:this.handlerFactory}))}}Hk=new WeakMap,$k=new WeakMap;var Wk,qk,Kk,Zk,Yk,Jk,Qk,Xk,ey,ty,iy,ry,ny,sy,ay,oy,cy,ly,dy,hy,uy,py,gy,fy,my,vy,by,ky,yy,wy,Sy,xy,Ey,Ty,_y,Py,Cy,Ay,Ry,Ly,Iy,My,Dy,Oy,Ny,Uy,Fy,jy,By,Vy,zy,Hy,$y,Gy,Wy,qy,Ky,Zy,Yy,Jy,Qy,Xy,ew,tw,iw,rw,nw,sw,aw,ow,cw,lw,dw,hw,uw,pw,gw;class fw extends nt.EventEmitter{constructor(e,t){super(),Ue(this,ry),Ue(this,sy),Ue(this,oy),Ue(this,ly),Ue(this,hy),Ue(this,py),Ue(this,fy),Ue(this,vy),Ue(this,ky),Ue(this,wy),Ue(this,xy),De(this,"context"),Ue(this,Wk,void 0),Ue(this,qk,void 0),Ue(this,Kk,void 0),Ue(this,Zk,void 0),Ue(this,Yk,void 0),Ue(this,Jk,void 0),Ue(this,Qk,void 0),Ue(this,Xk,void 0),Ue(this,ey,{transportFailureCount:{send:0,recv:0},lastConnectionTime:0}),Ue(this,ty,void 0),Ue(this,iy,"all"),this.context=e,Fe(this,Jk,t),Fe(this,Wk,new Gk(e)),Fe(this,Qk,new Jb(t)),Fe(this,Xk,jh),Ne(this,ry,ny).mediaState={send:{state:Sk.NEW},recv:{state:Sk.NEW}},(To(this.context,"forceRelay")||this.context.getValue("flagsmith").hasFeature(po))&&Fe(this,iy,"relay"),this.logger.info("ICE Transport Policy initially set to ".concat(Ne(this,iy))),je(this,sy,ay).call(this)}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}get socket(){return Ne(this,Jk)}get socketHandler(){return Ne(this,Qk)}get sendTransport(){return Ne(this,qk)}get recvTransport(){return Ne(this,Kk)}get events(){return Ne(this,Xk)}set sendTransportConnectedCallback(e){Fe(this,Zk,e)}set recvTransportConnectedCallback(e){Fe(this,Yk,e)}setupTransports(e){return Be(this,null,function*(){let t,i;yield je(this,oy,cy).call(this,e),e.send&&(t=je(this,ly,dy).call(this,Ne(this,qk)).then(e=>{try{Ne(this,Zk).call(this,e)}catch(t){this.logger.error("Failed to run send transport callback")}})),e.recv&&(i=je(this,ly,dy).call(this,Ne(this,Kk)).then(e=>{try{Ne(this,Yk).call(this,e)}catch(t){this.logger.error("Failed to run recv transport callback")}})),yield Promise.all([t,i])})}stopTransports(e){var t,i;if(e.send&&void 0!==this.sendTransport){const{id:e,serverId:t,direction:i}=Ne(this,qk);this.logger.info("Closing send transport",{transport:{id:e,serverId:t,type:i}}),Ne(this,qk).close(),Ne(this,qk).removeAllListeners(),Fe(this,qk,void 0)}if(e.recv&&void 0!==this.recvTransport){const{id:e,serverId:r,direction:n}=Ne(this,Kk);this.logger.info("Closing recv transport",{transport:{id:e,serverId:r,type:n}}),null==(t=Ne(this,Kk))||t.close(),null==(i=Ne(this,Kk))||i.removeAllListeners(),Fe(this,Kk,void 0)}je(this,sy,ay).call(this)}stopAllTransports(){this.logger.info("Closing all transports"),this.stopTransports({send:!0,recv:!0})}handleErrors(e){throw new Error("Method not implemented.")}}Wk=new WeakMap,qk=new WeakMap,Kk=new WeakMap,Zk=new WeakMap,Yk=new WeakMap,Jk=new WeakMap,Qk=new WeakMap,Xk=new WeakMap,ey=new WeakMap,ty=new WeakMap,iy=new WeakMap,ry=new WeakSet,ny=function(){return this.context.getValue("connectionHandler")},sy=new WeakSet,ay=function(){Fe(this,ty,{send:void 0,recv:void 0})},oy=new WeakSet,cy=function(e){return Be(this,null,function*(){var t,i,r,n,s,a,o,c;(To(this.context,"forceRelay")||this.context.getValue("flagsmith").hasFeature(po))&&Fe(this,iy,"relay"),this.logger.info("ICE Transport Policy set to ".concat(Ne(this,iy)));const l=yield fu().getICEServers().catch(e=>(this.logger.warn("failed to get iceservers from server: ".concat(e.message)),[]));if(e.send){const e=this.context.getValue("flagsmith").hasFeature(bo);je(this,py,gy).call(this,{iceServers:l,additionalSettings:{encodedInsertableStreams:null==(t=this.context.getValue("modules").e2ee)?void 0:t.enabled},config:{enableHighBitrate:null!=(n=null==(r=null==(i=this.context.getValue("defaults").mediaConfiguration)?void 0:i.audio)?void 0:r.enableHighBitrate)&&n,enableStereo:null!=(o=null==(a=null==(s=this.context.getValue("defaults").mediaConfiguration)?void 0:s.audio)?void 0:a.enableStereo)&&o,enableDtx:!!e},iceTransportPolicy:Ne(this,iy)})}e.recv&&je(this,fy,my).call(this,{iceServers:l,additionalSettings:{encodedInsertableStreams:null==(c=this.context.getValue("modules").e2ee)?void 0:c.enabled},iceTransportPolicy:Ne(this,iy)})})},ly=new WeakSet,dy=function(e){return Be(this,null,function*(){const{id:t,serverId:i,direction:r}=e;je(this,vy,by).call(this,e);try{return yield Wb((n,s)=>Be(this,null,function*(){n>0&&this.logger.debug("Retrying transport connect, count: ".concat(n),{transport:{id:t,serverId:i,type:r}});try{if(e.closed)throw new $b("Cannot reconnect closed transport");yield je(this,hy,uy).call(this,e)}catch(a){if(a instanceof $b)return void s(a);throw this.logger.error("Failed to connect transport, retrying",{transport:e,error:a}),a}}),{delayTime:100,strategy:"exponential",maxRetryCount:1/0}),e}catch(n){throw this.logger.error("Failed to connect send transport after retry: ".concat(e.id),{error:n,transport:{id:t,serverId:i,type:r}}),e.close(),e.removeAllListeners(),n}})},hy=new WeakSet,uy=function(e){return Be(this,null,function*(){const{id:t,direction:i}=e;if(this.logger.info("Connecting ".concat(i," transport"),{transport:{id:t,type:i}}),!Ne(this,Jk).isConnected)throw new $b("Socket is not connected");if("closed"===e.connectionState)throw new $b("Transport is closed");try{yield e.connect(e=>je(this,ky,yy).call(this,i,e)),this.logger.info("Connected ".concat(i," transport"),{transport:{id:t,serverId:e.serverId,type:i}})}catch(r){throw Ne(this,ey).transportFailureCount[i]+=1,"ice connection failed"===r.message?new $b(r.message):r}})},py=new WeakSet,gy=function(e){var t,i;Ne(this,qk)&&Ne(this,qk).connected?this.logger.info("Transport send is already connected",{transport:{id:null==(t=Ne(this,qk))?void 0:t.id,serverId:null==(i=Ne(this,qk))?void 0:i.serverId,type:"send"}}):(Fe(this,qk,Ne(this,Wk).createTransport(Ie(Le({},e),{direction:"send"}))),this.context.getValue("callstats").configureSendTransport(Ne(this,qk)))},fy=new WeakSet,my=function(e){var t,i;Ne(this,Kk)&&Ne(this,Kk).connected?this.logger.info("Transport recv is already connected",{transport:{id:null==(t=Ne(this,Kk))?void 0:t.id,serverId:null==(i=Ne(this,Kk))?void 0:i.serverId,type:"recv"}}):(Fe(this,Kk,Ne(this,Wk).createTransport(Ie(Le({},e),{direction:"recv"}))),this.context.getValue("callstats").configureRecvTransport(Ne(this,Kk)))},vy=new WeakSet,by=function(e){const{direction:t,id:i}=e;e.on("connectionstatechange",r=>Be(this,null,function*(){je(this,xy,Ey).call(this,{state:r,direction:t}),this.logger.info("Transport connection state changed for ".concat(t," transport"),{transport:{id:i,serverId:e.serverId,type:t,status:r}});const n=()=>{const e=Ne(this,ty)[t];void 0!==e&&(clearTimeout(e),Ne(this,ty)[t]=void 0)};switch(r){case"connected":n(),Ne(this,ey).lastConnectionTime=performance.now();break;case"disconnected":Ne(this,ty)[t]=setTimeout(()=>Be(this,null,function*(){this.logger.warn("".concat(t," transport is in disconnected state, reconnecting transport"),{transport:{id:i,serverId:e.serverId,type:t}}),yield je(this,wy,Sy).call(this,e.direction)}),2e3);break;case"failed":if(e.closed)return;n(),this.logger.warn("".concat(t," transport is in failed state, reconnecting transport"),{transport:{id:i,serverId:e.serverId,type:t}}),yield je(this,wy,Sy).call(this,e.direction)}})),e.on("icecandidate",e=>Be(this,null,function*(){this.logger.debug("Sending iceCandidate:",{iceCandidate:e})})),e.on("datachannel:events",(t,i)=>Be(this,null,function*(){var r,n;this.logger.debug("Got data channel message on event:",{rtcChannel:{label:t,message:i}});try{switch(i.type){case"handshake":{const r={type:"handshake",payload:{message:"pong"}};e.sendResponseOverDC(t,Mk(i),r);break}case"hub-disconnect":this.logger.debug("media hub disconnected, full_reconnect: ".concat(null==(r=i.payload)?void 0:r.full_reconnect)),!0===(null==(n=i.payload)?void 0:n.full_reconnect)&&this.handleErrors("rejoin")}}catch(s){this.logger.error("Unable to handle the incoming datachannel message on channel ".concat(t))}})),e.on("dc_error",()=>{"recv"===e.direction&&(this.logger.warn("Events datachannel did not open in 5s",{country:Mo.location.country}),this.handleErrors("reconnectRecvTransport"))})},ky=new WeakSet,yy=function(e,t){return Be(this,null,function*(){const i="recv"===e;try{const{sdp:e,type:r}=t,n={consuming:i,description:{sdp:e,type:r,target:i?oc.SUBSCRIBER:oc.PUBLISHER},producers:[]};return Ne(this,Qk).connectTransport(n)}catch(r){throw this.logger.error("Error in ".concat(e," transport connection:"),{error:r,country:Mo.location.country}),r}})},wy=new WeakSet,Sy=function(e){return Be(this,null,function*(){switch(this.logger.info("Called reconnect transport",{transport:{type:e}}),this.stopTransports({[e]:!0}),this.context.getValue("flagsmith").hasFeature(Ka)&&Ne(this,Jk).isConnected&&Ne(this,ey).transportFailureCount[e]>2&&(this.logger.warn("Multiple disconnections in ".concat(e," transport, forcing relay")),Fe(this,iy,"relay")),yield this.setupTransports({[e]:!0}),e){case"send":this.logger.info("Transport reconnected",{transport:Ne(this,qk)}),this.context.getValue("peerSessionStore").emit(Vo.RESET_PRODUCER_STATE);break;case"recv":this.logger.info("Transport reconnected",{transport:Ne(this,Kk)}),this.context.getValue("peerSessionStore").emit(Vo.UPDATE_ACTIVE,{createAllConsumers:!0});break;default:this.logger.warn("Unknown transport direction",{transport:{type:e}})}je(this,xy,Ey).call(this,{state:Sk.CONNECTED,direction:e})})},xy=new WeakSet,Ey=function(e){const{state:t,direction:i}=e;Ne(this,ry,ny).mediaState[i]={state:t},this.context.getValue("peerSessionStore").emit(Vo.TRANSPORT_STATE_UPDATE,Le({transport:i},Ne(this,ry,ny).mediaState[i]))};class mw{constructor(e,t,i,r,n){Ue(this,Ty,void 0),Ue(this,_y,void 0),this.events=t,this.recvTransport=i,this.socket=r,this.socketHandler=n,Fe(this,Ty,e),Fe(this,_y,e.getValue("logger"))}create(e){return Be(this,null,function*(){if(!e||e&&0===e.length)throw new Error("List of producers is required");const t=new Map,i=[];e.forEach(e=>{const{producingPeerId:r,producerId:n,producingTransportId:s}=e,a=Ne(this,Ty).getValue("flagsmith").hasFeature(qa)?{simulcast:{preferredRid:"h",priorityOrdering:"asciibetical",ridNotAvailable:"asciibetical"}}:{};t.set(n,r),i.push(Le({producingPeerId:r,producerId:n,producingTransportId:s},a))});const r=yield this.socketHandler.consume({requests:i,consumingTransportId:this.recvTransport.serverId}),n=new Map;e.forEach(e=>n.set(e.producerId,e));const s=new Map,a=[];return Object.entries(r.consumerStateMap).forEach(e=>{let[t,i]=e;const r=n.get(t);if(!r)return;if(i.errorCode)return Ne(this,_y).warn("Consumer request failed for producer ".concat(t),{error:{message:i.errorCode}}),void a.push(Ie(Le({},r),{errorCode:i.errorCode}));let o={};try{o=JSON.parse(i.producerState.appData)}catch(c){}s.set(t,{consumerId:i.consumerId,producingTransportId:r.producingTransportId,producingPeerId:r.producingPeerId,kind:r.kind,paused:r.pause,streamId:i.producerTrack.streamId,trackId:i.producerTrack.trackId,screenShare:r.screenShare,mimeType:r.mimeType,appData:o})}),{consumerStates:s,sessionDescription:r.sessionDescription,failedProducers:a}})}negotiate(e){return Be(this,null,function*(){try{Ne(this,_y).info("Negotiating socket consumer",{transport:this.recvTransport}),Ne(this,_y).debug("setting remote offer: ".concat(JSON.stringify(e)," on recvTransport"),{transport:this.recvTransport});const t=yield this.recvTransport.setRemoteOffer(e),i={transportId:this.recvTransport.serverId,description:{sdp:t.sdp,type:t.type,target:oc.SUBSCRIBER}};return Ne(this,_y).debug("sending renegotiate request: ".concat(JSON.stringify(i)," on recvTransport"),{transport:this.recvTransport}),yield this.socket.sendMessagePromise(this.events.renegotiateSessionDescription,mc.toBinary(i)),Ne(this,_y).info("Renegotiation done",{transport:this.recvTransport}),t}catch(t){return void Ne(this,_y).error("Failed to renegotiate",{error:t})}})}close(e){return Be(this,null,function*(){if(!e.length)return{};const t=(e,t)=>Be(this,null,function*(){const i=e.map(e=>e.localId);Ne(this,_y).info("Closing consumers: ".concat(JSON.stringify(i)));const r={description:{sdp:t.sdp,type:t.type,target:oc.SUBSCRIBER},consumerIds:i,consumingTransportId:this.recvTransport.serverId},n=yield this.socketHandler.closeConsumer(r),s=tl.fromBinary(n).description;return{sdp:s.sdp,type:s.type}});return yield this.recvTransport.awaitQueue.push(()=>this.recvTransport.closeConsumers(e,t),"ConsumerStrategy.close",{consumersLength:e.length}),{}})}switchConsumersToLayer(e,t){return Be(this,null,function*(){const i={requests:[],consumingTransportId:this.recvTransport.serverId},r=e.filter(e=>e&&e.id);r.forEach(e=>{let{id:r,producingTransportId:n,localId:s}=e;i.requests.push({producerId:r,producingTransportId:n,mid:s,simulcast:{preferredRid:0===t?"q":"h",priorityOrdering:"asciibetical",ridNotAvailable:"asciibetical"}})}),yield this.socketHandler.updateConsumersSimulcastConfig(i),Ne(this,_y).info("Consumers switched layers to ".concat(t),{consumerIds:null==r?void 0:r.map(e=>{let{id:t}=e;return t})})})}}Ty=new WeakMap,_y=new WeakMap;class vw{constructor(e){this.socketHandler=e}static getMSIDFromSDP(e,t){return ye.qg(e).media.filter(e=>"video"===t?"video"===e.type:"audio"===e.type).at(-1).msid}create(e){return Be(this,arguments,function(e){var t=this;let{offer:i,kind:r,paused:n,appData:s,codecOptions:a,producingTransportId:o}=e;return function*(){var e,c;const l=vw.getMSIDFromSDP(i.sdp,r),d={description:{sdp:i.sdp,type:i.type,target:oc.PUBLISHER},paused:n,kind:r,msid:l,appData:JSON.stringify(s),screenShare:null!=(e=s.screenShare)&&e,mimeType:"".concat(r,"/").concat(null==(c=a[0])?void 0:c.name),producingTransportId:o},{answer:h,producerId:u}=yield t.socketHandler.produce(d);return{answer:h,producerId:u}}()})}}class bw extends fw{constructor(e,t){super(e,t),Ue(this,Oy),Ue(this,Uy),Ue(this,jy),Ue(this,Vy),Ue(this,Hy),Ue(this,Py,void 0),Ue(this,Cy,void 0),Ue(this,Ay,void 0),Ue(this,Ry,void 0),Ue(this,Ly,void 0),Ue(this,Iy,{producerCreationFailureCount:0,consumerCreationFailureCount:0,producerNotReadyFailureCount:0}),Ue(this,My,[]),Ue(this,Dy,void 0),this.context=e,this.sendTransportConnectedCallback=()=>Be(this,null,function*(){Fe(this,Ry,new vw(this.socketHandler))}),this.recvTransportConnectedCallback=e=>Be(this,null,function*(){Ne(this,Ay).clear(),Fe(this,Ly,new mw(this.context,this.events,e,this.socket,this.socketHandler))}),this.reset()}get socketHandler(){return super.socketHandler}get producers(){return Ne(this,Py)}get consumers(){return Ne(this,Cy)}get producerIdToConsumerIdMap(){return Ne(this,Ay)}get logger(){return this.context.getValue("logger")}reset(){Fe(this,Py,new Map),Fe(this,Cy,new Map),Fe(this,Ay,new Map)}createProducer(e,t){return Be(this,null,function*(){var i;if(!this.sendTransport||this.sendTransport.closed)throw new Error("Send transport is closed");try{const r=yield this.sendTransport.produce(e,je(this,Uy,Fy).bind(this));return null!=(i=e.appData)&&i.e2ee&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_ACTIVE_PRODUCER,r),je(this,jy,By).call(this,r,t),r}catch(r){throw this.logger.error("Failed to create producer",{error:r}),Ne(this,Iy).producerCreationFailureCount+=1,r}})}closeProducer(e,t){return Be(this,null,function*(){var i;const r=this.producers.get(e);if(r){null!=t&&t.stopTrack&&r.track.stop();try{yield this.sendTransport.closeProducer(r),null!=(i=this.context.getValue("modules").e2ee)&&i.enabled&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_INACTIVE_PRODUCER,r)}catch(n){this.logger.error("Failed to close producer on server",{error:n,producer:r})}}else this.logger.warn("Producer with ID ".concat(e," was not found"))})}closeAllProducers(){return Promise.all(Array.from(Ne(this,Py).entries()).map(e=>{let[,t]=e;return t.close()}))}createConsumer(e){return this.createConsumers([e])}createConsumers(e){return Be(this,null,function*(){Ne(this,Dy)||clearTimeout(Ne(this,Dy)),Fe(this,My,Ne(this,My).concat(e)),yield je(this,Oy,Ny).call(this)})}closeConsumer(e){return this.closeConsumers([e])}closeConsumers(e){return Be(this,null,function*(){if(!Ne(this,Ly))return;const t=e.map(e=>this.consumers.get(e)).filter(e=>void 0!==e);if(0===t.length)return;const{failedConsumers:i}=yield Ne(this,Ly).close(t);null!=i&&i.length&&this.logger.warn("Failed to close some consumers",{consumerIds:i})})}closeAllConsumers(){return this.closeConsumers(Array.from(Ne(this,Cy).keys()))}switchConsumersToLayer(e,t){return Be(this,null,function*(){Ne(this,Ly).switchConsumersToLayer(e,t)})}}Py=new WeakMap,Cy=new WeakMap,Ay=new WeakMap,Ry=new WeakMap,Ly=new WeakMap,Iy=new WeakMap,My=new WeakMap,Dy=new WeakMap,Oy=new WeakSet,Ny=function(){return Be(this,null,function*(){if(!this.recvTransport||this.recvTransport.closed)throw new Error("Recv transport is closed");const e=Ne(this,My).splice(0,Ne(this,My).length);try{const t=new Set(Array.from(this.consumers.values()).map(e=>{let{producerId:t}=e;return t})),i=e.filter(e=>{let{producerId:i}=e;return!this.producers.get(i)&&!t.has(i)});if(0===i.length)return;const{consumers:r,failedProducers:n}=yield this.recvTransport.consume(i,je(this,Vy,zy).bind(this),Ne(this,Ly).negotiate.bind(Ne(this,Ly)));if(r.forEach(je(this,Hy,$y).bind(this)),null!=n&&n.length){this.logger.error("Failed to create consumers for producers",{producers:n});const e=n.filter(e=>{let{errorCode:t,producerId:i}=e;return"not_found_track_error"===t?(this.logger.error("Track not found for producer: ".concat(i,". This will not be retried.")),!1):"backend_error"!==t||(this.logger.error("Unrecoverable error: backend error"),!1)});Fe(this,My,Ne(this,My).concat(e)),Fe(this,Dy,setTimeout(je(this,Oy,Ny).bind(this),500))}}catch(d){if(this.logger.error("failed to consume on transport",{error:d}),"internal_error"===d.errorCode&&"Backend error"===d.errorDescription||"invalid_session_description"===d.errorCode){this.logger.error("Irrecoverable error, closing current recvTransport to create a new one",{transport:this.recvTransport,error:{code:d.errorCode,message:d.errorDescription}});try{this.stopTransports({recv:!0})}catch(t){}yield this.setupTransports({recv:!0})}}})},Uy=new WeakSet,Fy=function(e){return Ne(this,Ry).create(e)},jy=new WeakSet,By=function(e,t){e.on("close",(i,r)=>Be(this,null,function*(){const{offer:n,reason:s}=i;if(this.logger.info("producer::closing",{debuggingHint:s,producer:Ie(Le({},e),{status:"closing"})}),s!==jk){const t={producerId:e.id,description:{sdp:n.sdp,type:n.type,target:oc.PUBLISHER}};try{const i=yield this.socketHandler.closeProducer(t),n={sdp:null==i?void 0:i.sdp,type:null==i?void 0:i.type};this.logger.info("producer::closed",{producer:Ie(Le({},e),{status:"closed"})}),r({answer:n})}catch(a){this.logger.error("producer close error",a)}}this.producers.delete(e.id),t()})),e.on("trackended",()=>{this.logger.info("producer::trackended",{producer:Ie(Le({},e),{status:"UNKNOWN"})})}),Ne(this,Py).set(e.id,e)},Vy=new WeakSet,zy=function(e){return Be(this,null,function*(){try{return yield this.recvTransport.canConsume(),yield Ne(this,Ly).create(e)}catch(t){throw this.logger.error("Error in consume request",{error:t}),t}})},Hy=new WeakSet,$y=function(e){e.on("close",t=>Be(this,null,function*(){this.logger.debug("consumer closed",{consumer:{closureReason:t,id:e.id,kind:e.kind,appData:e.appData}}),Ne(this,Cy).delete(e.id),this.context.getValue("peerSessionStore").emit(Vo.CONSUMER_CLOSED,{id:e.id})})),Ne(this,Cy).set(e.id,e),this.producerIdToConsumerIdMap.set(e.producerId,e.id),this.context.getValue("peerSessionStore").emit(Vo.NEW_CONSUMER,{id:e.id,appData:e.appData,peerId:e.peerId})};const kw=class{constructor(){let{initialEnergyThreshold:e=.015,zeroCrossingThreshold:t=20,minVoiceDuration:i=3,hangoverFrames:r=5,noiseAdaptationRate:n=.95,voiceAdaptationRate:s=.99,minEnergyThreshold:a=.005,maxEnergyThreshold:o=.2,energyRatioThreshold:c=1.5,noiseHistorySize:l=50}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ue(this,ow),Ue(this,lw),Ue(this,Gy,void 0),Ue(this,Wy,void 0),Ue(this,qy,void 0),Ue(this,Ky,void 0),Ue(this,Zy,void 0),Ue(this,Yy,void 0),Ue(this,Jy,void 0),Ue(this,Qy,void 0),Ue(this,Xy,void 0),Ue(this,ew,void 0),Ue(this,tw,void 0),Ue(this,iw,!1),Ue(this,rw,0),Ue(this,nw,0),Ue(this,sw,[]),Ue(this,aw,void 0),Fe(this,Ky,e),Fe(this,ew,e),Fe(this,Gy,t),Fe(this,Wy,i),Fe(this,qy,r),Fe(this,Zy,n),Fe(this,Yy,s),Fe(this,Jy,a),Fe(this,Qy,o),Fe(this,Xy,c),Fe(this,aw,l),Fe(this,tw,e/2)}get voiceDetected(){return Ne(this,iw)}processAudioChunk(e){var t,i;const r=je(t=kw,hw,uw).call(t,e),n=je(i=kw,pw,gw).call(i,e);return je(this,ow,cw).call(this,r),r/Ne(this,tw)>Ne(this,Xy)&&r>Ne(this,ew)&&n>Ne(this,Gy)?(Fe(this,rw,Ne(this,rw)+1),Fe(this,nw,Ne(this,qy)),Ne(this,rw)>=Ne(this,Wy)&&Fe(this,iw,!0)):(Fe(this,rw,0),Ne(this,nw)>0?Fe(this,nw,Ne(this,nw)-1):Ne(this,iw)&&Fe(this,iw,!1),Ne(this,iw)||je(this,lw,dw).call(this,r)),{energy:r,isVoice:Ne(this,iw)}}reset(){Fe(this,iw,!1),Fe(this,rw,0),Fe(this,nw,0),Fe(this,ew,Ne(this,Ky)),Fe(this,tw,Ne(this,Ky)/2),Fe(this,sw,[])}getThresholdInfo(){return{currentEnergyThreshold:Ne(this,ew),backgroundNoiseEnergy:Ne(this,tw),energyRatioThreshold:Ne(this,Xy)}}};let yw=kw;var ww,Sw;Gy=new WeakMap,Wy=new WeakMap,qy=new WeakMap,Ky=new WeakMap,Zy=new WeakMap,Yy=new WeakMap,Jy=new WeakMap,Qy=new WeakMap,Xy=new WeakMap,ew=new WeakMap,tw=new WeakMap,iw=new WeakMap,rw=new WeakMap,nw=new WeakMap,sw=new WeakMap,aw=new WeakMap,ow=new WeakSet,cw=function(e){Ne(this,iw)?Fe(this,ew,Ne(this,Yy)*Ne(this,ew)+(1-Ne(this,Yy))*e):Fe(this,ew,Ne(this,Zy)*Ne(this,ew)+(1-Ne(this,Zy))*Ne(this,tw)),Fe(this,ew,Math.max(Ne(this,Jy),Math.min(Ne(this,Qy),Ne(this,ew))))},lw=new WeakSet,dw=function(e){if(e<1.2*Ne(this,ew))if(Ne(this,sw).push(e),Ne(this,sw).length>Ne(this,aw)&&Ne(this,sw).shift(),Ne(this,sw).length>=10){const e=[...Ne(this,sw)].sort((e,t)=>e-t),t=Math.floor(e.length/2);Fe(this,tw,e[t])}else Fe(this,tw,.95*Ne(this,tw)+.05*e)},hw=new WeakSet,uw=function(e){return Math.sqrt(e.map(e=>e*e).reduce((e,t)=>e+t)/e.length)},pw=new WeakSet,gw=function(e){let t=0;for(let i=1;i=0&&e[i-1]<0||e[i]<0&&e[i-1]>=0)&&(t+=1);return t},Ue(yw,hw),Ue(yw,pw);class xw{constructor(e){De(this,"RNAudioSampleHandler"),Ue(this,ww,void 0),Fe(this,ww,e);const{RNAudioSampleHandlerImpl:t}=navigator;null==t||t.init().then(e=>{this.RNAudioSampleHandler=e}).catch(e=>{this.logger.error("ReactNativeAudioSampler: Failed to initialize audio sampler",e)})}get logger(){return Ne(this,ww).getValue("logger")}get samples(){var e;const t=new Float32Array(1024);return null==(e=this.RNAudioSampleHandler)||e.getFloatTimeDomainData(t),t}stop(){var e;null==(e=this.RNAudioSampleHandler)||e.destructor()}}ww=new WeakMap;class Ew{constructor(e){De(this,"audioContext"),De(this,"analyser"),Ue(this,Sw,void 0),Fe(this,Sw,e),this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048}get logger(){return Ne(this,Sw).getValue("logger")}get samples(){if("suspended"===this.audioContext.state)try{this.audioContext.resume()}catch(t){this.logger.error("AudioContextSampler: Failed to resume audio context",t)}const e=new Float32Array(this.analyser.frequencyBinCount);return this.analyser.getFloatTimeDomainData(e),e}set audioTrack(e){const t=new MediaStream;t.addTrack(e),this.audioContext.createMediaStreamSource(t).connect(this.analyser)}}Sw=new WeakMap;class Tw{static setInterval(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s1&&void 0!==arguments[1]?arguments[1]:0;for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;sBe(this,null,function*(){var e;if(!Ne(this,Aw)||!Ne(this,Cw))return;const{energy:t}=je(this,Fw,jw).call(this),i=je(e=Ww,Bw,Vw).call(e,t);let r=.9;r=Ne(this,Dw)!==i&&Ne(this,Dw)?.9:i?.3:.5,Fe(this,Rw,(Ne(this,Rw)||0)*(1-r)+t*r)}),60)),Ne(this,Pw)&&Ne(this,Uw).clearInterval(Ne(this,Pw)),Fe(this,Pw,Ne(this,Uw).setInterval(je(this,zw,Hw).bind(this),400))}stop(){try{this.logger.debug("AudioActivityReporter: Stopping audio activity reporter: ".concat(Ne(this,Cw))),Ne(this,_w)&&(Ne(this,Uw).clearInterval(Ne(this,_w)),Fe(this,_w,void 0)),Ne(this,Pw)&&(Ne(this,Uw).clearInterval(Ne(this,Pw)),Fe(this,Pw,void 0))}catch(e){}Ne(this,Lw).reset(),Ne(this,Nw)instanceof xw&&Ne(this,Nw).stop()}};let qw=Ww;_w=new WeakMap,Pw=new WeakMap,Cw=new WeakMap,Aw=new WeakMap,Rw=new WeakMap,Lw=new WeakMap,Iw=new WeakMap,Mw=new WeakMap,Dw=new WeakMap,Ow=new WeakMap,Nw=new WeakMap,Uw=new WeakMap,Fw=new WeakSet,jw=function(){var e;const{samples:t}=Ne(this,Nw),{energy:i,isVoice:r}=Ne(this,Lw).processAudioChunk(t),n=je(e=Ww,$w,Gw).call(e,i);return Ne(this,Ow).getValue("flagsmith").hasFeature(ko)&&this.logger.debug("AudioActivityReporter: producer: ".concat(Ne(this,Cw),", energy: ").concat(Ne(this,Rw),",\n\t\t\t\tslogScale: ").concat(n,", isVoice: ").concat(r,", minEnergy: ").concat(Ne(this,Iw),",\n\t\t\t\tmaxEnergy: ").concat(Ne(this,Mw))),n===-1/0||i<1e-6?{energy:0,isVoice:!1}:((!Ne(this,Iw)||nNe(this,Mw))&&Fe(this,Mw,n),{energy:(n-Ne(this,Iw))/(Ne(this,Mw)-Ne(this,Iw))*10||0,isVoice:r})},Bw=new WeakSet,Vw=function(e){return e<5},zw=new WeakSet,Hw=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ne(this,Rw);var t;if(!Ne(this,Cw)||!e)return void(Ne(this,Ow).getValue("flagsmith").hasFeature(ko)&&this.logger.debug("AudioActivityReporter: No producerId or energy to report: ".concat(Ne(this,Cw))));const i={producerId:Ne(this,Cw),energy:Math.round(e),silent:je(t=Ww,Bw,Vw).call(t,e)};Fe(this,Dw,i.silent),this.reportRequest(i)},$w=new WeakSet,Gw=function(e){const t=Math.log10(e);return Math.round(t)},Ue(qw,Bw),Ue(qw,$w);var Kw=Object.defineProperty,Zw=Object.getOwnPropertyDescriptor,Yw=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?Zw(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&Kw(t,i,s),s};const Jw=["video/VP9","video/VP8"];var Qw,Xw,eS,tS,iS,rS,nS,sS,aS,oS,cS,lS,dS,hS,uS,pS,gS,fS,mS,vS,bS,kS,yS,wS,SS,xS,ES,TS,_S,PS,CS,AS,RS,LS,IS,MS,DS,OS,NS,US,FS,jS,BS,VS,zS,HS;const $S=(_S=class{constructor(e,t){var i,r;Ue(this,fS),Ue(this,vS),Ue(this,kS),Ue(this,wS),Ue(this,xS),Ue(this,CS),Ue(this,RS),Ue(this,IS),Ue(this,DS),Ue(this,NS),Ue(this,FS),Ue(this,BS),Ue(this,zS),De(this,"context"),De(this,"authToken"),De(this,"e2ee"),Ue(this,Qw,void 0),Ue(this,Xw,void 0),Ue(this,eS,void 0),Ue(this,tS,void 0),Ue(this,iS,void 0),Ue(this,rS,void 0),Ue(this,nS,void 0),Ue(this,sS,void 0),Ue(this,aS,void 0),Ue(this,oS,void 0),Ue(this,cS,null),Ue(this,lS,void 0),Ue(this,dS,void 0),Ue(this,hS,void 0),Ue(this,uS,void 0),Ue(this,pS,void 0),Ue(this,gS,void 0),this.context=e;const{socket:n}=t;this.mediaJoined=!1,Fe(this,hS,new Map([["video/VP9",new Set],["video/VP8",new Set]])),Fe(this,uS,new Map([["video/VP9",new Set],["video/VP8",new Set]])),Fe(this,eS,n),Fe(this,nS,!1),Fe(this,tS,new bw(e,n)),Fe(this,rS,Ne(this,tS).events),Fe(this,lS,new Set),Fe(this,pS,new Map),Fe(this,sS,!1),Fe(this,aS,new Vb(e.getValue("logger"))),Fe(this,gS,new qw(this.context,Ne(this,tS).socketHandler.audioActivity.bind(Ne(this,tS).socketHandler))),this.e2ee=null!=(r=null==(i=e.getValue("modules").e2ee)?void 0:i.enabled)&&r,this.handleSocketEvents(),this.handleCallstatsEvents(),Fe(this,oS,Ra(()=>Be(this,null,function*(){if(!Ne(this,fS,mS).mediaJoinAttempted)return;const{roomJoined:e}=yield this.joinRoom(Ne(this,Xw),Ne(this,Qw),!0,!0);e&&(this.context.getValue("peerSessionStore").emit(Vo.RESET_PRODUCER_STATE),this.context.getValue("peerSessionStore").emit(Vo.ROOM_NODE_RECONNECTED))}),5e3,{leading:!0,maxWait:1e3}))}get peerId(){return this.context.getValue("peerId")}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}get mediaJoined(){return Ne(this,fS,mS).mediaJoined}set mediaJoined(e){Ne(this,fS,mS).mediaJoined=e}reset(){Ne(this,tS).closeAllProducers(),Ne(this,tS).closeAllConsumers(),Ne(this,pS).clear(),Ne(this,lS).clear(),Fe(this,cS,null),Ne(this,aS).stop(),Ne(this,tS).stopAllTransports(),Ne(this,tS).reset(),Fe(this,aS,new Vb)}joinRoom(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return function*(){Ne(i,fS,mS).mediaJoinAttempted=!0,Fe(i,nS,!0),r&&i.reset();try{return yield Ne(i,aS).push(()=>je(i,vS,bS).call(i,e,t,n,s),"joinRoom")}catch(a){return i.logger.error("Error in room joining process",{error:a}),i.context.getValue("peerSessionStore").emit(Vo.ROOM_NODE_FAILED),{roomJoined:!1}}}()})}initializeConnection(e,t){return Be(this,arguments,function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function*(){return Ne(i,cS)||Fe(i,cS,Be(i,null,function*(){try{yield je(this,xS,ES).call(this,e,t,r,n)}catch(i){throw Fe(this,cS,null),i}})),Ne(i,cS)}()})}getConsumers(){return Ne(this,tS).consumers}getProducers(){return Ne(this,tS).producers}leaveRoom(){return Be(this,null,function*(){Ne(this,tS).stopAllTransports(),Fe(this,sS,!1),Ne(this,fS,mS).mediaJoinAttempted=!1;Ne(this,eS).sendMessagePromise(Ne(this,rS).leaveRoom,Rc.toBinary({closeRoom:!1})).then(e=>{var t;null!=(t=Jc.fromBinary(e.payload))&&t.closed&&this.logger.warn("Weird state on peer closed and should not happen")}).catch(e=>{this.logger.error("error on sending leave room request",{error:e})}),this.context.getValue("callstats").callEnded(),this.context.getValue("telemetry").destruct()})}activatePeers(e){return Be(this,null,function*(){return this.createConsumers(e)})}createConsumers(e){return Be(this,null,function*(){return 0===e.length?Promise.resolve():Ne(this,tS).createConsumers(e)})}closeConsumers(e){return Be(this,null,function*(){if(!e.length)return;const t=e.reduce((e,t)=>{const i=Ne(this,tS).producerIdToConsumerIdMap.get(t.producerId);return i?(e.push(i),e):(this.logger.warn("consumer not found in close consumers: ".concat(t.producerId)),e)},[]);yield Ne(this,tS).closeConsumers(t)})}_shareWebcam(e,t){return Be(this,null,function*(){var i,r;const n="video/VP9"===t?_f.WEBCAM:_f.WEBCAM_BACKUP,s=je(this,DS,OS).call(this,n);if(s){const i=yield s;if(Ne(this,tS).producers.has(i)){const r=Ne(this,tS).producers.get(i);if(!r.closed)return yield r.replaceTrack({track:e}),yield this.resumeWebcam(n),e;yield this.disableWebcam(t)}return this._shareWebcam(e,t)}const a=[t].concat(Jw.filter(e=>e!==t)),o=je(this,zS,HS).call(this,e,a),c=To(this.context,"disableSimulcast"),l=null==(r=null==(i=this.context)?void 0:i.getValue("overrides"))?void 0:r.simulcastConfig;c||l&&l.disable||!this.context.getValue("flagsmith").hasFeature(qa)?this.logger.info("Simulcast disabled for webcam producer, SFU: CF"):(this.logger.info("Simulcast enabled for SFU: CF"),o.encodings=((e,t)=>{var i,r,n;const s=null==(i=null==e?void 0:e.getValue("overrides"))?void 0:i.simulcastConfig;if(null!=(r=null==s?void 0:s.encodings)&&r.length)return s.encodings;const a="getSettings"in t&&t.getSettings().width||"getConstraints"in t&&t.getConstraints().width||"originalSettings"in t&&(null==(n=t.originalSettings)?void 0:n.width);let o=Tf;e.getValue("flagsmith").hasFeature(mo)&&(o=JSON.parse(e.getValue("flagsmith").getValue(mo)));const c=o.map(e=>{let[t]=e;return t}).sort((e,t)=>e-t);let l=Number.MAX_VALUE,d=0;return c.forEach((e,t)=>{Math.abs(e-a){this.logger.info("Disabling video due to the producer closure"),Ne(this,pS).delete(n)});return je(this,NS,US).call(this,n,d.then(e=>e.id)),d.then(e=>e.track)})}shareWebcam(e){return Be(this,null,function*(){var t;if(void 0===e)return null;const i=null==(t=this.context.getValue("flagsmith").getValue(go))?void 0:t.toString();if(i)return this.logger.debug("Calling _shareWebcam with forced video codec: ".concat(i)),this._shareWebcam(e,i);const r=Jw.filter(e=>{var t,i;return(null==(i=null==(t=Ne(this,iS).sender)?void 0:t.video)?void 0:i.codecs.findIndex(t=>t.mimeType===e))>=0&&Ne(this,uS).get(e).size>0});return 0===r.length&&r.push(Jw[0]),yield Promise.all(r.map(t=>(this.logger.debug("Calling _shareWebcam with video codec: ".concat(t)),this._shareWebcam(e,t)))),e})}shareScreen(e){return Be(this,null,function*(){const{video:t,audio:i}=e;if(void 0===t)return;const r={track:t,codecOptions:[{name:"VP8"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:it.isElectron()},stopTracks:!1},n=Ne(this,tS).createProducer(r,()=>{this.logger.info("Disabling screenShare due to the producer closure"),Ne(this,pS).delete(_f.SCREENSHARE_VIDEO),Ne(this,pS).delete(_f.SCREENSHARE_AUDIO)});let s;if(je(this,NS,US).call(this,_f.SCREENSHARE_VIDEO,n.then(e=>e.id)),i){const e={track:i,codecOptions:[{name:"opus"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:it.isElectron()},stopTracks:!1,zeroRtpOnPause:!1},t=()=>{};s=Ne(this,tS).createProducer(e,t),je(this,NS,US).call(this,_f.SCREENSHARE_AUDIO,s.then(e=>e.id))}yield Promise.all([n,s||Promise.resolve()]),this.context.getValue("callstats").screenShareStart()})}shareMic(e){return Be(this,null,function*(){try{if(void 0===e)throw new Hb("track undefined");const t=je(this,DS,OS).call(this,_f.MIC);if(t){const i=yield t;if(Ne(this,tS).producers.has(i)){const t=Ne(this,tS).producers.get(i);if(!t.closed)return yield t.replaceTrack({track:e}),yield this.resumeMic(),void(Ne(this,gS)&&(Ne(this,gS).audioTrack=e,Ne(this,gS).producerId=i,Ne(this,gS).start()));yield Ne(this,tS).closeProducer(i,{stopTrack:!1})}return void(yield this.shareMic(e))}const i=je(this,BS,VS).call(this,e),r=()=>{Ne(this,pS).delete(_f.MIC)},n=Ne(this,tS).createProducer(i,r);je(this,NS,US).call(this,_f.MIC,n.then(e=>e.id)),yield n.then(e=>{Ne(this,gS)&&(Ne(this,gS).audioTrack=e.track,Ne(this,gS).producerId=e.id,Ne(this,gS).start())})}catch(t){throw new Uo(t)}})}pauseMic(){return Be(this,null,function*(){var e;const t=yield je(this,DS,OS).call(this,_f.MIC),i=Ne(this,tS).producers.get(t);if(!i)return void this.logger.error("pauseMic::could_not_find_mic_producer");if(i.paused)return void this.logger.info("pauseMic::mic_producer_already_paused");i.pause(),null==(e=Ne(this,gS))||e.stop();const r={producerId:i.id,pause:!0};Ne(this,eS).sendMessage(Ne(this,rS).toggleProducer,Uc.toBinary(r))})}pauseWebcam(){return Be(this,null,function*(){const e=yield je(this,DS,OS).call(this,_f.WEBCAM),t=yield je(this,DS,OS).call(this,_f.WEBCAM_BACKUP),i=Ne(this,tS).producers.get(e),r=Ne(this,tS).producers.get(t);if(!i&&!r)return void this.logger.error("pauseWebcam::could_not_find_webcam_producer");const n=e=>{const t={producerId:e.id,pause:!0};Ne(this,eS).sendMessage(Ne(this,rS).toggleProducer,Uc.toBinary(t))};i&&(i.pause(),n(i)),r&&(r.pause(),n(r))})}resumeMic(){return Be(this,null,function*(){const e=yield je(this,DS,OS).call(this,_f.MIC),t=Ne(this,tS).producers.get(e);if(!t)return void this.logger.error("resumeMic::could_not_find_mic_producer");if(!t.pause)return void this.logger.info("resumeMic::mic_producer_already_resumed");t.resume(),t.appData.e2ee&&this.context.getValue("peerSessionStore").emit(Vo.E2EE_ACTIVE_PRODUCER,t);const i={producerId:t.id,pause:!1};Ne(this,eS).sendMessage(Ne(this,rS).toggleProducer,Uc.toBinary(i))})}resumeWebcam(){return Be(this,arguments,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_f.WEBCAM;return function*(){const i=yield je(e,DS,OS).call(e,t),r=Ne(e,tS).producers.get(i);if(!r)return void e.logger.error("resumeWebcam::could_not_find_webcam_producer");if(!r.paused)return void e.logger.info("resumeWebcam::webcam_producer_already_resumed");r.resume(),r.appData.e2ee&&e.context.getValue("peerSessionStore").emit(Vo.E2EE_ACTIVE_PRODUCER,r);const n={producerId:r.id,pause:!1};Ne(e,eS).sendMessage(Ne(e,rS).toggleProducer,Uc.toBinary(n))}()})}disableWebcam(e){return Be(this,null,function*(){const t="video/VP9"===e?_f.WEBCAM:_f.WEBCAM_BACKUP,i=yield je(this,DS,OS).call(this,t);je(this,FS,jS).call(this,t),i&&(yield Ne(this,tS).closeProducer(i))})}disableMic(){return Be(this,null,function*(){var e;const t=yield je(this,DS,OS).call(this,_f.MIC);t&&(yield Ne(this,tS).closeProducer(t)),null==(e=Ne(this,gS))||e.stop(),Ne(this,pS).delete(_f.MIC)})}disableScreenShare(){return Be(this,null,function*(){this.logger.info("screen_sharing_stopped"),this.context.getValue("callstats").screenShareStop();const e=yield je(this,DS,OS).call(this,_f.SCREENSHARE_VIDEO),t=yield je(this,DS,OS).call(this,_f.SCREENSHARE_AUDIO);e&&(yield Ne(this,tS).closeProducer(e)),t&&(yield Ne(this,tS).closeProducer(t)),Ne(this,lS).clear(),Ne(this,pS).delete(_f.SCREENSHARE_VIDEO),Ne(this,pS).delete(_f.SCREENSHARE_AUDIO)})}muteSelf(){return Be(this,null,function*(){this.pauseMic()})}resetVideoProducers(e,t){return Be(this,null,function*(){if(e){const t=yield je(this,DS,OS).call(this,_f.WEBCAM),i=yield je(this,DS,OS).call(this,_f.WEBCAM_BACKUP);yield Ne(this,tS).closeProducer(t,{stopTrack:!1}),yield Ne(this,tS).closeProducer(i,{stopTrack:!1}),this.shareWebcam(e)}if(t){const e=yield je(this,DS,OS).call(this,_f.SCREENSHARE_VIDEO);yield Ne(this,tS).closeProducer(e,{stopTrack:!1}),this.shareScreen({video:t})}})}changeDisplayName(e,t){return Be(this,null,function*(){const i={displayName:e,participantId:null!=t?t:this.peerId};if(!(yield Ne(this,tS).socketHandler.changeDisplayName(i)))throw new Error("failed to change display name!")})}kick(e){const t={peerIds:[e]};Ne(this,tS).socketHandler.kickPeer(t)}kickAll(){Ne(this,tS).socketHandler.kickAll()}muteAll(e){return Be(this,null,function*(){if(!(yield Ne(this,tS).socketHandler.hostControlForAll("audio")))throw new Error("failed to mute all participant")})}muteAllVideo(){return Be(this,null,function*(){if(!(yield Ne(this,tS).socketHandler.hostControlForAll("video")))throw new Error("failed to mute all video participant")})}disableAudio(e){return Be(this,null,function*(){if(!(yield Ne(this,tS).socketHandler.hostControlForPeer(e,"audio")))throw new Error("failed to mute given participant")})}disableVideo(e){return Be(this,null,function*(){if(!(yield Ne(this,tS).socketHandler.hostControlForPeer(e,"video")))throw new Error("failed to mute video of given participant")})}pinPeer(e){return Be(this,null,function*(){const t={participantId:null!=e?e:""};try{yield Ne(this,eS).sendMessagePromise(Ne(this,rS).globalPinPeer,Nc.toBinary(t))}catch(i){this.logger.error("Error in pinning peer:",{error:i})}})}validateScreenShare(e){return this.peerId===e.peerId&&Ne(this,tS).producers.get(e.producerId)&&Ne(this,lS).add(e.consumerPeerId),Ne(this,lS).size}switchConsumersToLayer(e,t){return Be(this,null,function*(){const i=e.map(e=>this.getConsumers().get(e));Ne(this,tS).switchConsumersToLayer(i,t)})}handleSocketEvents(){return Be(this,null,function*(){Ne(this,eS).on(Ne(this,rS).peerProducerCreateBroadcast,e=>{let{payload:t}=e;var i,r;if(this.mediaJoined)try{const{participantId:e,producerState:n}=cl.fromBinary(t);if(e===this.peerId)return;if(null!=n&&n.mimeType||(n.mimeType=n.kind===cc.AUDIO?"audio/opus":"video/VP8"),n.kind===cc.VIDEO&&!n.screenShare&&(null==(r=null==(i=Ne(this,iS).receiver)?void 0:i.video)?void 0:r.codecs.findIndex(e=>e.mimeType===Jw[0]))>=0&&Ne(this,hS).get(Jw[0]).has(e)&&n.mimeType!==Jw[0])return void this.logger.warn("Ignoring producer: ".concat(n.producerId));this.logger.info("producer created broadcast: ".concat(e,", producer state: ").concat(n)),this.context.getValue("peerSessionStore").emit(Vo.NEW_PRODUCER,{peerId:e,producer:Ie(Le({},n),{kind:n.kind===cc.AUDIO?"audio":"video",producingPeerId:e})})}catch(n){this.logger.error("error in peer-producer-create-broadcast",{error:n})}}),Ne(this,eS).on(Ne(this,rS).peerProducerToggleBroadcast,e=>{let{payload:t}=e;if(this.mediaJoined)try{const{participantId:e,initiatorParticipantId:i,producerState:{kind:r,pause:n,producerId:s,screenShare:a}}=ll.fromBinary(t);if(a)return;const o=r===cc.AUDIO?"audio":"video";if(this.logger.info("producer toggle broadcast: ".concat(e,", producerId: ").concat(s,", kind:").concat(o,", paused:").concat(n," payload: ").concat(JSON.stringify(ll.fromBinary(t)))),e===this.peerId&&i!==this.peerId&&n&&this.context.getValue("peerSessionStore").emit("audio"===o?Vo.MUTE_SELF:Vo.MUTE_SELF_VIDEO),e===this.peerId)return;this.context.getValue("peerSessionStore").emit(Vo.PRODUCER_TOGGLE,{peerId:e,producerId:s,paused:n,kind:o}),Array.from(this.getConsumers().values()).filter(e=>e.producerId===s).forEach(e=>{"video"===e.kind&&n||e.paused!==n&&(this.logger.debug("consumer state mismatched for ".concat(e.id,". updating consumer pause state ").concat(e.paused," to ").concat(n)),n?(e.pause(),this.context.getValue("peerSessionStore").emit(Vo.CONSUMER_PAUSED,{id:e.id})):(e.resume(),this.context.getValue("peerSessionStore").emit(Vo.CONSUMER_RESUMED,{id:e.id})))})}catch(i){this.logger.error("error in producer toggle broadcast handler",{error:i})}}),Ne(this,eS).on(Ne(this,rS).peerLeaveBroadcast,e=>{let{payload:t}=e;if(this.mediaJoined)try{const{participantId:e}=hl.fromBinary(t);if(e===this.peerId)return;this.logger.info("peer left broadcast:".concat(e)),Ne(this,lS).delete(e),Ne(this,tS).consumers.forEach(t=>{t.peerId===e&&t.close()}),this.context.getValue("peerSessionStore").emit(Vo.PEER_CLOSED,{id:e})}catch(i){this.logger.error("error in peer left broadcast",{error:i})}}),Ne(this,eS).on(Ne(this,rS).peerProducerCloseBroadcast,e=>{let{payload:t}=e;if(this.mediaJoined)try{const{participantId:e,producerState:{producerId:i}}=dl.fromBinary(t);if(e===this.peerId)return;this.logger.info("producer closed broadcast:".concat(e)),this.context.getValue("peerSessionStore").emit(Vo.PRODUCER_CLOSED,{peerId:e,producerId:i});const r=Ne(this,tS).producerIdToConsumerIdMap.get(i);if(!r)return void this.logger.warn("no consumer found for producer:".concat(i));this.logger.info("closing consumer ".concat(r,", producer id: ").concat(i)),Ne(this,tS).closeConsumer(r).then(()=>{this.logger.info("closed consumer: ".concat(r)),Ne(this,tS).producerIdToConsumerIdMap.delete(i),this.context.getValue("peerSessionStore").emit(Vo.CONSUMER_CLOSED,{id:r})}).catch(e=>{this.logger.error("error closing consumer",{error:e})})}catch(i){this.logger.error("error on producer close broadcast",{error:i})}}),Ne(this,eS).on(Ne(this,rS).mediaRoomTerminationBroadcastResponse,()=>{!this.mediaJoined&&!Ne(this,nS)&&!Ne(this,sS)||(this.logger.warn("media hub termination broadcast received, rejoining room"),this.context.getValue("peerSessionStore").emit(Vo.ROOM_NODE_DISCONNECTED),Ne(this,oS).call(this))})})}handleCallstatsEvents(){this.context.getValue("callstats").onConsumerScore(e=>{e.forEach((e,t)=>{const i=Ne(this,tS).consumers.get(t);i&&this.context.getValue("peerSessionStore").emit(Vo.CONSUMER_SCORE_UPDATE,{id:t,kind:i.kind,peerId:i.peerId,score:e.score,scoreStats:e})})}),this.context.getValue("callstats").onProducerScore(e=>{e.forEach((e,t)=>{const i=Array.from(Ne(this,tS).producers.values()).find(e=>e.id===t);i&&this.context.getValue("peerSessionStore").emit(Vo.PRODUCER_SCORE_UPDATE,{id:t,kind:i.kind,appData:i.appData,score:e.score,scoreStats:e})})})}handlePeerCapabilities(e,t){var i,r,n,s;for(let a=0;a<=Jw.length;a+=1){const n=Jw[a];if((null==(r=null==(i=null==t?void 0:t.receiver)?void 0:i.video)?void 0:r.codecs.findIndex(e=>e.mimeType===n))>=0||a===Jw.length-1){Ne(this,uS).get(n).add(e);break}}for(let a=0;a<=Jw.length;a+=1){const i=Jw[a];if((null==(s=null==(n=null==t?void 0:t.sender)?void 0:n.video)?void 0:s.codecs.findIndex(e=>e.mimeType===i))>=0||a===Jw.length-1){Ne(this,hS).get(i).add(e);break}}}handlePeerLeaving(e){this.context.getValue("flagsmith").hasFeature(go)||(Ne(this,hS).forEach(t=>t.delete(e)),Ne(this,uS).forEach((t,i)=>{t.delete(e),0===t.size&&i!==Jw[0]&&this.disableWebcam(i)}))}},Qw=new WeakMap,Xw=new WeakMap,eS=new WeakMap,tS=new WeakMap,iS=new WeakMap,rS=new WeakMap,nS=new WeakMap,sS=new WeakMap,aS=new WeakMap,oS=new WeakMap,cS=new WeakMap,lS=new WeakMap,dS=new WeakMap,hS=new WeakMap,uS=new WeakMap,pS=new WeakMap,gS=new WeakMap,fS=new WeakSet,mS=function(){return this.context.getValue("connectionHandler")},vS=new WeakSet,bS=function(e,t,i,r){return Be(this,null,function*(){Fe(this,Xw,e);try{return Ne(this,cS)?yield Ne(this,cS):yield je(this,xS,ES).call(this,e,t,i,r),je(this,wS,SS).call(this,t),{roomJoined:yield je(this,kS,yS).call(this)}}catch(d){return this.logger.error("Failed to complete room join",{error:d}),{roomJoined:!1}}finally{Fe(this,cS,null)}})},kS=new WeakSet,yS=function(){return Be(this,null,function*(){try{this.mediaJoined=!0;const{roomState:e}=yield Ne(this,tS).socketHandler.notifySelfJoinComplete();return Fe(this,Qw,e.roomUuid),Fe(this,sS,!0),Fe(this,nS,!1),!0}catch(ht){return this.logger.error("Error completing room join",{error:ht}),this.mediaJoined=!1,!1}})},wS=new WeakSet,SS=function(e){"ReactNative"!==navigator.product&&setTimeout(()=>{try{const t={userId:this.context.getValue("userId"),peerId:this.peerId,roomUUID:e,roomViewType:"groupCall",deviceInfo:Ie(Le({},it.getDeviceInfo()),{userAgent:navigator.userAgent,memory:navigator.deviceMemory,cpus:navigator.hardwareConcurrency}),sdkName:this.context.getValue("sdkName"),sdkVersion:this.context.getValue("sdkVersion"),metaData:{},permissions:{}};this.context.getValue("callstats").roomJoined(t)}catch(t){this.logger.error("Error reporting room joined analytics",{error:t})}},0)},xS=new WeakSet,ES=function(e,t,i,r){return Be(this,null,function*(){var n;try{null!=Ne(this,dS)||Fe(this,dS,je(n=$S,TS,PS).call(n));const s=je(this,CS,AS).call(this);yield je(this,RS,LS).call(this,e,t,i,s),yield Ne(this,tS).setupTransports({send:!0,recv:!0}),yield je(this,IS,MS).call(this,r)}catch(s){throw this.logger.error("Failed to initialize connection",{error:s}),s}})},TS=new WeakSet,PS=function(){const{ipInfo:e}=fu();if(null==e||!e.loc)return;const[t,i]=e.loc.split(",").map(parseFloat);return{latitude:t,longitude:i}},CS=new WeakSet,AS=function(){var e;const t=function(e){const t=RTCRtpReceiver.getCapabilities("audio"),i=RTCRtpReceiver.getCapabilities("video"),r=RTCRtpSender.getCapabilities("audio"),n=RTCRtpSender.getCapabilities("video");e&&(i.codecs=i.codecs.filter(t=>{let{mimeType:i}=t;return e===i}),n.codecs=n.codecs.filter(t=>{let{mimeType:i}=t;return e===i}));const s={audio:Zb(t),video:Zb(i)};return{sender:{audio:Zb(r),video:Zb(n)},receiver:s}}(null==(e=this.context.getValue("flagsmith").getValue(go))?void 0:e.toString());return Fe(this,iS,t),t},RS=new WeakSet,LS=function(e,t,i,r){return Be(this,null,function*(){yield Wb((n,s)=>Be(this,null,function*(){if(Ne(this,eS).isConnected){n>0&&this.logger.warn("Retry: send joinRoom message",{debuggingHint:"Retry attempt ".concat(n)});try{yield Ne(this,tS).socketHandler.joinRoom(t,e,r,i,Ne(this,dS))}catch(a){throw this.logger.error("Failed to send joinRoom message after retries",{error:a}),a}}else s(new Error("Socket is not connected"))}),{delayTime:1e3,strategy:"exponential",maxRetryCount:1/0})})},IS=new WeakSet,MS=function(e){return Be(this,null,function*(){if(this.context.getValue("flagsmith").hasFeature(vo)&&e)try{const t=[];if(e.canProduceVideo===ls.Allowed&&t.push(this.shareWebcam(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var t,i;const r=(new MediaStream).getVideoTracks()[0],n=document.createElement("canvas");n.height=null!=(t=null==r?void 0:r.getSettings().height)?t:720,n.width=null!=(i=null==r?void 0:r.getSettings().width)?i:1280;const s=n.getContext("2d");s.fillStyle="black",s.fillRect(0,0,n.width,n.height),setInterval(()=>{s.fillStyle="black",s.fillRect(0,0,n.width,n.height)},1e3);const a=n.captureStream().getVideoTracks()[0];return Object.assign(a,{fakeTracks:"fakeTracks:fakeVideoTrack"}),a.enabled=e,a}(!1))),e.canProduceAudio===ls.Allowed){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("MediaStreamTrackGenerator"in window&&"AudioData"in window)try{const t=new window.MediaStreamTrackGenerator({kind:"audio"}),i=t.writable.getWriter(),r=48e3,n=128,s=1;let a=0,o=null;const c=()=>Be(void 0,null,function*(){try{const e=new Float32Array(n*s),t=new window.AudioData({format:"f32",sampleRate:r,numberOfFrames:n,numberOfChannels:s,timestamp:a,data:e});a+=n/r*1e6,yield i.ready,yield i.write(t)}catch(e){o&&clearInterval(o),i.releaseLock(),t.writable.abort()}});o=window.setInterval(c,100);const l=new MediaStream([t]).getAudioTracks()[0];return l.addEventListener("ended",()=>{o&&clearInterval(o),i.releaseLock(),t.writable.abort()}),Object.assign(l,{fakeTracks:"fakeTracks:fakeAudioTrack"}),l.enabled=e,l}catch(t){}const i=window.AudioContext||window.webkitAudioContext;if(i)try{const t=new i;if(!t||"running"!==t.state||!t.destination)return;const r=t.createOscillator();r.frequency.value=0,r.type="sine";const n=t.createGain();n.gain.value=0,r.connect(n);const s=t.createMediaStreamDestination();n.connect(s),r.start();const a=s.stream.getAudioTracks()[0];return a?(Object.assign(a,{fakeTracks:"fakeTracks:fakeAudioTrack"}),a.enabled=e,a):void 0}catch(t){return}}(!1);e&&t.push(this.shareMic(e))}t.length>0&&(yield Promise.all(t))}catch(t){this.logger.warn("Failed to precreate producers",{error:t})}})},DS=new WeakSet,OS=function(e){return Ne(this,pS).get(e)},NS=new WeakSet,US=function(e,t){return Ne(this,pS).set(e,t)},FS=new WeakSet,jS=function(e){return Ne(this,pS).delete(e)},BS=new WeakSet,VS=function(e){return{track:e,encodings:[{priority:"high"}],codecOptions:[{name:"opus"}],appData:{e2ee:this.e2ee},stopTracks:!1,zeroRtpOnPause:!1}},zS=new WeakSet,HS=function(e,t){return{track:e,codecOptions:t?t.map(e=>({name:e.split("/")[1]})):[{name:"VP8"}],appData:{screenShare:!1,e2ee:this.e2ee},stopTracks:!1}},Ue(_S,TS),_S);let GS=$S;function WS(e,t){const i=e.getValue("roomNodeClient");if(i){if(i)return i;throw new Error("Room node client already set up.")}const r=new GS(e,t);return e.setValue("roomNodeClient",r),r}function qS(e){const t=e.getValue("roomNodeClient");try{null==t||t.leaveRoom()}catch(i){e.getValue("logger").error("roomNodeClient::cleanupRoomNodeClient")}e.setValue("roomNodeClient",void 0)}Yw([Mo.trace("MediaNodeClient.reset",{country:Mo.location.country})],GS.prototype,"reset",1),Yw([Mo.trace("MediaNodeClient.joinRoom")],GS.prototype,"joinRoom",1),Yw([Mo.trace("MediaNodeClient.leaveRoom")],GS.prototype,"leaveRoom",1),Yw([Mo.trace("MediaNodeClient.activatePeers")],GS.prototype,"activatePeers",1),Yw([Mo.trace("MediaNodeClient.createConsumers")],GS.prototype,"createConsumers",1),Yw([Mo.trace("MediaNodeClient.closeConsumers")],GS.prototype,"closeConsumers",1),Yw([Mo.trace("MediaNodeClient._shareWebcam")],GS.prototype,"_shareWebcam",1),Yw([Mo.trace("MediaNodeClient.shareWebcam")],GS.prototype,"shareWebcam",1),Yw([Mo.trace("MediaNodeClient.shareScreen")],GS.prototype,"shareScreen",1),Yw([Mo.trace("MediaNodeClient.shareMic")],GS.prototype,"shareMic",1),Yw([Mo.trace("MediaNodeClient.pauseMic")],GS.prototype,"pauseMic",1),Yw([Mo.trace("MediaNodeClient.pauseWebcam")],GS.prototype,"pauseWebcam",1),Yw([Mo.trace("MediaNodeClient.resumeMic")],GS.prototype,"resumeMic",1),Yw([Mo.trace("MediaNodeClient.resumeWebcam")],GS.prototype,"resumeWebcam",1),Yw([Mo.trace("MediaNodeClient.disableWebcam")],GS.prototype,"disableWebcam",1),Yw([Mo.trace("MediaNodeClient.disableMic")],GS.prototype,"disableMic",1),Yw([Mo.trace("MediaNodeClient.disableScreenShare")],GS.prototype,"disableScreenShare",1),Yw([Mo.trace("MediaNodeClient.muteSelf")],GS.prototype,"muteSelf",1),Yw([Mo.trace("MediaNodeClient.resetVideoProducers")],GS.prototype,"resetVideoProducers",1),Yw([Mo.trace("MediaNodeClient.changeDisplayName")],GS.prototype,"changeDisplayName",1),Yw([Mo.trace("MediaNodeClient.kickPeer")],GS.prototype,"kick",1),Yw([Mo.trace("MediaNodeClient.kickAllPeers")],GS.prototype,"kickAll",1),Yw([Mo.trace("MediaNodeClient.muteAll")],GS.prototype,"muteAll",1),Yw([Mo.trace("MediaNodeClient.muteAllVideo")],GS.prototype,"muteAllVideo",1),Yw([Mo.trace("MediaNodeClient.disableAudio")],GS.prototype,"disableAudio",1),Yw([Mo.trace("MediaNodeClient.disableVideo")],GS.prototype,"disableVideo",1),Yw([Mo.trace("MediaNodeClient.pinPeer")],GS.prototype,"pinPeer",1),Yw([Mo.trace("MediaNodeClient.validateScreenShare")],GS.prototype,"validateScreenShare",1);var KS,ZS,YS,JS,QS,XS,ex=Object.defineProperty,tx=Object.getOwnPropertyDescriptor,ix=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?tx(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&ex(t,i,s),s};const rx=(XS=class{constructor(e,t,i,r){Ue(this,JS),De(this,"self"),De(this,"authToken"),Ue(this,KS,void 0),De(this,"viewType"),Ue(this,ZS,void 0),Ue(this,YS,void 0);const{socket:n}=i,s=e.getValue("authToken");this.self=t,Fe(this,YS,e),this.viewType=r,this.authToken=s,Fe(this,KS,n),Fe(this,ZS,i),t.config.viewType!==cs.Chat&&this.setupEvents()}get peerId(){return Ne(this,YS).getValue("peerId")}get telemetry(){return Ne(this,YS).getValue("telemetry")}get logger(){return Ne(this,YS).getValue("logger")}get mediaJoined(){return Ne(this,YS).getValue("connectionHandler").mediaJoined}static init(e,t,i,r,n){return Be(this,null,function*(){const s=fu(),a=e.getValue("peerId"),o=!!e.getValue("cachedUserDetails"),c=yield Ub.__init__(e,i,r,n,n.name,o);e.setValue("self",c);const l=e.getValue("logger");if("ReactNative"!==navigator.product){const t=!e.getValue("flagsmith").hasFeature(ho);setTimeout(()=>Be(this,null,function*(){const i=yield c.getAllDevices();l.info("populated_full_device_list",{devices:JSON.stringify(i)}),e.getValue("callstats").devices("AUDIO",null==i?void 0:i.filter(e=>"audioinput"===e.kind)),e.getValue("callstats").devices("VIDEO",null==i?void 0:i.filter(e=>"videoinput"===e.kind)),e.getValue("callstats").devices("SPEAKER",null==i?void 0:i.filter(e=>"audiooutput"===e.kind)),l.info("Callstats:: initializing");try{yield e.getValue("callstats").initialize({peerId:a,engineName:it.getDeviceInfo().engineName,env:e.getValue("env"),iceServers:yield s.getICEServers(),apiBase:e.getValue("apiBase"),flags:e.getValue("flagsmith").getAllFlags(),logger:l,apiHostnames:Po(e),skipConnectivityChecks:t}),l.info("Callstats:: initialized")}catch(r){l.error("Callstats:: initialization failed",{error:r})}}),0)}else l.info("Callstats:: Skipped initialization due to navigator product being ReactNative.");return new rx(e,c,t,n.viewType)})}shareMediaTracks(){return Be(this,null,function*(){var e;const{audioTrack:t,videoTrack:i,permissions:r,audioEnabled:n,videoEnabled:s,screenShareEnabled:a,screenShareTracks:o}=this.self;if(r.canProduceAudio===ls.Allowed&&n)try{yield Ne(this,JS,QS).shareMic(t),this.self.audioEnabled||Ne(this,JS,QS).pauseMic()}catch(c){this.self.disableAudio()}if(r.canProduceVideo===ls.Allowed&&s)try{const e=yield Ne(this,JS,QS).shareWebcam(i);e&&e.id!==i.id&&Ne(this,YS).getValue("flagsmith").hasFeature(co)&&(yield Ne(this,JS,QS).shareWebcam(e)),this.self.videoEnabled||Ne(this,JS,QS).pauseWebcam()}catch(c){this.self.disableVideo()}if(r.canProduceScreenshare===ls.Allowed&&a)try{yield null==(e=Ne(this,JS,QS))?void 0:e.shareScreen({video:o.video,audio:o.audio})}catch(c){this.self.disableScreenShare()}})}kickHandler(e){return Be(this,null,function*(){let t="kicked";"kickAll"===(null==e?void 0:e.kickType)&&(t="ended"),this.leaveRoom(t)})}waitlistedHandler(){this.logger.info("SelController.waitlisted"),this.self.waitlistStatus="waiting",this.self.roomState="waitlisted",this.self.emit("waitlisted")}waitlistAcceptHandler(){this.logger.info("SelController.waitlistAccepted"),"accepted"!==this.self.waitlistStatus?(this.self.waitlistStatus="accepted",this.joinRoom()):this.logger.warn("SelfController.WAITLIST_ACCEPTED.UserAlreadyAccepted")}waitlistRejectedHandler(){this.logger.info("SelfController.waitlistRejected"),"rejected"!==this.self.waitlistStatus?(this.self.waitlistStatus="rejected",this.leaveRoom("rejected")):this.logger.warn("SelfController.WAITLIST_REJECTED.UserAlreadyRejected")}resetSelf(e){return Be(this,null,function*(){Ne(this,YS).getValue("callstats").callEnded(),Ne(this,JS,QS).reset(),e&&(yield this.joinRoom(e))})}setupEvents(){Ne(this,YS).getValue("peerSessionStore").on(Vo.RESET_PRODUCER_STATE,()=>Be(this,null,function*(){this.mediaJoined&&this.shareMediaTracks()})),Ne(this,YS).getValue("peerSessionStore").on(Vo.ROOM_NODE_RECONNECTED,()=>{this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:!0})}),Ne(this,YS).getValue("peerSessionStore").on(Vo.ROOM_NODE_DISCONNECTED,()=>{"disconnected"!==this.self.roomState&&(this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"}))}),Ne(this,YS).getValue("peerSessionStore").on(Vo.ROOM_NODE_FAILED,()=>{this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),Ne(this,YS).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_RECONNECTED,e=>{let{wasJoinAttempted:t}=e;!1===t&&(this.self.roomState="init"),this.resetSelf(t)}),Ne(this,YS).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_DISCONNECTED,e=>{let{joinAttempted:t}=e;if("disconnected"===this.self.roomState)return;let{peerId:i}=this;t&&Ne(this,YS).getValue("flagsmith").hasFeature(Ga)&&(i=u()),Ne(this,KS).updateURL(i),Ne(this,YS).getValue("telemetry").resetPeerId(i),fu().setHeader("tracing-id",i),Do.remapContext(i,Ne(this,YS)),this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"})}),Ne(this,YS).getValue("peerSessionStore").on(Vo.SOCKET_SERVICE_FAILED,()=>{this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),Ne(this,ZS).on(Mh.waitingRoomRequestAccepted,()=>{this.waitlistAcceptHandler()}),Ne(this,ZS).on(Bh.updateUserPreset,e=>{e.updatePeersPresets.forEach(e=>{e.userIds===this.self.userId&&Ne(this,YS).getValue("peerSessionStore").emit(Vo.UPDATE_PERMISSIONS,e.patch)})}),Ne(this,ZS).on(Mh.waitingRoomRequestDenied,()=>{this.waitlistRejectedHandler()}),Ne(this,ZS).on(Mh.kick,()=>{this.kickHandler({kickType:"kick"})}),Ne(this,ZS).on(Mh.kickAll,()=>{this.kickHandler({kickType:"kickAll"})}),Ne(this,YS).getValue("peerSessionStore").onAsync(Vo.JOIN_MEDIA_ROOM,this.joinMediaRoom.bind(this)),Ne(this,YS).getValue("peerSessionStore").on(Vo.PRODUCER_SCORE_UPDATE,e=>{let{score:t,kind:i,appData:r,scoreStats:n}=e;var s;const a=null!=(s=null==r?void 0:r.screenShare)&&s;this.self.emit("mediaScoreUpdate",{kind:i,isScreenshare:a,score:t,participantId:this.self.id,scoreStats:n})}),Ne(this,YS).getValue("peerSessionStore").on(Vo.MUTE_SELF,()=>Be(this,null,function*(){this.self.audioEnabled&&(yield this.self.disableAudio(),Ne(this,YS).getValue("callstats").audioOff())})),Ne(this,YS).getValue("peerSessionStore").on(Vo.MUTE_SELF_VIDEO,()=>Be(this,null,function*(){this.self.videoEnabled&&(yield this.self.disableVideo(),Ne(this,YS).getValue("callstats").videoOff())})),Ne(this,YS).getValue("peerSessionStore").onAsync(Vo.LEAVE_MEDIA_ROOM,this.leaveMediaRoom.bind(this)),Ne(this,YS).getValue("peerSessionStore").on(Vo.PIP_HANGUP,this.leaveRoom.bind(this))}joinRoom(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Be(this,null,function*(){try{const{peer:t}=yield Ne(this,ZS).joinRoom(this.self);Ne(this,ZS).socket.flush();const i=Gp(t.stageType);if(Ne(this,YS).setValue("stageStatus",i,!1),t.waitlisted)return void this.waitlistedHandler();yield this.joinMediaRoom(e),Ne(this,YS).notify("stageStatus")}catch(t){throw this.logger.error("Error in joinRoom",{error:t}),t}})}leaveRoom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"left";return Be(this,null,function*(){var t,i;if(this.logger.info("Leaving room with state: ".concat(e)),null==(t=Ne(this,YS).getValue("roomSocketHandler"))||t.cleanup(),"rejected"===e)return this.self.roomState=e,void this.self.emit("roomLeft",{state:e});this.self.setIsPinned(!1),Ne(this,YS).setValue("stageStatus","OFF_STAGE",!1),yield this.leaveMediaRoom(e),Ne(this,YS).notify("stageStatus");try{null==(i=Ne(this,KS))||i.disconnect()}catch(r){this.logger.error("SelfController::leaveRoom::socketDisconnect")}qS(Ne(this,YS)),this.self.roomState=e,this.self.emit("roomLeft",{state:e}),this.logger.info("roomLeft event emitted with state: ".concat(e))})}joinMediaRoom(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Be(this,null,function*(){var t,i;const{peerId:r,viewType:n,meetingId:s,stageStatus:a}=Ne(this,YS).getAllValues();try{if(n===cs.Livestream){if("ON_STAGE"!==a)return this.self.roomState="joined",void this.self.emit("roomJoined",{reconnected:e});WS(Ne(this,YS),{socket:Ne(this,KS),peerId:r})}const{canProduceAudio:o,canProduceVideo:c,canProduceScreenshare:l}=this.self.permissions,{roomJoined:d}=null!=(i=yield null==(t=Ne(this,JS,QS))?void 0:t.joinRoom(this.self.name,s,e,e,{canProduceAudio:o,canProduceVideo:c,canProduceScreenshare:l}))?i:{};if(!d)return;"ON_STAGE"===a&&(yield this.shareMediaTracks()),this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:e})}catch(o){throw this.logger.error("Error:SelfController.mediaRoomJoin",{error:o}),new Uo("Error: could not join media room","0002")}})}leaveMediaRoom(e){return Be(this,null,function*(){const t=Ne(this,YS).getValue("viewType");"connected-meeting"!==e&&(yield this.cleanupSelf()),("stageLeft"!==e||t!==cs.Webinar)&&Ne(this,JS,QS)&&(Ne(this,JS,QS).mediaJoined&&"disconnected"!==e&&(yield Ne(this,JS,QS).leaveRoom()),("stageLeft"!==e||t!==cs.Livestream)&&(Ne(this,JS,QS).mediaJoined=!1))})}cleanupSelf(){return Be(this,null,function*(){yield this.self.disableAudio(),yield this.self.disableVideo(),yield this.self.disableScreenShare(),this.self.cleanUpTracks(),this.self.destructMediaHandler(),navigator.isReactNative||this.self.removeDocumentEventListeners()})}},KS=new WeakMap,ZS=new WeakMap,YS=new WeakMap,JS=new WeakSet,QS=function(){return Ne(this,YS).getValue("roomNodeClient")},XS);let nx=rx;var sx,ax,ox;ix([Mo.trace("SelfController.resetSelf")],nx.prototype,"resetSelf",1),ix([Mo.trace("SelfController.setupEvents")],nx.prototype,"setupEvents",1),ix([Mo.trace("SelfController.joinRoom")],nx.prototype,"joinRoom",1),ix([Mo.trace("SelfController.leaveRoom")],nx.prototype,"leaveRoom",1),ix([Mo.trace("SelfController.joinMediaRoom")],nx.prototype,"joinMediaRoom",1),ix([Mo.trace("SelfController.leaveMediaRoom")],nx.prototype,"leaveMediaRoom",1),ix([Mo.trace("SelfController.init")],nx,"init",1);class cx{constructor(e){Ue(this,sx,void 0),Fe(this,sx,e)}on(e,t){let i;i=e===Mh.roomPeerCount?_l.fromBinary.bind(_l):gh.fromBinary.bind(gh),Ne(this,sx).on(e,r=>{let{payload:n}=r;if(e===Mh.roomPeerCount&&!n)return;const s=i(n);t(s)})}}sx=new WeakMap;class lx{constructor(e,t){Ue(this,ax,void 0),Ue(this,ox,void 0),Fe(this,ax,t),Fe(this,ox,e)}get logger(){return Ne(this,ox).getValue("logger")}on(e,t){let i,r;if(e===Mh.transcript)i=pl.fromBinary.bind(pl),r=pl.create();else this.logger.debug("AISocketHandler switch case hit default, event not accounted for.");Ne(this,ax).on(e,e=>{let{payload:n}=e,s=r;try{s=i(n)}catch(a){this.logger.error("aiSocketHandler::on::binary_decode_error",{error:a})}return t(s)})}}ax=new WeakMap,ox=new WeakMap;var dx,hx,ux=Object.defineProperty,px=Object.getOwnPropertyDescriptor,gx=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?px(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&ux(t,i,s),s};class fx{constructor(e,t){Ue(this,dx,void 0),Ue(this,hx,void 0),Fe(this,dx,t),Fe(this,hx,e)}get logger(){return Ne(this,hx).getValue("logger")}get telemetry(){return Ne(this,hx).getValue("telemetry")}getPolls(){return Ne(this,dx).sendMessagePromise(Nh.getPolls)}createPoll(e,t){const i={anonymous:arguments.length>2&&void 0!==arguments[2]&&arguments[2],hideVotes:arguments.length>3&&void 0!==arguments[3]&&arguments[3],question:e,options:t};return Ne(this,dx).sendMessage(Nh.createPoll,Eh.toBinary(i))}votePoll(e,t){const i={index:t,pollId:e};return Ne(this,dx).sendMessage(Nh.votePoll,Th.toBinary(i))}on(e,t){let i,r;switch(e){case Nh.updatePoll:case Nh.createPoll:case Nh.votePoll:i=_h.fromBinary.bind(_h),r=_h.create()}Ne(this,dx).on(e,e=>{let{payload:n}=e,s=r;try{s=i(n)}catch(a){this.logger.error("pollSocketHandler::on::binary_decode_error",{error:a})}return t(s)})}removeListeners(e){Ne(this,dx).removeListeners(e)}}dx=new WeakMap,hx=new WeakMap,gx([Mo.trace("PollSocketHandler.getPolls")],fx.prototype,"getPolls",1),gx([Mo.trace("PollSocketHandler.createPoll")],fx.prototype,"createPoll",1),gx([Mo.trace("PollSocketHandler.votePoll")],fx.prototype,"votePoll",1);var mx,vx,bx,kx,yx=Object.defineProperty,wx=Object.getOwnPropertyDescriptor;class Sx{constructor(e,t){De(this,"socket"),Ue(this,mx,void 0),Fe(this,mx,e),this.socket=t,this.handleSocketEvents(),Ne(this,mx).setValue("roomSocketHandler",this)}get telemetry(){return Ne(this,mx).getValue("telemetry")}get logger(){return Ne(this,mx).getValue("logger")}cleanup(){var e;try{null==(e=this.socket)||e.disconnect()}catch(t){this.logger.error("roomSocketHandler::cleanup")}}joinRoom(e){return Be(this,null,function*(){var t;this.socket.joinAttempted=!0;const i={capabilities:[],peer:{displayName:null!=(t=e.name)?t:"Participant",customParticipantId:e.customParticipantId,peerId:e.id,userId:e.userId,displayPictureUrl:e.picture,waitlisted:!1},roomUuid:""},r=this.socket.sendMessagePromise(Mh.joinRoom,Ll.toBinary(i));try{const{peer:e}=Sl.fromBinary((yield r).payload);Ne(this,mx).getValue("connectionHandler").socketJoined=!0,Ne(this,mx).getValue("peerSessionStore").emit(Vo.SOCKET_SERVICE_ROOM_JOINED,{peer:e});const t=this.getRoomState(),i=this.getRoomPeersNonPaginated(),[{room:n},{peers:s}]=yield Promise.all([t,i]);return Ne(this,mx).getValue("peerSessionStore").emit(Vo.ROOM_STATE,n),Ne(this,mx).getValue("peerSessionStore").emit(Vo.SOCKET_PEERS,s),{peer:e}}catch(n){throw this.logger.error("RoomSocketHandler.joinRoom.failed",{error:n}),new Uo("Error: RoomSocketHandler.joinRoom failed.","0002",this.logger,n)}})}getAllAddedParticipants(){return Be(this,null,function*(){try{return Yl.fromBinary((yield this.socket.sendMessagePromise(Mh.getAllAddedParticipants)).payload).participants.map(e=>{var t=e,{id:i}=t,r=Me(t,["id"]);return Ie(Le({},r),{userId:i})})}catch(e){return[]}})}getRoomPeers(e,t,i){return Be(this,null,function*(){let r;try{const n={seachQuery:e,limit:t,offset:i},s=yield this.socket.sendMessagePromise(Mh.getRoomPeersInfo,El.toBinary(n));r=Tl.fromBinary(s.payload)}catch(n){this.logger.error("getRoomPeers::binary_decode_error",{error:n})}return r})}getRoomPeersNonPaginated(){return Be(this,null,function*(){let e;try{const t=yield this.socket.sendMessagePromise(Mh.getRoomPeersInfo);e=Tl.fromBinary(t.payload)}catch(t){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:t})}return e})}getStagePeers(){return Be(this,null,function*(){let e;try{const t=yield this.socket.sendMessagePromise(Mh.getRoomPeersInfo);e=Tl.fromBinary(t.payload)}catch(t){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:t})}return e})}getPeerInfo(e){return Be(this,null,function*(){let t;try{const i=yield this.socket.sendMessagePromise(Mh.getPeerInfo,Rl.toBinary({peerId:e}));t=Sl.fromBinary(i.payload)}catch(i){this.logger.error("getPeerInfo::binary_decode_error",{error:i})}return t})}getRoomState(){return Be(this,null,function*(){let e=Al.create();try{const t=yield this.socket.sendMessagePromise(Mh.getRoomInfo);e=Al.fromBinary(t.payload)}catch(t){this.logger.error("getRoomState::binary_decode_error",{error:t})}return e})}getRoomStageState(){return Be(this,null,function*(){let e=nd.create();try{const t=yield this.socket.sendMessagePromise(Mh.getRoomStageState);e=nd.fromBinary(t.payload)}catch(t){this.logger.error("getRoomStageState::binary_decode_error",{error:t})}return e})}broadcastMessage(e,t){return Be(this,null,function*(){const i={type:e,payload:(new TextEncoder).encode(JSON.stringify(t)),timestamp:Date.now(),ids:[]};return this.socket.sendMessagePromise(Mh.broadcastMessage,Xl.toBinary(i))})}broadcastToMeetings(e,t,i){return Be(this,null,function*(){const r={type:e,payload:(new TextEncoder).encode(JSON.stringify(i)),timestamp:Date.now(),ids:t,broadcastType:1};return this.socket.sendMessagePromise(Mh.broadcastToEntity,Xl.toBinary(r))})}broadcastToPeers(e,t,i){return Be(this,null,function*(){const r={type:e,payload:(new TextEncoder).encode(JSON.stringify(i)),timestamp:Date.now(),ids:t,broadcastType:0};return this.socket.sendMessage(Mh.broadcastToEntity,Xl.toBinary(r))})}leaveRoom(){return Be(this,null,function*(){this.socket.joinAttempted=!1,this.socket.sendMessagePromise(Mh.leaveRoom,Il.toBinary({}))})}kick(e){return Be(this,null,function*(){const t={peerIds:[e]};this.socket.sendMessage(Mh.kick,Ql.toBinary(t))})}kickAll(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Be(this,null,function*(){const t={propagateKickAcrossRooms:e};this.socket.sendMessage(Mh.kickAll,Bc.toBinary(t))})}getWaitingRoomRequests(){this.socket.sendMessage(Mh.getWaitingRoomRequests)}acceptWaitingRoomRequest(e){const t={userIds:e};this.socket.sendMessage(Mh.acceptWaitingRoomRequests,ed.toBinary(t))}rejectWaitingRoomRequest(e){const t={userIds:e};this.socket.sendMessage(Mh.denyWaitingRoomRequests,td.toBinary(t))}updatePermissions(e,t){return Be(this,null,function*(){const i={updatePeersPresets:[]};return e.forEach(e=>{i.updatePeersPresets.push({userIds:e,patch:t})}),this.socket.sendMessagePromise(Bh.updateUserPreset,yd.toBinary(i))})}handleSocketEvents(){this.socket.on(Mh.broadcastMessage,e=>{let{payload:t}=e;try{const e=Xl.fromBinary(t);Ne(this,mx).getValue("peerSessionStore").emit(Vo.ROOM_MESSAGE,{payload:JSON.parse((new TextDecoder).decode(e.payload)),type:e.type,timestamp:e.timestamp})}catch(i){this.logger.error("failed to decode broadcast message:",i)}}),this.socket.on(Mh.broadcastToEntity,e=>{let{payload:t}=e;try{const e=Xl.fromBinary(t);Ne(this,mx).getValue("peerSessionStore").emit(Vo.MESSAGE,{payload:JSON.parse((new TextDecoder).decode(e.payload)),type:e.type,timestamp:e.timestamp})}catch(i){this.logger.error("failed to decode peer broadcast message:",i)}})}on(e,t){let i,r;switch(e){case Mh.joinRoom:case Mh.leaveRoom:case Mh.kick:case Mh.kickAll:i=Sl.fromBinary.bind(Sl),r=Sl.create();break;case Mh.getWaitingRoomRequests:i=(e,t)=>e?rd.fromBinary(e,t):{requests:[]},r=rd.create();break;case Mh.recordingPaused:case Mh.recordingStarted:case Mh.recordingStopped:i=Ch.fromBinary.bind(Ch);break;case Bh.updateUserPreset:i=wd.fromBinary.bind(wd);break;case jh.peerJoinedBroadcast:case Fh.peerJoinedBroadcast:i=sl.fromBinary.bind(sl);break;case jh.selfJoinComplete:case Fh.selfJoinComplete:i=Yc.fromBinary.bind(Yc);break;case jh.globalPeerPinBroadcast:case Fh.globalPeerPinBroadcast:i=ul.fromBinary.bind(ul);break;case jh.selectedPeer:case Fh.selectedPeer:i=qc.fromBinary.bind(qc);break;case jh.selectedPeerDiff:case Fh.selectedPeerDiff:i=Zc.fromBinary.bind(Zc);break;case jh.leaveRoom:case Fh.leaveRoom:i=hl.fromBinary.bind(hl)}this.socket.on(e,e=>{let{payload:n}=e,s=r;if(!i)return t(void 0);try{s=i(n)}catch(a){this.logger.error("roomSocketHandler::on::binary_decode_error",{error:a})}return t(s)})}getUserPermissions(e){return Be(this,null,function*(){const t={userIds:[e]};try{const e=yield this.socket.sendMessagePromise(Bh.getUserPresets,md.toBinary(t)),i=bd.fromBinary(e.payload).peerPresets[0],r=(new TextDecoder).decode(i.preset),n=JSON.parse(r).permissions;return{chat:n.chat,polls:n.polls,plugins:n.plugins}}catch(i){throw this.logger.error("Error in getting user preset",{error:i}),i}})}}mx=new WeakMap,((e,t,i,r)=>{for(var n,s=r>1?void 0:r?wx(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&yx(t,i,s)})([Mo.trace("RoomSocketHandler.joinRoom")],Sx.prototype,"joinRoom",1);class xx{constructor(e){Ue(this,vx,void 0),Fe(this,vx,e)}getStageRequests(){return Be(this,null,function*(){const{payload:e}=yield Ne(this,vx).sendMessagePromise(Mh.getStageRequests);return e?vh.fromBinary(e):{stageRequests:[]}})}requestAccess(){Ne(this,vx).sendMessage(Mh.requestStageAccess)}cancelRequestAccess(){Ne(this,vx).sendMessage(Mh.cancelStageRequest)}grantAccess(e){return Be(this,null,function*(){const t={userIds:e};Ne(this,vx).sendMessage(Mh.grantStageAccess,bh.toBinary(t))})}denyAccess(e){return Be(this,null,function*(){const t={userIds:e};Ne(this,vx).sendMessage(Mh.denyStageAccess,kh.toBinary(t))})}joinStage(){return Ne(this,vx).sendMessagePromise(Mh.joinStage,void 0,void 0,Mh.peerStageStatusUpdate)}leaveStage(e){const t={userIds:[e]};return Ne(this,vx).sendMessagePromise(Mh.leaveStage,yh.toBinary(t),void 0,Mh.peerStageStatusUpdate)}kick(e){const t={userIds:e};return Ne(this,vx).sendMessagePromise(Mh.leaveStage,yh.toBinary(t))}on(e,t){let i;switch(e){case Mh.grantStageAccess:case Mh.denyStageAccess:i=void 0;break;case Mh.getStagePeers:i=fh.fromBinary.bind(fh);break;case Mh.getStageRequests:case Mh.requestStageAccess:case Mh.cancelStageRequest:i=vh.fromBinary.bind(vh);break;case Mh.peerStageStatusUpdate:i=xl.fromBinary.bind(xl)}Ne(this,vx).on(e,e=>{let{payload:r,id:n}=e;if(!r||!i)return t(void 0,n);const s=i(r);return t(s,n)})}getPeerInfo(e){return Be(this,null,function*(){const t=yield Ne(this,vx).sendMessagePromise(Mh.getPeerInfo,Rl.toBinary({peerId:e}));return Sl.fromBinary(t.payload)})}}vx=new WeakMap;class Ex{constructor(e,t){Ue(this,bx,void 0),Ue(this,kx,void 0),Fe(this,bx,t),Fe(this,kx,e)}get logger(){return Ne(this,kx).getValue("logger")}addPlugin(e,t){Ne(this,bx).sendMessage(Oh.addPlugin,Zd.toBinary({pluginId:e,staggered:t}))}removePlugin(e){Ne(this,bx).sendMessage(Oh.removePlugin,Yd.toBinary({pluginId:e,staggered:!1}))}getActivePlugins(){return Be(this,null,function*(){const{payload:e}=yield Ne(this,bx).sendMessagePromise(Oh.getPlugins);return e?lh.fromBinary(e):{plugins:[]}})}customPluginEventToRoom(e,t,i){const r={pluginId:e,pluginData:(new TextEncoder).encode(JSON.stringify(t))};Ne(this,bx).sendMessage(Oh.customPluginEventToRoom,th.toBinary(r),i)}customPluginEventToPeers(e,t,i,r){const n={pluginId:e,peerIds:t,pluginData:(new TextEncoder).encode(JSON.stringify(i))};Ne(this,bx).sendMessage(Oh.customPluginEventToPeers,ih.toBinary(n),r)}enablePluginForRoom(e,t){Ne(this,bx).sendMessage(Oh.enablePluginForRoom,Jd.toBinary({pluginId:e}),t)}enablePluginForPeers(e,t,i){Ne(this,bx).sendMessage(Oh.enablePluginForPeers,Xd.toBinary({pluginId:e,peerIds:t}),i)}disablePluginForRoom(e,t){Ne(this,bx).sendMessage(Oh.disablePluginForRoom,Qd.toBinary({pluginId:e}),t)}disablePluginForPeers(e,t,i){Ne(this,bx).sendMessage(Oh.disablePluginForPeers,eh.toBinary({pluginId:e,peerIds:t}),i)}storeInsertKeys(e,t,i,r){const n={pluginId:e,storeName:t,insertKeys:i.map(e=>({storeKey:e.key,payload:(new TextEncoder).encode(JSON.stringify(e.payload))}))};Ne(this,bx).sendMessage(Oh.storeInsertKeys,nh.toBinary(n),r)}storeGetKeys(e,t,i,r){const n={pluginId:e,storeName:t,getKeys:i.map(e=>({storeKey:e.key}))};Ne(this,bx).sendMessage(Oh.storeGetKeys,sh.toBinary(n),r)}storeDeleteKeys(e,t,i,r){const n={pluginId:e,storeName:t,deleteKeys:i.map(e=>({storeKey:e.key}))};Ne(this,bx).sendMessage(Oh.storeDeleteKeys,ah.toBinary(n),r)}storeDelete(e,t,i){Ne(this,bx).sendMessage(Oh.storeDelete,oh.toBinary({pluginId:e,storeName:t}),i)}getPluginDataOld(e,t){this.logger.info("getPluginDataOld",{plugin:{id:e,storeName:t}})}storePluginDataOld(e,t,i){const r={pluginId:e,storeName:t,insertKeys:[{storeKey:i.key,payload:(new TextEncoder).encode(JSON.stringify(i))}]};Ne(this,bx).sendMessage(Oh.storeInsertKeys,nh.toBinary(r))}on(e,t){let i;switch(e){case Oh.addPlugin:case Oh.enablePluginForPeers:case Oh.enablePluginForRoom:i=ch.fromBinary.bind(ch);break;case Oh.removePlugin:case Oh.disablePluginForPeers:case Oh.disablePluginForRoom:i=dh.fromBinary.bind(dh);break;case Oh.customPluginEventToPeers:case Oh.customPluginEventToRoom:i=ph.fromBinary.bind(ph);break;case Oh.storeInsertKeys:case Oh.storeGetKeys:case Oh.storeDeleteKeys:case Oh.storeDelete:i=uh.fromBinary.bind(uh)}Ne(this,bx).on(e,e=>{let{payload:r,id:n}=e;const s=i(r);return t(s,n)})}}bx=new WeakMap,kx=new WeakMap;var Tx,_x=Object.defineProperty,Px=(e,t,i)=>(((e,t,i)=>{t in e?_x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i})(e,"symbol"!=typeof t?t+"":t,i),i),Cx=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ax=(e,t,i)=>(Cx(e,t,"read from private field"),i?i.call(e):t.get(e)),Rx=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Lx=(e,t,i,r)=>(Cx(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),Ix=(e,t,i)=>(Cx(e,t,"access private method"),i),Mx={},Dx={get exports(){return Mx},set exports(e){Mx=e}},Ox="object"==typeof Reflect?Reflect:null,Nx=Ox&&"function"==typeof Ox.apply?Ox.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};Tx=Ox&&"function"==typeof Ox.ownKeys?Ox.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Ux=Number.isNaN||function(e){return e!==e};function Fx(){Fx.init.call(this)}Dx.exports=Fx,Mx.once=function(e,t){return new Promise(function(i,r){function n(i){e.removeListener(t,s),r(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}Kx(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&Kx(e,"error",t,i)}(e,n,{once:!0})})},Fx.EventEmitter=Fx,Fx.prototype._events=void 0,Fx.prototype._eventsCount=0,Fx.prototype._maxListeners=void 0;var jx=10;function Bx(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Vx(e){return void 0===e._maxListeners?Fx.defaultMaxListeners:e._maxListeners}function zx(e,t,i,r){var n,s,a;if(Bx(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),a=s[t]),void 0===a)a=s[t]=i,++e._eventsCount;else if("function"==typeof a?a=s[t]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(n=Vx(e))>0&&a.length>n&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=a.length,function(e){console&&console.warn&&console.warn(e)}(o)}return e}function Hx(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $x(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=Hx.bind(r);return n.listener=i,r.wrapFn=n,n}function Gx(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=n[e];if(void 0===o)return!1;if("function"==typeof o)Nx(o,this,t);else{var c=o.length,l=qx(o,c);for(i=0;i=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},Fx.prototype.listeners=function(e){return Gx(this,e,!0)},Fx.prototype.rawListeners=function(e){return Gx(this,e,!1)},Fx.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Wx.call(e,t)},Fx.prototype.listenerCount=Wx,Fx.prototype.eventNames=function(){return this._eventsCount>0?Tx(this._events):[]};const Zx=new class extends pe{constructor(){super("message.v1.SocketMessage",[{no:1,name:"event",kind:"scalar",T:13},{no:2,name:"id",kind:"scalar",opt:!0,T:9},{no:3,name:"payload",kind:"scalar",opt:!0,T:12},{no:4,name:"metadata",kind:"scalar",opt:!0,T:12}])}};class Yx{static encode(e){return Zx.toBinary(e)}static decode(e){return Zx.fromBinary(new Uint8Array(e))}}var Jx;class Qx{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Px(this,"opts"),Rx(this,Jx,void 0),this.opts={initialTimeout:e.initialTimeout||1e3,maxTimeout:e.maxTimeout||1e4,factor:e.factor||2},Lx(this,Jx,0)}wait(){return Be(this,null,function*(){Lx(this,Jx,Ax(this,Jx)+1);const e=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)}(0,Math.min(this.opts.maxTimeout,this.opts.initialTimeout*Ae(2,Ax(this,Jx))));yield new Promise(t=>{setTimeout(t,e)})})}getAttempts(){return Ax(this,Jx)}reset(){Lx(this,Jx,0)}}Jx=new WeakMap;const Xx={debug:0,info:1,warn:2,error:3};var eE,tE;class iE{constructor(e){Rx(this,eE,void 0),Rx(this,tE,void 0),Lx(this,eE,console),Lx(this,tE,e)}debug(){for(var e=arguments.length,t=new Array(e),i=0;iXx.debug||Ax(this,eE).debug("[Sockrates]:",...t)}info(){for(var e=arguments.length,t=new Array(e),i=0;iXx.info||Ax(this,eE).info("[Sockrates]:",...t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;iXx.warn||Ax(this,eE).warn("[Sockrates]:",...t)}error(){for(var e=arguments.length,t=new Array(e),i=0;iXx.error||Ax(this,eE).error("[Sockrates]:",...t)}}eE=new WeakMap,tE=new WeakMap;var rE=(e=>(e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED",e))(rE||{});var nE,sE,aE,oE,cE,lE,dE,hE,uE,pE,gE,fE,mE,vE,bE,kE,yE,wE,SE,xE,EE,TE,_E,PE,CE,AE,RE,LE,IE,ME,DE,OE,NE;class UE{constructor(e,t){var i,r,n,s,a,o,c,l,d,h;Rx(this,fE),Rx(this,vE),Rx(this,kE),Rx(this,wE),Rx(this,xE),Rx(this,TE),Rx(this,PE),Rx(this,AE),Rx(this,LE),Rx(this,ME),Rx(this,OE),Rx(this,nE,void 0),Rx(this,sE,void 0),Rx(this,aE,void 0),Rx(this,oE,void 0),Rx(this,cE,void 0),Rx(this,lE,void 0),Rx(this,dE,void 0),Rx(this,hE,void 0),Rx(this,uE,void 0),Rx(this,pE,void 0),Rx(this,gE,void 0),Lx(this,sE,e),Lx(this,cE,[]),Lx(this,lE,new Mx),Lx(this,dE,!0),Lx(this,uE,!1),Lx(this,aE,null!=t?t:{}),null!=(r=Ax(this,aE)).autoReconnect||(r.autoReconnect=!0),null!=(n=Ax(this,aE)).retryConnectionInterval||(n.retryConnectionInterval=1e3),null!=(s=Ax(this,aE)).pingTimeout||(s.pingTimeout=3e4),null!=(a=Ax(this,aE)).connectionTimeout||(a.connectionTimeout=5e3),null!=(o=Ax(this,aE)).debug||(o.debug=!0),null!=(c=Ax(this,aE)).maxReconnectionAttempts||(c.maxReconnectionAttempts=10),null!=(l=Ax(this,aE)).disconnectOnPingTimeout||(l.disconnectOnPingTimeout=!0),null!=(d=Ax(this,aE)).queueOnDisconnect||(d.queueOnDisconnect=!1),null!=(h=Ax(this,aE)).flushOnReconnect||(h.flushOnReconnect=!1),Lx(this,hE,{code:void 0,reason:void 0}),Lx(this,oE,null!=(i=Ax(this,aE).logger)?i:new iE(Ax(this,aE).debug?"debug":"info")),Lx(this,gE,new Qx)}get readyState(){var e;return null==(e=Ax(this,nE))?void 0:e.readyState}get url(){return Ax(this,sE)}updateURL(e){Lx(this,sE,e),Ix(this,TE,_E).call(this)}get config(){return Ax(this,aE)}get sendQueue(){return Ax(this,cE)}flush(){if(!Ax(this,aE).queueOnDisconnect)return!1;const e=[];return Ax(this,cE).forEach(t=>{this.send(t.event,t.id,t.payload,t.metadata)||e.push(t)}),Lx(this,cE,e),Ax(this,cE)}connect(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Be(this,null,function*(){if(e||![0,1].includes(this.readyState))return!1!==Ax(this,dE)?new Promise((e,t)=>{Ix(this,ME,DE).call(this),Ix(this,OE,NE).call(this);try{Lx(this,nE,new WebSocket(Ix(this,fE,mE).call(this,Ax(this,sE)))),Ax(this,nE).binaryType="arraybuffer",Ax(this,oE).debug("Connecting");const i=setTimeout(()=>{Ax(this,oE).debug("Connection timeout. Closing socket"),Lx(this,dE,!0),Ix(this,OE,NE).call(this),Ax(this,nE).close(3001,"Connection Timeout"),Ax(this,aE).autoReconnect&&!Ax(this,uE)&&(Ax(this,lE).emit("reconnecting"),Ix(this,PE,CE).call(this)),t(new Error("Connection timed out!"))},Ax(this,aE).connectionTimeout);Ax(this,nE).onopen=()=>{Ax(this,oE).debug("Ready State: ".concat(rE[Ax(this,nE).readyState])),i&&clearTimeout(i),Ix(this,LE,IE).call(this),Lx(this,hE,{code:void 0,reason:void 0}),Ax(this,lE).emit("connected"),Ax(this,aE).flushOnReconnect&&this.flush(),e()},Ax(this,nE).onclose=e=>{try{i&&clearTimeout(i);const{code:r,reason:n}=e;t(n),Ax(this,oE).debug("Socket closed. Close event:",{event:e}),Ax(this,oE).debug("Connection closed code: ".concat(r)),Ax(this,oE).debug("Connection closed reason: ".concat(n)),Ax(this,uE)||Ix(this,xE,EE).call(this,r,n)}catch(r){Ix(this,vE,bE).call(this,r)}},Ax(this,nE).onerror=e=>{Ix(this,vE,bE).call(this,e)},Ax(this,nE).onmessage=e=>Ix(this,kE,yE).call(this,e)}catch(d){Ix(this,vE,bE).call(this,d,t)}}):void 0;Ax(this,oE).debug("Websocket was already connecting or connected.")})}send(e,t,i,r){const n={event:e,id:t,payload:i,metadata:r};if(Ax(this,aE).queueOnDisconnect&&(!Ax(this,nE)||1!==Ax(this,nE).readyState))return Ax(this,oE).debug("Queuing message since socket is not connected!",n),Ax(this,cE).push(n),!1;const s=Yx.encode(n);return Ix(this,AE,RE).call(this,s)}emit(e,t,i,r){return this.send(e,t,i,r)}sendRaw(e){return Ix(this,AE,RE).call(this,e)}receive(e,t){return Ax(this,lE).on(e.toString(),t)}on(e,t){"string"!=typeof e||"connected"!==e&&"disconnected"!==e&&"errored"!==e&&"reconnected"!==e&&"reconnecting"!==e&&"reconnectAttempt"!==e&&"reconnectFailure"!==e&&"failed"!==e?this.receive(e,t):Ax(this,lE).on(e,t)}removeAllListeners(){Ax(this,lE).removeAllListeners()}removeReceiver(e,t){this.removeListener(e,t)}removeListener(e,t){Ax(this,lE).removeListener(e.toString(),t)}removeReceivers(e){this.removeListeners(e)}removeListeners(e){Ax(this,lE).listeners(e.toString()).map(t=>this.removeListener(e,t))}disconnect(){Lx(this,dE,!1),Ix(this,ME,DE).call(this),this.removeAllListeners(),Lx(this,hE,{code:1e3,reason:"Sockrates disconnect method called"}),Ax(this,nE).close(1e3,"Sockrates disconnect method called.")}}nE=new WeakMap,sE=new WeakMap,aE=new WeakMap,oE=new WeakMap,cE=new WeakMap,lE=new WeakMap,dE=new WeakMap,hE=new WeakMap,uE=new WeakMap,pE=new WeakMap,gE=new WeakMap,fE=new WeakSet,mE=function(e){if(e.startsWith("ws://")||e.startsWith("wss://"))return e;if(e.startsWith("https://"))return"wss://".concat(e.substring(8));if(e.startsWith("http://"))return"ws://".concat(e.substring(7));throw new Error("Invalid URL. URL must start with http(s):// or ws(s)://.")},vE=new WeakSet,bE=function(e,t){Ax(this,oE).error("Error:",{error:e}),Ax(this,lE).emit("errored",{error:e}),null==t||t(e)},kE=new WeakSet,yE=function(e){if(Ix(this,LE,IE).call(this),"2"===e.data)return Ax(this,oE).debug("Received ping from server"),void Ix(this,AE,RE).call(this,"3");const t=Yx.decode(e.data),{id:i,payload:r}=t;Ax(this,oE).debug("Received message",{event:t.event,messageID:i}),Ax(this,lE).emit(t.event.toString(),{id:i,payload:r})},wE=new WeakSet,SE=function(){return 1===Ax(this,nE).readyState},xE=new WeakSet,EE=function(e,t){Lx(this,hE,{reason:t,code:e}),Ax(this,lE).emit("disconnected",{code:e,reason:t})},TE=new WeakSet,_E=function(){const{reason:e,code:t}=Ax(this,hE);t&&1e3!==t&&Ax(this,dE)&&Ax(this,aE).autoReconnect&&!Ax(this,uE)&&(Ax(this,oE).debug("Triggering reconnection due to ".concat(e,".")),Ax(this,lE).emit("reconnecting"),Ix(this,PE,CE).call(this))},PE=new WeakSet,CE=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Be(this,null,function*(){if(e&&Ax(this,uE))Ax(this,oE).debug("Reconnect called when already in a reconnect loop. Ignoring.");else{if(Ax(this,uE)||Ax(this,gE).reset(),null!==Ax(this,aE).maxReconnectionAttempts&&Ax(this,gE).getAttempts()>=Ax(this,aE).maxReconnectionAttempts)return Ax(this,lE).emit("failed"),void Lx(this,uE,!1);Lx(this,uE,!0),Ix(this,OE,NE).call(this),Ix(this,ME,DE).call(this);try{if(yield Ax(this,gE).wait(),!1===Ax(this,dE))return;if(Ax(this,oE).debug("Reconnection attempt ".concat(Ax(this,gE).getAttempts())),Ax(this,lE).emit("reconnectAttempt",{attempt:Ax(this,gE).getAttempts()}),yield this.connect(),!Ix(this,wE,SE).call(this))throw Error("Reconnect Failed");Lx(this,uE,!1),Lx(this,hE,{code:void 0,reason:void 0}),Ax(this,lE).emit("reconnected")}catch(t){Ax(this,oE).debug("Failed to reconnect."),Ax(this,lE).emit("reconnectFailure",{attempt:Ax(this,gE).getAttempts()}),Ix(this,PE,CE).call(this,!1)}}})},AE=new WeakSet,RE=function(e){try{return Ax(this,nE).send(e),!0}catch(t){return Ax(this,oE).error(t.message),!1}},LE=new WeakSet,IE=function(){this.config.disconnectOnPingTimeout&&(Ax(this,oE).debug("Resetting ping timeout"),Ix(this,ME,DE).call(this),Lx(this,pE,setTimeout(()=>{var e;Ax(this,oE).debug("Disconnecting the socket due to ping timeout"),Lx(this,dE,!0);const t="Ping timeout";null==(e=Ax(this,nE))||e.close(3002,t),Ix(this,xE,EE).call(this,3002,t)},Ax(this,aE).pingTimeout)))},ME=new WeakSet,DE=function(){Ax(this,pE)&&(clearTimeout(Ax(this,pE)),Lx(this,pE,void 0))},OE=new WeakSet,NE=function(){Ax(this,nE)&&(Ax(this,nE).onopen=void 0,Ax(this,nE).onerror=void 0,Ax(this,nE).onmessage=void 0,Ax(this,nE).onclose=void 0)};var FE=Object.defineProperty,jE=Object.getOwnPropertyDescriptor,BE=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?jE(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&FE(t,i,s),s};var VE,zE,HE,$E,GE,WE,qE,KE,ZE,YE,JE;const QE=(JE=class{constructor(e,t){let{peerId:i,meetingId:r,authToken:n,capabilities:s}=t;var a;if(Ue(this,HE),Ue(this,qE),Ue(this,ZE),Ue(this,VE,void 0),Ue(this,zE,void 0),De(this,"roomName"),De(this,"authToken"),De(this,"capabilities"),Ue(this,GE,void 0),Ue(this,WE,void 0),!i||!r||!n)throw new Uo("peerId, meetingId, or authToken can not be empty","0404");Fe(this,GE,void 0),Fe(this,WE,e),this.capabilities=s,this.roomName=r,this.authToken=n,Fe(this,VE,je(this,qE,KE).call(this,i)),Fe(this,zE,new UE(Ne(this,VE),{autoReconnect:!0,disconnectOnPingTimeout:null!=(a=s.includes("PING"))&&a,queueOnDisconnect:!0,flushOnReconnect:!1,logger:this.logger})),this.handleSocketConnectionEvents()}get joinAttempted(){return Ne(this,HE,$E).socketJoinAttempted}set joinAttempted(e){Ne(this,HE,$E).socketJoinAttempted=e}get telemetry(){return Ne(this,WE).getValue("telemetry")}get logger(){return Ne(this,WE).getValue("logger")}get peerId(){return Ne(this,WE).getValue("peerId")}updateURL(e){e!==this.peerId&&(Fe(this,VE,je(this,qE,KE).call(this,e)),this.logger.debug("SocketService:: Connection URL updated.")),Ne(this,zE).updateURL(Ne(this,VE))}static getSocketEdgeDomain(e){return _o({servicePrefix:"socket-edge",baseURI:e})}get url(){return Ne(this,VE)}connect(){return Be(this,null,function*(){Ne(this,HE,$E).socketJoinAttempted=!0,yield Ne(this,zE).connect(),Ne(this,HE,$E).socketJoinAttempted=!0,Ne(this,HE,$E).socketState={state:"connected",reconnected:!1,reconnectionAttempt:void 0}})}disconnect(){Ne(this,HE,$E).socketJoinAttempted=!1,Ne(this,zE).disconnect(),Ne(this,HE,$E).socketJoinAttempted=!0,Ne(this,HE,$E).socketState={state:"disconnected",reconnected:!1,reconnectionAttempt:void 0}}get isConnected(){try{return 1===Ne(this,zE).readyState}catch(ht){return!1}}sendMessage(e,t,i){const r={};return Ne(this,WE).getValue("telemetry").injectContext(r),Ne(this,zE).send(e,null!=i?i:je(this,ZE,YE).call(this),t,(new TextEncoder).encode(JSON.stringify(r)))}sendMessagePromise(e,t,i,r){const n=parseInt({}.SOCKET_SERVICE_MESSAGE_REQUEST_TIMEOUT,10)||2e4;return this.sendMessagePromiseWithTimeout({event:e,timeout:n,protobuf:t,messageId:i,resp:r})}sendMessagePromiseWithTimeout(e){let{event:t,timeout:i,protobuf:r,messageId:n,resp:s}=e;const a=null!=s?s:t;return new Promise((e,s)=>{const o=(e,t)=>{Ne(this,zE).removeListener(a,e),Ne(this,zE).removeListener(65535,t),Ne(this,zE).removeListener(Fh.errorResponse,t),Ne(this,zE).removeListener(jh.errorResponse,t)},c=null!=n?n:je(this,ZE,YE).call(this),l={};Ne(this,WE).getValue("telemetry").injectContext(l);const d=e=>{let{id:t,payload:i}=e;if(c===t){let e;try{const t=Gc.fromBinary(i);e=new Error(t.errorMessage)}catch(r){e=new Error("failed to parse error message",{cause:r});try{const t=gl.fromBinary(i);e=new Error(t.message)}catch(n){e=new Error("failed to parse error message",{cause:n})}}s(e),o(h,d)}},h=t=>{let{id:i,payload:r}=t;c===i&&(e({id:i,payload:r}),o(h,d))};Ne(this,zE).on(a,h),Ne(this,zE).on(65535,d),Ne(this,zE).on(Fh.errorResponse,d),Ne(this,zE).on(jh.errorResponse,d),setTimeout(()=>{o(h,d),s(new Error("request timeout for callback eventId:".concat(t)))},i),Ne(this,zE).send(t,c,r,(new TextEncoder).encode(JSON.stringify(l)))})}on(e,t){Ne(this,zE).on(e,t)}onStateEvent(e,t){Ne(this,zE).on(e,t)}removeListener(e,t){Ne(this,zE).removeListener(e,t)}removeListeners(e){Ne(this,zE).removeListeners(e)}flush(){return Ne(this,zE).flush()}handleSocketConnectionEvents(){this.onStateEvent("connected",()=>Be(this,null,function*(){this.logger.info("SocketService::Connected to socket-edge"),Ne(this,GE)&&(clearTimeout(Ne(this,GE)),Fe(this,GE,void 0)),Ne(this,HE,$E).updateSocketConnectionState("connected")})),this.onStateEvent("disconnected",e=>{let{code:t,reason:i}=e;var r;this.logger.info("SocketService::Disconnected from socket-edge",{error:{code:t,reason:i},country:Mo.location.country});const{recv:n,send:s}=null!=(r=Ne(this,HE,$E).mediaState)?r:{};null!=n&&n.state&&(null==n?void 0:n.state)!==Sk.CONNECTED||null!=s&&s.state&&(null==s?void 0:s.state)!==Sk.CONNECTED?Ne(this,WE).getValue("peerSessionStore").emit(Vo.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:Ne(this,HE,$E).joinAttempted}):Fe(this,GE,setTimeout(()=>{Ne(this,WE).getValue("peerSessionStore").emit(Vo.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:Ne(this,HE,$E).joinAttempted}),Fe(this,GE,void 0)},3e3)),Ne(this,HE,$E).updateSocketConnectionState("disconnected")}),this.onStateEvent("reconnecting",()=>Be(this,null,function*(){this.logger.info("SocketService::Reconnecting to socket-edge",{country:Mo.location.country}),Ne(this,HE,$E).updateSocketConnectionState("reconnecting")})),this.onStateEvent("reconnectAttempt",e=>Be(this,[e],function(e){var t=this;let{attempt:i}=e;return function*(){t.logger.info("SocketService::Attempting to reconnect to socket-edge",{socket:{retryAttempt:i}}),Ne(t,HE,$E).updateSocketConnectionState("reconnectAttempt",i)}()})),this.onStateEvent("reconnectFailure",e=>{let{attempt:t}=e;this.logger.info("SocketService::Reconnect attempt to socket-edge failed",{socket:{retryAttempt:t}}),Ne(this,HE,$E).updateSocketConnectionState("reconnectFailure",t)}),this.onStateEvent("reconnected",()=>Be(this,null,function*(){this.logger.info("SocketService::Reconnected to socket-edge",{connectionState:{joinAttempted:Ne(this,HE,$E).mediaJoinAttempted}}),Ne(this,GE)&&(clearTimeout(Ne(this,GE)),Fe(this,GE,void 0)),Ne(this,WE).getValue("peerSessionStore").emit(Vo.SOCKET_SERVICE_RECONNECTED,{wasJoinAttempted:Ne(this,HE,$E).mediaJoinAttempted}),Ne(this,HE,$E).updateSocketConnectionState("reconnected")})),this.onStateEvent("failed",()=>Be(this,null,function*(){this.logger.info("SocketService::Failed to connect to socket-edge",{country:Mo.location.country}),Ne(this,WE).getValue("peerSessionStore").emit(Vo.SOCKET_SERVICE_FAILED),Ne(this,HE,$E).updateSocketConnectionState("failed")}))}},VE=new WeakMap,zE=new WeakMap,HE=new WeakSet,$E=function(){return Ne(this,WE).getValue("connectionHandler")},GE=new WeakMap,WE=new WeakMap,qE=new WeakSet,KE=function(e){let t=QE.getSocketEdgeDomain(Ne(this,WE).getValue("baseURI"));"string"==typeof To(Ne(this,WE),"socket_server_base")&&(t=To(Ne(this,WE),"socket_server_base"));const i="wss://".concat(t),r=new URL("".concat(i,"/ws")),n=this.peerId,s=Ie(Le({roomID:this.roomName,peerID:e,authToken:this.authToken,useMediaV2:!0},n!==e&&{oldPeerID:n}),{ping:this.capabilities.includes("PING"),capabilities:this.capabilities.map(e=>kl[e]).join(" "),joinWithDetails:!0,useCfWorker:!0,useStartSession:!0});return Object.entries(s).forEach(e=>{let[t,i]=e;r.searchParams.append(t,i.toString())}),r.href},ZE=new WeakSet,YE=function(){return"".concat(this.peerId,"-").concat((Math.random()+1).toString(36).substring(7))},JE);let XE=QE;BE([Mo.trace("SocketService.connect")],XE.prototype,"connect",1),BE([Mo.trace("SocketService.disconnect")],XE.prototype,"disconnect",1),BE([Mo.trace("SocketService.sendMessagePromise")],XE.prototype,"sendMessagePromise",1),BE([Mo.trace("SocketService.sendMessagePromiseWithTimeout")],XE.prototype,"sendMessagePromiseWithTimeout",1);class eT{constructor(e){De(this,"socketService"),this.socketService=e}handleConnectedRoomsDumpRaw(e){let{payload:t}=e;var i;const r=Nl.fromBinary(t),n=r.meetings.map(e=>{var t;return{id:e.id,title:e.title,participants:null!=(t=e.participants)?t:[]}});return{parentMeeting:{id:r.parentMeeting.id,title:r.parentMeeting.title,participants:null!=(i=r.parentMeeting.participants)?i:[]},meetings:n}}handleTransferPeerRaw(e){let{payload:t}=e;const i=Zl.fromBinary(t);return{authToken:i.authToken,meetingId:i.meetingId}}handleMovedPeerRaw(e){let{payload:t}=e;const i=Kl.fromBinary(t);return{meetingId:i.meetingId,customParticipantId:i.customParticipantId}}handleConnectedRoomsUpdatedRaw(e){let{payload:t}=e;return Bl.fromBinary(t).payloads.map(e=>({id:e.id,title:e.title}))}handleConnectedRoomsDeletedRaw(e){let{payload:t}=e;return $l.fromBinary(t).payloads}getConnectedRoomsDump(){return Be(this,null,function*(){const e=yield this.socketService.sendMessagePromise(Mh.getConnectedRoomsDump);return this.handleConnectedRoomsDumpRaw(e)})}createConnectedRooms(e){return Be(this,null,function*(){const{payload:t}=yield this.socketService.sendMessagePromise(Mh.createConnectedRooms,Fl.toBinary({payloads:e}));return Bl.fromBinary(t).payloads.map(e=>({id:e.id,title:e.title}))})}updateConnectedRooms(e){return Be(this,null,function*(){})}disableConnectedRooms(e){return Be(this,null,function*(){const t=e.map(e=>({id:e})),i=yield this.socketService.sendMessagePromise(Mh.deleteConnectedRooms,Hl.toBinary({payloads:t}));return this.handleConnectedRoomsDeletedRaw(i)})}movePeersBetweenRooms(e){return Be(this,null,function*(){try{const t=yield this.socketService.sendMessagePromise(Mh.movePeers,ql.toBinary({sourceMeetingId:e.sourceMeetingId,destinationMeetingId:e.destinationMeetingId,participants:e.participants}));return(new TextDecoder).decode(t.payload).includes("error")?{success:!1,error:"failed to move participants"}:{success:!0}}catch(t){return{success:!1,error:t}}})}}var tT,iT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor;class nT extends Ho{constructor(e){super(e.getValue("logger")),De(this,"meetings",[]),De(this,"parentMeeting",null),Ue(this,tT,void 0),Fe(this,tT,e)}get supportsConnectedMeetings(){return""!==Ne(this,tT).getValue("self").id}get isActive(){return 0!==this.meetings.length}validateConnectedMeetingsAction(){if(!this.supportsConnectedMeetings)throw new Error("You are not allowed to perform this action.\n\t\t\t\t\t\tPlease connect with our support team to enable connected meetings.")}getConnectedMeetings(){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Getting connected meetings dump");const e=yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").getConnectedRoomsDump();return this.logger.info("Got connected meetings dump"),e})}createMeetings(e){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Creating connected meetings ".concat(JSON.stringify(e)));const t=yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").createConnectedRooms(e);return this.logger.info("Created connected meetings ".concat(JSON.stringify(t))),t.map(e=>({id:e.id,title:e.title}))})}updateMeetings(e){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Updating connected meetings ".concat(JSON.stringify(e))),yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").updateConnectedRooms(e.map(e=>({meetingId:e.id,title:e.title}))),this.logger.info("Updated connected meetings ".concat(JSON.stringify(e)))})}deleteMeetings(e){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Moving participants before deleting connected meetings ".concat(JSON.stringify(e)));const t=this.meetings.map(t=>e.includes(t.id)&&0!==t.participants.length?this.moveParticipants(t.id,this.parentMeeting.id,t.participants.map(e=>e.id)):Promise.resolve());this.logger.info("Moved participants before deleting connected meetings ".concat(JSON.stringify(e),". Deleting now.")),yield Promise.all(t);const i=yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").disableConnectedRooms(e);return this.logger.info("Deleted connected meetings ".concat(JSON.stringify(e))),i})}moveParticipants(e,t,i){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Moving connected meetings participants ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t));const r=yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:t,participants:i.map(e=>({id:e}))});return r.success?(this.logger.info("Moved connected meetings participants ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t)),this.moveSuccessHandler(e,t,i)):this.logger.error("Failed to move connected meetings participants ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t)),r})}moveParticipantsWithCustomPreset(e,t,i){return Be(this,null,function*(){this.validateConnectedMeetingsAction(),this.logger.info("Moving connected meetings participants (custom preset) ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t));const r=yield Ne(this,tT).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:t,participants:i});return r.success?(this.logger.info("Moved connected meetings participants (custom preset) ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t)),this.moveSuccessHandler(e,t,i.map(e=>e.id))):this.logger.error("Failed to move connected meetings participants (custom preset) ".concat(JSON.stringify(i)," from ").concat(e," to ").concat(t)),r})}moveSuccessHandler(e,t,i){const r=new Map;[...this.parentMeeting.participants,...this.meetings.flatMap(e=>e.participants)].forEach(e=>r.set(e.id,e)),t===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.concat(i.map(e=>r.get(e)))),e===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.filter(e=>!i.includes(e.id))),this.meetings=this.meetings.map(n=>{if(t===n.id){const e=n.participants.concat(i.map(e=>r.get(e)));return Ie(Le({},n),{participants:e})}if(e===n.id){const e=n.participants.filter(e=>!i.includes(e.id));return Ie(Le({},n),{participants:e})}return n})}}tT=new WeakMap,((e,t,i,r)=>{for(var n,s=r>1?void 0:r?rT(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);r&&s&&iT(t,i,s)})([vu({maxInvocations:60,period:60})],nT.prototype,"getConnectedMeetings",1);var sT,aT,oT=Object.defineProperty,cT=Object.getOwnPropertyDescriptor,lT=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?cT(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&oT(t,i,s),s};const dT=(aT=class{constructor(e){De(this,"connectedMeetings"),Ue(this,sT,void 0),Fe(this,sT,e),this.connectedMeetings=new nT(e)}get telemetry(){return Ne(this,sT).getValue("telemetry")}get logger(){return Ne(this,sT).getValue("logger")}static init(e){const t=new dT(e);return t.connectedMeetings.supportsConnectedMeetings&&(t.setupEvents(),e.getValue("self").once("roomJoined",()=>t.getConnectedMeetings())),t}getConnectedMeetings(){this.connectedMeetings.getConnectedMeetings()}setupEvents(){Ne(this,sT).getValue("connectedMeetingsSocketHandler").socketService.on(Mh.getConnectedRoomsDump,this.handleConnectedRoomsDump.bind(this)),Ne(this,sT).getValue("connectedMeetingsSocketHandler").socketService.on(Mh.transferPeer,this.handleTransferPeer.bind(this)),Ne(this,sT).getValue("connectedMeetingsSocketHandler").socketService.on(Mh.movedPeer,this.handleMovedPeer.bind(this)),Ne(this,sT).getValue("connectedMeetingsSocketHandler").socketService.on(Mh.connectedRoomsUpdated,this.handleConnectedRoomsUpdated.bind(this)),Ne(this,sT).getValue("connectedMeetingsSocketHandler").socketService.on(Mh.connectedRoomsDeleted,this.handleConnectedRoomsDeleted.bind(this))}handleTransferPeer(e){this.logger.info("Received backend request to switch connected meetings");const t=Ne(this,sT).getValue("connectedMeetingsSocketHandler").handleTransferPeerRaw(e);return this.logger.info("Honoring request to switch connected meetings. Going to ".concat(null==t?void 0:t.meetingId)),this.switchMeeting(t)}switchMeeting(e){return Be(this,arguments,function(e){var t=this;let{authToken:i,meetingId:r}=e;return function*(){var e,n,s,a;if(!t.connectedMeetings.supportsConnectedMeetings)throw new Error("You are not allowed to perform this action.\n\t\t\t\t\t\t\t\tPlease connect with our support team to enable connected meetings.");t.logger.info("ConnectedMeetingsController::switchMeeting:: asking ui-kit to show switching breakout UI"),t.connectedMeetings.emit("changingMeeting",r);const o={video:Ne(t,sT).getValue("self").videoEnabled,audio:Ne(t,sT).getValue("self").audioEnabled};try{Ne(t,sT).getValue("self").cleanupEvents(),yield Ne(t,sT).getValue("meeting").leave("connected-meeting")}catch(l){t.logger.error("ConnectedMeetingsController:: switchMeeting:: issues in leaving previous meeting. Meeting Id: ".concat(null==(n=null==(e=Ne(t,sT).getValue("meeting"))?void 0:e.meta)?void 0:n.meetingId),{error:l})}t.logger.info("ConnectedMeetingsController::switchMeeting:: initializing new meeting. Meeting Id: ".concat(r));const c=yield DT.init(Ie(Le({},Ne(t,sT).getValue("options")),{cachedUserDetails:null,defaults:Ie(Le(Le({},Ne(t,sT).getValue("options").defaults),o),{mediaHandler:Ne(t,sT).getValue("self")}),authToken:i}));t.logger.info("ConnectedMeetingsController::switchMeeting:: initialized new meeting. Meeting Id: ".concat(null==(s=null==c?void 0:c.meta)?void 0:s.meetingId));try{const{hidden:e}=Ne(t,sT).getValue("self");c.self.setName(Ne(t,sT).getValue("self").name),yield c.join(),e&&c.self.hide()}catch(l){t.logger.error("ConnectedMeetingsController.joinRoom",{error:l})}return t.logger.info("ConnectedMeetingsController::switchMeeting:: asking ui-kit to show in-meeting ui of newly joined meeting id: ".concat(null==(a=null==c?void 0:c.meta)?void 0:a.meetingId)),t.connectedMeetings.emit("meetingChanged",c),c}()})}handleConnectedRoomsDump(e){const t=Ne(this,sT).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDumpRaw(e);this.connectedMeetings.meetings=t.meetings.map(e=>({id:e.id,title:e.title,participants:e.participants||[]})),this.connectedMeetings.parentMeeting={id:t.parentMeeting.id,title:t.parentMeeting.title,participants:t.parentMeeting.participants},this.emitStateUpdate()}handleMovedPeer(e){return Ne(this,sT).getValue("connectedMeetingsSocketHandler").handleMovedPeerRaw(e)}handleConnectedRoomsUpdated(e){const t=Ne(this,sT).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsUpdatedRaw(e),i=new Map;this.connectedMeetings.meetings.forEach(e=>{i.set(e.id,e)}),t.forEach(e=>{i.has(e.id)?i.get(e.id).title=e.title:i.set(e.id,Ie(Le({},e),{participants:[]}))}),this.connectedMeetings.meetings=Array.from(i.values()),this.emitStateUpdate()}handleConnectedRoomsDeleted(e){const t=Ne(this,sT).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDeletedRaw(e).map(e=>e.id);this.connectedMeetings.meetings=this.connectedMeetings.meetings.filter(e=>!t.includes(e.id)),this.emitStateUpdate()}emitStateUpdate(){this.connectedMeetings.emit("stateUpdate",{meetings:this.connectedMeetings.meetings,parentMeeting:this.connectedMeetings.parentMeeting})}},sT=new WeakMap,aT);let hT=dT;lT([Mo.trace("ConnectedMeetingsController.getConnectedMeetings")],hT.prototype,"getConnectedMeetings",1),lT([Mo.trace("ConnectedMeetingsController.setupEvents")],hT.prototype,"setupEvents",1),lT([Mo.trace("ConnectedMeetingsController.switchMeeting")],hT.prototype,"switchMeeting",1);var uT=Object.defineProperty,pT=Object.getOwnPropertyDescriptor,gT=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?pT(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&uT(t,i,s),s};const fT=class{constructor(e,t,i){De(this,"apiBase"),De(this,"selfController"),De(this,"pollController"),De(this,"chatController"),De(this,"metaController"),De(this,"storesManager"),De(this,"stageController"),De(this,"pluginController"),De(this,"internalsController"),De(this,"recordingController"),De(this,"livestreamController"),De(this,"participantController"),De(this,"connectedMeetingsController"),De(this,"telemetry"),De(this,"logger"),this.apiBase=e,this.storesManager=t.storesManager,this.metaController=t.metaController,this.selfController=t.selfController,this.chatController=t.chatController,this.pollController=t.pollController,this.stageController=t.stageController,this.pluginController=t.pluginController,this.recordingController=t.recordingController,this.internalsController=t.internalsController,this.participantController=t.participantController,this.livestreamController=t.livestreamController,this.connectedMeetingsController=t.connectedMeetingsController,this.telemetry=i.getValue("telemetry"),this.logger=i.getValue("logger")}static init(e){return Be(this,null,function*(){var t,i;const{peerId:r,apiBase:n,authToken:s,meetingId:a,organizationId:o,cachedUserDetails:c,logger:l}=e.getAllValues();if(qS(e),!1===it.isSupported())throw new Uo("Browser not supported","0010",l,!0);const d=function(e,t){return gu=new pu(e,t),gu}(e,{authToken:s,baseURL:n,cachedUserDetails:c});d.setRoomName(a),d.setRoomUUID(a),d.setOrganizationId(o),d.setHeader("tracing-id",r),e.setValue("apiClient",d);const h=new zg(e);e.setValue("connectionHandler",h);const u=fT.createSocketService(e),p=u.connect(),g=d.getUserDetails(),f=d.getPlugins();let m,v="";try{yield fT.setupFlagsmith(e)}catch(S){l.error("Failed to setup flagsmith",{error:S})}try{yield p}catch(S){l.error("[Controller]: Failed to connect to socket server:",{error:S})}try{({meetingTitle:v}=yield d.getRoomNodeData()),m=yield g,l.info("CF SFU is being used."),e.setValue("presetName",m.preset.name)}catch(S){l.error("Failed to get room metadata",{error:S})}const b=xm.init(m.preset,!e.getValue("modules").theme),k=gb.init(e,b.viewType,m.preset.permissions),y=fT.setupControllers(u,e,m,f,v,b,k);(function(e){return!("LIVESTREAM"===e.viewType||"CHAT"===e.viewType)})(b)&&(null==(t=fT.createRoomNodeClient(e,u).initializeConnection(m.participant.name,a,!1,k))||t.catch(e=>{l.error("[Controller]: Failed to queue partial media room promise:",{error:e})})),Mo.location.country=null==(i=d.ipInfo)?void 0:i.country;const{controllers:w}=yield y;return function(){it.isElectron()&&window.electronGetDisplayMediaSource&&(navigator.mediaDevices.getDisplayMedia=()=>Be(this,null,function*(){const e=yield window.electronGetDisplayMediaSource({types:["window","screen"]});let t=[];if(e&&(t=Array.isArray(e)?e:[e]),null==t||!t.length)throw new Error("Couldn't find any media source for screen share.");let i=t.find(e=>{var t;return null==(t=e.id)?void 0:t.includes("screen")});i=null!=i?i:t[0];const r={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i.id}}};return yield navigator.mediaDevices.getUserMedia(r)}))}(),new fT(n,w,e)})}static setupFlagsmith(e){return Be(this,null,function*(){var t;const{peerId:i,baseURI:r,overrides:n,meetingId:s,organizationId:a,logger:o}=e.getAllValues(),c=function(e){let t,i,r=0;if(!e)return r;for(t=0;tBe(this,null,function*(){this.logger=e;try{"getBattery"in navigator&&(this.battery=yield navigator.getBattery(),this.battery.addEventListener("chargingchange",this.updateChargeInfo),this.battery.addEventListener("levelchange",this.updateLevelInfo),this.updateLevelInfo(),this.updateChargeInfo())}catch(t){e.error("Error getting battery",t)}})),De(this,"updateChargeInfo",()=>{var e;this.logger.log("Battery charging? ".concat(null!=(e=this.battery)&&e.charging?"Yes":"No"))}),De(this,"updateLevelInfo",()=>{this.battery?this.logger.log("Battery level: ".concat(100*this.battery.level,"%")):this.logger.log("Battery level: Not known")}),De(this,"cleanup",()=>{var e,t;"getBattery"in navigator&&(null==(e=this.battery)||e.removeEventListener("chargingchange",this.updateChargeInfo),null==(t=this.battery)||t.removeEventListener("levelchange",this.updateLevelInfo))})}};var bT,kT,yT,wT,ST,xT,ET;class TT{constructor(){Ue(this,ST),Ue(this,bT,new Audio),Ue(this,kT,new MediaStream),Ue(this,yT,new Map),Ue(this,wT,void 0),Ne(this,bT).srcObject=Ne(this,kT),Ne(this,bT).autoplay=!0}playTracks(e){return Be(this,null,function*(){return e.forEach(e=>{Ne(this,yT).has(e.id)||(Ne(this,kT).addTrack(e),Ne(this,yT).set(e.id,e))}),this.play()})}setSpeakerDevice(e){"function"==typeof HTMLAudioElement.prototype.setSinkId&&Ne(this,bT).setSinkId(e)}removeTrack(e){const t=Ne(this,yT).get(e);t&&(Ne(this,kT).removeTrack(t),Ne(this,yT).delete(e))}play(){return Be(this,null,function*(){return Ne(this,bT).srcObject=Ne(this,kT),Ne(this,bT).play().catch(e=>{je(this,ST,xT).call(this,e)})})}onError(e){Fe(this,wT,e)}}bT=new WeakMap,kT=new WeakMap,yT=new WeakMap,wT=new WeakMap,ST=new WeakSet,xT=function(e){var t;null==(t=Ne(this,wT))||t.call(this,e)};class _T extends TT{constructor(){super(),Ue(this,ET,void 0),Fe(this,ET,new Map)}addParticipantTrack(e,t){Ne(this,ET).set(e,t.id),this.playTracks([t])}removeParticipantTrack(e){const t=Ne(this,ET).get(e);t&&this.removeTrack(t),Ne(this,ET).delete(e)}}ET=new WeakMap;var PT,CT,AT,RT=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,IT=(e,t,i,r)=>{for(var n,s=r>1?void 0:r?LT(t,i):t,a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r?n(t,i,s):n(s))||s);return r&&s&&RT(t,i,s),s};let MT=(AT=class{constructor(e,t){Ue(this,PT,void 0),Ue(this,CT,void 0),Fe(this,CT,e),Fe(this,PT,t)}get peerId(){return Ne(this,CT).getValue("peerId")}static initMedia(){return Be(this,arguments,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return function*(){var r;const n=null!=(r=null==i?void 0:i.peerId)?r:u(),s=Do.createContext(n,{peerId:n}),a=s.getValue("logger");a.init(s);const o=new mb(s,a);return yield o.init(e,t,s),s.setValue("defaults",{mediaHandler:o}),o}()})}static init(e){return Be(this,null,function*(){var t,i,r,n,s,a,o;it.init();const{mediaHandler:c}=null!=(t=e.defaults)?t:{},l=(null==c?void 0:c.peerId)||(null!=(r=null==(i=null==e?void 0:e.cachedUserDetails)?void 0:i.peerId)?r:u()),{authToken:d,baseURI:h}=e,p=function(e,t){e.startsWith("eyJ")||console.error("Invalid auth token provided. Ensure you are passing a %cparticipant `authToken`%c \u2014 not an Org API Key or an incorrectly formatted token.\nYou get the participant token from the Add Participant API: https://docs.realtime.cloudflare.com/api#/operations/add_participant","font-weight: bold","font-weight: normal");try{const{meetingId:i,orgId:r,participantId:n}=JSON.parse(atob(e.split(".")[1]));if(!i)throw Error("Received V1 auth token ".concat(e));let s=Ao.baseURI.prod;return t&&(s=t),{meetingId:i,orgId:r,participantId:n,baseURI:s,apiBase:"https://".concat(_o({servicePrefix:"api",baseURI:s}))}}catch(c){throw new Uo("Invalid auth token","0004")}}(d,h),{meetingId:g}=p,f=Me(p,["meetingId"]);window.__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION=!0;const m=MT.setupContext(l,e,g,f),v=m.getValue("telemetry"),b=m.getValue("logger");(e=>{!navigator.isReactNative&&"undefined"!=typeof window&&(window.addEventListener("error",t=>{var i;(null==(i=t.filename)||!i.includes("localhost"))&&0!==t.lineno&&e.error("window::error",{error:t.error},!0)}),window.addEventListener("unhandledrejection",t=>{var i,r,n,s,a,o,c,l;e.error("window::unhandledrejection",{error:null==t?void 0:t.reason,networkCall:{url:null==(r=null==(i=null==t?void 0:t.reason)?void 0:i.config)?void 0:r.url,baseURL:null==(s=null==(n=null==t?void 0:t.reason)?void 0:n.config)?void 0:s.baseURL,method:null==(o=null==(a=null==t?void 0:t.reason)?void 0:a.config)?void 0:o.method,status:null==(c=null==t?void 0:t.reason)?void 0:c.status,statusText:null==(l=null==t?void 0:t.reason)?void 0:l.statusText}},!0)}),window.addEventListener("offline",()=>{e.info("window::offline")}),window.addEventListener("online",()=>{e.info("window::online")}))})(b),vT.init(b),v.init(m,{roomName:g,userId:f.participantId,organizationId:f.orgId,peerId:l},null==(s=null==(n=e.modules)?void 0:n.tracing)||s),b.init(m),b.info("Client::init::options",{clientInitOptions:Ie(Le({},e),{authToken:"".concat(null==(a=e.authToken)?void 0:a.slice(0,10),"...\n\t\t\t\t").concat(null==(o=e.authToken)?void 0:o.slice(-10))})});const k=yield mT.init(m),y=new MT(m,k);return m.setValue("meeting",y),y})}static setupContext(e,t,i,r){var n,s;const a=Do.createContext(e,t),o=Le(Le({},Eo),null==t?void 0:t.modules),c=t.defaults||{audio:!0,video:!0};return a.setValue("options",t),a.setValue("peerId",e),a.setValue("modules",o),a.setValue("sdkName","web-core"),a.setValue("meetingId",i),a.setValue("apiBase",r.apiBase),a.setValue("baseURI",r.baseURI),a.setValue("userId",r.participantId),a.setValue("organizationId",r.orgId),a.setValue("authToken",t.authToken),a.setValue("overrides",null!=(n=t.overrides)?n:{}),a.setValue("env",function(e){let{baseURI:t}=e;return t.includes("preprod.dyte")||t.includes("preprod.realtime")?Pt.PREPROD:t.includes("devel.dyte")||t.includes("devel.realtime")?Pt.DEVEL:Pt.PROD}({baseURI:r.baseURI})),a.setValue("defaults",c),a.setValue("onError",t.onError||(()=>{})),a.setValue("cachedUserDetails",iu(t.cachedUserDetails)),a.setValue("sdkVersion","1.2.3"),null!=(s=t.modules)&&s.experimentalAudioPlayback&&a.setValue("audioPlayback",new _T),a}join(){return Be(this,null,function*(){const{selfController:e}=Ne(this,PT);return e.self.roomJoined?null:e.joinRoom()})}leave(e){return Be(this,null,function*(){vT.cleanup(),Ne(this,CT).getValue("peerSessionStore").reset();const{selfController:t}=Ne(this,PT);return t.leaveRoom(e)})}get participants(){var e;return null==(e=Ne(this,PT).participantController)?void 0:e.participants}get self(){var e;return null==(e=Ne(this,PT).selfController)?void 0:e.self}get meta(){var e;return null==(e=Ne(this,PT).metaController)?void 0:e.meta}get ai(){var e;return null==(e=Ne(this,PT).metaController)?void 0:e.ai}get plugins(){var e;return null==(e=Ne(this,PT).pluginController)?void 0:e.plugins}get chat(){var e;return null==(e=Ne(this,PT).chatController)?void 0:e.chat}get polls(){var e;return null==(e=Ne(this,PT).pollController)?void 0:e.polls}get connectedMeetings(){var e;return null==(e=Ne(this,PT).connectedMeetingsController)?void 0:e.connectedMeetings}get recording(){var e;return null==(e=Ne(this,PT).recordingController)?void 0:e.recording}get livestream(){var e;return null==(e=Ne(this,PT).livestreamController)?void 0:e.livestream}get stage(){var e;return null==(e=Ne(this,PT).stageController)?void 0:e.stage}get stores(){return Ne(this,PT).storesManager}get audio(){return Ne(this,CT).getValue("audioPlayback")}get __internals__(){var e;return null==(e=Ne(this,PT).internalsController)?void 0:e.internals}joinRoom(){return Be(this,null,function*(){return this.join()})}leaveRoom(e){return Be(this,null,function*(){return this.leave(e)})}},PT=new WeakMap,CT=new WeakMap,AT);IT([Bo("0002"),Rp.executeWithLock({methodName:"meeting.join",lockName:"Client.join",timeout:3e3})],MT.prototype,"join",1),IT([Bo("0003")],MT.prototype,"leave",1),IT([Bo("0001"),Rp.executeWithLock({methodName:"Client.init",lockName:"Client.init",timeout:3e3})],MT,"init",1),MT=IT([Bo("0000")],MT);const DT=MT},45(e,t,i){"use strict";i.d(t,{A:()=>n});var r=i(8587);function n(e,t){if(null==e)return{};var i,n,s=(0,r.A)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;nMe,B:()=>F,C:()=>X,D:()=>Yt,E:()=>s,F:()=>u,G:()=>Ei,H:()=>b,I:()=>v,J:()=>g,K:()=>h,L:()=>d,M:()=>ki,N:()=>a,O:()=>Ai,P:()=>Ri,Q:()=>V,R:()=>k,S:()=>pt,T:()=>n,U:()=>ai,V:()=>o,W:()=>l,X:()=>Si,Y:()=>wi,b:()=>Ci,c:()=>ci,e:()=>mi,h:()=>fi,i:()=>me,j:()=>Q,k:()=>Te,l:()=>be,m:()=>ye,n:()=>Y,o:()=>Z,p:()=>ut,q:()=>ke,r:()=>xe,s:()=>et,t:()=>J,u:()=>_i,v:()=>Ue,w:()=>Ge,x:()=>fe,y:()=>bt,z:()=>Kt});var r=i(6547);e=i.hmd(e);const n=e=>!!a(e)&&("LIVESTREAM"===e.meta.viewType&&"ON_STAGE"!==e.stage.status),s=e=>{var t;return!!a(e)&&("LIVESTREAM"===e.meta.viewType&&(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.canLivestream))},a=e=>null===e||void 0===e?void 0:e.livestream;var o,c;function l(e){let{meeting:t,hlsLevels:i}=e,r=t.self.config.livestreamViewerQualities||[];if(!r.length)return{autoLevelChangeAllowed:!0,levels:i};const n=i.filter(e=>r.includes(e.height));return n.length?{autoLevelChangeAllowed:!1,levels:n}:{autoLevelChangeAllowed:!0,levels:i}}!function(e){e.BUFFERING="Buffering",e.ENDED="Ended",e.IDLE="Idle",e.PAUSED="Paused",e.PLAYING="Playing",e.READY="Ready"}(o||(o={})),function(e){e.INITIALIZED="PlayerInitialized",e.QUALITY_CHANGED="PlayerQualityChanged",e.DURATION_CHANGED="PlayerDurationChanged",e.VOLUME_CHANGED="PlayerVolumeChanged",e.MUTED_CHANGED="PlayerMutedChanged",e.PLAYBACK_RATE_CHANGED="PlayerPlaybackRateChanged",e.REBUFFERING="PlayerRebuffering",e.AUDIO_BLOCKED="PlayerAudioBlocked",e.PLAYBACK_BLOCKED="PlayerPlaybackBlocked",e.ERROR="PlayerError",e.RECOVERABLE_ERROR="PlayerRecoverableError",e.ANALYTICS_EVENT="PlayerAnalyticsEvent",e.TIME_UPDATE="PlayerTimeUpdate",e.BUFFER_UPDATE="PlayerBufferUpdate",e.SEEK_COMPLETED="PlayerSeekCompleted",e.SESSION_DATA="PlayerSessionData",e.STATE_CHANGED="PlayerStateChanged",e.WORKER_ERROR="PlayerWorkerError",e.METADATA="PlayerMetadata",e.TEXT_CUE="PlayerTextCue",e.TEXT_METADATA_CUE="PlayerTextMetadataCue",e.AD_CUE="PlayerAdCue",e.STREAM_SOURCE_CUE="PlayerStreamSourceCue",e.NETWORK_UNAVAILABLE="PlayerNetworkUnavailable",e.SEGMENT_DISCONTINUITY="PlayerSegmentDiscontinuity",e.SEGMENT_METADATA="PlayerSegmentMetadata",e.PLAYER_METADATA="PlayerMetadata"}(c||(c={}));const d={PLAY_PARTICIPANT_TILE_VIDEO_ON_PAUSE:"play_participant_tile_video_on_pause",DISABLE_EMOJI_PICKER:"disable_emoji_picker",FEAT_PAGINATED_CHAT:"feat_paginated_chat",LOG_PLAYING_FAILURES:"log_playing_failures",FEAT_CHANNEL_CHAT:"feat_channel_chat",DISABLE_KICKING:"disable_kicking",ADMIN_CANTREMOVE_ADMIN:"admin_cantremove_admin",CANTINVITE_VIEWER:"cantinvite_viewer",PINNED_MESSAGES:"pinned_msgs"},h=e=>{var t;return"CHAT"===(null===e||void 0===e?void 0:e.meta.viewType)||a(e)||(null===(t=null===e||void 0===e?void 0:e.__internals__)||void 0===t?void 0:t.features.hasFeature("feat_paginated_chat"))},u=e=>{var t,i;return(null===(t=null===e||void 0===e?void 0:e.__internals__)||void 0===t?void 0:t.browserSpecs.isFirefox())&&(null===(i=null===e||void 0===e?void 0:e.__internals__)||void 0===i?void 0:i.features.hasFeature("disable_firefox_setting_sink_id"))};let p=0;function g(){p=0}const f="temp-";function m(e){return e.includes(f)}function v(e){var t;return null!==(t=e.customParticipantId)&&void 0!==t?t:e.clientSpecificId}function b(e){const t=new Map;return[e.self,...e.participants.joined.toArray()].map(e=>{t.set(v(e),e.picture)}),[e.connectedMeetings.parentMeeting,...e.connectedMeetings.meetings].flatMap(e=>e.participants).map(e=>({id:e.id,customParticipantId:v(e),displayName:e.displayName,displayPictureUrl:""!==e.displayPictureUrl?e.displayPictureUrl:t.get(v(e))}))}const k=e=>{if(!(e=>e.connectedMeetings.supportsConnectedMeetings)(e))return!1;const t=e.self.permissions.connectedMeetings;return!!t.canAlterConnectedMeetings||!(!t.canSwitchConnectedMeetings&&!t.canSwitchToParentMeeting)&&e.connectedMeetings.isActive};var y,w,S,x,E,T,_,P,C,A,R,L,I,M,D,O=function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i},N=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},U=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n{const r=N(this,P,"f").get(i);r.isParent?e=Object.assign(Object.assign({},r),{participants:N(this,y,"m",D).call(this,i)}):t.push(Object.assign(Object.assign({},r),{participants:N(this,y,"m",D).call(this,i)}))}),{parentMeeting:e,meetings:t}}get allConnectedMeetings(){return this.currentState.meetings.sort((e,t)=>e.title.localeCompare(t.title))}get allParticipants(){return Array.from(N(this,_,"f").values())}get unassignedParticipants(){return N(this,y,"m",D).call(this,N(this,S,"f").parentMeeting.id)}getParticipantsForMeeting(e){return N(this,y,"m",D).call(this,e)}addNewMeeting(){O(this,w,!0,"f");const e={id:"".concat(f).concat(Math.random().toString(36)),title:"Room ".concat(++p),participants:[]},t=U(e,["participants"]);return N(this,y,"m",L).call(this,Object.assign(Object.assign({},t),{isParent:!1})),t}addNewMeetings(e){return Array.from({length:e}).map(()=>this.addNewMeeting())}updateMeetingTitle(e,t){N(this,P,"f").get(e).title=t,m(e)||N(this,C,"f").add(e)}deleteMeeting(e){O(this,w,!0,"f");const t=N(this,P,"f").get(e),i=N(this,y,"m",D).call(this,t.id).map(v);this.assignParticipantsToMeeting(i,N(this,S,"f").parentMeeting.id),N(this,P,"f").delete(t.id),N(this,T,"f").delete(t.id),m(t.id)||N(this,A,"f").add(t.id)}assignParticipantsToMeeting(e,t){return O(this,w,!0,"f"),e.forEach(e=>{const i=N(this,x,"f").get(e);N(this,T,"f").get(i).delete(e),N(this,T,"f").get(t).add(e),N(this,x,"f").set(e,t)}),this.currentState}assignParticipantsRandomly(){const e=function(e,t){const i=e.length,r=Math.ceil(i/t),n=new Array(t);let s=0;for(let a=0;ae.length)}(this.unassignedParticipants,this.allConnectedMeetings.length);return this.allConnectedMeetings.forEach((t,i)=>{const r=e[i];r&&0!==r.length&&this.assignParticipantsToMeeting(r.map(e=>e.customParticipantId),t.id)}),this.currentState}unassignParticipants(e){const t=N(this,S,"f").parentMeeting.id;return this.assignParticipantsToMeeting(e,t)}unassignAllParticipants(){const e=N(this,S,"f").parentMeeting.id,t=this.allParticipants.map(v);return this.assignParticipantsToMeeting(t,e)}updateCurrentState(e){N(this,w,"f")||N(this,y,"m",R).call(this,e),[e.parentMeeting,...e.meetings].forEach((e,t)=>{const i=Object.assign(Object.assign({},e),{isParent:0===t});N(this,y,"m",L).call(this,i),e.participants.forEach(e=>{N(this,y,"m",I).call(this,e,i)})})}get meetingsToCreate(){return this.allConnectedMeetings.filter(e=>m(e.id)).map(e=>{let{id:t,title:i}=e;return{id:t,title:i}})}get meetingsToUpdate(){return this.allConnectedMeetings.filter(e=>N(this,C,"f").has(e.id)).map(e=>{let{id:t,title:i}=e;return{id:t,title:i}})}get meetingsToDelete(){return Array.from(N(this,A,"f"))}get participantsToMove(){const e=new Map;return Array.from(N(this,x,"f").keys()).forEach(t=>{const i=N(this,E,"f").get(t),r=N(this,x,"f").get(t);if(i===r)return;const n="".concat(i,"__").concat(r);e.has(n)||e.set(n,[]);const s=N(this,_,"f").get(t);e.get(n).push(s.id)}),Array.from(e.keys()).map(t=>{const[i,r]=t.split("__");return{sourceMeetingId:i,destinationMeetingId:r,participantIds:e.get(t)}})}async applyChanges(e){const t=0!==this.meetingsToCreate.length?e.connectedMeetings.createMeetings(this.meetingsToCreate):Promise.resolve([]),i=0!==this.meetingsToUpdate.length?e.connectedMeetings.updateMeetings(this.meetingsToUpdate):Promise.resolve(),[r]=await Promise.all([t,i]);r&&r.forEach(e=>{this.meetingsToCreate.forEach(t=>{t.title===e.title&&N(this,y,"m",M).call(this,N(this,P,"f").get(t.id),e.id)})}),0!==this.participantsToMove.length&&this.participantsToMove.forEach(t=>{let{sourceMeetingId:i,destinationMeetingId:r,participantIds:n}=t;e.connectedMeetings.moveParticipants(i,r,n)}),0!==this.meetingsToDelete.length&&e.connectedMeetings.deleteMeetings(this.meetingsToDelete)}discardChanges(){return O(this,w,!1,"f"),this.updateCurrentState(N(this,S,"f")),this.currentState}}w=new WeakMap,S=new WeakMap,x=new WeakMap,E=new WeakMap,T=new WeakMap,_=new WeakMap,P=new WeakMap,C=new WeakMap,A=new WeakMap,y=new WeakSet,R=function(e){O(this,S,e,"f"),O(this,P,new Map,"f"),O(this,_,new Map,"f"),O(this,C,new Set,"f"),O(this,A,new Set,"f"),O(this,T,new Map,"f"),O(this,x,new Map,"f"),O(this,E,new Map,"f"),O(this,E,new Map,"f"),N(this,S,"f").parentMeeting.participants.forEach(e=>{N(this,E,"f").set(v(e),N(this,S,"f").parentMeeting.id)}),N(this,S,"f").meetings.forEach(e=>{e.participants.forEach(t=>{N(this,E,"f").set(v(t),e.id)})})},L=function(e){N(this,P,"f").has(e.id)||(N(this,P,"f").set(e.id,e),N(this,T,"f").set(e.id,new Set))},I=function(e,t){N(this,_,"f").has(v(e))||(N(this,_,"f").set(v(e),e),N(this,x,"f").set(v(e),t.id),N(this,T,"f").get(t.id).add(v(e)))},M=function(e,t){const i=e.id;N(this,y,"m",L).call(this,Object.assign(Object.assign({},e),{id:t})),N(this,P,"f").delete(i);const r=N(this,T,"f").get(i);N(this,T,"f").set(t,r),N(this,T,"f").delete(i),Array.from(N(this,x,"f").keys()).forEach(e=>{N(this,x,"f").get(e)===i&&N(this,x,"f").set(e,t)})},D=function(e){return Array.from(N(this,T,"f").get(e)).map(e=>N(this,_,"f").get(e))};const j="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;var B="object"==typeof self&&self&&self.Object===Object&&self;const V=j||B||Function("return this")();const z=V.Symbol;var H=Object.prototype,$=H.hasOwnProperty,G=H.toString,W=z?z.toStringTag:void 0;var q=Object.prototype.toString;var K=z?z.toStringTag:void 0;function Z(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":K&&K in Object(e)?function(e){var t=$.call(e,W),i=e[W];try{e[W]=void 0;var r=!0}catch(s){}var n=G.call(e);return r&&(t?e[W]=i:delete e[W]),n}(e):function(e){return q.call(e)}(e)}function Y(e){return null!=e&&"object"==typeof e}const J=Array.isArray;function Q(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function X(e){if(!Q(e))return!1;var t=Z(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}const ee=V["__core-js_shared__"];var te=function(){var e=/[^.]+$/.exec(ee&&ee.keys&&ee.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var ie=Function.prototype.toString;function re(e){if(null!=e){try{return ie.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ne=/^\[object .+?Constructor\]$/,se=Function.prototype,ae=Object.prototype,oe=se.toString,ce=ae.hasOwnProperty,le=RegExp("^"+oe.call(ce).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function de(e){return!(!Q(e)||(t=e,te&&te in t))&&(X(e)?le:ne).test(re(e));var t}function he(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return de(i)?i:void 0}const ue=he(V,"WeakMap");var pe=Object.create;const ge=function(){function e(){}return function(t){if(!Q(t))return{};if(pe)return pe(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();function fe(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function Te(e){return null!=e&&Ee(e.length)&&!X(e)}var _e=Object.prototype;function Pe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function Ce(e){return Y(e)&&"[object Arguments]"==Z(e)}var Ae=Object.prototype,Re=Ae.hasOwnProperty,Le=Ae.propertyIsEnumerable,Ie=Ce(function(){return arguments}())?Ce:function(e){return Y(e)&&Re.call(e,"callee")&&!Le.call(e,"callee")};const Me=Ie;var De="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=De&&e&&!e.nodeType&&e,Ne=Oe&&Oe.exports===De?V.Buffer:void 0;const Ue=(Ne?Ne.isBuffer:void 0)||function(){return!1};var Fe={};function je(e){return function(t){return e(t)}}Fe["[object Float32Array]"]=Fe["[object Float64Array]"]=Fe["[object Int8Array]"]=Fe["[object Int16Array]"]=Fe["[object Int32Array]"]=Fe["[object Uint8Array]"]=Fe["[object Uint8ClampedArray]"]=Fe["[object Uint16Array]"]=Fe["[object Uint32Array]"]=!0,Fe["[object Arguments]"]=Fe["[object Array]"]=Fe["[object ArrayBuffer]"]=Fe["[object Boolean]"]=Fe["[object DataView]"]=Fe["[object Date]"]=Fe["[object Error]"]=Fe["[object Function]"]=Fe["[object Map]"]=Fe["[object Number]"]=Fe["[object Object]"]=Fe["[object RegExp]"]=Fe["[object Set]"]=Fe["[object String]"]=Fe["[object WeakMap]"]=!1;var Be="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ve=Be&&e&&!e.nodeType&&e,ze=Ve&&Ve.exports===Be&&j.process;const He=function(){try{var e=Ve&&Ve.require&&Ve.require("util").types;return e||ze&&ze.binding&&ze.binding("util")}catch(t){}}();var $e=He&&He.isTypedArray;const Ge=$e?je($e):function(e){return Y(e)&&Ee(e.length)&&!!Fe[Z(e)]};var We=Object.prototype.hasOwnProperty;function qe(e,t){var i=J(e),r=!i&&Me(e),n=!i&&!r&&Ue(e),s=!i&&!r&&!n&&Ge(e),a=i||r||n||s,o=a?function(e,t){for(var i=-1,r=Array(e);++i-1},ot.prototype.set=function(e,t){var i=this.__data__,r=st(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};const ct=he(V,"Map");function lt(e,t){var i=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?i["string"==typeof t?"string":"hash"]:i.map}function dt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++tai(oi),li=e=>!("isConnected"in e)||e.isConnected,di=((e,t)=>{let i;return function(){for(var r=arguments.length,n=new Array(r),s=0;s{i=0,e(...n)},t)}})(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(li))},2e3),hi=e=>"function"===typeof e?e():e,ui=(e,t)=>{const i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],e.length--)},pi=(e,t)=>{const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e,t)=>e!==t;const i=hi(e);let r=new Map(Object.entries(null!==i&&void 0!==i?i:{}));const n={dispose:[],get:[],set:[],reset:[]},s=()=>{var t;r=new Map(Object.entries(null!==(t=hi(e))&&void 0!==t?t:{})),n.reset.forEach(e=>e())},a=e=>(n.get.forEach(t=>t(e)),r.get(e)),o=(e,i)=>{const s=r.get(e);t(i,s,e)&&(r.set(e,i),n.set.forEach(t=>t(e,i,s)))},c="undefined"===typeof Proxy?{}:new Proxy(i,{get:(e,t)=>a(t),ownKeys:e=>Array.from(r.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>r.has(t),set:(e,t,i)=>(o(t,i),!0)}),l=(e,t)=>(n[e].push(t),()=>{ui(n[e],t)});return{state:c,get:a,set:o,on:l,onChange:(t,i)=>{const r=l("set",(e,r)=>{e===t&&i(r)}),n=l("reset",()=>i(hi(e)[t]));return()=>{r(),n()}},use:function(){for(var e=arguments.length,t=new Array(e),i=0;i(t.set&&e.push(l("set",t.set)),t.get&&e.push(l("get",t.get)),t.reset&&e.push(l("reset",t.reset)),t.dispose&&e.push(l("dispose",t.dispose)),e),[]);return()=>r.forEach(e=>e())},dispose:()=>{n.dispose.forEach(e=>e()),s()},reset:s,forceUpdate:e=>{const t=r.get(e);n.set.forEach(i=>i(e,t,t))}}}(e,t);return i.use((()=>{if("function"!==typeof r.g)return{};const e=new Map;return{dispose:()=>e.clear(),get:t=>{const i=(0,r.g)();i&&((e,t,i)=>{const r=e.get(t);r?r.includes(i)||r.push(i):e.set(t,[i])})(e,t,i)},set:t=>{const i=e.get(t);i&&e.set(t,i.filter(r.f)),di(e)},reset:()=>{e.forEach(e=>e.forEach(r.f)),di(e)}}})()),i},gi={about_call:"About Call",screen:"Screen",camera:"Camera",leave:"Leave",dismiss:"Dismiss",logo:"Logo",page:"Page",more:"More","page.prev":"Previous Page","page.next":"Next Page",layout:"Layout","layout.auto":"Auto Layout",settings:"Settings",file:"File",image:"Image",connection:"Connection",leave_confirmation:"Are you sure you want to leave the call?",cancel:"Cancel",yes:"Yes","(you)":"(you)",you:"You",everyone:"Everyone",to:"To",mute:"Mute",kick:"Kick",pin:"Pin",pinned:"Pinned",accept:"Accept",unpin:"Unpin",pip_on:"Show PiP",pip_off:"Hide PiP",viewers:"Viewers",join:"Join",joined:"Joined",create:"Create",close:"Close",ask:"Ask",type:"Type",activate:"Activate",requests:"Requests",mic_off:"Mic Off",disable_mic:"Disable Mic",mic_on:"Mic On",enable_mic:"Enable Mic",audio:"Audio",test:"Test",minimize:"Hide Tile",maximize:"Show Tile",mute_all:"Mute all","mute_all.description":"Everyone else in the meeting will be muted.","mute_all.header":"Are you sure?","mute_all.allow_unmute":"Allow others to unmute",video_off:"Video Off",disable_video:"Disable Video",video_on:"Video On",enable_video:"Enable Video",video:"Video",offline:"You're offline","offline.description":"Please ensure that you are connected to the internet.",disconnected:"You haven't joined the meeting.",failed:"You've been disconnected","failed.description":"We could not connect you back to the meeting room. Please try rejoining the meeting.","disconnected.description":"Please join the meeting in order to see and interact with other participants.",participants:"Participants","participants.errors.empty_results":"Couldn't find a participant with the specified name or ID.","participants.empty_list":"It looks like nobody is here.","participants.no_pending_requests":"There are no pending requests.","participants.turn_off_video":"Turn off video",polls:"Polls","polls.by":"Poll by","polls.question":"Poll Question","polls.question.placeholder":"What is your poll for?","polls.answers":"Answers","polls.option":"Add an option.","polls.option.placeholder":"Enter an option","polls.results.anon":"Anonymous","polls.results.hide":"Hide results before voting","polls.create":"Create Poll","polls.cancel":"Cancel Poll Creation","polls.empty":"No polls available","polls.errors.question_required":"Question is required.","polls.errors.empty_option":"Empty options not allowed.",screenshare:"Screen Share","screenshare.min_preview":"Minimize Preview","screenshare.max_preview":"Expand Preview","screenshare.shared":"Your screen is being shared.","screenshare.start":"Share Screen","screenshare.stop":"Stop Sharing","screenshare.error.unknown":"An error occured while starting screenshare.","screenshare.error.max_count":"Maximum screen share limit reached.",plugins:"Plugins",perm_denied:"Permission denied by browser.","perm_denied.audio":"Mic Permission denied by browser","perm_denied.video":"Camera Permission denied by browser","perm_denied.screenshare":"Screenshare Permission denied by browser","perm_denied.audio.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Microphone' permission is checked","perm_denied.video.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Camera' permission is checked","perm_denied.screenshare.chrome.message":"Under Chrome settings, navigate to 'Privacy and Security > Site Settings > Permissions'. Select 'Screenshare', provide permission and reload this application.","perm_denied.audio.safari.message":"Under Safari settings, navigate to 'Websites > Microphone', provide permission and reload this application.","perm_denied.video.safari.message":"Under Safari settings, navigate to 'Websites > Camera', provide permission and reload this application.","perm_denied.screenshare.safari.message":"Under Safari settings, navigate to 'Websites > Screenshare', provide permission and reload this application.","perm_denied.audio.edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Microphone', provide permission and reload this application.","perm_denied.video.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.others.message":"From your browser settings, enable 'Microphone' permissions and reload this application.","perm_denied.video.others.message":"From your browser settings, enable 'Camera' permissions and reload this application.","perm_denied.screenshare.others.message":"From your browser settings, enable 'Screenshare' permissions and reload this application.",perm_sys_denied:"Permission denied by system","perm_sys_denied.audio":"Mic permission denied by system","perm_sys_denied.video":"Camera permission denied by system","perm_sys_denied.screenshare":"Screenshare permission denied by system","perm_sys_denied.audio.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Microphone'. Allow access to your browser and reload this application.","perm_sys_denied.video.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Camera'. Allow access to your browser and reload this application.","perm_sys_denied.screenshare.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Screenshare'. Allow access to your browser and reload this application.","perm_sys_denied.audio.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Microphone', allow access to your browser and reload this application.","perm_sys_denied.video.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Camera', allow access to your browser and reload this application.","perm_sys_denied.screenshare.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Screenshare', allow access to your browser and reload this application.","perm_sys_denied.audio.windows.message":"Go to windows settings, select 'Settings > Privacy > Microphone'. Allow permissions to your browser and reload this application.","perm_sys_denied.video.windows.message":"Go to windows settings, select 'Settings > Privacy > Camera'. Allow permissions to your browser and reload this application.","perm_sys_denied.screenshare.windows.message":"Go to windows settings, select 'Settings > Privacy > Screenshare'. Allow permissions to your browser and reload this application.","perm_sys_denied.audio.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Microphone permissions and reload this application.","perm_sys_denied.video.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Camera permissions and reload this application.","perm_sys_denied.screenshare.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Screenshare permissions and reload this application.","perm_sys_denied.audio.others.message":"Navigate to your system settings. Allow 'Microphone' permissions for your browser and reload this application.","perm_sys_denied.video.others.message":"Navigate to your system settings. Allow 'Camera' permissions for your browser and reload this application.","perm_sys_denied.screenshare.others.message":"Navigate to your system settings. Allow 'Screenshare' permissions for your browser and reload this application.",perm_could_not_start:"Could not capture device.","perm_could_not_start.audio":"Unable to start your Microphone","perm_could_not_start.video":"Unable to start your Camera","perm_could_not_start.screenshare":"Unable to start your Screenshare","perm_could_not_start.audio.message":"Looks like the system could not capture your microphone. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.video.message":"Looks like the system could not capture your camera. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.screenshare.message":"Looks like the system could not capture your screenshare. Please restart your device or upgrade your browser to fix this.",full_screen:"Full Screen","full_screen.exit":"Exit Full Screen","waitlist.header_title":"Waiting","waitlist.body_text":"You are in the waiting room, the host will let you in soon.","waitlist.deny_request":"Deny request","waitlist.accept_request":"Accept request","waitlist.accept_all":"Accept all","stage_request.header_title":"Join Stage Requests","stage_request.deny_request":"Deny request","stage_request.accept_request":"Accept request","stage_request.accept_all":"Accept all","stage_request.deny_all":"Deny all","stage_request.approval_pending":"Pending","stage_request.denied":"Denied","stage_request.request":"Join stage","stage_request.requested":"Requested","stage_request.cancel_request":"Cancel request","stage_request.leave_stage":"Leave stage","stage_request.request_tip":"Request to join the discussion","stage_request.leave_tip":"Leave the stage","stage_request.pending_tip":"Request pending","stage_request.denied_tip":"Rejected request","stage.empty_host":"The stage is empty","stage.empty_host_summary":"You are off stage. You can manage stage request from the participants tab.","stage.empty_viewer":"There is no one on stage","stage.remove_from_stage":"Remove from stage","stage.invited_notification":"has been invited to join stage.","stage.add_to_stage":"Invite to stage","stage.join_title":"Join Stage","stage.join_summary":"You are about to join the stage, your video & audio as shown above will be visible to all participants.","stage.join_cancel":"Cancel","stage.join_confirm":"Join","setup_screen.join_in_as":"Joining as","setup_screen.your_name":"Your name","stage.reconnecting":"Reconnecting...","recording.label":"REC","recording.indicator":"This meeting is being recorded.","recording.started":"This meeting is being recorded.","recording.stopped":"Recording for this meeting has been stopped.","recording.paused":"Recording for this meeting has been paused.","recording.error.start":"Error while starting recording.","recording.error.stop":"Error while stopping recording","recording.error.resume":"Error while resuming recording","recording.start":"Start Recording","recording.stop":"Stop Recording","recording.resume":"Resume Recording","recording.starting":"Starting","recording.stopping":"Stopping","recording.loading":"Loading","recording.idle":"Record",audio_playback:"Play Audio","audio_playback.title":"Allow Audio Playback","audio_playback.description":"In order to play audio properly on your device, click the button below.",breakout_rooms:"Breakout Rooms","breakout_rooms.room_config_header":"Create Breakout","breakout_rooms.join_breakout_header":"Join Breakout","breakout_rooms.empty":"Nobody here yet.","breakout_rooms.delete":"Delete Room","breakout_rooms.switch":"Switch","breakout_rooms.main_room":"Main Room","breakout_rooms.shuffle_participants":"Shuffle Participants","breakout_rooms.deselect":"Deselect","breakout_rooms.selected":"selected","breakout_rooms.num_of_rooms":"No. of Rooms","breakout_rooms.approx":"Approx.","breakout_rooms.participants_per_room":"participants/room","breakout_rooms.division_text":"when equally divided.","breakout_rooms.start_breakout":"Start Breakout","breakout_rooms.close_breakout":"Close Breakout","breakout_rooms.update_breakout":"Update Breakout","breakout_rooms.discard_changes":"Discard Changes","breakout_rooms.room":"Room","breakout_rooms.rooms":"Rooms","breakout_rooms.room_name":"Room Name","breakout_rooms.edit_room_name":"Edit Room Name","breakout_rooms.save_room_name":"Save Room Name","breakout_rooms.add_room":"Add","breakout_rooms.add_room_brief":"Add Room","breakout_rooms.select_all":"Select all","breakout_rooms.unassign_all":"Unassign all","breakout_rooms.assign":"Assign","breakout_rooms.assign_participants":"Assign Participants","breakout_rooms.none_assigned":"No participants assigned yet","breakout_rooms.drag_drop_participants":"Drag and drop participants","breakout_rooms.click_drop_participants":"Click here to assign","breakout_rooms.status.assign_multiple":"Assign multiple participants at once by clicking and selecting them","breakout_rooms.status.select_room":"Select a room to assign","breakout_rooms.ephemeral_status.participants_assigned":"Participants assigned","breakout_rooms.ephemeral_status.participants_assigned_randomly":"Participants assigned randomly","breakout_rooms.ephemeral_status.changes_discarded":"Changes discarded","breakout_rooms.confirm_modal.start_breakout.header":"Start breakout rooms?","breakout_rooms.confirm_modal.start_breakout.content":"Once started, all participants will be moved to their assigned rooms.","breakout_rooms.confirm_modal.start_breakout.cancelText":"No, go back","breakout_rooms.confirm_modal.start_breakout.ctaText":"Yes, start","breakout_rooms.confirm_modal.close_breakout.header":"Close breakout rooms?","breakout_rooms.confirm_modal.close_breakout.content":"All breakout rooms will be closed & participants will be moved back to the main room.","breakout_rooms.confirm_modal.close_breakout.ctaText":"Yes, close breakout","breakout_rooms.move_reason.started_msg":"Starting breakout rooms...","breakout_rooms.move_reason.started_desc":"You are being moved to your assigned room","breakout_rooms.move_reason.closed_msg":"Closing Breakout rooms...","breakout_rooms.move_reason.closed_desc":"You are being moved back to the main room","breakout_rooms.move_reason.switch_room":"Joining Breakout Room...","breakout_rooms.move_reason.switch_main_room":"Joining Main Room...","breakout_rooms.all_assigned":"All participants have been assigned","breakout_rooms.empty_main_room":"No more participants in the main room.","breakout_rooms.leave_confirmation":"Are you sure you want to leave the call? You are in a breakout room, you can join the main room too.","breakout_rooms.leave_confirmation.main_room_btn":"Go back to main room",ai:"AI","ai.meeting_ai":"MeetingAI","ai.home":"Home","ai.transcriptions":"Transcriptions","ai.personal":"Personal","ai.caption_view":"Caption View","ai.chat.tooltip":"This conversation will just be visible to you and not to others in the call.","ai.chat.summerise":"Hey AI, summarise this call","ai.chat.agenda":"Hey AI, what is today's agenda?",search:"Search","search.could_not_find":"Couldn't find a participant with the specified name or ID.","search.empty":"It looks like nobody is here.",end:"End Meeting","end.all":"End meeting for all",ended:"The meeting ended.","ended.rejected":"Your request to join the meeting was denied.","ended.left":"You left the meeting.","ended.kicked":"You were removed from the meeting.","ended.disconnected":"The call ended because the connection was lost.","ended.network":"Please check your internet connection and try again.","ended.unauthorized":"You are not authorized to join this meeting.",network:"Network","network.reconnecting":"Connection lost. Trying to reconnect.","network.delay_extended":"Taking too long to reconnect. Please check your network connection.","network.disconnected":"Could not reconnect. Please leave the meeting and try refreshing the window.","network.leaving":"Automatically leaving the meeting in 10 seconds.","network.restored":"Connection restored","network.delay":"Taking too long to reconnect.","network.lost":"Connection lost","network.lost_extended":"Connection lost. Please check your network connection.",livestream:"Livestream","livestream.indicator":"This meeting is being livestreamed.","livestream.skip":"Skip to Live","livestream.idle":"Waiting to go live.","livestream.starting":"Livestream is starting...","livestream.stopping":"Livestream is stopping...","livestream.waiting_on_manual_ingestion":"Please ingest livestream media.","livestream.error.not_supported":"Player not supported.","livestream.error.not_found":"Playback URL not found.","livestream.error.unknown":"An unknown error occured.","livestream.error.sync":"Could not sync livestream please try again later.","livestream.error.start":"Error while starting livestream.","livestream.error.stop":"Error while stopping livestream.","livestream.go_live":"Go Live","livestream.end_live":"End Live","livestream.error":"Error","cta.help":"Need help on how to do this?","cta.continue":"Ignore","cta.reload":"Reload","cta.confirmation":"Are you sure?","cta.system_settings":"Open Settings","remote_access.empty":"There are no remote requests, yet.","remote_access.requests":"The following people have requested remote control to your screen share.","remote_access.allow":"Please select whom you want to give access to.","remote_access.grant":"Grant acess","remote_access.indicator":"Any plugin or screenshare you switch to will sync the change across the meeting",chat:"Chat","chat.new":"New","chat.max_limit_warning":"Max Character Limit","chat.rate_limit_error":"Please wait before you can send another message","chat.new_channel":"Create new channel","chat.channel_name":"Enter channel name","chat.member_name":"Enter member name","chat.add_members":"Add members","chat.delete_msg":"Delete","chat.edit_msg":"Edit","chat.send_msg":"Send message","chat.send_attachment":"Drop files/images to send","chat.send_img":"Send an image","chat.send_file":"Send a file","chat.send_emoji":"Send an emoji","chat.update_msg":"Update message","chat.channel_members":"Channel Members","chat.img.loading":"Loading image","chat.error.img_not_found":"Image not found","chat.error.empty_results":"Couldn't find a member with the specified name.","chat.img.shared_by":"Shared by","chat.reply":"Reply","chat.message_placeholder":"Message..","chat.click_to_send":"Click to send as message","chat.search_msgs":"Search messages","chat.search_conversations":"Search conversations","chat.start_conversation":"Start a conversation..","chat.empty_search":"No messages found","chat.empty_channel":"Send a message to get started","chat.cancel_upload":"Cancel upload","chat.view_chats":"View chats","chat.everyone":"everyone","chat.pinned_msgs":"Pinned messages","chat.toggle_pinned_msgs":"Toggle pinned messages","date.today":"Today","date.yesteday":"Yesterday","date.sunday":"Sunday","date.monday":"Monday","date.tuesday":"Tuesday","date.wednesday":"Wednesday","date.thursday":"Thursday","date.friday":"Friday","date.saturday":"Saturday","list.empty":"No items found","grid.listening":"Listening","transcript.off":"Turn off Transcripts","transcript.on":"Turn on Transcripts","settings.notification_sound":"Notification sound","settings.microphone_input":"Microphone","settings.speaker_output":"Speaker","settings.mirror_video":"Mirror my Video","settings.camera_off":"Camera is off","dialog.close":"Close dialog","notifications.joined":"just joined","notifications.left":"left","notifications.requesting_to_join_meeting":"is requesting to join the meeting","notifications.requested_to_join_stage":"has requested to join stage","notifications.joined_stage":"has joined stage","notifications.request_to_join_accepted":"Request to join accepted","notifications.request_to_join_rejected":"Request to join rejected","notifications.accept":"Accept","notifications.new_poll_created_by":"New poll created by","notifications.connected_to":"Connected to","notifications.plugin_switched_to":"Plugin switched to","notifications.remote_control_requested":"has requested for remote control","notifications.remote_control_request_sent":"Sent remote control request to","notifications.remote_control_request_accepted":"has granted remote control","notifications.remote_control_granted":"Granted remote control to","notifications.remote_control_terminated":"Existing remote control has been terminated","debugger.troubleshooting.label":"Troubleshooting","debugger.quality.good":"Good","debugger.quality.average":"Average","debugger.quality.poor":"Poor","debugger.stats.bitrate.label":"Bitrate","debugger.stats.bitrate.description":"Data transmitted per second, affects quality and file size.","debugger.stats.packet_loss.label":"Packet Loss","debugger.stats.packet_loss.description":"Amount of data lost during transfer","debugger.stats.jitter.label":"Jitter","debugger.stats.jitter.description":"Variance or fluctuation in latency","debugger.stats.cpu_limitations.label":"CPU Limitations","debugger.stats.cpu_limitations.description":"CPU limitations can impact WebRTC call quality and performance.","debugger.stats.bandwidth_limitations.label":"Bandwidth Limitations","debugger.stats.bandwidth_limitations.description":"Slow internet speeds can degrade video quality.","debugger.audio.label":"Audio","debugger.audio.troubleshooting.label":"Audio Troubleshooting","debugger.audio.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.audio.messages.enable_media":"Please enable mic to see the report.","debugger.audio.sections.network_media":"Network & Media","debugger.video.label":"Video","debugger.video.troubleshooting.label":"Video Troubleshooting","debugger.video.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.video.messages.enable_media":"Please enable camera to see the report.","debugger.video.sections.network_media":"Network & Media","debugger.screenshare.label":"Screenshare","debugger.screenshare.troubleshooting.label":"Screenshare Troubleshooting","debugger.screenshare.sections.network_media":"Network & Media","debugger.screenshare.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.screenshare.messages.enable_media":"Please share screen to see the report.","debugger.system.label":"System","debugger.system.troubleshooting.label":"System Troubleshooting","debugger.system.sections.battery":"Battery","debugger.system.battery.level.label":"Battery Level","debugger.system.battery.level.description":"A low battery charge may result in reduced performance.","debugger.system.battery.charging.label":"Battery Charging Status","debugger.system.battery.charging.description":"A device running on power performs optimally.","debugger.system.battery.charging.is_charging":"Charging","debugger.system.battery.charging.is_not_charging":"Not charging"},fi=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gi,t=gi;return(e!==gi||Object.keys(e).length>0)&&(t=Object.assign({},gi,e)),e=>{var i;return null!==(i=t[e])&&void 0!==i?i:e}},mi={people:'',people_checked:'',chat:'',poll:'',participants:'',rocket:'',call_end:'',share:'',mic_on:'',mic_off:'',video_on:'',video_off:'',share_screen_start:'',share_screen_stop:'',share_screen_person:'',clock:'',dismiss:'',send:'',search:'',more_vertical:'',chevron_down:'',chevron_up:'',chevron_left:'',chevron_right:'',settings:'',wifi:'',speaker:'',speaker_off:'',download:'',full_screen_maximize:'',full_screen_minimize:'',copy:'',attach:'',image:'',emoji_multiple:'',image_off:'',disconnected:'',wand:'',recording:'',subtract:'',stop_recording:'',warning:'',pin:'',pin_off:'',spinner:'',breakout_rooms:'',add:'',shuffle:'',edit:'',delete:'',back:'',save:'',web:'',checkmark:'',spotlight:'',join_stage:'',leave_stage:'',pip_off:'',pip_on:'',signal_1:'',signal_2:'',signal_3:'',signal_4:'',signal_5:'',start_livestream:'',stop_livestream:'',viewers:'',debug:'',info:'',devices:'',horizontal_dots:'',ai_sparkle:'',meeting_ai:'',create_channel:'',create_channel_illustration:' ',captionsOn:'',captionsOff:'',play:'',pause:'',fastForward:'',minimize:'',maximize:''},vi={get:(e,t,i)=>function(){try{for(var r=arguments.length,n=new Array(r),s=0;s{const i=JSON.parse(ki.getItem(yi)||"{}");i[e]=JSON.stringify(t),ki.setItem("rtk-prefs",JSON.stringify(i))},Si=e=>JSON.parse(ki.getItem(yi)||"{}")[e],xi=()=>{const e=JSON.parse(ki.getItem(yi)||"{}");return{mirrorVideo:!e["mirror-video"]||"true"===e["mirror-video"],muteNotificationSounds:!!e["mute-notification-sounds"]&&"true"===e["mute-notification-sounds"]}},Ei={},Ti=e=>({meeting:"idle",prefs:xi(),peerId:e||"LEGACY_GLOBAL_PEER"}),_i=pi({meeting:null,t:fi(),iconPack:mi,states:Ti(),config:ci(),peerId:"global",storeType:"global",storeId:"store-global"}),Pi=new Map;_i.elementsMap=Pi,_i.use({set:(e,t)=>{const i=Pi.get(e);i&&Pi.set(e,i.filter(i=>i[e]!==t&&(i[e]=t,!0)))}});_i.state;function Ci(e){let{meeting:t,config:i,providerId:r,iconPack:n,t:s}=e;const a=pi({meeting:t,t:s,iconPack:n,states:Ti(t.self.peerId),config:i||ci(),peerId:t.self.id,storeType:"peer",storeId:"store-"+r.replace("provider-","")}),o=new Map;return a.elementsMap=o,a.use({set:(e,t)=>{const i=o.get(e);i&&o.set(e,i.filter(i=>i[e]!==t&&(i[e]=t,!0)))}}),a}function Ai(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_i;const r=i.elementsMap;if(!r)return void console.error("appendElement: No elementsMap found on store",i);const n=r.get(e);if(n)try{Ri(e,t,i),n.push(t)}catch(s){console.error("appendElement: Error adding element:",s)}else try{r.set(e,[t])}catch(s){console.error("appendElement: Error setting new array:",s)}}function Ri(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_i;const r=i.elementsMap;if(!r)return void console.error("removeElement: No elementsMap found on store",i);const n=r.get(e);if(n){const e=n.indexOf(t);e>-1&&n.splice(e,1)}}},579(e,t,i){"use strict";e.exports=i(1153)},1141(e){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},1153(e,t,i){"use strict";i(2123);var r=i(5043),n=60103;if(t.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var s=Symbol.for;n=s("react.element"),t.Fragment=s("react.fragment")}var a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o=Object.prototype.hasOwnProperty,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,i){var r,s={},l=null,d=null;for(r in void 0!==i&&(l=""+i),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(d=t.ref),t)o.call(t,r)&&!c.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:n,type:e,key:l,ref:d,props:s,_owner:a.current}}t.jsx=l,t.jsxs=l},1497(e,t,i){"use strict";var r=i(3218);function n(){}function s(){}s.resetWarningCache=n,e.exports=function(){function e(e,t,i,n,s,a){if(a!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var i={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:n};return i.PropTypes=i,i}},2123(e){"use strict";var t=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},i=0;i<10;i++)t["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(n){return!1}}()?Object.assign:function(e,n){for(var s,a,o=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;co})},2614(e,t,i){"use strict";i.d(t,{u:()=>rt});var r=i(45),n=i(2555);e=i.hmd(e);const s=["crossAxis","alignment","allowedPlacements","autoAlignment"],a=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],o=["strategy"],c=["mainAxis","crossAxis","limiter"],l="hydrated",d=!0,h=!0,u=!0;var p=Object.defineProperty,g=e=>{if(e.__stencil__getHostRef)return e.__stencil__getHostRef()},f=(e,t)=>{e.__stencil__getHostRef=()=>t,t.$lazyInstance$=e},m=(e,t)=>t in e,v=(e,t)=>(0,console.error)(e,t),b=new Map,k=new Map,y="slot-fb{display:contents}slot-fb[hidden]{display:none}",w="http://www.w3.org/1999/xlink",S="undefined"!==typeof window?window:{},x={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,i,r)=>e.addEventListener(t,i,r),rel:(e,t,i,r)=>e.removeEventListener(t,i,r),ce:(e,t)=>new CustomEvent(e,t)},E=(()=>{var e;let t=!1;try{null==(e=S.document)||e.addEventListener("e",null,Object.defineProperty({},"passive",{get(){t=!0}}))}catch(i){}return t})(),T=(()=>{try{return new CSSStyleSheet,"function"===typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),_=!1,P=[],C=[],A=(e,t)=>t=>{e.push(t),_||(_=!0,4&x.$flags$?I(L):x.raf(L))},R=e=>{for(let i=0;i{R(P),R(C),(_=P.length>0)&&x.raf(L)},I=e=>{return Promise.resolve(t).then(e);var t},M=A(C),D=e=>"object"===(e=typeof e)||"function"===e;function O(e){var t,i,r;return null!=(r=null==(i=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:i.getAttribute("content"))?r:void 0}((e,t)=>{for(var i in t)p(e,i,{get:t[i],enumerable:!0})})({},{err:()=>U,map:()=>F,ok:()=>N,unwrap:()=>j,unwrapErr:()=>B});var N=e=>({isOk:!0,isErr:!1,value:e}),U=e=>({isOk:!1,isErr:!0,value:e});function F(e,t){if(e.isOk){const i=t(e.value);return i instanceof Promise?i.then(e=>N(e)):N(i)}if(e.isErr){const t=e.value;return U(t)}throw"should never get here"}var j=e=>{if(e.isOk)return e.value;throw e.value},B=e=>{if(e.isErr)return e.value;throw e.value},V=e=>{const t=W(e,"childNodes");e.tagName&&e.tagName.includes("-")&&e["s-cr"]&&"SLOT-FB"!==e.tagName&&z(t,e.tagName).forEach(e=>{1===e.nodeType&&"SLOT-FB"===e.tagName&&(H(e,G(e),!1).length?e.hidden=!0:e.hidden=!1)});let i=0;for(i=0;i2&&void 0!==arguments[2])||arguments[2];const r=[];(i&&e["s-sr"]||!e["s-sr"])&&r.push(e);let n=e;for(;n=n.nextSibling;)G(n)!==t||!i&&n["s-sr"]||r.push(n);return r},$=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,G=e=>"string"===typeof e["s-sn"]?e["s-sn"]:1===e.nodeType&&e.getAttribute("slot")||void 0;function W(e,t){if("__"+t in e){const i=e["__"+t];return"function"!==typeof i?i:i.bind(e)}return"function"!==typeof e[t]?e[t]:e[t].bind(e)}var q,K,Z=function(e,t){let i=null,r=null,n=null,s=!1,a=!1;const o=[],c=t=>{for(let r=0;r2?l-2:0),h=2;he[t]).join(" "))}}if("function"===typeof e)return e(null===t?{}:t,o,Q);const u=Y(e,null);return u.$attrs$=t,o.length>0&&(u.$children$=o),u.$key$=r,u.$name$=n,u},Y=(e,t)=>{const i={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return i},J={},Q={forEach:(e,t)=>e.map(X).forEach(t),map:(e,t)=>e.map(X).map(t).map(ee)},X=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),ee=e=>{if("function"===typeof e.vtag){const t=(0,n.A)({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),Z(e.vtag,t,...e.vchildren||[])}const t=Y(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},te=(e,t)=>null==e||D(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?String(e):e,ie=e=>g(e).$hostElement$,re=(e,t,i)=>{const r=ie(e);return{emit:e=>ne(r,t,{bubbles:!!(4&i),composed:!!(2&i),cancelable:!!(1&i),detail:e})}},ne=(e,t,i)=>{const r=x.ce(t,i);return e.dispatchEvent(r),r},se=new WeakMap,ae=e=>{const t=e.$cmpMeta$,i=e.$hostElement$,r=t.$flags$,n=(t.$tagName$,()=>{}),s=((e,t)=>{var i;const r=oe(t),n=k.get(r);if(!S.document)return r;if(e=11===e.nodeType?e:S.document,n)if("string"===typeof n){e=e.head||e;let s,a=se.get(e);if(a||se.set(e,a=new Set),!a.has(r)){{s=document.querySelector("[".concat("sty-id",'="').concat(r,'"]'))||S.document.createElement("style"),s.innerHTML=n;const a=null!=(i=x.$nonce$)?i:O(S.document);if(null!=a&&s.setAttribute("nonce",a),!(1&t.$flags$))if("HEAD"===e.nodeName){const t=e.querySelectorAll("link[rel=preconnect]"),i=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(s,(null==i?void 0:i.parentNode)===e?i:null)}else if("host"in e)if(T){const t=new CSSStyleSheet;t.replaceSync(n),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{const t=e.querySelector("style");t?t.innerHTML=n+t.innerHTML:e.prepend(s)}else e.append(s);1&t.$flags$&&e.insertBefore(s,null)}4&t.$flags$&&(s.innerHTML+=y),a&&a.add(r)}}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return r})(i.shadowRoot?i.shadowRoot:i.getRootNode(),t);(10&r&&2&r||128&r)&&(i["s-sc"]=s,i.classList.add(s+"-h")),n()},oe=(e,t)=>"sc-"+e.$tagName$,ce=(e,t,i,r,n,s,a)=>{if(i===r)return;let o=m(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,n=de(i);let s=de(r);t.remove(...n.filter(e=>e&&!s.includes(e))),t.add(...s.filter(e=>e&&!n.includes(e)))}else if("style"===t){for(const t in i)r&&null!=r[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in r)i&&r[t]===i[t]||(t.includes("-")?e.style.setProperty(t,r[t]):e.style[t]=r[t])}else if("key"===t);else if("ref"===t)r&&r(e);else if(o||"o"!==t[0]||"n"!==t[1]){const a=D(r);if((o||a&&null!==r)&&!n)try{if(e.tagName.includes("-"))e[t]!==r&&(e[t]=r);else{const n=null==r?"":r;"list"===t?o=!1:null!=i&&e[t]==n||("function"===typeof e.__lookupSetter__(t)?e[t]=n:e.setAttribute(t,n))}}catch(l){}let d=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,d=!0),null==r||!1===r?!1===r&&""!==e.getAttribute(t)||(d?e.removeAttributeNS(w,t):e.removeAttribute(t)):(!o||4&s||n)&&!a&&1===e.nodeType&&(r=!0===r?"":r,d?e.setAttributeNS(w,t,r):e.setAttribute(t,r))}else if(t="-"===t[2]?t.slice(3):m(S,c)?c.slice(2):c[2]+t.slice(3),i||r){const n=t.endsWith(he);t=t.replace(ue,""),i&&x.rel(e,t,i,n),r&&x.ael(e,t,r,n)}},le=/\s/,de=e=>("object"===typeof e&&e&&"baseVal"in e&&(e=e.baseVal),e&&"string"===typeof e?e.split(le):[]),he="Capture",ue=new RegExp(he+"$"),pe=(e,t,i,r)=>{const n=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,s=e&&e.$attrs$||{},a=t.$attrs$||{};for(const o of ge(Object.keys(s)))o in a||ce(n,o,s[o],void 0,i,t.$flags$);for(const o of ge(Object.keys(a)))ce(n,o,s[o],a[o],i,t.$flags$)};function ge(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var fe=!1,me=!1,ve=!1,be=!1,ke=(e,t,i)=>{var r;const n=t.$children$[i];let s,a,o,c=0;if(fe||(ve=!0,"slot"===n.$tag$&&(n.$flags$|=n.$children$?2:1)),null!==n.$text$)s=n.$elm$=S.document.createTextNode(n.$text$);else if(1&n.$flags$)s=n.$elm$=S.document.createTextNode(""),pe(null,n,be);else{if(!S.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(s=n.$elm$=S.document.createElement(!fe&&h&&2&n.$flags$?"slot-fb":n.$tag$),pe(null,n,be),n.$children$)for(c=0;cfunction(e){const i=[],r=this["s-sn"];(null==e?void 0:e.flatten)&&console.error("\n Flattening is not supported for Stencil non-shadow slots. \n You can use `.childNodes` to nested slot fallback content.\n If you have a particular use case, please open an issue on the Stencil repo.\n ");const n=this["s-cr"].parentElement;return(n.__childNodes?n.childNodes:(e=>{const t=[];for(let i=0;i{r===G(e)&&i.push(e)}),t?i.filter(e=>1===e.nodeType):i}.bind(e);e.assignedElements=t(!0),e.assignedNodes=t(!1)}(s),o=e&&e.$children$&&e.$children$[i],o&&o.$tag$===n.$tag$&&e.$elm$&&ye(e.$elm$,!1)),s},ye=(e,t)=>{x.$flags$|=1;const i=Array.from(e.__childNodes||e.childNodes);e["s-sr"];for(let r=i.length-1;r>=0;r--){const e=i[r];e["s-hn"]!==K&&e["s-ol"]&&(Ae(Ee(e).parentNode,e,Ee(e)),e["s-ol"].remove(),e["s-ol"]=void 0,e["s-sh"]=void 0,ve=!0),t&&ye(e,t)}x.$flags$&=-2},we=(e,t,i,r,n,s)=>{let a,o=e["s-cr"]&&e["s-cr"].parentNode||e;for(o.shadowRoot&&o.tagName===K&&(o=o.shadowRoot);n<=s;++n)r[n]&&(a=ke(null,i,n),a&&(r[n].$elm$=a,Ae(o,a,Ee(t))))},Se=(e,t,i)=>{for(let r=t;r<=i;++r){const t=e[r];if(t){const e=t.$elm$;Ce(t),e&&(me=!0,e["s-ol"]?e["s-ol"].remove():ye(e,!0),e.remove())}}},xe=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:i?(i&&!e.$key$&&t.$key$&&(e.$key$=t.$key$),!0):e.$key$===t.$key$)},Ee=e=>e&&e["s-ol"]||e,Te=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=t.$elm$=e.$elm$,n=e.$children$,s=t.$children$,a=t.$text$;let o;null===a?(pe(e,t,be),null!==n&&null!==s?function(e,t,i,r){let n,s,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=0,c=0,l=0,d=0,h=t.length-1,u=t[0],p=t[h],g=r.length-1,f=r[0],m=r[g];for(;o<=h&&c<=g;)if(null==u)u=t[++o];else if(null==p)p=t[--h];else if(null==f)f=r[++c];else if(null==m)m=r[--g];else if(xe(u,f,a))Te(u,f,a),u=t[++o],f=r[++c];else if(xe(p,m,a))Te(p,m,a),p=t[--h],m=r[--g];else if(xe(u,m,a))"slot"!==u.$tag$&&"slot"!==m.$tag$||ye(u.$elm$.parentNode,!1),Te(u,m,a),Ae(e,u.$elm$,p.$elm$.nextSibling),u=t[++o],m=r[--g];else if(xe(p,f,a))"slot"!==u.$tag$&&"slot"!==m.$tag$||ye(p.$elm$.parentNode,!1),Te(p,f,a),Ae(e,p.$elm$,u.$elm$),p=t[--h],f=r[++c];else{for(l=-1,d=o;d<=h;++d)if(t[d]&&null!==t[d].$key$&&t[d].$key$===f.$key$){l=d;break}l>=0?(s=t[l],s.$tag$!==f.$tag$?n=ke(t&&t[c],i,l):(Te(s,f,a),t[l]=void 0,n=s.$elm$),f=r[++c]):(n=ke(t&&t[c],i,c),f=r[++c]),n&&Ae(Ee(u.$elm$).parentNode,n,Ee(u.$elm$))}o>h?we(e,null==r[g+1]?null:r[g+1].$elm$,i,r,c,g):c>g&&Se(t,o,h)}(r,n,t,s,i):null!==s?(null!==e.$text$&&(r.textContent=""),we(r,null,t,s,0,s.length-1)):!i&&u&&null!==n&&Se(n,0,n.length-1)):(o=r["s-cr"])?o.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},_e=[],Pe=e=>{let t,i,r;const n=e.__childNodes||e.childNodes;for(const s of n){if(s["s-sr"]&&(t=s["s-cr"])&&t.parentNode){i=t.parentNode.__childNodes||t.parentNode.childNodes;const e=s["s-sn"];for(r=i.length-1;r>=0;r--)if(t=i[r],!t["s-cn"]&&!t["s-nr"]&&t["s-hn"]!==s["s-hn"])if($(t,e)){let i=_e.find(e=>e.$nodeToRelocate$===t);me=!0,t["s-sn"]=t["s-sn"]||e,i?(i.$nodeToRelocate$["s-sh"]=s["s-hn"],i.$slotRefNode$=s):(t["s-sh"]=s["s-hn"],_e.push({$slotRefNode$:s,$nodeToRelocate$:t})),t["s-sr"]&&_e.map(e=>{$(e.$nodeToRelocate$,t["s-sn"])&&(i=_e.find(e=>e.$nodeToRelocate$===t),i&&!e.$slotRefNode$&&(e.$slotRefNode$=i.$slotRefNode$))})}else _e.some(e=>e.$nodeToRelocate$===t)||_e.push({$nodeToRelocate$:t})}1===s.nodeType&&Pe(s)}},Ce=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(Ce)},Ae=(e,t,i)=>null==e?void 0:e.insertBefore(t,i),Re=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r,n,s,a;const o=e.$hostElement$,c=e.$cmpMeta$,l=e.$vnode$||Y(null,null),d=(h=t)&&h.$tag$===J?t:Z(null,null,t);var h;if(K=o.tagName,c.$attrsToReflect$&&(d.$attrs$=d.$attrs$||{},c.$attrsToReflect$.map(e=>{let[t,i]=e;return d.$attrs$[i]=o[t]})),i&&d.$attrs$)for(const u of Object.keys(d.$attrs$))o.hasAttribute(u)&&!["key","ref","style","class"].includes(u)&&(d.$attrs$[u]=o[u]);if(d.$tag$=null,d.$flags$|=4,e.$vnode$=d,d.$elm$=l.$elm$=o.shadowRoot||o,fe=!!(1&c.$flags$)&&!(128&c.$flags$),q=o["s-cr"],me=!1,Te(l,d,i),x.$flags$|=1,ve){Pe(d.$elm$);for(const e of _e){const t=e.$nodeToRelocate$;if(!t["s-ol"]&&S.document){const e=S.document.createTextNode("");e["s-nr"]=t,Ae(t.parentNode,t["s-ol"]=e,t)}}for(const e of _e){const t=e.$nodeToRelocate$,o=e.$slotRefNode$;if(o){const e=o.parentNode;let i=o.nextSibling;{let s=null==(r=t["s-ol"])?void 0:r.previousSibling;for(;s;){let r=null!=(n=s["s-nr"])?n:null;if(r&&r["s-sn"]===t["s-sn"]&&e===(r.__parentNode||r.parentNode)){for(r=r.nextSibling;r===t||(null==r?void 0:r["s-sr"]);)r=null==r?void 0:r.nextSibling;if(!r||!r["s-nr"]){i=r;break}}s=s.previousSibling}}const a=t.__parentNode||t.parentNode,c=t.__nextSibling||t.nextSibling;(!i&&e!==a||c!==i)&&t!==i&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),Ae(e,t,i),1===t.nodeType&&"SLOT-FB"!==t.tagName&&(t.hidden=null!=(s=t["s-ih"])&&s)),t&&"function"===typeof o["s-rf"]&&o["s-rf"](o)}else 1===t.nodeType&&(i&&(t["s-ih"]=null!=(a=t.hidden)&&a),t.hidden=!0)}}me&&V(d.$elm$),x.$flags$&=-2,_e.length=0,q=void 0},Le=(e,t)=>{if(t&&!e.$onRenderResolve$&&t["s-p"]){const i=t["s-p"].push(new Promise(r=>e.$onRenderResolve$=()=>{t["s-p"].splice(i-1,1),r()}))}},Ie=(e,t)=>{if(e.$flags$|=16,4&e.$flags$)return void(e.$flags$|=512);Le(e,e.$ancestorComponent$);return M(()=>Me(e,t))},Me=(e,t)=>{const i=e.$hostElement$,r=(e.$cmpMeta$.$tagName$,()=>{}),n=e.$lazyInstance$;if(!n)throw new Error("Can't render component <".concat(i.tagName.toLowerCase()," /> with invalid Stencil runtime! Make sure this imported component is compiled with a `externalRuntime: true` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime"));let s;return t?(e.$flags$|=256,e.$queuedListeners$&&(e.$queuedListeners$.map(e=>{let[t,r]=e;return He(n,t,r,i)}),e.$queuedListeners$=void 0),s=He(n,"componentWillLoad",void 0,i)):s=He(n,"componentWillUpdate",void 0,i),s=De(s,()=>He(n,"componentWillRender",void 0,i)),r(),De(s,()=>Ne(e,n,t))},De=(e,t)=>Oe(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),Oe=e=>e instanceof Promise||e&&e.then&&"function"===typeof e.then,Ne=async(e,t,i)=>{var r;const n=e.$hostElement$,s=(e.$cmpMeta$.$tagName$,()=>{}),a=n["s-rc"];i&&ae(e);const o=(e.$cmpMeta$.$tagName$,()=>{});Fe(e,t,n,i),a&&(a.map(e=>e()),n["s-rc"]=void 0),o(),s();{const t=null!=(r=n["s-p"])?r:[],i=()=>Be(e);0===t.length?i():(Promise.all(t).then(i),e.$flags$|=4,t.length=0)}},Ue=null,Fe=(e,t,i,r)=>{try{Ue=t,t=t.render(),e.$flags$&=-17,e.$flags$|=2,Re(e,t,r)}catch(n){v(n,e.$hostElement$)}return Ue=null,null},je=()=>Ue,Be=e=>{e.$cmpMeta$.$tagName$;const t=e.$hostElement$,i=()=>{},r=e.$lazyInstance$,n=e.$ancestorComponent$;He(r,"componentDidRender",void 0,t),64&e.$flags$?(He(r,"componentDidUpdate",void 0,t),i()):(e.$flags$|=64,$e(t),He(r,"componentDidLoad",void 0,t),i(),e.$onReadyResolve$(t),n||ze()),e.$onInstanceResolve$(t),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&I(()=>Ie(e,!1)),e.$flags$&=-517},Ve=e=>{{const t=g(e),i=t.$hostElement$.isConnected;return i&&2===(18&t.$flags$)&&Ie(t,!1),i}},ze=e=>{I(()=>ne(S,"appload",{detail:{namespace:"realtimekit-ui"}}))},He=(e,t,i,r)=>{if(e&&e[t])try{return e[t](i)}catch(n){v(n,r)}},$e=e=>{var t;return e.classList.add(null!=(t=l)?t:"hydrated")},Ge=(e,t,i,r)=>{const n=g(e);if(!n)throw new Error("Couldn't find host element for \"".concat(r.$tagName$,'" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).'));const s=n.$hostElement$,a=n.$instanceValues$.get(t),o=n.$flags$,c=n.$lazyInstance$;i=te(i,r.$members$[t][0]);const l=Number.isNaN(a)&&Number.isNaN(i);if((!(8&o)||void 0===a)&&(i!==a&&!l)&&(n.$instanceValues$.set(t,i),c)){if(r.$watchers$&&128&o){const e=r.$watchers$[t];e&&e.map(e=>{try{c[e](i,a,t)}catch(r){v(r,s)}})}if(2===(18&o)){if(c.componentShouldUpdate&&!1===c.componentShouldUpdate(i,a,t))return;Ie(n,!1)}}},We=(e,t,i)=>{var r,n;const s=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const a=Object.entries(null!=(r=t.$members$)?r:{});if(a.map(e=>{let[r,[n]]=e;if(31&n||2&i&&32&n){const{get:e,set:a}=Object.getOwnPropertyDescriptor(s,r)||{};e&&(t.$members$[r][0]|=2048),a&&(t.$members$[r][0]|=4096),(1&i||!e)&&Object.defineProperty(s,r,{get(){{if(0===(2048&t.$members$[r][0]))return((e,t)=>g(e).$instanceValues$.get(t))(this,r);const e=g(this),i=e?e.$lazyInstance$:s;if(!i)return;return i[r]}},configurable:!0,enumerable:!0}),Object.defineProperty(s,r,{set(e){const s=g(this);if(a){const i=32&n?this[r]:s.$hostElement$[r];return"undefined"===typeof i&&s.$instanceValues$.get(r)?e=s.$instanceValues$.get(r):!s.$instanceValues$.get(r)&&i&&s.$instanceValues$.set(r,i),a.apply(this,[te(e,n)]),e=32&n?this[r]:s.$hostElement$[r],void Ge(this,r,e,t)}{if(0===(1&i)||0===(4096&t.$members$[r][0]))return Ge(this,r,e,t),void(1&i&&!s.$lazyInstance$&&s.$onReadyPromise$.then(()=>{4096&t.$members$[r][0]&&s.$lazyInstance$[r]!==s.$instanceValues$.get(r)&&(s.$lazyInstance$[r]=e)}));const a=()=>{const i=s.$lazyInstance$[r];!s.$instanceValues$.get(r)&&i&&s.$instanceValues$.set(r,i),s.$lazyInstance$[r]=te(e,n),Ge(this,r,s.$lazyInstance$[r],t)};s.$lazyInstance$?a():s.$onReadyPromise$.then(()=>a())}}})}else 1&i&&64&n&&Object.defineProperty(s,r,{value(){for(var e=arguments.length,t=new Array(e),i=0;i{var e;return null==(e=s.$lazyInstance$)?void 0:e[r](...t)})}})}),1&i){const i=new Map;s.attributeChangedCallback=function(e,r,n){x.jmp(()=>{var a;const o=i.get(e);if(this.hasOwnProperty(o)&&d)n=this[o],delete this[o];else{if(s.hasOwnProperty(o)&&"number"===typeof this[o]&&this[o]==n)return;if(null==o){const i=g(this),s=null==i?void 0:i.$flags$;if(s&&!(8&s)&&128&s&&n!==r){const s=i.$lazyInstance$,o=null==(a=t.$watchers$)?void 0:a[e];null==o||o.forEach(t=>{null!=s[t]&&s[t].call(s,n,r,e)})}return}}const c=Object.getOwnPropertyDescriptor(s,o);(n=(null!==n||"boolean"!==typeof this[o])&&n)===this[o]||c.get&&!c.set||(this[o]=n)})},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(n=t.$watchers$)?n:{}),...a.filter(e=>{let[t,i]=e;return 15&i[0]}).map(e=>{let[r,n]=e;var s;const a=n[1]||r;return i.set(a,r),512&n[0]&&(null==(s=t.$attrsToReflect$)||s.push([r,a])),a})]))}}return e},qe=async(e,t,r,n)=>{let s;if(0===(32&t.$flags$)){t.$flags$|=32;if(r.$lazyBundleId$){const n=((e,t)=>{const r=e.$tagName$.replace(/-/g,"_"),n=e.$lazyBundleId$;if(!n)return;const s=b.get(n);if(s)return s[r];{const e=e=>(b.set(n,e),e[r]);switch(n){case"rtk-avatar_54":return Promise.resolve().then(function(){return hd}).then(e,v);case"rtk-ai":return Promise.resolve().then(function(){return gd}).then(e,v);case"rtk-ai-toggle":return Promise.resolve().then(function(){return vd}).then(e,v);case"rtk-audio-grid":return Promise.resolve().then(function(){return yd}).then(e,v);case"rtk-audio-tile":return Promise.resolve().then(function(){return Ad}).then(e,v);case"rtk-breakout-rooms-toggle":return Promise.resolve().then(function(){return Id}).then(e,v);case"rtk-camera-toggle":return Promise.resolve().then(function(){return Od}).then(e,v);case"rtk-caption-toggle":return Promise.resolve().then(function(){return Fd}).then(e,v);case"rtk-channel-selector-ui":return Promise.resolve().then(function(){return Vd}).then(e,v);case"rtk-chat-composer-ui":return Promise.resolve().then(function(){return Gd}).then(e,v);case"rtk-chat-selector-ui":return Promise.resolve().then(function(){return Kd}).then(e,v);case"rtk-chat-toggle":return Promise.resolve().then(function(){return th}).then(e,v);case"rtk-clock":return Promise.resolve().then(function(){return sh}).then(e,v);case"rtk-controlbar":return Promise.resolve().then(function(){return ch}).then(e,v);case"rtk-debugger-toggle":return Promise.resolve().then(function(){return hh}).then(e,v);case"rtk-ended-screen":return Promise.resolve().then(function(){return gh}).then(e,v);case"rtk-file-dropzone":return Promise.resolve().then(function(){return vh}).then(e,v);case"rtk-grid":return Promise.resolve().then(function(){return cu}).then(e,v);case"rtk-grid-pagination":return Promise.resolve().then(function(){return hu}).then(e,v);case"rtk-header":return Promise.resolve().then(function(){return gu}).then(e,v);case"rtk-idle-screen":return Promise.resolve().then(function(){return vu}).then(e,v);case"rtk-image-viewer":return Promise.resolve().then(function(){return yu}).then(e,v);case"rtk-information-tooltip":return Promise.resolve().then(function(){return Su}).then(e,v);case"rtk-leave-button":return Promise.resolve().then(function(){return Tu}).then(e,v);case"rtk-livestream-toggle":return Promise.resolve().then(function(){return Cu}).then(e,v);case"rtk-meeting-title":return Promise.resolve().then(function(){return Lu}).then(e,v);case"rtk-message-list-view":return Promise.resolve().then(function(){return Mu}).then(e,v);case"rtk-mic-toggle":return Promise.resolve().then(function(){return Nu}).then(e,v);case"rtk-mixed-grid":return Promise.resolve().then(function(){return ju}).then(e,v);case"rtk-more-toggle":return Promise.resolve().then(function(){return zu}).then(e,v);case"rtk-mute-all-button":return Promise.resolve().then(function(){return Gu}).then(e,v);case"rtk-network-indicator":return Promise.resolve().then(function(){return Ku}).then(e,v);case"rtk-participant-count":return Promise.resolve().then(function(){return Ju}).then(e,v);case"rtk-participant-setup":return Promise.resolve().then(function(){return ep}).then(e,v);case"rtk-participants":return Promise.resolve().then(function(){return rp}).then(e,v);case"rtk-participants-audio":return Promise.resolve().then(function(){return op}).then(e,v);case"rtk-participants-toggle":return Promise.resolve().then(function(){return dp}).then(e,v);case"rtk-pip-toggle":return Promise.resolve().then(function(){return pp}).then(e,v);case"rtk-plugins-toggle":return Promise.resolve().then(function(){return mp}).then(e,v);case"rtk-polls-toggle":return Promise.resolve().then(function(){return kp}).then(e,v);case"rtk-recording-indicator":return Promise.resolve().then(function(){return Sp}).then(e,v);case"rtk-recording-toggle":return Promise.resolve().then(function(){return Tp}).then(e,v);case"rtk-screen-share-toggle":return Promise.resolve().then(function(){return Ap}).then(e,v);case"rtk-screenshare-view":return Promise.resolve().then(function(){return Np}).then(e,v);case"rtk-settings":return Promise.resolve().then(function(){return jp}).then(e,v);case"rtk-settings-toggle":return Promise.resolve().then(function(){return zp}).then(e,v);case"rtk-setup-screen":return Promise.resolve().then(function(){return Gp}).then(e,v);case"rtk-sidebar":return Promise.resolve().then(function(){return Kp}).then(e,v);case"rtk-simple-grid":return Promise.resolve().then(function(){return Jp}).then(e,v);case"rtk-spotlight-grid":return Promise.resolve().then(function(){return eg}).then(e,v);case"rtk-stage":return Promise.resolve().then(function(){return rg}).then(e,v);case"rtk-stage-toggle":return Promise.resolve().then(function(){return ag}).then(e,v);case"rtk-transcripts":return Promise.resolve().then(function(){return lg}).then(e,v);case"rtk-ui-provider":return Promise.resolve().then(function(){return hg}).then(e,v);case"rtk-waiting-screen":return Promise.resolve().then(function(){return gg}).then(e,v);case"rtk-ai-transcriptions":return Promise.resolve().then(function(){return vg}).then(e,v);case"rtk-livestream-indicator_3":return Promise.resolve().then(function(){return rx}).then(e,v);case"rtk-name-tag":return Promise.resolve().then(function(){return ax}).then(e,v);case"rtk-participants-stage-list_4":return Promise.resolve().then(function(){return fx}).then(e,v);case"rtk-plugin-main_2":return Promise.resolve().then(function(){return yx}).then(e,v);case"rtk-plugins_2":return Promise.resolve().then(function(){return Tx}).then(e,v);case"rtk-settings-audio_2":return Promise.resolve().then(function(){return Rx}).then(e,v);case"rtk-transcript":return Promise.resolve().then(function(){return Ix}).then(e,v);case"rtk-audio-visualizer_4":return Promise.resolve().then(function(){return zx}).then(e,v);case"rtk-fullscreen-toggle":return Promise.resolve().then(function(){return Gx}).then(e,v);case"rtk-participant_2":return Promise.resolve().then(function(){return Zx}).then(e,v);case"rtk-camera-selector_2":return Promise.resolve().then(function(){return eE}).then(e,v);case"rtk-poll_2":return Promise.resolve().then(function(){return sE}).then(e,v);case"rtk-sidebar-ui":return Promise.resolve().then(function(){return oE}).then(e,v);case"rtk-spotlight-indicator":return Promise.resolve().then(function(){return dE}).then(e,v);case"rtk-controlbar-button":return Promise.resolve().then(function(){return uE}).then(e,v)}}return i(8054)("./".concat(n,".entry.js")).then(e=>(b.set(n,e),e[r]),e=>{v(e,t.$hostElement$)})})(r,t);if(n&&"then"in n){const e=()=>{};s=await n,e()}else s=n;if(!s)throw new Error('Constructor for "'.concat(r.$tagName$,"#").concat(t.$modeName$,'" was not found'));s.isProxied||(r.$watchers$=s.watchers,We(s,r,2),s.isProxied=!0);const a=(r.$tagName$,()=>{});t.$flags$|=8;try{new s(t)}catch(c){v(c,e)}t.$flags$&=-9,t.$flags$|=128,a(),Ke(t.$lazyInstance$,e)}else{s=e.constructor;const i=e.localName;customElements.whenDefined(i).then(()=>t.$flags$|=128)}if(s&&s.style){let e;"string"===typeof s.style&&(e=s.style);const t=oe(r);if(!k.has(t)){const i=(r.$tagName$,()=>{});((e,t,i)=>{let r=k.get(e);T&&i?(r=r||new CSSStyleSheet,"string"===typeof r?r=t:r.replaceSync(t)):r=t,k.set(e,r)})(t,e,!!(1&r.$flags$)),i()}}}const a=t.$ancestorComponent$,o=()=>Ie(t,!0);a&&a["s-rc"]?a["s-rc"].push(o):o()},Ke=(e,t)=>{He(e,"connectedCallback",void 0,t)},Ze=e=>{if(!S.document)return;const t=e["s-cr"]=S.document.createComment("");t["s-cn"]=!0,Ae(e,t,e.firstChild)},Ye=(e,t)=>{He(e,"disconnectedCallback",void 0,t||e)},Je=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i;if(!S.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const r=()=>{},n=[],s=t.exclude||[],a=S.customElements,o=S.document.head,c=o.querySelector("meta[charset]"),l=S.document.createElement("style"),d=[];let h,u=!0;Object.assign(x,t),x.$resourcesUrl$=new URL(t.resourcesUrl||"./",S.document.baseURI).href;let p=!1;if(e.map(e=>{e[1].map(t=>{var i;const r={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};4&r.$flags$&&(p=!0),r.$members$=t[2],r.$listeners$=t[3],r.$attrsToReflect$=[],r.$watchers$=null!=(i=t[4])?i:{};const o=r.$tagName$,c=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,t)=>{const i={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};i.$onInstancePromise$=new Promise(e=>i.$onInstanceResolve$=e),i.$onReadyPromise$=new Promise(e=>i.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[];const r=i;e.__stencil__getHostRef=()=>r})(e=this,r),1&r.$flags$)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw new Error("Unable to re-use existing shadow root for ".concat(r.$tagName$,"! Mode is set to ").concat(e.shadowRoot.mode," but Stencil only supports open shadow roots."))}else e.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)})}connectedCallback(){const e=g(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,Xe(this,e,r.$listeners$)),h&&(clearTimeout(h),h=null),u?d.push(this):x.jmp(()=>(e=>{if(0===(1&x.$flags$)){const t=g(e),i=t.$cmpMeta$,r=(i.$tagName$,()=>{});if(1&t.$flags$)Xe(e,t,i.$listeners$),(null==t?void 0:t.$lazyInstance$)?Ke(t.$lazyInstance$,e):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Ke(t.$lazyInstance$,e));else{t.$flags$|=1,12&i.$flags$&&Ze(e);{let i=e;for(;i=i.parentNode||i.host;)if(i["s-p"]){Le(t,t.$ancestorComponent$=i);break}}i.$members$&&Object.entries(i.$members$).map(t=>{let[i,[r]]=t;if(31&r&&e.hasOwnProperty(i)){const t=e[i];delete e[i],e[i]=t}}),qe(e,t,i)}r()}})(this))}disconnectedCallback(){x.jmp(()=>(async e=>{if(0===(1&x.$flags$)){const t=g(e);t.$rmListeners$&&(t.$rmListeners$.map(e=>e()),t.$rmListeners$=void 0),(null==t?void 0:t.$lazyInstance$)?Ye(t.$lazyInstance$,e):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Ye(t.$lazyInstance$,e))}se.has(e)&&se.delete(e),e.shadowRoot&&se.has(e.shadowRoot)&&se.delete(e.shadowRoot)})(this)),x.raf(()=>{var e;const t=g(this),i=d.findIndex(e=>e===this);i>-1&&d.splice(i,1),(null==(e=null==t?void 0:t.$vnode$)?void 0:e.$elm$)instanceof Node&&!t.$vnode$.$elm$.isConnected&&delete t.$vnode$.$elm$})}componentOnReady(){return g(this).$onReadyPromise$}};r.$lazyBundleId$=e[0],s.includes(o)||a.get(o)||(n.push(o),a.define(o,We(c,r,1)))})}),n.length>0&&(p&&(l.textContent+=y),l.textContent+=n.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",l.innerHTML.length)){l.setAttribute("data-styles","");const e=null!=(i=x.$nonce$)?i:O(S.document);null!=e&&l.setAttribute("nonce",e),o.insertBefore(l,c?c.nextSibling:o.firstChild)}u=!1,d.length?d.map(e=>e.connectedCallback()):x.jmp(()=>h=setTimeout(ze,30)),r()},Qe=(e,t)=>t,Xe=(e,t,i,r)=>{i&&S.document&&i.map(i=>{let[r,n,s]=i;const a=tt(S.document,e,r),o=et(t,s),c=it(r);x.ael(a,n,o,c),(t.$rmListeners$=t.$rmListeners$||[]).push(()=>x.rel(a,n,o,c))})},et=(e,t)=>i=>{var r;try{256&e.$flags$?null==(r=e.$lazyInstance$)||r[t](i):(e.$queuedListeners$=e.$queuedListeners$||[]).push([t,i])}catch(n){v(n,e.$hostElement$)}},tt=(e,t,i)=>8&i?S:t,it=e=>E?{passive:0!==(1&e),capture:0!==(2&e)}:0!==(2&e);const rt=async(e,t)=>{if("undefined"!==typeof window)return await void 0,Je(JSON.parse('[["rtk-avatar_54",[[1,"rtk-meeting",{"loadConfigFromPreset":[1028,"load-config-from-preset"],"applyDesignSystem":[1028,"apply-design-system"],"mode":[513],"leaveOnUnmount":[4,"leave-on-unmount"],"meeting":[16],"showSetupScreen":[1028,"show-setup-screen"],"t":[16],"config":[1040],"size":[1537],"gridLayout":[1,"grid-layout"],"iconPack":[16]},null,{"meeting":["meetingChanged"],"iconPack":["iconPackChanged"],"t":["tChanged"],"config":["configChanged"]}],[1,"rtk-chat",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"disablePrivateChat":[4,"disable-private-chat"],"privatePresetFilter":[16],"displayFilter":[16],"canPinMessages":[32],"unreadCountGroups":[32],"chatGroups":[32],"selectedGroup":[32],"now":[32],"dropzoneActivated":[32],"showLatestMessageButton":[32],"canSend":[32],"canSendTextMessage":[32],"canSendFiles":[32],"canPrivateMessage":[32],"canSendPrivateTexts":[32],"canSendPrivateFiles":[32],"emojiPickerEnabled":[32],"chatRecipientId":[32],"participants":[32],"selectedParticipant":[32],"channels":[32],"selectedChannelId":[32],"editingMessage":[32],"replyMessage":[32],"searchQuery":[32],"selectorState":[32],"creatingChannel":[32],"showPinnedMessages":[32]},[[8,"editMessageInit","onEditMessageInit"],[0,"switchChannel","channelSwitchListener"]],{"meeting":["meetingChanged"],"chatGroups":["chatGroupsChanged"],"displayFilter":["onDisplayFilterChanged"]}],[1,"rtk-dialog-manager",{"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16]},null,{"meeting":["meetingChanged"]}],[1,"rtk-chat-messages-ui",{"selectedGroup":[1,"selected-group"],"messages":[16],"selfUserId":[1,"self-user-id"],"canPinMessages":[4,"can-pin-messages"],"size":[513],"iconPack":[16],"t":[16],"now":[32],"showLatestMessageButton":[32]},null,{"messages":["chatChanged"],"selectedGroup":["selectedBucketChanged"]}],[1,"rtk-chat-messages-ui-paginated",{"meeting":[16],"selectedChannel":[16],"selectedChannelId":[1,"selected-channel-id"],"size":[513],"iconPack":[16],"t":[16],"leftAlign":[4,"left-align"],"children":[32],"permissionsChanged":[32]},null,{"meeting":["meetingChanged"],"selectedChannelId":["channelChanged"]}],[1,"rtk-chat-search-results",{"meeting":[16],"query":[1],"channelId":[1,"channel-id"],"iconPack":[16],"t":[16]}],[1,"rtk-chat-composer-view",{"canSendTextMessage":[4,"can-send-text-message"],"canSendFiles":[4,"can-send-files"],"message":[1],"quotedMessage":[1,"quoted-message"],"storageKey":[1,"storage-key"],"inputTextPlaceholder":[1,"input-text-placeholder"],"isEditing":[4,"is-editing"],"iconPack":[16],"t":[16],"maxLength":[2,"max-length"],"disableEmojiPicker":[4,"disable-emoji-picker"],"rateLimits":[16],"fileToUpload":[32],"isEmojiPickerOpen":[32],"disableSendButton":[32],"rateLimitsBreached":[32]}],[0,"rtk-channel-header",{"meeting":[16],"channel":[16],"iconPack":[16],"t":[16],"showBackButton":[4,"show-back-button"],"showChannelDetailsDialog":[32],"showSearchBar":[32],"members":[32]},null,{"channel":["onChannelChanged"]}],[1,"rtk-channel-selector-view",{"channels":[16],"selectedChannelId":[1,"selected-channel-id"],"disableSearch":[4,"disable-search"],"hideAvatar":[4,"hide-avatar"],"iconPack":[16],"t":[16],"viewAs":[1,"view-as"],"searchQuery":[32],"showDropdown":[32]}],[1,"rtk-notifications",{"meeting":[16],"states":[16],"config":[16],"t":[16],"size":[513],"iconPack":[16],"notifications":[32],"paused":[32]},[[8,"rtkApiError","apiErrorListener"],[8,"rtkSendNotification","sendNotificationListener"]],{"meeting":["meetingChanged"],"config":["configChanged"],"states":["statesChanged"]}],[1,"rtk-chat-message",{"message":[16],"isContinued":[4,"is-continued"],"child":[16],"isUnread":[4,"is-unread"],"size":[513],"iconPack":[16],"t":[16],"isSelf":[4,"is-self"],"canEdit":[4,"can-edit"],"canDelete":[4,"can-delete"],"canReply":[4,"can-reply"],"canPin":[4,"can-pin"],"disableControls":[4,"disable-controls"],"alignRight":[4,"align-right"],"senderDisplayPicture":[1,"sender-display-picture"],"hideAvatar":[4,"hide-avatar"],"leftAlign":[4,"left-align"],"now":[32]}],[1,"rtk-breakout-rooms-manager",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"loading":[32],"roomConfig":[32],"draftState":[32],"assigningParticipants":[32],"selectedParticipants":[32],"ephemeralStatusText":[32],"isDragMode":[32]},[[0,"participantDelete","onParticipantDelete"],[0,"participantsDragging","toggleDragMode"],[0,"selectedParticipantsUpdate","updateSelectedParticipants"],[0,"allParticipantsToggleUpdate","updateAllParticipants"]],{"selectedParticipants":["onSelectedParticipantsChanged"]}],[1,"rtk-debugger",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"activeTab":[32],"isMobileMainVisible":[32],"progress":[32]},[[0,"testProgress","progressUpdate"]]],[1,"rtk-channel-creator",{"meeting":[16],"t":[16],"iconPack":[16],"channelName":[32],"searchQuery":[32],"step":[32],"loading":[32],"selectedMemberIds":[32],"focusedMemberIndex":[32],"showAllMembersList":[32]}],[1,"rtk-channel-details",{"channel":[16],"t":[16],"iconPack":[16],"members":[16]}],[1,"rtk-draft-attachment-view",{"iconPack":[16],"t":[16],"attachment":[16],"filePreview":[32]},null,{"attachment":["onAttachmentChange"]}],[1,"rtk-emoji-picker-button",{"iconPack":[16],"t":[16],"isActive":[4,"is-active"]}],[1,"rtk-file-picker-button",{"filter":[1],"label":[1],"icon":[1],"iconPack":[16],"t":[16]}],[1,"rtk-broadcast-message-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"messagePayload":[32],"successMessage":[32]}],[1,"rtk-join-stage",{"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"dataConfig":[16],"isLoading":[32]}],[1,"rtk-notification",{"notification":[16],"paused":[4],"size":[513],"iconPack":[16],"t":[16],"imageState":[32]},null,{"paused":["pausedChanged"],"notification":["notificationChanged"]}],[1,"rtk-permissions-message",{"meeting":[16],"t":[16],"iconPack":[16],"states":[16],"device":[32],"currentStep":[32],"svgSteps":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-confirmation-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16]}],[1,"rtk-leave-meeting",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"canEndMeeting":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-mute-all-confirmation",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"allowUnmute":[32]}],[1,"rtk-overlay-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16]}],[1,"rtk-text-composer-view",{"disabled":[4],"placeholder":[1],"value":[1],"maxLength":[2,"max-length"],"rateLimitBreached":[4,"rate-limit-breached"],"keyDownHandler":[16],"iconPack":[16],"t":[16],"maxLengthBreached":[32],"setText":[64]}],[1,"rtk-message-view",{"actions":[16],"variant":[1],"viewType":[1,"view-type"],"avatarUrl":[1,"avatar-url"],"hideAvatar":[4,"hide-avatar"],"authorName":[1,"author-name"],"hideAuthorName":[4,"hide-author-name"],"hideMetadata":[4,"hide-metadata"],"time":[16],"iconPack":[16]}],[1,"rtk-breakout-room-manager",{"meeting":[16],"assigningParticipants":[4,"assigning-participants"],"mode":[1],"states":[16],"allowDelete":[4,"allow-delete"],"iconPack":[16],"t":[16],"isDragMode":[4,"is-drag-mode"],"room":[16],"defaultExpanded":[4,"default-expanded"],"editingTitleRoomId":[32],"newTitle":[32],"showExpandedCard":[32],"glowingCard":[32]}],[1,"rtk-breakout-room-participants",{"meeting":[16],"participantIds":[16],"iconPack":[16],"t":[16],"selectedParticipantIds":[16],"search":[32],"participantsToShow":[32],"isDragging":[32]},null,{"meeting":["meetingChanged"],"participantIds":["participantsChanged"],"search":["searchChanged"]}],[1,"rtk-emoji-picker",{"iconPack":[16],"t":[16],"focusWhenOpened":[4,"focus-when-opened"],"emojiList":[32],"filterVal":[32],"filteredEmojis":[32]}],[0,"rtk-image-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"],"status":[32]}],[1,"rtk-image-message-view",{"url":[1],"iconPack":[16],"t":[16],"status":[32]}],[1,"rtk-paginated-list",{"pageSize":[2,"page-size"],"pagesAllowed":[2,"pages-allowed"],"fetchData":[16],"createNodes":[16],"selectedItemId":[1,"selected-item-id"],"autoScroll":[4,"auto-scroll"],"iconPack":[16],"t":[16],"emptyListLabel":[1,"empty-list-label"],"isLoading":[32],"rerenderBoolean":[32],"shouldRenderNewNodes":[32],"hasNewNodesToRender":[32],"showEmptyListLabel":[32],"onNewNode":[64],"onNodeDelete":[64],"onNodeUpdate":[64]},null,{"selectedItemId":["onItemChanged"]}],[1,"rtk-counter",{"size":[513],"value":[2],"minValue":[2,"min-value"],"iconPack":[16],"t":[16],"input":[32]},null,{"input":["watchStateHandler"]}],[0,"rtk-file-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"]}],[1,"rtk-file-message-view",{"name":[1],"size":[2],"url":[1],"iconPack":[16]}],[1,"rtk-debugger-audio",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"audioProducerFormattedStats":[32],"audioProducerScoreStats":[32],"networkBasedMediaHealth":[32],"devicesHealth":[32]},null,{"audioProducerScoreStats":["audioProducerScoreStatsChanged"],"meeting":["meetingChanged"]}],[1,"rtk-debugger-screenshare",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"videoProducerFormattedStats":[32],"videoProducerScoreStats":[32],"audioProducerFormattedStats":[32],"audioProducerScoreStats":[32],"networkBasedMediaHealth":[32]},null,{"videoProducerScoreStats":["videoProducerScoreStatsChanged"],"audioProducerScoreStats":["audioProducerScoreStatsChanged"],"meeting":["meetingChanged"]}],[1,"rtk-debugger-system",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isBatterySectionOpen":[32],"batterySectionHealth":[32],"battery":[32],"batteryFormattedStats":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-debugger-video",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"videoProducerFormattedStats":[32],"videoProducerScoreStats":[32],"networkBasedMediaHealth":[32],"devicesHealth":[32]},null,{"videoProducerScoreStats":["videoProducerScoreStatsChanged"],"meeting":["meetingChanged"]}],[0,"rtk-text-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"]}],[1,"rtk-dialog",{"hideCloseButton":[4,"hide-close-button"],"disableEscapeKey":[4,"disable-escape-key"],"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"open":[1540]}],[1,"rtk-logo",{"logoUrl":[1025,"logo-url"],"config":[16],"meeting":[16],"t":[16]},null,{"config":["configChanged"],"meeting":["meetingChanged"]}],[0,"rtk-text-message-view",{"text":[1],"isMarkdown":[4,"is-markdown"]}],[1,"rtk-markdown-view",{"text":[1],"maxLength":[2,"max-length"]}],[1,"rtk-menu",{"size":[513],"placement":[1],"offset":[2],"iconPack":[16],"t":[16]}],[1,"rtk-menu-item",{"size":[513],"iconPack":[16],"t":[16]}],[1,"rtk-menu-list",{"iconPack":[16],"t":[16]}],[1,"rtk-avatar",{"participant":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"imageState":[32]}],[1,"rtk-tooltip",{"label":[1],"variant":[513],"disabled":[516],"open":[516],"kind":[513],"size":[513],"placement":[1],"delay":[2],"isInFocus":[32]},null,{"open":["openChanged"]}],[1,"rtk-spinner",{"iconPack":[16],"size":[513]}],[17,"rtk-button",{"size":[513],"variant":[513],"kind":[513],"reverse":[516],"disabled":[516],"type":[513]}],[1,"rtk-icon",{"icon":[1],"variant":[513],"size":[513]}]]],["rtk-participants",[[1,"rtk-participants",{"meeting":[16],"states":[16],"config":[16],"size":[513],"iconPack":[16],"defaultParticipantsTabId":[1,"default-participants-tab-id"],"t":[16],"currentParticipantsTabId":[32],"tabs":[32],"hasRequests":[32],"search":[32]},null,{"meeting":["meetingChanged"],"currentParticipantsTabId":["currentParticipantsTabIdChanged"]}]]],["rtk-settings",[[1,"rtk-settings",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"activeTab":[32],"isMobileMainVisible":[32],"networkStatus":[32],"canProduceVideo":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-grid",[[1,"rtk-grid",{"layout":[513],"aspectRatio":[513,"aspect-ratio"],"meeting":[16],"gap":[514],"size":[513],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16],"overrides":[8],"participants":[32],"pinnedParticipants":[32],"screenShareParticipants":[32],"plugins":[32],"emptyStage":[32],"showLiveStreamPlayer":[32],"canCurrentPeerHost":[32],"pipSupported":[32],"pipEnabled":[32],"hidden":[32],"roomState":[32]},null,{"meeting":["meetingChanged"],"overrides":["overridesChanged"],"screenShareParticipants":["screenShareParticipantsChanged"],"plugins":["pluginsChanged"],"pinnedParticipants":["pinnedParticipantsChanged"]}]]],["rtk-sidebar",[[1,"rtk-sidebar",{"enabledSections":[1040],"defaultSection":[1,"default-section"],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"size":[513],"view":[513],"currentTab":[32],"isFloating":[32],"enablePinning":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"view":["viewChanged"]}]]],["rtk-chat-composer-ui",[[1,"rtk-chat-composer-ui",{"canSendTextMessage":[4,"can-send-text-message"],"canSendFiles":[4,"can-send-files"],"size":[513],"iconPack":[16],"t":[16],"disableEmojiPicker":[4,"disable-emoji-picker"],"prefill":[16],"members":[16],"channelId":[1,"channel-id"],"emojiPickerActive":[32],"mentionQuery":[32],"focusedMemberIndex":[32],"filePreview":[32]},null,{"channelId":["onChannelChanged"]}]]],["rtk-mixed-grid",[[1,"rtk-mixed-grid",{"layout":[513],"participants":[16],"pinnedParticipants":[16],"screenShareParticipants":[16],"plugins":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16],"activeTab":[32],"initialised":[32]},null,{"meeting":["meetingChanged"],"screenShareParticipants":["screenShareParticipantsChanged"],"plugins":["pluginsChanged"]}]]],["rtk-setup-screen",[[1,"rtk-setup-screen",{"meeting":[16],"states":[16],"size":[513],"config":[16],"iconPack":[16],"t":[16],"displayName":[32],"isJoining":[32],"canEditName":[32],"canProduceAudio":[32],"connectionState":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-audio-tile",[[1,"rtk-audio-tile",{"meeting":[16],"config":[16],"size":[513],"states":[16],"iconPack":[16],"t":[16],"participant":[16],"audioEnabled":[32],"volume":[32]},null,{"participant":["participantChanged"]}]]],["rtk-camera-toggle",[[1,"rtk-camera-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"videoEnabled":[32],"canProduceVideo":[32],"cameraPermission":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-channel-selector-ui",[[1,"rtk-channel-selector-ui",{"channels":[16],"selectedChannelId":[1,"selected-channel-id"],"iconPack":[16],"t":[16],"showRecentMessage":[4,"show-recent-message"],"isHidden":[32],"searchQuery":[32]}]]],["rtk-mic-toggle",[[1,"rtk-mic-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"audioEnabled":[32],"canProduceAudio":[32],"micPermission":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-mute-all-button",[[1,"rtk-mute-all-button",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"canDisable":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-screen-share-toggle",[[1,"rtk-screen-share-toggle",{"states":[16],"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"maxScreenShareCount":[32],"screenShareCount":[32],"screenShareEnabled":[32],"canScreenShare":[32],"shareScreenPermission":[32],"screenShareState":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-stage-toggle",[[1,"rtk-stage-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"states":[16],"t":[16],"stageStatus":[32],"state":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-ai",[[1,"rtk-ai",{"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"size":[513],"view":[513]},null,{"view":["viewChanged"]}]]],["rtk-ai-toggle",[[1,"rtk-ai-toggle",{"variant":[513],"states":[16],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"aiActive":[32]},null,{"states":["statesChanged"]}]]],["rtk-breakout-rooms-toggle",[[1,"rtk-breakout-rooms-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"canToggle":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-caption-toggle",[[1,"rtk-caption-toggle",{"variant":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"size":[513],"t":[16],"captionEnabled":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-chat-toggle",[[1,"rtk-chat-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"unreadMessageCount":[32],"chatActive":[32],"canViewChat":[32],"hasNewMessages":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"chatActive":["handleChatActiveChange"]}]]],["rtk-debugger-toggle",[[1,"rtk-debugger-toggle",{"variant":[513],"meeting":[16],"states":[16],"t":[16],"iconPack":[16],"size":[513]}]]],["rtk-grid-pagination",[[1,"rtk-grid-pagination",{"meeting":[16],"states":[16],"size":[513],"variant":[513],"iconPack":[16],"t":[16],"page":[32],"pageCount":[32],"activeCount":[32],"activeComputedCount":[32],"showPagination":[32]},null,{"meeting":["meetingChanged"],"size":["sizeChanged"]}]]],["rtk-idle-screen",[[1,"rtk-idle-screen",{"meeting":[16],"config":[16],"iconPack":[16],"t":[16]}]]],["rtk-leave-button",[[1,"rtk-leave-button",{"variant":[513],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-livestream-toggle",[[1,"rtk-livestream-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"livestreamState":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-more-toggle",[[1,"rtk-more-toggle",{"states":[16],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-participants-audio",[[1,"rtk-participants-audio",{"meeting":[16],"iconPack":[16],"t":[16],"preloadedAudioElem":[16],"showPlayDialog":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-participants-toggle",[[1,"rtk-participants-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"participantsActive":[32],"waitlistedParticipants":[32],"stageRequestedParticipants":[32],"badgeCount":[32],"canViewParticipants":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"participantsActive":["handleParticipantsActiveChange"]}]]],["rtk-pip-toggle",[[1,"rtk-pip-toggle",{"variant":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"size":[513],"t":[16],"pipSupported":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-plugins-toggle",[[1,"rtk-plugins-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"pluginsActive":[32],"canViewPlugins":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"pluginsActive":["handlePluginsActiveChange"]}]]],["rtk-polls-toggle",[[1,"rtk-polls-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"pollsActive":[32],"unreadPollsCount":[32],"canViewPolls":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"pollsActive":["handlePollsActiveChange"]}]]],["rtk-recording-toggle",[[1,"rtk-recording-toggle",{"variant":[513],"meeting":[16],"t":[16],"iconPack":[16],"size":[513],"disabled":[4],"recordingState":[32],"canRecord":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-screenshare-view",[[1,"rtk-screenshare-view",{"hideFullScreenButton":[4,"hide-full-screen-button"],"nameTagPosition":[513,"name-tag-position"],"participant":[16],"meeting":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"videoExpanded":[32],"screenShareEnabled":[32],"isFullScreen":[32],"remoteControlInfo":[32]},null,{"participant":["participantChanged"]}]]],["rtk-settings-toggle",[[1,"rtk-settings-toggle",{"variant":[513],"states":[16],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-ended-screen",[[1,"rtk-ended-screen",{"config":[16],"size":[513],"states":[16],"t":[16],"iconPack":[16],"meeting":[16],"icon":[32],"message":[32]},null,{"states":["statesChanged"]}]]],["rtk-image-viewer",[[1,"rtk-image-viewer",{"image":[16],"size":[513],"t":[16],"iconPack":[16]}]]],["rtk-message-list-view",[[0,"rtk-message-list-view",{"messages":[16],"renderer":[16],"loadMore":[16],"visibleItemsCount":[2,"visible-items-count"],"estimateItemSize":[2,"estimate-item-size"],"iconPack":[16],"range":[32],"isFetching":[32],"autoScroll":[32],"totalHeight":[32]},null,{"messages":["messagesUpdated"]}]]],["rtk-chat-selector-ui",[[1,"rtk-chat-selector-ui",{"selfUserId":[1,"self-user-id"],"selectedGroupId":[1,"selected-group-id"],"unreadCounts":[16],"groups":[16],"iconPack":[16],"t":[16],"showParticipantsPanel":[32],"query":[32]}]]],["rtk-clock",[[1,"rtk-clock",{"meeting":[16],"iconPack":[16],"size":[513],"startedTime":[32],"timeDiff":[32]},null,{"meeting":["meetingChanged"],"startedTime":["startedTimeChanged"]}]]],["rtk-file-dropzone",[[1,"rtk-file-dropzone",{"hostEl":[16],"iconPack":[16],"t":[16],"dropzoneActivated":[32]}]]],["rtk-information-tooltip",[[1,"rtk-information-tooltip",{"iconPack":[16]}]]],["rtk-meeting-title",[[1,"rtk-meeting-title",{"meeting":[16],"iconPack":[16],"t":[16]}]]],["rtk-network-indicator",[[1,"rtk-network-indicator",{"participant":[16],"meeting":[16],"iconPack":[16],"t":[16],"isScreenShare":[4,"is-screen-share"],"score":[32]},null,{"participant":["participantChanged"]}]]],["rtk-participant-count",[[1,"rtk-participant-count",{"meeting":[16],"iconPack":[16],"t":[16],"size":[513],"participantCount":[32],"isViewer":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-recording-indicator",[[1,"rtk-recording-indicator",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"isRecording":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-transcript",[[1,"rtk-transcript",{"transcript":[16],"t":[16],"timeout":[32]},null,{"transcript":["transcriptChanged"]}]]],["rtk-transcripts",[[1,"rtk-transcripts",{"meeting":[16],"states":[16],"config":[16],"t":[16],"transcripts":[32],"listenerAttached":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"]}]]],["rtk-waiting-screen",[[1,"rtk-waiting-screen",{"meeting":[16],"config":[16],"iconPack":[16],"t":[16]}]]],["rtk-audio-grid",[[1,"rtk-audio-grid",{"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"size":[513],"t":[16],"hideSelf":[4,"hide-self"],"activeParticipants":[32],"onStageParticipants":[32],"offStageParticipants":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-controlbar",[[1,"rtk-controlbar",{"variant":[513],"disableRender":[4,"disable-render"],"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"t":[16],"size":[513]}]]],["rtk-header",[[1,"rtk-header",{"variant":[513],"disableRender":[4,"disable-render"],"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"t":[16],"size":[513]}]]],["rtk-participant-setup",[[1,"rtk-participant-setup",{"nameTagPosition":[513,"name-tag-position"],"isPreview":[4,"is-preview"],"participant":[16],"states":[16],"config":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"videoState":[32],"isPinned":[32]},null,{"participant":["participantsChanged"],"videoState":["videoStateChanged"]}]]],["rtk-simple-grid",[[1,"rtk-simple-grid",{"participants":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"dimensions":[32],"mediaConnection":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-spotlight-grid",[[1,"rtk-spotlight-grid",{"layout":[513],"participants":[16],"pinnedParticipants":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16]}]]],["rtk-stage",[[1,"rtk-stage",{"iconPack":[16],"t":[16]}]]],["rtk-ui-provider",[[4,"rtk-ui-provider",{"meeting":[16],"iconPack":[16],"t":[16],"config":[16],"mode":[513],"showSetupScreen":[4,"show-setup-screen"]},null,{"meeting":["meetingChanged"],"iconPack":["iconPackChanged"],"t":["tChanged"],"config":["configChanged"]}]]],["rtk-ai-transcriptions",[[1,"rtk-ai-transcriptions",{"t":[16],"meeting":[16],"initialTranscriptions":[16],"participantQuery":[32],"isProcessing":[32],"transcriptions":[32]},null,{"meeting":["meetingChanged"],"transcriptions":["transcriptionsChanged"]}]]],["rtk-name-tag",[[1,"rtk-name-tag",{"participant":[16],"meeting":[16],"size":[513],"isScreenShare":[4,"is-screen-share"],"variant":[513],"iconPack":[16],"t":[16],"length":[32]},null,{"size":["sizeChanged"]}]]],["rtk-settings-audio_2",[[1,"rtk-settings-audio",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16]}],[1,"rtk-settings-video",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"videoEnabled":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-spotlight-indicator",[[1,"rtk-spotlight-indicator",{"meeting":[16],"iconPack":[16],"t":[16],"size":[513],"canSpotlight":[32],"isSpotlighted":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-poll_2",[[1,"rtk-poll-form",{"iconPack":[16],"t":[16],"options":[32],"anonymous":[32],"hideVotes":[32],"error":[32]}],[1,"rtk-poll",{"poll":[16],"self":[1],"permissions":[16],"iconPack":[16],"t":[16]}]]],["rtk-plugins_2",[[1,"rtk-polls",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"create":[32],"polls":[32],"permissions":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-plugins",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"plugins":[32],"canStartPlugins":[32],"canClosePlugins":[32],"activatedPluginsId":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-plugin-main_2",[[1,"rtk-tab-bar",{"size":[513],"meeting":[16],"states":[16],"config":[16],"layout":[513],"iconPack":[16],"t":[16],"activeTab":[16],"tabs":[16]}],[1,"rtk-plugin-main",{"meeting":[16],"plugin":[16],"iconPack":[16],"t":[16],"canClosePlugin":[32],"viewModeEnabled":[32]},null,{"meeting":["meetingChanged"],"plugin":["pluginChanged"]}]]],["rtk-fullscreen-toggle",[[1,"rtk-fullscreen-toggle",{"states":[16],"targetElement":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"fullScreenActive":[32],"isFullScreenSupported":[32]}]]],["rtk-sidebar-ui",[[1,"rtk-sidebar-ui",{"view":[513],"tabs":[16],"hideHeader":[4,"hide-header"],"hideCloseAction":[4,"hide-close-action"],"currentTab":[1,"current-tab"],"iconPack":[16],"focusCloseButton":[4,"focus-close-button"],"t":[16]},null,{"currentTab":["handleFocusCloseButton"]}]]],["rtk-livestream-indicator_3",[[1,"rtk-livestream-player",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"playbackUrl":[32],"isSupported":[32],"playerState":[32],"livestreamState":[32],"playerError":[32],"livestreamId":[32],"audioPlaybackError":[32],"qualityLevels":[32],"selectedQuality":[32],"currentTime":[32],"duration":[32],"hideControls":[32],"isDragging":[32],"seekPosition":[32],"isSeeking":[32]},null,{"livestreamState":["updateLivestreamId"],"meeting":["meetingChanged"]}],[1,"rtk-livestream-indicator",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"isLivestreaming":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-viewer-count",{"meeting":[16],"variant":[513],"iconPack":[16],"t":[16],"viewerCount":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-participant_2",[[1,"rtk-participant",{"meeting":[16],"states":[16],"view":[1],"participant":[16],"iconPack":[16],"t":[16],"config":[16],"audioEnabled":[32],"videoEnabled":[32],"isPinned":[32],"isHidden":[32],"isOnStage":[32],"canDisableParticipantAudio":[32],"canDisableParticipantVideo":[32],"canKickParticipant":[32],"canPinParticipant":[32],"canAllowParticipantOnStage":[32],"menuOpen":[32]},null,{"meeting":["meetingChanged"],"participant":["participantChanged"]}],[0,"rtk-virtualized-participant-list",{"items":[16],"renderItem":[16],"itemHeight":[1026,"item-height"],"bufferedItemsCount":[2,"buffered-items-count"],"emptyListElement":[16],"visibleStart":[32],"visibleEnd":[32]},null,{"items":["itemsChanged"]}]]],["rtk-participants-stage-list_4",[[1,"rtk-participants-viewer-list",{"meeting":[16],"config":[16],"size":[513],"hideHeader":[4,"hide-header"],"iconPack":[16],"view":[1],"search":[1],"t":[16],"stageViewers":[32]},null,{"meeting":["meetingChanged"],"search":["searchChanged"]}],[1,"rtk-participants-stage-queue",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"view":[1],"t":[16],"stageRequestedParticipants":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-participants-waiting-list",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"view":[1],"t":[16],"waitlistedParticipants":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-participants-stage-list",{"meeting":[16],"states":[16],"config":[16],"size":[513],"hideHeader":[4,"hide-header"],"iconPack":[16],"view":[1],"t":[16],"search":[1],"participants":[32]},null,{"meeting":["meetingChanged"],"search":["searchChanged"]}]]],["rtk-camera-selector_2",[[1,"rtk-participant-tile",{"nameTagPosition":[513,"name-tag-position"],"isPreview":[4,"is-preview"],"participant":[16],"meeting":[16],"states":[16],"config":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"isPinned":[32],"mediaConnectionError":[32]},null,{"meeting":["meetingChanged"],"participant":["participantsChanged"]}],[1,"rtk-camera-selector",{"meeting":[16],"size":[513],"iconPack":[16],"variant":[1],"t":[16],"videoDevices":[32],"currentDevice":[32],"canProduceVideo":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-audio-visualizer_4",[[1,"rtk-audio-visualizer",{"variant":[513],"participant":[16],"size":[513],"iconPack":[16],"t":[16],"hideMuted":[4,"hide-muted"],"isScreenShare":[4,"is-screen-share"],"audioEnabled":[32],"volume":[32]},null,{"participant":["participantChanged"]}],[1,"rtk-speaker-selector",{"meeting":[16],"states":[16],"variant":[1],"size":[513],"iconPack":[16],"t":[16],"speakerDevices":[32],"currentDevices":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-microphone-selector",{"meeting":[16],"size":[513],"iconPack":[16],"variant":[1],"t":[16],"audioinputDevices":[32],"canProduceAudio":[32],"currentDevices":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-switch",{"checked":[1028],"readonly":[4],"disabled":[516],"iconPack":[16],"t":[16]},null,{"checked":["checkedChange"]}]]],["rtk-controlbar-button",[[17,"rtk-controlbar-button",{"variant":[513],"showWarning":[4,"show-warning"],"size":[513],"label":[1],"icon":[1],"isLoading":[4,"is-loading"],"disabled":[516],"iconPack":[16],"brandIcon":[516,"brand-icon"]}]]]]'),t)},nt=e=>!!at(e)&&("LIVESTREAM"===e.meta.viewType&&"ON_STAGE"!==e.stage.status),st=e=>{var t;return!!at(e)&&("LIVESTREAM"===e.meta.viewType&&(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.canLivestream))},at=e=>null===e||void 0===e?void 0:e.livestream;var ot,ct;!function(e){e.BUFFERING="Buffering",e.ENDED="Ended",e.IDLE="Idle",e.PAUSED="Paused",e.PLAYING="Playing",e.READY="Ready"}(ot||(ot={})),function(e){e.INITIALIZED="PlayerInitialized",e.QUALITY_CHANGED="PlayerQualityChanged",e.DURATION_CHANGED="PlayerDurationChanged",e.VOLUME_CHANGED="PlayerVolumeChanged",e.MUTED_CHANGED="PlayerMutedChanged",e.PLAYBACK_RATE_CHANGED="PlayerPlaybackRateChanged",e.REBUFFERING="PlayerRebuffering",e.AUDIO_BLOCKED="PlayerAudioBlocked",e.PLAYBACK_BLOCKED="PlayerPlaybackBlocked",e.ERROR="PlayerError",e.RECOVERABLE_ERROR="PlayerRecoverableError",e.ANALYTICS_EVENT="PlayerAnalyticsEvent",e.TIME_UPDATE="PlayerTimeUpdate",e.BUFFER_UPDATE="PlayerBufferUpdate",e.SEEK_COMPLETED="PlayerSeekCompleted",e.SESSION_DATA="PlayerSessionData",e.STATE_CHANGED="PlayerStateChanged",e.WORKER_ERROR="PlayerWorkerError",e.METADATA="PlayerMetadata",e.TEXT_CUE="PlayerTextCue",e.TEXT_METADATA_CUE="PlayerTextMetadataCue",e.AD_CUE="PlayerAdCue",e.STREAM_SOURCE_CUE="PlayerStreamSourceCue",e.NETWORK_UNAVAILABLE="PlayerNetworkUnavailable",e.SEGMENT_DISCONTINUITY="PlayerSegmentDiscontinuity",e.SEGMENT_METADATA="PlayerSegmentMetadata",e.PLAYER_METADATA="PlayerMetadata"}(ct||(ct={}));const lt="play_participant_tile_video_on_pause",dt="disable_emoji_picker",ht="disable_kicking",ut="admin_cantremove_admin",pt="cantinvite_viewer",gt="pinned_msgs",ft=e=>{var t;return"CHAT"===(null===e||void 0===e?void 0:e.meta.viewType)||at(e)||(null===(t=null===e||void 0===e?void 0:e.__internals__)||void 0===t?void 0:t.features.hasFeature("feat_paginated_chat"))},mt=e=>{var t,i;return(null===(t=null===e||void 0===e?void 0:e.__internals__)||void 0===t?void 0:t.browserSpecs.isFirefox())&&(null===(i=null===e||void 0===e?void 0:e.__internals__)||void 0===i?void 0:i.features.hasFeature("disable_firefox_setting_sink_id"))};let vt=0;const bt="temp-";function kt(e){return e.includes(bt)}function yt(e){var t;return null!==(t=e.customParticipantId)&&void 0!==t?t:e.clientSpecificId}function wt(e){const t=new Map;return[e.self,...e.participants.joined.toArray()].map(e=>{t.set(yt(e),e.picture)}),[e.connectedMeetings.parentMeeting,...e.connectedMeetings.meetings].flatMap(e=>e.participants).map(e=>({id:e.id,customParticipantId:yt(e),displayName:e.displayName,displayPictureUrl:""!==e.displayPictureUrl?e.displayPictureUrl:t.get(yt(e))}))}const St=e=>{if(!(e=>e.connectedMeetings.supportsConnectedMeetings)(e))return!1;const t=e.self.permissions.connectedMeetings;return!!t.canAlterConnectedMeetings||!(!t.canSwitchConnectedMeetings&&!t.canSwitchToParentMeeting)&&e.connectedMeetings.isActive};var xt,Et,Tt,_t,Pt,Ct,At,Rt,Lt,It,Mt,Dt,Ot,Nt,Ut,Ft=function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i},jt=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class Bt{constructor(){xt.add(this),Et.set(this,!1),Tt.set(this,void 0),_t.set(this,void 0),Pt.set(this,void 0),Ct.set(this,void 0),At.set(this,void 0),Rt.set(this,void 0),Lt.set(this,void 0),It.set(this,void 0)}get hasLocalChanges(){return jt(this,Et,"f")}get currentState(){let e,t=[];return Array.from(jt(this,Ct,"f").keys()).forEach(i=>{const r=jt(this,Rt,"f").get(i);r.isParent?e=Object.assign(Object.assign({},r),{participants:jt(this,xt,"m",Ut).call(this,i)}):t.push(Object.assign(Object.assign({},r),{participants:jt(this,xt,"m",Ut).call(this,i)}))}),{parentMeeting:e,meetings:t}}get allConnectedMeetings(){return this.currentState.meetings.sort((e,t)=>e.title.localeCompare(t.title))}get allParticipants(){return Array.from(jt(this,At,"f").values())}get unassignedParticipants(){return jt(this,xt,"m",Ut).call(this,jt(this,Tt,"f").parentMeeting.id)}getParticipantsForMeeting(e){return jt(this,xt,"m",Ut).call(this,e)}addNewMeeting(){Ft(this,Et,!0,"f");const e=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);nthis.addNewMeeting())}updateMeetingTitle(e,t){jt(this,Rt,"f").get(e).title=t,kt(e)||jt(this,Lt,"f").add(e)}deleteMeeting(e){Ft(this,Et,!0,"f");const t=jt(this,Rt,"f").get(e),i=jt(this,xt,"m",Ut).call(this,t.id).map(yt);this.assignParticipantsToMeeting(i,jt(this,Tt,"f").parentMeeting.id),jt(this,Rt,"f").delete(t.id),jt(this,Ct,"f").delete(t.id),kt(t.id)||jt(this,It,"f").add(t.id)}assignParticipantsToMeeting(e,t){return Ft(this,Et,!0,"f"),e.forEach(e=>{const i=jt(this,_t,"f").get(e);jt(this,Ct,"f").get(i).delete(e),jt(this,Ct,"f").get(t).add(e),jt(this,_t,"f").set(e,t)}),this.currentState}assignParticipantsRandomly(){const e=function(e,t){const i=e.length,r=Math.ceil(i/t),n=new Array(t);let s=0;for(let a=0;ae.length)}(this.unassignedParticipants,this.allConnectedMeetings.length);return this.allConnectedMeetings.forEach((t,i)=>{const r=e[i];r&&0!==r.length&&this.assignParticipantsToMeeting(r.map(e=>e.customParticipantId),t.id)}),this.currentState}unassignParticipants(e){const t=jt(this,Tt,"f").parentMeeting.id;return this.assignParticipantsToMeeting(e,t)}unassignAllParticipants(){const e=jt(this,Tt,"f").parentMeeting.id,t=this.allParticipants.map(yt);return this.assignParticipantsToMeeting(t,e)}updateCurrentState(e){jt(this,Et,"f")||jt(this,xt,"m",Mt).call(this,e),[e.parentMeeting,...e.meetings].forEach((e,t)=>{const i=Object.assign(Object.assign({},e),{isParent:0===t});jt(this,xt,"m",Dt).call(this,i),e.participants.forEach(e=>{jt(this,xt,"m",Ot).call(this,e,i)})})}get meetingsToCreate(){return this.allConnectedMeetings.filter(e=>kt(e.id)).map(e=>{let{id:t,title:i}=e;return{id:t,title:i}})}get meetingsToUpdate(){return this.allConnectedMeetings.filter(e=>jt(this,Lt,"f").has(e.id)).map(e=>{let{id:t,title:i}=e;return{id:t,title:i}})}get meetingsToDelete(){return Array.from(jt(this,It,"f"))}get participantsToMove(){const e=new Map;return Array.from(jt(this,_t,"f").keys()).forEach(t=>{const i=jt(this,Pt,"f").get(t),r=jt(this,_t,"f").get(t);if(i===r)return;const n="".concat(i,"__").concat(r);e.has(n)||e.set(n,[]);const s=jt(this,At,"f").get(t);e.get(n).push(s.id)}),Array.from(e.keys()).map(t=>{const[i,r]=t.split("__");return{sourceMeetingId:i,destinationMeetingId:r,participantIds:e.get(t)}})}async applyChanges(e){const t=0!==this.meetingsToCreate.length?e.connectedMeetings.createMeetings(this.meetingsToCreate):Promise.resolve([]),i=0!==this.meetingsToUpdate.length?e.connectedMeetings.updateMeetings(this.meetingsToUpdate):Promise.resolve(),[r]=await Promise.all([t,i]);r&&r.forEach(e=>{this.meetingsToCreate.forEach(t=>{t.title===e.title&&jt(this,xt,"m",Nt).call(this,jt(this,Rt,"f").get(t.id),e.id)})}),0!==this.participantsToMove.length&&this.participantsToMove.forEach(t=>{let{sourceMeetingId:i,destinationMeetingId:r,participantIds:n}=t;e.connectedMeetings.moveParticipants(i,r,n)}),0!==this.meetingsToDelete.length&&e.connectedMeetings.deleteMeetings(this.meetingsToDelete)}discardChanges(){return Ft(this,Et,!1,"f"),this.updateCurrentState(jt(this,Tt,"f")),this.currentState}}Et=new WeakMap,Tt=new WeakMap,_t=new WeakMap,Pt=new WeakMap,Ct=new WeakMap,At=new WeakMap,Rt=new WeakMap,Lt=new WeakMap,It=new WeakMap,xt=new WeakSet,Mt=function(e){Ft(this,Tt,e,"f"),Ft(this,Rt,new Map,"f"),Ft(this,At,new Map,"f"),Ft(this,Lt,new Set,"f"),Ft(this,It,new Set,"f"),Ft(this,Ct,new Map,"f"),Ft(this,_t,new Map,"f"),Ft(this,Pt,new Map,"f"),Ft(this,Pt,new Map,"f"),jt(this,Tt,"f").parentMeeting.participants.forEach(e=>{jt(this,Pt,"f").set(yt(e),jt(this,Tt,"f").parentMeeting.id)}),jt(this,Tt,"f").meetings.forEach(e=>{e.participants.forEach(t=>{jt(this,Pt,"f").set(yt(t),e.id)})})},Dt=function(e){jt(this,Rt,"f").has(e.id)||(jt(this,Rt,"f").set(e.id,e),jt(this,Ct,"f").set(e.id,new Set))},Ot=function(e,t){jt(this,At,"f").has(yt(e))||(jt(this,At,"f").set(yt(e),e),jt(this,_t,"f").set(yt(e),t.id),jt(this,Ct,"f").get(t.id).add(yt(e)))},Nt=function(e,t){const i=e.id;jt(this,xt,"m",Dt).call(this,Object.assign(Object.assign({},e),{id:t})),jt(this,Rt,"f").delete(i);const r=jt(this,Ct,"f").get(i);jt(this,Ct,"f").set(t,r),jt(this,Ct,"f").delete(i),Array.from(jt(this,_t,"f").keys()).forEach(e=>{jt(this,_t,"f").get(e)===i&&jt(this,_t,"f").set(e,t)})},Ut=function(e){return Array.from(jt(this,Ct,"f").get(e)).map(e=>jt(this,At,"f").get(e))};const Vt="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;var zt="object"==typeof self&&self&&self.Object===Object&&self;const Ht=Vt||zt||Function("return this")();const $t=Ht.Symbol;var Gt=Object.prototype,Wt=Gt.hasOwnProperty,qt=Gt.toString,Kt=$t?$t.toStringTag:void 0;var Zt=Object.prototype.toString;var Yt=$t?$t.toStringTag:void 0;function Jt(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Yt&&Yt in Object(e)?function(e){var t=Wt.call(e,Kt),i=e[Kt];try{e[Kt]=void 0;var r=!0}catch(s){}var n=qt.call(e);return r&&(t?e[Kt]=i:delete e[Kt]),n}(e):function(e){return Zt.call(e)}(e)}function Qt(e){return null!=e&&"object"==typeof e}const Xt=Array.isArray;function ei(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ti(e){if(!ei(e))return!1;var t=Jt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}const ii=Ht["__core-js_shared__"];var ri=function(){var e=/[^.]+$/.exec(ii&&ii.keys&&ii.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var ni=Function.prototype.toString;function si(e){if(null!=e){try{return ni.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ai=/^\[object .+?Constructor\]$/,oi=Function.prototype,ci=Object.prototype,li=oi.toString,di=ci.hasOwnProperty,hi=RegExp("^"+li.call(di).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ui(e){return!(!ei(e)||(t=e,ri&&ri in t))&&(ti(e)?hi:ai).test(si(e));var t}function pi(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return ui(i)?i:void 0}const gi=pi(Ht,"WeakMap");var fi=Object.create;const mi=function(){function e(){}return function(t){if(!ei(t))return{};if(fi)return fi(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();const vi=function(){try{var e=pi(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();var bi=/^(?:0|[1-9]\d*)$/;function ki(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&bi.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function Ti(e){return null!=e&&Ei(e.length)&&!ti(e)}var _i=Object.prototype;function Pi(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_i)}function Ci(e){return Qt(e)&&"[object Arguments]"==Jt(e)}var Ai=Object.prototype,Ri=Ai.hasOwnProperty,Li=Ai.propertyIsEnumerable,Ii=Ci(function(){return arguments}())?Ci:function(e){return Qt(e)&&Ri.call(e,"callee")&&!Li.call(e,"callee")};const Mi=Ii;var Di="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oi=Di&&e&&!e.nodeType&&e,Ni=Oi&&Oi.exports===Di?Ht.Buffer:void 0;const Ui=(Ni?Ni.isBuffer:void 0)||function(){return!1};var Fi={};function ji(e){return function(t){return e(t)}}Fi["[object Float32Array]"]=Fi["[object Float64Array]"]=Fi["[object Int8Array]"]=Fi["[object Int16Array]"]=Fi["[object Int32Array]"]=Fi["[object Uint8Array]"]=Fi["[object Uint8ClampedArray]"]=Fi["[object Uint16Array]"]=Fi["[object Uint32Array]"]=!0,Fi["[object Arguments]"]=Fi["[object Array]"]=Fi["[object ArrayBuffer]"]=Fi["[object Boolean]"]=Fi["[object DataView]"]=Fi["[object Date]"]=Fi["[object Error]"]=Fi["[object Function]"]=Fi["[object Map]"]=Fi["[object Number]"]=Fi["[object Object]"]=Fi["[object RegExp]"]=Fi["[object Set]"]=Fi["[object String]"]=Fi["[object WeakMap]"]=!1;var Bi="object"==typeof exports&&exports&&!exports.nodeType&&exports,Vi=Bi&&e&&!e.nodeType&&e,zi=Vi&&Vi.exports===Bi&&Vt.process;const Hi=function(){try{var e=Vi&&Vi.require&&Vi.require("util").types;return e||zi&&zi.binding&&zi.binding("util")}catch(t){}}();var $i=Hi&&Hi.isTypedArray;const Gi=$i?ji($i):function(e){return Qt(e)&&Ei(e.length)&&!!Fi[Jt(e)]};var Wi=Object.prototype.hasOwnProperty;function qi(e,t){var i=Xt(e),r=!i&&Mi(e),n=!i&&!r&&Ui(e),s=!i&&!r&&!n&&Gi(e),a=i||r||n||s,o=a?function(e,t){for(var i=-1,r=Array(e);++i-1},or.prototype.set=function(e,t){var i=this.__data__,r=sr(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};const cr=pi(Ht,"Map");function lr(e,t){var i=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?i["string"==typeof t?"string":"hash"]:i.map}function dr(e){var t=-1,i=null==e?0:e.length;for(this.clear();++trn(nn),an=e=>!("isConnected"in e)||e.isConnected,on=((e,t)=>{let i;return function(){for(var r=arguments.length,n=new Array(r),s=0;s{i=0,e(...n)},t)}})(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(an))},2e3),cn=e=>"function"===typeof e?e():e,ln=(e,t)=>{const i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],e.length--)},dn=(e,t)=>{const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e,t)=>e!==t;const i=cn(e);let r=new Map(Object.entries(null!==i&&void 0!==i?i:{}));const n={dispose:[],get:[],set:[],reset:[]},s=()=>{var t;r=new Map(Object.entries(null!==(t=cn(e))&&void 0!==t?t:{})),n.reset.forEach(e=>e())},a=e=>(n.get.forEach(t=>t(e)),r.get(e)),o=(e,i)=>{const s=r.get(e);t(i,s,e)&&(r.set(e,i),n.set.forEach(t=>t(e,i,s)))},c="undefined"===typeof Proxy?{}:new Proxy(i,{get:(e,t)=>a(t),ownKeys:e=>Array.from(r.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>r.has(t),set:(e,t,i)=>(o(t,i),!0)}),l=(e,t)=>(n[e].push(t),()=>{ln(n[e],t)});return{state:c,get:a,set:o,on:l,onChange:(t,i)=>{const r=l("set",(e,r)=>{e===t&&i(r)}),n=l("reset",()=>i(cn(e)[t]));return()=>{r(),n()}},use:function(){for(var e=arguments.length,t=new Array(e),i=0;i(t.set&&e.push(l("set",t.set)),t.get&&e.push(l("get",t.get)),t.reset&&e.push(l("reset",t.reset)),t.dispose&&e.push(l("dispose",t.dispose)),e),[]);return()=>r.forEach(e=>e())},dispose:()=>{n.dispose.forEach(e=>e()),s()},reset:s,forceUpdate:e=>{const t=r.get(e);n.set.forEach(i=>i(e,t,t))}}}(e,t);return i.use((()=>{const e=new Map;return{dispose:()=>e.clear(),get:t=>{const i=je();i&&((e,t,i)=>{const r=e.get(t);r?r.includes(i)||r.push(i):e.set(t,[i])})(e,t,i)},set:t=>{const i=e.get(t);i&&e.set(t,i.filter(Ve)),on(e)},reset:()=>{e.forEach(e=>e.forEach(Ve)),on(e)}}})()),i},hn={about_call:"About Call",screen:"Screen",camera:"Camera",leave:"Leave",dismiss:"Dismiss",logo:"Logo",page:"Page",more:"More","page.prev":"Previous Page","page.next":"Next Page",layout:"Layout","layout.auto":"Auto Layout",settings:"Settings",file:"File",image:"Image",connection:"Connection",leave_confirmation:"Are you sure you want to leave the call?",cancel:"Cancel",yes:"Yes","(you)":"(you)",you:"You",everyone:"Everyone",to:"To",mute:"Mute",kick:"Kick",pin:"Pin",pinned:"Pinned",accept:"Accept",unpin:"Unpin",pip_on:"Show PiP",pip_off:"Hide PiP",viewers:"Viewers",join:"Join",joined:"Joined",create:"Create",close:"Close",ask:"Ask",type:"Type",activate:"Activate",requests:"Requests",mic_off:"Mic Off",disable_mic:"Disable Mic",mic_on:"Mic On",enable_mic:"Enable Mic",audio:"Audio",test:"Test",minimize:"Hide Tile",maximize:"Show Tile",mute_all:"Mute all","mute_all.description":"Everyone else in the meeting will be muted.","mute_all.header":"Are you sure?","mute_all.allow_unmute":"Allow others to unmute",video_off:"Video Off",disable_video:"Disable Video",video_on:"Video On",enable_video:"Enable Video",video:"Video",offline:"You're offline","offline.description":"Please ensure that you are connected to the internet.",disconnected:"You haven't joined the meeting.",failed:"You've been disconnected","failed.description":"We could not connect you back to the meeting room. Please try rejoining the meeting.","disconnected.description":"Please join the meeting in order to see and interact with other participants.",participants:"Participants","participants.errors.empty_results":"Couldn't find a participant with the specified name or ID.","participants.empty_list":"It looks like nobody is here.","participants.no_pending_requests":"There are no pending requests.","participants.turn_off_video":"Turn off video",polls:"Polls","polls.by":"Poll by","polls.question":"Poll Question","polls.question.placeholder":"What is your poll for?","polls.answers":"Answers","polls.option":"Add an option.","polls.option.placeholder":"Enter an option","polls.results.anon":"Anonymous","polls.results.hide":"Hide results before voting","polls.create":"Create Poll","polls.cancel":"Cancel Poll Creation","polls.empty":"No polls available","polls.errors.question_required":"Question is required.","polls.errors.empty_option":"Empty options not allowed.",screenshare:"Screen Share","screenshare.min_preview":"Minimize Preview","screenshare.max_preview":"Expand Preview","screenshare.shared":"Your screen is being shared.","screenshare.start":"Share Screen","screenshare.stop":"Stop Sharing","screenshare.error.unknown":"An error occured while starting screenshare.","screenshare.error.max_count":"Maximum screen share limit reached.",plugins:"Plugins",perm_denied:"Permission denied by browser.","perm_denied.audio":"Mic Permission denied by browser","perm_denied.video":"Camera Permission denied by browser","perm_denied.screenshare":"Screenshare Permission denied by browser","perm_denied.audio.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Microphone' permission is checked","perm_denied.video.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Camera' permission is checked","perm_denied.screenshare.chrome.message":"Under Chrome settings, navigate to 'Privacy and Security > Site Settings > Permissions'. Select 'Screenshare', provide permission and reload this application.","perm_denied.audio.safari.message":"Under Safari settings, navigate to 'Websites > Microphone', provide permission and reload this application.","perm_denied.video.safari.message":"Under Safari settings, navigate to 'Websites > Camera', provide permission and reload this application.","perm_denied.screenshare.safari.message":"Under Safari settings, navigate to 'Websites > Screenshare', provide permission and reload this application.","perm_denied.audio.edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Microphone', provide permission and reload this application.","perm_denied.video.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.others.message":"From your browser settings, enable 'Microphone' permissions and reload this application.","perm_denied.video.others.message":"From your browser settings, enable 'Camera' permissions and reload this application.","perm_denied.screenshare.others.message":"From your browser settings, enable 'Screenshare' permissions and reload this application.",perm_sys_denied:"Permission denied by system","perm_sys_denied.audio":"Mic permission denied by system","perm_sys_denied.video":"Camera permission denied by system","perm_sys_denied.screenshare":"Screenshare permission denied by system","perm_sys_denied.audio.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Microphone'. Allow access to your browser and reload this application.","perm_sys_denied.video.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Camera'. Allow access to your browser and reload this application.","perm_sys_denied.screenshare.macos.message":"Open Apple Menu, Navigate to 'System Settings > Privacy & Security > Screenshare'. Allow access to your browser and reload this application.","perm_sys_denied.audio.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Microphone', allow access to your browser and reload this application.","perm_sys_denied.video.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Camera', allow access to your browser and reload this application.","perm_sys_denied.screenshare.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Screenshare', allow access to your browser and reload this application.","perm_sys_denied.audio.windows.message":"Go to windows settings, select 'Settings > Privacy > Microphone'. Allow permissions to your browser and reload this application.","perm_sys_denied.video.windows.message":"Go to windows settings, select 'Settings > Privacy > Camera'. Allow permissions to your browser and reload this application.","perm_sys_denied.screenshare.windows.message":"Go to windows settings, select 'Settings > Privacy > Screenshare'. Allow permissions to your browser and reload this application.","perm_sys_denied.audio.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Microphone permissions and reload this application.","perm_sys_denied.video.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Camera permissions and reload this application.","perm_sys_denied.screenshare.android.message":"On you device, navigate to 'Settings > Apps'. Select your browser, allow Screenshare permissions and reload this application.","perm_sys_denied.audio.others.message":"Navigate to your system settings. Allow 'Microphone' permissions for your browser and reload this application.","perm_sys_denied.video.others.message":"Navigate to your system settings. Allow 'Camera' permissions for your browser and reload this application.","perm_sys_denied.screenshare.others.message":"Navigate to your system settings. Allow 'Screenshare' permissions for your browser and reload this application.",perm_could_not_start:"Could not capture device.","perm_could_not_start.audio":"Unable to start your Microphone","perm_could_not_start.video":"Unable to start your Camera","perm_could_not_start.screenshare":"Unable to start your Screenshare","perm_could_not_start.audio.message":"Looks like the system could not capture your microphone. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.video.message":"Looks like the system could not capture your camera. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.screenshare.message":"Looks like the system could not capture your screenshare. Please restart your device or upgrade your browser to fix this.",full_screen:"Full Screen","full_screen.exit":"Exit Full Screen","waitlist.header_title":"Waiting","waitlist.body_text":"You are in the waiting room, the host will let you in soon.","waitlist.deny_request":"Deny request","waitlist.accept_request":"Accept request","waitlist.accept_all":"Accept all","stage_request.header_title":"Join Stage Requests","stage_request.deny_request":"Deny request","stage_request.accept_request":"Accept request","stage_request.accept_all":"Accept all","stage_request.deny_all":"Deny all","stage_request.approval_pending":"Pending","stage_request.denied":"Denied","stage_request.request":"Join stage","stage_request.requested":"Requested","stage_request.cancel_request":"Cancel request","stage_request.leave_stage":"Leave stage","stage_request.request_tip":"Request to join the discussion","stage_request.leave_tip":"Leave the stage","stage_request.pending_tip":"Request pending","stage_request.denied_tip":"Rejected request","stage.empty_host":"The stage is empty","stage.empty_host_summary":"You are off stage. You can manage stage request from the participants tab.","stage.empty_viewer":"There is no one on stage","stage.remove_from_stage":"Remove from stage","stage.invited_notification":"has been invited to join stage.","stage.add_to_stage":"Invite to stage","stage.join_title":"Join Stage","stage.join_summary":"You are about to join the stage, your video & audio as shown above will be visible to all participants.","stage.join_cancel":"Cancel","stage.join_confirm":"Join","setup_screen.join_in_as":"Joining as","setup_screen.your_name":"Your name","stage.reconnecting":"Reconnecting...","recording.label":"REC","recording.indicator":"This meeting is being recorded.","recording.started":"This meeting is being recorded.","recording.stopped":"Recording for this meeting has been stopped.","recording.paused":"Recording for this meeting has been paused.","recording.error.start":"Error while starting recording.","recording.error.stop":"Error while stopping recording","recording.error.resume":"Error while resuming recording","recording.start":"Start Recording","recording.stop":"Stop Recording","recording.resume":"Resume Recording","recording.starting":"Starting","recording.stopping":"Stopping","recording.loading":"Loading","recording.idle":"Record",audio_playback:"Play Audio","audio_playback.title":"Allow Audio Playback","audio_playback.description":"In order to play audio properly on your device, click the button below.",breakout_rooms:"Breakout Rooms","breakout_rooms.room_config_header":"Create Breakout","breakout_rooms.join_breakout_header":"Join Breakout","breakout_rooms.empty":"Nobody here yet.","breakout_rooms.delete":"Delete Room","breakout_rooms.switch":"Switch","breakout_rooms.main_room":"Main Room","breakout_rooms.shuffle_participants":"Shuffle Participants","breakout_rooms.deselect":"Deselect","breakout_rooms.selected":"selected","breakout_rooms.num_of_rooms":"No. of Rooms","breakout_rooms.approx":"Approx.","breakout_rooms.participants_per_room":"participants/room","breakout_rooms.division_text":"when equally divided.","breakout_rooms.start_breakout":"Start Breakout","breakout_rooms.close_breakout":"Close Breakout","breakout_rooms.update_breakout":"Update Breakout","breakout_rooms.discard_changes":"Discard Changes","breakout_rooms.room":"Room","breakout_rooms.rooms":"Rooms","breakout_rooms.room_name":"Room Name","breakout_rooms.edit_room_name":"Edit Room Name","breakout_rooms.save_room_name":"Save Room Name","breakout_rooms.add_room":"Add","breakout_rooms.add_room_brief":"Add Room","breakout_rooms.select_all":"Select all","breakout_rooms.unassign_all":"Unassign all","breakout_rooms.assign":"Assign","breakout_rooms.assign_participants":"Assign Participants","breakout_rooms.none_assigned":"No participants assigned yet","breakout_rooms.drag_drop_participants":"Drag and drop participants","breakout_rooms.click_drop_participants":"Click here to assign","breakout_rooms.status.assign_multiple":"Assign multiple participants at once by clicking and selecting them","breakout_rooms.status.select_room":"Select a room to assign","breakout_rooms.ephemeral_status.participants_assigned":"Participants assigned","breakout_rooms.ephemeral_status.participants_assigned_randomly":"Participants assigned randomly","breakout_rooms.ephemeral_status.changes_discarded":"Changes discarded","breakout_rooms.confirm_modal.start_breakout.header":"Start breakout rooms?","breakout_rooms.confirm_modal.start_breakout.content":"Once started, all participants will be moved to their assigned rooms.","breakout_rooms.confirm_modal.start_breakout.cancelText":"No, go back","breakout_rooms.confirm_modal.start_breakout.ctaText":"Yes, start","breakout_rooms.confirm_modal.close_breakout.header":"Close breakout rooms?","breakout_rooms.confirm_modal.close_breakout.content":"All breakout rooms will be closed & participants will be moved back to the main room.","breakout_rooms.confirm_modal.close_breakout.ctaText":"Yes, close breakout","breakout_rooms.move_reason.started_msg":"Starting breakout rooms...","breakout_rooms.move_reason.started_desc":"You are being moved to your assigned room","breakout_rooms.move_reason.closed_msg":"Closing Breakout rooms...","breakout_rooms.move_reason.closed_desc":"You are being moved back to the main room","breakout_rooms.move_reason.switch_room":"Joining Breakout Room...","breakout_rooms.move_reason.switch_main_room":"Joining Main Room...","breakout_rooms.all_assigned":"All participants have been assigned","breakout_rooms.empty_main_room":"No more participants in the main room.","breakout_rooms.leave_confirmation":"Are you sure you want to leave the call? You are in a breakout room, you can join the main room too.","breakout_rooms.leave_confirmation.main_room_btn":"Go back to main room",ai:"AI","ai.meeting_ai":"MeetingAI","ai.home":"Home","ai.transcriptions":"Transcriptions","ai.personal":"Personal","ai.caption_view":"Caption View","ai.chat.tooltip":"This conversation will just be visible to you and not to others in the call.","ai.chat.summerise":"Hey AI, summarise this call","ai.chat.agenda":"Hey AI, what is today's agenda?",search:"Search","search.could_not_find":"Couldn't find a participant with the specified name or ID.","search.empty":"It looks like nobody is here.",end:"End Meeting","end.all":"End meeting for all",ended:"The meeting ended.","ended.rejected":"Your request to join the meeting was denied.","ended.left":"You left the meeting.","ended.kicked":"You were removed from the meeting.","ended.disconnected":"The call ended because the connection was lost.","ended.network":"Please check your internet connection and try again.","ended.unauthorized":"You are not authorized to join this meeting.",network:"Network","network.reconnecting":"Connection lost. Trying to reconnect.","network.delay_extended":"Taking too long to reconnect. Please check your network connection.","network.disconnected":"Could not reconnect. Please leave the meeting and try refreshing the window.","network.leaving":"Automatically leaving the meeting in 10 seconds.","network.restored":"Connection restored","network.delay":"Taking too long to reconnect.","network.lost":"Connection lost","network.lost_extended":"Connection lost. Please check your network connection.",livestream:"Livestream","livestream.indicator":"This meeting is being livestreamed.","livestream.skip":"Skip to Live","livestream.idle":"Waiting to go live.","livestream.starting":"Livestream is starting...","livestream.stopping":"Livestream is stopping...","livestream.waiting_on_manual_ingestion":"Please ingest livestream media.","livestream.error.not_supported":"Player not supported.","livestream.error.not_found":"Playback URL not found.","livestream.error.unknown":"An unknown error occured.","livestream.error.sync":"Could not sync livestream please try again later.","livestream.error.start":"Error while starting livestream.","livestream.error.stop":"Error while stopping livestream.","livestream.go_live":"Go Live","livestream.end_live":"End Live","livestream.error":"Error","cta.help":"Need help on how to do this?","cta.continue":"Ignore","cta.reload":"Reload","cta.confirmation":"Are you sure?","cta.system_settings":"Open Settings","remote_access.empty":"There are no remote requests, yet.","remote_access.requests":"The following people have requested remote control to your screen share.","remote_access.allow":"Please select whom you want to give access to.","remote_access.grant":"Grant acess","remote_access.indicator":"Any plugin or screenshare you switch to will sync the change across the meeting",chat:"Chat","chat.new":"New","chat.max_limit_warning":"Max Character Limit","chat.rate_limit_error":"Please wait before you can send another message","chat.new_channel":"Create new channel","chat.channel_name":"Enter channel name","chat.member_name":"Enter member name","chat.add_members":"Add members","chat.delete_msg":"Delete","chat.edit_msg":"Edit","chat.send_msg":"Send message","chat.send_attachment":"Drop files/images to send","chat.send_img":"Send an image","chat.send_file":"Send a file","chat.send_emoji":"Send an emoji","chat.update_msg":"Update message","chat.channel_members":"Channel Members","chat.img.loading":"Loading image","chat.error.img_not_found":"Image not found","chat.error.empty_results":"Couldn't find a member with the specified name.","chat.img.shared_by":"Shared by","chat.reply":"Reply","chat.message_placeholder":"Message..","chat.click_to_send":"Click to send as message","chat.search_msgs":"Search messages","chat.search_conversations":"Search conversations","chat.start_conversation":"Start a conversation..","chat.empty_search":"No messages found","chat.empty_channel":"Send a message to get started","chat.cancel_upload":"Cancel upload","chat.view_chats":"View chats","chat.everyone":"everyone","chat.pinned_msgs":"Pinned messages","chat.toggle_pinned_msgs":"Toggle pinned messages","date.today":"Today","date.yesteday":"Yesterday","date.sunday":"Sunday","date.monday":"Monday","date.tuesday":"Tuesday","date.wednesday":"Wednesday","date.thursday":"Thursday","date.friday":"Friday","date.saturday":"Saturday","list.empty":"No items found","grid.listening":"Listening","transcript.off":"Turn off Transcripts","transcript.on":"Turn on Transcripts","settings.notification_sound":"Notification sound","settings.microphone_input":"Microphone","settings.speaker_output":"Speaker","settings.mirror_video":"Mirror my Video","settings.camera_off":"Camera is off","dialog.close":"Close dialog","notifications.joined":"just joined","notifications.left":"left","notifications.requesting_to_join_meeting":"is requesting to join the meeting","notifications.requested_to_join_stage":"has requested to join stage","notifications.joined_stage":"has joined stage","notifications.request_to_join_accepted":"Request to join accepted","notifications.request_to_join_rejected":"Request to join rejected","notifications.accept":"Accept","notifications.new_poll_created_by":"New poll created by","notifications.connected_to":"Connected to","notifications.plugin_switched_to":"Plugin switched to","notifications.remote_control_requested":"has requested for remote control","notifications.remote_control_request_sent":"Sent remote control request to","notifications.remote_control_request_accepted":"has granted remote control","notifications.remote_control_granted":"Granted remote control to","notifications.remote_control_terminated":"Existing remote control has been terminated","debugger.troubleshooting.label":"Troubleshooting","debugger.quality.good":"Good","debugger.quality.average":"Average","debugger.quality.poor":"Poor","debugger.stats.bitrate.label":"Bitrate","debugger.stats.bitrate.description":"Data transmitted per second, affects quality and file size.","debugger.stats.packet_loss.label":"Packet Loss","debugger.stats.packet_loss.description":"Amount of data lost during transfer","debugger.stats.jitter.label":"Jitter","debugger.stats.jitter.description":"Variance or fluctuation in latency","debugger.stats.cpu_limitations.label":"CPU Limitations","debugger.stats.cpu_limitations.description":"CPU limitations can impact WebRTC call quality and performance.","debugger.stats.bandwidth_limitations.label":"Bandwidth Limitations","debugger.stats.bandwidth_limitations.description":"Slow internet speeds can degrade video quality.","debugger.audio.label":"Audio","debugger.audio.troubleshooting.label":"Audio Troubleshooting","debugger.audio.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.audio.messages.enable_media":"Please enable mic to see the report.","debugger.audio.sections.network_media":"Network & Media","debugger.video.label":"Video","debugger.video.troubleshooting.label":"Video Troubleshooting","debugger.video.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.video.messages.enable_media":"Please enable camera to see the report.","debugger.video.sections.network_media":"Network & Media","debugger.screenshare.label":"Screenshare","debugger.screenshare.troubleshooting.label":"Screenshare Troubleshooting","debugger.screenshare.sections.network_media":"Network & Media","debugger.screenshare.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.screenshare.messages.enable_media":"Please share screen to see the report.","debugger.system.label":"System","debugger.system.troubleshooting.label":"System Troubleshooting","debugger.system.sections.battery":"Battery","debugger.system.battery.level.label":"Battery Level","debugger.system.battery.level.description":"A low battery charge may result in reduced performance.","debugger.system.battery.charging.label":"Battery Charging Status","debugger.system.battery.charging.description":"A device running on power performs optimally.","debugger.system.battery.charging.is_charging":"Charging","debugger.system.battery.charging.is_not_charging":"Not charging"},un=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hn,t=hn;return(e!==hn||Object.keys(e).length>0)&&(t=Object.assign({},hn,e)),e=>{var i;return null!==(i=t[e])&&void 0!==i?i:e}},pn={people:'',people_checked:'',chat:'',poll:'',participants:'',rocket:'',call_end:'',share:'',mic_on:'',mic_off:'',video_on:'',video_off:'',share_screen_start:'',share_screen_stop:'',share_screen_person:'',clock:'',dismiss:'',send:'',search:'',more_vertical:'',chevron_down:'',chevron_up:'',chevron_left:'',chevron_right:'',settings:'',wifi:'',speaker:'',speaker_off:'',download:'',full_screen_maximize:'',full_screen_minimize:'',copy:'',attach:'',image:'',emoji_multiple:'',image_off:'',disconnected:'',wand:'',recording:'',subtract:'',stop_recording:'',warning:'',pin:'',pin_off:'',spinner:'',breakout_rooms:'',add:'',shuffle:'',edit:'',delete:'',back:'',save:'',web:'',checkmark:'',spotlight:'',join_stage:'',leave_stage:'',pip_off:'',pip_on:'',signal_1:'',signal_2:'',signal_3:'',signal_4:'',signal_5:'',start_livestream:'',stop_livestream:'',viewers:'',debug:'',info:'',devices:'',horizontal_dots:'',ai_sparkle:'',meeting_ai:'',create_channel:'',create_channel_illustration:' ',captionsOn:'',captionsOff:'',play:'',pause:'',fastForward:'',minimize:'',maximize:''},gn={get:(e,t,i)=>function(){try{for(var r=arguments.length,n=new Array(r),s=0;s{const i=JSON.parse(mn.getItem(vn)||"{}");i[e]=JSON.stringify(t),mn.setItem("rtk-prefs",JSON.stringify(i))},kn=e=>JSON.parse(mn.getItem(vn)||"{}")[e],yn=()=>{const e=JSON.parse(mn.getItem(vn)||"{}");return{mirrorVideo:!e["mirror-video"]||"true"===e["mirror-video"],muteNotificationSounds:!!e["mute-notification-sounds"]&&"true"===e["mute-notification-sounds"]}},wn={},Sn=e=>({meeting:"idle",prefs:yn(),peerId:e||"LEGACY_GLOBAL_PEER"}),xn=dn({meeting:null,t:un(),iconPack:pn,states:Sn(),config:sn(),peerId:"global",storeType:"global",storeId:"store-global"}),En=new Map;function Tn(e){let{meeting:t,config:i,providerId:r,iconPack:n,t:s}=e;const a=dn({meeting:t,t:s,iconPack:n,states:Sn(t.self.peerId),config:i||sn(),peerId:t.self.id,storeType:"peer",storeId:"store-"+r.replace("provider-","")}),o=new Map;return a.elementsMap=o,a.use({set:(e,t)=>{const i=o.get(e);i&&o.set(e,i.filter(i=>i[e]!==t&&(i[e]=t,!0)))}}),a}function _n(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xn;const r=i.elementsMap;if(!r)return void console.error("appendElement: No elementsMap found on store",i);const n=r.get(e);if(n)try{Pn(e,t,i),n.push(t)}catch(s){console.error("appendElement: Error adding element:",s)}else try{r.set(e,[t])}catch(s){console.error("appendElement: Error setting new array:",s)}}function Pn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xn;const r=i.elementsMap;if(!r)return void console.error("removeElement: No elementsMap found on store",i);const n=r.get(e);if(n){const e=n.indexOf(t);e>-1&&n.splice(e,1)}}xn.elementsMap=En,xn.use({set:(e,t)=>{const i=En.get(e);i&&En.set(e,i.filter(i=>i[e]!==t&&(i[e]=t,!0)))}}),xn.state;const Cn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;return null==e?"":e.length>t?"".concat(e.substring(0,t),"..."):e},An=e=>/^(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED8\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])+$/.test(e)&&!/^\d+$/.test(e),Rn=e=>(null===e||void 0===e?void 0:e.trim().toLowerCase().startsWith("javascript:"))?"https://realtime.cloudflare.com":e,Ln=e=>""===(e=null===e||void 0===e?void 0:e.trim())?"Participant":e,In=new RegExp(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/,"g"),Mn=new RegExp(/\s+/);function Dn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e.replace(In,"").trim().split(Mn).slice(0,t).map(e=>e.charAt(0)).join("").toUpperCase()}function On(){return function(e,t){const{connectedCallback:i,disconnectedCallback:r}=e;e.connectedCallback=function(){const e=ie(this),r=e[t];if(e["_rtkStoreToCleanup-".concat(t)]=xn,!r){const i=xn.state[t];e[t]=i,_n(t,e,xn)}const n=i=>{const r=e._storeRequestId;if(i.detail.requestId===r){const r=i.detail.store.state[t];e.componentOnReady().then(()=>{e[t]=r}),_n(t,e,i.detail.store),e["_rtkStoreToCleanup-".concat(t)]=i.detail.store,Pn(t,e,xn)}};e["_rtkStoreResponseListener-".concat(t)]=n,document.addEventListener("rtkProvideStore",n);const s="".concat(e.tagName,"-").concat(Date.now(),"-").concat(Math.random());e._storeRequestId=s;const a=new CustomEvent("rtkRequestStore",{detail:{element:e,propName:t,requestId:s},bubbles:!0,composed:!0});e.dispatchEvent(a);const o=()=>{const i="".concat(e.tagName,"-").concat(Date.now(),"-").concat(Math.random().toString(36));e._storeRequestId=i;const r=new CustomEvent("rtkRequestStore",{detail:{element:e,propName:t,requestId:i},bubbles:!0,composed:!0});e.dispatchEvent(r)};return e["_rtkStoreReadyListener-".concat(t)]=o,document.addEventListener("rtkPeerStoreReady",o),null===i||void 0===i?void 0:i.call(this)},e.disconnectedCallback=function(){const e=ie(this);Pn(t,e,e["_rtkStoreToCleanup-".concat(t)]);const i=e["_rtkStoreResponseListener-".concat(t)];i&&(document.removeEventListener("rtkProvideStore",i),delete e["_rtkStoreResponseListener-".concat(t)]);const n=e["_rtkStoreReadyListener-".concat(t)];return n&&(document.removeEventListener("rtkPeerStoreReady",n),delete e["_rtkStoreReadyListener-".concat(t)]),null===r||void 0===r?void 0:r.call(this)}}}var Nn=/\s/;var Un=/^\s+/;function Fn(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&Nn.test(e.charAt(t)););return t}(e)+1).replace(Un,""):e}var jn=/^[-+]0x[0-9a-f]+$/i,Bn=/^0b[01]+$/i,Vn=/^0o[0-7]+$/i,zn=parseInt;function Hn(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||Qt(e)&&"[object Symbol]"==Jt(e)}(e))return NaN;if(ei(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ei(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Fn(e);var i=Bn.test(e);return i||Vn.test(e)?zn(e.slice(2),i?2:8):jn.test(e)?NaN:+e}const $n=function(){return Ht.Date.now()};var Gn=Math.max,Wn=Math.min;function qn(e,t,i){var r,n,s,a,o,c,l=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var i=r,s=n;return r=n=void 0,l=t,a=e.apply(s,i)}function g(e){var i=e-c;return void 0===c||i>=t||i<0||h&&e-l>=s}function f(){var e=$n();if(g(e))return m(e);o=setTimeout(f,function(e){var i=t-(e-c);return h?Wn(i,s-(e-l)):i}(e))}function m(e){return o=void 0,u&&r?p(e):(r=n=void 0,a)}function v(){var e=$n(),i=g(e);if(r=arguments,n=this,c=e,i){if(void 0===o)return function(e){return l=e,o=setTimeout(f,t),d?p(e):a}(c);if(h)return clearTimeout(o),o=setTimeout(f,t),p(c)}return void 0===o&&(o=setTimeout(f,t)),a}return t=Hn(t)||0,ei(i)&&(d=!!i.leading,s=(h="maxWait"in i)?Gn(Hn(i.maxWait)||0,t):s,u="trailing"in i?!!i.trailing:u),v.cancel=function(){void 0!==o&&clearTimeout(o),l=0,r=c=n=o=void 0},v.flush=function(){return void 0===o?a:m($n())},v}const Kn=e=>{let t=null;try{const i=JSON.parse(e.message),{target:r,message:n}=i;t=void 0===r||void 0===n?e:Object.assign(Object.assign({},e),{targetUserIds:r,message:n})}catch(i){t=e}return t};function Zn(e,t){return e.localeCompare(t)}function Yn(e){return e.sort((e,t)=>e.localeCompare(t)).join("_")}function Jn(e,t){if(null==e)return!0;for(const i of e)if("file"===i.kind){const e=i.getAsFile();i.type.startsWith("image/")?t("image",e):t("file",e)}}const Qn="dm__";function Xn(e){return e.isDirectMessage}function es(e){return[...new Set(e)].sort(Zn).join("<>")}function ts(e){return e.split("").reverse().join("")}const is=/^\*([^*\s]+)\*/,rs=/^_([^_\s]+)_/,ns=/^~([^~\s]+)~/,ss=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.,~#?&//=]*)/,as=/
[.\s\S]*<\/blockquote>\n\n/m;function os(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!as.test(e))return"";let i=0,r=13;return t&&(i=12,r=0),e.substring(e.indexOf("
")+i,e.indexOf("
")+r)}function cs(e){return e.replace(as,"")}const ls=2e3,ds=["","","","",""];function hs(e){e=(e=e.split(" ").map(e=>{if(ss.test(e)){const t=ss.exec(e);e=e.replace(t[0],"".concat(t[0],""))}else{if(is.test(e)){const t=is.exec(e);e=e.replace(t[0],"".concat(t[1],""))}if(rs.test(e)){const t=rs.exec(e);e=e.replace(t[0],"".concat(t[1],""))}if(ns.test(e)){const t=ns.exec(e);e=e.replace(t[0],"".concat(t[1],""))}}return e}).join(" ")).split(" ").map((e,t)=>">"!==e||0!==t&&">"!==e[t-1]?e:"").join(" ");const[t]=us(e);return t}function us(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=[];if(0===e.length)return[i,0];let r=0;for(;r"));i.push({type:e[r+1],content:1===t.length&&"plain_text"===t[0].type?t[0].content:t}),r+=n+3}else{let t=i[i.length-1];t&&"plain_text"===t.type||(i.push({type:"plain_text",content:""}),t=i[i.length-1]),t.content+=e[r],r++}}return[i,r]}const ps=(e,t)=>{const i=t.getTime()-e.getTime();return Math.round(Math.abs(i/1e3/60))},gs=(e,t)=>{const i=ps(e,t);if(i<2)return"just now";if(i<60)return"".concat(i,"m ago");const r=Math.round(i/60);if(i<90)return"about ".concat(r,"h ago");if(r<24)return"".concat(r,"h ago");const n=Math.round(r/24);if(n<7)return"".concat(n,"d ago");const s=Math.round(n/7);return"".concat(s,"w ago")},fs=e=>e.toDateString()+" "+e.toLocaleTimeString(),ms=e=>{let{name:t,time:i,now:r}=e;return Z("div",{class:"head"},Z("div",{class:"name"},Cn(Ln(t),20)),Z("div",{class:"time",title:fs(i)},gs(i,r)))},vs=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!=e&&e.scrollTo({top:e.scrollHeight,behavior:t?"smooth":"auto"})},bs=e=>{let{element:t,size:i,states:r={},config:n={}}=e,s=[];const a=null===n||void 0===n?void 0:n.root[t],o=e=>{s.push(e),"string"===typeof i&&s.push("".concat(e,".").concat(i))};if(o(t),"object"===typeof a&&!Array.isArray(a)&&null!==a){const{state:e,states:i}=a;let n=t,s=[];if(Array.isArray(i)){s=i.filter(e=>r[e]),s.sort();for(const e of s)o("".concat(n,".").concat(e));if(s.length>1){o([n,...s].join("."))}}if("string"===typeof e){const i="".concat(t,"[").concat(e,"=").concat(r[e],"]");o(i);for(const e of s)o("".concat(i,".").concat(e));if(s.length>1){o([i,...s].join("."))}}}return s},ks=e=>{let{selectors:t,root:i}=e;if(!i||!Array.isArray(t))return[];let r=[];for(const n of t){const e=i[n];if(Array.isArray(e))r=[...e];else if(e){if(e.children&&(r=[...e.children]),Array.isArray(e.remove))for(const t of e.remove)r=r.filter(e=>"string"===typeof e?e!==t:!Array.isArray(e)||e[0]!==t);if(e.addBefore)for(const[t,i]of Object.entries(e.addBefore)){const e=r.findIndex(e=>"string"===typeof e?e===t:!!Array.isArray(e)&&e[0]===t);e>=0&&r.splice(e,0,...i)}Array.isArray(e.add)&&(r=r.concat(e.add)),Array.isArray(e.prepend)&&(r=e.prepend.concat(r))}}return r},ys=e=>{let{elements:t,defaults:i,props:r={},deepProps:n=!1,elementProps:s={}}=e;return Array.isArray(t)&&0!==t.length?t.map(e=>Z(ws,{element:e,defaults:i,props:r,childProps:n&&r,elementProps:s})):null},ws=(e,t)=>{let{element:i,defaults:r,childProps:n={},props:s={},onlyChildren:a=!1,asHost:o=!1,deepProps:c=!1,elementProps:l={}}=e;var d;const{config:h,size:u,states:p}=r;let g,f={},m=[];Array.isArray(i)?[g,f,...m]=i:g=i;const v=null===(d=null===h||void 0===h?void 0:h.root)||void 0===d?void 0:d[g];null!=v&&"props"in v&&(s=Object.assign(Object.assign({},v.props),s)),s=Object.assign(Object.assign({},s),f),g in l&&(s=Object.assign(Object.assign({},s),l[g]));const b=bs({element:g,size:u,states:p,config:h}),k=ks({selectors:b,root:h.root});if(a)return Z(ys,{elements:k,defaults:r,props:n,deepProps:c,elementProps:l});const y=(e=>{let{selectors:t,styles:i}=e;if(!Array.isArray(t)||null==i)return{};const r={};for(const n of t){const e=i[n];null!=e&&Object.assign(r,e)}return r})({selectors:b,styles:h.styles});if(o)return Z(J,Object.assign({},r,{style:y},s),Z(ys,{elements:k,defaults:r,props:n,deepProps:c,elementProps:l}),t,m.map(e=>{if(Array.isArray(e)){const[t,i]=e;return Z(t,Object.assign({},r,i))}return e}));if(["rtk-header","rtk-controlbar"].includes(g)&&(s.disableRender=!0),g.startsWith("rtk-"))return Z(g,Object.assign({},r,{style:y},s),Z(ys,{elements:k,defaults:r,props:n,deepProps:c,elementProps:l}),t,m.map(e=>{if(Array.isArray(e)){const[t,i]=e;return Z(t,Object.assign({},r,i))}return e}));{const[e,i]=g.split("#");return Z(e,Object.assign({id:i,style:y},s),Z(ys,{elements:k,defaults:r,props:n,deepProps:c,elementProps:l}),t,m.map(e=>{if(Array.isArray(e)){const[t,i]=e;return Z(t,Object.assign({},r,i))}return e}))}},Ss=e=>e.split(/[#?]/)[0].split(".").pop().trim(),xs=e=>{if(!e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/1024**t).toFixed(2)," ").concat(["B","kB","MB","GB","TB"][t])},Es=async(e,t)=>{e=Rn(e);let i=null===t||void 0===t?void 0:t.name;const r=await fetch(e);if(!r.ok)return void window.open(e,"_blank");const n=URL.createObjectURL(await r.blob()),s=document.createElement("a");s.href=n,s.download=null!==i&&void 0!==i?i:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";try{const i=new URL(e).pathname.split("/").pop();return"/"!==i?i:t}catch(i){return t}}(e,null===t||void 0===t?void 0:t.fallbackName),s.click()},Ts=[0,.5,1,1.5,2,3,4,5,6,7,8,9,10,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],_s={darkest:{background:{1e3:"#080808",900:"#1A1A1A",800:"#1E1E1E",700:"#2C2C2C",600:"#393939"},text:"#FFFFFF"},dark:{background:{1e3:"#252525",900:"#2F2F2F",800:"#323232",700:"#3E3E3E",600:"#4A4A4A"},text:"#F5F5F5","video-bg":"#1C1C1C"},light:{background:{1e3:"#FFFFFF",900:"#F5F5F5",800:"#EBEBEB",700:"#E0E0E0",600:"#D6D6D6"},text:"#111111","text-on-brand":"#ffffff","video-bg":"#DADADA"}},Ps={none:{none:0,sm:0,md:0,lg:0},thin:{none:0,sm:1,md:2,lg:4},fat:{none:0,sm:2,md:4,lg:8}},Cs={sharp:{none:0,sm:0,md:0,lg:0},rounded:{none:0,sm:4,md:8,lg:12},"extra-rounded":{none:0,sm:8,md:16,lg:24},circular:{none:9999,sm:9999,md:9999,lg:9999}};function As(e){let t="0",i="0",r="0";return 4==(e=e.trim()).length?(t="0x"+e[1]+e[1],i="0x"+e[2]+e[2],r="0x"+e[3]+e[3]):e.length>6&&(t="0x"+e[1]+e[2],i="0x"+e[3]+e[4],r="0x"+e[5]+e[6]),[+t,+i,+r]}const Rs=e=>"string"===typeof e&&7===e.length&&e.startsWith("#"),Ls="--rtk-";function Is(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ls)+e}const Ms=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ls;Object.keys(t).forEach(r=>{const n=t[r];if("string"===typeof n)if("text"===r||"text-on-brand"===r){const t=As(n).join(" ");e.style.setProperty(Is("colors-".concat(r,"-1000"),i),"".concat(t)),e.style.setProperty(Is("colors-".concat(r,"-900"),i),"".concat(t," / 0.88")),e.style.setProperty(Is("colors-".concat(r,"-800"),i),"".concat(t," / 0.76")),e.style.setProperty(Is("colors-".concat(r,"-700"),i),"".concat(t," / 0.64")),e.style.setProperty(Is("colors-".concat(r,"-600"),i),"".concat(t," / 0.52"))}else{const t=As(n).join(" ");e.style.setProperty(Is("colors-".concat(r),i),t)}else"object"===typeof n&&Object.keys(n).forEach(t=>{const s=As(n[t]).join(" ");e.style.setProperty(Is("colors-".concat(r,"-").concat(t),i),s)})})},Ds=(e,t)=>{let{spacingBase:i,borderRadius:r,borderWidth:n,colors:s,fontFamily:a,googleFont:o,theme:c,tokenPrefix:l=Ls}=t;if("object"!==typeof e)throw new Error("[rtk-ui-kit] (provideRtkDesignSystem): Passed element is not a valid HTML Element");if("string"===typeof o&&((e=>{const t=[];if(null==document.querySelector("link[data-rtk-font]")){const e=document.createElement("link");e.rel="preconnect",e.setAttribute("data-rtk-font","true"),e.href="https://fonts.googleapis.com";const i=e.cloneNode(!0);i.href="https://fonts.gstatic.com",i.crossOrigin="",t.push(e,i)}const i=document.createElement("link");i.rel="stylesheet",i.setAttribute("data-rtk-font",e),i.href=encodeURI("https://fonts.googleapis.com/css2?family=".concat(e,":wght@").concat([400,500,700].join(";"),"&display=swap")),t.push(i),document.head.append(...t)})(o),e.style.setProperty(Is("font-family",l),o)),"string"===typeof a&&e.style.setProperty(Is("font-family",l),a),"number"===typeof i&&function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ls;Ts.forEach(r=>{e.style.setProperty(Is("space-".concat(r),i),"".concat(r*t,"px"))})}(e,i,l),"string"===typeof n&&function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ls;if(t in Ps){const r=Ps[t];Object.keys(r).forEach(t=>{e.style.setProperty(Is("border-width-".concat(t),i),"".concat(r[t],"px"))})}}(e,n,l),"string"===typeof r&&function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ls;if(t in Cs){const r=Cs[t];Object.keys(r).forEach(t=>{e.style.setProperty(Is("border-radius-".concat(t),i),"".concat(r[t],"px"))})}}(e,r,l),"string"===typeof c){const t=_s[c];null!=t&&Ms(e,t,l)}"object"===typeof s&&Ms(e,s,l)};function Os(e){return e}var Ns=Date.now;var Us=function(e){var t=0,i=0;return function(){var r=Ns(),n=16-(r-i);if(i=r,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(vi?function(e,t){return vi(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:Os);const Fs=Us;var js=Math.max;function Bs(e,t){return Fs(function(e,t,i){return t=js(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,s=js(r.length-t,0),a=Array(s);++n1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(n=Xs.length>3&&"function"==typeof n?(r--,n):void 0,s&&function(e,t,i){if(!ei(i))return!1;var r=typeof t;return!!("number"==r?Ti(i)&&ki(t,i.length):"string"==r&&t in i)&&wi(i[t],e)}(t[0],t[1],s)&&(n=r<3?void 0:n,r=1),e=Object(e);++i2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{grid_pagination:!0,settings_toggle:!0};var n,s,a,o,c,l,d,h,u,p,g,f,m,v,b,k,y,w;const S={showSetupScreen:!0};let x,E=["rtk-stage"],T={},_={};const P=!1!==(null===r||void 0===r?void 0:r.settings_toggle),C=!1!==(null===r||void 0===r?void 0:r.grid_pagination);if(null===(n=e.controlBar)||void 0===n?void 0:n.isEnabled){E.push("rtk-controlbar");const{elements:i}=e.controlBar,r=[...i.fullscreen?["rtk-fullscreen-toggle"]:[],...P?["rtk-settings-toggle"]:[]],n=[],h=[];(null===(s=t.participants.pip)||void 0===s?void 0:s.isSupported())&&(null===(o=null===(a=t.self)||void 0===a?void 0:a.config)||void 0===o?void 0:o.pipMode)&&"LIVESTREAM"!==(null===(c=t.self.config)||void 0===c?void 0:c.viewType)&&h.push("rtk-pip-toggle"),(null===t||void 0===t?void 0:t.self.permissions.canDisableParticipantAudio)&&h.push("rtk-mute-all-button"),h.push("rtk-breakout-rooms-toggle"),(null===(l=t.self)||void 0===l?void 0:l.permissions.canRecord)&&h.push("rtk-recording-toggle"),null!==(d=t.self.permissions.transcriptionEnabled)&&void 0!==d&&d&&h.push("rtk-caption-toggle"),"ReactNative"!==navigator.product&&h.push("rtk-debugger-toggle"),st(t)&&r.push("rtk-livestream-toggle"),i.screenshare&&r.push("rtk-screen-share-toggle"),i.chat&&n.push("rtk-chat-toggle"),i.polls&&n.push("rtk-polls-toggle"),i.participants&&n.push("rtk-participants-toggle"),i.plugins&&n.push("rtk-plugins-toggle"),n.push("rtk-ai-toggle");const u=["rtk-mic-toggle","rtk-camera-toggle","rtk-stage-toggle","rtk-leave-button"];h.length>0&&u.push("rtk-more-toggle");const p=r.concat(n).concat(h);let g=!1;p.length>0&&(g=!0),_={"rtk-controlbar":{states:["activeMoreMenu"],children:["div#controlbar-left","div#controlbar-center","div#controlbar-right"]},"div#controlbar-left":r,"div#controlbar-center":u,"div#controlbar-right":n,"rtk-more-toggle":{states:["activeMoreMenu"],children:[]},"rtk-more-toggle.activeMoreMenu":h.map(e=>[e,{variant:"horizontal",slot:"more-elements"}]),"rtk-controlbar.sm":["div#controlbar-mobile"],"rtk-controlbar.md":["div#controlbar-mobile"],"rtk-more-toggle.activeMoreMenu.md":p.map(e=>[e,{variant:"horizontal",slot:"more-elements"}]),"rtk-more-toggle.activeMoreMenu.sm":p.map(e=>[e,{variant:"horizontal",slot:"more-elements"}]),"div#controlbar-mobile":["rtk-mic-toggle","rtk-camera-toggle","rtk-stage-toggle",g&&"rtk-more-toggle","rtk-leave-button"]}}if(null===(h=e.header)||void 0===h?void 0:h.isEnabled){E.unshift("rtk-header");const{elements:t}=e.header;let i=["rtk-recording-indicator","rtk-livestream-indicator"],r=[],n=[];C&&n.push("rtk-grid-pagination"),t.title&&r.push("rtk-meeting-title"),"string"===typeof t.logo&&t.logo.length>0&&(x=t.logo,i.unshift("rtk-logo")),t.participantCount&&n.push("rtk-participant-count","rtk-viewer-count"),t.timer&&n.push("rtk-clock"),T={"rtk-header":["div#header-left","div#header-center","div#header-right"],"rtk-header.sm":{remove:["div#header-center"]},"div#header-left":i,"div#header-center":r,"div#header-right":n,"div#header-left.sm":{remove:["rtk-logo"],prepend:["rtk-meeting-title"]}}}E.push("rtk-participants-audio","rtk-dialog-manager");let A={logo:x};A=e.designTokens,Rs(null===(p=null===(u=null===e||void 0===e?void 0:e.designTokens)||void 0===u?void 0:u.colors)||void 0===p?void 0:p.textOnBrand)&&(A.colors["text-on-brand"]=null===(f=null===(g=null===e||void 0===e?void 0:e.designTokens)||void 0===g?void 0:g.colors)||void 0===f?void 0:f.textOnBrand),Rs(null===(v=null===(m=null===e||void 0===e?void 0:e.designTokens)||void 0===m?void 0:m.colors)||void 0===v?void 0:v.videoBg)&&(A.colors["video-bg"]=null===(k=null===(b=null===e||void 0===e?void 0:e.designTokens)||void 0===b?void 0:b.colors)||void 0===k?void 0:k.videoBg);let R={designTokens:A,styles:{"rtk-header":{display:"grid",height:"48px",gridTemplateColumns:"repeat(3, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-2, 8px)"},"rtk-header.sm":{display:"grid",gridArea:"header",gridTemplateColumns:"repeat(2, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-1, 4px)"},"div#header-left":{display:"flex",alignItems:"center",height:"48px",wordBreak:"break-all",gap:"var(--header-section-gap)"},"rtk-logo":{height:"26px"},"div#header-center":{display:"flex",alignItems:"center",justifyContent:"center",wordBreak:"break-all",gap:"var(--header-section-gap)",paddingInline:"var(--rtk-space-3, 12px)"},"div#header-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--header-section-gap)"},"rtk-stage":{display:"flex",flex:"1"},"rtk-grid":{flex:"1",height:"auto"},"rtk-controlbar":{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gridTemplateRows:"1fr",alignItems:"center",padding:"8px"},"rtk-controlbar.sm":{display:"flex",position:"relative",backgroundColor:"var(--rtk-colors-background-1000, #000)"},"rtk-controlbar.md":{display:"flex",position:"relative",backgroundColor:"var(--rtk-colors-background-1000, #000)"},"div#controlbar-left":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-center":{display:"flex",alignItems:"center",position:"relative",overflow:"visible",justifyContent:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-mobile":{display:"flex",flex:"1",alignItems:"center",justifyContent:"center",zIndex:"10000",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--rtk-space-1, 4px)"},"rtk-settings":{width:"720px",height:"480px"},"rtk-debugger":{width:"720px",height:"480px"},"div#setupcontrols-indicator":{position:"absolute",bottom:"12px",left:"12px",display:"flex",gap:"6px",background:"rgb(var(--rtk-colors-background-800, 0 0 0))",borderRadius:"100%"},"div#setupcontrols-media":{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},"div#setupcontrols-settings":{position:"absolute",top:"8px",right:"8px",display:"flex",flexDirection:"column",gap:"6px"},"rtk-meeting-title.sm":{marginLeft:"0"},"rtk-clock":{marginRight:"0"}},root:Object.assign(Object.assign(Object.assign({"rtk-meeting":{state:"meeting",states:["activeSidebar","activeAI"]},"rtk-meeting[meeting=idle]":["rtk-idle-screen"],"rtk-meeting[meeting=waiting]":["rtk-waiting-screen"],"rtk-meeting[meeting=setup]":["rtk-setup-screen","rtk-dialog-manager"],"rtk-meeting[meeting=joined]":E,"rtk-meeting[meeting=joined].activeSidebar.sm":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeSidebar.md":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeAI.sm":{add:[["rtk-ai",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeAI.md":{add:[["rtk-ai",{view:"full-screen"}]]},"rtk-meeting[meeting=ended]":["rtk-ended-screen"]},T),_),{"rtk-stage":{states:["activeSidebar","activeAI"],children:["rtk-grid","rtk-notifications","rtk-transcripts"]},"rtk-stage.activeSidebar":{add:[["rtk-sidebar",{view:"sidebar"}]]},"rtk-stage.activeSidebar.sm":{remove:["rtk-sidebar"]},"rtk-stage.activeAI":{add:[["rtk-ai",{view:"sidebar"}]]},"rtk-stage.activeAI.sm":{remove:["rtk-ai"]},"rtk-grid":{states:["activeScreenShare","activePlugin","activeSpotlight"],state:"viewType",children:["rtk-simple-grid"]},"rtk-grid[viewType=AUDIO_ROOM]":["rtk-audio-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activeScreenshare":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-grid.activeScreenShare":["rtk-mixed-grid"],"rtk-grid.activePlugin":["rtk-mixed-grid"],"rtk-grid.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-mixed-grid":{states:["activeSpotlight"],state:"viewType",children:["rtk-simple-grid"]},"rtk-mixed-grid[viewType=AUDIO_ROOM]":["rtk-audio-grid"],"rtk-mixed-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-participant-tile":{state:"meeting",children:["rtk-name-tag","rtk-avatar","rtk-network-indicator"]},"rtk-participant-setup":["rtk-avatar","div#setupcontrols-media"],"rtk-participant-tile[meeting=setup]":["rtk-avatar","div#setupcontrols-indicator","div#setupcontrols-media",...P?["div#setupcontrols-settings"]:[]],"div#setupcontrols-indicator":[["rtk-audio-visualizer",{slot:"start",hideMuted:!0}]],"div#setupcontrols-media":[["rtk-mic-toggle",{size:"sm"}],["rtk-camera-toggle",{size:"sm"}]],"div#setupcontrols-settings":[["rtk-settings-toggle",{size:"sm"}]],"rtk-screenshare-view":["rtk-name-tag","rtk-network-indicator"],"rtk-name-tag":[["rtk-audio-visualizer",{slot:"start"}]]}),config:{notification_sounds:{participant_left:!1},participant_joined_sound_notification_limit:3,participant_chat_message_sound_notification_limit:10,videoFit:"cover"}};return R=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sn(),i=Object.assign({},t);return ta(i,e),i}(i,R),S.showSetupScreen=null===(w=null===(y=e.setupScreen)||void 0===y?void 0:y.isEnabled)||void 0===w||w,{config:R,data:S}},ra={joined:"https://rtk-uploads.realtime.cloudflare.com/notification_join.mp3",left:"https://rtk-uploads.realtime.cloudflare.com/notification_join.mp3",message:"https://rtk-uploads.realtime.cloudflare.com/notification_message.mp3"};class na{constructor(e){this.meeting=e,this.audio=document.createElement("audio"),this.audio.volume=.3}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;var i;this.playing||(this.playing=!0,this.audio.src=ra[e],this.audio.volume=.3,null===(i=this.audio.play())||void 0===i||i.catch(e=>{}),setTimeout(()=>{this.playing=!1},t))}async setDevice(e){var t,i,r;mt(this.meeting)||await(null===(r=null===(i=null===(t=this.audio)||void 0===t?void 0:t.setSinkId)||void 0===i?void 0:i.call(t,e))||void 0===r?void 0:r.catch(e=>{}))}}var sa=function(){if("undefined"!==typeof Map)return Map;function e(e,t){var i=-1;return e.some(function(e,r){return e[0]===t&&(i=r,!0)}),i}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var i=e(this.__entries__,t),r=this.__entries__[i];return r&&r[1]},t.prototype.set=function(t,i){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=i:this.__entries__.push([t,i])},t.prototype.delete=function(t){var i=this.__entries__,r=e(i,t);~r&&i.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var i=0,r=this.__entries__;i0},e.prototype.connect_=function(){aa&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),da?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){aa&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,i=void 0===t?"":t;la.some(function(e){return!!~i.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),ua=function(e,t){for(var i=0,r=Object.keys(t);i0},e}(),Ea="undefined"!==typeof WeakMap?new WeakMap:new sa,Ta=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=ha.getInstance(),r=new xa(t,i,this);Ea.set(this,r)};["observe","unobserve","disconnect"].forEach(function(e){Ta.prototype[e]=function(){var t;return(t=Ea.get(this))[e].apply(t,arguments)}});var _a="undefined"!==typeof oa.ResizeObserver?oa.ResizeObserver:Ta;const Pa=["top","right","bottom","left"],Ca=["start","end"],Aa=Pa.reduce((e,t)=>e.concat(t,t+"-"+Ca[0],t+"-"+Ca[1]),[]),Ra=Math.min,La=Math.max,Ia=Math.round,Ma=e=>({x:e,y:e}),Da={left:"right",right:"left",bottom:"top",top:"bottom"},Oa={start:"end",end:"start"};function Na(e,t,i){return La(e,Ra(t,i))}function Ua(e,t){return"function"===typeof e?e(t):e}function Fa(e){return e.split("-")[0]}function ja(e){return e.split("-")[1]}function Ba(e){return"x"===e?"y":"x"}function Va(e){return"y"===e?"height":"width"}const za=new Set(["top","bottom"]);function Ha(e){return za.has(Fa(e))?"y":"x"}function $a(e){return Ba(Ha(e))}function Ga(e,t,i){void 0===i&&(i=!1);const r=ja(e),n=$a(e),s=Va(n);let a="x"===n?r===(i?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Qa(a)),[a,Qa(a)]}function Wa(e){return e.replace(/start|end/g,e=>Oa[e])}const qa=["left","right"],Ka=["right","left"],Za=["top","bottom"],Ya=["bottom","top"];function Ja(e,t,i,r){const n=ja(e);let s=function(e,t,i){switch(e){case"top":case"bottom":return i?t?Ka:qa:t?qa:Ka;case"left":case"right":return t?Za:Ya;default:return[]}}(Fa(e),"start"===i,r);return n&&(s=s.map(e=>e+"-"+n),t&&(s=s.concat(s.map(Wa)))),s}function Qa(e){return e.replace(/left|right|bottom|top/g,e=>Da[e])}function Xa(e){return"number"!==typeof e?function(e){return(0,n.A)({top:0,right:0,bottom:0,left:0},e)}(e):{top:e,right:e,bottom:e,left:e}}function eo(e){const{x:t,y:i,width:r,height:n}=e;return{width:r,height:n,top:i,left:t,right:t+r,bottom:i+n,x:t,y:i}}function to(e,t,i){let{reference:r,floating:n}=e;const s=Ha(t),a=$a(t),o=Va(a),c=Fa(t),l="y"===s,d=r.x+r.width/2-n.width/2,h=r.y+r.height/2-n.height/2,u=r[o]/2-n[o]/2;let p;switch(c){case"top":p={x:d,y:r.y-n.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-n.width,y:h};break;default:p={x:r.x,y:r.y}}switch(ja(t)){case"start":p[a]-=u*(i&&l?-1:1);break;case"end":p[a]+=u*(i&&l?-1:1)}return p}async function io(e,t){var i;void 0===t&&(t={});const{x:r,y:n,platform:s,rects:a,elements:o,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:u=!1,padding:p=0}=Ua(t,e),g=Xa(p),f=o[u?"floating"===h?"reference":"floating":h],m=eo(await s.getClippingRect({element:null==(i=await(null==s.isElement?void 0:s.isElement(f)))||i?f:f.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(o.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===h?{x:r,y:n,width:a.floating.width,height:a.floating.height}:a.reference,b=await(null==s.getOffsetParent?void 0:s.getOffsetParent(o.floating)),k=await(null==s.isElement?void 0:s.isElement(b))&&await(null==s.getScale?void 0:s.getScale(b))||{x:1,y:1},y=eo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:v,offsetParent:b,strategy:c}):v);return{top:(m.top-y.top+g.top)/k.y,bottom:(y.bottom-m.bottom+g.bottom)/k.y,left:(m.left-y.left+g.left)/k.x,right:(y.right-m.right+g.right)/k.x}}function ro(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function no(e){return Pa.some(t=>e[t]>=0)}const so=new Set(["left","top"]);function ao(){return"undefined"!==typeof window}function oo(e){return ho(e)?(e.nodeName||"").toLowerCase():"#document"}function co(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function lo(e){var t;return null==(t=(ho(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ho(e){return!!ao()&&(e instanceof Node||e instanceof co(e).Node)}function uo(e){return!!ao()&&(e instanceof Element||e instanceof co(e).Element)}function po(e){return!!ao()&&(e instanceof HTMLElement||e instanceof co(e).HTMLElement)}function go(e){return!(!ao()||"undefined"===typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof co(e).ShadowRoot)}const fo=new Set(["inline","contents"]);function mo(e){const{overflow:t,overflowX:i,overflowY:r,display:n}=Co(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+i)&&!fo.has(n)}const vo=new Set(["table","td","th"]);function bo(e){return vo.has(oo(e))}const ko=[":popover-open",":modal"];function yo(e){return ko.some(t=>{try{return e.matches(t)}catch(i){return!1}})}const wo=["transform","translate","scale","rotate","perspective"],So=["transform","translate","scale","rotate","perspective","filter"],xo=["paint","layout","strict","content"];function Eo(e){const t=To(),i=uo(e)?Co(e):e;return wo.some(e=>!!i[e]&&"none"!==i[e])||!!i.containerType&&"normal"!==i.containerType||!t&&!!i.backdropFilter&&"none"!==i.backdropFilter||!t&&!!i.filter&&"none"!==i.filter||So.some(e=>(i.willChange||"").includes(e))||xo.some(e=>(i.contain||"").includes(e))}function To(){return!("undefined"===typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const _o=new Set(["html","body","#document"]);function Po(e){return _o.has(oo(e))}function Co(e){return co(e).getComputedStyle(e)}function Ao(e){return uo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ro(e){if("html"===oo(e))return e;const t=e.assignedSlot||e.parentNode||go(e)&&e.host||lo(e);return go(t)?t.host:t}function Lo(e){const t=Ro(e);return Po(t)?e.ownerDocument?e.ownerDocument.body:e.body:po(t)&&mo(t)?t:Lo(t)}function Io(e,t,i){var r;void 0===t&&(t=[]);const n=Lo(e),s=n===(null==(r=e.ownerDocument)?void 0:r.body),a=co(n);return s?(Mo(a),t.concat(a,a.visualViewport||[],mo(n)?n:[],[])):t.concat(n,Io(n,[]))}function Mo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Do(e){const t=Co(e);let i=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const n=po(e),s=n?e.offsetWidth:i,a=n?e.offsetHeight:r,o=Ia(i)!==s||Ia(r)!==a;return o&&(i=s,r=a),{width:i,height:r,$:o}}function Oo(e){return uo(e)?e:e.contextElement}function No(e){const t=Oo(e);if(!po(t))return Ma(1);const i=t.getBoundingClientRect(),{width:r,height:n,$:s}=Do(t);let a=(s?Ia(i.width):i.width)/r,o=(s?Ia(i.height):i.height)/n;return a&&Number.isFinite(a)||(a=1),o&&Number.isFinite(o)||(o=1),{x:a,y:o}}const Uo=Ma(0);function Fo(e){const t=co(e);return To()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Uo}function jo(e,t,i,r){void 0===t&&(t=!1),void 0===i&&(i=!1);const n=e.getBoundingClientRect(),s=Oo(e);let a=Ma(1);t&&(r?uo(r)&&(a=No(r)):a=No(e));const o=function(e,t,i){return void 0===t&&(t=!1),!(!i||t&&i!==co(e))&&t}(s,i,r)?Fo(s):Ma(0);let c=(n.left+o.x)/a.x,l=(n.top+o.y)/a.y,d=n.width/a.x,h=n.height/a.y;if(s){const e=co(s),t=r&&uo(r)?co(r):r;let i=e,n=Mo(i);for(;n&&r&&t!==i;){const e=No(n),t=n.getBoundingClientRect(),r=Co(n),s=t.left+(n.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(n.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,h*=e.y,c+=s,l+=a,i=co(n),n=Mo(i)}}return eo({width:d,height:h,x:c,y:l})}function Bo(e,t){const i=Ao(e).scrollLeft;return t?t.left+i:jo(lo(e)).left+i}function Vo(e,t){const i=e.getBoundingClientRect();return{x:i.left+t.scrollLeft-Bo(e,i),y:i.top+t.scrollTop}}const zo=new Set(["absolute","fixed"]);function Ho(e,t,i){let r;if("viewport"===t)r=function(e,t){const i=co(e),r=lo(e),n=i.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,c=0;if(n){s=n.width,a=n.height;const e=To();(!e||e&&"fixed"===t)&&(o=n.offsetLeft,c=n.offsetTop)}const l=Bo(r);if(l<=0){const e=r.ownerDocument,t=e.body,i=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(i.marginLeft)+parseFloat(i.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-n);a<=25&&(s-=a)}else l<=25&&(s+=l);return{width:s,height:a,x:o,y:c}}(e,i);else if("document"===t)r=function(e){const t=lo(e),i=Ao(e),r=e.ownerDocument.body,n=La(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=La(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-i.scrollLeft+Bo(e);const o=-i.scrollTop;return"rtl"===Co(r).direction&&(a+=La(t.clientWidth,r.clientWidth)-n),{width:n,height:s,x:a,y:o}}(lo(e));else if(uo(t))r=function(e,t){const i=jo(e,!0,"fixed"===t),r=i.top+e.clientTop,n=i.left+e.clientLeft,s=po(e)?No(e):Ma(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:n*s.x,y:r*s.y}}(t,i);else{const i=Fo(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return eo(r)}function $o(e,t){const i=Ro(e);return!(i===t||!uo(i)||Po(i))&&("fixed"===Co(i).position||$o(i,t))}function Go(e,t,i){const r=po(t),n=lo(t),s="fixed"===i,a=jo(e,!0,s,t);let o={scrollLeft:0,scrollTop:0};const c=Ma(0);function l(){c.x=Bo(n)}if(r||!r&&!s)if(("body"!==oo(t)||mo(n))&&(o=Ao(t)),r){const e=jo(t,!0,s,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else n&&l();s&&!r&&n&&l();const d=!n||r||s?Ma(0):Vo(n,o);return{x:a.left+o.scrollLeft-c.x-d.x,y:a.top+o.scrollTop-c.y-d.y,width:a.width,height:a.height}}function Wo(e){return"static"===Co(e).position}function qo(e,t){if(!po(e)||"fixed"===Co(e).position)return null;if(t)return t(e);let i=e.offsetParent;return lo(e)===i&&(i=i.ownerDocument.body),i}function Ko(e,t){const i=co(e);if(yo(e))return i;if(!po(e)){let t=Ro(e);for(;t&&!Po(t);){if(uo(t)&&!Wo(t))return t;t=Ro(t)}return i}let r=qo(e,t);for(;r&&bo(r)&&Wo(r);)r=qo(r,t);return r&&Po(r)&&Wo(r)&&!Eo(r)?i:r||function(e){let t=Ro(e);for(;po(t)&&!Po(t);){if(Eo(t))return t;if(yo(t))return null;t=Ro(t)}return null}(e)||i}const Zo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:i,offsetParent:r,strategy:n}=e;const s="fixed"===n,a=lo(r),o=!!t&&yo(t.floating);if(r===a||o&&s)return i;let c={scrollLeft:0,scrollTop:0},l=Ma(1);const d=Ma(0),h=po(r);if((h||!h&&!s)&&(("body"!==oo(r)||mo(a))&&(c=Ao(r)),po(r))){const e=jo(r);l=No(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const u=!a||h||s?Ma(0):Vo(a,c);return{width:i.width*l.x,height:i.height*l.y,x:i.x*l.x-c.scrollLeft*l.x+d.x+u.x,y:i.y*l.y-c.scrollTop*l.y+d.y+u.y}},getDocumentElement:lo,getClippingRect:function(e){let{element:t,boundary:i,rootBoundary:r,strategy:n}=e;const s=[..."clippingAncestors"===i?yo(t)?[]:function(e,t){const i=t.get(e);if(i)return i;let r=Io(e,[]).filter(e=>uo(e)&&"body"!==oo(e)),n=null;const s="fixed"===Co(e).position;let a=s?Ro(e):e;for(;uo(a)&&!Po(a);){const t=Co(a),i=Eo(a);i||"fixed"!==t.position||(n=null),(s?!i&&!n:!i&&"static"===t.position&&n&&zo.has(n.position)||mo(a)&&!i&&$o(e,a))?r=r.filter(e=>e!==a):n=t,a=Ro(a)}return t.set(e,r),r}(t,this._c):[].concat(i),r],a=s[0],o=s.reduce((e,i)=>{const r=Ho(t,i,n);return e.top=La(r.top,e.top),e.right=Ra(r.right,e.right),e.bottom=Ra(r.bottom,e.bottom),e.left=La(r.left,e.left),e},Ho(t,a,n));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:Ko,getElementRects:async function(e){const t=this.getOffsetParent||Ko,i=this.getDimensions,r=await i(e.floating);return{reference:Go(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:i}=Do(e);return{width:t,height:i}},getScale:No,isElement:uo,isRTL:function(e){return"rtl"===Co(e).direction}},Yo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var i,r;const{x:s,y:a,placement:o,middlewareData:c}=t,l=await async function(e,t){const{placement:i,platform:r,elements:n}=e,s=await(null==r.isRTL?void 0:r.isRTL(n.floating)),a=Fa(i),o=ja(i),c="y"===Ha(i),l=so.has(a)?-1:1,d=s&&c?-1:1,h=Ua(t,e);let{mainAxis:u,crossAxis:p,alignmentAxis:g}="number"===typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&"number"===typeof g&&(p="end"===o?-1*g:g),c?{x:p*d,y:u*l}:{x:u*l,y:p*d}}(t,e);return o===(null==(i=c.offset)?void 0:i.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:s+l.x,y:a+l.y,data:(0,n.A)((0,n.A)({},l),{},{placement:o})}}}},Jo=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var i,n,a;const{rects:o,middlewareData:c,placement:l,platform:d,elements:h}=t,u=Ua(e,t),{crossAxis:p=!1,alignment:g,allowedPlacements:f=Aa,autoAlignment:m=!0}=u,v=(0,r.A)(u,s),b=void 0!==g||f===Aa?function(e,t,i){return(e?[...i.filter(t=>ja(t)===e),...i.filter(t=>ja(t)!==e)]:i.filter(e=>Fa(e)===e)).filter(i=>!e||ja(i)===e||!!t&&Wa(i)!==i)}(g||null,m,f):f,k=await io(t,v),y=(null==(i=c.autoPlacement)?void 0:i.index)||0,w=b[y];if(null==w)return{};const S=Ga(w,o,await(null==d.isRTL?void 0:d.isRTL(h.floating)));if(l!==w)return{reset:{placement:b[0]}};const x=[k[Fa(w)],k[S[0]],k[S[1]]],E=[...(null==(n=c.autoPlacement)?void 0:n.overflows)||[],{placement:w,overflows:x}],T=b[y+1];if(T)return{data:{index:y+1,overflows:E},reset:{placement:T}};const _=E.map(e=>{const t=ja(e.placement);return[e.placement,t&&p?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),P=(null==(a=_.filter(e=>e[2].slice(0,ja(e[0])?2:3).every(e=>e<=0))[0])?void 0:a[0])||_[0][0];return P!==l?{data:{index:y+1,overflows:E},reset:{placement:P}}:{}}}},Qo=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:i,y:s,placement:a}=t,o=Ua(e,t),{mainAxis:l=!0,crossAxis:d=!1,limiter:h={fn:e=>{let{x:t,y:i}=e;return{x:t,y:i}}}}=o,u=(0,r.A)(o,c),p={x:i,y:s},g=await io(t,u),f=Ha(Fa(a)),m=Ba(f);let v=p[m],b=p[f];if(l){const e="y"===m?"bottom":"right";v=Na(v+g["y"===m?"top":"left"],v,v-g[e])}if(d){const e="y"===f?"bottom":"right";b=Na(b+g["y"===f?"top":"left"],b,b-g[e])}const k=h.fn((0,n.A)((0,n.A)({},t),{},{[m]:v,[f]:b}));return(0,n.A)((0,n.A)({},k),{},{data:{x:k.x-i,y:k.y-s,enabled:{[m]:l,[f]:d}}})}}},Xo=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var i,n;const{placement:s,middlewareData:o,rects:c,initialPlacement:l,platform:d,elements:h}=t,u=Ua(e,t),{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0}=u,k=(0,r.A)(u,a);if(null!=(i=o.arrow)&&i.alignmentOffset)return{};const y=Fa(s),w=Ha(l),S=Fa(l)===l,x=await(null==d.isRTL?void 0:d.isRTL(h.floating)),E=f||(S||!b?[Qa(l)]:function(e){const t=Qa(e);return[Wa(e),t,Wa(t)]}(l)),T="none"!==v;!f&&T&&E.push(...Ja(l,b,v,x));const _=[l,...E],P=await io(t,k),C=[];let A=(null==(n=o.flip)?void 0:n.overflows)||[];if(p&&C.push(P[y]),g){const e=Ga(s,c,x);C.push(P[e[0]],P[e[1]])}if(A=[...A,{placement:s,overflows:C}],!C.every(e=>e<=0)){var R,L;const e=((null==(R=o.flip)?void 0:R.index)||0)+1,t=_[e];if(t){if(!("alignment"===g&&w!==Ha(t))||A.every(e=>Ha(e.placement)!==w||e.overflows[0]>0))return{data:{index:e,overflows:A},reset:{placement:t}}}let i=null==(L=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:L.placement;if(!i)switch(m){case"bestFit":{var I;const e=null==(I=A.filter(e=>{if(T){const t=Ha(e.placement);return t===w||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:I[0];e&&(i=e);break}case"initialPlacement":i=l}if(s!==i)return{reset:{placement:i}}}return{}}}},ec=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:i}=t,s=Ua(e,t),{strategy:a="referenceHidden"}=s,c=(0,r.A)(s,o);switch(a){case"referenceHidden":{const e=ro(await io(t,(0,n.A)((0,n.A)({},c),{},{elementContext:"reference"})),i.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:no(e)}}}case"escaped":{const e=ro(await io(t,(0,n.A)((0,n.A)({},c),{},{altBoundary:!0})),i.floating);return{data:{escapedOffsets:e,escaped:no(e)}}}default:return{}}}}},tc=e=>({name:"arrow",options:e,async fn(t){const{x:i,y:r,placement:s,rects:a,platform:o,elements:c,middlewareData:l}=t,{element:d,padding:h=0}=Ua(e,t)||{};if(null==d)return{};const u=Xa(h),p={x:i,y:r},g=$a(s),f=Va(g),m=await o.getDimensions(d),v="y"===g,b=v?"top":"left",k=v?"bottom":"right",y=v?"clientHeight":"clientWidth",w=a.reference[f]+a.reference[g]-p[g]-a.floating[f],S=p[g]-a.reference[g],x=await(null==o.getOffsetParent?void 0:o.getOffsetParent(d));let E=x?x[y]:0;E&&await(null==o.isElement?void 0:o.isElement(x))||(E=c.floating[y]||a.floating[f]);const T=w/2-S/2,_=E/2-m[f]/2-1,P=Ra(u[b],_),C=Ra(u[k],_),A=P,R=E-m[f]-C,L=E/2-m[f]/2+T,I=Na(A,L,R),M=!l.arrow&&null!=ja(s)&&L!==I&&a.reference[f]/2-(L{const r=new Map,s=(0,n.A)({platform:Zo},i),a=(0,n.A)((0,n.A)({},s.platform),{},{_c:r});return(async(e,t,i)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=i,c=a.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:u}=to(d,r,l),p=r,g={},f=0;for(let m=0;me.map(e=>{switch(e.type){case"a":if("string"===typeof e.content)return t=e.content,Z("a",{class:"link",href:t,target:"_blank",rel:"noopener noreferrer"},t);case"b":return(e=>Z("b",null,"string"===typeof e?e:rc(e)))(e.content);case"i":return(e=>Z("i",null,"string"===typeof e?e:rc(e)))(e.content);case"s":return(e=>"string"===typeof e?Z("s",null,e):Z("b",null,rc(e)))(e.content);case"q":return Z("span",{class:"block-quote"});default:return(e=>"string"===typeof e?e:Z("p",null,rc(e)))(e.content)}var t}),nc=e=>{let{message:t}=e;const i=t.slice(0,ls),r=os(i,!0),n=cs(i);return Z("p",null,0!==r.length&&Z("blockquote",null,r.split("\n").map(e=>{const t=hs(e);return Z("p",null,rc(t))})),n.split("\n").map(e=>{const t=hs(e);return Z("p",null,rc(t))}))};var sc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ac=class{constructor(e){f(this,e),this.variant="circular",this.iconPack=pn,this.t=un(),this.imageState="loading",this.getAvatar=()=>{var e;const t=Ln((null===(e=this.participant)||void 0===e?void 0:e.name)||"");let i;if(null!=this.participant&&"picture"in this.participant&&(i=this.participant.picture),i&&i.length>0&&"errored"!==this.imageState)return Z("div",{class:"image-ctr"},"loading"===this.imageState&&Z("rtk-spinner",{iconPack:this.iconPack}),Z("img",{src:i,class:{loaded:"loaded"===this.imageState},loading:"lazy",title:t,onLoad:()=>this.imageState="loaded",onError:()=>this.imageState="errored",part:"image"}));const r=Dn(t);return Z("div",{class:"initials",title:t,part:"initials"},r)}}render(){return Z(J,{key:"c1a0be37edb75c40b275ad59af85cee7df3f1cdf"},this.getAvatar(),Z("slot",{key:"1cd71e7494a09d68a52051edc279911dc3168515"}))}};sc([On()],ac.prototype,"iconPack",void 0),sc([On()],ac.prototype,"t",void 0),ac.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px);align-items:center;justify-content:center;font-size:28px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));overflow:clip;border-radius:9999px;-webkit-user-select:none;-moz-user-select:none;user-select:none}rtk-icon{height:50%;width:50%}.image-ctr{display:flex;height:100%;width:100%;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}img{height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);-o-object-fit:cover;object-fit:cover}img.loaded{height:100%;width:100%}.initials{display:flex;height:100%;width:100%;align-items:center;justify-content:center;text-transform:uppercase}.image{display:flex;height:100%;width:100%;align-items:center;justify-content:center}.image img{display:none;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}.image img.loaded{display:block}:host([variant='hexagon']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)}:host([variant='square']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)}:host([size='sm']){height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);font-size:12px}:host([size='md']){height:var(--rtk-space-28, 112px);width:var(--rtk-space-28, 112px)}:host([size='lg']){height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px)}";var oc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const cc=class{constructor(e){f(this,e),this.onParticipantsAdd=re(this,"participantsAdd",7),this.onParticipantDelete=re(this,"participantDelete",7),this.onRoomJoin=re(this,"roomJoin",7),this.deleteRoom=re(this,"delete",7),this.updateRoom=re(this,"update",7),this.allowDelete=!0,this.iconPack=pn,this.t=un(),this.isDragMode=!1,this.defaultExpanded=!1,this.editingTitleRoomId=null,this.newTitle=null,this.showExpandedCard=!1,this.glowingCard=!1,this.permissionsUpdateListener=()=>{this.permissions=this.meeting.self.permissions.connectedMeetings},this.reset=()=>{this.editingTitleRoomId=null,this.newTitle=null},this.onEditClick=()=>{if(this.editingTitleRoomId){if(this.newTitle.length<3)return;this.roomTitle=this.newTitle,this.updateRoom.emit({title:this.newTitle,id:this.editingTitleRoomId}),this.glowCard(),this.reset()}else this.editingTitleRoomId=this.room.id,M(()=>{this.inputTextEl.focus(),this.inputTextEl.select()})},this.onDrop=e=>{e.currentTarget instanceof HTMLParagraphElement&&(e.currentTarget.classList.remove("drop-zone-active"),this.onAssign())},this.onDragOver=e=>{e.currentTarget instanceof HTMLParagraphElement&&(e.currentTarget.classList.add("drop-zone-active"),e.preventDefault())}}connectedCallback(){var e;this.allParticipants=wt(this.meeting),this.permissionsUpdateListener(),this.showExpandedCard=this.defaultExpanded,this.roomTitle=this.room.isParent?this.t("breakout_rooms.main_room"):null===(e=this.room)||void 0===e?void 0:e.title,this.canEditMeetingTitle=this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&!this.meeting.connectedMeetings.isActive,this.meeting.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener)}disconnectedCallback(){this.meeting.self.permissions.off("permissionsUpdate",this.permissionsUpdateListener)}onDragLeave(e){e.currentTarget instanceof HTMLParagraphElement&&e.currentTarget.classList.remove("drop-zone-active")}getAssignmentHint(){return this.assigningParticipants&&this.isDragMode?this.t("breakout_rooms.drag_drop_participants"):this.assigningParticipants?this.t("breakout_rooms.click_drop_participants"):0===this.room.participants.length?this.t("breakout_rooms.none_assigned"):void 0}toggleCardDisplay(){this.showExpandedCard=!this.showExpandedCard}glowCard(){this.glowingCard=!0,setTimeout(()=>{this.glowingCard=!1},2e3)}onAssign(){this.onParticipantsAdd.emit(),this.glowCard()}onJoin(){this.onRoomJoin.emit()}onTitleChanged(e){"Enter"===e.key&&(this.newTitle=e.target.value,this.onEditClick())}renderPeer(e){const{displayPictureUrl:t}=this.allParticipants.find(t=>yt(t)===yt(e)),i=Ln(e.displayName||"");return Z("div",{class:"peer-ui-container"},Z("rtk-avatar",{participant:{name:i,picture:t},size:"sm"}),Z("p",{class:"name",title:i},Cn(i,16),this.meeting.self.userId===e.id&&" (".concat(this.t("you"),")")))}renderExpandedCardMaybe(){if(this.showExpandedCard&&!this.room.isParent&&this.getAssignmentHint()&&this.permissions.canAlterConnectedMeetings)return Z("div",{class:"message-container"},Z("p",{class:{"compact-height":0!==this.room.participants.length},onClick:()=>this.onAssign(),onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},this.getAssignmentHint()))}renderParticipantsMaybe(){if(this.showExpandedCard&&!this.room.isParent&&0!==this.room.participants.length)return Z("div",{class:"participant-list",onClick:()=>{this.onAssign()}},this.room.participants.map(e=>Z("div",{class:"participant-item",role:"listitem",key:e.id},this.renderPeer(e),this.permissions.canAlterConnectedMeetings&&Z("rtk-icon",{class:"show-on-hover",icon:this.iconPack.dismiss,onClick:()=>{this.onParticipantDelete.emit(e)}}))))}render(){var e,t,i;if(!this.meeting||!this.room||!this.permissions)return null;const r=this.permissions.canAlterConnectedMeetings||this.permissions.canSwitchConnectedMeetings&&!this.room.isParent||this.permissions.canSwitchToParentMeeting&&this.room.isParent;return Z(J,null,Z("div",{class:{"assign-mode":this.assigningParticipants,"selector-mode":!this.assigningParticipants,"glowing-card":this.glowingCard}},Z("div",{class:"header"},Z("input",{ref:e=>this.inputTextEl=e,placeholder:this.t("breakout_rooms.room_name"),disabled:!(this.editingTitleRoomId===this.room.id),value:this.roomTitle,minlength:3,onChange:e=>{this.newTitle=e.target.value},onKeyPress:e=>this.onTitleChanged(e),class:{"editing-enabled":this.editingTitleRoomId===this.room.id},style:{width:"".concat(this.roomTitle.length+1,"ch")}}),this.editingTitleRoomId!==this.room.id&&Z("span",{class:"participant-count"},"(",Z("rtk-icon",{icon:this.iconPack.people}),null!==(i=null===(t=null===(e=this.room)||void 0===e?void 0:e.participants)||void 0===t?void 0:t.length)&&void 0!==i?i:"0",")"),this.canEditMeetingTitle&&Z("rtk-tooltip",{label:this.editingTitleRoomId===this.room.id?this.t("breakout_rooms.save_room_name"):this.t("breakout_rooms.edit_room_name")},Z("rtk-icon",{icon:this.editingTitleRoomId===this.room.id?this.iconPack.checkmark:this.iconPack.edit,class:"show-on-hover",onClick:this.onEditClick})),Z("div",{class:"rooms-container"},this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&this.allowDelete&&Z("rtk-tooltip",{label:this.t("breakout_rooms.delete"),class:"danger"},Z("rtk-icon",{icon:this.iconPack.delete,class:"show-on-hover",onClick:()=>{this.deleteRoom.emit()}})),this.assigningParticipants&&this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&Z("rtk-button",{kind:"button",variant:"ghost",class:"assign-button",size:"md",onClick:()=>this.onAssign()},this.t("breakout_rooms.assign")),"edit"===this.mode&&!this.assigningParticipants&&r&&Z("rtk-button",{kind:"button",variant:"ghost",class:"assign-button",size:"md",disabled:this.room.id===this.meeting.meta.meetingId,onClick:()=>this.onJoin()},this.room.id===this.meeting.meta.meetingId?this.t("joined"):this.t("join")),!this.room.isParent&&Z("rtk-icon",{icon:this.showExpandedCard?this.iconPack.chevron_up:this.iconPack.chevron_down,onClick:()=>this.toggleCardDisplay()}))),this.renderExpandedCardMaybe(),this.renderParticipantsMaybe()))}};oc([On()],cc.prototype,"meeting",void 0),oc([On()],cc.prototype,"states",void 0),oc([On()],cc.prototype,"iconPack",void 0),oc([On()],cc.prototype,"t",void 0),cc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-sm, 4px)}@keyframes bg-glow{25%{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}50%{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}75%{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}}.glowing-card{animation:bg-glow 0.8s}.selector-mode,.assign-mode{display:flex;flex-direction:column;align-items:center;padding:var(--rtk-space-2, 8px);cursor:pointer}.selector:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.show-on-hover{display:none}.header{width:100%;display:flex;align-items:center}.header rtk-icon{margin-left:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);cursor:pointer}.header .danger{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.header .hide{display:none}.header .rooms-container{display:flex;flex-grow:1;flex-direction:row;align-items:center;justify-content:flex-end}.header input{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-1, 4px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));max-width:var(--rtk-space-36, 144px);font-size:14px;font-weight:500;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-border-opacity))}.header input:disabled{overflow-x:visible;border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}.header input:invalid{border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:dashed;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity))}.header input.editing-enabled{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.header .participant-count{display:flex;align-items:center;font-size:14px;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.header .participant-count rtk-icon{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0\\.5, 2px);width:var(--rtk-space-3, 12px)}.header .assign-button{height:var(--rtk-space-6, 24px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));text-decoration-line:underline}.header .assign-button:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.participant-list{display:grid;flex-grow:1;grid-template-columns:repeat(2, minmax(0, 1fr));gap:var(--rtk-space-2, 8px);margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);width:100%;border-radius:var(--rtk-border-radius-sm, 4px)}.participant-list::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px)}.participant-list::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.participant-list::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.participant-item{display:flex;align-items:center;justify-content:space-between;margin-right:var(--rtk-space-2, 8px);height:-moz-fit-content;height:fit-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}.participant-item:hover{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.selector-mode:hover .show-on-hover{display:flex}.message-container{margin:var(--rtk-space-0, 0px);display:flex;width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.message-container p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);height:var(--rtk-space-20, 80px);display:flex;width:100%;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));border-style:dashed;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}.message-container p:hover{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.25)}.message-container .drop-zone-active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.25)}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}.show-on-hover{margin-left:var(--rtk-space-4, 16px);height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);display:none}:host(:hover) .show-on-hover{display:flex}.peer-ui-container{position:relative;display:flex;align-items:center;gap:var(--rtk-space-2, 8px);height:var(--rtk-space-10, 40px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.peer-ui-container rtk-avatar{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.peer-ui-container .name{font-size:14px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}";var lc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const dc=class{constructor(e){f(this,e),this.onSelectedParticipantsUpdate=re(this,"selectedParticipantsUpdate",7),this.onAllToggled=re(this,"allParticipantsToggleUpdate",7),this.onParticipantsDragging=re(this,"participantsDragging",7),this.participantIds=[],this.iconPack=pn,this.t=un(),this.search="",this.participantsToShow=[],this.selectedParticipantIds=[],this.isDragging=!1,this.onSearchInput=e=>{this.search=e.target.value},this.onDragStart=e=>{this.isDragging=!0,this.onParticipantsDragging.emit(!0),this.updateSelectedParticipants(e,!0)},this.onDragEnd=e=>{this.isDragging=!1,this.onParticipantsDragging.emit(!1),this.updateSelectedParticipants(e,!1)},this.onClick=e=>{const t=this.selectedParticipantIds.includes(yt(e));this.updateSelectedParticipants(e,!t)},this.onToggleAll=e=>{const t=e?this.participantsToShow.map(yt):[];this.onAllToggled.emit(t)}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}disconnectedCallback(){this.meeting}updateSelectedParticipants(e,t){const i=yt(e);let r=[];r=t&&!this.selectedParticipantIds.includes(i)?[...this.selectedParticipantIds,i]:[...this.selectedParticipantIds.filter(e=>e!==i)],this.onSelectedParticipantsUpdate.emit(r)}meetingChanged(e){e&&this.getParticipants(this.search)}participantsChanged(){this.getParticipants(this.search)}searchChanged(e){this.getParticipants(e)}getParticipants(e){const t=wt(this.meeting);this.participantsToShow=t.filter(t=>{var i;return this.participantIds.includes(yt(t))&&(null!==(i=t.displayName)&&void 0!==i?i:"").toLowerCase().includes(e.toLowerCase())})}renderPeer(e){const t=Ln(e.displayName||"");return Z("div",{class:"peer-ui-container"},Z("rtk-avatar",{participant:{name:e.displayName,picture:e.displayPictureUrl},size:"sm"}),Z("p",{class:"name",title:t},Cn(t,16),this.meeting.self.userId===e.id&&" (".concat(this.t("you"),")")))}render(){return Z(J,{key:"3d6466a85fa946d5c0d064d22431e3c7bf044787"},Z("div",{key:"8626af199d5290ce595212817ee06c1ef00d91bf",class:"search-wrapper"},Z("div",{key:"9ac706f201f5975b7d36b4dde7fd9504321b7d5f",class:"search",part:"search"},Z("rtk-icon",{key:"0ccba51717c665364934ea1bfdd7eeea3c5e96b7",icon:this.iconPack.search,part:"search-icon",class:"search-icon"}),Z("input",{key:"01c85631f3e1823d1ab384bad4a9efbd86514894",type:"search",autocomplete:"off",placeholder:this.t("search"),onInput:this.onSearchInput,part:"search-input"})),Z("slot",{key:"9d3a00a2bd167d053025d979bb0a498028b664de",name:"shuffle-button"})),Z("div",{key:"38defd0577bedacd300e8cb558b42727b7817420",class:"header"},Z("div",{key:"e11f58aae66a50800625464b79517e59094e5f1d",class:"title-wrapper"},Z("span",{key:"99ec80653bc7045fd08c4e95ac15f95dc3ca90ad"},this.t("breakout_rooms.main_room")),Z("span",{key:"40617acc26b95df49c2f221846ee811046709908",class:"participant-count"},"(",Z("rtk-icon",{key:"aa8c4c4281635c998ea7c254b611341fd28e65cc",icon:this.iconPack.people}),this.participantsToShow.length,")")),0!==this.selectedParticipantIds.length&&Z("rtk-tooltip",{key:"ce8eb895411d27003cafccb8ed694851df0ec52e",label:this.t("breakout_rooms.select_all")},Z("input",{key:"76ba09891936c9dfbfbd216f030c32b38c3160ee",type:"checkbox",checked:this.selectedParticipantIds.length===this.participantsToShow.length,onChange:e=>this.onToggleAll(!!e.target.checked)}))),Z("div",{key:"2ac3f88bd10747f453a626837a8806072ccc283d",class:"ctr scrollbar",part:"container"},this.participantsToShow.length>0&&Z("ul",{key:"01e08e47d7b52a1805561b3efc4e97713f542a4d",class:"participants",part:"participants"},this.participantsToShow.map(e=>Z("li",{class:{"participant-item":!0,dragging:this.isDragging},onClick:()=>this.onClick(e),onDragStart:()=>this.onDragStart(e),onDragEnd:()=>this.onDragEnd(e),draggable:0===this.selectedParticipantIds.length,role:"listitem",key:e.id},this.renderPeer(e),!this.isDragging&&Z("input",{type:"checkbox",class:{"hide-checkbox":0===this.selectedParticipantIds.length},checked:this.selectedParticipantIds.includes(yt(e))})))),0===this.participantsToShow.length&&this.search.length>0&&Z("div",{key:"aa14388c88e230528364d906d97972abdb4a5d7c",class:"empty-message"},this.t("participants.errors.empty_results")),0===this.participantsToShow.length&&0===this.search.length&&Z("div",{key:"0b10bd982a32001549df0d38cb76f0fcc112fb3d",class:"empty-room"},Z("rtk-icon",{key:"bc7ce0cfa9f46e0d793f9b9a6b3866325963d017",icon:this.iconPack.people_checked,part:"search-icon",class:"search-icon"}),Z("p",{key:"6ff4827b2df19620c677fdbf432669fd60200bb1"},this.t("breakout_rooms.all_assigned")),Z("span",{key:"ea6e1b05bfaf16842687fbdf1b680cb64fe2a9ef"},this.t("breakout_rooms.empty_main_room")))))}static get watchers(){return{meeting:["meetingChanged"],participantIds:["participantsChanged"],search:["searchChanged"]}}};lc([On()],dc.prototype,"meeting",void 0),lc([On()],dc.prototype,"iconPack",void 0),lc([On()],dc.prototype,"t",void 0),dc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;height:100%;flex-direction:column;font-size:14px}:host input[type='checkbox']{margin:var(--rtk-space-0, 0px);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:var(--rtk-border-radius-sm, 4px);position:relative;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;border-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}:host input[type='checkbox']:checked{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host input[type='checkbox']:checked::before{position:absolute;top:1px;left:1px;height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);background-color:rgb(var(--rtk-colors-text-1000, 255 255 255));content:'';clip-path:polygon(5% 60%, 35% 93%, 100% 19%, 86% 4%, 36% 62%, 19% 44%)}*{box-sizing:border-box}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.ctr{box-sizing:border-box;padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);overflow-y:auto;flex-grow:1;flex-basis:0}.empty-message{margin-top:var(--rtk-space-10, 40px);margin-bottom:var(--rtk-space-10, 40px);text-align:center;font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.empty-room{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--rtk-space-2, 8px);height:100%;text-align:center;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.empty-room rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}.empty-room p{font-size:16px;font-weight:500;margin:var(--rtk-space-0, 0px)}.empty-room span{font-size:12px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search-wrapper{margin-bottom:var(--rtk-space-1, 4px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);height:var(--rtk-space-8, 32px)}.search .search-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search input{box-sizing:border-box;width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:inherit;color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.header{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-1\\.5, 6px);height:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-0\\.5, 2px);border-bottom-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));display:flex;align-items:center;justify-content:space-between}.title-wrapper{display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.participant-count{display:flex;align-items:center;font-size:14px}.participant-count rtk-icon{margin-right:var(--rtk-space-0\\.5, 2px);width:var(--rtk-space-3, 12px)}.participant-item{display:flex;align-items:center;justify-content:space-between;margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);cursor:pointer}.participant-item input.hide-checkbox{display:none}.participant-item input:checked{display:inline-block}.dragging input{display:none}.participant-item:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.participant-item:hover input{display:inline-block}.peer-ui-container{position:relative;display:flex;align-items:center;gap:var(--rtk-space-2, 8px);height:var(--rtk-space-10, 40px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px);color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.peer-ui-container rtk-avatar{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.peer-ui-container .name{font-size:14px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}";var hc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const uc=class{constructor(e){var t=this;f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.loading=!1,this.roomConfig={rooms:2,step:"room-config",mode:"create",applyingChanges:!1},this.assigningParticipants=!1,this.selectedParticipants=[],this.ephemeralStatusText="",this.isDragMode=!1,this.iconPack=pn,this.t=un(),this.permissionsUpdateListener=()=>{this.permissions=this.meeting.self.permissions.connectedMeetings},this.updateLocalState=e=>{this.stateManager.updateCurrentState(e),this.draftState=this.stateManager.currentState,this.meeting.connectedMeetings.isActive&&(this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{mode:"edit"})),"create"!==this.roomConfig.mode||this.meeting.connectedMeetings.isActive||(vt=0),["edit","view"].includes(this.roomConfig.mode)&&(this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{rooms:e.meetings.length,step:"participants-config"}),this.selectedParticipants=[])},this.onAddNewRoom=()=>{this.stateManager.addNewMeeting(),this.draftState=this.stateManager.currentState,this.selectorRef.scrollTo({top:this.selectorRef.scrollHeight,behavior:"smooth"})},this.onRoomUpdate=e=>{const{detail:t}=e;this.stateManager.updateMeetingTitle(t.id,t.title),this.draftState=this.stateManager.currentState},this.onRoomDelete=e=>{this.stateManager.allConnectedMeetings.find(t=>t.id===e)&&(this.stateManager.deleteMeeting(e),this.draftState=this.stateManager.currentState)},this.unassignParticipant=e=>{this.stateManager.unassignParticipants([e]),this.draftState=this.stateManager.currentState},this.onUnassignAll=()=>{this.stateManager.unassignAllParticipants(),this.draftState=this.stateManager.currentState},this.assignParticipantsToRoom=e=>{0!==this.selectedParticipants.length&&0!=this.assigningParticipants&&(this.stateManager.assignParticipantsToMeeting(this.selectedParticipants,e),this.draftState=this.stateManager.currentState,this.selectedParticipants=[],this.assigningParticipants=!1,this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.participants_assigned")))},this.handleClose=(e,t)=>{e.emit({activeBreakoutRoomsManager:{active:!0}}),t.activeBreakoutRoomsManager={active:!0}},this.enableConfirmationModal=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start-breakout",i={active:!0,header:"breakout_rooms.confirm_modal.start_breakout.header",content:"breakout_rooms.confirm_modal.start_breakout.content",variant:"primary",cancelText:"breakout_rooms.confirm_modal.start_breakout.cancelText",ctaText:"breakout_rooms.confirm_modal.start_breakout.ctaText",onClick:()=>t.applyChanges(),onClose:t.handleClose};"close-breakout"===e&&(i={active:!0,header:"breakout_rooms.confirm_modal.close_breakout.header",content:"breakout_rooms.confirm_modal.close_breakout.content",variant:"danger",cancelText:"cancel",ctaText:"breakout_rooms.confirm_modal.close_breakout.ctaText",onClick:()=>t.closeBreakout(),onClose:t.handleClose}),t.stateUpdate.emit({activeBreakoutRoomsManager:{active:!1},activeConfirmationModal:i})},this.close=()=>{this.stateManager.discardChanges(),this.stateUpdate.emit({activeBreakoutRoomsManager:{active:!1}})},this.applyChanges=async()=>{this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{applyingChanges:!0}),await this.stateManager.applyChanges(this.meeting),this.close(),this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{applyingChanges:!1})}}onSelectedParticipantsChanged(e){e.length>0?this.assigningParticipants=!0:this.assigningParticipants=!1}connectedCallback(){this.permissionsUpdateListener(),this.meeting.connectedMeetings.on("stateUpdate",this.updateLocalState),this.meeting.connectedMeetings.on("changingMeeting",this.close),this.meeting.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener),this.stateManager=new Bt,this.fetchRoomState()}disconnectedCallback(){this.meeting.connectedMeetings.off("stateUpdate",this.updateLocalState),this.meeting.connectedMeetings.off("changingMeeting",this.close),this.meeting.self.permissions.off("permissionsUpdate",this.permissionsUpdateListener)}async fetchRoomState(){this.loading=!0,await this.meeting.connectedMeetings.getConnectedMeetings(),this.loading=!1}setEphemeralStatus(e){this.ephemeralStatusText=e,setTimeout(()=>{this.ephemeralStatusText=""},3e3)}onCreateRooms(){this.selectedParticipants=[],this.stateManager.addNewMeetings(this.roomConfig.rooms),this.draftState=this.stateManager.currentState,this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{step:"participants-config"})}onParticipantDelete(e){const{detail:t}=e,i=yt(t);null!=i&&this.unassignParticipant(i)}toggleDragMode(e){this.isDragMode=e.detail}assignParticipantsRandomly(){0!==this.stateManager.unassignedParticipants.length&&(this.stateManager.assignParticipantsRandomly(),this.draftState=this.stateManager.currentState,this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.participants_assigned_randomly")))}async joinRoom(e){const t=yt(this.meeting.self);this.stateManager.assignParticipantsToMeeting([t],e),await this.applyChanges()}async closeBreakout(){this.stateManager.allConnectedMeetings.forEach(e=>this.stateManager.deleteMeeting(e.id)),await this.applyChanges()}updateSelectedParticipants(e){this.selectedParticipants=e.detail}updateAllParticipants(e){this.selectedParticipants=e.detail}getStatusText(){if(""!==this.ephemeralStatusText)return this.ephemeralStatusText;let e="";return"create"===this.roomConfig.mode&&(e=this.t("breakout_rooms.status.assign_multiple"),0!==this.selectedParticipants.length&&(e=this.t("breakout_rooms.status.select_room"))),e}getApproxDistribution(){const e=this.stateManager.unassignedParticipants.length/(this.roomConfig.rooms||1);return Math.max(1,Math.round(e))}deselectAll(){this.selectedParticipants=[]}async discardChanges(){this.stateManager.discardChanges(),await this.fetchRoomState(),this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.changes_discarded"))}shouldShowOnlyRoomSwitcher(){return!1===this.permissions.canAlterConnectedMeetings}getPermittedRooms(){return this.permissions.canAlterConnectedMeetings||this.permissions.canSwitchConnectedMeetings?this.stateManager.allConnectedMeetings:this.stateManager.allConnectedMeetings.filter(e=>e.id===this.meeting.meta.meetingId)}renderMainRoomMaybe(){return this.meeting.connectedMeetings.isActive&&this.permissions.canSwitchToParentMeeting?Z("rtk-breakout-room-manager",{key:this.stateManager.currentState.parentMeeting.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,meeting:this.meeting,mode:this.roomConfig.mode,onParticipantsAdd:()=>this.assignParticipantsToRoom(this.stateManager.currentState.parentMeeting.id),onRoomJoin:()=>this.joinRoom(this.stateManager.currentState.parentMeeting.id),onUpdate:this.onRoomUpdate,states:this.states,room:Object.assign({},this.stateManager.currentState.parentMeeting),iconPack:this.iconPack,t:this.t}):null}renderRoomSwitcher(){return Z(J,null,Z("div",{class:"room-switcher-container"},Z("header",null,Z("rtk-icon",{icon:this.iconPack.breakout_rooms}),Z("span",null,this.t("breakout_rooms.join_breakout_header"))),Z("div",{class:"rooms",ref:e=>this.selectorRef=e},this.renderMainRoomMaybe(),this.getPermittedRooms().map((e,t)=>Z("rtk-breakout-room-manager",{key:e.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,defaultExpanded:0===t,meeting:this.meeting,mode:this.roomConfig.mode,onDelete:()=>this.onRoomDelete(e.id),onParticipantsAdd:()=>this.assignParticipantsToRoom(e.id),onRoomJoin:()=>this.joinRoom(e.id),states:this.states,room:Object.assign({},e),iconPack:this.iconPack,t:this.t,allowDelete:!1})))))}renderLoading(){return Z(J,null,Z("div",{class:"loading-content"},Z("rtk-spinner",{size:"xl"})))}renderRoomConfig(){return Z(J,null,Z("div",{class:"room-config"},Z("header",null,Z("rtk-icon",{icon:this.iconPack.breakout_rooms}),Z("span",null,this.t("breakout_rooms.room_config_header"))),Z("div",{class:"create-room"},Z("p",null,this.t("breakout_rooms.num_of_rooms")),Z("rtk-counter",{value:this.roomConfig.rooms,minValue:1,iconPack:this.iconPack,t:this.t,onValueChange:e=>{this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{rooms:Math.max(+e.detail,1)})}})),Z("span",{class:"distribution-hint"},"".concat(this.t("breakout_rooms.approx")," ")," ",Z("em",null,this.getApproxDistribution()," ",this.t("breakout_rooms.participants_per_room"))," ",this.t("breakout_rooms.division_text")),Z("footer",null,Z("rtk-button",{kind:"button",size:"lg",title:this.t("create"),disabled:0===this.roomConfig.rooms,onClick:()=>this.onCreateRooms()},this.t("create")))))}render(){return this.loading?this.renderLoading():this.shouldShowOnlyRoomSwitcher()?this.renderRoomSwitcher():"room-config"===this.roomConfig.step?this.renderRoomConfig():Z(J,null,Z("div",{class:"participant-config-wrapper"},Z("div",{class:"participant-config"},Z("aside",{part:"menu"},Z("header",null,this.t("breakout_rooms.assign_participants")),Z("rtk-breakout-room-participants",{meeting:this.meeting,iconPack:this.iconPack,t:this.t,participantIds:this.stateManager.unassignedParticipants.map(yt),selectedParticipantIds:this.selectedParticipants},Z("rtk-tooltip",{label:this.t("breakout_rooms.shuffle_participants"),slot:"shuffle-button"},Z("rtk-button",{disabled:"edit"===this.roomConfig.mode||0===this.stateManager.unassignedParticipants.length,kind:"button",variant:"secondary",size:"md",onClick:()=>this.assignParticipantsRandomly(),class:"shuffle-button br-primary-btn"},Z("rtk-icon",{icon:this.iconPack.shuffle})))),0!==this.selectedParticipants.length&&Z("div",{class:"participants-assign-actions"},Z("span",null,"".concat(this.selectedParticipants.length," ").concat(this.t("breakout_rooms.selected"))),Z("rtk-button",{disabled:"edit"===this.roomConfig.mode,kind:"button",variant:"ghost",size:"md",onClick:()=>this.deselectAll(),class:"deselect-button color-danger"},this.t("breakout_rooms.deselect")))),Z("div",{class:"assign-rooms"},Z("div",{class:"row"},Z("p",{class:"row-header"},this.t("breakout_rooms.rooms")," (",this.stateManager.allConnectedMeetings.length,")"),!this.assigningParticipants&&Z("div",{class:"cta-buttons"},Z("rtk-button",{kind:"button",variant:"secondary",class:"br-primary-btn"},Z("div",{onClick:this.onAddNewRoom},Z("rtk-icon",{icon:this.iconPack.add}),this.t("breakout_rooms.add_room"))),0!==this.stateManager.allConnectedMeetings.flatMap(e=>e.participants).length&&Z("rtk-button",{kind:"button",variant:"ghost",onClick:this.onUnassignAll},this.t("breakout_rooms.unassign_all")))),Z("div",{class:"rooms",ref:e=>this.selectorRef=e},this.renderMainRoomMaybe(),this.getPermittedRooms().map((e,t)=>Z("rtk-breakout-room-manager",{key:e.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,defaultExpanded:0===t,meeting:this.meeting,mode:this.roomConfig.mode,onDelete:()=>this.onRoomDelete(e.id),onParticipantsAdd:()=>this.assignParticipantsToRoom(e.id),onRoomJoin:()=>this.joinRoom(e.id),onUpdate:this.onRoomUpdate,states:this.states,room:Object.assign({},e),iconPack:this.iconPack,t:this.t,allowDelete:this.stateManager.allConnectedMeetings.length>1})),Z("rtk-button",{kind:"button",variant:"secondary",onClick:this.onAddNewRoom,class:"add-room-jumbo-btn br-secondary-btn"},Z("div",null,Z("rtk-icon",{icon:this.iconPack.add}),Z("span",null,this.t("breakout_rooms.add_room_brief"))))))),Z("div",{class:"participant-config-actions"},Z("div",{class:{"status-bar":!0,"ephemeral-status":""!==this.ephemeralStatusText}},""!==this.ephemeralStatusText&&Z("rtk-icon",{icon:this.iconPack.checkmark}),this.getStatusText()),Z("div",{class:"breakout-actions"},"create"===this.roomConfig.mode&&this.permissions.canAlterConnectedMeetings&&Z("rtk-button",{size:"md",class:"start-breakout-button",onClick:()=>this.enableConfirmationModal("start-breakout")},this.t("breakout_rooms.start_breakout")),"edit"===this.roomConfig.mode&&this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&Z("rtk-button",{size:"md",class:"color-danger",variant:"ghost",onClick:()=>this.discardChanges()},this.t("breakout_rooms.discard_changes")),"edit"===this.roomConfig.mode&&this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&Z("rtk-button",{size:"md",class:"update-breakout-button",onClick:this.applyChanges},this.t("breakout_rooms.update_breakout")),"edit"===this.roomConfig.mode&&!this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&Z("rtk-button",{size:"md",class:"close-breakout-button",onClick:()=>this.enableConfirmationModal("close-breakout")},this.t("breakout_rooms.close_breakout"))))))}static get watchers(){return{selectedParticipants:["onSelectedParticipantsChanged"]}}};hc([On()],uc.prototype,"meeting",void 0),hc([On()],uc.prototype,"states",void 0),hc([On()],uc.prototype,"iconPack",void 0),hc([On()],uc.prototype,"t",void 0),uc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.color-brand{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.color-danger{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.loading-content{height:var(--rtk-space-60, 240px);width:var(--rtk-space-96, 384px);padding:var(--rtk-space-9, 36px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;align-items:center;justify-content:center}.room-config{overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;flex-direction:column;width:var(--rtk-space-96, 384px);padding-left:var(--rtk-space-9, 36px);padding-right:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-10, 40px);padding-bottom:var(--rtk-space-10, 40px)}header{margin-bottom:var(--rtk-space-8, 32px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px);font-size:24px;font-weight:600}header rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}.create-room{margin-bottom:var(--rtk-space-4, 16px);display:flex;align-items:center;gap:var(--rtk-space-3, 12px);width:100%}.create-room p{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-1, 4px);font-size:16px}.distribution-hint{margin-bottom:var(--rtk-space-8, 32px);font-size:14px;font-weight:400;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.distribution-hint em{font-style:normal;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}footer{display:flex;flex-direction:row;vertical-align:middle;justify-content:center}footer rtk-button{width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}label{margin-bottom:var(--rtk-space-3, 12px);font-weight:400;color:rgb(var(--rtk-colors-text-1000, 255 255 255));opacity:0.4}.participant-config-wrapper{width:850px;min-height:595px;max-width:100%;max-height:100%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column}.participant-config-actions{display:flex;justify-content:space-between;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-5, 20px);padding-bottom:var(--rtk-space-5, 20px);border-bottom-right-radius:var(--rtk-border-radius-md, 8px);border-bottom-left-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.participant-config{display:flex;flex-grow:1;flex-direction:row;overflow:hidden}aside{box-sizing:border-box;display:flex;width:var(--rtk-space-96, 384px);flex-grow:1;flex-direction:column;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-4, 16px);border-right-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-right-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}aside header{margin-bottom:var(--rtk-space-4, 16px);width:100%;padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px);padding-top:var(--rtk-space-8, 32px);font-size:20px;font-weight:500;line-height:2rem}.shuffle-button{display:flex;flex-direction:row;align-items:center}.shuffle-button rtk-icon{height:var(--rtk-space-8, 32px)}.participants-assign-actions{display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:14px;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-2, 8px);margin-left:calc(var(--rtk-space-8, 32px) * -1);margin-right:calc(var(--rtk-space-4, 16px) * -1);padding-top:var(--rtk-space-0\\.5, 2px);padding-bottom:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.participants-assign-actions .deselect-button{height:var(--rtk-space-6, 24px)}.participants-assign-actions .deselect-button:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.assign-rooms{padding:var(--rtk-space-8, 32px);display:flex;width:100%;flex-direction:column}.assign-rooms .disabled{opacity:0.2}.assign-rooms .back{display:flex;cursor:pointer;flex-direction:row;align-items:center;justify-content:flex-start;padding:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-0, 0px);font-size:14px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.assign-rooms .back rtk-icon{height:var(--rtk-space-5, 20px)}.assign-rooms .row{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}.assign-rooms .row-header{margin:var(--rtk-space-0, 0px);font-size:16px;line-height:2rem}.assign-rooms .cta-buttons{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}.assign-rooms .cta-buttons rtk-button div{display:flex;flex-direction:row;align-items:center}.assign-rooms .cta-buttons rtk-button div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.rooms{margin-bottom:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-1, 4px);display:flex;flex-grow:1;flex-direction:column;gap:var(--rtk-space-2, 8px);overflow-y:auto;max-height:500px}.rooms::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px)}.rooms::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.rooms::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.breakout-actions{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:var(--rtk-space-2, 8px)}.breakout-actions .start-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.breakout-actions .close-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}.breakout-actions .update-breakout-button{background-color:transparent;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}.status-bar{display:flex;align-items:center;font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));width:var(--rtk-space-80, 320px)}.ephemeral-status{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.ephemeral-status rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.room-switcher-container{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));width:468px;padding:var(--rtk-space-8, 32px)}.add-room-jumbo-btn div{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.add-room-jumbo-btn div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.br-primary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-primary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}";var pc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const gc=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un(),this.messagePayload={to:"Everyone",message:""},this.successMessage=!1}close(){var e;null===(e=this.stateUpdate)||void 0===e||e.emit({activeBroadcastMessageModal:!1})}sendMessage(){this.successMessage=!0,setTimeout(()=>{this.close()},2e3)}render(){return Z(J,{key:"4d23ce819f004fd0e14a4c9062e21f1321c46495"},Z("div",{key:"f0814536068dd268c1aec9d80c45cc6817fe184b",class:"content-col"},Z("h2",{key:"5b0caef4e9f93d1a18c7bba8a269f10d95f5d290"},"Broadcast message to"),Z("select",{key:"8f32291fa522cf7a5947caf54178327e1574f103",onChange:e=>{this.messagePayload=Object.assign(Object.assign({},this.messagePayload),{to:e.target.value})}},Z("option",{key:"b09bb9b952ade48788bf8ab15645a1a45dab6935"},"Everyone"),Z("option",{key:"177d1af8eaeaa77393a9b2e477fca32563c05290"},"List of rooms")),Z("textarea",{key:"b592528751cb63fa8c107b2b63455bfed0b3f3cb",placeholder:"Type message here...",onInput:e=>{this.messagePayload=Object.assign(Object.assign({},this.messagePayload),{message:e.target.value})}}),this.successMessage?Z("p",null,"Message sent to ",this.messagePayload.to,Z("rtk-icon",{icon:this.iconPack.checkmark})):Z("div",{class:"content-row"},Z("rtk-button",{onClick:()=>this.close(),variant:"secondary"},"Cancel"),"\u2002",Z("rtk-button",{variant:"primary",onClick:()=>this.sendMessage()},"Send"))))}};pc([On()],gc.prototype,"meeting",void 0),pc([On()],gc.prototype,"states",void 0),pc([On()],gc.prototype,"iconPack",void 0),pc([On()],gc.prototype,"t",void 0),gc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);padding:var(--rtk-space-4, 16px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));width:400px;max-width:80%}.content-col{display:flex;width:100%;flex-direction:column}h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-2, 8px)}.content-row{display:flex;width:100%;flex-direction:row}.content-row rtk-button{margin-top:var(--rtk-space-4, 16px);width:100%}textarea{margin-top:var(--rtk-space-3, 12px);resize:none;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;font-family:var(--rtk-font-family, sans-serif);outline:2px solid transparent;outline-offset:2px;height:var(--rtk-space-16, 64px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}textarea::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}textarea::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}select{border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);outline:2px solid transparent;outline-offset:2px;border-right-width:var(--rtk-border-width-md, 2px);border-style:solid;border-color:transparent;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p{margin:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-2, 8px);width:100%;text-align:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));display:flex;flex-direction:row;align-items:center;justify-content:center}p rtk-icon{margin-left:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px)}";const fc=class{constructor(e){f(this,e),this.variant="primary",this.kind="button",this.reverse=!1,this.disabled=!1,this.type="button"}render(){return Z(J,{key:"0f96cef4ae77a2be8013fa5d62d39626734eeced"},Z("button",{key:"8c06d5f5cc71779b8d56f31d2dd77b8d35e8b280",part:"button",type:this.type,disabled:this.disabled},Z("span",{key:"ae741ddf8cc914f9493c26330b1f322541f64223",class:"start"},Z("slot",{key:"18275dab42a4dd38b5a59463ffca227e4a6df3c8",name:"start"})),Z("span",{key:"c2b912515b6edc2966c4cdb282c89022aa05c13f",class:"content",part:"content"},Z("slot",{key:"5d87993198e16a3b5f38e62979fa2ee5637a059d"})),Z("span",{key:"0bc907da23ea362f8ae0b3fdf88452b1c3881078",class:"end"},Z("slot",{key:"0862eeefcfa5765ce605b99a04aab88222ed6e68",name:"end"}))))}static get delegatesFocus(){return!0}};fc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--icon-size:var(--rtk-button-icon-size, var(--rtk-space-5, 20px));--transition-property:var(--rtk-transition-property, all);--transition-duration:100ms;display:inline-flex;height:var(--rtk-space-8, 32px);cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-sm, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration)}button{box-sizing:border-box;background-color:transparent;color:inherit;border:var(--rtk-border-width-sm, 1px) solid transparent;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);display:inline-flex;flex-grow:1;justify-content:center;vertical-align:baseline;gap:var(--rtk-space-1, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration);outline:none;height:inherit;border-radius:inherit;fill:inherit;cursor:inherit;font-weight:inherit;font-family:inherit;font-size:inherit;line-height:inherit}.start,.content,.end{align-self:center}::slotted(rtk-icon),::slotted(rtk-spinner){height:var(--icon-size);width:var(--icon-size)}:host([variant='primary']){color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}button:focus-visible{border-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity))}:host([disabled]:not([disabled='false'])){cursor:not-allowed;opacity:0.6}:host([variant='secondary']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='secondary']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='secondary']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([variant='danger']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='danger']:hover){background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.7)}:host([variant='danger']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='ghost']){background-color:transparent;color:inherit}:host([variant='ghost'].active){--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}:host([variant='ghost']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='ghost']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([kind='icon']){--icon-size:var(--rtk-space-5, 20px);width:var(--rtk-space-8, 32px)}:host([kind='icon']) button{padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px)}:host([kind='wide']){width:100%}:host([size='lg']){--icon-size:var(--rtk-space-5, 20px);height:var(--rtk-space-10, 40px);font-size:16px}:host([size='lg'][kind='icon']){--icon-size:var(--rtk-space-6, 24px);height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px)}:host([size='sm']){--icon-size:var(--rtk-space-4, 16px);height:var(--rtk-space-6, 24px);font-size:12px}:host([size='sm'][kind='icon']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}";var mc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const vc=class{constructor(e){var t=this;f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.switchChannel=re(this,"switchChannel",7),this.t=un(),this.iconPack=pn,this.channelName="",this.searchQuery="",this.step=1,this.loading=!1,this.selectedMemberIds=new Set,this.focusedMemberIndex=-1,this.showAllMembersList=!1,this.allMembers=new Map,this.inputTextRef=null,this.searchInputTextRef=null,this.focusOnSearch=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.focusedMemberIndex=-1,M(()=>{var i,r;null===(i=t.searchInputTextRef)||void 0===i||i.focus(),e&&(null===(r=t.searchInputTextRef)||void 0===r||r.select())})},this.onClickHandler=async()=>{if(0!==this.channelName.length){if(1===this.step){const e=this.meeting.participants.all.toArray(),t=this.meeting.self.userId;return e.filter(e=>e.userId!==t).forEach(e=>this.allMembers.set(e.userId,e)),this.step=2,void this.focusOnSearch()}await this.createChannel()}},this.createChannel=async()=>{const e=Array.from(this.selectedMemberIds),t=await this.meeting.chat.createChannel(this.channelName,e,{displayPictureUrl:"",visibility:"public",isDirectMessage:!1});this.switchChannel.emit(t.id),this.stateUpdate.emit({activeChannelCreator:!1})},this.onMemberAdd=e=>{this.showAllMembersList=!1,this.selectedMemberIds.add(e),this.searchQuery="",this.focusOnSearch()},this.keyDownHandler=(e,t)=>{if("ArrowDown"===e.key)this.focusedMemberIndex=Math.min(this.focusedMemberIndex+1,t.length-1);else if("ArrowUp"===e.key){if(-1===this.focusedMemberIndex)return;if(0===this.focusedMemberIndex)return void this.focusOnSearch(!0);this.focusedMemberIndex=Math.max(this.focusedMemberIndex-1,0)}else if("Enter"===e.key)this.onMemberAdd(t[this.focusedMemberIndex].userId);else if("Backspace"===e.key){if(0!==this.searchQuery.length)return;if(0===this.selectedMemberIds.size)return;const e=Array.from(this.selectedMemberIds.values()).at(-1);this.selectedMemberIds.delete(e),Ve(this.$el)}},this.renderMemberSelector=()=>{const e=Array.from(this.allMembers.values()).filter(e=>!this.selectedMemberIds.has(e.userId)&&e.name.toLowerCase().includes(this.searchQuery.toLowerCase())),t=Array.from(this.selectedMemberIds.values()).map(e=>this.allMembers.get(e)),i=this.selectedMemberIds.size===this.allMembers.size;return Z("div",{class:"input-container"},Z("ul",{class:"members scrollbar",onClick:()=>{var e;null===(e=this.searchInputTextRef)||void 0===e||e.focus()}},t.map(e=>Z("li",{class:"pill"},Z("rtk-avatar",{participant:{name:e.name,picture:e.picture},size:"sm"}),Z("span",null,e.name),Z("rtk-icon",{icon:this.iconPack.dismiss,onClick:()=>{this.selectedMemberIds.delete(e.userId),Ve(this.$el),this.focusOnSearch()}}))),!i&&Z("input",{type:"text",ref:e=>this.searchInputTextRef=e,value:this.searchQuery,placeholder:0===this.selectedMemberIds.size?this.t("chat.member_name"):"",class:{"wide-input":0===this.selectedMemberIds.size},onInput:e=>{this.searchQuery=e.target.value.trim()},onClick:()=>{this.showAllMembersList=!this.showAllMembersList},onKeyDown:t=>this.keyDownHandler(t,e)})),(0!==this.searchQuery.length||this.showAllMembersList)&&Z("ul",{class:"search-results"},e.map((e,t)=>Z("li",{class:{member:!0,selected:t===this.focusedMemberIndex},onClick:()=>this.onMemberAdd(e.userId),ref:e=>{t===this.focusedMemberIndex&&M(()=>{e&&e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})})}},Z("rtk-avatar",{participant:{name:e.name,picture:e.picture},size:"sm"}),Z("span",null,e.name))),0===e.length&&Z("li",{class:"member"},Z("span",null,this.t("chat.error.empty_results")))))}}componentDidLoad(){var e;null===(e=this.inputTextRef)||void 0===e||e.focus()}render(){return Z(J,{key:"7d1b6bc07ef49de8075a25dec0f70b1f01d41222"},Z("header",{key:"d0db6948cb2888043e6bb260f219570523398721"},1===this.step?this.t("chat.new_channel"):this.t("chat.add_members")),1===this.step&&Z("input",{key:"ebe47cfa27796197bc08a74e3e2d23e557325e30",class:"channel-name-input",type:"text",placeholder:this.t("chat.channel_name"),ref:e=>this.inputTextRef=e,onInput:e=>{this.channelName=e.target.value.trim()}}),2===this.step&&this.renderMemberSelector(),Z("footer",{key:"c2a1b31a32bef53ced22b6d7267dba25173376cf"},Z("rtk-button",{key:"2766a128dca00f5175545897e985ab9fe2a074b1",kind:"button",size:"lg",disabled:0===this.channelName.length,onClick:this.onClickHandler},1===this.step?this.t("chat.add_members"):this.t("create"))))}get $el(){return ie(this)}};mc([On()],vc.prototype,"meeting",void 0),mc([On()],vc.prototype,"t",void 0),mc([On()],vc.prototype,"iconPack",void 0),vc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;flex-direction:column;width:var(--rtk-space-96, 384px);padding-left:var(--rtk-space-9, 36px);padding-right:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-10, 40px);padding-bottom:var(--rtk-space-10, 40px)}header{margin-bottom:var(--rtk-space-8, 32px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px);font-size:24px;font-weight:600}.channel-name-input{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-3, 12px);font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;line-height:1.25;outline:2px solid transparent;outline-offset:2px}.channel-name-input:focus{outline-width:2px;outline-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}footer{margin-top:var(--rtk-space-5, 20px);display:flex;justify-content:flex-end}.member{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding:var(--rtk-space-2, 8px)}.member rtk-avatar{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.input-container{position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;line-height:1.25;outline:2px solid transparent;outline-offset:2px;outline-width:2px;outline-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5);border-radius:var(--rtk-border-radius-sm, 4px)}.input-container .members{margin:var(--rtk-space-0, 0px);max-height:var(--rtk-space-28, 112px);border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);list-style-type:none;display:flex;flex-wrap:wrap;gap:var(--rtk-space-1, 4px);cursor:text;font-size:16px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));overflow-y:auto;min-height:var(--rtk-space-7, 28px)}.input-container .pill{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.input-container .pill rtk-avatar{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);font-size:14px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.input-container .pill span{max-width:var(--rtk-space-32, 128px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.input-container .pill rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}.input-container input{width:var(--rtk-space-24, 96px);border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-1, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;font-size:16px;line-height:1.25rem}.input-container input.wide-input{width:100%}.search-results{margin:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-1, 4px);max-height:var(--rtk-space-28, 112px);width:100%;padding:var(--rtk-space-0, 0px);position:absolute;list-style-type:none;overflow-y:auto;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-md, 8px);--tw-border-spacing-x:var(--rtk-space-2, 8px);--tw-border-spacing-y:var(--rtk-space-2, 8px);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-style:solid;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.search-results .member{cursor:pointer}.search-results .member rtk-avatar{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.search-results .member:hover,.search-results .member.selected{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}";var bc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const kc=class{constructor(e){f(this,e),this.t=un(),this.iconPack=pn,this.members=[]}renderMembers(){return Z("ul",{class:"scrollbar"},this.members.map(e=>Z("li",null,Z("rtk-avatar",{participant:{name:e.name,picture:e.picture},size:"sm"}),Z("span",null,e.name))))}render(){return Z(J,{key:"cc8b22dae541a200e63d0d6b286f7ad380a53f09"},Z("header",{key:"e481f5db77f40f53cac0c6aeae28752ddab505cb"},this.t("chat.channel_members")),this.renderMembers())}};bc([On()],kc.prototype,"t",void 0),bc([On()],kc.prototype,"iconPack",void 0),kc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;flex-direction:column;width:var(--rtk-space-72, 288px);padding-top:var(--rtk-space-5, 20px);padding-bottom:var(--rtk-space-5, 20px);padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px)}header{font-size:20px}rtk-spinner{margin-top:var(--rtk-space-10, 40px);margin-bottom:var(--rtk-space-10, 40px);margin-left:auto;margin-right:auto}ul{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-6, 24px);margin-bottom:var(--rtk-space-4, 16px);height:var(--rtk-space-48, 192px);padding:var(--rtk-space-0, 0px);overflow-y:auto;list-style-type:none;display:flex;flex-direction:column;gap:var(--rtk-space-2, 8px)}ul li{margin-right:var(--rtk-space-2, 8px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px);padding:var(--rtk-space-2, 8px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px)}ul li:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}ul li rtk-avatar{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}";var yc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const wc=class{constructor(e){f(this,e),this.search=re(this,"search",7),this.searchDismissed=re(this,"searchDismissed",7),this.back=re(this,"back",7),this.iconPack=pn,this.t=un(),this.showChannelDetailsDialog=!1,this.showSearchBar=!1,this.members=[],this.showBackButton=!1}onChannelChanged(){this.$searchInput&&(this.$searchInput.value=""),this.showSearchBar=!1,this.channel.isDirectMessage||this.meeting.chat.getChannelMembers(this.channel.id).then(e=>{this.members=e})}connectedCallback(){this.onChannelChanged()}renderChannelDetails(){return Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>{this.showChannelDetailsDialog=!1},iconPack:this.iconPack,t:this.t},Z("rtk-channel-details",{members:this.members,channel:this.channel}))}render(){return this.channel?Z(J,null,this.showChannelDetailsDialog&&this.renderChannelDetails(),Z("header",{class:{searching:this.showSearchBar}},this.showBackButton&&Z("rtk-button",{kind:"icon",variant:"secondary",class:"back-btn",onClick:()=>{this.back.emit()}},Z("rtk-icon",{icon:this.iconPack.chevron_left})),Z("div",{class:"channel-details"},Z("span",{class:"name"},this.channel.displayName),!this.channel.isDirectMessage&&Z("span",{class:"members"},this.members.map(e=>e.name).join(", "))),Z("div",{class:"channel-tools"},!this.channel.isDirectMessage&&Z("rtk-tooltip",{label:this.t("chat.channel_members"),variant:"primary"},Z("rtk-button",{kind:"button",variant:"secondary",size:"md",onClick:()=>{this.showChannelDetailsDialog=!this.showChannelDetailsDialog},class:"br-primary-btn"},Z("rtk-icon",{icon:this.iconPack.people})))))):null}static get watchers(){return{channel:["onChannelChanged"]}}};yc([On()],wc.prototype,"meeting",void 0),yc([On()],wc.prototype,"iconPack",void 0),yc([On()],wc.prototype,"t",void 0),wc.style="header{box-sizing:border-box;height:var(--rtk-space-16, 64px);width:100%;padding:var(--rtk-space-4, 16px);display:flex;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));border-left-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-border-opacity))}header.searching{justify-content:flex-end}header.searching .channel-details{display:none}header .channel-details{display:flex;flex-grow:1;flex-direction:column;justify-content:center;height:var(--rtk-space-9, 36px);width:var(--rtk-space-1, 4px)}header .channel-details .name{font-weight:500}header .channel-details .members{margin-top:var(--rtk-space-0\\.5, 2px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}header .channel-tools{display:flex;flex-shrink:0;justify-content:flex-end;gap:var(--rtk-space-1, 4px);min-width:var(--rtk-space-24, 96px)}header .channel-tools rtk-tooltip{height:var(--rtk-space-8, 32px);width:var(--rtk-space-10, 40px);display:flex}header .search-input{height:var(--rtk-space-8, 32px);width:var(--rtk-space-48, 192px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header .name{font-size:16px}header .br-primary-btn{background-color:transparent}header .br-primary-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}@media (orientation: landscape) and (min-width: 400px){header.searching .channel-details{display:flex}}.back-btn{margin-right:var(--rtk-space-3, 12px)}";var Sc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const xc=class{constructor(e){f(this,e),this.channelChange=re(this,"channelChange",7),this.disableSearch=!1,this.hideAvatar=!1,this.iconPack=pn,this.t=un(),this.viewAs="list",this.searchQuery="",this.showDropdown=!1,this.calculateListHeight=qn(()=>{if("list"===this.viewAs&&this.$listEl){let e=0;const t=this.$el.shadowRoot.querySelector('slot[name="header"]');t&&t.assignedElements().forEach(t=>e+=t.offsetHeight),this.$searchEl&&(e+=this.$searchEl.offsetHeight),this.$listEl.style.height="".concat(window.innerHeight-e-16,"px")}},60),this.getFilteredChannels=()=>""===this.searchQuery.trim()?this.channels:this.channels.filter(e=>e.name.toLowerCase().includes(this.searchQuery.toLowerCase())),this.toggleDropdown=()=>{this.showDropdown=!this.showDropdown},this.getChannelById=e=>this.channels.find(t=>t.id===e),this.getTotalUnreads=()=>this.channels.reduce((e,t)=>e+t.unreadCount,0),this.onChannelClickHandler=e=>{this.channelChange.emit(e),"dropdown"===this.viewAs&&(this.showDropdown=!1)}}connectedCallback(){this.resizeObserver=new ResizeObserver(this.calculateListHeight)}componentDidLoad(){this.resizeObserver.observe(this.$el),this.calculateListHeight()}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.calculateListHeight.cancel()}getTimeLabel(e){const t=new Date,i=new Date(t);i.setDate(t.getDate()-1);const r=new Date(t);if(r.setDate(t.getDate()-t.getDay()-1),e.toDateString()===t.toDateString())return e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(e.toDateString()===i.toDateString())return this.t("date.yesteday");if(e>r){const t=["date.sunday","date.monday","date.tuesday","date.wednesday","date.thursday","date.friday","date.saturday"];return this.t(t[e.getDay()])}return Intl.DateTimeFormat([],{day:"2-digit",month:"2-digit",year:"2-digit"}).format(e)}render(){const e=this.getFilteredChannels(),t="list"===this.viewAs||"dropdown"===this.viewAs&&this.showDropdown;return Z(J,{key:"adc8ab4b9c8c865998588fbd9766296f18b3e48e"},"list"===this.viewAs&&Z("slot",{key:"e5740725a4349472ca2eb1fb0816eb2311a99838",name:"header"}),t&&Z("div",{key:"425adc920c28e0421e07bb0bd9f61b31c42fcda9",class:{dropdown:"dropdown"===this.viewAs,scrollbar:"dropdown"===this.viewAs,list:"list"===this.viewAs}},!this.disableSearch&&Z("div",{key:"9fbbc48d8489f2a6490729fac1fecdef1838e84a",class:"search-container",ref:e=>this.$searchEl=e},Z("input",{key:"f7fb43662d50274f80380b735ef9f5fc0b215442",type:"text",placeholder:this.t("chat.search_conversations"),value:this.searchQuery,onInput:e=>this.searchQuery=e.target.value}),Z("rtk-icon",{key:"af76e65a1397d2a6e557a28b687e26aef641c568",icon:this.iconPack.search})),Z("div",{key:"0711a9cfcc811269a5020dc41030c0daee5cc8bf",class:"channels-container scrollbar",ref:e=>this.$listEl=e},e.map(e=>Z("button",{class:{channel:!0,active:this.selectedChannelId===e.id},onClick:()=>this.onChannelClickHandler(e)},!this.hideAvatar&&Z("div",null,e.icon?Z("rtk-icon",{class:"avatar-icon",icon:this.iconPack[e.icon]}):Z("rtk-avatar",{participant:{name:e.name,picture:e.avatarUrl}})),Z("div",{class:"channel-data"},Z("div",{class:"col"},Z("div",{class:"name"},e.name),e.latestMessage&&Z("div",{class:{"last-message":!0,"no-message":!e.latestMessage}},Z("rtk-text-message-view",{isMarkdown:!0,text:e.latestMessage}))),Z("div",{class:"col channel-meta"},e.latestMessageTime&&Z("time",{class:"time"},this.getTimeLabel(e.latestMessageTime)),e.unreadCount>0&&Z("div",{class:"unread-count"},e.unreadCount))))))),"dropdown"===this.viewAs&&Z("button",{key:"0c87f90d6d0fe22284995ab7259689f80a862829",class:"dropdown-trigger",onClick:this.toggleDropdown},Z("span",{key:"d1a364f2c5c57d19702d0b8707ca661c1dc4c14f"},this.selectedChannelId&&"".concat(this.t("to")," ").concat(this.getChannelById(this.selectedChannelId).name),this.getTotalUnreads()>0&&Z("div",{key:"bf789f9df82851825bc6ea12a19a5f37ab74aefe",class:"unread-count"},this.getTotalUnreads())),Z("rtk-icon",{key:"c0d03f883f4c46b2698be0f197751fc0470717ea",icon:this.showDropdown?this.iconPack.chevron_up:this.iconPack.chevron_down})))}get $el(){return ie(this)}};Sc([On()],xc.prototype,"iconPack",void 0),Sc([On()],xc.prototype,"t",void 0),xc.style=".scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n position: relative;\n z-index: 10;\n height: var(--rtk-space-12, 48px);\n min-height: 48px;\n}\n\n.dropdown-trigger {\n height: 100%;\n width: 100%;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n padding: var(--rtk-space-4, 16px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n font-size: 14px;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n cursor: pointer;\n position: absolute;\n z-index: 20;\n}\n\n.dropdown-trigger span {\n display: flex;\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n}\n\n.dropdown-trigger rtk-icon {\n margin-left: var(--rtk-space-1, 4px);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n flex-shrink: 0;\n}\n\n@container chatcontainer (height < 360px) {\n .dropdown-trigger {\n padding: var(--rtk-space-2, 8px);\n }\n .dropdown {\n top: var(--rtk-space-8, 32px) !important;\n }\n .search-container {\n padding-left: var(--rtk-space-0, 0px) !important;\n padding-right: var(--rtk-space-0, 0px) !important;\n padding-top: var(--rtk-space-0, 0px) !important;\n padding-bottom: var(--rtk-space-0, 0px) !important;\n }\n input {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-none, 0) !important;\n }\n .channel {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-sm, 4px) !important;\n }\n .avatar-icon {\n height: var(--rtk-space-3, 12px) !important;\n width: var(--rtk-space-3, 12px) !important;\n padding: var(--rtk-space-1, 4px) !important;\n }\n\n rtk-avatar {\n height: var(--rtk-space-5, 20px) !important;\n width: var(--rtk-space-5, 20px) !important;\n }\n}\n\n.dropdown {\n position: absolute;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n top: var(--rtk-space-12, 48px);\n z-index: 10;\n animation: 0.3s slide-down ease;\n}\n\n.dropdown .channels-container {\n max-height: var(--rtk-space-80, 320px);\n}\n\n.list {\n display: flex;\n flex-direction: column;\n}\n\n.list .channel .channel-data {\n align-items: flex-start;\n}\n\n.unread-count {\n display: flex;\n justify-content: center;\n height: var(--rtk-space-5, 20px);\n min-width: var(--rtk-space-3, 12px);\n border-radius: 9999px;\n padding-left: var(--rtk-space-1, 4px);\n padding-right: var(--rtk-space-1, 4px);\n font-size: 12px;\n line-height: 1.25rem;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\ninput {\n height: var(--rtk-space-9, 36px);\n width: 100%;\n padding-left: var(--rtk-space-3, 12px);\n padding-right: var(--rtk-space-3, 12px);\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n outline: 2px solid transparent;\n outline-offset: 2px;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.search-container {\n display: flex;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n align-items: center;\n padding-top: var(--rtk-space-3, 12px);\n padding-bottom: var(--rtk-space-3, 12px);\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.search-container rtk-icon {\n margin-left: calc(var(--rtk-space-8, 32px) * -1);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channels-container {\n display: flex;\n flex-direction: column;\n gap: var(--rtk-space-1, 4px);\n padding: var(--rtk-space-2, 8px);\n flex: 1 1 auto;\n overflow-y: auto;\n}\n\n.channel {\n flex-shrink: 0;\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n background-color: transparent;\n outline: 2px solid transparent;\n outline-offset: 2px;\n cursor: pointer;\n border-radius: var(--rtk-border-radius-md, 8px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--rtk-space-2, 8px);\n height: var(--rtk-space-16, 64px);\n width: 100%;\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.channel:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n}\n\n.channel .channel-data {\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.channel .name {\n font-size: 16px;\n}\n\n.channel .name, \n .channel .last-message {\n max-width: var(--rtk-space-40, 160px);\n text-align: left;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n}\n\n.channel .no-message {\n font-style: italic;\n}\n\n.channel rtk-avatar {\n height: var(--rtk-space-12, 48px);\n width: var(--rtk-space-12, 48px);\n overflow: clip;\n border-radius: 9999px;\n font-size: 14px;\n}\n\n.channel .avatar-icon {\n height: var(--rtk-space-6, 24px);\n width: var(--rtk-space-6, 24px);\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n overflow: clip;\n border-radius: 9999px;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.channel time, \n .channel .last-message {\n font-size: 12px;\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channel.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.channel.active .unread-count {\n background-color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));\n}\n\n.channel.active time {\n color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n}\n\n.channel.active .last-message {\n color: rgb(var(--rtk-colors-text-on-brand-700, var(--rtk-colors-text-700, 255 255 255 / 0.64)));\n}\n\n.channel.active rtk-avatar {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.col {\n gap: var(--rtk-space-1, 4px);\n display: flex;\n flex-direction: column;\n}\n\n.channel-meta {\n flex-shrink: 0;\n align-items: flex-end;\n}\n\n@keyframes slide-down {\n from {\n transform: translateY(-50px);\n }\n to {\n transform: translateY(0%);\n }\n}\n";var Ec=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Tc=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.chatUpdateListener=e=>{let{message:t}=e;t.channelId||this.displayFilter&&!this.displayFilter(t)||(this.addToChatGroup(t),this.chatGroups=Object.assign({},this.chatGroups))},this.chatPermissionUpdateListener=()=>{this.canSend=this.meeting.self.permissions.chatPublic.canSend,this.canSendTextMessage=this.meeting.self.permissions.chatPublic.text,this.canSendFiles=this.meeting.self.permissions.chatPublic.files},this.config=sn(),this.iconPack=pn,this.t=un(),this.disablePrivateChat=!1,this.canPinMessages=!1,this.privatePresetFilter=[],this.displayFilter=void 0,this.unreadCountGroups={},this.chatGroups={everyone:[]},this.selectedGroup="everyone",this.now=new Date,this.dropzoneActivated=!1,this.showLatestMessageButton=!1,this.canSend=!1,this.canSendTextMessage=!1,this.canSendFiles=!1,this.canPrivateMessage=!1,this.canSendPrivateTexts=!1,this.canSendPrivateFiles=!1,this.emojiPickerEnabled=!1,this.chatRecipientId="everyone",this.participants=[],this.channels=[],this.editingMessage=null,this.replyMessage=null,this.searchQuery="",this.selectorState="hide",this.creatingChannel=!1,this.showPinnedMessages=!1,this.channelMap=new Map,this.onDragOver=e=>{e.preventDefault(),this.dropzoneActivated=!0},this.onDragLeave=()=>{this.dropzoneActivated=!1},this.onDrop=e=>{e.preventDefault(),this.dropzoneActivated=!1,Jn(e.dataTransfer.items,(e,t)=>{var i,r,n,s;switch(e){case"image":this.isFileMessagingAllowed()&&(null===(r=null===(i=this.meeting)||void 0===i?void 0:i.chat)||void 0===r||r.sendImageMessage(t,this.getRecipientPeerIds()));break;case"file":this.isFileMessagingAllowed()&&(null===(s=null===(n=this.meeting)||void 0===n?void 0:n.chat)||void 0===s||s.sendFileMessage(t,this.getRecipientPeerIds()))}})},this.disconnectMeeting=e=>{var t,i,r,n,s,a;this.isPrivateChatSupported()&&(null===e||void 0===e||e.participants.joined.removeListener("participantJoined",this.onParticipantUpdate),null===e||void 0===e||e.participants.joined.removeListener("participantLeft",this.onParticipantUpdate)),null===(t=null===e||void 0===e?void 0:e.chat)||void 0===t||t.removeListener("chatUpdate",this.chatUpdateListener),null===(i=null===e||void 0===e?void 0:e.chat)||void 0===i||i.removeListener("channelCreate",this.onChannelCreateOrUpdate),null===(r=null===e||void 0===e?void 0:e.chat)||void 0===r||r.removeListener("channelUpdate",this.onChannelCreateOrUpdate),null===(n=null===e||void 0===e?void 0:e.chat)||void 0===n||n.removeListener("channelMessageUpdate",this.onChannelCreateOrUpdate),null===(a=null===(s=null===e||void 0===e?void 0:e.participants)||void 0===s?void 0:s.all)||void 0===a||a.removeListener("participantsUpdate",this.onChannelCreateOrUpdate),e.self.permissions.removeListener("*",this.chatPermissionUpdateListener)},this.getFilteredParticipants=()=>0===this.privatePresetFilter.length?this.participants:this.participants.filter(e=>this.privatePresetFilter.includes(e.presetName)),this.onParticipantUpdate=()=>{this.participants=this.meeting.participants.joined.toArray().filter(e=>0===this.privatePresetFilter.length||this.privatePresetFilter.includes(e.presetName)),this.selectedParticipant&&!this.participants.includes(this.selectedParticipant)&&(this.selectedParticipant=null,this.chatRecipientId=this.selectedGroup="everyone")},this.usePaginatedChat=()=>(!this.isGroupCall||!this.showPinnedMessages)&&("everyone"===this.selectedGroup&&ft(this.meeting)),this.updateUnreadCountGroups=e=>{this.unreadCountGroups=Object.assign(Object.assign({},this.unreadCountGroups),e)},this.isPrivateChatSupported=()=>this.canPrivateMessage&&!this.disablePrivateChat,this.updateRecipients=e=>{const{id:t}=e.detail;if(this.chatRecipientId=t,this.selectedParticipant=this.participants.find(e=>e.userId===t),"everyone"!==this.chatRecipientId){const e=Yn([this.chatRecipientId,this.meeting.self.userId]);this.selectedGroup=e}else this.selectedGroup="everyone";this.updateUnreadCountGroups({[this.selectedGroup]:0})},this.isTextMessagingAllowed=()=>"everyone"===this.chatRecipientId?this.canSend&&this.canSendTextMessage:this.canPrivateMessage&&this.canSendPrivateTexts,this.isFileMessagingAllowed=()=>"everyone"===this.chatRecipientId?this.canSend&&this.canSendFiles:this.canPrivateMessage&&this.canSendPrivateFiles,this.onChannelChanged=e=>{const t=e.detail;t.id.includes(Qn)?this.createDMChannel(t.id.replace(Qn,"")):this.selectedChannelId=t.id,this.cleanup(),"desktop"!==this.selectorState&&(this.selectorState="hide")},this.createDMChannel=async e=>{this.creatingChannel=!0;const t=await this.meeting.chat.createChannel("Direct Message",[e],{visibility:"private",isDirectMessage:!0});this.creatingChannel=!1,this.selectedChannelId=t.id},this.cleanup=()=>{this.editingMessage=null,this.replyMessage=null,this.searchQuery=""},this.onQuotedMessageDismiss=()=>{this.replyMessage=null},this.onChannelCreateOrUpdate=e=>{e?this.channelMap.set(e.id,e):this.meeting.chat.channels.forEach(e=>this.channelMap.set(e.id,e));const t=Array.from(this.channelMap.values()),i=t.filter(e=>!Xn(e)).sort((e,t)=>Zn(e.displayName,t.displayName)),r=t.filter(Xn).map(e=>Object.assign(Object.assign({},e),{displayName:this.getMemberDisplayName(e)})),n=this.meeting.participants.all.toArray().filter(e=>{if(e.userId===this.meeting.self.userId)return!1;const t=es([this.meeting.self.userId,e.userId]);return r.every(e=>es(e.memberIds)!==t)}).map(e=>({id:"".concat(Qn).concat(e.userId),displayName:e.name,displayPictureUrl:e.picture,isDirectMessage:!0,unreadCount:0})),s=[...r,...n].sort((e,t)=>Zn(e.displayName,t.displayName));this.channels=[...i,...s];const a=[...i,...r];this.selectedChannelId||0===a.length||(this.selectedChannelId=a[0].id)},this.getMemberDisplayName=e=>{var t;let i;i=1===e.memberIds.length?e.memberIds[0]:e.memberIds[0]===this.meeting.self.userId?e.memberIds[1]:e.memberIds[0];const r=this.meeting.participants.all.toArray().find(e=>e.userId===i);return null!==(t=null===r||void 0===r?void 0:r.name)&&void 0!==t?t:i},this.onNewMessageHandler=async e=>{const t=e.detail;this.isChatViewType?(await this.meeting.chat.sendMessageToChannel(t,this.selectedChannelId,this.replyMessage?{replyTo:this.replyMessage}:{}),this.replyMessage=null):this.meeting.chat.sendMessage(t,this.getRecipientPeerIds())},this.onEditMessageHandler=async e=>{var t,i;await(null===(i=null===(t=this.meeting)||void 0===t?void 0:t.chat)||void 0===i?void 0:i.editTextMessage(this.editingMessage.id,e.detail,this.editingMessage.channelId)),this.editingMessage=null},this.onEditCancel=()=>{this.editingMessage=null},this.onSearchHandler=async e=>{this.searchQuery=e.detail},this.onSearchDismissed=()=>{this.searchQuery=""},this.onChannelCreateClicked=()=>{this.stateUpdate.emit({activeChannelCreator:!0})},this.onPinMessage=e=>{const t=e.detail;t.pinned?this.meeting.chat.unpin(t.id):this.meeting.chat.pin(t.id)},this.onDeleteMessage=e=>{const t=e.detail;this.meeting.chat.deleteMessage(t.id)},this.getChannelItems=()=>this.channels.map(e=>{const t={id:e.id,name:e.displayName,avatarUrl:e.displayPictureUrl};return e.latestMessage&&(t.latestMessage="text"===e.latestMessage.type?cs(e.latestMessage.message):"",t.latestMessageTime=e.latestMessage.time),t}),this.getPrivateChatRecipients=()=>{const e=this.getFilteredParticipants().map(e=>{const t=Yn([e.userId,this.meeting.self.userId]);return{id:e.userId,name:e.name,avatarUrl:e.picture,unreadCount:this.unreadCountGroups[t]}});return[{id:"everyone",name:this.t("chat.everyone"),icon:"participants",unreadCount:this.unreadCountGroups.everyone},...e]},this.onTogglePinnedMessages=()=>{this.showPinnedMessages=!this.showPinnedMessages},this.renderPinnedMessagesHeader=()=>0===this.meeting.chat.pinned.length?null:Z("rtk-tooltip",{label:this.t("chat.toggle_pinned_msgs")},Z("div",{class:{"pinned-messages-header":!0,active:this.showPinnedMessages},onClick:this.onTogglePinnedMessages},Z("rtk-icon",{icon:this.iconPack.pin}),this.t("chat.pinned_msgs")," (".concat(this.meeting.chat.pinned.length,")")))}connectedCallback(){this.meeting&&(this.meetingChanged(this.meeting),this.meeting&&!this.meeting.chat||this.isFileMessagingAllowed()&&(this.host.addEventListener("dragover",this.onDragOver),this.host.addEventListener("dragleave",this.onDragLeave),this.host.addEventListener("drop",this.onDrop)))}onEditMessageInit(e){e.detail.flags.isReply?this.replyMessage=e.detail.payload:e.detail.flags.isEdit&&(this.editingMessage=e.detail.payload)}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.disconnectMeeting(this.meeting),this.host.removeEventListener("dragover",this.onDragOver),this.host.removeEventListener("dragleave",this.onDragLeave),this.host.removeEventListener("drop",this.onDrop)}meetingChanged(e,t){var i,r,n,s,a,o;if(void 0!=t&&this.disconnectMeeting(t),(!e||e.chat)&&null!=e){if(this.canSend=e.self.permissions.chatPublic.canSend,this.canSendTextMessage=e.self.permissions.chatPublic.text,this.canSendFiles=e.self.permissions.chatPublic.files,this.canPrivateMessage=!(!(null===(i=e.self.permissions.chatPrivate)||void 0===i?void 0:i.canSend)&&!(null===(r=e.self.permissions.chatPrivate)||void 0===r?void 0:r.canReceive)),this.canSendPrivateTexts=!!(null===(n=e.self.permissions.chatPrivate)||void 0===n?void 0:n.text),this.canSendPrivateFiles=!!(null===(s=e.self.permissions.chatPrivate)||void 0===s?void 0:s.files),this.canPinMessages=(null===(a=null===e||void 0===e?void 0:e.__internals__)||void 0===a?void 0:a.features.hasFeature(gt))&&e.self.permissions.pinParticipant,this.isGroupCall="GROUP_CALL"===e.meta.viewType,this.isChatViewType="CHAT"===e.meta.viewType,this.isChatViewType){this.onChannelCreateOrUpdate();this.channels.filter(e=>!e.id.includes(Qn)).length&&(this.selectedChannelId=this.channels[0].id),this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeObserver=new ResizeObserver(e=>{for(const t of e)t.contentBoxSize[0].inlineSize<758?this.selectorState="hide":this.selectorState="desktop"}),this.isChatViewType&&this.resizeObserver.observe(this.host)}this.initializeChatGroups(),this.chatGroups=Object.assign({},this.chatGroups),e.self.permissions.on("*",this.chatPermissionUpdateListener),this.onParticipantUpdate(),null===(o=e.chat)||void 0===o||o.addListener("chatUpdate",this.chatUpdateListener),this.isPrivateChatSupported()&&(e.participants.joined.addListener("participantJoined",this.onParticipantUpdate),e.participants.joined.addListener("participantLeft",this.onParticipantUpdate)),this.isChatViewType&&(e.chat.addListener("channelCreate",this.onChannelCreateOrUpdate),e.chat.addListener("channelUpdate",this.onChannelCreateOrUpdate),e.chat.addListener("channelMessageUpdate",this.onChannelCreateOrUpdate),e.participants.all.addListener("participantsUpdate",this.onChannelCreateOrUpdate))}}chatGroupsChanged(e){var t,i;if(!this.isPrivateChatSupported())return;const r={};for(const n in e){const s=null!==(t=wn[n])&&void 0!==t?t:0;r[n]=e[n].filter(e=>"chat"==e.type&&e.message.time>s&&e.message.userId!==this.meeting.self.userId).length,(n===Yn([this.meeting.self.userId,null===(i=this.selectedParticipant)||void 0===i?void 0:i.userId])||"everyone"===n&&null===this.selectedParticipant)&&(r[n]=0,wn[n]=new Date)}this.updateUnreadCountGroups(r)}initializeChatGroups(){var e;null===(e=this.meeting.chat)||void 0===e||e.messages.forEach(e=>{this.displayFilter&&!this.displayFilter(e)||this.addToChatGroup(e)})}onDisplayFilterChanged(e,t){e!==t&&(this.chatGroups={},this.initializeChatGroups())}addToChatGroup(e){var t;const i=Kn(e);let r="everyone";if((null===(t=i.targetUserIds)||void 0===t?void 0:t.length)>0){const e=new Set([i.userId,...i.targetUserIds]);r=Yn(Array.from(e))}void 0===this.chatGroups[r]&&(this.chatGroups[r]=[]);let n=!1,s=[];this.chatGroups[r].forEach(t=>{"chat"===t.type&&t.message.id===e.id?(n=!0,s.push({type:"chat",message:i})):s.push(t)}),n||s.push({type:"chat",message:i}),this.chatGroups[r]=s}getRecipientPeerIds(){let e=[];return"everyone"!==this.chatRecipientId&&(e=[this.selectedParticipant.id]),e}channelSwitchListener(e){this.onChannelChanged(e)}renderHeadlessComponents(){return Z(Qe,null,Z("rtk-dialog-manager",{meeting:this.meeting}),Z("rtk-notifications",{meeting:this.meeting}))}renderComposerUI(){var e,t,i;if(this.isChatViewType&&0===this.channels.length)return null;if(this.isChatViewType&&""!==this.searchQuery)return null;if(this.isChatViewType&&!this.selectedChannelId)return null;if("everyone"===this.chatRecipientId){if(!this.canSendTextMessage&&!this.canSendFiles)return null}else if(!this.canSendPrivateTexts&&!this.canSendPrivateFiles)return null;const r={iconPack:this.iconPack,t:this.t,size:this.size},n=this.editingMessage?this.editingMessage.message:"",s=this.replyMessage?this.replyMessage.message:"";return Z("rtk-chat-composer-view",Object.assign({message:n,storageKey:null!==(e=this.selectedChannelId)&&void 0!==e?e:"draft-".concat(this.selectedChannelId),quotedMessage:s,isEditing:!!this.editingMessage,canSendTextMessage:this.isTextMessagingAllowed(),canSendFiles:this.isFileMessagingAllowed(),disableEmojiPicker:!!(null===(i=null===(t=this.meeting)||void 0===t?void 0:t.__internals__)||void 0===i?void 0:i.features.hasFeature(dt)),maxLength:this.meeting.chat.maxTextLimit,rateLimits:this.meeting.chat.rateLimits,inputTextPlaceholder:this.t("chat.message_placeholder"),onNewMessage:this.onNewMessageHandler,onEditMessage:this.onEditMessageHandler,onEditCancel:this.onEditCancel,onQuotedMessageDismiss:this.onQuotedMessageDismiss},r),Z("slot",{name:"chat-addon",slot:"chat-addon"}))}renderFullChat(){if(this.creatingChannel)return Z("div",{class:"banner"},Z("rtk-spinner",{size:"lg"}));if(0===this.channels.length||!this.selectedChannelId)return Z("div",{class:"banner"},Z("rtk-icon",{icon:this.iconPack.create_channel_illustration,slot:"start",class:"create-channel-illustration"}),Z("rtk-button",{kind:"wide",variant:"primary",size:"md",onClick:this.onChannelCreateClicked,class:"welcome-new-channel"},Z("rtk-icon",{icon:this.iconPack.add,slot:"start"}),Z("span",null,this.t("chat.new_channel"))),("mobile"===this.selectorState||"hide"===this.selectorState)&&Z("rtk-button",{kind:"button",variant:"secondary",size:"md",class:"view-chats-btn",onClick:()=>{this.selectorState="mobile"}},Z("rtk-icon",{icon:this.iconPack.chat,slot:"start"}),Z("span",null,this.t("chat.view_chats"))));const e=this.channels.find(e=>e.id===this.selectedChannelId);return Z("div",{class:"chat"},Z("rtk-channel-header",{slot:"header",meeting:this.meeting,channel:e,onSearch:this.onSearchHandler,onSearchDismissed:this.onSearchDismissed,showBackButton:"mobile"===this.selectorState||"hide"===this.selectorState,onBack:()=>{this.selectorState="mobile"}}),""!==this.searchQuery&&Z("rtk-chat-search-results",{meeting:this.meeting,query:this.searchQuery,channelId:this.selectedChannelId}),""===this.searchQuery&&Z("rtk-chat-messages-ui-paginated",{meeting:this.meeting,size:this.size,iconPack:this.iconPack,t:this.t,selectedChannelId:this.selectedChannelId,selectedChannel:e}))}render(){var e,t;if(!this.meeting)return null;const i={iconPack:this.iconPack,t:this.t,size:this.size},r=null===(e=this.meeting)||void 0===e?void 0:e.self.userId;let n=this.chatGroups[this.selectedGroup]||[];return this.showPinnedMessages&&0!==this.meeting.chat.pinned.length&&(n=n.filter(e=>"chat"===e.type&&e.message.pinned)),Z(J,null,this.isChatViewType&&this.renderHeadlessComponents(),Z("div",{class:"chat-container"},this.isChatViewType&&Z("div",{class:{"selector-container":!0,[this.selectorState]:!0}},Z("rtk-channel-selector-view",{channels:this.getChannelItems(),selectedChannelId:this.selectedChannelId,onChannelChange:this.onChannelChanged,t:this.t},Z("div",{class:"channel-selector-header",slot:"header"},Z("rtk-logo",{meeting:this.meeting,config:this.config,t:this.t}),Z("rtk-tooltip",{label:this.t("chat.new_channel")},Z("rtk-button",{kind:"button",variant:"ghost",size:"md",onClick:this.onChannelCreateClicked,class:"channel-create-btn"},Z("rtk-icon",{icon:this.iconPack.add}))))),Z("rtk-button",{kind:"icon",variant:"ghost",class:"mobile-close-btn",onClick:()=>this.selectorState="hide"},Z("rtk-icon",{icon:this.iconPack.dismiss}))),Z("div",{class:"chat"},this.isFileMessagingAllowed()&&Z("div",{id:"dropzone",class:{active:this.dropzoneActivated},part:"dropzone"},Z("rtk-icon",{icon:this.iconPack.attach}),Z("p",null,this.t("chat.send_attachment"))),this.renderPinnedMessagesHeader(),this.isPrivateChatSupported()&&Z("rtk-channel-selector-view",{channels:this.getPrivateChatRecipients(),selectedChannelId:(null===(t=this.selectedParticipant)||void 0===t?void 0:t.userId)||"everyone",onChannelChange:this.updateRecipients,t:this.t,viewAs:"dropdown"}),this.isChatViewType?this.renderFullChat():this.usePaginatedChat()?Z("rtk-chat-messages-ui-paginated",{meeting:this.meeting,onPinMessage:this.onPinMessage,onDeleteMessage:this.onDeleteMessage,size:this.size,iconPack:this.iconPack,t:this.t}):Z("rtk-chat-messages-ui",Object.assign({messages:n,selfUserId:r,selectedGroup:this.selectedGroup,onPinMessage:this.onPinMessage,canPinMessages:this.canPinMessages},i)),this.renderComposerUI())))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],chatGroups:["chatGroupsChanged"],displayFilter:["onDisplayFilterChanged"]}}};Ec([On()],Tc.prototype,"meeting",void 0),Ec([On()],Tc.prototype,"config",void 0),Ec([On()],Tc.prototype,"iconPack",void 0),Ec([On()],Tc.prototype,"t",void 0),Tc.style=":host {\n line-height: initial;\n font-family: var(--rtk-font-family, sans-serif);\n\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n\np {\n margin: var(--rtk-space-0, 0px);\n padding: var(--rtk-space-0, 0px);\n}\n\n.scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: column;\n font-size: 14px;\n position: relative;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\nh3 {\n margin: var(--rtk-space-0, 0px);\n display: flex;\n height: var(--rtk-space-12, 48px);\n align-items: center;\n justify-content: center;\n font-size: 16px;\n font-weight: 400;\n color: rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));\n text-align: center;\n}\n\n#dropzone {\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n display: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));\n}\n\n#dropzone.active {\n display: flex;\n animation: 0.2s slide-up ease-in;\n}\n\nrtk-chat-messages-ui,\nrtk-chat-messages-ui-paginated {\n flex: 1 0 0;\n}\n\nrtk-chat-composer-view {\n margin: var(--rtk-space-2, 8px);\n}\n\n.chat-container {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: row;\n container-type: size;\n container-name: chatcontainer;\n}\n\n@container chatcontainer (height < 360px) {\n rtk-channel-selector-view {\n height: var(--rtk-space-8, 32px);\n min-height: 24px;\n }\n}\n\n.chat {\n display: flex;\n flex: 1 1 0%;\n flex-direction: column;\n}\n\n.banner {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.banner .welcome-new-channel {\n width: var(--rtk-space-48, 192px);\n}\n\n.banner .create-channel-illustration {\n height: var(--rtk-space-40, 160px);\n width: var(--rtk-space-40, 160px);\n}\n\n.channel-selector-header {\n box-sizing: border-box;\n height: var(--rtk-space-16, 64px);\n padding: var(--rtk-space-4, 16px);\n display: flex;\n justify-content: space-between;\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.channel-selector-header .channel-create-btn {\n width: var(--rtk-space-8, 32px);\n justify-content: center;\n}\n\n.channel-selector-header .channel-create-btn:hover {\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));\n}\n\n.view-chats-btn {\n margin-top: var(--rtk-space-4, 16px);\n}\n\n.selector-container {\n z-index: 50;\n width: 100%;\n max-width: var(--rtk-space-80, 320px);\n border-right: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.selector-container.hide {\n display: none;\n}\n\n.mobile-close-btn {\n display: none;\n}\n\n.selector-container.mobile {\n height: 100%;\n width: 100%;\n max-width: 100%;\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n background-color: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);\n display: flex;\n}\n\n.selector-container.mobile rtk-channel-selector-view {\n max-width: var(--rtk-space-96, 384px);\n animation: 0.3s swipe-in;\n}\n\n.selector-container.mobile .mobile-close-btn {\n margin-top: var(--rtk-space-4, 16px);\n margin-bottom: var(--rtk-space-4, 16px);\n margin-left: var(--rtk-space-6, 24px);\n margin-right: var(--rtk-space-6, 24px);\n display: block;\n}\n\n.pinned-messages-header {\n display: flex;\n align-items: center;\n gap: var(--rtk-space-2, 8px);\n padding: var(--rtk-space-2, 8px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n font-size: 12px;\n cursor: pointer;\n}\n\n.pinned-messages-header rtk-icon {\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px);\n}\n\n.pinned-messages-header:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.pinned-messages-header.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n@keyframes swipe-in {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n";var _c=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Pc={messagesSent:0,startTime:0},Cc=class{constructor(e){f(this,e),this.onNewMessage=re(this,"newMessage",7),this.onEditMessage=re(this,"editMessage",7),this.onEditCancel=re(this,"editCancel",7),this.onQuotedMessageDismiss=re(this,"quotedMessageDismiss",7),this.canSendTextMessage=!0,this.canSendFiles=!0,this.message="",this.quotedMessage="",this.storageKey="rtk-text-message",this.inputTextPlaceholder="Enter your message",this.isEditing=!1,this.iconPack=pn,this.t=un(),this.disableEmojiPicker=!1,this.rateLimits={period:60,maxInvocations:60},this.fileToUpload=null,this.isEmojiPickerOpen=!1,this.disableSendButton=!1,this.rateLimitsBreached=!1,this.textMessage="",this.sendFile=()=>{this.canSendFiles&&("image"===this.fileToUpload.type?this.onNewMessage.emit({type:"image",image:this.fileToUpload.file}):this.onNewMessage.emit({type:"file",file:this.fileToUpload.file}),this.fileToUpload=null)},this.handleSendMessage=()=>{if(!this.canSendTextMessage||this.rateLimitsBreached)return;if(null!==this.fileToUpload)return void this.sendFile();const e=this.textMessage,t=Date.now();t-Pc.startTime>1e3*this.rateLimits.period&&(Pc.startTime=t,Pc.messagesSent=0),Pc.messagesSent+=1,this.checkRateLimitBreached(t),e.length>0&&(this.quotedMessage.length,this.onNewMessage.emit({type:"text",message:e}),this.cleanup())},this.handleEditMessage=()=>{this.onEditMessage.emit(this.textMessage),this.cleanup()},this.handleEditCancel=()=>{this.onEditCancel.emit(),this.cleanup()},this.onTextChangeHandler=e=>{var t;this.textMessage=e.detail,this.textMessage.length>=(null!==(t=this.maxLength)&&void 0!==t?t:ls)?this.disableSendButton=!0:this.disableSendButton&&(this.disableSendButton=!1),mn.setItem(this.storageKey,e.detail)},this.onKeyDownHandler=e=>{"Enter"===e.key&&e.shiftKey||this.disableSendButton||"Enter"===e.key&&(e.preventDefault(),this.isEditing?this.handleEditMessage():this.handleSendMessage())},this.onFileUploadHandler=(e,t)=>{this.fileToUpload={type:e,file:t}},this.onQuotedMessageDismissHandler=()=>{this.onQuotedMessageDismiss.emit()},this.cleanup=()=>{this.textMessage="",this.fileToUpload=null,mn.setItem(this.storageKey,""),this.$textComposer.setText("",!0),this.isEmojiPickerOpen=!1},this.onKeyDownHandler=this.onKeyDownHandler.bind(this)}connectedCallback(){this.textMessage=this.message||mn.getItem(this.storageKey)||"",this.checkRateLimitBreached(Date.now())}componentWillUpdate(){this.textMessage=this.message||mn.getItem(this.storageKey)||""}componentDidLoad(){this.message&&M(()=>this.$textComposer.setText(this.message,!0))}checkRateLimitBreached(e){if(Pc.messagesSent>=this.rateLimits.maxInvocations){this.disableSendButton=!0,this.rateLimitsBreached=!0;const t=e-Pc.startTime+1e3*this.rateLimits.period;setTimeout(()=>{Pc.messagesSent=0,Pc.startTime=Date.now(),this.disableSendButton=!1,this.rateLimitsBreached=!1},t)}}render(){var e;const t={iconPack:this.iconPack,t:this.t};return Z(J,{key:"06455539e3067eb1c1c592b551d0ef99eba2f331"},this.canSendTextMessage&&this.isEmojiPickerOpen&&Z("rtk-emoji-picker",Object.assign({key:"fe83b0ab9562cc0e1c61f89e4b441ef592edfa1a",part:"emoji-picker",onPickerClose:()=>{this.isEmojiPickerOpen=!1},onRtkEmojiClicked:e=>{this.textMessage+=e.detail,this.$textComposer.setText(this.textMessage,!0)}},t)),Z("slot",{key:"8653c2e805e41adf5958941cc10ff01d43f97792",name:"chat-addon"}),this.quotedMessage&&0!==this.quotedMessage.length&&Z("div",{key:"82b9bf5203a799709e980d61ab827b9daf8292e6",class:"quoted-message-container",part:"quoted-message-container"},Z("div",{key:"4b9fe8f382da7075e815c329f2d7dca17ce0f694",class:"quoted-message scrollbar"},Z("rtk-text-message-view",{key:"7a16547e83d9bca43794e46e56c5a9c743a9929a",text:this.quotedMessage,isMarkdown:!0})),Z("div",{key:"5691b8d882016cda66cd2faf3858bc38cd53458c"},Z("rtk-icon",{key:"2d5b222bd5eaac6d46812b704674f52f86efdb92","aria-label":this.t("dismiss"),class:"dismiss",icon:this.iconPack.dismiss,onClick:this.onQuotedMessageDismissHandler}))),Z("div",{key:"d7638411df9ae1b2cbef8cae66d0af2b7ad310e6",class:"composer-container"},Z("div",{key:"ca1ee222584fdd27e53989d28b6ce583c6b0c400",class:"composers"},this.fileToUpload&&Z("rtk-draft-attachment-view",Object.assign({key:"d511c900c71a97f8f92640b73a7575dcd267de88"},t,{attachment:this.fileToUpload,onDeleteAttachment:()=>this.fileToUpload=null})),!this.fileToUpload&&Z("rtk-text-composer-view",{key:"08f214184853dcedeccb5f07dac2a0a308269793",value:this.textMessage,placeholder:this.inputTextPlaceholder,onTextChange:this.onTextChangeHandler,keyDownHandler:this.onKeyDownHandler,maxLength:null!==(e=this.maxLength)&&void 0!==e?e:ls,rateLimitBreached:this.rateLimitsBreached,t:this.t,iconPack:this.iconPack,ref:e=>this.$textComposer=e})),Z("div",{key:"9b6cbe7cb8529c8e60f8cc9e13cc95ca64504efc",class:"chat-buttons",part:"chat-buttons"},Z("div",{key:"30e24e8edf58179ef20ccd436d3833ba177ebb0d",class:"left",part:"chat-buttons-left"},!this.fileToUpload&&!this.isEditing&&Z("div",{key:"54ad294bedab1c0bc7c02a72c4f3f51bc10bba85"},this.canSendFiles&&[Z("rtk-file-picker-button",Object.assign({key:"1a0760e05a183b6c8da2ff02e33ecd40bfdb6e97"},t,{onFileChange:e=>this.onFileUploadHandler("file",e.detail)})),Z("rtk-file-picker-button",Object.assign({key:"5d6cf1928c8edb6737b367807c93152ad62cea36",filter:"image/*",label:this.t("chat.send_img"),icon:"image",onFileChange:e=>this.onFileUploadHandler("image",e.detail)},t))],this.canSendTextMessage&&!this.disableEmojiPicker&&Z("rtk-emoji-picker-button",Object.assign({key:"50f14152b8d15009104e9b1dd05ee5e1ec49ab16",isActive:this.isEmojiPickerOpen,onClick:()=>{this.isEmojiPickerOpen=!this.isEmojiPickerOpen}},t)),Z("slot",{key:"1e1fe81e1e196fc8d679bfc2d6ed0c6402c74a4a",name:"chat-buttons"}))),Z("div",{key:"272526b7c81ed1acd028beceb3869c584e94308f",class:"right",part:"chat-buttons-right"},!this.isEditing&&Z("rtk-tooltip",{key:"6750abf323b2f1c951661c44390eb97d3ec71544",variant:"primary",label:this.t("chat.send_msg"),delay:2e3},Z("rtk-button",{key:"a159fa6dcc1f8ede64085abd8286a69ad86b7002",kind:"icon",disabled:this.disableSendButton,onClick:()=>this.handleSendMessage(),title:this.t("chat.send_msg")},Z("rtk-icon",{key:"bb26a3a7954727859f5566ecc60d746ac6700b7b",icon:this.iconPack.send}))),this.isEditing&&Z("div",{key:"5ef512e3fc236510a518e76ce027f0c8fc1c9a0c",class:"edit-buttons"},Z("rtk-tooltip",{key:"e18ae7567350d32b18a70de8cb2c1af0830353bc",variant:"secondary",label:this.t("cancel"),delay:2e3},Z("rtk-button",{key:"4f4aa2e44308a393314ab95244c87a3b8d4b282c",kind:"icon",variant:"secondary",onClick:()=>this.handleEditCancel(),title:this.t("cancel")},Z("rtk-icon",{key:"a4a99fe9ae34707cb63f63461a4728baf70e3e7a",icon:this.iconPack.dismiss}))),Z("rtk-tooltip",{key:"789315dbf551ba74d004459981532fa9a467ac45",variant:"primary",label:this.t("chat.update_msg"),delay:2e3},Z("rtk-button",{key:"61da43993c2da9b8bd00796544030e9b4cb45f12",kind:"icon",onClick:()=>this.handleEditMessage(),title:this.t("chat.send_msg")},Z("rtk-icon",{key:"e45aab29b0f6553ed2d7f370a8817bdccdabe42e",icon:this.iconPack.checkmark}))))))))}};_c([On()],Cc.prototype,"iconPack",void 0),_c([On()],Cc.prototype,"t",void 0),Cc.style=":host {\n display: flex;\n flex-direction: column;\n font-family: var(--rtk-font-family, sans-serif);\n font-size: 14px;\n position: relative;\n}\n\n.quoted-message-container {\n margin-bottom: var(--rtk-space-2, 8px);\n display: flex;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n border-radius: var(--rtk-border-radius-md, 8px);\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.quoted-message-container .quoted-message {\n flex: 1 1 0%;\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n max-height: var(--rtk-space-24, 96px);\n overflow-y: auto;\n word-break: break-all;\n}\n\n.quoted-message-container .quoted-message blockquote {\n display: none;\n}\n\n.quoted-message-container rtk-icon.dismiss {\n margin-left: auto;\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));\n}\n\n.quoted-message-container rtk-icon.dismiss:hover {\n cursor: pointer;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.quoted-message-container rtk-icon.dismiss {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.composer-container {\n position: relative;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n border-radius: var(--rtk-border-radius-md, 8px);\n overflow: hidden;\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.composer-container > .composers {\n min-height: 60px;\n }\n\n@container chatcontainer (height < 360px) {\n .composer-container > .composers {\n min-height: 30px;\n }\n}\n\n.chat-buttons {\n padding: var(--rtk-space-3, 12px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.chat-buttons .right {\n z-index: 10;\n}\n\n.chat-buttons .right .edit-buttons {\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.chat-buttons > div {\n display: flex;\n align-items: center;\n}\n\nrtk-emoji-picker {\n z-index: 20;\n position: absolute;\n top: calc(var(--rtk-space-72, 288px) * -1);\n border-top: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n animation: 0.3s slide-up ease;\n}\n\n@keyframes slide-up {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0%);\n }\n}\n";var Ac=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Rc=class{constructor(e){f(this,e),this.edit=re(this,"edit",7),this.reply=re(this,"reply",7),this.pin=re(this,"pin",7),this.delete=re(this,"delete",7),this.iconPack=pn,this.t=un(),this.isSelf=!1,this.canEdit=!1,this.canDelete=!1,this.canReply=!1,this.canPin=!1,this.disableControls=!1,this.alignRight=!1,this.hideAvatar=!1,this.now=new Date,this.leftAlign=!1,this.renderMessage=()=>{switch(this.message.type){case"text":return Z("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&Z("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),Z("rtk-text-message",{message:this.message,now:this.now,isContinued:this.isContinued,"data-timestamp":this.message.time.getTime(),iconPack:this.iconPack,t:this.t,showBubble:!0}));case"image":return Z("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&Z("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),Z("rtk-image-message",{message:this.message,now:this.now,isContinued:this.isContinued,iconPack:this.iconPack,"data-timestamp":this.message.time.getTime(),t:this.t,showBubble:!0}));case"file":return Z("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&Z("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),Z("rtk-file-message",{message:this.message,now:this.now,isContinued:this.isContinued,iconPack:this.iconPack,t:this.t,"data-timestamp":this.message.time.getTime(),showBubble:!0}));case"custom":this.child.setAttribute("message",JSON.stringify(this.message));const e=this.child.cloneNode(!0);return Z("div",{"is-continued":this.isContinued,key:this.message.id,ref:t=>t.appendChild(e)})}},this.onReply=()=>{this.reply.emit(this.message)},this.onPinned=()=>{this.pin.emit(this.message)},this.onDelete=()=>{this.delete.emit(this.message)},this.onEdit=async()=>{this.edit.emit(this.message)},this.isTouchDevice=()=>"ontouchstart"in window||navigator.maxTouchPoints>0}renderControls(){if(!this.disableControls)return Z("rtk-menu",{placement:this.alignRight?"bottom-end":"bottom-start"},Z("button",{slot:"trigger",class:"actions"},Z("rtk-icon",{icon:this.iconPack.chevron_down})),Z("rtk-menu-list",null,this.canReply&&Z("rtk-menu-item",{onClick:this.onReply},Z("rtk-icon",{icon:this.iconPack.back,slot:"start"}),this.t("chat.reply")),this.canPin&&Z("rtk-menu-item",{onClick:this.onPinned},Z("rtk-icon",{icon:this.iconPack.pin,slot:"start"}),this.t("pin")),this.canEdit&&Z("rtk-menu-item",{onClick:this.onEdit},Z("rtk-icon",{icon:this.iconPack.edit,slot:"start"}),this.t("chat.edit_msg")),this.canDelete&&Z("rtk-menu-item",{onClick:this.onDelete},Z("rtk-icon",{icon:this.iconPack.delete,slot:"start"}),this.t("chat.delete_msg"))))}renderAvatar(){if(!this.hideAvatar)return this.isContinued?Z("div",{class:"avatar"}):Z("div",{class:"avatar"},Z("rtk-avatar",{size:"sm",participant:{name:this.message.displayName,picture:this.senderDisplayPicture}}))}render(){return Z(J,{key:"50c4021e3c717d8d2c7e035ce6541adca05ca3d2"},Z("div",{key:"1f5a0d679baea7ea72855846f57fa8419e46f019",class:{"message-wrapper":!0,"align-right":this.alignRight,"left-align":this.leftAlign},"is-continued":this.isContinued},this.renderAvatar(),Z("div",{key:"1f11244450725426035076a80fcc41a76ef0b7a4",class:{message:!0,"show-on-hover":!this.isTouchDevice()},"is-continued":this.isContinued},this.renderMessage(),this.renderControls())))}get $el(){return ie(this)}};Ac([On()],Rc.prototype,"iconPack",void 0),Ac([On()],Rc.prototype,"t",void 0),Rc.style=".message-wrapper{display:flex;gap:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-4, 16px);margin-right:var(--rtk-space-4, 16px);margin-top:var(--rtk-space-4, 16px)}[is-continued] .message-wrapper{margin-top:var(--rtk-space-0, 0px)}.message-wrapper.align-right{flex-direction:row-reverse}.file-picker{display:none}.message{position:relative;display:flex}.show-on-hover rtk-menu{visibility:hidden}.show-on-hover:hover rtk-menu{visibility:visible}.align-right .message{justify-content:flex-end;margin-left:auto}.align-right .message .head{margin-right:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-0, 0px);flex-direction:row-reverse;gap:var(--rtk-space-4, 16px)}.align-right .message rtk-text-message .bubble,.align-right .message rtk-image-message .bubble,.align-right .message rtk-file-message .bubble{padding-right:var(--rtk-space-5, 20px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right .message .actions rtk-icon{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right rtk-menu{left:auto;right:var(--rtk-space-0, 0px)}.head{margin-bottom:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-1, 4px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.head .name{font-size:14px;font-weight:600}.head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}rtk-menu{position:absolute;left:var(--rtk-space-0, 0px);top:var(--rtk-space-6, 24px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}[is-continued] rtk-menu{top:var(--rtk-space-2, 8px)}.actions{display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0\\.5, 2px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.body{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.body .emoji{font-size:24px}.body.bubble{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-1, 4px);max-width:var(--rtk-space-96, 384px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-left:var(--rtk-space-5, 20px);padding-right:var(--rtk-space-5, 20px);overflow-wrap:break-word;font-size:14px;line-height:1.375;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.body.bubble p{margin:var(--rtk-space-0, 0px);word-break:break-word}p{margin:var(--rtk-space-0, 0px)}rtk-text-message,rtk-image-message,rtk-file-message{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-0, 0px)}.image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.new-chat-marker{display:flex;width:100%;align-items:center;gap:var(--rtk-space-2, 8px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.new-chat-marker::before{content:'';height:1px;flex:1 1 0%;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.show-new-messages-ctr{pointer-events:none;display:flex;justify-content:flex-end;padding:var(--rtk-space-3, 12px);z-index:0;margin-top:calc(var(--rtk-space-14, 56px) * -1)}.show-new-messages{pointer-events:auto;--tw-translate-y:calc(var(--rtk-space-6, 24px) * -1);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);background-color:transparent}.block-quote,blockquote{--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;border-left-color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px) !important;border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}.link{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.align-right .block-quote{border-color:rgb(var(--rtk-colors-text-on-brand-600, var(--rtk-colors-text-600, 255 255 255 / 0.52)));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity))}.align-right .link{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right .image .actions rtk-icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px}.message{width:75%}.left-align .body{margin-top:var(--rtk-space-4, 16px)}.left-align [is-continued] .body{margin-top:var(--rtk-space-0, 0px)}.left-align .body{--tw-translate-x:calc(var(--rtk-space-8, 32px) * -1);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}";var Lc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ic=class{constructor(e){f(this,e),this.onPinMessage=re(this,"pinMessage",7),this.stateUpdate=re(this,"rtkStateUpdate",7),this.observingEl=[],this.autoScrollEnabled=!0,this.messages=[],this.canPinMessages=!1,this.iconPack=pn,this.t=un(),this.now=new Date,this.showLatestMessageButton=!1,this.onScroll=e=>{const t=e.target;M(()=>{const{scrollTop:e,clientHeight:i,scrollHeight:r}=t;e+i+10>=r?(this.autoScrollEnabled=!0,this.showLatestMessageButton=!1):this.autoScrollEnabled=!1})},this.scrollToBottom=()=>{vs(this.$chat)},this.observeMessage=e=>{e&&this.observingEl.push(e);try{this.intersectionObserver.observe(e)}catch(pE){}},this.getMessageActions=e=>{const t=[];return!e.pinned&&this.canPinMessages&&t.push({id:"pin_message",label:this.t("pin"),icon:this.iconPack.pin}),t},this.onMessageActionHandler=(e,t)=>{if("pin_message"===e)this.onPinMessage.emit(t)}}connectedCallback(){var e;this.lastReadTimestamp=null!==(e=wn.everyone)&&void 0!==e?e:new Date("0001-01-01T00:00:00Z"),this.intersectionObserver=new IntersectionObserver(e=>{document.hasFocus()&&M(()=>{for(const t of e)if(t.isIntersecting){parseInt(t.target.getAttribute("data-timestamp"))>this.lastReadTimestamp.getTime()&&(wn[this.selectedGroup]=new Date)}})});const t=()=>{this.now=new Date,this.timeout=setTimeout(()=>{null!=this.request&&(this.request=requestAnimationFrame(t))},6e4)};this.request=requestAnimationFrame(t),this.chatChanged(this.messages)}componentDidLoad(){this.$chat.addEventListener("scroll",this.onScroll),this.$chat.scrollTop=this.$chat.scrollHeight}componentDidRender(){this.autoScrollEnabled?vs(this.$chat):null==this.autoScrollEnabled&&vs(this.$chat,!1)}chatChanged(e){if(null!=this.$chat&&!this.autoScrollEnabled&&this.$chat.clientHeight!==this.$chat.scrollHeight)for(let t=e.length-1;t>=0;t--)if(e[t].message.time>this.lastReadTimestamp&&e[t].message.userId!==this.selfUserId){this.showLatestMessageButton=!0;break}}selectedBucketChanged(){this.autoScrollEnabled=void 0,this.observingEl.forEach(e=>{this.intersectionObserver.unobserve(e)}),this.observingEl=[]}disconnectedCallback(){this.$chat.removeEventListener("scroll",this.onScroll),this.intersectionObserver.disconnect(),clearTimeout(this.timeout),cancelAnimationFrame(this.request)}render(){var e;let t=null,i=!1;return Z(J,{key:"1e44ac8e6bd0eabff25aaedb905d80fb4007903d"},Z("div",{key:"ffbb1fe97efc2408e2ee7e4bccef1cc8a3100b66",class:"chat-container scrollbar",ref:e=>this.$chat=e,part:"container"},Z("div",{key:"58d11c81a25a0760d3bdd9e60a8a6d0a96c022c2",class:"spacer",part:"spacer"}),Z("div",{key:"be68b5ccfd53bc7ec4c7dc23b10fe325a7c54314",class:"chat",part:"chat"},null===(e=this.messages)||void 0===e?void 0:e.map(e=>{if("chat"===e.type){const{message:r}=e,n=!(r.userId===this.selfUserId)&&!this.autoScrollEnabled&&!i&&r.time>this.lastReadTimestamp;n&&(i=n);const s=!n&&r.userId===(null===t||void 0===t?void 0:t.userId)&&ps(r.time,null===t||void 0===t?void 0:t.time)<2;return t=r,Z("div",{"is-continued":s,key:e.message.id,ref:this.observeMessage,"data-timestamp":r.time.getTime(),class:r.pinned?"pinned":""},n&&Z("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),Z("div",{class:"message-wrapper"},Z("rtk-message-view",{time:r.time,actions:this.getMessageActions(r),authorName:r.displayName,hideAuthorName:!0,hideAvatar:!0,hideMetadata:!0,viewType:"incoming",variant:"bubble",onAction:e=>this.onMessageActionHandler(e.detail,r)},!s&&Z("div",{class:"head"},Z("div",{class:"name"},r.displayName),!!r.time&&Z("div",{class:"time",title:fs(r.time)},gs(r.time,new Date(Date.now())))),Z("div",{class:"body"},"text"===r.type&&Z("rtk-text-message-view",{text:r.message,isMarkdown:!0}),"file"===r.type&&Z("rtk-file-message-view",{name:r.name,url:r.link,size:r.size}),"image"===r.type&&Z("rtk-image-message-view",{url:r.link,onPreview:()=>{this.stateUpdate.emit({image:r})}}))),r.pinned&&Z("div",{class:"pin-button",part:"pin-button"},Z("rtk-tooltip",{label:this.t("unpin")},Z("rtk-button",{kind:"icon",variant:"ghost",onClick:()=>this.onMessageActionHandler("pin_message",r),disabled:!this.canPinMessages},Z("rtk-icon",{icon:this.iconPack.pin,size:"sm"}))))))}return null}))),Z("div",{key:"ae321cae98279cb45e61968b5fab1806d8ae2f33",class:"show-new-messages-ctr"},Z("rtk-button",{key:"e593e952615692612b2423e49975f97bb22df0fe",class:{"show-new-messages":!0,active:this.showLatestMessageButton},kind:"icon",part:"show-new-messages",onClick:this.scrollToBottom},Z("rtk-icon",{key:"454e7ecb90b1660b882bb6f988beb1d7d0494d5f",icon:this.iconPack.chevron_down}))))}static get watchers(){return{messages:["chatChanged"],selectedGroup:["selectedBucketChanged"]}}};Lc([On()],Ic.prototype,"iconPack",void 0),Lc([On()],Ic.prototype,"t",void 0),Ic.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));word-break:break-word}.chat-container{box-sizing:border-box;display:flex;flex-direction:column;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);flex:1 0 0px;overflow-y:scroll}.chat-container .spacer{flex:1 1 auto}.chat-container .chat{flex:0 0 auto}.file-picker{display:none}.chat .head{margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-2, 8px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{overflow-wrap:break-word;line-height:1.5}.chat .body .emoji{font-size:24px}p{margin:var(--rtk-space-0, 0px);line-height:1.5}rtk-message-view{margin-top:var(--rtk-space-2, 8px);display:block;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}rtk-message-view::part(message){flex-grow:1}*[is-continued] rtk-message-view{margin-top:var(--rtk-space-1, 4px)}.pinned .message-wrapper{position:relative}.pinned .pin-button{position:absolute;right:var(--rtk-space-4, 16px);top:calc(var(--rtk-space-4, 16px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.pinned .pin-button:hover rtk-button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.new-chat-marker{display:flex;width:100%;align-items:center;gap:var(--rtk-space-2, 8px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.new-chat-marker::before{content:'';height:1px;flex:1 1 0%;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.show-new-messages-ctr{pointer-events:none;display:flex;justify-content:flex-end;padding:var(--rtk-space-3, 12px);z-index:0;margin-top:calc(var(--rtk-space-14, 56px) * -1)}.show-new-messages{pointer-events:auto;--tw-translate-y:var(--rtk-space-16, 64px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}";var Mc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Dc=class{constructor(e){f(this,e),this.editMessageInit=re(this,"editMessageInit",7),this.onPinMessage=re(this,"pinMessage",7),this.onDeleteMessage=re(this,"deleteMessage",7),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un(),this.leftAlign=!1,this.permissionsChanged=!1,this.pageSize=25,this.lastReadMessageIndex=-1,this.permissionsUpdateListener=()=>{this.permissionsChanged=!this.permissionsChanged},this.maybeMarkChannelAsRead=e=>{if(!this.selectedChannelId)return;if(0===e.length)return;if(-1!==this.lastReadMessageIndex)return;const t=e.at(0).time>e.at(-1).time?e.at(0):e.at(-1);t.channelIndex&&(this.lastReadMessageIndex=parseInt(t.channelIndex,10),this.meeting.chat.markLastReadMessage(this.selectedChannelId,t))},this.getChatMessages=async(e,t,i)=>{const{messages:r}=await this.meeting.chat.getMessages(e,t,i,void 0,this.selectedChannelId);return this.maybeMarkChannelAsRead(r),r},this.createChatNodes=e=>e.map((t,i)=>{var r;const n=t.userId===(null===(r=e[i-1])||void 0===r?void 0:r.userId);return this.createChatNode(t,n)}),this.disconnectMeeting=e=>{var t,i;null===(t=null===e||void 0===e?void 0:e.chat)||void 0===t||t.removeListener("chatUpdate",this.chatUpdateListener),null===(i=this.meeting)||void 0===i||i.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)},this.getMessageActions=e=>{const t=[];return this.meeting.self.permissions.pinParticipant&&t.push({id:"pin_message",label:e.pinned?this.t("unpin"):this.t("pin"),icon:this.iconPack.pin}),t},this.onMessageActionHandler=(e,t)=>{switch(e){case"pin_message":this.onPinMessage.emit(t);break;case"delete_message":this.onDeleteMessage.emit(t)}},this.createChatNode=(e,t)=>{var i,r,n,s;if(0!==e.targetUserIds.length)return null;let a;return a="CHAT"===this.meeting.meta.viewType?null===(i=this.meeting.participants.all.toArray().find(t=>t.userId===e.userId))||void 0===i?void 0:i.picture:this.meeting.self.userId===e.userId?this.meeting.self.picture:null!==(n=null===(r=this.meeting.participants.joined.toArray().find(t=>t.userId===e.userId))||void 0===r?void 0:r.picture)&&void 0!==n?n:null===(s=this.meeting.participants.waitlisted.toArray().find(t=>t.userId===e.userId))||void 0===s?void 0:s.picture,Z("div",{class:{pinned:e.pinned}},Z("div",{class:"message-wrapper"},Z("rtk-message-view",{time:e.time,actions:this.getMessageActions(e),authorName:e.displayName,avatarUrl:a,hideAuthorName:t,viewType:"incoming",variant:"bubble",onAction:t=>this.onMessageActionHandler(t.detail,e)},Z("div",null,Z("div",{class:"body"},"text"===e.type&&Z("rtk-text-message-view",{text:e.message,isMarkdown:!0}),"file"===e.type&&Z("rtk-file-message-view",{name:e.name,url:e.link,size:e.size}),"image"===e.type&&Z("rtk-image-message-view",{url:e.link,onPreview:()=>{this.stateUpdate.emit({image:e})}})),e.pinned&&Z("div",{class:"pin-icon",part:"pin-icon"},Z("rtk-icon",{icon:this.iconPack.pin,size:"sm"}))))))},this.chatUpdateListener=e=>{this.selectedChannelId&&e.message.channelId!==this.selectedChannelId||("add"===e.action?(this.$paginatedListRef.onNewNode(e.message),this.lastReadMessageIndex=-1,this.maybeMarkChannelAsRead([e.message])):"delete"===e.action?this.$paginatedListRef.onNodeDelete(e.message.id):"edit"===e.action&&this.$paginatedListRef.onNodeUpdate(e.message.id,e.message))}}componentDidLoad(){const e=this.host.shadowRoot.querySelector("slot");e&&(this.children=e.assignedElements()[0])}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}meetingChanged(e,t){var i;void 0!=t&&this.disconnectMeeting(t),e&&!e.chat||(null!=e&&(null===(i=e.chat)||void 0===i||i.addListener("chatUpdate",this.chatUpdateListener),e.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener)),this.permissionsUpdateListener())}channelChanged(){this.lastReadMessageIndex=-1}render(){return Z(J,{key:"d0ae21ca32589c18ede4b1e4b4682f5b82b58320"},Z("rtk-paginated-list",{key:"bff3bdae7c6bbefed8dd8b478ac60370067c75a6",ref:e=>this.$paginatedListRef=e,pageSize:this.pageSize,pagesAllowed:3,fetchData:this.getChatMessages,createNodes:this.createChatNodes,selectedItemId:this.selectedChannelId,emptyListLabel:this.t("chat.empty_channel")},Z("slot",{key:"043cfe627a1056c2267dd00705ff33e7e96f1f89"})))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],selectedChannelId:["channelChanged"]}}};Mc([On()],Dc.prototype,"meeting",void 0),Mc([On()],Dc.prototype,"iconPack",void 0),Mc([On()],Dc.prototype,"t",void 0),Dc.style=":host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));flex:1 0 0px}";var Oc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Nc=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.pageSize=50,this.searchMessages=async(e,t,i)=>this.meeting.chat.searchMessages(this.query,{channelId:this.channelId,timestamp:e,size:t,reversed:i}),this.nodeRenderer=e=>e.map(e=>Z("rtk-chat-message",{key:e.id,message:e,disableControls:!0}))}render(){return Z(J,{key:"9947c793cb766158d4ed3d81871bbdb8b60274af"},Z("rtk-paginated-list",{key:"0d91dc8818b08c7ed053728074c483f159811a41",pageSize:this.pageSize,pagesAllowed:3,fetchData:this.searchMessages,createNodes:this.nodeRenderer,selectedItemId:this.query}))}};Oc([On()],Nc.prototype,"meeting",void 0),Oc([On()],Nc.prototype,"iconPack",void 0),Oc([On()],Nc.prototype,"t",void 0),Nc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;flex-direction:column;position:relative;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}";var Uc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Fc=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.keyPressListener=e=>{"Escape"===e.key&&this.close()},this.iconPack=pn,this.t=un(),this.close=()=>{this.states.activeConfirmationModal.onClose(this.stateUpdate,this.states,this.meeting),this.stateUpdate.emit({activeConfirmationModal:{active:!1}}),this.states.activeConfirmationModal={active:!1}},this.onConfirmation=async()=>{this.states.activeConfirmationModal.onClick(this.stateUpdate,this.states,this.meeting),this.stateUpdate.emit({activeConfirmationModal:{active:!1}}),this.states.activeConfirmationModal={active:!1}}}connectedCallback(){document.addEventListener("keydown",this.keyPressListener)}componentDidLoad(){}disconnectedCallback(){document.removeEventListener("keydown",this.keyPressListener)}render(){var e,t;const i=this.states.activeConfirmationModal;return Z(J,{key:"c79124361c70a80d200f4021c7483038f330b683"},Z("div",{key:"a1c812cc2742b0eca2525416e67579864a8c0ae7",class:"leave-modal"},Z("div",{key:"21edbc34bdd1c996707d297abf86a1c04a487396",class:"header"},Z("h2",{key:"a7c77cf1a39bc46b787b851d51a5cd37695e44eb",class:"title"},i.header?this.t(i.header):this.t("cta.confirmation"))),i.content&&Z("p",{key:"25ceecc3c208442821795ebf0a1a981b5130d1d9",class:"message"},this.t(i.content)),Z("div",{key:"f081c0544fb467787cbfea432575d4a16a1c42c3",class:"content"},Z("div",{key:"a7cf64611e6a516624310fbe0c119c279bec682d",class:"leave-meeting"},Z("rtk-button",{key:"469b16b167d943f369f9995c9b0d20225108303a",variant:"secondary",title:i.cancelText?this.t(i.cancelText):this.t("cancel"),onClick:this.close,class:"br-secondary-btn"},i.cancelText?this.t(i.cancelText):this.t("cancel")),Z("rtk-button",{key:"5fc8427e0b0c51fad3a4d033f1d6c4b4399477f3",onClick:()=>this.onConfirmation(),variant:null!==(t=null===(e=this.states.activeConfirmationModal)||void 0===e?void 0:e.variant)&&void 0!==t?t:"danger",title:i.ctaText?this.t(i.ctaText):this.t("yes")},i.ctaText?this.t(i.ctaText):this.t("yes"))))))}};Uc([On()],Fc.prototype,"meeting",void 0),Uc([On()],Fc.prototype,"states",void 0),Uc([On()],Fc.prototype,"iconPack",void 0),Uc([On()],Fc.prototype,"t",void 0),Fc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);padding:var(--rtk-space-8, 32px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));width:400px;max-width:80%}.leave-modal{width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px)}.leave-modal .content{font-size:14px}.leave-modal p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px)}.leave-meeting{display:flex;flex-direction:row;justify-content:space-between;gap:var(--rtk-space-4, 16px)}.leave-meeting rtk-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255));flex:1 1 0%}.br-secondary-btn{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-secondary-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}";var jc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Bc=class{constructor(e){f(this,e),this.onChange=re(this,"valueChange",7),this.input="1",this.minValue=0,this.iconPack=pn,this.t=un()}connectedCallback(){this.watchStateHandler(this.input),this.input=this.value.toString()}watchStateHandler(e){this.onChange.emit(e)}increment(){this.input=Math.max(parseInt(this.input)+1,this.minValue).toString()}decrement(){this.input=Math.max(this.minValue,parseInt(this.input)-1).toString()}render(){return Z(J,{key:"151ffb29ae91788d05b46f4c795b817c20a35b90"},Z("rtk-button",{key:"9568cb52875c92f57597033cc7b396fa5c2d0371",kind:"icon",variant:"ghost",onClick:()=>this.decrement()},Z("rtk-icon",{key:"8ef248b64e90f01bd1f78db5048db148d7c374c9",icon:this.iconPack.subtract})),Z("input",{key:"376d604bb62a6c9013e7361da51de8f05f34c870",type:"number",value:this.input,min:this.minValue,onInput:e=>{const t=parseInt(e.target.value,10);isNaN(t)||tthis.increment()},Z("rtk-icon",{key:"cb2146960e8c8368cce69fb8d8a696078bcea2fc",icon:this.iconPack.add})))}static get watchers(){return{input:["watchStateHandler"]}}};jc([On()],Bc.prototype,"iconPack",void 0),jc([On()],Bc.prototype,"t",void 0),Bc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));width:-moz-fit-content;width:fit-content;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-1, 4px)}p{margin:var(--rtk-space-0, 0px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}input{margin:var(--rtk-space-0, 0px);width:var(--rtk-space-6, 24px);padding:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;border-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));text-align:center;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));border-radius:var(--rtk-border-radius-sm, 4px);font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{margin:var(--rtk-space-0, 0px);appearance:none;-webkit-appearance:none}input[type='number']{-moz-appearance:textfield}";var Vc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const zc=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.keyPressListener=e=>{"Escape"===e.key&&this.close()},this.iconPack=pn,this.t=un(),this.activeTab="audio",this.isMobileMainVisible=!1,this.progress=0}connectedCallback(){document.addEventListener("keydown",this.keyPressListener)}disconnectedCallback(){this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener)}progressUpdate(e){this.progress=e.detail}changeTab(e){this.activeTab=e,"sm"===this.size&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeDebugger:!1})}getActiveTab(){switch(this.activeTab){case"audio":return this.t("debugger.audio.troubleshooting.label");case"screenshare":return this.t("debugger.screenshare.troubleshooting.label");case"video":return this.t("debugger.video.troubleshooting.label");case"system":return this.t("debugger.system.troubleshooting.label");default:return this.t("debugger.troubleshooting.label")}}render(){if(!this.meeting)return null;const e={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t,size:this.size},t=this.getActiveTab(),i="undefined"!==typeof navigator.getBattery;return Z(J,null,Z("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},Z("header",null,Z("h3",null,this.t("debugger.troubleshooting.label"))),Z("button",{type:"button",class:{active:"audio"===this.activeTab},onClick:()=>this.changeTab("audio")},this.t("debugger.audio.label"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.mic_on}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right}))),Z("button",{type:"button",class:{active:"video"===this.activeTab},onClick:()=>this.changeTab("video")},this.t("debugger.video.label"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.video_on}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right}))),Z("button",{type:"button",class:{active:"screenshare"===this.activeTab},onClick:()=>this.changeTab("screenshare")},this.t("debugger.screenshare.label"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.share_screen_start}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right}))),Z("button",{type:"button",class:{active:"system"===this.activeTab,hidden:!i},onClick:()=>this.changeTab("system")},this.t("debugger.system.label"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.settings}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right})))),Z("main",{class:{active:this.isMobileMainVisible},part:"main-content"},"sm"===this.size&&Z("header",null,Z("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},Z("rtk-icon",{icon:this.iconPack.chevron_left})),Z("h4",null,t)),"audio"===this.activeTab&&Z("rtk-debugger-audio",Object.assign({},e)),"video"===this.activeTab&&Z("rtk-debugger-video",Object.assign({},e)),"screenshare"===this.activeTab&&Z("rtk-debugger-screenshare",Object.assign({},e)),"system"===this.activeTab&&i&&Z("rtk-debugger-system",Object.assign({},e))))}};function Hc(e){let{stats:t}=e;if(!t||!t.length)return null;let i="Good";const r=t.map(e=>e.verdict);return r.includes("Poor")?i="Poor":r.includes("Average")&&(i="Average"),i}function $c(e){let{packetLossPercentage:t}=e,i="Good";return t>4?i="Poor":t>=1&&t<=4&&(i="Average"),i}function Gc(e){let{jitterInMS:t}=e,i="Good";return t>100?i="Poor":t>=50&&t<=100&&(i="Average"),i}function Wc(e){let{bitrate:t}=e,i="Good";return 0===Math.round(t/1024)&&(i="Poor"),i}function qc(e){let{batteryLevelPercentage:t}=e,i="Good";return t<20?i="Poor":t<50&&(i="Average"),i}function Kc(e){let{charging:t,dischargingTimeInSeconds:i,batteryLevelPercentage:r}=e;return r<20?"Poor":t?"Good":i<1800?"Poor":"Average"}Vc([On()],zc.prototype,"meeting",void 0),Vc([On()],zc.prototype,"states",void 0),Vc([On()],zc.prototype,"iconPack",void 0),Vc([On()],zc.prototype,"t",void 0),zc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{margin-right:var(--rtk-space-2, 8px);display:flex;align-items:center;justify-content:space-between;padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}header h3{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px)}.back-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;max-width:var(--rtk-space-56, 224px) !important;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:14px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.hidden{display:none}main{position:relative;box-sizing:border-box;display:flex;height:100%;width:100%;flex-direction:column}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));width:100% !important;max-width:100% !important;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside button.hidden{display:none}:host([size='sm']) aside.hide{display:none}aside button:host([size='sm']) aside.hide{display:none}:host([size='sm']) aside button:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;height:100%;width:100%;padding:var(--rtk-space-0, 0px)}aside button:host([size='sm']) main{display:none}:host([size='sm']) aside button:host([size='sm']) main{display:none}:host([size='sm']) main.active{display:block}:host([size='sm']) header{margin:var(--rtk-space-0, 0px);justify-content:center}:host([size='sm']) header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}::-webkit-scrollbar-thumb:hover{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.progress-bar{height:var(--rtk-space-1, 4px);width:100%;overflow:hidden;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.progress-indicator{height:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}";var Zc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Yc=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.audioProducerFormattedStats=[],this.audioProducerScoreStats=null,this.networkBasedMediaHealth=null,this.devicesHealth=null,this.mediaScoreUpdateListener=e=>{let{kind:t,isScreenshare:i,scoreStats:r}=e;"audio"!==t||i||(this.audioProducerScoreStats=r)},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getAudioDevices();this.devicesHealth=(null===e||void 0===e?void 0:e.length)>0?"Good":"Poor"},this.audioUpdateListener=()=>{this.meeting.self.audioEnabled||(this.audioProducerScoreStats=null)}}async audioProducerScoreStatsChanged(e){if(!e)return void(this.audioProducerFormattedStats=[]);const t=e,i=[];i.push({name:this.t("debugger.stats.bitrate.label"),value:"".concat(Math.round(t.bitrate/1024)," kbps"),description:this.t("debugger.stats.bitrate.description"),verdict:Wc({bitrate:t.bitrate})}),i.push({name:this.t("debugger.stats.packet_loss.label"),value:"".concat(t.packetsLostPercentage,"%"),description:this.t("debugger.stats.packet_loss.description"),verdict:$c({packetLossPercentage:t.packetsLostPercentage})}),i.push({name:this.t("debugger.stats.jitter.label"),value:"".concat(Math.round(1e3*t.jitter)," ms"),description:this.t("debugger.stats.jitter.description"),verdict:Gc({jitterInMS:1e3*t.jitter})}),this.audioProducerFormattedStats=i,this.networkBasedMediaHealth=Hc({stats:i})}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("audioUpdate",this.audioUpdateListener),this.meeting.self.off("deviceListUpdate",this.deviceListUpdateListener))}async meetingChanged(e){e&&(e.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),e.self.on("audioUpdate",this.audioUpdateListener),e.self.on("deviceListUpdate",this.deviceListUpdateListener),await this.deviceListUpdateListener())}render(){var e,t;if(this.meeting)return Z(J,null,Z("div",{id:"header"}),Z("div",{class:"tab-body"},Z("div",{class:"status-container"},Z("div",{class:"status-section"},Z("div",{class:"section-header ".concat(this.networkBasedMediaHealth?"":"only-child")},Z("span",null,this.t("debugger.audio.sections.network_media")),this.networkBasedMediaHealth&&Z("span",{class:"status ".concat(null===(e=this.networkBasedMediaHealth)||void 0===e?void 0:e.toLowerCase())},this.t("debugger.quality.".concat(null===(t=this.networkBasedMediaHealth)||void 0===t?void 0:t.toLowerCase())))),this.isNetworkOpen&&!this.audioProducerFormattedStats.length&&Z("div",{class:"section-body missing-stats"},this.meeting.self.audioEnabled?Z("span",null,this.t("debugger.audio.messages.generating_report")):Z("span",null,this.t("debugger.audio.messages.enable_media"))),this.isNetworkOpen&&!!this.audioProducerFormattedStats.length&&Z("div",{class:"section-body network-table"},this.audioProducerFormattedStats.map(e=>{var t,i;return Z("div",{class:"network-row"},Z("div",{class:"network-cell label"},Z("strong",null,e.name),Z("span",{class:"description"},e.description)),Z("div",{class:"network-cell value"},Z("span",{class:"status ".concat(null===(t=e.verdict)||void 0===t?void 0:t.toLowerCase())},this.t("debugger.quality.".concat(null===(i=e.verdict)||void 0===i?void 0:i.toLowerCase()))),Z("span",{class:"value"},e.value)))}))))))}static get watchers(){return{audioProducerScoreStats:["audioProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};Zc([On()],Yc.prototype,"meeting",void 0),Zc([On()],Yc.prototype,"states",void 0),Zc([On()],Yc.prototype,"iconPack",void 0),Zc([On()],Yc.prototype,"t",void 0),Yc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-audio{display:flex;flex-direction:column}";var Jc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Qc=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.videoProducerFormattedStats=[],this.videoProducerScoreStats=null,this.audioProducerFormattedStats=[],this.audioProducerScoreStats=null,this.networkBasedMediaHealth=null,this.mediaScoreUpdateListener=e=>{let{kind:t,isScreenshare:i,scoreStats:r}=e;"video"===t&&i&&(this.videoProducerScoreStats=r),"audio"===t&&i&&(this.audioProducerScoreStats=r)},this.screenShareUpdateListener=()=>{this.meeting.self.screenShareEnabled||(this.videoProducerScoreStats=null,this.audioProducerScoreStats=null)}}async videoProducerScoreStatsChanged(e){if(!e)return void(this.videoProducerFormattedStats=[]);const t=e,i=[];i.push({name:this.t("debugger.stats.cpu_limitations.label"),value:t.cpuLimitations?"Yes":"No",description:this.t("debugger.stats.cpu_limitations.description"),verdict:t.cpuLimitations?"Poor":"Good"}),i.push({name:this.t("debugger.stats.bandwidth_limitations.label"),value:t.bandwidthLimitations?"Yes":"No",description:this.t("debugger.stats.bandwidth_limitations.description"),verdict:t.bandwidthLimitations?"Poor":"Good"}),i.push({name:this.t("debugger.stats.bitrate.label"),value:"".concat(Math.round(t.bitrate/1024)," kbps"),description:this.t("debugger.stats.bitrate.description"),verdict:Wc({bitrate:t.bitrate})}),i.push({name:this.t("debugger.stats.packet_loss.label"),value:"".concat(t.packetsLostPercentage,"%"),description:this.t("debugger.stats.packet_loss.description"),verdict:$c({packetLossPercentage:t.packetsLostPercentage})}),i.push({name:this.t("debugger.stats.jitter.label"),value:"".concat(Math.round(1e3*t.jitter)," ms"),description:this.t("debugger.stats.jitter.description"),verdict:Gc({jitterInMS:1e3*t.jitter})}),this.videoProducerFormattedStats=i,this.networkBasedMediaHealth=Hc({stats:i})}async audioProducerScoreStatsChanged(e){if(!e)return void(this.audioProducerFormattedStats=[]);const t=e,i=[];i.push({name:this.t("debugger.stats.bitrate.label"),value:"".concat(Math.round(t.bitrate/1024)," kbps"),description:this.t("debugger.stats.bitrate.description"),verdict:Wc({bitrate:t.bitrate})}),i.push({name:this.t("debugger.stats.packet_loss.label"),value:"".concat(t.packetsLostPercentage,"%"),description:this.t("debugger.stats.packet_loss.description"),verdict:$c({packetLossPercentage:t.packetsLostPercentage})}),i.push({name:this.t("debugger.stats.jitter.label"),value:"".concat(Math.round(1e3*t.jitter)," ms"),description:this.t("debugger.stats.jitter.description"),verdict:Gc({jitterInMS:1e3*t.jitter})}),this.audioProducerFormattedStats=i}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("screenShareUpdate",this.screenShareUpdateListener))}async meetingChanged(e){e&&(e.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),e.self.on("screenShareUpdate",this.screenShareUpdateListener))}render(){var e,t;if(this.meeting)return Z(J,null,Z("div",{id:"header"}),Z("div",{class:"tab-body"},Z("div",{class:"status-container"},Z("div",{class:"status-section"},Z("div",{class:"section-header ".concat(this.networkBasedMediaHealth?"":"only-child")},Z("span",null,this.t("debugger.screenshare.sections.network_media")),this.networkBasedMediaHealth&&Z("span",{class:"status ".concat(null===(e=this.networkBasedMediaHealth)||void 0===e?void 0:e.toLowerCase())},this.t("debugger.quality.".concat(null===(t=this.networkBasedMediaHealth)||void 0===t?void 0:t.toLowerCase())))),this.isNetworkOpen&&!this.videoProducerFormattedStats.length&&Z("div",{class:"section-body missing-stats"},this.meeting.self.screenShareEnabled?Z("span",null,this.t("debugger.screenshare.messages.generating_report")):Z("span",null,this.t("debugger.screenshare.messages.enable_media"))),this.isNetworkOpen&&!!this.videoProducerFormattedStats.length&&Z("div",{class:"section-body network-table"},this.videoProducerFormattedStats.map(e=>{var t,i;return Z("div",{class:"network-row"},Z("div",{class:"network-cell label"},Z("strong",null,e.name),Z("span",{class:"description"},e.description)),Z("div",{class:"network-cell value"},Z("span",{class:"status ".concat(null===(t=e.verdict)||void 0===t?void 0:t.toLowerCase())},this.t("debugger.quality.".concat(null===(i=e.verdict)||void 0===i?void 0:i.toLowerCase()))),Z("span",{class:"value"},e.value)))}))))))}static get watchers(){return{videoProducerScoreStats:["videoProducerScoreStatsChanged"],audioProducerScoreStats:["audioProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};Jc([On()],Qc.prototype,"meeting",void 0),Jc([On()],Qc.prototype,"states",void 0),Jc([On()],Qc.prototype,"iconPack",void 0),Jc([On()],Qc.prototype,"t",void 0),Qc.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}";var Xc=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const el=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.isBatterySectionOpen=!0,this.batterySectionHealth=null,this.battery=null,this.batteryFormattedStats=[],this.batteryUpdateListener=()=>{const e=Math.round(100*this.battery.level),t=[];t.push({name:this.t("debugger.system.battery.level.label"),value:"".concat(e,"%"),description:this.t("debugger.system.battery.level.description"),verdict:qc({batteryLevelPercentage:e})}),t.push({name:this.t("debugger.system.battery.charging.label"),value:"".concat(this.battery.charging?this.t("debugger.system.battery.charging.is_charging"):this.t("debugger.system.battery.charging.is_not_charging")),description:this.t("debugger.system.battery.charging.description"),verdict:Kc({batteryLevelPercentage:e,chargingTimeInSeconds:this.battery.chargingTime,dischargingTimeInSeconds:this.battery.dischargingTime,charging:this.battery.charging})}),this.batterySectionHealth=function(e){let{stats:t}=e;if(!t||!t.length)return null;let i="Good";const r=t.map(e=>e.verdict);return r.includes("Poor")?i="Poor":r.includes("Average")&&(i="Average"),i}({stats:t}),this.batteryFormattedStats=t}}toggleSection(e){"battery"===e&&(this.isBatterySectionOpen=!this.isBatterySectionOpen)}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&this.battery&&(this.battery.removeEventListener("levelchange",this.batteryUpdateListener),this.battery.removeEventListener("chargingchange",this.batteryUpdateListener))}async meetingChanged(e){e&&"undefined"!==typeof navigator.getBattery&&(this.battery=await navigator.getBattery(),this.battery.addEventListener("levelchange",this.batteryUpdateListener),this.battery.addEventListener("chargingchange",this.batteryUpdateListener),this.batteryUpdateListener())}render(){var e,t;if(this.meeting)return Z(J,null,Z("div",{id:"header"}),Z("div",{class:"tab-body"},Z("div",{class:"status-container"},Z("div",{class:"status-section"},Z("div",{class:"section-header",onClick:()=>this.toggleSection("battery")},Z("span",null,this.t("debugger.system.sections.battery")),this.batterySectionHealth&&Z("span",{class:"status ".concat(null===(e=this.batterySectionHealth)||void 0===e?void 0:e.toLowerCase())},this.t("debugger.quality.".concat(null===(t=this.batterySectionHealth)||void 0===t?void 0:t.toLowerCase())))),this.isBatterySectionOpen&&!!this.batteryFormattedStats.length&&Z("div",{class:"section-body battery-table"},this.batteryFormattedStats.map(e=>{var t,i;return Z("div",{class:"battery-row"},Z("div",{class:"battery-cell label"},Z("strong",null,e.name),Z("span",{class:"description"},e.description)),Z("div",{class:"battery-cell value"},Z("span",{class:"status ".concat(null===(t=e.verdict)||void 0===t?void 0:t.toLowerCase())},this.t("debugger.quality.".concat(null===(i=e.verdict)||void 0===i?void 0:i.toLowerCase()))),Z("span",{class:"value"},e.value)))}))))))}static get watchers(){return{meeting:["meetingChanged"]}}};Xc([On()],el.prototype,"meeting",void 0),Xc([On()],el.prototype,"states",void 0),Xc([On()],el.prototype,"iconPack",void 0),Xc([On()],el.prototype,"t",void 0),el.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.battery-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.battery-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.battery-row:last-child{border-bottom:none}.battery-cell{display:flex;flex-direction:column}.battery-cell.label strong{font-size:14px}.battery-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.battery-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-video{display:flex;flex-direction:column}";var tl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const il=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.videoProducerFormattedStats=[],this.videoProducerScoreStats=null,this.networkBasedMediaHealth=null,this.devicesHealth=null,this.mediaScoreUpdateListener=e=>{let{kind:t,isScreenshare:i,scoreStats:r}=e;"video"!==t||i||(this.videoProducerScoreStats=r)},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getVideoDevices();this.devicesHealth=(null===e||void 0===e?void 0:e.length)>0?"Good":"Poor"},this.videoUpdateListener=()=>{this.meeting.self.videoEnabled||(this.videoProducerScoreStats=null)}}async videoProducerScoreStatsChanged(e){if(!e)return void(this.videoProducerFormattedStats=[]);const t=e,i=[];i.push({name:this.t("debugger.stats.cpu_limitations.label"),value:t.cpuLimitations?"Yes":"No",description:this.t("debugger.stats.cpu_limitations.description"),verdict:t.cpuLimitations?"Poor":"Good"}),i.push({name:this.t("debugger.stats.bandwidth_limitations.label"),value:t.bandwidthLimitations?"Yes":"No",description:this.t("debugger.stats.bandwidth_limitations.description"),verdict:t.bandwidthLimitations?"Poor":"Good"}),i.push({name:this.t("debugger.stats.bitrate.label"),value:"".concat(Math.round(t.bitrate/1024)," kbps"),description:this.t("debugger.stats.bitrate.description"),verdict:Wc({bitrate:t.bitrate})}),i.push({name:this.t("debugger.stats.packet_loss.label"),value:"".concat(t.packetsLostPercentage,"%"),description:this.t("debugger.stats.packet_loss.description"),verdict:$c({packetLossPercentage:t.packetsLostPercentage})}),i.push({name:this.t("debugger.stats.jitter.label"),value:"".concat(Math.round(1e3*t.jitter)," ms"),description:this.t("debugger.stats.jitter.description"),verdict:Gc({jitterInMS:1e3*t.jitter})}),this.videoProducerFormattedStats=i,this.networkBasedMediaHealth=Hc({stats:i})}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("videoUpdate",this.videoUpdateListener),this.meeting.self.off("deviceListUpdate",this.deviceListUpdateListener))}async meetingChanged(e){e&&(e.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),e.self.on("videoUpdate",this.videoUpdateListener),e.self.on("deviceListUpdate",this.deviceListUpdateListener),await this.deviceListUpdateListener())}render(){var e,t;if(this.meeting)return Z(J,null,Z("div",{id:"header"}),Z("div",{class:"tab-body"},Z("div",{class:"status-container"},Z("div",{class:"status-section"},Z("div",{class:"section-header ".concat(this.networkBasedMediaHealth?"":"only-child")},Z("span",null,this.t("debugger.video.sections.network_media")),this.networkBasedMediaHealth&&Z("span",{class:"status ".concat(null===(e=this.networkBasedMediaHealth)||void 0===e?void 0:e.toLowerCase())},this.t("debugger.quality.".concat(null===(t=this.networkBasedMediaHealth)||void 0===t?void 0:t.toLowerCase())))),this.isNetworkOpen&&!this.videoProducerFormattedStats.length&&Z("div",{class:"section-body missing-stats"},this.meeting.self.videoEnabled?Z("span",null,this.t("debugger.video.messages.generating_report")):Z("span",null,this.t("debugger.video.messages.enable_media"))),this.isNetworkOpen&&!!this.videoProducerFormattedStats.length&&Z("div",{class:"section-body network-table"},this.videoProducerFormattedStats.map(e=>{var t,i;return Z("div",{class:"network-row"},Z("div",{class:"network-cell label"},Z("strong",null,e.name),Z("span",{class:"description"},e.description)),Z("div",{class:"network-cell value"},Z("span",{class:"status ".concat(null===(t=e.verdict)||void 0===t?void 0:t.toLowerCase())},this.t("debugger.quality.".concat(null===(i=e.verdict)||void 0===i?void 0:i.toLowerCase()))),Z("span",{class:"value"},e.value)))}))))))}static get watchers(){return{videoProducerScoreStats:["videoProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};tl([On()],il.prototype,"meeting",void 0),tl([On()],il.prototype,"states",void 0),tl([On()],il.prototype,"iconPack",void 0),tl([On()],il.prototype,"t",void 0),il.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-video{display:flex;flex-direction:column}";var rl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const nl=class{constructor(e){f(this,e),this.onClose=re(this,"rtkDialogClose",7),this.hideCloseButton=!1,this.disableEscapeKey=!1,this.config=sn(),this.iconPack=pn,this.t=un(),this.open=!0,this.close=()=>{this.open=!1,this.onClose.emit()},this.keydownListener=e=>{!this.disableEscapeKey&&"Escape"===e.key&&this.open&&this.close()}}connectedCallback(){document.addEventListener("keydown",this.keydownListener)}disconnectedCallback(){document.removeEventListener("keydown",this.keydownListener)}componentDidRender(){this.open&&!this.dialogEl.open&&this.dialogEl.showModal()}render(){return this.open?Z(J,null,Z("dialog",{ref:e=>this.dialogEl=e,id:"dialog",part:"container",onClose:this.close,onClick:e=>{this.disableEscapeKey||e.target!==this.dialogEl||this.close()},onKeyDown:e=>{this.disableEscapeKey&&"Escape"===e.key&&e.preventDefault()}},Z("slot",null),!this.hideCloseButton&&Z("rtk-button",{part:"close-button",id:"dismiss-btn",kind:"icon",variant:"ghost",onClick:()=>this.close(),type:"button","aria-label":this.t("dialog.close"),role:"button"},Z("rtk-icon",{icon:this.iconPack.dismiss})))):null}};rl([On()],nl.prototype,"meeting",void 0),rl([On()],nl.prototype,"config",void 0),rl([On()],nl.prototype,"states",void 0),rl([On()],nl.prototype,"iconPack",void 0),rl([On()],nl.prototype,"t",void 0),nl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{word-wrap:break-word;overflow-wrap:break-word}#dialog{position:relative;max-height:100%;max-width:100%;padding:var(--rtk-space-0, 0px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#dialog::backdrop{background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / 0.5);-webkit-backdrop-filter:blur(12px) saturate(180%);backdrop-filter:blur(12px) saturate(180%)}#dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);z-index:50}::slotted(*){max-width:100%;height:auto;min-height:-moz-fit-content;min-height:fit-content}";var sl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const al=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.config=sn(),this.iconPack=pn,this.t=un(),this.updateStoreState=(e,t)=>{this.stateUpdate.emit({[e]:t})},this.cancelJoinStage=async()=>{var e,t,i;"ACCEPTED_TO_JOIN_STAGE"===(null===(e=this.meeting.stage)||void 0===e?void 0:e.status)&&await(null===(i=null===(t=this.meeting)||void 0===t?void 0:t.stage)||void 0===i?void 0:i.leave()),this.updateStoreState("activeJoinStage",!1)},this.joinStage=async()=>{await this.meeting.stage.join()},this.stageStatusUpdateListener=e=>{var t;(null===(t=this.states)||void 0===t?void 0:t.activeJoinStage)&&"ON_STAGE"===e&&this.updateStoreState("activeJoinStage",!1)}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;null===(e=this.meeting.stage)||void 0===e||e.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)}meetingChanged(e){if(!e)return;const{stage:t}=e;null===t||void 0===t||t.addListener("stageStatusUpdate",this.stageStatusUpdateListener)}render(){var e,t,i,r;if(!this.meeting)return;const n={meeting:this.meeting,states:this.states,config:this.config,size:this.size,iconPack:this.iconPack,t:this.t},s=this.states;if(null!=(null===s||void 0===s?void 0:s.image)){const e=s.image,t=()=>{this.stateUpdate.emit({image:null})};return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:t,hideCloseButton:!0,iconPack:this.iconPack,t:this.t},Z(ws,{element:"rtk-image-viewer",defaults:n,props:{image:e,onClose:t}})))}if(!0===(null===s||void 0===s?void 0:s.activeSettings))return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeSettings",!1),iconPack:this.iconPack,t:this.t},Z(ws,{element:"rtk-settings",defaults:n})));if(!0===(null===s||void 0===s?void 0:s.activeDebugger))return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeDebugger",!1),iconPack:this.iconPack,t:this.t},Z("rtk-debugger",Object.assign({},n))));if(!0===(null===s||void 0===s?void 0:s.activeLeaveConfirmation))return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeLeaveConfirmation",!1),iconPack:this.iconPack,t:this.t},Z("rtk-leave-meeting",Object.assign({},n))));if(!0===(null===(e=null===s||void 0===s?void 0:s.activePermissionsMessage)||void 0===e?void 0:e.enabled))return Z(J,null,Z("rtk-dialog",{open:!0,hideCloseButton:!0,iconPack:this.iconPack,t:this.t},Z("rtk-permissions-message",Object.assign({},n))));if(!0===(null===(t=null===s||void 0===s?void 0:s.activeBreakoutRoomsManager)||void 0===t?void 0:t.active))return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeBreakoutRoomsManager",{active:!1,data:void 0}),iconPack:this.iconPack,t:this.t},Z("rtk-breakout-rooms-manager",Object.assign({},n))));if(!0===(null===(i=null===s||void 0===s?void 0:s.activeConfirmationModal)||void 0===i?void 0:i.active))return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeConfirmationModal",!1),iconPack:this.iconPack,t:this.t},Z("rtk-confirmation-modal",Object.assign({},n))));if(!0===(null===(r=null===s||void 0===s?void 0:s.activeOverlayModal)||void 0===r?void 0:r.active))return Z(J,null,Z("rtk-overlay-modal",{meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t}));if(null===s||void 0===s?void 0:s.activeBroadcastMessageModal)return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeBroadcastMessageModal",!1),iconPack:this.iconPack,t:this.t},Z("rtk-broadcast-message-modal",Object.assign({},n))));if(!0===(null===s||void 0===s?void 0:s.activeJoinStage)){const e={title:this.t("stage.join_title"),label:{accept:this.t("stage.join_confirm"),reject:this.t("stage.join_cancel")},description:this.t("stage.join_summary")};return Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:this.cancelJoinStage,iconPack:this.iconPack,t:this.t},Z("rtk-join-stage",Object.assign({dataConfig:e,onRtkJoinStage:this.joinStage,onRtkLeaveStage:this.cancelJoinStage},n))))}return!0===(null===s||void 0===s?void 0:s.activeMuteAllConfirmation)?Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>{this.updateStoreState("activeMuteAllConfirmation",!1)},iconPack:this.iconPack,t:this.t},Z("rtk-mute-all-confirmation",Object.assign({},n)))):(null===s||void 0===s?void 0:s.activeChannelCreator)?Z(J,null,Z("rtk-dialog",{open:!0,onRtkDialogClose:()=>{this.updateStoreState("activeChannelCreator",!1)},iconPack:this.iconPack,t:this.t},Z("rtk-channel-creator",Object.assign({},n)))):null}static get watchers(){return{meeting:["meetingChanged"]}}};sl([On()],al.prototype,"meeting",void 0),sl([On()],al.prototype,"config",void 0),sl([On()],al.prototype,"states",void 0),sl([On()],al.prototype,"iconPack",void 0),sl([On()],al.prototype,"t",void 0),al.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var ol=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const cl=class{constructor(e){f(this,e),this.onDeleteAttachment=re(this,"deleteAttachment",7),this.iconPack=pn,this.t=un(),this.attachment=null,this.filePreview=null,this.fileReader=new FileReader,this.generatePreview=()=>{"image"===this.attachment.type?this.fileReader.readAsDataURL(this.attachment.file):"file"===this.attachment.type&&(this.filePreview=this.attachment.file.name)},this.onDeleteClickHandler=()=>{this.filePreview=null,this.onDeleteAttachment.emit()}}onAttachmentChange(){this.generatePreview()}connectedCallback(){this.fileReader.onload=e=>{"string"===typeof e.target.result&&(this.filePreview=e.target.result)}}componentWillLoad(){this.onAttachmentChange()}render(){return Z(J,{key:"22c8ff3317b6247dc6a0fa2088f28dc293de9738"},Z("div",{key:"317c0e6a06849af0af42d81353dc0002b82185a5",class:"preview-overlay"},Z("div",{key:"94d0d35a3696725b59341303760212cf6e01c8a7",class:"preview"},Z("rtk-tooltip",{key:"3171acf60f22a80cbcbf9d3d6f8cf5ac61b67b67",label:this.t("chat.cancel_upload")},Z("rtk-button",{key:"37d1055de9d59318c0f7f612dee3304838142968",variant:"secondary",kind:"icon",onClick:this.onDeleteClickHandler},Z("rtk-icon",{key:"9988b389300e0c6bd404d02440d7b3d323f384dd",icon:this.iconPack.dismiss}))),"image"===this.attachment.type?Z("img",{class:"preview-image",src:this.filePreview}):Z("div",{class:"preview-file"},Z("span",null,this.filePreview)))))}static get watchers(){return{attachment:["onAttachmentChange"]}}};ol([On()],cl.prototype,"iconPack",void 0),ol([On()],cl.prototype,"t",void 0),cl.style=":host{display:flex;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px)}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);background-color:inherit}.preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.preview:hover rtk-tooltip{display:block}.preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}";let ll;var dl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const hl=class{constructor(e){f(this,e),this.pickerClose=re(this,"pickerClose",7),this.emojiClicked=re(this,"rtkEmojiClicked",7),this.iconPack=pn,this.t=un(),this.focusWhenOpened=!0,this.filterVal="",this.filteredEmojis=[]}componentWillLoad(){(async()=>{if(!ll){const e=await fetch("https://rtk-assets.realtime.cloudflare.com/assets/emojis-data.json");ll=e.json()}return ll})().then(e=>{this.emojiList=e,this.handleInputChange(this.inputElement)})}componentDidLoad(){this.focusWhenOpened&&this.inputElement.focus()}handleInputChange(e){this.filterVal=e.value;const t=new RegExp("([^,]*?".concat(this.filterVal,"[^,]*):(\\d+)"),"g");this.filteredEmojis=Array.from(this.emojiList.search.matchAll(t)).map(e=>({name:e[1],emoji:this.emojiList.emojis[e[2]]}))}handleEmojiClick(e){this.emojiClicked.emit(e)}mapEmojiList(){var e;return(null===(e=this.emojiList)||void 0===e?void 0:e.length)>0?Z("div",{id:"loader"},Z("rtk-spinner",{iconPack:this.iconPack})):Z("div",{id:"emoji-grid",class:"scrollbar max-w-40"},this.filteredEmojis.map(e=>Z("rtk-button",{key:"emoji-button-".concat(e.name),class:"emoji",variant:"ghost",kind:"icon",title:e.name,onClick:()=>this.handleEmojiClick(e.emoji)},e.emoji)))}render(){return Z(J,{key:"48f4159ff5232b9d03fdcabf2d39e4375ca4fa14"},Z("div",{key:"20f86592a9dc47231c0c6cf33484af981533e21d",class:"close-parent"},Z("rtk-button",{key:"cff61f9c8fa0c1e0a8b6dc9433abedf914f9ded0",variant:"ghost",kind:"icon",class:"close",onClick:()=>{var e;return null===(e=this.pickerClose)||void 0===e?void 0:e.emit()},"aria-label":this.t("close")},Z("rtk-icon",{key:"56a12d4cc55b80ea026c92906466ebb10bf6cd6e",icon:this.iconPack.dismiss}))),Z("div",{key:"b48a1933b33f9886f39955ecbd046ffff370719b",class:"emoji-parent"},Z("input",{key:"40d0f74a160358c3214b810de0f2ee6f286f1af7",value:this.filterVal,onInput:e=>this.handleInputChange(e.target),placeholder:this.t("search"),ref:e=>this.inputElement=e}),this.mapEmojiList()))}};dl([On()],hl.prototype,"iconPack",void 0),dl([On()],hl.prototype,"t",void 0),hl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:100%}.emoji-parent{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-64, 256px);width:100%;max-width:640px;flex-direction:column;padding:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-0, 0px);-webkit-user-select:none;-moz-user-select:none;user-select:none;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.close-parent{display:flex;flex:1 1 0%;justify-content:flex-end;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#emoji-grid{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start;overflow-x:hidden;overflow-y:scroll;height:100%;grid-auto-rows:minmax(min-content, max-content)}#loader{display:flex;height:100%;width:100%;align-items:center;justify-content:center}input{display:block;height:var(--rtk-space-8, 32px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;border-width:var(--rtk-border-width-none, 0);border-style:solid;border-style:none;border-color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input::placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input{border-radius:var(--rtk-border-radius-sm, 4px);outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-ring-opacity));--tw-ring-opacity:0.3}.emoji{height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);font-size:20px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}";var ul=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const pl=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un()}render(){return Z("rtk-tooltip",{key:"9826128cb78d2cb79a21b4dcb877ecc1ab020090",label:this.t("chat.send_emoji")},Z("rtk-button",{key:"07fd6bcc6ffdb58278c843748f771a2597f8edcd",variant:"ghost",kind:"icon",class:{active:this.isActive},title:this.t("chat.send_emoji")},Z("rtk-icon",{key:"30f352d18771bd542d9ca4ff1a4615ef5958ec7d",icon:this.iconPack.emoji_multiple})))}};ul([On()],pl.prototype,"iconPack",void 0),ul([On()],pl.prototype,"t",void 0),pl.style=":host{}";var gl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const fl=class{constructor(e){f(this,e),this.now=new Date,this.isContinued=!1,this.iconPack=pn,this.t=un(),this.showBubble=!1}render(){const e=Rn(this.message.link);return Z(J,{key:"771fc8ccb2700a3fba83f04676a0c4396c1a8a41"},!this.isContinued&&Z(ms,{key:"ef2d83897dcae870bb7a2b0eeef397585b873b77",name:this.message.displayName,time:this.message.time,now:this.now}),Z("div",{key:"841039fcad32f254653bd490a98f268479345b44",class:{body:!0,bubble:this.showBubble},part:"body"},Z("div",{key:"65e3c8aafa4e9fa55a24264685bb0cf20841048a",class:"file"},Z("div",{key:"1b1e97b1518c5471964ea91889f4500fc0e01e03",class:"file-data"},Z("div",{key:"ff9d3071b528162f6e796ccb49e2472df2e8d364",class:"name"},this.message.name),Z("div",{key:"1d3ccb1f5bc2a94983de216e77a8ebc0ae07d669",class:"file-data-split"},Z("div",{key:"ebab32b642e097b3c1c1903269a8d76fbd586f5c",class:"ext"},Ss(this.message.name)),Z("span",{key:"81ee3600ba18a7689706504befebcf02697a56e7",class:"divider"}),Z("div",{key:"e969a8d6221d8af560a26510c38a92406a18ef2a",class:"size"},xs(this.message.size)))),Z("rtk-button",{key:"482c27659f71cfebf9f88fdf538e32baa6b87073",variant:"secondary",kind:"icon",onClick:()=>Es(e,{name:this.message.name,fallbackName:"file"}),part:"button"},Z("rtk-icon",{key:"4efaeb927b4ea2010eed09227eb7f511b9253017",icon:this.iconPack.download})))))}};gl([On()],fl.prototype,"iconPack",void 0),gl([On()],fl.prototype,"t",void 0);const ml=class{constructor(e){f(this,e),this.iconPack=pn}render(){return Z("div",{key:"d2cbeddc138f81c05da1656ee7f59c170e83bd1e",class:"file"},Z("rtk-button",{key:"b0ee90c3493c24e938b6ea88a317c642e4afc003",variant:"secondary",kind:"icon",onClick:()=>Es(Rn(this.url),{name:this.name,fallbackName:"file"}),part:"button"},Z("rtk-icon",{key:"c1b25c655b5c87bf95948abfa461f8b58ff79195",icon:this.iconPack.download})),Z("div",{key:"c961a8ce93d4ff4405590787a88b5a9bbdbf56ab",class:"file-data"},Z("div",{key:"bd178354d166c7816d6fabb72f7bba70fd711415",class:"name"},this.name),Z("div",{key:"59a791ae9f94a13b4005a0d8f79d09687fe3fc4c",class:"file-data-split"},Z("div",{key:"b31421fdf786d92eed0decec9d3b247530413aa9",class:"ext"},Ss(this.name)),Z("span",{key:"7a0a2a188b3e0b6bee0cf54d3afe29c2454788bb",class:"divider"}),Z("div",{key:"b217b87fa0737732aae10662b82d337d7258e6d7",class:"size"},xs(this.size)))))}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],ml.prototype,"iconPack",void 0),ml.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{margin-left:var(--rtk-space-1, 4px);flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}";var vl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const bl=class{constructor(e){f(this,e),this.onFileChange=re(this,"fileChange",7),this.icon="attach",this.iconPack=pn,this.t=un(),this.uploadFile=()=>{const e=this.fileInputField;e.type="file",this.filter&&(e.accept=this.filter),e.onchange=e=>{const{validity:t,files:[i]}=e.target;t.valid&&this.onFileChange.emit(i)},e.click()}}connectedCallback(){this.fileInputField=document.createElement("input")}disconnectedCallback(){this.fileInputField=void 0}render(){const e=this.label||this.t("chat.send_file"),t=this.iconPack[this.icon];return Z("rtk-tooltip",{key:"90e405f39792f7ea0430c55e9b5ba0da72ce2a4a",label:e},Z("rtk-button",{key:"f0957e7a9668afd9e25e866ea2acbb6891123bbe",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile(),title:e},Z("rtk-icon",{key:"1955f524343683974831b28629291428637aa8fc",icon:t})))}};vl([On()],bl.prototype,"iconPack",void 0),vl([On()],bl.prototype,"t",void 0),bl.style=":host{}";const kl=e=>{try{return JSON.parse(e)}catch(t){return e}},yl=class{constructor(e){f(this,e),this.variant="primary",this.size="lg"}render(){return Z(J,{key:"fbacb1ee3dd4c1ca7aa612f08e938601df73036c"},Z("div",{key:"04c026967cb7aa3acb3fba09fcf5b0d33f45e2b0",class:"icon-wrapper",innerHTML:kl(this.icon),part:"wrapper"}))}};yl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:var(--rtk-space-10, 40px);outline:2px solid transparent;outline-offset:2px}:host .icon-wrapper{display:flex;height:100%;width:100%;flex-direction:column;align-items:center}:host svg{height:100%;width:100%;outline:2px solid transparent;outline-offset:2px}:host([size='xl']){box-sizing:border-box;display:block;height:var(--rtk-space-16, 64px) !important;width:var(--rtk-space-16, 64px) !important;--rtk-spinner-color:currentColor}:host([size='md']){box-sizing:border-box;display:block;height:var(--rtk-space-6, 24px) !important;width:var(--rtk-space-6, 24px) !important;--rtk-spinner-color:currentColor}:host([size='sm']){box-sizing:border-box;display:block;height:var(--rtk-space-4, 16px) !important;width:var(--rtk-space-4, 16px) !important;--rtk-spinner-color:currentColor}:host([variant='secondary']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-text-opacity))}:host([variant='danger']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var wl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Sl=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.now=new Date,this.isContinued=!1,this.iconPack=pn,this.t=un(),this.showBubble=!1,this.status="loading"}render(){return Z(J,{key:"7e0fc95aff5f4db94f4ec0ba3c4dcd4d2ee9ffa6"},!this.isContinued&&Z(ms,{key:"cc7f214502f49fe2869f3e9bdfd797926987ef74",name:this.message.displayName,time:this.message.time,now:this.now}),Z("div",{key:"2e61a7320c1941df7c0d13082a9257e47ec5df58",class:{body:!0,bubble:this.showBubble},part:"body"},Z("div",{key:"bf2eec18c82aae79f31c40d44711ec7db2ab5bf1",class:{image:!0,loaded:"loaded"===this.status}},Z("img",{key:"acb8f5ef169bd0c663dbc74c1d43b4186f81004a",src:Rn(this.message.link),onLoad:()=>{this.status="loaded"},onError:()=>{this.status="errored"},onClick:()=>{"loaded"===this.status&&this.stateUpdate.emit({image:this.message})}}),"loading"===this.status&&Z("div",{key:"92a6610a937088e03200f9048146da0e4f749054",class:"image-spinner",title:this.t("chat.img.loading"),"aria-label":this.t("chat.img.loading")},Z("rtk-spinner",{key:"b85fa3e9dd0580f1d7e18360e74670a933e74367",iconPack:this.iconPack})),"errored"===this.status&&Z("div",{key:"b1046aff30dfe244498c957799f33c3a7c26ecb8",class:"image-errored",title:this.t("chat.error.img_not_found"),"aria-label":this.t("chat.error.img_not_found")},Z("rtk-icon",{key:"833e3ea7f7734a17450c98077e52b9db4fb5404a",icon:this.iconPack.image_off})),"loaded"===this.status&&Z("div",{key:"2545e3685f6e586b4fdc1304da08bbece5ec2cda",class:"actions"},Z("rtk-button",{key:"bb5e37862d82702f6350f48c275100825dd494fa",class:"action",variant:"secondary",kind:"icon",onClick:()=>{this.stateUpdate.emit({image:this.message})}},Z("rtk-icon",{key:"247f754dfe4c9b63634906105a71bb2146154eaa",icon:this.iconPack.full_screen_maximize})),Z("rtk-button",{key:"ab2712266ddce6f79abf1fca68379abcb4a3c9a1",class:"action",variant:"secondary",kind:"icon",onClick:()=>Es(this.message.link,{fallbackName:"image"})},Z("rtk-icon",{key:"ffafa0e22d7752b125d0e1e50cfc03d858d29365",icon:this.iconPack.download}))))))}};wl([On()],Sl.prototype,"iconPack",void 0),wl([On()],Sl.prototype,"t",void 0),Sl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}";var xl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const El=class{constructor(e){f(this,e),this.onPreview=re(this,"preview",7),this.iconPack=pn,this.t=un(),this.status="loading"}render(){return Z("div",{key:"259bdc1102c6026dd10388ae759f67608c777b5f",class:{image:!0,loaded:"loaded"===this.status}},Z("img",{key:"dbcb8d497fee3710f4474ec3ac0ce9a9b4f1bb49",src:Rn(this.url),onLoad:()=>{this.status="loaded"},onError:()=>{this.status="errored"},onClick:()=>{"loaded"===this.status&&this.onPreview.emit(this.url)}}),"loading"===this.status&&Z("div",{key:"b0ecfada4428e1cb8c3625cc4ce3d2a5bae058ab",class:"image-spinner",title:this.t("chat.img.loading"),"aria-label":this.t("chat.img.loading")},Z("rtk-spinner",{key:"fff61c6522d8bcb7de1345bb6505721ee6c6325e",iconPack:this.iconPack})),"errored"===this.status&&Z("div",{key:"c07e2cf6e9a94d375802c974e519d859ab48aa9b",class:"image-errored",title:this.t("chat.error.img_not_found"),"aria-label":this.t("chat.error.img_not_found")},Z("rtk-icon",{key:"83108f4f0396d77778463601a4f18d8593b0ffe7",icon:this.iconPack.image_off})),"loaded"===this.status&&Z("div",{key:"96b5aafbd94eec920ae1cad14f09ab4a44571bd7",class:"actions"},Z("rtk-button",{key:"a87ec11cc8de472aeb356689b49b6b366bd67f28",class:"action",variant:"secondary",kind:"icon",onClick:()=>{this.onPreview.emit(this.url)}},Z("rtk-icon",{key:"543478c786b709ac477d4482874608c0b394b27c",icon:this.iconPack.full_screen_maximize})),Z("rtk-button",{key:"6ce6d94a965688c7ec6ee64f79a4d13dda9651e3",class:"action",variant:"secondary",kind:"icon",onClick:()=>Es(this.url,{fallbackName:"image"})},Z("rtk-icon",{key:"3b1d67fbdd667e0d006e342c37f6e78c90fd2e34",icon:this.iconPack.download}))))}};xl([On()],El.prototype,"iconPack",void 0),xl([On()],El.prototype,"t",void 0),El.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}.image{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}";var Tl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const _l=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.joinStage=re(this,"rtkJoinStage",7),this.leaveStage=re(this,"rtkLeaveStage",7),this.config=sn(),this.iconPack=pn,this.t=un(),this.dataConfig={title:this.t("stage.join_title"),label:{accept:this.t("stage.join_confirm"),reject:this.t("stage.join_cancel")},description:this.t("stage.join_summary")},this.isLoading=!1}render(){var e,t;const i={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return Z(J,{key:"b69a0a77d20a65a3112a393f33e4bc71564b16e1",class:{stage:!0}},Z("header",{key:"c9860a7bd9139b4ddb188f03f4efadcecf2d4259"},Z("h2",{key:"3222f6b149c9584205f355daecb4ebc7a2c329e3"},this.dataConfig.title)),Z(ws,{key:"ae93b03e1ffeef036560de82bd1cfd678be9895a",element:"rtk-participant-setup",defaults:i,props:{participant:null===(e=this.meeting)||void 0===e?void 0:e.self,size:"md"},childProps:{participant:null===(t=this.meeting)||void 0===t?void 0:t.self,size:"md"},deepProps:!0}),Z("div",{key:"b579bcd55ac13475d46a9b363e50a293b3f8ab87",class:"summary"},this.dataConfig.description),Z("div",{key:"b7002bbcf12848243621dbd4e0e62d73ed5c7043",class:"container"},Z("rtk-button",{key:"240d7e4f50f89e6859be85917a325075d5d98628",variant:"secondary",onClick:()=>this.leaveStage.emit(),title:this.dataConfig.label.reject},this.dataConfig.label.reject),Z("rtk-button",{key:"c510ea579e35bf1302b6364065a2bb4eac43bec0",onClick:()=>{this.isLoading||(this.isLoading=!0,this.joinStage.emit())},title:this.dataConfig.label.accept},this.isLoading?Z("rtk-icon",{icon:this.iconPack.spinner}):this.dataConfig.label.accept)))}};Tl([On()],_l.prototype,"meeting",void 0),Tl([On()],_l.prototype,"config",void 0),Tl([On()],_l.prototype,"states",void 0),Tl([On()],_l.prototype,"iconPack",void 0),Tl([On()],_l.prototype,"t",void 0),_l.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}:host::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host(.stage){box-sizing:border-box;display:block;width:512px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-6, 24px);-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:auto;border-radius:var(--rtk-border-radius-md, 8px);line-height:1.25}:host(.stage) rtk-participant-setup{display:flex;flex:1 1 0%;align-items:center;justify-content:space-around;margin-left:auto;margin-right:auto}:host(.stage) .container rtk-button{flex-grow:1;padding:var(--rtk-space-1, 4px);width:50%}:host(.stage) .container rtk-button:nth-child(1){margin-right:var(--rtk-space-1\\.5, 6px)}:host(.stage) .container rtk-button:nth-child(2){margin-left:var(--rtk-space-1\\.5, 6px)}:host(.stage) h2{font-size:24px;font-weight:500;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(.stage) header{padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host(.stage) .summary{padding:var(--rtk-space-4, 16px)}.deny-access{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.container{width:100%;max-width:1080px;display:flex;flex:1 1 0%;align-items:center;justify-content:space-around}header{display:flex;align-items:center;justify-content:space-between}";var Pl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Cl=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.keyPressListener=e=>{"Escape"===e.key&&this.close()},this.iconPack=pn,this.t=un(),this.canEndMeeting=!1,this.isBreakoutRoomsActive=!1,this.isChildMeeting=!1,this.canJoinMainRoom=!1,this.permissionsUpdateListener=()=>{this.canEndMeeting=this.meeting.self.permissions.kickParticipant,this.canJoinMainRoom=this.meeting.self.permissions.connectedMeetings.canSwitchToParentMeeting},this.close=()=>{this.stateUpdate.emit({activeLeaveConfirmation:!1})},this.handleLeave=()=>{var e;null===(e=this.meeting)||void 0===e||e.leaveRoom(),this.close()},this.handleJoinMainRoom=()=>{this.meeting.connectedMeetings.moveParticipants(this.meeting.meta.meetingId,this.meeting.connectedMeetings.parentMeeting.id,[this.meeting.self.userId]),this.close()},this.handleEndMeeting=()=>{var e;null===(e=this.meeting)||void 0===e||e.participants.kickAll(),this.close()}}connectedCallback(){this.meetingChanged(this.meeting),document.addEventListener("keydown",this.keyPressListener)}disconnectedCallback(){var e;document.removeEventListener("keydown",this.keyPressListener),null===(e=this.meeting)||void 0===e||e.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(e){null!=e&&(this.isBreakoutRoomsActive=this.meeting.connectedMeetings.supportsConnectedMeetings&&this.meeting.connectedMeetings.isActive,this.isChildMeeting=this.meeting.connectedMeetings.supportsConnectedMeetings&&this.meeting.connectedMeetings.meetings.some(t=>t.id===e.meta.meetingId),this.meeting.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener),this.permissionsUpdateListener())}render(){return Z(J,{key:"3a498cd6ba7efe8697a29b25cb91bba8bf4f8385"},Z("div",{key:"8094c0d9b4ade3f1a511796556b9bea6163f4081",class:"leave-modal"},Z("div",{key:"2ccb549f2ce35c8f54d806f7d6aa8e74bbc7bab2",class:"header"},Z("h2",{key:"cf9281517dfad495e37f86b51a5cef6e471a1e62",class:"title"},this.t("leave"))),Z("p",{key:"c2c0f7a042c377ce26e1045c6462c0a526d00041",class:"message"},this.isBreakoutRoomsActive&&this.isChildMeeting?this.t("breakout_rooms.leave_confirmation"):this.t("leave_confirmation")),Z("div",{key:"d2e9264448b26532318022ec7991fc77a17f15e1",class:"content"},Z("rtk-button",{key:"7792537400624c5f8028f5a6e167af8cc6c19317",variant:"secondary",onClick:this.close,class:"secondary-btn"},this.t("cancel")),this.isBreakoutRoomsActive&&this.isChildMeeting&&this.canJoinMainRoom&&Z("rtk-button",{key:"e37a7a97fa85d120385f64831efebc02c9b4b036",variant:"secondary",onClick:this.handleJoinMainRoom,class:"secondary-btn"},this.t("breakout_rooms.leave_confirmation.main_room_btn")),Z("rtk-button",{key:"b6ae60a2e64af83b118c077c4eac6c5d7ee6f6f8",variant:"danger",title:this.t("leave"),onClick:this.handleLeave},this.t("leave")),this.canEndMeeting&&Z("rtk-button",{key:"05f27640ced0043aeb733df84f51a6ee637d3396",variant:"danger",class:"secondary-btn secondary-danger-btn",onClick:this.handleEndMeeting},this.t("end.all")))))}static get watchers(){return{meeting:["meetingChanged"]}}};Pl([On()],Cl.prototype,"meeting",void 0),Pl([On()],Cl.prototype,"states",void 0),Pl([On()],Cl.prototype,"iconPack",void 0),Pl([On()],Cl.prototype,"t",void 0),Cl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.leave-modal{width:var(--rtk-space-72, 288px)}@media (min-width: 768px){.leave-modal{width:var(--rtk-space-96, 384px)}}.leave-modal{position:relative;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding:var(--rtk-space-8, 32px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}.leave-modal .message{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.leave-modal .content{margin-top:var(--rtk-space-4, 16px);font-size:14px;display:flex;flex-wrap:wrap;gap:var(--rtk-space-4, 16px)}.leave-modal .content rtk-button{height:var(--rtk-space-9, 36px);min-width:var(--rtk-space-44, 176px);flex-grow:1}.leave-modal .content .secondary-btn{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.leave-modal .content .secondary-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.leave-modal .content .secondary-danger-btn{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var Al=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Rl=class{constructor(e){f(this,e),this.config=sn(),this.t=un()}connectedCallback(){this.configChanged(this.config),this.meetingChanged(this.meeting)}configChanged(e){var t;if(null!=e){const i=null===(t=null===e||void 0===e?void 0:e.designTokens)||void 0===t?void 0:t.logo;null!=i&&null==this.logoUrl&&(this.logoUrl=i)}}meetingChanged(e){var t,i,r,n;if(null!=e){const s=null===(n=null===(r=null===(i=null===(t=e.self)||void 0===t?void 0:t.config)||void 0===i?void 0:i.header)||void 0===r?void 0:r.elements)||void 0===n?void 0:n.logo;null!=s&&null==this.logoUrl&&(this.logoUrl=s)}}render(){if(!this.logoUrl||""===this.logoUrl)return null;const e=this.logoUrl,t=this.t("logo");return Z(J,{class:"loaded"},Z("img",{src:e,alt:t}))}static get watchers(){return{config:["configChanged"],meeting:["meetingChanged"]}}};Al([On()],Rl.prototype,"config",void 0),Al([On()],Rl.prototype,"meeting",void 0),Al([On()],Rl.prototype,"t",void 0),Rl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--rtk-colors-text-1000, 255 255 255));height:100%;width:auto}svg,img{height:100%;width:auto}.brand-color{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";const Ll=class{constructor(e){f(this,e),this.maxLength=ls,this.restoreEmpty=(e,t,i)=>0===e.trim().length?"".concat(t).concat(e).concat(t):i(e),this.renderLink=e=>Z("a",{class:"link",href:e,target:"_blank",rel:"noopener noreferrer"},e),this.renderBold=e=>"string"===typeof e?this.restoreEmpty(e,"*",e=>Z("b",null,e)):Z("b",null,this.renderTokens(e)),this.renderItalic=e=>"string"===typeof e?this.restoreEmpty(e,"_",e=>Z("i",null,e)):Z("i",null,this.renderTokens(e)),this.renderStrikethrough=e=>"string"===typeof e?this.restoreEmpty(e,"~",e=>Z("s",null,e)):Z("b",null,this.renderTokens(e)),this.renderPlainText=e=>"string"===typeof e?e:Z("p",null,this.renderTokens(e)),this.renderTokens=e=>e.map(e=>{switch(e.type){case"a":if("string"===typeof e.content)return this.renderLink(e.content);case"b":return this.renderBold(e.content);case"i":return this.renderItalic(e.content);case"s":return this.renderStrikethrough(e.content);case"q":return Z("span",{class:"block-quote"});default:return this.renderPlainText(e.content)}})}renderMessage(e){let t=e.split("\n"),i=!1;"```"===t[0]&&"```"===t[t.length-1]&&(i=!0,t=t.slice(1,-1));const r=t.map(e=>{const t=hs(e);return Z("p",null,this.renderTokens(t))});return i?Z("pre",{style:{whiteSpace:"pre",overflow:"scroll"}},t.join("\n")):r}render(){const e=this.text.slice(0,this.maxLength),t=os(e,!0),i=cs(e);return Z("p",{key:"9544292f118f2c6975a807d6bcc2d307c70b2940"},0!==t.length&&Z("blockquote",{key:"294bca9889738148fd51ecd8487d2d98b5adee4b"},this.renderMessage(t)),0!==i.length&&this.renderMessage(i))}};Ll.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{overflow-wrap:break-word}a{color:currentColor}.block-quote,blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}pre{white-space:pre-wrap}";const Il=768,Ml=1080,Dl=class{constructor(e){f(this,e),this.statesUpdate=re(this,"rtkStatesUpdate",7),this.providerId="provider-"+Math.floor(100*Math.random()),this.roomJoinedListener=()=>{this.updateStates({meeting:"joined"})},this.waitlistedListener=()=>{this.updateStates({meeting:"waiting"})},this.roomLeftListener=e=>{let{state:t}=e;"disconnected"!==t&&"failed"!==t&&this.updateStates({meeting:"ended",roomLeftState:t})},this.mediaPermissionUpdateListener=e=>{let{kind:t,message:i}=e;if(["audio","video"].includes(t)&&("DENIED"===i||"SYSTEM_DENIED"===i)&&!0!==(this.peerStore||xn).state.states.activeDebugger){const e={enabled:!0,kind:t};this.updateStates({activePermissionsMessage:e})}},this.socketConnectionUpdateListener=e=>{let{state:t}=e;"failed"===t&&setTimeout(()=>{this.meeting.leave("disconnected")},this.leaveRoomTimer)},this.peerStore=null,this.loadConfigFromPreset=!1,this.applyDesignSystem=!1,this.mode="fixed",this.leaveOnUnmount=!1,this.t=un(),this.config=sn(),this.gridLayout="row",this.iconPack=pn,this.handleChangingMeeting=e=>{const t=(this.peerStore||xn).state.states;this.updateStates({activeBreakoutRoomsManager:Object.assign(Object.assign({},t.activeBreakoutRoomsManager),{destinationMeetingId:e})})}}connectedCallback(){var e;"undefined"!==typeof window&&(this.authErrorListener=e=>{e.detail.message.includes("401")&&this.updateStates({meeting:"ended",roomLeftState:"unauthorized"})},window.addEventListener("rtkError",this.authErrorListener)),this.leaveRoomTimer=1e4,this.loadConfigFromPreset=!0,this.applyDesignSystem=!0,this.setupStoreRequestListener(),this.setupStateUpdateListener(),this.meetingChanged(this.meeting),this.iconPackChanged(this.iconPack),this.tChanged(this.t),this.configChanged(this.config),this.resizeObserver=new _a(()=>this.handleResize()),this.resizeObserver.observe(this.host),this.applyDesignSystem&&null!=(null===(e=this.config)||void 0===e?void 0:e.designTokens)&&"undefined"!==typeof document&&!0!==(this.peerStore||xn).state.states.activeDebugger&&Ds(document.documentElement,this.config.designTokens)}disconnectedCallback(){var e;this.leaveOnUnmount&&(null===(e=this.meeting)||void 0===e||e.leaveRoom()),this.resizeObserver.disconnect(),window.removeEventListener("rtkError",this.authErrorListener),this.storeRequestListener&&(this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=null),this.stateUpdateListener&&(this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=null),this.meeting&&this.clearListeners(this.meeting)}setupStoreRequestListener(){this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=e=>{if(!this.peerStore)return;const t=this.peerStore,i=new CustomEvent("rtkProvideStore",{detail:{store:t,requestId:e.detail.requestId}});document.dispatchEvent(i),e.stopPropagation()},this.host.addEventListener("rtkRequestStore",this.storeRequestListener)}setupStateUpdateListener(){this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=e=>{const t=e.target;this.host.contains(t)&&this.updateStates(e.detail)},this.host.addEventListener("rtkStateUpdate",this.stateUpdateListener)}clearListeners(e){e&&(e.self.removeListener("roomLeft",this.roomLeftListener),e.self.removeListener("roomJoined",this.roomJoinedListener),e.self.removeListener("waitlisted",this.waitlistedListener),e.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),e.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener))}meetingChanged(e){var t,i;if(e){if(e?(this.peerStore=Tn({meeting:e,config:this.config,iconPack:this.iconPack,t:this.t,providerId:this.providerId}),document.dispatchEvent(new CustomEvent("rtkPeerStoreReady",{detail:{peerId:e.self.id}}))):this.peerStore=null,this.updateStates({viewType:e.meta.viewType}),this.loadConfigFromPreset&&null!=e.self.config){const i=e.self.config,{config:r,data:n}=ia(i,e);this.config=r,null==this.showSetupScreen&&(this.showSetupScreen=n.showSetupScreen),e.connectedMeetings.supportsConnectedMeetings&&(null===(t=(this.peerStore||xn).state.states.activeBreakoutRoomsManager)||void 0===t?void 0:t.destinationMeetingId)&&(this.showSetupScreen=!1)}this.applyDesignSystem&&null!=(null===(i=this.config)||void 0===i?void 0:i.designTokens)&&"undefined"!==typeof document&&!0!==(this.peerStore||xn).state.states.activeDebugger&&Ds(document.documentElement,this.config.designTokens),e.self.addListener("roomJoined",this.roomJoinedListener),e.self.addListener("waitlisted",this.waitlistedListener),e.self.addListener("roomLeft",this.roomLeftListener),e.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),e.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),e.connectedMeetings.supportsConnectedMeetings&&e.connectedMeetings.once("changingMeeting",this.handleChangingMeeting),e.self.roomJoined?this.updateStates({meeting:"joined"}):this.showSetupScreen?this.updateStates({meeting:"setup"}):e.joinRoom(),window.removeEventListener("rtkError",this.authErrorListener)}}iconPackChanged(e){this.peerStore&&(this.peerStore.state.iconPack=e)}tChanged(e){this.peerStore&&(this.peerStore.state.t=e)}configChanged(e){this.peerStore&&(this.peerStore.state.config=e),(null===e||void 0===e?void 0:e.designTokens)&&"undefined"!==typeof document&&!0!==(this.peerStore||xn).state.states.activeDebugger&&Ds(document.documentElement,e.designTokens)}handleResize(){var e;this.size=(e=this.host.clientWidth)>=Ml?"lg":e>=Il?"md":"sm"}updateStates(e){const t=this.peerStore||xn,i=Object.assign({},t.state.states);t.state.states=ta(i,e),this.statesUpdate.emit(t.state.states);const r=new CustomEvent("rtkStatesUpdate",{detail:t.state.states,bubbles:!0,composed:!0});this.host.dispatchEvent(r)}render(){const e={meeting:this.meeting,size:this.size,states:(this.peerStore||xn).state.states,config:this.config||sn(),iconPack:this.iconPack,t:this.t};if("CHAT"===(this.peerStore||xn).state.states.viewType)return Z("rtk-chat",Object.assign({},e));const t={"rtk-grid":{layout:this.gridLayout}};return Z(ws,{element:"rtk-meeting",defaults:e,asHost:!0,elementProps:t})}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],iconPack:["iconPackChanged"],t:["tChanged"],config:["configChanged"]}}};Dl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}";var Ol=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Nl=class{constructor(e){f(this,e),this.clickedThis=!1,this.placement="bottom-end",this.offset=10,this.iconPack=pn,this.t=un(),this.handleOutsideClick=()=>{this.clickedThis||(this.menuListEl.style.display="none"),this.clickedThis=!1}}componentDidLoad(){document.addEventListener("click",this.handleOutsideClick),this.update()}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}update(){ic(this.triggerEl,this.menuListEl,{placement:this.placement,middleware:[Yo(this.offset),Xo(),Qo({padding:5})]}).then(e=>{let{x:t,y:i}=e;Object.assign(this.menuListEl.style,{left:"".concat(t,"px"),top:"".concat(i,"px")})})}render(){return Z(J,{key:"a814ea3dde902a15cb6fb0db8a9c2409c240537f"},Z("span",{key:"de2447524c6a1787a6b9442ccb9c3d56a33e9f4f",id:"trigger",ref:e=>this.triggerEl=e,onClick:()=>{this.clickedThis=!0,"block"!==this.menuListEl.style.display?(this.menuListEl.style.display="block",this.update()):this.menuListEl.style.display="none"}},Z("slot",{key:"fb566f431ceca452fad8b564cfb777bc90411a02",name:"trigger"})),Z("span",{key:"50b030d301e54677d19cc21dadcec53f566b14cf",part:"menu-list",id:"menu-list",ref:e=>this.menuListEl=e},Z("slot",{key:"59ce6c30c39155fec448114fd25752585d95c87d"})))}};Ol([On()],Nl.prototype,"iconPack",void 0),Ol([On()],Nl.prototype,"t",void 0),Nl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20;display:none}";var Ul=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Fl=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un()}render(){return Z(J,{key:"f0316fee5ac5fd2124ee26ac2664172007ad1c54"},Z("slot",{key:"994a3a27f743462a3ae0a4c95bc5de672119fdb6",name:"start"}),Z("slot",{key:"24594ecaffb46a4b0458032596570fee37e6ae00"}),Z("slot",{key:"4ede22267a24a37c508591b0148a1e1b2c391fc9",name:"end"}))}};Ul([On()],Fl.prototype,"iconPack",void 0),Ul([On()],Fl.prototype,"t",void 0),Fl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px}::slotted([slot='start']){margin-right:var(--rtk-space-2, 8px)}::slotted([slot='end']){margin-left:var(--rtk-space-2, 8px)}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host(.red){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var jl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Bl=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un()}render(){return Z(J,{key:"c0974bc340294b197aa8310e5a9913126ac22c48"},Z("slot",{key:"1a660db36c713285203569957959663497803c5e"}))}};jl([On()],Bl.prototype,"iconPack",void 0),jl([On()],Bl.prototype,"t",void 0),Bl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:-moz-max-content;width:max-content;flex-direction:column;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";const Vl=class{constructor(e){f(this,e),this.onAction=re(this,"action",7),this.actions=[],this.variant="bubble",this.viewType="outgoing",this.hideAvatar=!1,this.hideAuthorName=!1,this.hideMetadata=!1,this.iconPack=pn}renderActions(){return Z("rtk-menu",{placement:"top-end",offset:1},Z("button",{slot:"trigger",class:"actions"},Z("rtk-icon",{icon:this.iconPack.chevron_down})),Z("rtk-menu-list",null,this.actions.map(e=>Z("rtk-menu-item",{onClick:()=>this.onAction.emit(e.id)},e.icon&&Z("rtk-icon",{icon:e.icon,slot:"start"}),e.label))))}render(){return Z(J,{key:"9fafe4370eee525631023ecde39b3293059e8c22"},Z("div",{key:"1718981905d4458d0862c34c3c342f7335f0921b",class:{"message-wrapper":!0,[this.viewType]:!0}},!this.hideAvatar&&Z("aside",{key:"c6ea0c46283a7faa4bb937cb4196e2e1d548c721",class:"avatar",part:"avatar"},Z("rtk-avatar",{key:"e3181a831b75b5c79f212da64076dbf6b47fecca",participant:{name:this.authorName,picture:this.avatarUrl},size:"sm"})),Z("div",{key:"5565b5711055f1cd543cfaa36c03789b82fb94fa",class:"message",part:"message"},!this.hideAuthorName&&Z("div",{key:"613098d825ba1c33aaca53579c883a306ed1239d",class:"header"},this.authorName),Z("div",{key:"166dd3e4fb33876cd74f94a7ac193064e8778f81",class:{body:!0,bubble:"bubble"===this.variant}},Z("slot",{key:"d04e722b66c4d7cb7c20952a9e7c70d048e66410"}),!this.hideMetadata&&!!this.time&&Z("div",{key:"f12d8c9dd8320202a6906c10298d3357aff5d762",class:"metadata",title:fs(this.time)},gs(this.time,new Date(Date.now()))),0!==this.actions.length&&this.renderActions()))))}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],Vl.prototype,"iconPack",void 0),Vl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{max-width:var(--rtk-space-96, 384px)}.message-wrapper{display:flex;flex-direction:row-reverse;gap:var(--rtk-space-2, 8px)}.message-wrapper.incoming{flex-direction:row}.message{display:flex;flex-direction:column}.header{margin-bottom:var(--rtk-space-1, 4px);align-self:flex-end;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:14px;font-weight:600}.incoming .header{align-self:flex-start}.body{display:flex;flex-direction:column;min-width:var(--rtk-space-24, 96px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:14px;line-height:1.375;position:relative}.body .metadata{margin-top:var(--rtk-space-2, 8px);align-self:flex-end;font-size:10px}.bubble{max-width:var(--rtk-space-96, 384px);padding:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:var(--rtk-border-radius-md, 8px)}.incoming .bubble{width:-moz-fit-content;width:fit-content;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.avatar{display:none}rtk-menu{position:absolute;right:var(--rtk-space-0, 0px);top:var(--rtk-space-0, 0px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}.actions{display:flex;align-items:center;justify-content:center;padding-left:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-brand-300, 73 124 253)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.incoming .actions{background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-background-800, 30 30 30)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.incoming .actions rtk-icon{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.incoming rtk-avatar{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}@media (min-width: 400px){.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px;overflow:clip;border-radius:9999px}}@media (hover: hover){rtk-menu{visibility:hidden}.body:hover rtk-menu{visibility:visible}}";var zl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Hl=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un(),this.allowUnmute=!0,this.onClose=()=>{this.stateUpdate.emit({activeMuteAllConfirmation:!1})},this.onMuteAll=()=>{var e;null===(e=this.meeting)||void 0===e||e.participants.disableAllAudio(this.allowUnmute),this.onClose()}}render(){return Z(J,{key:"6f260e3a10d229942b3903afc721d30b6e6494a7"},Z("div",{key:"9bdf56a9eee7b0a172f4b29b619632817ccc1212",class:"leave-modal"},Z("div",{key:"a68cd8b46f9727a2ced5e505651e65bf1a1fb1f2",class:"header"},Z("h2",{key:"202529f47bd59dd2df1a7971a33cc706070705d9",class:"title"},this.t("mute_all.header"))),Z("p",{key:"40569f7f09c9f370ccd117590113545a4a083e40",class:"message"},this.t("mute_all.description")),Z("div",{key:"f6a19e3fcdc7ca1c8e8d443cb705dcd27b55398e",class:"content"},Z("div",{key:"979e79f3f20c60b1e1474d7c37b96392809078f9",class:"leave-meeting"},Z("rtk-button",{key:"a717271acf30ebf16e22cfbc23b7e7120662754c",variant:"secondary",title:this.t("close"),onClick:this.onClose},this.t("cancel")),Z("rtk-button",{key:"6b425563d4f0c4db28e9201c87d0bd9aa71399a8",variant:"danger",title:this.t("mute_all"),onClick:this.onMuteAll},this.t("mute_all"))))))}};zl([On()],Hl.prototype,"meeting",void 0),zl([On()],Hl.prototype,"states",void 0),zl([On()],Hl.prototype,"iconPack",void 0),zl([On()],Hl.prototype,"t",void 0),Hl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;-webkit-user-select:none;-moz-user-select:none;user-select:none}.leave-modal{position:relative;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}.leave-modal .content{font-size:14px}.leave-message p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px)}.leave-meeting{display:flex;flex-direction:row;justify-content:space-between;gap:var(--rtk-space-2, 8px)}.leave-meeting rtk-button{flex:1 1 0%}.end-meeting{margin-top:var(--rtk-space-2, 8px)}.message{margin-bottom:var(--rtk-space-4, 16px)}label{display:flex;align-items:center}input[type='checkbox']{margin-right:var(--rtk-space-2, 8px);accent-color:rgb(var(--rtk-colors-brand-500, 33 96 253))}";var $l=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Gl=class{constructor(e){f(this,e),this.dismiss=re(this,"rtkNotificationDismiss",7),this.iconPack=pn,this.t=un(),this.imageState="loading"}connectedCallback(){this.notificationChanged(this.notification)}pausedChanged(e){e?clearTimeout(this.timeout):this.notificationChanged(this.notification)}notificationChanged(e){null==e||"number"!==typeof e.duration||this.paused||(this.timeout=window.setTimeout(()=>{this.dismiss.emit(e.id)},e.duration))}render(){var e;return Z(J,{key:"60c06bbf91a415227daa6df5e33ce70f70b9e96a"},Z("div",{key:"88b3028fbab2ae480d9b56169be54d7be88f283a",class:"ctr"},null!=this.notification.icon&&Z("rtk-icon",{key:"2082950cbd422100eaae181089b459a228edb5b2",class:"icon",icon:this.notification.icon,variant:null!==(e=this.notification.iconVariant)&&void 0!==e?e:"primary"}),null!=this.notification.image&&null==this.notification.icon&&"errored"!==this.imageState&&Z("img",{key:"56e7d906bb2daf5ddce6b143ffa74a47d602ca70",src:this.notification.image,class:{loaded:"loaded"===this.imageState},onLoad:()=>this.imageState="loaded",onError:()=>this.imageState="errored"}),Z("p",{key:"980db1c29942c51de04eef62c519ff20402c639e",class:"message"},Z(nc,{key:"6b59afd62dcf6671d056ed424146c9c4c1e1bead",message:this.notification.message})),Z("div",{key:"a4399741c18093e46be3726f3514d8e8a5682ab3",class:"right"},null!=this.notification.button&&Z("rtk-button",{key:"a20046c85de2c3ee5cd7b6814c84e52a027e0cfc",size:"sm",variant:this.notification.button.variant,onClick:()=>this.notification.button.onClick()},this.notification.button.text),Z("button",{key:"83d7d13c98c68f6049321d5d0c573ea2eccf65f8",onClick:()=>this.dismiss.emit(this.notification.id),class:"dismiss"},Z("rtk-icon",{key:"5a17a700a54172a10cd2398dd38853bd0c337215","aria-label":this.t("dismiss"),icon:this.iconPack.dismiss})))))}static get watchers(){return{paused:["pausedChanged"],notification:["notificationChanged"]}}};$l([On()],Gl.prototype,"iconPack",void 0),$l([On()],Gl.prototype,"t",void 0),Gl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;height:var(--rtk-space-10, 40px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));animation:show 0.4s ease;transition:0.4s;z-index:100}.ctr{box-sizing:border-box;display:inline-flex;height:100%;min-width:var(--rtk-space-40, 160px);align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-2, 8px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto}img{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);border-radius:9999px}img.loaded{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}.message{margin-right:var(--rtk-space-2, 8px);max-width:var(--rtk-space-72, 288px) !important;font-size:14px !important;overflow:hidden !important;display:-webkit-box !important;-webkit-box-orient:vertical !important;-webkit-line-clamp:2 !important}.message p{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-1, 4px)}.message blockquote{display:none}rtk-icon.icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}button.dismiss{display:flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);align-items:center;justify-content:center;border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-0, 0px);border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));outline-width:1px;outline-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}button.dismiss:hover{cursor:pointer;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}button.dismiss:focus-visible{outline-style:solid}button.dismiss{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.dismiss rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px)}.right{margin-left:auto;display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateX(-120px)}100%{opacity:1;transform:translateX(0px)}}@keyframes exit{0%{opacity:1;transform:translateX(0)}100%{opacity:0;transform:translateX(-120px)}}:host([size='sm']){font-size:14px}";const Wl=2e3,ql=Object.freeze({notifications:{participant_joined:!0,participant_left:!0,participant_joined_waitlist:!0,chat:!0,polls:!0,webinar:!0,tab_sync:!0,recording_started:!0,recording_stopped:!0},notification_sounds:{participant_joined:!0,participant_left:!0,chat:!0,polls:!0,webinar:!0,participant_joined_waitlist:!0},notification_duration:{participant_joined:2100,participant_left:2100,participant_joined_waitlist:4e3,chat:Wl,polls:Wl,webinar:Wl,tab_sync:Wl,recording_started:Wl,recording_stopped:Wl},participant_joined_sound_notification_limit:10,participant_chat_message_sound_notification_limit:10});var Kl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};function Zl(e){return Object.keys(e).filter(t=>e[t])}const Yl=class{constructor(e){f(this,e),this.permissions=ql,this.enabledSounds=Zl(ql.notification_sounds),this.config=sn(),this.t=un(),this.iconPack=pn,this.notifications=[],this.addStagePeersListeners=e=>{e.participants.joined.addListener("participantJoined",this.participantJoinedListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener)},this.removeStagePeersListeners=e=>{e.participants.joined.removeListener("participantJoined",this.participantJoinedListener),e.participants.joined.removeListener("participantLeft",this.participantLeftListener)},this.onNotification=e=>{this.add(e.detail);const t=e.detail.playSound;void 0!=t&&this.audio.play(t)},this.onRecordingUpdate=e=>{var t,i;"RECORDING"===e&&!1!==this.permissions.notifications.recording_started?this.add({id:"recording-started",icon:this.iconPack.recording,message:this.t("recording.started"),duration:null!==(t=this.permissions.notification_duration.recording_started)&&void 0!==t?t:Wl}):"STOPPING"===e&&!1!==this.permissions.notifications.recording_stopped&&this.add({id:"recording-stopped",icon:this.iconPack.stop_recording,message:this.t("recording.stopped"),duration:null!==(i=this.permissions.notification_duration.recording_stopped)&&void 0!==i?i:Wl})},this.paused=!1}connectedCallback(){"undefined"!==typeof document&&(null===document||void 0===document||document.addEventListener("rtkNotification",this.onNotification)),this.meetingChanged(this.meeting),this.configChanged(this.config),this.statesChanged(this.states)}clearListeners(e){var t,i,r,n,s,a,o,c;const l="LIVESTREAM"===e.meta.viewType;(l&&"ON_STAGE"===(null===(t=e.stage)||void 0===t?void 0:t.status)||!l)&&this.removeStagePeersListeners(e),this.chatUpdateListener&&(null===(i=e.chat)||void 0===i||i.removeListener("chatUpdate",this.chatUpdateListener)),this.pollUpdateListener&&(null===(r=e.polls)||void 0===r||r.removeListener("pollsUpdate",this.pollUpdateListener)),e.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener),this.stageRequestAccepted&&(null===(n=e.stage)||void 0===n||n.removeListener("stageRequestApproved",this.stageRequestAccepted)),this.stageRequestRejected&&(null===(s=e.stage)||void 0===s||s.removeListener("stageRequestRejected",this.stageRequestRejected)),this.newStageRequests&&(null===(a=e.stage)||void 0===a||a.removeListener("newStageRequest",this.newStageRequests)),this.stageStatusUpdateListener&&(null===(o=e.stage)||void 0===o||o.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)),null===(c=e.recording)||void 0===c||c.removeListener("recordingUpdate",this.onRecordingUpdate),clearTimeout(this.disconnectTimeout),e.self.removeListener("deviceUpdate",this.deviceUpdateListener)}disconnectedCallback(){var e;"undefined"!==typeof document&&(null===document||void 0===document||document.removeEventListener("rtkNotification",this.onNotification)),this.meeting&&(this.clearListeners(this.meeting),this.waitlistedParticipantJoinedListener&&this.meeting.participants.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&this.meeting.participants.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),this.activeTabUpdateListener&&(null===(e=this.meeting.meta)||void 0===e||e.removeListener("activeTabUpdate",this.activeTabUpdateListener)),this.peerStageStatusListener&&this.meeting.participants.joined.removeListener("stageStatusUpdate",this.peerStageStatusListener))}meetingChanged(e,t){var i,r,n,s,a,o,c,l,d;if(clearTimeout(this.disconnectTimeout),t&&this.clearListeners(t),!e)return;const h="LIVESTREAM"===e.meta.viewType;this.audio=new na(e);const{notifications:u,notification_duration:p,notification_sounds:g}=this.permissions;if(this.participantJoinedListener=e=>{u.participant_joined&&this.add({id:"".concat(e.id,"-joined"),message:"".concat(Ln(e.name)," ").concat(this.t("notifications.joined")),image:e.picture,duration:p.participant_joined}),g.participant_joined&&this.canPlayParticipantJoinedSound()&&this.audio.play("joined")},this.participantLeftListener=e=>{const{socketState:{state:t}}=this.meeting.meta;u.participant_left&&"connected"!==t&&this.add({id:"".concat(e.id,"-left"),message:"".concat(Ln(e.name)," ").concat(this.t("notifications.left")),image:e.picture,duration:p.participant_left}),g.participant_left&&this.canPlayParticipantJoinedSound()&&this.audio.play("left")},this.waitlistedParticipantJoinedListener=e=>{if(!this.canAcceptWaitingRequests())return;const t="".concat(e.id,"-joined-waitlist");this.add({id:t,message:"".concat(Ln(e.name)," ").concat(this.t("notifications.requesting_to_join_meeting")),image:e.picture,duration:p.participant_joined_waitlist,button:{text:this.t("notifications.accept"),variant:"primary",onClick:async()=>{await this.meeting.participants.acceptWaitingRoomRequest(e.id),this.remove(t)}}}),g.participant_joined_waitlist&&this.canPlayParticipantJoinedSound()&&this.audio.play("message")},this.waitlistedParticipantLeftListener=e=>{this.remove("".concat(e.id,"-joined-waitlist"))},this.chatUpdateListener=t=>{let{message:i}=t;const r=Kn(i);if(null!=r){if(r.userId===e.self.userId)return;"text"===r.type&&(u.chat&&this.add({id:"message-".concat(Math.random().toString(36)),icon:this.iconPack.chat,message:"".concat(r.displayName,": ").concat(r.message),duration:p.chat}),g.chat&&this.canPlayChatSound()&&this.audio.play("message"))}},this.pollUpdateListener=e=>{let{polls:t,newPoll:i}=e;!1!==i&&(u.polls&&this.meeting.self.userId!==t[t.length-1].createdByUserId&&this.add({id:"poll-".concat(Math.random().toString(36)),icon:this.iconPack.poll,message:"".concat(this.t("notifications.new_poll_created_by")," ").concat(t[t.length-1].createdBy),duration:p.polls}),g.polls&&this.meeting.self.userId!==t[t.length-1].createdByUserId&&this.canPlayChatSound()&&this.audio.play("message"))},this.deviceUpdateListener=e=>{let{device:t,preview:i}=e;i||("audiooutput"===t.kind&&(this.audio.setDevice(t.deviceId),this.remove("speaker-switched"),this.add({id:"speaker-switched",message:"".concat(this.t("notifications.connected_to")," ").concat(t.label),icon:this.iconPack.speaker,duration:5e3})),"videoinput"===t.kind&&(this.remove("camera-switched"),this.add({id:"camera-switched",message:"".concat(this.t("notifications.connected_to")," ").concat(t.label),icon:this.meeting.self.videoEnabled?this.iconPack.video_on:this.iconPack.video_off,iconVariant:this.meeting.self.videoEnabled?"primary":"danger",duration:5e3})),"audioinput"===t.kind&&(this.remove("mic-switched"),this.add({id:"mic-switched",message:"".concat(this.t("notifications.connected_to")," ").concat(t.label),icon:this.meeting.self.audioEnabled?this.iconPack.mic_on:this.iconPack.mic_off,iconVariant:this.meeting.self.audioEnabled?"primary":"danger",duration:5e3})))},this.socketConnectionUpdateListener=e=>{let{state:t,reconnectionAttempt:i,reconnected:r}=e;switch(t){case"connected":this.remove("socket"),r&&this.add({id:"socket",icon:this.iconPack.wifi,message:this.t("network.restored"),duration:3e3});break;case"disconnected":this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.reconnecting")});break;case"reconnecting":i>=6?(this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.disconnected"),button:{text:this.t("end"),variant:"danger",onClick:()=>{var e;return null===(e=this.meeting)||void 0===e?void 0:e.leaveRoom()}}})):i>=4&&(this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.delay_extended")}));break;case"failed":this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.leaving"),button:{text:this.t("end"),variant:"danger",onClick:()=>{var e;return null===(e=this.meeting)||void 0===e?void 0:e.leaveRoom()}}})}},this.activeTabUpdateListener=t=>{if(u.tab_sync)switch(t.type){case"plugin":const i=e.plugins.active.toArray().find(e=>e.id==t.id);void 0!=i&&this.add({id:"activeTab",message:"".concat(this.t("notifications.plugin_switched_to")," ").concat(i.name),duration:p.participant_joined});break;case"screenshare":const r=e.participants.joined.toArray().filter(e=>e.screenShareEnabled).find(e=>e.id==t.id);void 0!=r&&this.add({id:"spotlight",message:"Now watching ".concat(r.name,"'s screen"),duration:p.webinar})}},this.peerStageStatusListener=e=>{"REQUESTED_TO_JOIN_STAGE"===e.stageStatus&&(this.add({id:"stage-request-".concat(e.id),message:"".concat(e.name," ").concat(this.t("notifications.requested_to_join_stage")),duration:p.webinar,button:{text:this.t("notifications.accept"),variant:"primary",onClick:async()=>{await this.meeting.stage.grantAccess([e.userId]),this.remove("stage-request-".concat(e.id))}}}),g.webinar&&this.audio.play("joined")),"ON_STAGE"===e.stageStatus&&(this.add({id:"stage-joined-".concat(e.id),message:"".concat(e.name," ").concat(this.t("notifications.joined_stage")),duration:p.webinar}),g.webinar&&this.audio.play("joined"))},this.stageRequestAccepted=()=>{this.add({id:"stage-request-accepted",message:this.t("notifications.request_to_join_accepted"),duration:3e3})},this.stageRequestRejected=()=>{this.add({id:"stage-request-rejected",message:this.t("notifications.request_to_join_rejected"),duration:3e3})},this.newStageRequests=e=>{let{count:t}=e;this.add({id:"new-stage-request",message:"You have ".concat(t<0?"new stage":"".concat(t," pending")," request").concat(1===t?"":"s"),duration:3e3})},this.stageStatusUpdateListener=t=>{"ON_STAGE"===t?this.addStagePeersListeners(e):this.removeStagePeersListeners(e)},!at(e)&&(null===(i=e.chat)||void 0===i||i.addListener("chatUpdate",this.chatUpdateListener)),"CHAT"===(null===(r=e.self.config.viewType)||void 0===r?void 0:r.toString()))return;const f=e.self.getCurrentDevices();null!=f.speaker&&this.audio.setDevice(f.speaker.deviceId),h?null===(n=e.stage)||void 0===n||n.on("stageStatusUpdate",this.stageStatusUpdateListener):this.addStagePeersListeners(e),this.canAcceptWaitingRequests()&&(e.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),e.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener)),null===(s=e.polls)||void 0===s||s.addListener("pollsUpdate",this.pollUpdateListener),e.self.addListener("deviceUpdate",this.deviceUpdateListener),e.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),null===(a=e.meta)||void 0===a||a.addListener("activeTabUpdate",this.activeTabUpdateListener),null===(o=e.recording)||void 0===o||o.addListener("recordingUpdate",this.onRecordingUpdate),null===(c=e.stage)||void 0===c||c.addListener("stageRequestApproved",this.stageRequestAccepted),null===(l=e.stage)||void 0===l||l.addListener("stageRequestRejected",this.stageRequestRejected),e.self.permissions.stageEnabled&&e.self.permissions.acceptStageRequests&&(null===(d=e.stage)||void 0===d||d.addListener("newStageRequest",this.newStageRequests))}configChanged(e){null!=e&&null!=(null===e||void 0===e?void 0:e.config)&&(this.permissions=function(e){const t=Object.assign({},ql);return null==e||(Object.assign(t.notification_sounds,e.notification_sounds),Object.assign(t.notifications,e.notifications),Object.assign(t.notification_duration,e.notification_duration),t.participant_chat_message_sound_notification_limit=e.participant_chat_message_sound_notification_limit,t.participant_joined_sound_notification_limit=e.participant_joined_sound_notification_limit),t}(e.config),this.enabledSounds=Zl(this.permissions.notification_sounds))}statesChanged(e){var t;if(null!=e){const i=!(null===(t=null===e||void 0===e?void 0:e.prefs)||void 0===t?void 0:t.muteNotificationSounds);for(const e of this.enabledSounds)e in this.permissions.notification_sounds&&(this.permissions.notification_sounds[e]=i)}}apiErrorListener(e){let{detail:t}=e;const{trace:i,message:r}=t;this.add({id:i,message:r,duration:Wl,icon:this.iconPack.warning})}sendNotificationListener(e){let{detail:t}=e;const{trace:i,message:r}=t;this.add({id:i,message:r,duration:Wl})}add(e){"visible"===document.visibilityState&&this.notifications.length<5&&(this.notifications=[...this.notifications,e])}remove(e){this.notifications=this.notifications.filter(t=>t.id!==e)}handleDismiss(e){e.stopPropagation();const t=e.detail,i=this.host.shadowRoot.querySelector('[data-id="'.concat(t,'"]'));null===i||void 0===i||i.classList.add("exit"),setTimeout(()=>{M(()=>{this.remove(t)})},400)}canPlayParticipantJoinedSound(){return void 0==this.permissions.participant_joined_sound_notification_limit||this.permissions.participant_joined_sound_notification_limit<=0||this.meeting.participants.count<=this.permissions.participant_joined_sound_notification_limit}canPlayChatSound(){return void 0==this.permissions.participant_chat_message_sound_notification_limit||this.permissions.participant_chat_message_sound_notification_limit<=0||this.meeting.participants.count<=this.permissions.participant_chat_message_sound_notification_limit}canAcceptWaitingRequests(){return this.permissions.notifications.participant_joined_waitlist&&this.meeting.self.permissions.acceptWaitingRequests}render(){if(this.meeting)return Z(J,null,Z("div",{onMouseEnter:()=>this.paused=!0,onFocusin:()=>this.paused=!0,onMouseLeave:()=>this.paused=!1,onFocusout:()=>this.paused=!1},this.notifications.map(e=>Z("rtk-notification",{size:this.size,key:e.id,"data-id":e.id,notification:e,onRtkNotificationDismiss:e=>this.handleDismiss(e),iconPack:this.iconPack,paused:this.paused,t:this.t}))))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],config:["configChanged"],states:["statesChanged"]}}};Kl([On()],Yl.prototype,"meeting",void 0),Kl([On()],Yl.prototype,"states",void 0),Kl([On()],Yl.prototype,"config",void 0),Kl([On()],Yl.prototype,"t",void 0),Kl([On()],Yl.prototype,"iconPack",void 0),Yl.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;z-index:100}rtk-notification{margin-top:var(--rtk-space-2, 8px)}";var Jl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ql=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un()}connectedCallback(){this.states.activeOverlayModal.timeout&&setTimeout(()=>{this.stateUpdate.emit({activeOverlayModal:{active:!1}})},this.states.activeOverlayModal.timeout)}render(){return Z(J,{key:"c767e575975cc837f1f484932c5c916d5d7e4522"},Z("rtk-icon",{key:"0f4e8e81e1fa985852cbe4055203ca3095ae8ebe",icon:this.states.activeOverlayModal.icon}),Z("h2",{key:"1af8c19bc19e93b279cf396903a91d3ae7192eda"},this.states.activeOverlayModal.title),Z("p",{key:"226aacfe32b70ba4e1a01b1e4875af3fd39b559a"},this.states.activeOverlayModal.description))}};Jl([On()],Ql.prototype,"meeting",void 0),Jl([On()],Ql.prototype,"states",void 0),Jl([On()],Ql.prototype,"iconPack",void 0),Jl([On()],Ql.prototype,"t",void 0),Ql.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);z-index:50}rtk-icon{height:var(--rtk-space-20, 80px)}h2{margin:var(--rtk-space-2, 8px);font-weight:500}p{margin:var(--rtk-space-0, 0px);font-size:16px}";var Xl=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ed=class{constructor(e){f(this,e),this.autoScroll=!0,this.iconPack=pn,this.t=un(),this.emptyListLabel=null,this.isLoading=!1,this.rerenderBoolean=!1,this.shouldRenderNewNodes=!0,this.hasNewNodesToRender=!1,this.showEmptyListLabel=!1,this.pagesToRender=[[]],this.currentTime=()=>(new Date).getTime(),this.observe=e=>{e&&this.intersectionObserver.observe(e)}}async onNewNode(e){this.shouldRenderNewNodes?(this.addNodeToRender(e,!1),this.rerender()):this.hasNewNodesToRender=!0}async onNodeDelete(e){const t=this.pagesToRender.flat().length;this.pagesToRender=this.pagesToRender.map(t=>t.filter(t=>t.id!==e)),t!==this.pagesToRender.flat().length&&this.rerender()}async onNodeUpdate(e,t){let i=!1;this.pagesToRender=this.pagesToRender.map(r=>r.map(r=>r.id===e?(i=!0,t):r)),i&&this.rerender()}onItemChanged(e,t){e!==t&&(this.pagesToRender=[[]],this.loadFirstPage().then(()=>this.rerender()))}connectedCallback(){this.rerender=qn(this.rerender.bind(this),50,{maxWait:200}),this.intersectionObserver=new IntersectionObserver(e=>{M(()=>{for(const t of e)"bottom-scroll"===t.target.id&&(t.isIntersecting?this.loadBottom():this.shouldRenderNewNodes=!1),"top-scroll"===t.target.id&&t.isIntersecting&&this.loadTop()})})}disconnectedCallback(){this.intersectionObserver.disconnect()}componentDidLoad(){this.loadFirstPage(),this.observe(this.$topRef),this.observe(this.$bottomRef)}componentDidRender(){this.shouldRenderNewNodes&&this.autoScroll&&vs(this.$paginatedList)}loadFirstPage(){return this.loadPage(this.currentTime(),this.pageSize,!0,e=>{0===e.length&&(this.showEmptyListLabel=!0)})}loadTop(){if(0===this.pagesToRender.length)return;if(1===this.pagesToRender.length&&this.pagesToRender[0].length{})}loadBottom(){if(0===this.pagesToRender.length)return void(this.shouldRenderNewNodes=!0);if(1===this.pagesToRender.length&&this.pagesToRender[0].lengthvs(this.$paginatedList))}addNodeToRender(e,t){if(t){const t=this.pagesToRender[0];if(t&&(null===t||void 0===t?void 0:t.length)3&&void 0!==arguments[3]?arguments[3]:()=>{};this.isLoading=!0;const n=await this.fetchData(e,t,i);if(this.isLoading=!1,!(null===n||void 0===n?void 0:n.length))return i||(this.hasNewNodesToRender=!1,this.shouldRenderNewNodes=!0),void r([]);n.forEach(e=>this.addNodeToRender(e,i)),this.rerender(),r(n)}rerender(){this.rerenderBoolean=!this.rerenderBoolean}removeLastPageIfNeeded(e){this.pagesToRender.length>this.pagesAllowed&&(e?this.pagesToRender.shift():this.pagesToRender.pop())}onDownArrowClicked(){this.loadBottom()}render(){var e;return Z(J,{key:"4f1521c422a134079a5def745ed85631c48a132a"},Z("div",{key:"0cadd9723fbc844bab7e595d18b6174ecb6ba10c",class:"scrollbar container",part:"container",ref:e=>this.$paginatedList=e},Z("div",{key:"35a9b009d74a81159c7b856b9412b670051c9893",class:{"show-new-messages-ctr":!0,active:!this.shouldRenderNewNodes}},Z("rtk-button",{key:"2798fbf3da7200db72dfe1f985d4570163d77ff8",class:"show-new-messages",kind:"icon",variant:"secondary",part:"show-new-messages",onClick:()=>this.onDownArrowClicked()},Z("rtk-icon",{key:"08b47cd4f472b240174cee559d4d39cf796aa788",icon:this.iconPack.chevron_down}))),Z("div",{key:"ae30f2391936a8a4f258384cc8da4300bf2c350c",class:"smallest-dom-element",id:"bottom-scroll",ref:e=>this.$bottomRef=e}),this.isLoading&&0===this.pagesToRender.flat().length&&Z("rtk-spinner",{key:"72f866d03e6d0d954a46443aa19d95f7033dfbe9",size:"lg"}),0===this.pagesToRender.flat().length&&this.showEmptyListLabel?Z("div",{class:"empty-list"},null!==(e=this.emptyListLabel)&&void 0!==e?e:this.t("list.empty")):Z("div",{class:"page-wrapper"},this.pagesToRender.map(e=>this.createNodes(e))),Z("div",{key:"c96065eee8e01c56c0f6cb419b5e26ceef564678",class:"smallest-dom-element",id:"top-scroll",ref:e=>this.$topRef=e})))}static get watchers(){return{selectedItemId:["onItemChanged"]}}};Xl([On()],ed.prototype,"iconPack",void 0),Xl([On()],ed.prototype,"t",void 0),ed.style=".scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;flex:1}.container{box-sizing:border-box;display:flex;flex-direction:column-reverse;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);flex:1 0 0px;overflow-y:scroll;}.file-picker{display:none}.chat *:first-child{margin-top:var(--rtk-space-0, 0px)}.chat .head{display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.chat .body .emoji{font-size:24px}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}rtk-text-message,rtk-image-message,rtk-file-message{margin-top:var(--rtk-space-4, 16px);display:block;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-3, 12px)}rtk-text-message[is-continued]{margin-top:var(--rtk-space-2, 8px)}.chat .image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.chat .image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.chat .image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.chat .image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat .image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.chat .image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.chat .file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.chat .file .file-data{flex:1 1 0%}.chat .file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.chat .file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.chat .file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}.smallest-dom-element{width:1px}#top-scroll{transform:translateY(20vh)}#bottom-scroll{transform:translateY(-20vh)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.show-new-messages-ctr{pointer-events:none;position:absolute;bottom:var(--rtk-space-2, 8px);right:var(--rtk-space-4, 16px);z-index:10;margin-top:calc(var(--rtk-space-14, 56px) * -1);--tw-translate-y:var(--rtk-space-28, 112px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages-ctr.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.show-new-messages{pointer-events:auto;border-radius:9999px}.show-new-messages:hover{border-radius:9999px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}rtk-spinner,.empty-list{margin:auto}.page-wrapper{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.message-wrapper{margin-bottom:var(--rtk-space-2, 8px)}.pinned .message-wrapper{position:relative}.pinned .pin-icon{position:absolute;right:calc(var(--rtk-space-1, 4px) * -1);top:calc(var(--rtk-space-1, 4px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px)}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}";var td=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const id={"Chrome.Desktop.audio":["Chrome1.svg","Chrome2.svg","Chrome3.svg"],"Chrome.Desktop.video":["Chrome1.svg","Chrome2.svg","Chrome3.svg"]},rd=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.t=un(),this.iconPack=pn,this.currentStep=0,this.svgSteps=[],this.continue=()=>{this.stateUpdate.emit({activePermissionsMessage:{enabled:!1}})},this.reload=()=>{"undefined"!==typeof window&&window.location.reload()},this.getImage=async e=>{function t(e,t,i){return e.split(t).join(i)}const i=await fetch("https://rtk-assets.realtime.cloudflare.com/ui-kit/permissions/".concat(e));let r=await i.text();return r=t(r,"yoursite.com",location.host),r=t(r,"Yoursite",document.title.length>14?"".concat(document.title.slice(0,14),"..."):document.title),r},this.nextStep=()=>{this.currentStep=(this.currentStep+1)%this.svgSteps.length},this.openMacSystemSettings=()=>{const e=document.createElement("a");switch(this.mediaType){case"audio":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone";break;case"screenshare":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture";break;case"video":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_Camera"}e.click()}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.stepsTimer&&clearTimeout(this.stepsTimer)}meetingChanged(e){var t,i,r;if(null!=e){this.device=e.self.device;const n=(null===(t=this.device)||void 0===t?void 0:t.isMobile)?"Mobile":"Desktop",s=null!==(r=id["".concat(null===(i=this.device)||void 0===i?void 0:i.browserName,".").concat(n,".").concat(this.mediaType)])&&void 0!==r?r:[];Promise.all(s.map(this.getImage)).then(e=>{this.svgSteps=e})}}getLink(e){let t;switch(e){case"audio":t="microphone";break;case"video":t="camera";break;default:t="screenshare"}let i="Allow+".concat(t,"+access");if(null!=this.device){const{browserName:e,isMobile:t}=this.device;i+="+"+e,t&&(i+="+mobile")}return"https://www.google.com/search?q="+i}isDeniedBySystem(){var e;const t=null===(e=this.meeting)||void 0===e?void 0:e.self.mediaPermissions;return null!=t&&"SYSTEM_DENIED"===t[this.mediaType]}getTitle(){return this.isDeniedBySystem()?this.t("perm_sys_denied.".concat(this.mediaType)):this.t("perm_denied.".concat(this.mediaType))}get mediaType(){var e,t,i;return null!==(i=null===(t=null===(e=this.states)||void 0===e?void 0:e.activePermissionsMessage)||void 0===t?void 0:t.kind)&&void 0!==i?i:"audio"}getMessage(){var e;const{browserName:t,osName:i}=this.meeting.self.device,r=this.isDeniedBySystem(),n=null!==(e=t.toLowerCase())&&void 0!==e?e:"others",s=null!==i&&void 0!==i?i:"others";if(r){const e="perm_sys_denied.".concat(this.mediaType,".").concat(s.toLowerCase(),".message");return this.t(e)===e?this.t("perm_sys_denied.".concat(this.mediaType,".others.message")):this.t(e)}const a="perm_denied.".concat(this.mediaType,".").concat(n,".message");return this.t(a)===a?this.t("perm_denied.".concat(this.mediaType,".others.message")):this.t(a)}render(){var e,t,i;const r=this.isDeniedBySystem();this.svgSteps.length>0&&(this.stepsTimer&&clearTimeout(this.stepsTimer),this.stepsTimer=setTimeout(this.nextStep,2500));const n=r&&"macOS"==this.meeting.self.device.osName;return Z(J,{key:"9e1ddfa94e56f005310a17a451647055d687afdb"},Z("h2",{key:"0f4105daa1ca09074175e27931f4883814a527fb"},Z("rtk-icon",{key:"439a834c97fd162637202e8f682f115de8e0188f",class:"text-icon",icon:this.iconPack.warning}),this.getTitle()),this.svgSteps.length>0&&Z("div",{key:"9f65d4789625e7fbfa8f3c7e5b916584febf3bc9",class:"svg-container"},this.svgSteps.map((e,t)=>Z("p",{innerHTML:e,class:"svg-ins",key:this.currentStep,hidden:t!==this.currentStep}))),Z("div",{key:"c419b837d680c5e003dfbd58e66dfab790ae13ce"},this.getMessage()),!r&&Z("a",{key:"9fd27220623637172a1fc0679cb1f60410dbb1b9",class:"need-help-link",href:this.getLink(null!==(i=null===(t=null===(e=this.states)||void 0===e?void 0:e.activePermissionsMessage)||void 0===t?void 0:t.kind)&&void 0!==i?i:"audio"),target:"_blank",rel:"noreferrer external noreferrer noopener"},Z("rtk-icon",{key:"c237332bdbc21bd33350c3e94928c08526bf63d9",class:"text-icon",icon:this.iconPack.attach}),this.t("cta.help")),Z("div",{key:"b0345160cc94639ed4d8bb9bdda4dd29a7defe83",class:"actions"},Z("rtk-button",{key:"21e95a3acf84a9d4209039ea9b1ccf29987d2195",size:"lg",kind:"wide",variant:"secondary",onClick:this.continue},this.t("cta.continue")),n?Z("rtk-button",{size:"lg",kind:"wide",onClick:this.openMacSystemSettings},this.t("cta.system_settings")):Z("rtk-button",{size:"lg",kind:"wide",onClick:this.reload},this.t("cta.reload"))),Z("slot",{key:"b08b0d9a9f91874e10d1b2e0fa8ededb71054e60"}))}static get watchers(){return{meeting:["meetingChanged"]}}};td([On()],rd.prototype,"meeting",void 0),td([On()],rd.prototype,"t",void 0),td([On()],rd.prototype,"iconPack",void 0),td([On()],rd.prototype,"states",void 0),rd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;max-height:100%;width:600px;overflow-y:auto;padding:var(--rtk-space-6, 24px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));overflow-wrap:break-word;color:rgb(var(--rtk-colors-text-1000, 255 255 255));word-wrap:break-word}.actions{display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.text-icon{display:inline-block;vertical-align:middle}h2{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px)}h2 .text-icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px)}.need-help-link{margin-top:var(--rtk-space-2, 8px);display:inline-block;text-underline-offset:2px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity))}.need-help-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-text-opacity))}a rtk-icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) .actions{flex-direction:column;align-items:flex-start;justify-content:center}:host([size='sm']) .action{width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.actions{margin-top:var(--rtk-space-6, 24px)}.actions rtk-button{flex:1 1 0%}.svg-container{display:flex;width:100%;justify-content:center !important}.svg-ins{width:80%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}";const nd=class{constructor(e){f(this,e),this.iconPack=pn,this.size="md"}render(){return Z(J,{key:"896d7e13900a390f5c03df4e2af45163d61f6d09"},Z("rtk-icon",{key:"dd05bbbb3eb9db982d85db131b82c2bcaf253a94",class:"spinner",icon:this.iconPack.spinner}))}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],nd.prototype,"iconPack",void 0),nd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);--rtk-spinner-color:currentColor}.spinner{height:100%;width:100%}@keyframes spin{to{transform:rotate(360deg)}}.spinner{animation:spin 1s linear infinite;border-radius:9999px;background-color:transparent;animation-duration:1.3s}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";var sd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ad=class{constructor(e){f(this,e),this.onTextChange=re(this,"textChange",7),this.disabled=!1,this.rateLimitBreached=!1,this.keyDownHandler=()=>{},this.iconPack=pn,this.t=un(),this.maxLengthBreached=0,this.onInputHandler=()=>{const e=this.$textArea.value.trim();this.maybeResize(e),this.checkLength(e),this.onTextChange.emit(e)},this.maybeResize=e=>{const t=[...e.matchAll(/\n/g)].length;this.$textArea.style.height="".concat(Math.min(200,60+20*t),"px")}}componentDidLoad(){this.maxLength&&(this.$textArea.maxLength=this.maxLength);const e=this.$textArea.value.trim();""!==e&&this.maybeResize(e),this.$textArea.focus()}async setText(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.$textArea.value=e,this.maybeResize(e),t&&this.$textArea.focus(),this.checkLength(e),this.onTextChange.emit(e)}checkLength(e){const t=e.length;t+10>=this.maxLength?this.maxLengthBreached=e.length:t+100&&(this.maxLengthBreached=0)}render(){return Z("div",{key:"16cc81323e6fb16e4d4a6622895ed7edc80f2db9",class:"chat-input",part:"chat-input-container"},this.maxLengthBreached>0&&Z("div",{key:"05fde7b4f3e084e464fcc3276f0ce1e0d909e6a7",class:"text-error "+(this.maxLengthBreached===this.maxLength?"breached":"")},Z("rtk-icon",{key:"d4101bf8933a9873605e88fbb617d8ae38bb56a1",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})," ",this.maxLengthBreached," / ",this.maxLength," ",this.t("chat.max_limit_warning")),this.rateLimitBreached&&Z("div",{key:"779a1c58114de2cce65a13ee3ea8cb308f7cd68a",class:"text-error breached"},Z("rtk-icon",{key:"9dedd14d826b1437f434d92c985659ecc3bc1842",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})," ",this.t("chat.rate_limit_error")),Z("textarea",{key:"f45f8f812ad668a86d2d0a22926bf437be44cbc9",ref:e=>this.$textArea=e,placeholder:this.placeholder,disabled:this.disabled,onInput:this.onInputHandler,onKeyDown:this.keyDownHandler,part:"chat-input",value:this.value}))}};sd([On()],ad.prototype,"iconPack",void 0),sd([On()],ad.prototype,"t",void 0),ad.style=".chat-input {\n position: relative;\n z-index: 10;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n border-top-left-radius: var(--rtk-border-radius-md, 8px);\n border-top-right-radius: var(--rtk-border-radius-md, 8px)\n}\n\n .chat-input textarea {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n box-sizing: border-box;\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::-moz-placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea {\n font-family: var(--rtk-font-family, sans-serif);\n outline: 2px solid transparent;\n outline-offset: 2px;\n resize: none;\n overflow-y: auto;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n min-height: 60px;\n font-size: 14px\n}\n\n@container chatcontainer (height < 360px) {\n textarea {\n height: 30px !important;\n min-height: 30px !important\n }\n}\n\n.text-error {\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n margin-top: var(--rtk-space-1, 4px);\n margin-left: var(--rtk-space-1, 4px);\n display: flex;\n width: -moz-fit-content;\n width: fit-content;\n align-items: center;\n justify-content: flex-start;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-border-opacity));\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n font-size: 12px;\n font-weight: 600;\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity));\n border: 1px solid\n}\n\n#warning-indicator {\n margin-right: var(--rtk-space-1, 4px);\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px)\n}\n\n.text-error.breached {\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))\n}";var od=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const cd=class{constructor(e){f(this,e),this.now=new Date,this.isContinued=!1,this.iconPack=pn,this.t=un(),this.showBubble=!1}render(){return Z(J,{key:"74b8d7a70a5960c4350061055ded0fa8838084ae"},!this.isContinued&&Z(ms,{key:"c0819a75eb645eff5ac6ccd7bdb54e7dbdce9876",name:this.message.displayName,time:this.message.time,now:this.now}),Z("div",{key:"f06fbf9a9e4680cc426c183d9ee09bfad452a5ad",class:{body:!0,bubble:this.showBubble},part:"body"},Z("div",{key:"2755f1cefa98695843569934c414d6b2fbf158e5",class:{text:!0,emoji:An(this.message.message)}},Z(nc,{key:"52e0ae4b7710d970cb1915fc4059abef212b12fd",message:this.message.message}))))}};od([On()],cd.prototype,"iconPack",void 0),od([On()],cd.prototype,"t",void 0);const ld=class{constructor(e){f(this,e),this.isMarkdown=!1}render(){return Z("p",{key:"3a9c21d67487ea40760163f0dd69152454049063",class:{text:!0,emoji:An(this.text)}},this.isMarkdown?Z("rtk-markdown-view",{text:this.text}):this.text)}};ld.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.text{word-break:break-word;display:block;overflow-wrap:break-word;line-height:1.375}.text.emoji{font-size:24px}";const dd=class{constructor(e){f(this,e),this.openChange=re(this,"rtkOpenChange",7),this.label="",this.variant="secondary",this.disabled=!1,this.open=!1,this.kind="inline",this.placement="top",this.delay=0,this.isInFocus=!1,this.showMenu=()=>{this.disabled||(this.isInFocus=!0,setTimeout(()=>{this.isInFocus&&(this.tooltipEl.style.display="block",this.update(),this.openChange.emit(!0),"sm"===this.size&&setTimeout(()=>{this.isInFocus&&this.hideMenu()},1e3))},this.delay))},this.hideMenu=()=>{this.open||this.disabled||(this.isInFocus=!1,this.tooltipEl.style.display="none",this.openChange.emit(!1))}}componentDidLoad(){this.triggerEl.addEventListener("focusin",this.showMenu),this.triggerEl.addEventListener("mouseenter",this.showMenu),this.triggerEl.addEventListener("focusout",this.hideMenu),this.triggerEl.addEventListener("mouseleave",this.hideMenu),M(()=>{this.openChanged(this.open)})}disconnectedCallback(){this.triggerEl&&(this.triggerEl.removeEventListener("focusin",this.showMenu),this.triggerEl.removeEventListener("mouseenter",this.showMenu),this.triggerEl.removeEventListener("focusout",this.hideMenu),this.triggerEl.removeEventListener("mouseleave",this.hideMenu),this.triggerEl=void 0)}openChanged(e){e?this.showMenu():this.hideMenu()}update(){ic(this.triggerEl,this.tooltipEl,{placement:this.placement,middleware:[Yo(8),Xo(),Qo({padding:5}),tc({element:this.arrowEl})]}).then(e=>{let{x:t,y:i,placement:r,middlewareData:n}=e;Object.assign(this.tooltipEl.style,{left:"".concat(t,"px"),top:"".concat(i,"px")});const{x:s,y:a}=n.arrow,o={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];Object.assign(this.arrowEl.style,{left:null!=s?"".concat(s,"px"):"",top:null!=a?"".concat(a,"px"):"",right:"",bottom:"",[o]:"-4px"})})}render(){return Z(J,{key:"cee2142cb6afa3e002b614bd3dd18b710b749ac1"},Z("span",{key:"4ba5b4777592afc8eb0ae14b50e5ebbfbb43bd1f",part:"trigger",id:"trigger",ref:e=>this.triggerEl=e},Z("slot",{key:"fa1ecc3998424e21444324bf4b5c90d6891ab03f"})),Z("div",{key:"39306bb13f784942525e0b8b203406512253be3d",part:"tooltip",class:"tooltip",id:"tooltip",role:"tooltip",ref:e=>this.tooltipEl=e},Z("div",{key:"d5bd2ca0781605c1ffe4cbeb1ade65430aed6691",id:"arrow",ref:e=>this.arrowEl=e,part:"arrow"}),this.label,Z("slot",{key:"c80c860e2c9cdcbe3c0e0ec97b8f4cd9c99abb78",name:"tooltip"})))}static get watchers(){return{open:["openChanged"]}}};dd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(--rtk-tooltip-background-color, rgb(var(--rtk-colors-background-600, 60 60 60)));--color:var(--rtk-tooltip-color, rgb(var(--rtk-colors-text-1000, 255 255 255)));display:inline-flex}#trigger{display:block;width:100%;flex:1 1 0%}.tooltip{max-width:var(--rtk-space-64, 256px);position:fixed;z-index:20;display:none;width:-moz-max-content;width:max-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);font-size:12px}.tooltip,#arrow{position:absolute;background-color:var(--background-color);color:var(--color)}#arrow{position:absolute;height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);transform:rotate(45deg)}:host([variant='primary']){--background-color:rgb(var(--rtk-colors-brand-500, 33 96 253));--color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host([kind='block']){display:block}";var hd=Object.freeze({__proto__:null,rtk_avatar:ac,rtk_breakout_room_manager:cc,rtk_breakout_room_participants:dc,rtk_breakout_rooms_manager:uc,rtk_broadcast_message_modal:gc,rtk_button:fc,rtk_channel_creator:vc,rtk_channel_details:kc,rtk_channel_header:wc,rtk_channel_selector_view:xc,rtk_chat:Tc,rtk_chat_composer_view:Cc,rtk_chat_message:Rc,rtk_chat_messages_ui:Ic,rtk_chat_messages_ui_paginated:Dc,rtk_chat_search_results:Nc,rtk_confirmation_modal:Fc,rtk_counter:Bc,rtk_debugger:zc,rtk_debugger_audio:Yc,rtk_debugger_screenshare:Qc,rtk_debugger_system:el,rtk_debugger_video:il,rtk_dialog:nl,rtk_dialog_manager:al,rtk_draft_attachment_view:cl,rtk_emoji_picker:hl,rtk_emoji_picker_button:pl,rtk_file_message:fl,rtk_file_message_view:ml,rtk_file_picker_button:bl,rtk_icon:yl,rtk_image_message:Sl,rtk_image_message_view:El,rtk_join_stage:_l,rtk_leave_meeting:Cl,rtk_logo:Rl,rtk_markdown_view:Ll,rtk_meeting:Dl,rtk_menu:Nl,rtk_menu_item:Fl,rtk_menu_list:Bl,rtk_message_view:Vl,rtk_mute_all_confirmation:Hl,rtk_notification:Gl,rtk_notifications:Yl,rtk_overlay_modal:Ql,rtk_paginated_list:ed,rtk_permissions_message:rd,rtk_spinner:nd,rtk_text_composer_view:ad,rtk_text_message:cd,rtk_text_message_view:ld,rtk_tooltip:dd});var ud=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const pd=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.config=sn(),this.iconPack=pn,this.t=un(),this.view="sidebar",this.close=()=>{this.stateUpdate.emit({activeAI:!1})}}connectedCallback(){this.viewChanged(this.view)}disconnectedCallback(){this.keydownListener&&document.removeEventListener("keydown",this.keydownListener)}viewChanged(e){"full-screen"===e&&(this.keydownListener=e=>{"Escape"===e.key&&this.close()},document.addEventListener("keydown",this.keydownListener))}render(){var e,t,i;if(!this.meeting)return null;if(!(null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions).transcriptionEnabled||!(null===(i=this.states)||void 0===i?void 0:i.activeAI))return null;const r={meeting:this.meeting,config:this.config,states:this.states,size:this.size,t:this.t,iconPack:this.iconPack};return Z(J,null,Z("h3",{class:"title"},this.t("ai.transcriptions")),Z("rtk-button",{variant:"ghost",kind:"icon",class:"close",onClick:this.close,"aria-label":this.t("close")},Z("rtk-icon",{icon:this.iconPack.dismiss})),Z("rtk-ai-transcriptions",Object.assign({},r)))}static get watchers(){return{view:["viewChanged"]}}};ud([On()],pd.prototype,"meeting",void 0),ud([On()],pd.prototype,"states",void 0),ud([On()],pd.prototype,"config",void 0),ud([On()],pd.prototype,"iconPack",void 0),ud([On()],pd.prototype,"t",void 0),pd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;box-sizing:border-box;display:flex;width:100%;max-width:var(--rtk-space-80, 320px);flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden}.close{position:absolute;top:var(--rtk-space-3, 12px);left:var(--rtk-space-3, 12px)}.title{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-2, 8px);-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:var(--rtk-space-0, 0px);text-align:center;font-size:14px;font-weight:400}rtk-ai-transcriptions{flex:1}:host([view='sidebar']){margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([view='full-screen']){position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:50;max-width:100%;border:none}";var gd=Object.freeze({__proto__:null,rtk_ai:pd});var fd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const md=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.aiActive=!1}statesChanged(e){const t=e;this.aiActive=t.activeAI}toggleAI(){var e;this.aiActive=!(null===(e=this.states)||void 0===e?void 0:e.activeAI),this.stateUpdate.emit({activeAI:this.aiActive,activeMoreMenu:!1,activeSidebar:!1})}render(){var e,t;if(!this.meeting)return null;const i=this.t("ai.meeting_ai");return(null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions).transcriptionEnabled?Z(J,{title:i},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.aiActive},onClick:()=>this.toggleAI(),icon:this.iconPack.meeting_ai,label:i,variant:this.variant,brandIcon:!0})):Z(J,{"data-hidden":!0})}static get watchers(){return{states:["statesChanged"]}}};fd([On()],md.prototype,"states",void 0),fd([On()],md.prototype,"meeting",void 0),fd([On()],md.prototype,"iconPack",void 0),fd([On()],md.prototype,"t",void 0),md.style=":host{display:block}:host([data-hidden]){display:none}";var vd=Object.freeze({__proto__:null,rtk_ai_toggle:md});var bd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const kd=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.hideSelf=!1,this.activeParticipants=[],this.onStageParticipants=[],this.offStageParticipants=[],this.onParticipantListUpdate=()=>{if(!this.meeting)return;let e=this.meeting.participants.active.toArray();this.hideSelf||(e=[...e,this.meeting.self]);let t=this.meeting.participants.joined.toArray().filter(t=>!e.some(e=>e.id===t.id));this.activeParticipants=e,this.onStageParticipants=t}}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(e){e&&"AUDIO_ROOM"===e.self.config.viewType&&(this.onParticipantListUpdate(),e.participants.active.addListener("participantJoined",this.onParticipantListUpdate),e.participants.active.addListener("participantLeft",this.onParticipantListUpdate),e.participants.joined.addListener("participantJoined",this.onParticipantListUpdate),e.participants.joined.addListener("participantLeft",this.onParticipantListUpdate))}disconnectedCallback(){this.resizeObserver.disconnect(),this.resizeObserver=void 0,this.meeting.participants.active.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.active.removeListener("participantLeft",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantLeft",this.onParticipantListUpdate)}renderGrid(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t={meeting:this.meeting,size:this.size,config:this.config,t:this.t,iconPack:this.iconPack,states:this.states};return e.map(e=>Z(ws,{element:"rtk-audio-tile",defaults:t,props:{key:e.id,participant:e},childProps:{participant:e},deepProps:!0}))}render(){const e=this.activeParticipants.concat(this.onStageParticipants);return Z(J,{key:"9abf98e115b0c6904fd970c39880101fab2c637c"},Z("div",{key:"dba672bd5cdd108629802028080eef8d1fb3afd6",class:"content scrollbar"},Z("div",{key:"21fc5e7ac8a6226b35695960f8f4b92a227344b5",class:"stage grid"},this.renderGrid(e)),this.offStageParticipants.length>0&&Z("div",{key:"6aee7d64d2af6e4435c5e552e24d7a3dc12847f8",class:"waitlist-area"},Z("div",{key:"e84f6038cc0071062b9d5d033848739bdb1cc971",class:"listening-title"},this.offStageParticipants.length," ",this.t("grid.listening")),Z("div",{key:"d6d5cdd233847dca6902a4c0158be110b36b1c76",class:"waitlist-grid grid"},this.renderGrid(this.offStageParticipants)))),Z("slot",{key:"03aee180fdfdf0a8391e31cc2e943173fb06bcc0"}))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"]}}};bd([On()],kd.prototype,"meeting",void 0),bd([On()],kd.prototype,"config",void 0),bd([On()],kd.prototype,"states",void 0),bd([On()],kd.prototype,"iconPack",void 0),bd([On()],kd.prototype,"t",void 0),kd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;height:100%;width:100%;box-sizing:border-box}.content{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow-y:auto}.waitlist-area{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.listening-title{text-align:center;margin-top:var(--rtk-space-5, 20px);margin-bottom:var(--rtk-space-4, 16px)}.waitlist-grid{flex:1 1 0%}.grid{box-sizing:border-box;flex:1 1 0%;gap:var(--rtk-space-6, 24px);display:flex;align-content:center;justify-content:center;flex-wrap:wrap}:host([size='md']) .grid{gap:var(--rtk-space-4, 16px)}:host([size='sm']) .grid{gap:var(--rtk-space-3, 12px)}rtk-audio-tile{aspect-ratio:1 / 1;flex:none;width:calc(20%);max-width:var(--rtk-space-48, 192px);transition:all 0.3s}rtk-audio-tile[size='md']{width:100%;max-width:var(--rtk-space-36, 144px)}rtk-audio-tile[size='sm']{width:100%;max-width:var(--rtk-space-24, 96px)}";var yd=Object.freeze({__proto__:null,rtk_audio_grid:kd}),wd=Sd;function Sd(){}Sd.mixin=function(e){var t=e.prototype||e;t.isWildEmitter=!0,t.on=function(e,t,i){this.callbacks=this.callbacks||{};var r=3===arguments.length,n=r?arguments[1]:void 0,s=r?arguments[2]:arguments[1];return s._groupName=n,(this.callbacks[e]=this.callbacks[e]||[]).push(s),this},t.once=function(e,t,i){var r=this,n=3===arguments.length,s=n?arguments[1]:void 0,a=n?arguments[2]:arguments[1];return this.on(e,s,function t(){r.off(e,t),a.apply(this,arguments)}),this},t.releaseGroup=function(e){var t,i,r,n;for(t in this.callbacks=this.callbacks||{},this.callbacks)for(i=0,r=(n=this.callbacks[t]).length;ii&&t[r]<0&&(i=t[r]);return i}(s,n);i.emit("volume_change",e,c);var t=0;if(e>c&&!i.speaking){for(var r=i.speakingHistory.length-3;r=2&&(i.speaking=!0,i.emit("speaking"))}else if(ec)),p()}},o)};return p(),i};var Pd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Cd=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.audioEnabled=!1,this.volume=0,this.onAudioUpdate=e=>{let{audioEnabled:t,audioTrack:i}=e;if(this.participant)if(t&&i){const e=new MediaStream;e.addTrack(i),this.calcVolume(e),this.audioEnabled=!0}else this.volume=0,this.audioEnabled=!1}}connectedCallback(){this.participantChanged(this.participant)}disconnectedCallback(){var e,t;null===(e=this.hark)||void 0===e||e.stop(),null===(t=this.participant)||void 0===t||t.removeListener("audioUpdate",this.onAudioUpdate)}participantChanged(e){e&&(this.audioEnabled=e.audioEnabled,e.addListener("audioUpdate",this.onAudioUpdate))}calcVolume(e){this.hark=_d(e,{play:!1,interval:100}),this.hark.on("volume_change",e=>{const t=this.volume;let i=Math.round(10**(e/115)*10);i<3&&(i=0);let r=Math.round((2*t+i)/3);t!==r&&(this.volume=r)})}render(){if(!this.meeting)return null;const e={meeting:this.meeting,size:this.size,config:this.config,states:this.states,iconPack:this.iconPack,t:this.t};let t="bar-0";return t=this.volume>5?"bar-5":this.volume<0?"bar-0":"bar-"+this.volume,Z(J,null,Z("div",{class:{"avatar-ctr":!0,speaking:this.audioEnabled,[t]:!0}},Z("rtk-avatar",{participant:this.participant,size:this.size},!this.audioEnabled&&Z("div",{class:"mic-icon"},Z("rtk-icon",{icon:pn.mic_off})))),Z("rtk-name-tag",Object.assign({variant:"text",participant:this.participant},e)),Z("slot",null))}static get watchers(){return{participant:["participantChanged"]}}};Pd([On()],Cd.prototype,"meeting",void 0),Pd([On()],Cd.prototype,"config",void 0),Pd([On()],Cd.prototype,"states",void 0),Pd([On()],Cd.prototype,"iconPack",void 0),Pd([On()],Cd.prototype,"t",void 0),Cd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column}.avatar-ctr{box-sizing:border-box;width:100%;flex:1 1 0%;padding:var(--rtk-space-1\\.5, 6px);border:2px solid transparent;border-radius:calc(var(--rtk-border-radius-xl, 40px) + var(--rtk-space-1\\.5, 6px))}.avatar-ctr.speaking{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.bar-0{box-shadow:none}.bar-1{box-shadow:0 0 4px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-2{box-shadow:0 0 8px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-3{box-shadow:0 0 16px 1px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-4{box-shadow:0 0 20px 3px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-5{box-shadow:0 0 24px 6px rgb(var(--rtk-colors-brand-500, 33 96 253))}rtk-avatar{aspect-ratio:1 / 1;height:100%;width:100%;position:relative;border-radius:var(--rtk-border-radius-xl, 40px)}rtk-name-tag{display:block;height:var(--rtk-space-10, 40px);width:100%;text-align:center;line-height:2.5rem}:host([size='sm']) .avatar-ctr{border-radius:calc(var(--rtk-border-radius-lg, 12px) + var(--rtk-space-1\\.5, 6px))}:host([size='sm']) rtk-name-tag{height:var(--rtk-space-7, 28px);line-height:1.75rem}:host([size='sm']) rtk-avatar{border-radius:var(--rtk-border-radius-lg, 12px)}.mic-icon{position:absolute;bottom:calc(var(--rtk-space-1, 4px) * -1);right:calc(var(--rtk-space-1, 4px) * -1);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.mic-icon rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) .mic-icon rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='md']) .mic-icon rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}";var Ad=Object.freeze({__proto__:null,rtk_audio_tile:Cd});var Rd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ld=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.canToggle=!1,this.permissionsUpdateListener=()=>{this.canToggle=St(this.meeting)},this.breakoutRoomToggle=()=>{var e,t;const i=this.meeting.connectedMeetings.isActive?"view":"create";this.stateUpdate.emit({activeBreakoutRoomsManager:{active:!(null===(t=null===(e=this.states)||void 0===e?void 0:e.activeBreakoutRoomsManager)||void 0===t?void 0:t.active),mode:i}})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i;null===(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===i||i.off("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(e){e&&(this.canToggle=St(e),e.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener))}render(){return this.meeting?this.canToggle?Z(J,{title:this.t("breakout_rooms")},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:this.breakoutRoomToggle,icon:this.iconPack.breakout_rooms,label:this.t("breakout_rooms"),variant:this.variant})):void 0:null}static get watchers(){return{meeting:["meetingChanged"]}}};Rd([On()],Ld.prototype,"meeting",void 0),Rd([On()],Ld.prototype,"states",void 0),Rd([On()],Ld.prototype,"iconPack",void 0),Rd([On()],Ld.prototype,"t",void 0),Ld.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var Id=Object.freeze({__proto__:null,rtk_breakout_rooms_toggle:Ld});var Md=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Dd=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.videoUpdateListener=e=>{let{videoEnabled:t}=e;this.videoEnabled=t},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo},this.mediaPermissionUpdateListener=e=>{let{kind:t,message:i}=e;"video"===t&&(this.cameraPermission=i)},this.meetingPermissionsUpdateListener=e=>{var t;(null===(t=null===e||void 0===e?void 0:e.media)||void 0===t?void 0:t.video)&&(this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo)},this.variant="button",this.iconPack=pn,this.t=un(),this.videoEnabled=!1,this.canProduceVideo=!1,this.cameraPermission="NOT_REQUESTED",this.stageStatus="OFF_STAGE",this.toggleCamera=()=>{var e,t,i,r,n,s,a,o,c,l,d;if(null===(e=this.meeting)||void 0===e||e.__internals__.logger.info("rtkCameraToggle::toggleCamera",{media:{video:{enabled:Boolean(null===(i=null===(t=this.meeting)||void 0===t?void 0:t.self)||void 0===i?void 0:i.videoEnabled),permission:this.cameraPermission,canProduce:null===(s=null===(n=null===(r=this.meeting)||void 0===r?void 0:r.self)||void 0===n?void 0:n.permissions)||void 0===s?void 0:s.canProduceVideo}},webinar:{stageStatus:null===(a=this.meeting)||void 0===a?void 0:a.stage.status},livestream:{stageStatus:null===(c=null===(o=this.meeting)||void 0===o?void 0:o.stage)||void 0===c?void 0:c.status},moduleExists:{self:Boolean(null===(l=this.meeting)||void 0===l?void 0:l.self)}}),this.hasPermissionError()){const e={enabled:!0,kind:"video"};return this.stateUpdate.emit({activePermissionsMessage:e}),!1}const h=null===(d=this.meeting)||void 0===d?void 0:d.self;null!=h&&this.canProduceVideo&&(h.videoEnabled?h.disableVideo():h.enableVideo())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i,r,n,s,a;null===(e=this.meeting)||void 0===e||e.self.removeListener("videoUpdate",this.videoUpdateListener),null===(t=this.meeting)||void 0===t||t.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===(r=null===(i=this.meeting)||void 0===i?void 0:i.stage)||void 0===r||r.removeListener("stageStatusUpdate",this.stageStatusListener),null===(a=null===(s=null===(n=this.meeting)||void 0===n?void 0:n.self)||void 0===s?void 0:s.permissions)||void 0===a||a.removeListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}meetingChanged(e){var t,i;if(null!=e){const{self:r,stage:n}=e;this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo,this.cameraPermission=r.mediaPermissions.video||"NOT_REQUESTED",this.videoEnabled=r.videoEnabled,this.stageStatus=e.stage.status,r.addListener("videoUpdate",this.videoUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===n||void 0===n||n.addListener("stageStatusUpdate",this.stageStatusListener),null===(i=null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===i||i.addListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}}hasPermissionError(){return"DENIED"===this.cameraPermission||"SYSTEM_DENIED"===this.cameraPermission}getState(){let e="",t="",i="",r={},n=this.hasPermissionError(),s="COULD_NOT_START"===this.cameraPermission;return this.videoEnabled&&!n?(t=this.t("video_on"),i=this.iconPack.video_on):(t=this.t("video_off"),i=this.iconPack.video_off,r["red-icon"]=!0),e=s?this.t("perm_could_not_start.video"):"SYSTEM_DENIED"===this.cameraPermission?this.t("perm_sys_denied.video"):"DENIED"===this.cameraPermission?this.t("perm_denied.video"):this.videoEnabled?this.t("disable_video"):this.t("enable_video"),{tooltipLabel:e,label:t,icon:i,classList:r,showWarning:n||s,disable:n}}render(){var e;if(!this.meeting)return null;if(!this.canProduceVideo||"AUDIO_ROOM"===(null===(e=this.meeting)||void 0===e?void 0:e.meta.viewType)||["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus))return Z(J,{"data-hidden":!0});const{tooltipLabel:t,label:i,icon:r,classList:n,showWarning:s,disable:a}=this.getState();return Z(J,{title:i},Z("rtk-tooltip",{kind:"block",label:t,part:"tooltip"},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:n,variant:this.variant,label:i,icon:r,onClick:this.toggleCamera,showWarning:s,disabled:a})))}static get watchers(){return{meeting:["meetingChanged"]}}};Md([On()],Dd.prototype,"meeting",void 0),Md([On()],Dd.prototype,"iconPack",void 0),Md([On()],Dd.prototype,"t",void 0),Dd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var Od=Object.freeze({__proto__:null,rtk_camera_toggle:Dd});var Nd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ud=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.config=sn(),this.iconPack=pn,this.t=un(),this.captionEnabled=!1,this.permissionsUpdateListener=()=>{var e;this.captionEnabled=null!==(e=this.meeting.self.permissions.transcriptionEnabled)&&void 0!==e&&e}}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(e){e&&(this.permissionsUpdateListener(),this.meeting.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}disconnectedCallback(){var e;null===(e=this.meeting)||void 0===e||e.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}toggleCaptions(){this.stateUpdate.emit({activeCaptions:!this.states.activeCaptions,activeMoreMenu:!1})}render(){if(!this.meeting)return null;if(!this.captionEnabled)return null;const e=this.states.activeCaptions;return Z(J,{tabIndex:0,role:"log","aria-label":"Picture-in-Picture mode"},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleCaptions(),icon:e?this.iconPack.captionsOff:this.iconPack.captionsOn,label:e?this.t("transcript.off"):this.t("transcript.on"),variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"]}}};Nd([On()],Ud.prototype,"meeting",void 0),Nd([On()],Ud.prototype,"states",void 0),Nd([On()],Ud.prototype,"config",void 0),Nd([On()],Ud.prototype,"iconPack",void 0),Nd([On()],Ud.prototype,"t",void 0),Ud.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var Fd=Object.freeze({__proto__:null,rtk_caption_toggle:Ud});var jd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Bd=class{constructor(e){f(this,e),this.channelChanged=re(this,"channelChanged",7),this.iconPack=pn,this.t=un(),this.showRecentMessage=!1,this.isHidden=!1,this.searchQuery="",this.handleResize=e=>{this.isHidden=!e.matches},this.channelSelected=e=>{this.channelChanged.emit(e),this.onRevealClicked()},this.onSearchInput=e=>{this.searchQuery=e.target.value},this.onRevealClicked=()=>{this.matchMedia.matches||(this.isHidden=!this.isHidden)},this.renderChannelDisplayPic=e=>{const t=e.displayPictureUrl&&0!==e.displayPictureUrl.length;return e.isDirectMessage||t?Z("div",{class:"channel-display"},Z("rtk-avatar",{participant:{name:e.displayName,picture:e.displayPictureUrl}})):Z("div",{class:"channel-display"},Z("rtk-icon",{icon:this.iconPack.people,slot:"start"}))},this.renderRecentMessage=e=>{if(!e.latestMessage)return Z("p",{class:"latest-msg new"},this.t("chat.start_conversation"));let t=e.isDirectMessage?"":"".concat(e.latestMessage.displayName,": ");if("text"===e.latestMessage.type)return Z("p",{class:"latest-msg"},t,Z(nc,{message:e.latestMessage.message}));let i="";return"image"===e.latestMessage.type?i=this.t("image"):"file"===e.latestMessage.type&&(i=this.t("file")),Z("p",{class:"latest-msg"},"".concat(t).concat(i))}}connectedCallback(){this.matchMedia=window.matchMedia("(orientation: landscape) and (min-width: 400px)"),this.matchMedia.addEventListener("change",this.handleResize),this.isHidden=!this.matchMedia.matches}disconnectedCallback(){this.matchMedia.removeEventListener("change",this.handleResize)}componentDidRender(){this.$el.style.transform=this.isHidden?"translateX(-380px)":"translateX(0)"}getTimeLabel(e){const t=e.time,i=new Date,r=new Date(i);r.setDate(i.getDate()-1);const n=new Date(i);if(n.setDate(i.getDate()-i.getDay()-1),t.toDateString()===i.toDateString())return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(t.toDateString()===r.toDateString())return this.t("date.yesteday");if(t>n){const e=["date.sunday","date.monday","date.tuesday","date.wednesday","date.thursday","date.friday","date.saturday"];return this.t(e[t.getDay()])}return Intl.DateTimeFormat([],{day:"2-digit",month:"2-digit",year:"2-digit"}).format(t)}render(){return Z(J,{key:"5a2393ac0ac3f67bfae1acf2ec06c2e3ced317f7"},Z("div",{key:"73361a84f8078584b80bca96f1f1f9c9f04d74b9",class:"container",ref:e=>this.$el=e},this.isHidden&&Z("rtk-button",{key:"ea1f4caf8e5e7aeb633cdec506952fad6f168900",kind:"icon",variant:"ghost",size:"md",onClick:this.onRevealClicked,class:"sidebar-btn"},Z("rtk-icon",{key:"165420751ca42a7fe1040152bae366964e2dfe9f",icon:this.isHidden?this.iconPack.chevron_left:this.iconPack.dismiss})),Z("slot",{key:"4a04c6acd67fd6a243e66cbadfb527f70c95c416",name:"header"}),Z("div",{key:"d994d7c80ddab2ab5d87e8b7bfbaf24283f400f6",class:"search-wrapper"},Z("div",{key:"6d3c72ccf0576bb1c682c9b687fd769f8720501a",class:"search"},Z("input",{key:"65eaf233392c435772a3a2da1a33f819e4760f66",type:"search",autocomplete:"off",placeholder:this.t("chat.search_conversations"),onInput:this.onSearchInput}),Z("rtk-icon",{key:"c70df6fb76af5815837461f4f9382631acc8f336",icon:this.iconPack.search,class:"search-icon"}))),Z("div",{key:"9b298879a017f3ac5c0919ec5869cb644839c31f",class:"channel-container scrollbar",role:"list"},this.channels.filter(e=>""===this.searchQuery||e.displayName.includes(this.searchQuery)).map(e=>Z("div",{class:{channel:!0,selected:e.id===this.selectedChannelId,highlight:!!e.unreadCount},role:"listitem",onClick:()=>{this.channelSelected(e.id)}},this.renderChannelDisplayPic(e),Z("div",{class:"channel-card","is-direct-message":e.isDirectMessage},Z("div",{class:"recent-message-row"},Z("span",{class:"channel-name"},e.displayName),e.latestMessage&&Z("span",{class:"latest-msg-time"},this.getTimeLabel(e.latestMessage))),Z("div",{class:"recent-message-row"},this.renderRecentMessage(e),e.unreadCount>0&&e.id!==this.selectedChannelId?Z("span",{class:"new-msgs-count"},e.unreadCount<99?e.unreadCount:"99+"):null)))))),!this.isHidden&&Z("div",{key:"3d760da990293e4ed28a2408d9db7987012c2bd4",class:"overlay-container"},Z("rtk-button",{key:"ae83483508d71df77f4de75a92d99b89d148eefe",kind:"icon",variant:"ghost",size:"md",onClick:this.onRevealClicked,class:"sidebar-btn"},Z("rtk-icon",{key:"482ab05f50c151ee956611db128cdd197df6ad11",icon:this.isHidden?this.iconPack.chevron_left:this.iconPack.dismiss}))))}};jd([On()],Bd.prototype,"iconPack",void 0),jd([On()],Bd.prototype,"t",void 0),Bd.style=".scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex}.container{display:flex;height:100%;width:var(--rtk-space-96, 384px);flex-direction:column;position:absolute;--tw-translate-x:calc(var(--rtk-space-96, 384px) * -1);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-sm, 1px);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-right-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-border-opacity));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}@keyframes fade{0%{opacity:0}100%{opacity:1}}.overlay-container{width:100vw;--tw-translate-x:var(--rtk-space-96, 384px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;animation:fade 0.8s}.overlay-container .sidebar-btn{position:static;padding:var(--rtk-space-4, 16px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.sidebar-btn{position:absolute;right:calc(var(--rtk-space-9, 36px) * -1);top:var(--rtk-space-4, 16px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-7, 28px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-sm, 4px)}@media (orientation: landscape) and (min-width: 400px){.container{position:static;--tw-translate-x:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sidebar-btn,.overlay-container{display:none}}.search-wrapper{display:flex;align-items:center;gap:var(--rtk-space-2, 8px);padding:var(--rtk-space-2, 8px);border-left-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-border-opacity))}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);height:var(--rtk-space-8, 32px);width:100%}.search .search-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);padding:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));border-top-right-radius:var(--rtk-border-radius-sm, 4px);border-bottom-right-radius:var(--rtk-border-radius-sm, 4px)}.search input{box-sizing:border-box;width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;font-size:14px;line-height:1.25rem}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input{border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px)}.channel-container{box-sizing:border-box;display:flex;flex-direction:column;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);overflow-y:scroll}.channel-container .channel{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px);border-left-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-border-opacity))}.channel-container .channel:hover{cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}.channel-container .channel:hover .latest-msg-time,.channel-container .channel:hover .latest-msg,.channel-container .channel:hover .latest-msg.new{color:rgb(var(--rtk-colors-text-on-brand-700, var(--rtk-colors-text-700, 255 255 255 / 0.64)))}.channel-container .channel-display{display:flex;gap:var(--rtk-space-2, 8px);align-self:center;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-0, 0px)}.channel-container .channel-display rtk-avatar{height:var(--rtk-space-9, 36px);width:var(--rtk-space-9, 36px);flex-shrink:0;font-size:12px}.channel-container .channel-display rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);flex-shrink:0;padding:var(--rtk-space-2, 8px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.channel-container .channel-card{width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-1, 4px)}.channel-container .channel-card .channel-name{max-width:var(--rtk-space-60, 240px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500}.channel-container .channel-card .latest-msg{margin:var(--rtk-space-0, 0px);max-width:var(--rtk-space-56, 224px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.channel-container .channel-card .latest-msg.new{font-weight:200;font-style:italic;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.channel-container .channel-card .latest-msg-time{font-size:12px;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.channel-container .channel-meta{width:var(--rtk-space-12, 48px);display:flex;flex-direction:column;align-items:flex-end;justify-content:space-between;gap:var(--rtk-space-1\\.5, 6px);font-size:12px;font-weight:600}.channel-container .new-msgs-count{height:var(--rtk-space-4, 16px);min-width:var(--rtk-space-4, 16px);padding-top:1px;padding-bottom:1px;padding-left:2px;padding-right:2px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:var(--rtk-border-radius-sm, 4px);text-align:center;font-size:12px}.channel-container .selected{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}.channel-container .selected .latest-msg-time,.channel-container .selected .latest-msg,.channel-container .selected .latest-msg.new{color:rgb(var(--rtk-colors-text-on-brand-700, var(--rtk-colors-text-700, 255 255 255 / 0.64)))}.channel-container .highlight .channel-title span{font-weight:700}.latest-msg p{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-1, 4px);display:inline-block}.latest-msg blockquote{display:none}.recent-message-row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;justify-content:space-between}";var Vd=Object.freeze({__proto__:null,rtk_channel_selector_ui:Bd});var zd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Hd="@",$d=class{constructor(e){f(this,e),this.onNewMessage=re(this,"rtkNewMessage",7),this.onEditMessage=re(this,"rtkEditMessage",7),this.onEditCancelled=re(this,"rtkEditCancelled",7),this.canSendTextMessage=!1,this.canSendFiles=!1,this.iconPack=pn,this.t=un(),this.disableEmojiPicker=!1,this.prefill={},this.members=[],this.emojiPickerActive=!1,this.mentionQuery="",this.focusedMemberIndex=0,this.filePreview=null,this.fileReader=new FileReader,this.fileToUpload=null,this.handleKeyDown=e=>{if(e.key===Hd&&[void 0," "].includes(this.$textArea.value.at(-1))&&(this.mentionQuery=Hd),"ArrowDown"===e.key&&(this.focusedMemberIndex=Math.min(this.focusedMemberIndex+1,this.getFilteredMembers().length-1)),"ArrowUp"===e.key&&(this.focusedMemberIndex=Math.max(0,this.focusedMemberIndex-1)),("Escape"===e.key||"Backspace"===e.key&&this.mentionQuery===Hd)&&(this.mentionQuery=""),["Enter","Tab"," "].includes(e.key)&&""!==this.mentionQuery){const t=this.getFilteredMembers()[this.focusedMemberIndex];return this.onMemberSelect(t),void e.preventDefault()}if("Enter"===e.key&&e.shiftKey){this.$textArea.clientHeight<200&&(this.$textArea.style.height=this.$textArea.clientHeight+20+"px")}else"Enter"===e.key?(e.preventDefault(),this.prefill.editMessage?this.handleEditMessage():this.handleSendMessage()):"Backspace"===e.key&&(this.$textArea.value.endsWith("\n")?this.$textArea.style.height=this.$textArea.clientHeight-20+"px":""===this.$textArea.value&&(this.$textArea.style.height="auto"))},this.handleKeyUp=e=>{if(""!==this.mentionQuery){const e=ts(this.$textArea.value.trim()),t=e.substring(0,e.indexOf(Hd));this.mentionQuery="".concat(Hd).concat(ts(t))}},this.onPaste=e=>{const t=e.clipboardData||e.originalEvent.clipboardData;M(()=>{t&&t.items&&t.items.length>0&&(Jn(t.items,this.generateFilePreview),this.$textArea.value="")})},this.generateFilePreview=(e,t)=>{this.fileToUpload={type:e,image:t,file:t},"image"===e?this.fileReader.readAsDataURL(t):"file"===e&&(this.filePreview=t.name)},this.sendFile=()=>{this.canSendFiles&&("image"===this.fileToUpload.type?this.onNewMessage.emit({type:"image",file:this.fileToUpload.image,image:this.fileToUpload.image}):this.onNewMessage.emit({type:"file",file:this.fileToUpload.file}),this.cleanUpFileUpload())},this.handleSendMessage=()=>{if(!this.canSendTextMessage)return;if(null!==this.fileToUpload)return void this.sendFile();const e=this.$textArea.value.trim();e.length>0&&(this.prefill.replyMessage?this.onNewMessage.emit({type:"text",message:e,replyTo:this.prefill.replyMessage}):this.onNewMessage.emit({type:"text",message:e}),this.cleanup())},this.cleanup=()=>{this.mentionQuery="",this.focusedMemberIndex=0,this.$textArea.value="",this.$textArea.style.height="auto",mn.setItem(this.storageKey,"")},this.handleEditMessage=()=>{var e;let t=this.$textArea.value.trim();if((null===(e=this.prefill.editMessage)||void 0===e?void 0:e.message)&&as.test(this.prefill.editMessage.message)){const e=os(this.prefill.editMessage.message);t="".concat(e,"\n\n").concat(t)}this.onEditMessage.emit({id:this.prefill.editMessage.id,message:t,channelId:this.prefill.editMessage.channelId}),this.cleanup()},this.handleEditCancel=()=>{this.onEditCancelled.emit(),this.cleanup()},this.initializeTextField=e=>{this.$textArea=e;const t=mn.getItem(this.storageKey)||"";this.$textArea.value=t},this.onMemberSelect=e=>{const t=ts(this.mentionQuery),i=ts(this.$textArea.value.trim()).replace(t,"");this.$textArea.value=ts(i)+"".concat(Hd).concat(e.name," "),this.mentionQuery="",this.focusedMemberIndex=0,M(()=>this.$textArea.focus())},this.getFilteredMembers=()=>{const e=this.mentionQuery.replace(Hd,"");return this.members.filter(t=>t.name.toLowerCase().includes(e.toLowerCase()))},this.cleanUpFileUpload=()=>{this.filePreview=null,this.fileToUpload=null},this.renderSuggestedReplies=()=>{if(this.prefill.suggestedReplies&&0!==this.prefill.suggestedReplies.length)return Z("ul",{class:"suggested-replies scrollbar"},this.prefill.suggestedReplies.map(e=>Z("rtk-tooltip",{label:this.t("chat.click_to_send")},Z("li",{onClick:()=>this.onNewMessage.emit({type:"text",message:e})},e))))},this.renderMenu=()=>{if(0===this.mentionQuery.length)return;const e=this.getFilteredMembers();return 0!==e.length?Z("ul",{class:"member-list scrollbar"},e.map((e,t)=>Z("li",{class:{member:!0,selected:t===this.focusedMemberIndex},onClick:()=>this.onMemberSelect(e),ref:e=>{t===this.focusedMemberIndex&&M(()=>{e&&e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})})}},Z("rtk-avatar",{participant:{name:e.name,picture:e.picture},size:"sm"}),Z("span",null,e.name)))):void 0}}connectedCallback(){this.fileReader.onload=e=>{"string"===typeof e.target.result&&(this.filePreview=e.target.result)}}onChannelChanged(){this.mentionQuery="",this.focusedMemberIndex=0;const e=mn.getItem(this.storageKey)||"";this.$textArea.value=e,this.emojiPickerActive=!1}componentDidRender(){(this.prefill.editMessage||this.prefill.replyMessage)&&M(()=>this.$textArea.focus())}get storageKey(){return this.channelId?"rtk-text-message-".concat(this.channelId):"rtk-text-message"}uploadFile(e){const t=document.createElement("input");t.type="file","image"===e&&(t.accept="image/*"),t.onchange=t=>{const{validity:i,files:[r]}=t.target;i.valid&&this.generateFilePreview(e,r)},t.click()}renderFilePreview(){if("string"===typeof this.filePreview)return Z("div",{class:"preview-overlay"},Z("div",{class:"file-preview"},Z("rtk-tooltip",{label:this.t("chat.cancel_upload")},Z("rtk-button",{variant:"secondary",kind:"icon",onClick:this.cleanUpFileUpload},Z("rtk-icon",{icon:this.iconPack.dismiss}))),"image"===this.fileToUpload.type?Z("img",{class:"preview-image",src:this.filePreview}):Z("div",{class:"preview-file"},Z("span",null,this.filePreview))))}render(){var e;let t="";return(null===(e=this.prefill.editMessage)||void 0===e?void 0:e.message)&&(t=cs(this.prefill.editMessage.message)),Z(J,{key:"0550423a075a5e445ebae18e70213e17dd79c6ff"},this.canSendTextMessage&&this.emojiPickerActive&&Z("rtk-emoji-picker",{key:"89eaa1c1e0ae3da8fed3c203fd87a19cd5f19b8e",part:"emoji-picker",onPickerClose:()=>{this.emojiPickerActive=!1},onRtkEmojiClicked:e=>{this.$textArea.value+=e.detail,this.$textArea.focus()},t:this.t}),this.renderSuggestedReplies(),Z("slot",{key:"6da586002dff47002d856c0204dee2bbe8571236",name:"chat-addon"}),Z("slot",{key:"fa285ac5f4fb88ddcc3aa9b6a294d12b09cd94e9",name:"quote-block"}),Z("div",{key:"c71568bf5344f9fcd3be019d02ca4bf1a8a9d9b8",class:"chat-input",part:"chat-input"},this.renderMenu(),this.canSendTextMessage&&Z("textarea",{key:"ec57005f4795fefdaaba266d9e891853a5bded1f",class:"scrollbar",part:"textarea",ref:this.initializeTextField,autoFocus:!0,placeholder:this.fileToUpload?"":this.t("chat.message_placeholder"),value:t,onPaste:this.onPaste,maxLength:ls,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onInput:e=>{mn.setItem(this.storageKey,e.target.value)},disabled:!!this.filePreview}),Z("div",{key:"322d141483c79366ef59dee65a5072a6f437a64a",class:"chat-buttons",part:"chat-buttons"},Z("div",{key:"cb287e6ced3bb48f445af933a99a1f8100ac41c6",class:"left",part:"chat-buttons-left"},!this.prefill.editMessage&&this.canSendFiles&&[Z("rtk-tooltip",{key:"78c91b6a2097013f3da368086e868d2d465ec9cb",label:this.t("chat.send_file")},Z("rtk-button",{key:"278e56e0d1d012c658a74a07aece9f07fb13b486",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile("file"),title:this.t("chat.send_file")},Z("rtk-icon",{key:"f0551578a82d14a0313044c257a2cd04b8a4320e",icon:this.iconPack.attach}))),Z("rtk-tooltip",{key:"f1f658aece9261ff928f631b78545bfc2cc6b99e",label:this.t("chat.send_img")},Z("rtk-button",{key:"31e9bb3127886607cb630db538b6acdc405df324",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile("image"),title:this.t("chat.send_img")},Z("rtk-icon",{key:"66f46b7128dcbb041a2e35a5a9d61eb087aae126",icon:this.iconPack.image})))],!this.prefill.editMessage&&this.canSendTextMessage&&!this.disableEmojiPicker&&Z("rtk-tooltip",{key:"28524998014e48efa944db921c6ebaa644f7522c",label:this.t("chat.send_emoji")},Z("rtk-button",{key:"2ab4710a53f8c399b94fdf89d8b3e26ecdfb38c9",variant:"ghost",kind:"icon",class:{active:this.emojiPickerActive},title:this.t("chat.send_emoji"),onClick:()=>{this.emojiPickerActive=!this.emojiPickerActive}},Z("rtk-icon",{key:"eb26faa361adb34eb7afbd013c21a5039e32292d",icon:this.iconPack.emoji_multiple})))),!!this.filePreview&&this.renderFilePreview(),this.canSendTextMessage&&Z("div",{key:"820a5ff20514c9802d3612045f36d95d2358dcda",class:"right",part:"chat-buttons-right"},!this.prefill.editMessage&&Z("rtk-tooltip",{key:"405fb291f728f2afa6940a82cbc16777e8eba2bc",variant:"primary",label:this.t("chat.send_msg"),delay:2e3},Z("rtk-button",{key:"4bff2c0bf52fc35da61d67760d82943b4516c358",kind:"icon",onClick:()=>this.handleSendMessage(),title:this.t("chat.send_msg")},Z("rtk-icon",{key:"d5294b068fbb1e60bdccb899b7931c03e4fb9eb1",icon:this.iconPack.send}))),this.prefill.editMessage&&Z("div",{key:"995aa908ccab6ab22252d78ddefed672474f56a0",class:"edit-buttons"},Z("rtk-tooltip",{key:"2429c8023b38ba99c8e0b3a66206f719ce0e1932",variant:"secondary",label:this.t("cancel"),delay:2e3},Z("rtk-button",{key:"2fbaa972db33e50976661f4a02a3be9d67ec78fa",kind:"icon",variant:"secondary",onClick:()=>this.handleEditCancel(),title:this.t("cancel")},Z("rtk-icon",{key:"3466f90521e92efe325dec9bd7c3419f726713d8",icon:this.iconPack.dismiss}))),Z("rtk-tooltip",{key:"84af3b7940bcdeec414e42cbda84359154a19a19",variant:"primary",label:this.t("chat.update_msg"),delay:2e3},Z("rtk-button",{key:"580af6cecb00e77994e688a9bd70b63aeb1f0782",kind:"icon",onClick:()=>this.handleEditMessage(),title:this.t("chat.send_msg")},Z("rtk-icon",{key:"a6266954cfa1ffbcc6e3606bfe993e54e3f5c5ee",icon:this.iconPack.checkmark}))))))))}static get watchers(){return{channelId:["onChannelChanged"]}}};zd([On()],$d.prototype,"iconPack",void 0),zd([On()],$d.prototype,"t",void 0),$d.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.chat-input{position:relative;margin:var(--rtk-space-2, 8px);z-index:10;box-sizing:border-box;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}textarea{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));box-sizing:border-box;padding:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea::-moz-placeholder{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea::placeholder{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea{border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px);font-family:var(--rtk-font-family, sans-serif);outline:2px solid transparent;outline-offset:2px;resize:none;overflow-y:auto;border-width:var(--rtk-border-width-none, 0);border-style:none;min-height:60px;font-size:16px}.chat-buttons{border-bottom-right-radius:var(--rtk-border-radius-md, 8px);border-bottom-left-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;height:var(--rtk-space-8, 32px);align-items:center;justify-content:space-between;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.chat-buttons .left rtk-button{margin-right:var(--rtk-space-1, 4px)}.chat-buttons .left rtk-button rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.chat-buttons .right{z-index:10}.chat-buttons .right .edit-buttons{display:flex;gap:var(--rtk-space-2, 8px)}.chat-buttons>div{display:flex;align-items:center}rtk-emoji-picker{z-index:0;position:absolute;bottom:var(--rtk-space-32, 128px);border-top:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));animation:0.3s slide-up ease}@keyframes slide-up{from{transform:translateY(100%)}to{transform:translateY(0%)}}.member-list{margin:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-1, 4px);max-height:var(--rtk-space-28, 112px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);padding:var(--rtk-space-0, 0px);position:absolute;bottom:var(--rtk-space-28, 112px);list-style-type:none;overflow-y:auto;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-sm, 4px);--tw-border-spacing-x:var(--rtk-space-2, 8px);--tw-border-spacing-y:var(--rtk-space-2, 8px);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-style:solid;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.member-list .member{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-4, 16px);cursor:pointer}.member-list .member rtk-avatar{flex-shrink:0;height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);font-size:14px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.member-list .member span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.member-list .member:hover,.member-list .member.selected{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.suggested-replies{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-3, 12px);display:flex;flex-wrap:nowrap;gap:var(--rtk-space-2, 8px);list-style-type:none;overflow-x:auto}.suggested-replies rtk-tooltip{flex-shrink:0}.suggested-replies li{padding:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-md, 8px);background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.75);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));cursor:pointer}.suggested-replies li:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity))}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-md, 8px)}.file-preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.file-preview:hover rtk-tooltip{display:block}.file-preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.file-preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.file-preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}@keyframes scroll-text{0%{transform:translateX(0%)}70%{transform:translateX(-100%)}80%{transform:translateX(0%)}100%{transform:translateX(0%)}}";var Gd=Object.freeze({__proto__:null,rtk_chat_composer_ui:$d});var Wd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const qd=class{constructor(e){f(this,e),this.groupChanged=re(this,"rtkChatGroupChanged",7),this.unreadCounts={},this.groups=[],this.iconPack=pn,this.t=un(),this.showParticipantsPanel=!1,this.query="",this.onScopeClick=e=>{this.showParticipantsPanel=!1,this.groupChanged.emit(e)}}toggleParticipants(){this.showParticipantsPanel=!this.showParticipantsPanel}getGroups(){return this.groups.filter(e=>e.name.toLowerCase().includes(this.query.toLowerCase()))}getName(){if(!this.selectedGroupId||"everyone"===this.selectedGroupId)return this.t("everyone");const e=this.groups.find(e=>e.userId===this.selectedGroupId);return e?e.name:this.t("everyone")}render(){const e=Object.keys(this.unreadCounts).reduce((e,t)=>e+this.unreadCounts[t],0);return Z(J,null,Z("div",{class:"chat-scope-selector"},this.showParticipantsPanel&&Z("div",{class:"participants-container"},Z("div",{class:"search",part:"search"},Z("rtk-icon",{icon:this.iconPack.search,part:"search-icon"}),Z("input",{type:"search",autocomplete:"off",placeholder:this.t("search"),value:this.query,onInput:e=>{this.query=e.target.value},part:"search-input"})),Z("ul",{class:"scope-list scrollbar"},""===this.query&&Z("li",{class:"scope scope-special",onClick:()=>this.onScopeClick("everyone")},Z("div",{class:"everyone-icon"},Z("rtk-icon",{icon:this.iconPack.participants})),this.t("everyone"),this.unreadCounts.everyone>0&&Z("div",{class:"unread-count",part:"unread-count"},Z("span",null,this.unreadCounts.everyone))),this.getGroups().map(e=>{const t=this.unreadCounts[Yn([this.selfUserId,e.userId])];return Z("li",{class:"scope",onClick:()=>this.onScopeClick(e),key:e.userId},e.name,t>0&&Z("div",{class:"unread-count",part:"unread-count"},Z("span",null,t)))}))),Z("button",{onClick:()=>this.toggleParticipants()},Z("span",null,"".concat(this.t("to")," ").concat(this.getName())," ",e>0&&Z("div",{class:"unread-count selector"},Z("span",null,e))),Z("rtk-icon",{icon:this.showParticipantsPanel?this.iconPack.chevron_up:this.iconPack.chevron_down}))))}};Wd([On()],qd.prototype,"iconPack",void 0),Wd([On()],qd.prototype,"t",void 0),qd.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;flex-direction:column}.chat-scope-selector{position:relative;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));z-index:10}.chat-scope-selector button{width:100%;border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-4, 16px);display:flex;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;cursor:pointer;height:var(--rtk-space-12, 48px)}.chat-scope-selector button span{display:flex;align-items:center;justify-content:flex-start}.chat-scope-selector button rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.chat-scope-selector .search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));margin-left:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-3, 12px);margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-0, 0px)}.chat-scope-selector .search rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.chat-scope-selector .search input{box-sizing:border-box;height:var(--rtk-space-9, 36px);width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.chat-scope-selector .search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat-scope-selector .search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat-scope-selector .participants-container{position:absolute;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));top:var(--rtk-space-12, 48px);animation:0.3s slide-down ease}@keyframes slide-down{from{transform:translateY(-50px)}to{transform:translateY(0%)}}.chat-scope-selector .scope-list{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);list-style-type:none;padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px);overflow:auto;max-height:375px}.chat-scope-selector .scope-list .scope{position:relative;display:flex;flex-direction:row;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px)}.chat-scope-selector .scope-list .scope:hover{cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.chat-scope-selector .scope-list .scope-special{margin-top:var(--rtk-space-4, 16px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat-scope-selector .scope-list .everyone-icon>rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.chat-scope-selector .scope-list .everyone-icon{display:flex;height:100%;width:100%;align-items:center;justify-content:center;margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px}.unread-count.selector{position:unset;margin-left:var(--rtk-space-2, 8px)}.unread-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}rtk-avatar{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px)}";var Kd=Object.freeze({__proto__:null,rtk_chat_selector_ui:qd});const Zd=e=>{if(e&&!e.chat)return!1;const{chatPublic:t,chatPrivate:i}=e.self.permissions;return t.canSend||t.canReceive||t.text||t.files||i.canSend||i.canReceive||i.files||i.text},Yd=e=>{if(e&&!e.polls)return!1;const{polls:t}=e.self.permissions;return t.canCreate||t.canView||t.canVote},Jd=e=>{var t;if(!(null===(t=e.self.permissions)||void 0===t?void 0:t.showParticipantList))return!1;if(e&&!e.participants)return!1;const i=null===e||void 0===e?void 0:e.self.config;return!(i&&!i.controlBar.elements.participants)},Qd=e=>{if(nt(e))return!1;if(e&&!e.plugins)return!1;if("LIVESTREAM"===e.meta.viewType)return"ON_STAGE"===e.stage.status;const{plugins:t}=e.self.permissions;return t.canClose||t.canStart};var Xd=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const eh=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.unreadMessageCount=0,this.variant="button",this.iconPack=pn,this.t=un(),this.chatActive=!1,this.canViewChat=!1,this.hasNewMessages=!1,this.onChatUpdate=e=>{let{action:t,message:i}=e;var r;this.chatActive||"add"===t&&i.userId!==(null===(r=this.meeting)||void 0===r?void 0:r.self.userId)&&(this.hasNewMessages=!0,this.unreadMessageCount+=1)},this.toggleChat=()=>{const e=this.states;this.chatActive=!((null===e||void 0===e?void 0:e.activeSidebar)&&"chat"===(null===e||void 0===e?void 0:e.sidebar)),this.chatActive&&(this.unreadMessageCount=0,this.hasNewMessages=!1),this.stateUpdate.emit({activeSidebar:this.chatActive,sidebar:this.chatActive?"chat":void 0,activeMoreMenu:!1,activeAI:!1})},this.updateCanView=()=>{this.canViewChat=Zd(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var e,t,i,r,n,s;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.chat)||void 0===t||t.removeListener("chatUpdate",this.onChatUpdate),null===(r=null===(i=this.meeting)||void 0===i?void 0:i.stage)||void 0===r||r.removeListener("stageStatusUpdate",this.updateCanView),null===(s=null===(n=this.meeting)||void 0===n?void 0:n.self)||void 0===s||s.permissions.removeListener("chatUpdate",this.updateCanView)}meetingChanged(e){var t,i,r,n,s,a,o;if(!e)return;ft(e)&&(null===(t=e.chat)||void 0===t||t.getMessages((new Date).getTime(),1,!0).then(e=>{var t;(null===(t=null===e||void 0===e?void 0:e.messages)||void 0===t?void 0:t.length)&&(this.hasNewMessages=!0)}));const c=null!==(r=null===(i=e.meta)||void 0===i?void 0:i.meetingStartedTimestamp.getTime())&&void 0!==r?r:0,l=null===(n=e.chat)||void 0===n?void 0:n.messages.filter(e=>e.timeMs>c);this.unreadMessageCount=l.length||0,null===(s=e.chat)||void 0===s||s.addListener("chatUpdate",this.onChatUpdate),this.canViewChat=Zd(e),null===(a=null===e||void 0===e?void 0:e.stage)||void 0===a||a.on("stageStatusUpdate",this.updateCanView),null===(o=null===e||void 0===e?void 0:e.self)||void 0===o||o.permissions.on("chatUpdate",this.updateCanView)}statesChanged(e){null!=e&&(this.chatActive=!0===e.activeSidebar&&"chat"===e.sidebar)}handleChatActiveChange(){this.chatActive||this.states.activeSidebar||this.buttonEl.focus()}render(){return this.meeting?this.canViewChat?Z(J,{title:this.t("chat")},ft(this.meeting)?this.hasNewMessages&&Z("div",{class:"unread-count-dot",part:"unread-count-dot"}):0!==this.unreadMessageCount&&!this.chatActive&&Z("div",{class:"unread-count",part:"unread-count"},Z("span",null,this.unreadMessageCount<=100?this.unreadMessageCount:"99+")),Z("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.chatActive},onClick:this.toggleChat,icon:this.iconPack.chat,label:this.t("chat"),variant:this.variant})):Z(J,{"data-hidden":!0}):null}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],chatActive:["handleChatActiveChange"]}}};Xd([On()],eh.prototype,"meeting",void 0),Xd([On()],eh.prototype,"states",void 0),Xd([On()],eh.prototype,"iconPack",void 0),Xd([On()],eh.prototype,"t",void 0),eh.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.unread-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}.unread-count-dot{position:absolute;right:var(--rtk-space-3, 12px);z-index:10;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));border-radius:50%;display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center}:host([variant='horizontal']) .unread-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}";var th=Object.freeze({__proto__:null,rtk_chat_toggle:eh});var ih=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const rh=e=>Math.trunc(e).toString().padStart(2,"0"),nh=class{constructor(e){f(this,e),this.iconPack=pn,this.disconnectMeeting=()=>{var e,t;this.timeout&&clearTimeout(this.timeout),"number"===typeof this.request&&cancelAnimationFrame(this.request),null===(t=null===(e=this.meeting)||void 0===e?void 0:e.meta)||void 0===t||t.removeListener("meetingStartTimeUpdate",this.startedTimeUpdateListener)},this.startedTimeUpdateListener=()=>{var e,t,i;this.startedTime=null===(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.meta)||void 0===t?void 0:t.meetingStartedTimestamp)||void 0===i?void 0:i.toISOString()}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting()}meetingChanged(e){var t,i,r;this.disconnectMeeting(),null!=e&&(this.startedTime=null===(i=null===(t=e.meta)||void 0===t?void 0:t.meetingStartedTimestamp)||void 0===i?void 0:i.toISOString(),null===(r=e.meta)||void 0===r||r.addListener("meetingStartTimeUpdate",this.startedTimeUpdateListener))}startedTimeChanged(e){if(void 0!==e){const e=()=>{this.timeDiff=(Date.now()-new Date(this.startedTime).getTime())/1e3,this.timeout=setTimeout(()=>{null!=this.request&&(this.request=requestAnimationFrame(e))},500)};this.request=requestAnimationFrame(e)}}getFormattedTime(){if(null==this.timeDiff)return null;const e=this.timeDiff;let t="";return e>=3600&&(t="".concat(rh(e/3600),":")),t+="".concat(rh(e%3600/60),":").concat(rh(e%60)),t}render(){const e=void 0!==this.startedTime;return Z(J,{key:"23a8a2e6c14a8c1d1dd70dce26df45f1a302f085","data-hidden":!e,tabIndex:0,role:"timer","aria-live":"off"},void 0!==this.startedTime&&[Z("rtk-icon",{key:"914bd75f8e3a14df602bbb58b2c2d75b26f7cb27",icon:this.iconPack.clock,"aria-hidden":!0,tabIndex:-1,part:"icon"}),Z("span",{key:"abb38cd4d3dbb3a6be06d1bf98b082c42551af2c",part:"text"},this.getFormattedTime())])}static get watchers(){return{meeting:["meetingChanged"],startedTime:["startedTimeChanged"]}}};ih([On()],nh.prototype,"meeting",void 0),ih([On()],nh.prototype,"iconPack",void 0),nh.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;align-items:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-variant-numeric:tabular-nums}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";var sh=Object.freeze({__proto__:null,rtk_clock:nh});var ah=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const oh=class{constructor(e){f(this,e),this.variant="solid",this.disableRender=!1,this.config=sn(),this.iconPack=pn,this.t=un()}render(){const e={meeting:this.meeting,config:this.config,states:this.states,t:this.t,iconPack:this.iconPack,size:this.size};return Z(J,{key:"65680394a70e60ccdb25b0a872ab433610e1b8b7"},!this.disableRender&&Z(ws,{key:"244f8d28e5a18483193a8a62fabd7550c06c110d",element:"rtk-controlbar",defaults:e,onlyChildren:!0}),Z("slot",{key:"e77d170e9292b6b1c0962c196ea9232ea4372294"}))}};ah([On()],oh.prototype,"meeting",void 0),ah([On()],oh.prototype,"config",void 0),ah([On()],oh.prototype,"states",void 0),ah([On()],oh.prototype,"iconPack",void 0),ah([On()],oh.prototype,"t",void 0),oh.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;align-items:center;gap:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);position:relative;z-index:10}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host{padding-top:var(--rtk-space-0, 0px) !important}}";var ch=Object.freeze({__proto__:null,rtk_controlbar:oh});var lh=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const dh=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.t=un(),this.iconPack=pn}toggleDebugger(){var e;this.stateUpdate.emit({activeDebugger:!(null===(e=this.states)||void 0===e?void 0:e.activeDebugger),activeMoreMenu:!1})}render(){return Z(J,{key:"5675d28a2da23df6c54e79827b0adf37ef128cd9",title:this.t("Troubleshooting")},Z("rtk-controlbar-button",{key:"b8e16bbfb77fe9c4d50e872ed4eaecf351816a98",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleDebugger(),icon:this.iconPack.debug,label:this.t("Troubleshooting"),variant:this.variant}))}};lh([On()],dh.prototype,"meeting",void 0),lh([On()],dh.prototype,"states",void 0),lh([On()],dh.prototype,"t",void 0),lh([On()],dh.prototype,"iconPack",void 0),dh.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var hh=Object.freeze({__proto__:null,rtk_debugger_toggle:dh});var uh=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ph=class{constructor(e){f(this,e),this.config=sn(),this.icon=pn,this.t=un(),this.iconPack=pn,this.message=""}connectedCallback(){this.statesChanged(this.states)}getBreakoutRoomsMessage(e){var t;let i;return"connected-meeting"===(null===e||void 0===e?void 0:e.roomLeftState)&&(i=(null===(t=this.states.activeBreakoutRoomsManager)||void 0===t?void 0:t.destinationMeetingId)===this.meeting.connectedMeetings.parentMeeting.id?"breakout_rooms.move_reason.switch_main_room":"breakout_rooms.move_reason.switch_room"),i}statesChanged(e){if(null!=e)switch(null===e||void 0===e?void 0:e.roomLeftState){case"left":this.message="ended.left";break;case"kicked":this.message="ended.kicked";break;case"disconnected":this.message="ended.disconnected";break;case"rejected":this.message="ended.rejected";break;case"connected-meeting":this.message=this.getBreakoutRoomsMessage(e);break;case"unauthorized":this.message="ended.unauthorized";break;default:this.message="ended"}}renderBreakoutRoomScreen(){return Z(J,null,Z("div",{class:"ctr",part:"container"},Z("rtk-icon",{icon:this.iconPack.breakout_rooms}),Z("p",{part:"message",class:"breakout"},this.t(this.message))))}render(){if(!this.meeting)return null;const e=this.states;return"connected-meeting"===e.roomLeftState?this.renderBreakoutRoomScreen():Z(J,null,Z("div",{class:"ctr",part:"container"},Z("rtk-logo",{meeting:this.meeting,config:this.config,part:"logo",t:this.t}),Z("p",{part:"message"},this.t(this.message)),"disconnected"===(null===e||void 0===e?void 0:e.roomLeftState)&&Z("span",{part:"description"},this.t("ended.network"))))}static get watchers(){return{states:["statesChanged"]}}};uh([On()],ph.prototype,"config",void 0),uh([On()],ph.prototype,"states",void 0),uh([On()],ph.prototype,"t",void 0),uh([On()],ph.prototype,"iconPack",void 0),uh([On()],ph.prototype,"meeting",void 0),ph.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}.rejoin-button{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-6, 24px);padding-bottom:var(--rtk-space-6, 24px);padding-left:var(--rtk-space-16, 64px);padding-right:var(--rtk-space-16, 64px)}.rejoin-icon{margin-right:var(--rtk-space-2, 8px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p.breakout{font-size:20px;display:flex;flex-direction:column;align-items:center}p.breakout span{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-0, 0px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}span{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}";var gh=Object.freeze({__proto__:null,rtk_ended_screen:ph});var fh=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const mh=class{constructor(e){f(this,e),this.onDropCallback=re(this,"dropCallback",7),this.iconPack=pn,this.t=un(),this.dropzoneActivated=!1}connectedCallback(){if(!this.hostEl)throw new Error("hostEl prop is required");this.hostEl.addEventListener("dragover",e=>{e.preventDefault(),this.dropzoneActivated=!0}),this.hostEl.addEventListener("dragleave",()=>{this.dropzoneActivated=!1}),this.hostEl.addEventListener("drop",e=>{e.preventDefault(),this.dropzoneActivated=!1,this.onDropCallback.emit(e)})}render(){return Z(J,{key:"b48025cbb3461f9eb95eb3731d3cf0e0b7c370c7"},Z("div",{key:"00112e25f54a6b0a1c66530abcf232bf553d02d2",id:"dropzone",class:{active:this.dropzoneActivated},part:"dropzone"},Z("rtk-icon",{key:"57b13d941c10854e3144d6107135e610734ed9f1",icon:this.iconPack.attach}),Z("p",{key:"5f803ce1f2938255b865a6b905658463f6870060"},this.t("chat.send_attachment"))))}};fh([On()],mh.prototype,"iconPack",void 0),fh([On()],mh.prototype,"t",void 0),mh.style="#dropzone{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:10;display:none;flex-direction:column;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}#dropzone.active{display:flex;animation:0.2s slide-up ease-in}";var vh=Object.freeze({__proto__:null,rtk_file_dropzone:mh}),bh="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof i.g?i.g:"undefined"!==typeof self?self:{};var kh=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},yh="object"==typeof bh&&bh&&bh.Object===Object&&bh,wh="object"==typeof self&&self&&self.Object===Object&&self,Sh=yh||wh||Function("return this")(),xh=Sh,Eh=function(){return xh.Date.now()},Th=/\s/;var _h=function(e){for(var t=e.length;t--&&Th.test(e.charAt(t)););return t},Ph=_h,Ch=/^\s+/;var Ah=function(e){return e?e.slice(0,Ph(e)+1).replace(Ch,""):e},Rh=Sh.Symbol,Lh=Rh,Ih=Object.prototype,Mh=Ih.hasOwnProperty,Dh=Ih.toString,Oh=Lh?Lh.toStringTag:void 0;var Nh=function(e){var t=Mh.call(e,Oh),i=e[Oh];try{e[Oh]=void 0;var r=!0}catch(s){}var n=Dh.call(e);return r&&(t?e[Oh]=i:delete e[Oh]),n},Uh=Object.prototype.toString;var Fh=Nh,jh=function(e){return Uh.call(e)},Bh=Rh?Rh.toStringTag:void 0;var Vh=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Bh&&Bh in Object(e)?Fh(e):jh(e)},zh=function(e){return null!=e&&"object"==typeof e};var Hh=Ah,$h=kh,Gh=function(e){return"symbol"==typeof e||zh(e)&&"[object Symbol]"==Vh(e)},Wh=/^[-+]0x[0-9a-f]+$/i,qh=/^0b[01]+$/i,Kh=/^0o[0-7]+$/i,Zh=parseInt;var Yh=kh,Jh=Eh,Qh=function(e){if("number"==typeof e)return e;if(Gh(e))return NaN;if($h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Hh(e);var i=qh.test(e);return i||Kh.test(e)?Zh(e.slice(2),i?2:8):Wh.test(e)?NaN:+e},Xh=Math.max,eu=Math.min;var tu=function(e,t,i){var r,n,s,a,o,c,l=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var i=r,s=n;return r=n=void 0,l=t,a=e.apply(s,i)}function g(e){var i=e-c;return void 0===c||i>=t||i<0||h&&e-l>=s}function f(){var e=Jh();if(g(e))return m(e);o=setTimeout(f,function(e){var i=t-(e-c);return h?eu(i,s-(e-l)):i}(e))}function m(e){return o=void 0,u&&r?p(e):(r=n=void 0,a)}function v(){var e=Jh(),i=g(e);if(r=arguments,n=this,c=e,i){if(void 0===o)return function(e){return l=e,o=setTimeout(f,t),d?p(e):a}(c);if(h)return clearTimeout(o),o=setTimeout(f,t),p(c)}return void 0===o&&(o=setTimeout(f,t)),a}return t=Qh(t)||0,Yh(i)&&(d=!!i.leading,s=(h="maxWait"in i)?Xh(Qh(i.maxWait)||0,t):s,u="trailing"in i?!!i.trailing:u),v.cancel=function(){void 0!==o&&clearTimeout(o),l=0,r=c=n=o=void 0},v.flush=function(){return void 0===o?a:m(Jh())},v};function iu(e,t){const i=Math.pow(10,t);return Math.floor(e*i)/i}function ru(e){let{dimensions:t,count:i,aspectRatio:r,gap:n}=e;const{width:s,height:a,rows:o,cols:c}=function(e){let{count:t,dimensions:i,aspectRatio:r,gap:n}=e,{width:s,height:a}=i;if(0===s||0===a)return{width:0,height:0,rows:1,cols:1};s-=2*n,a-=2*n;const o=n,c=t,l=nu(r);let d=0,h=0,u=1,p=1;const g=[];for(let f=1;f<=c;f++)g.push((s-o*(f-1))/f),g.push((a-o*(f-1))/(f*l));g.sort((e,t)=>t-e);for(const f of g)if(d=iu(f,4),h=iu(d*l,4),u=Math.floor((s+o)/(d+o)),p=Math.floor((a+o)/(h+o)),u*p>=c){p=Math.ceil(c/u);break}return{width:d,height:h,rows:p,cols:u}}({dimensions:t,count:i,aspectRatio:r,gap:n}),l=function(e){let{parentDimensions:t,dimensions:i,rows:r,cols:n,count:s,gap:a}=e;const{width:o,height:c}=t,{width:l,height:d}=i,h=(c-(d*r+(r-1)*a))/2;let u=(o-(l*n+(n-1)*a))/2;const p=d+a,g=l+a;let f=0,m=0;const v=s%n;function b(e){const t=s-e;t===v&&(u=(o-(l*t+(t-1)*a))/2);const i=h+m*p,r=u+f*g;return f++,(e+1)%n===0&&(m++,f=0),{top:i,left:r}}return b}({parentDimensions:t,dimensions:{width:s,height:a},rows:o,cols:c,count:i,gap:n});return{width:s,height:a,getPosition:l}}const nu=e=>{const[t,i]=e.split(":");return Number.parseInt(i)/Number.parseInt(t)},su={spotlight:"sm",mixed:"sm"};var au=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ou=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.hideSelf=!1,this.participants=[],this.pinnedParticipants=[],this.screenShareParticipants=[],this.plugins=[],this.emptyStage=!1,this.showLiveStreamPlayer=!1,this.canCurrentPeerHost=!1,this.pipSupported=!1,this.pipEnabled=!1,this.hidden=!1,this.layout="row",this.aspectRatio="16:9",this.gap=8,this.config=sn(),this.iconPack=pn,this.t=un(),this.gridSize=su,this.overrides={},this.invalidRoomStates=["init","waitlisted","ended","kicked","rejected"],this.filterParticipants=e=>{var t;if(this.overrides&&(null===(t=this.overrides)||void 0===t?void 0:t.videoUnsubscribed)){const t=this.overrides.videoUnsubscribed.preset;t.length>0&&(e=e.filter(e=>!t.some(t=>void 0!==e.presetName&&e.presetName.match(t))))}return e},this.onViewModeChanged=()=>{this.meeting&&this.updateActiveParticipants()},this.onParticipantJoined=tu(()=>{this.updateActiveParticipants()},50),this.onParticipantLeft=tu(()=>{this.updateActiveParticipants()},50),this.stageStatusListener=()=>{this.updateActiveParticipants(),this.showLiveStreamPlayer=nt(this.meeting),"ON_STAGE"!==this.meeting.stage.status&&this.removeScreenShare(this.meeting.self)},this.peerStageStatusListener=e=>{this.updateActiveParticipants(),"ON_STAGE"!==this.meeting.stage.status&&(this.removePinned(e),this.removeScreenShare(e))},this.onScreenShareUpdate=e=>{e.screenShareEnabled?this.addScreenShare(e):this.removeScreenShare(e)},this.onSelfScreenShareUpdate=e=>{let{screenShareEnabled:t}=e;t?this.addScreenShare(this.meeting.self):this.removeScreenShare(this.meeting.self)},this.toggleTileListener=e=>{let{hidden:t}=e;this.hidden=t,this.updateActiveParticipants()},this.onPluginStateUpdate=(e,t)=>{let{active:i}=t;i?this.plugins.some(t=>t.id===e.id)||(this.plugins=[...this.plugins,e]):this.plugins=this.plugins.filter(t=>t.id!==e.id)},this.onParticipantPinned=()=>{this.updateActiveParticipants()},this.onParticipantUnpinned=()=>{this.updateActiveParticipants()},this.updateRoomStateListener=()=>{this.roomState=this.meeting.self.roomState}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}disconnectMeeting(e){var t;if(!e)return;this.participants=[],this.plugins=[];const{self:i,participants:r,plugins:n}=e;i.removeListener("pinned",this.onParticipantPinned),i.removeListener("unpinned",this.onParticipantUnpinned),i.removeListener("roomLeft",this.updateRoomStateListener),i.removeListener("roomJoined",this.updateRoomStateListener),i.removeListener("screenShareUpdate",this.onSelfScreenShareUpdate),i.removeListener("toggleTile",this.toggleTileListener),null===n||void 0===n||n.all.removeListener("stateUpdate",this.onPluginStateUpdate),null===(t=e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.stageStatusListener),r.removeListener("viewModeChanged",this.onViewModeChanged),r.active.removeListener("participantLeft",this.onParticipantLeft),r.active.removeListener("participantJoined",this.onParticipantJoined),r.pinned.removeListener("participantJoined",this.onParticipantPinned),r.pinned.removeListener("participantLeft",this.onParticipantUnpinned),r.joined.removeListener("screenShareUpdate",this.onScreenShareUpdate),r.joined.removeListener("stageStatusUpdate",this.peerStageStatusListener)}meetingChanged(e,t){var i,r,n,s;if(null!==t&&this.disconnectMeeting(t),null!=e){const{self:t,participants:a,plugins:o,stage:c}=e;this.pipSupported=(null===(i=this.meeting.participants.pip)||void 0===i?void 0:i.isSupported())&&(null===(r=e.self.config)||void 0===r?void 0:r.pipMode),this.pipSupported&&this.meeting.participants.pip.init();const{permissions:l}=t;this.roomState=t.roomState;const d="ON_STAGE"!==this.meeting.stage.status,h=null===l||void 0===l?void 0:l.isRecorder;this.hideSelf=d||h||l.hiddenParticipant,this.participants=this.filterParticipants([...a.active.toArray(),...t.isPinned||this.hideSelf?[]:[t]]),this.pinnedParticipants=[...a.pinned.toArray(),...t.isPinned&&!this.hideSelf?[t]:[]],this.screenShareParticipants=a.joined.toArray().filter(e=>e.screenShareEnabled),this.plugins=(null===o||void 0===o?void 0:o.active.toArray())||[],(null===l||void 0===l?void 0:l.stageEnabled)&&(this.canCurrentPeerHost=l.acceptStageRequests||l.canPresent,this.updateStage()),this.hidden=e.self.hidden,t.addListener("roomLeft",this.updateRoomStateListener),t.addListener("roomJoined",this.updateRoomStateListener),t.addListener("screenShareUpdate",this.onSelfScreenShareUpdate),t.addListener("pinned",this.onParticipantPinned),t.addListener("unpinned",this.onParticipantUnpinned),t.addListener("toggleTile",this.toggleTileListener),null===c||void 0===c||c.addListener("stageStatusUpdate",this.stageStatusListener),null===o||void 0===o||o.all.addListener("stateUpdate",this.onPluginStateUpdate),a.addListener("viewModeChanged",this.onViewModeChanged),a.active.addListener("participantLeft",this.onParticipantLeft),null===(n=null===a||void 0===a?void 0:a.joined)||void 0===n||n.on("stageStatusUpdate",this.peerStageStatusListener),a.joined.addListener("screenShareUpdate",this.onScreenShareUpdate),a.active.addListener("participantJoined",this.onParticipantJoined),a.pinned.addListener("participantJoined",this.onParticipantPinned),a.pinned.addListener("participantLeft",this.onParticipantUnpinned),(null===(s=e.stage)||void 0===s?void 0:s.status)&&this.stageStatusListener()}}overridesChanged(e){this.updateActiveParticipants()}screenShareParticipantsChanged(e){const t=e.length>0;!!this.states.activeScreenShare!==t&&(this.stateUpdate.emit({activeScreenShare:t}),this.states.activeScreenShare=t)}pluginsChanged(e){const t=e.length>0;!!this.states.activePlugin!==t&&(this.stateUpdate.emit({activePlugin:t}),this.states.activePlugin=t)}pinnedParticipantsChanged(e){const t=e.length>0;!!this.states.activeSpotlight!==t&&(this.stateUpdate.emit({activeSpotlight:t}),this.states.activeSpotlight=t)}updateActiveParticipants(){var e;const{self:t,participants:i,stage:r}=this.meeting;this.hideSelf=this.hidden||"ON_STAGE"!==r.status||(null===(e=t.permissions)||void 0===e?void 0:e.isRecorder)||t.permissions.hiddenParticipant,this.participants=this.filterParticipants([...i.active.toArray().filter(e=>e.id!==t.id),..."ACTIVE_GRID"!==i.viewMode||t.isPinned||this.hideSelf?[]:[t]]),this.pinnedParticipants=[...i.pinned.toArray().filter(e=>e.id!==t.id),...t.isPinned&&!this.hideSelf?[t]:[]],this.screenShareParticipants=i.joined.toArray().filter(e=>e.screenShareEnabled),t.screenShareEnabled&&(this.screenShareParticipants=this.screenShareParticipants.concat([t])),this.updateStage()}updateStage(){var e;const{self:t}=this.meeting;this.meeting&&((null===(e=null===t||void 0===t?void 0:t.permissions)||void 0===e?void 0:e.stageEnabled)?this.emptyStage=0===this.participants.length&&0===this.pinnedParticipants.length:this.emptyStage=!1)}addScreenShare(e){this.screenShareParticipants.some(t=>t.id===e.id)||(this.screenShareParticipants=[...this.screenShareParticipants,e])}removeScreenShare(e){this.screenShareParticipants=this.screenShareParticipants.filter(t=>t.id!==e.id)}removePinned(e){this.pinnedParticipants=this.pinnedParticipants.filter(t=>t.id!==e.id)}render(){const e={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return this.invalidRoomStates.includes(this.roomState)?Z(J,null,Z("div",{class:"offline-grid"},Z("rtk-icon",{icon:this.iconPack.join_stage,size:"xl"}),Z("h3",null,this.t("disconnected")),Z("p",null,this.t("disconnected.description")))):"disconnected"===this.roomState?Z(J,null,Z("div",{class:"offline-grid"},Z("rtk-icon",{icon:this.iconPack.disconnected,size:"xl"}),Z("h3",null,this.t("offline")),Z("p",null,this.t("offline.description")))):"failed"===this.roomState?Z(J,null,Z("div",{class:"offline-grid"},Z("rtk-icon",{icon:this.iconPack.disconnected,size:"xl"}),Z("h3",null,this.t("failed")),Z("p",null,this.t("failed.description")))):this.showLiveStreamPlayer?Z(J,null,Z("rtk-livestream-player",{meeting:this.meeting,size:this.size}),Z("rtk-livestream-indicator",{meeting:this.meeting,size:"sm",t:this.t}),Z("rtk-viewer-count",{meeting:this.meeting,variant:"embedded",t:this.t})):this.emptyStage?Z(J,null,Z("div",{class:"webinar-stage"},Z("div",{class:"center"},this.canCurrentPeerHost&&Z("div",{class:"ctr",part:"container"},Z("p",{class:"message",part:"message"},this.t("stage.empty_host")),Z("span",{class:"description",part:"description"},this.t("stage.empty_host_summary"))),!this.canCurrentPeerHost&&Z("div",{class:"ctr",part:"container"},Z("p",{class:"message",part:"message"},this.t("stage.empty_viewer")))))):Z(J,null,Z(ws,{element:"rtk-grid",defaults:e,childProps:{participants:this.participants,screenShareParticipants:this.screenShareParticipants,plugins:this.plugins,pinnedParticipants:this.pinnedParticipants,aspectRatio:this.aspectRatio,gap:this.gap,layout:this.layout,gridSize:this.gridSize},onlyChildren:!0}),Z("rtk-livestream-indicator",{meeting:this.meeting,size:"sm",t:this.t}),Z("rtk-viewer-count",{meeting:this.meeting,variant:"embedded",t:this.t}))}static get watchers(){return{meeting:["meetingChanged"],overrides:["overridesChanged"],screenShareParticipants:["screenShareParticipantsChanged"],plugins:["pluginsChanged"],pinnedParticipants:["pinnedParticipantsChanged"]}}};au([On()],ou.prototype,"meeting",void 0),au([On()],ou.prototype,"states",void 0),au([On()],ou.prototype,"config",void 0),au([On()],ou.prototype,"iconPack",void 0),au([On()],ou.prototype,"t",void 0),ou.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:100%;width:100%}.offline-grid{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center}.offline-grid h3{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);font-size:20px;font-weight:500;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.offline-grid p{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);text-align:center;font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.offline-grid rtk-icon{margin-bottom:var(--rtk-space-2, 8px)}.webinar-stage{box-sizing:border-box;height:100%;display:flex;align-content:center;align-items:center;justify-content:center;text-align:center}.webinar-stage h2{margin:var(--rtk-space-0, 0px);font-weight:normal}rtk-viewer-count{display:none}.ctr{display:flex;flex-direction:column;align-items:center}.message{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.description{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}rtk-livestream-indicator{display:none}@media only screen and (max-device-height: 480px) and (orientation: landscape){rtk-viewer-count[variant='embedded']{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-2, 8px);z-index:20;margin-top:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0, 0px);display:flex}rtk-livestream-indicator{position:absolute;top:var(--rtk-space-0, 0px);left:var(--rtk-space-2, 8px);z-index:20;margin-top:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0, 0px);display:flex}}";var cu=Object.freeze({__proto__:null,rtk_grid:ou});var lu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const du=class{constructor(e){f(this,e),this.variant="rounded",this.iconPack=pn,this.t=un(),this.page=1,this.pageCount=0,this.activeCount=0,this.activeComputedCount=0,this.showPagination=!1,this.onPageChanged=e=>{let{currentPage:t,pageCount:i}=e;this.pageCount=i,this.page=t},this.toggleGridPagination=tu(()=>{var e;const{self:t,participants:i}=this.meeting,{mobile:r,desktop:n}=null===(e=t.config)||void 0===e?void 0:e.maxVideoStreams,s="sm"===this.size?r:n,a=i.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus).length;this.showPagination=!(a{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},50),this.onParticipantLeave=tu(()=>{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},50),this.onStateStatusUpdate=tu(()=>{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},50),this.prevPage=()=>{if(!this.meeting)return;const{participants:e}=this.meeting;this.page>1?e.setPage(this.page-=1):"PAGINATED"===e.viewMode&&e.setViewMode("ACTIVE_GRID")},this.nextPage=()=>{if(!this.meeting)return;const{participants:e}=this.meeting;this.page>0&&this.page0&&0===this.pageCount&&e.setViewMode("PAGINATED")}}connectedCallback(){this.meetingChanged(this.meeting),this.sizeChanged()}disconnectedCallback(){if(!this.meeting)return;const{participants:e,stage:t}=this.meeting;e.removeListener("pageChanged",this.onPageChanged),e.removeListener("viewModeChanged",this.onPageChanged),e.joined.removeListener("participantJoined",this.onParticipantJoin),e.joined.removeListener("participantLeft",this.onParticipantLeave),e.joined.removeListener("stageStatusUpdate",this.onStateStatusUpdate),t.removeListener("stageStatusUpdate",this.onStateStatusUpdate)}meetingChanged(e){if(null!=e){const{stage:t,participants:i}=e;this.page=i.currentPage,this.pageCount=i.pageCount,i.addListener("viewModeChanged",this.onPageChanged),i.addListener("pageChanged",this.onPageChanged),i.joined.addListener("participantJoined",this.onParticipantJoin),i.joined.addListener("participantLeft",this.onParticipantLeave),i.joined.addListener("stageStatusUpdate",this.onStateStatusUpdate),t.addListener("stageStatusUpdate",this.onStateStatusUpdate),this.activeCount=this.meeting.participants.joined.size,this.activeComputedCount=this.meeting.participants.joined.size,this.toggleGridPagination()}}sizeChanged(){this.toggleGridPagination()}render(){if(!this.meeting)return null;const{meta:e}=this.meeting;return"AUDIO_ROOM"===(null===e||void 0===e?void 0:e.viewType)||!this.showPagination?Z(J,{"data-hidden":!0}):Z(J,null,Z("rtk-button",{class:"prev",variant:"secondary",kind:"icon",disabled:0===this.pageCount,onClick:this.prevPage,"aria-label":this.t("page.prev")},Z("rtk-icon",{icon:this.iconPack.chevron_left})),"grid"!==this.variant&&Z("div",{class:"center"},Z("span",{class:"page"},0===this.pageCount?Z("rtk-tooltip",{label:this.t("layout.auto")},Z("rtk-button",{kind:"icon",class:"auto"},Z("rtk-icon",{icon:this.iconPack.wand}))):this.page),0!==this.pageCount&&[Z("span",{class:"slash"},"/"),Z("span",{class:"pages"},this.pageCount)]),"grid"===this.variant&&this.pageCount>0&&Z("div",{class:"dots"},[...Array(this.pageCount)].map((e,t)=>Z("div",{key:"dot-".concat(t),class:{dot:!0,active:t+1===this.page}}))),Z("rtk-button",{class:"next",variant:"secondary",kind:"icon",disabled:0!==this.page&&this.page===this.pageCount,onClick:this.nextPage,"aria-label":this.t("page.next")},Z("rtk-icon",{icon:this.iconPack.chevron_right,tabIndex:-1,"aria-hidden":!0})))}static get watchers(){return{meeting:["meetingChanged"],size:["sizeChanged"]}}};lu([On()],du.prototype,"meeting",void 0),lu([On()],du.prototype,"states",void 0),lu([On()],du.prototype,"iconPack",void 0),lu([On()],du.prototype,"t",void 0),du.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;font-size:16px}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}:host([size='sm']) .center{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px)}:host([size='sm']) rtk-button{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) rtk-button rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}rtk-button{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.center{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.center .page{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.center .slash{margin-left:var(--rtk-space-0\\.5, 2px);margin-right:var(--rtk-space-0\\.5, 2px)}.center .pages{align-self:flex-end;font-size:12px}:host([variant='rounded']){overflow:hidden;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='rounded']) rtk-button{border-radius:9999px;border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}:host([variant='rounded']) rtk-button:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='rounded']) rtk-button:not([disabled]):focus{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='grid']) rtk-button{position:absolute;top:50%;height:var(--rtk-space-20, 80px);width:var(--rtk-space-20, 80px);opacity:0.2;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}:host([variant='grid']) rtk-button:hover{opacity:1}:host([variant='grid']) rtk-button{transform:translateY(-50%)}:host([variant='grid']) rtk-button.prev{left:var(--rtk-space-0, 0px);border-top-right-radius:9999px;border-bottom-right-radius:9999px}:host([variant='grid']) rtk-button.next{right:var(--rtk-space-0, 0px);border-top-left-radius:9999px;border-bottom-left-radius:9999px}:host([variant='grid']) rtk-button.auto{left:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);border-top-right-radius:9999px;border-bottom-right-radius:9999px}:host([variant='grid']) .dots{position:absolute;left:50%;bottom:var(--rtk-space-3, 12px);display:flex;align-items:center;transform:translateX(-50%)}:host([variant='grid']) .dots .dot{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);cursor:pointer;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([variant='grid']) .dots .dot:last-child{margin-right:var(--rtk-space-0, 0px)}:host([variant='grid']) .dots .dot.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host([variant='grid'][size='sm']) rtk-button{height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);opacity:0.1}";var hu=Object.freeze({__proto__:null,rtk_grid_pagination:du});var uu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const pu=class{constructor(e){f(this,e),this.variant="solid",this.disableRender=!1,this.config=sn(),this.iconPack=pn,this.t=un()}render(){const e={meeting:this.meeting,config:this.config,states:this.states,t:this.t,iconPack:this.iconPack,size:this.size};return Z(J,{key:"1f3b7e1a0a0895e6429c12ddb44470ef35a30d23"},!this.disableRender&&Z(ws,{key:"3b1525e4f4aaac177b466e4c72be4b7492bd404f",element:"rtk-header",defaults:e,onlyChildren:!0}),Z("slot",{key:"6f770052362e6daa803638e0857de41c2c894ed3"}))}};uu([On()],pu.prototype,"meeting",void 0),uu([On()],pu.prototype,"config",void 0),uu([On()],pu.prototype,"states",void 0),uu([On()],pu.prototype,"iconPack",void 0),uu([On()],pu.prototype,"t",void 0),pu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-12, 48px);align-items:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host{display:none !important}}@media only screen and (max-height: 480px) and (orientation: landscape){:host{display:none !important}}";var gu=Object.freeze({__proto__:null,rtk_header:pu});var fu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const mu=class{constructor(e){f(this,e),this.config=sn(),this.iconPack=pn,this.t=un()}render(){return Z(J,{key:"c5eff1252dc42e20190130962994d713b95b922b"},Z("slot",{key:"99a385d737fba394bcce3340d7ceaa49fe290580"},Z("div",{key:"484cfb782b699eea5be2eac7c003dcaea922177a",class:"ctr",part:"container"},Z("rtk-logo",{key:"0e190078187680faec1df09a7a50bc80d405a978",meeting:this.meeting,config:this.config,t:this.t,part:"logo"}),Z("rtk-spinner",{key:"f00bae50ccb13120714d2d94c9629747824b5eaa","aria-label":"Idle, waiting for meeting data",part:"spinner",iconPack:this.iconPack}))))}};fu([On()],mu.prototype,"meeting",void 0),fu([On()],mu.prototype,"config",void 0),fu([On()],mu.prototype,"iconPack",void 0),fu([On()],mu.prototype,"t",void 0),mu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}rtk-spinner{height:var(--rtk-space-12, 48px);width:var(--rtk-space-12, 48px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";var vu=Object.freeze({__proto__:null,rtk_idle_screen:mu});var bu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ku=class{constructor(e){f(this,e),this.close=re(this,"close",7),this.t=un(),this.iconPack=pn,this.keypressListener=e=>{"Escape"===e.key&&this.close.emit()},this.handleOutsideClick=()=>this.close.emit()}connectedCallback(){document.addEventListener("keydown",this.keypressListener),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){document.removeEventListener("keydown",this.keypressListener),document.removeEventListener("click",this.handleOutsideClick)}render(){return Z(J,{key:"f7d65ee86716b9bea4ff1839df12647fa03bc053",class:"scrollbar",onClick:e=>e.stopPropagation()},Z("div",{key:"30715a0e1d52250815411be7a4339c47a9c050ff",class:"header"},Z("div",{key:"69bcd74cea972c9663f46549b1c62b08afd94558",class:"shared-by-user"},this.t("chat.img.shared_by")," ",Z("span",{key:"86b7f0095054d490e0a534d2c5df3733503dde72",class:"displayName"},Ln(Cn(this.image.displayName)))),Z("div",{key:"84b428b667da741f420753a0c58ef6a04169f765",class:"actions"},Z("rtk-button",{key:"dce9d2b6c6e4b7dcfb429839762a0f350dc474df",onClick:()=>Es(this.image.link,{fallbackName:"image"})},Z("rtk-icon",{key:"f9a6b1fbd5f770555ba4bc7267fff7ca6102f097",icon:this.iconPack.download,slot:"start"}),"Download"),Z("rtk-button",{key:"4051efa57da483dc628769fdd1e754a49fd389b7",kind:"icon",variant:"secondary",onClick:()=>this.close.emit()},Z("rtk-icon",{key:"ee1e43b0f89ad76c5cad6db21d6f8759c5d87a89",icon:this.iconPack.dismiss})))),Z("div",{key:"752ab0206aa1b1e9447f9814210bcaa346dfab5d",class:"image-ctr"},Z("img",{key:"7de531b58aa5aad94ab03d500d34d13c37b43ba1",src:this.image.link})))}};bu([On()],ku.prototype,"t",void 0),bu([On()],ku.prototype,"iconPack",void 0),ku.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:1140px;max-width:100%;box-sizing:border-box;display:flex;flex-direction:column;padding:var(--rtk-space-6, 24px);padding-top:var(--rtk-space-5, 20px);overflow-y:auto;color:rgb(var(--rtk-colors-text-1000, 255 255 255));z-index:40;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.displayName{font-weight:700}.image-ctr{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;justify-content:center;overflow:hidden}.actions{display:flex;align-items:center;justify-content:flex-end;gap:var(--rtk-space-2, 8px)}img{box-sizing:border-box;display:block;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}.header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--rtk-space-4, 16px)}.shared-by-user{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}:host([size='sm']) .header{flex-direction:column}:host([size='sm']) .header .actions{margin-top:var(--rtk-space-4, 16px)}";var yu=Object.freeze({__proto__:null,rtk_image_viewer:ku});const wu=class{constructor(e){f(this,e),this.iconPack=pn}render(){return Z(J,{key:"71ecafbad168eb980530eb5e524f9b243ac49fc7"},Z("div",{key:"beb675be20de89080d7fdeefb47367c5ab201a73",class:"tooltip-container"},Z("rtk-icon",{key:"8e135030eb60115c1f2a49ad71caedbd9e1b50e8",icon:this.iconPack.info,size:"sm"}),Z("div",{key:"9b4c277f0d2c9311258c24f1001bf763936adde3",class:"tooltip"},Z("slot",{key:"66c6b7895cd23271cca393cc12dc075c1bf14923",name:"tootlip-text"}))))}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],wu.prototype,"iconPack",void 0),wu.style=":host{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);cursor:pointer}.tooltip-container{position:relative;display:flex;flex-direction:row;align-items:center}.tooltip-container rtk-icon{cursor:pointer;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.tooltip-container rtk-icon:hover+.tooltip{display:flex !important}.tooltip{position:absolute;margin-left:var(--rtk-space-2, 8px);display:none !important;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);font-weight:400;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));z-index:50;display:flex;min-width:var(--rtk-space-60, 240px);flex-direction:column;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);left:14px}";var Su=Object.freeze({__proto__:null,rtk_information_tooltip:wu});var xu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Eu=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.leave=()=>{this.stateUpdate.emit({activeLeaveConfirmation:!0})}}render(){const e=this.t("leave");return Z(J,{key:"9a760243cdb8a409f96b2e44b07e84495ecf8ba6",label:e},Z("rtk-controlbar-button",{key:"5a45791756d7e448493b4968876820230d7ce81f",size:this.size,iconPack:this.iconPack,class:"leave red-icon",onClick:this.leave,icon:this.iconPack.call_end,label:e,variant:this.variant,part:"controlbar-button"}))}};xu([On()],Eu.prototype,"iconPack",void 0),xu([On()],Eu.prototype,"t",void 0),Eu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var Tu=Object.freeze({__proto__:null,rtk_leave_button:Eu});var _u=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Pu=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.apiError=re(this,"rtkApiError",7),this.variant="button",this.iconPack=pn,this.t=un(),this.livestreamState="IDLE",this.livestreamStateListener=e=>{this.livestreamState=e,"LIVESTREAMING"!==e&&"IDLE"!==e||this.stateUpdate.emit({activeMoreMenu:!1})},this.isLoading=()=>!this.meeting||"STARTING"===this.livestreamState||"STOPPING"===this.livestreamState}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.clearListeners()}meetingChanged(e){var t,i;e&&(this.livestreamState=null===(t=this.meeting.livestream)||void 0===t?void 0:t.state,null===(i=this.meeting.livestream)||void 0===i||i.on("livestreamUpdate",this.livestreamStateListener))}async toggleLivestream(){var e,t;if("LIVESTREAMING"===this.livestreamState)try{await(null===(e=this.meeting.livestream)||void 0===e?void 0:e.stop())}catch(i){this.apiError.emit({trace:this.t("livestream.stop"),message:this.t("livestream.error.stop")})}else try{await(null===(t=this.meeting.livestream)||void 0===t?void 0:t.start())}catch(r){this.apiError.emit({trace:this.t("livestream.start"),message:this.t("livestream.error.start")})}}clearListeners(){var e;null===(e=this.meeting.livestream)||void 0===e||e.removeListener("livestreamUpdate",this.livestreamStateListener)}getLivestreamLabel(){switch(this.livestreamState){case"IDLE":return this.t("livestream.go_live");case"LIVESTREAMING":return this.t("livestream.end_live");case"WAITING_ON_MANUAL_INGESTION":return this.t("livestream.waiting_on_manual_ingestion");case"STARTING":return this.t("livestream.starting");case"STOPPING":return this.t("livestream.stopping");default:return this.t("livestream.error")}}getLivestreamIcon(){switch(this.livestreamState){case"IDLE":case"WAITING_ON_MANUAL_INGESTION":return this.iconPack.start_livestream;default:return this.iconPack.stop_livestream}}render(){return this.meeting?st(this.meeting)?Z(J,null,Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,isLoading:this.isLoading(),class:{"active-livestream":"LIVESTREAMING"===this.livestreamState},onClick:()=>this.toggleLivestream(),icon:this.getLivestreamIcon(),disabled:this.isLoading(),label:this.t(this.getLivestreamLabel()),variant:this.variant})):Z(J,{"data-hidden":!0}):null}static get watchers(){return{meeting:["meetingChanged"]}}};_u([On()],Pu.prototype,"meeting",void 0),_u([On()],Pu.prototype,"iconPack",void 0),_u([On()],Pu.prototype,"t",void 0),Pu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var Cu=Object.freeze({__proto__:null,rtk_livestream_toggle:Pu});var Au=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ru=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un()}render(){var e;const t=null===(e=this.meeting)||void 0===e?void 0:e.meta.meetingTitle;return null==t?Z(J,{"data-hidden":!0}):Z(J,{role:"banner","aria-label":t},Z("rtk-tooltip",{label:t,part:"tooltip"},Z("div",{class:"title",part:"title"},t)))}};Au([On()],Ru.prototype,"meeting",void 0),Au([On()],Ru.prototype,"iconPack",void 0),Au([On()],Ru.prototype,"t",void 0),Ru.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:16px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host([data-hidden]){display:none}.title{text-align:center;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}:host([size='sm']){font-size:12px}";var Lu=Object.freeze({__proto__:null,rtk_meeting_title:Ru});const Iu=class{constructor(e){f(this,e),this.visibleItemsCount=20,this.estimateItemSize=100,this.iconPack=pn,this.isFetching=!1,this.autoScroll=!0,this.totalHeight=0,this.sizes=new Map,this.lastScrollTop=0,this.scrollToBottomRetries=0,this.elementObserver=(()=>{let e=null;const t=()=>e||("undefined"!==typeof ResizeObserver?e=new ResizeObserver(e=>{e.forEach(e=>{this.measureElement(e.target,e)})}):null);return{disconnect:()=>{var e;return null===(e=t())||void 0===e?void 0:e.disconnect()},observe:e=>{var i;return null===(i=t())||void 0===i?void 0:i.observe(e,{box:"border-box"})},unobserve:e=>{var i;return null===(i=t())||void 0===i?void 0:i.unobserve(e)}}})(),this.measureElement=(e,t)=>{if(!e)return;const i=e.dataset.id;if(this.sizes.has(i))return void this.elementObserver.unobserve(e);if(t){const r=t.borderBoxSize[0];if(r&&r.blockSize>0)return this.saveItemSize(i,r.blockSize),void this.elementObserver.unobserve(e)}const r=e.getBoundingClientRect();r.height>0&&this.saveItemSize(i,r.height)},this.getVisibleItems=()=>this.messages.slice(this.range.start,this.range.end+1),this.updateVisibleItems=(e,t)=>{const i=this.messages.length;let r=e,n=t;i<=this.visibleItemsCount?(r=0,n=i-1):t-ethis.estimateItemSize,this.getRangeSize=(e,t)=>{let i=0,r=0;for(let n=e;nthis.$listRef?Math.ceil(this.$listRef.scrollTop):0,this.getClientHeight=()=>this.$listRef?Math.ceil(this.$listRef.clientHeight):0,this.getScrollHeight=()=>this.$listRef?Math.ceil(this.$listRef.scrollHeight):0,this.getItemsScrolled=()=>{const e=this.lastScrollTop;if(e<=0)return 0;let t=0,i=0,r=0,n=this.messages.length;for(;t<=n;){if(i=t+n>>>1,r=this.getRangeSize(0,i),r===e)return i;re&&(n=i-1)}return t>0?--t:0},this.getEndByStart=e=>Math.min(e+this.visibleItemsCount,this.messages.length-1),this.scrollToOffset=e=>{this.$listRef&&(this.$listRef.scrollTop=e)},this.scrollToIndex=e=>{if(e>=this.messages.length-1)this.scrollToBottom();else{const t=e<1?0:this.getRangeSize(0,e);this.scrollToOffset(t)}},this.scrollToBottom=()=>{this.$listEndRef&&M(()=>{this.$listEndRef.scrollIntoView(),this.getScrollHeight()-(this.getScrollTop()+this.getClientHeight())>0&&this.scrollToBottomRetries<10?setTimeout(()=>{this.scrollToBottom()},1e3/60):(this.scrollToBottomRetries=0,this.autoScroll=!0)})},this.handleScroll=async()=>{if(this.isFetching)return;const e=this.getScrollTop(),t=e{const e=this.getItemsScrolled();if(e<=this.range.end-5&&(this.autoScroll=!1),e>this.range.start+5)return;const t=Math.max(this.range.start-5,0);this.updateVisibleItems(t,this.getEndByStart(t))},this.handleBottom=()=>{if(this.getItemsScrolled(){this.totalHeight=this.getRangeSize(0,this.messages.length)},1e3/30,{leading:!0}),this.rendererInternal=(e,t,i)=>{if(!e)return;if(e.dataset.id===t.id)return;const r=this.renderer(t,i);e.hasChildNodes&&(e.innerHTML=""),this.elementObserver.observe(e),e.dataset.id=t.id,e.appendChild(r)}}connectedCallback(){const e=this.messages.length-1;this.range={start:e-this.visibleItemsCount,end:e},this.updateVisibleItems(this.range.start,this.range.end),this.totalHeight=this.getRangeSize(0,e)}componentDidLoad(){this.autoScroll&&this.scrollToBottom()}messagesUpdated(e,t){if(e.length>t.length){const i=e.length-t.length;this.updateVisibleItems(i,this.getEndByStart(i)),this.scrollToIndex(this.range.start)}}saveItemSize(e,t){this.sizes.set(e,Math.round(t)),this.updateTotalHeight()}render(){return Z("div",{key:"4da03366f085b87729d946b1633d031e4656f2ac",class:"scrollbar content-wrapper",ref:e=>this.$listRef=e,onScroll:this.handleScroll},Z("div",{key:"7a8268e8a3d5326d359f4722c341e6487e1f21f6",class:"scroller"},Z("div",{key:"b856c5ec8c602963ab9bd74e9838b4ce6bf05f85",style:{height:"".concat(this.totalHeight,"px")}}),Z("div",{key:"a7fe4267408199ffe0f81b56c00f3dffb5e2e59f",class:"smallest-dom-element",id:"list-end",ref:e=>this.$listEndRef=e})),Z("div",{key:"bcd29a59a370c975ab344cabeefdd7ce905f37fe",class:"content",style:{transform:"translateY(".concat(this.getRangeSize(0,this.range.start),"px)")}},this.isFetching&&Z("div",{key:"6529fdc824381737d75e489f262dcf90bd12e186",class:"loader"},Z("rtk-spinner",{key:"8785a6b44007f8ce834639b5e6ae9221a6df704c",size:"md"})),this.getVisibleItems().map((e,t)=>Z("div",{key:e.id,ref:i=>this.rendererInternal(i,e,t)}))))}static get watchers(){return{messages:["messagesUpdated"]}}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],Iu.prototype,"iconPack",void 0),Iu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.loading{cursor:wait}.content-wrapper{height:100%;overflow-y:auto;position:relative;contain:strict}.scroller{width:1px;opacity:0}.content{position:absolute;top:0;width:100%}.smallest-dom-element{width:100%;height:2px;background:red}.loader{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;justify-content:center}";var Mu=Object.freeze({__proto__:null,rtk_message_list_view:Iu});var Du=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ou=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.audioUpdateListener=e=>{let{audioEnabled:t}=e;this.audioEnabled=t},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio},this.mediaPermissionUpdateListener=e=>{let{kind:t,message:i}=e;"audio"===t&&(this.micPermission=i)},this.meetingPermissionsUpdateListener=e=>{var t;(null===(t=null===e||void 0===e?void 0:e.media)||void 0===t?void 0:t.audio)&&(this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio)},this.variant="button",this.iconPack=pn,this.t=un(),this.audioEnabled=!1,this.canProduceAudio=!1,this.micPermission="NOT_REQUESTED",this.stageStatus="OFF_STAGE",this.toggleMic=()=>{var e,t,i,r,n,s,a,o,c,l,d,h;if(null===(e=this.meeting)||void 0===e||e.__internals__.logger.info("rtkMicToggle::toggleMic",{media:{audio:{enabled:Boolean(null===(i=null===(t=this.meeting)||void 0===t?void 0:t.self)||void 0===i?void 0:i.audioEnabled),permission:this.micPermission,canProduce:null===(s=null===(n=null===(r=this.meeting)||void 0===r?void 0:r.self)||void 0===n?void 0:n.permissions)||void 0===s?void 0:s.canProduceAudio}},webinar:{stageStatus:null===(o=null===(a=this.meeting)||void 0===a?void 0:a.stage)||void 0===o?void 0:o.status},livestream:{stageStatus:null===(l=null===(c=this.meeting)||void 0===c?void 0:c.stage)||void 0===l?void 0:l.status},moduleExists:{self:Boolean(null===(d=this.meeting)||void 0===d?void 0:d.self)}}),this.hasPermissionError()){const e={enabled:!0,kind:"audio"};return this.stateUpdate.emit({activePermissionsMessage:e}),!1}const u=null===(h=this.meeting)||void 0===h?void 0:h.self;null!=u&&this.canProduceAudio&&(u.audioEnabled?u.disableAudio():u.enableAudio())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i,r,n,s,a;null===(e=this.meeting)||void 0===e||e.self.removeListener("audioUpdate",this.audioUpdateListener),null===(t=this.meeting)||void 0===t||t.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===(r=null===(i=this.meeting)||void 0===i?void 0:i.stage)||void 0===r||r.removeListener("stageStatusUpdate",this.stageStatusListener),null===(a=null===(s=null===(n=this.meeting)||void 0===n?void 0:n.self)||void 0===s?void 0:s.permissions)||void 0===a||a.removeListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}meetingChanged(e){var t,i;if(null!=e){const{self:r,stage:n}=e;this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio,this.micPermission=e.self.mediaPermissions.audio||"NOT_REQUESTED",this.audioEnabled=r.audioEnabled,this.stageStatus=e.stage.status,r.addListener("audioUpdate",this.audioUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===n||void 0===n||n.addListener("stageStatusUpdate",this.stageStatusListener),null===(i=null===(t=e.self)||void 0===t?void 0:t.permissions)||void 0===i||i.addListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}}hasPermissionError(){return"DENIED"===this.micPermission||"SYSTEM_DENIED"===this.micPermission}getState(){let e="",t="",i="",r={},n=this.hasPermissionError(),s="COULD_NOT_START"===this.micPermission;return this.audioEnabled&&!n?(t=this.t("mic_on"),i=this.iconPack.mic_on):(t=this.t("mic_off"),i=this.iconPack.mic_off,r["red-icon"]=!0),e=s?this.t("perm_could_not_start.audio"):"SYSTEM_DENIED"===this.micPermission?this.t("perm_sys_denied.audio"):"DENIED"===this.micPermission?this.t("perm_denied.audio"):this.audioEnabled?this.t("disable_mic"):this.t("enable_mic"),{tooltipLabel:e,label:t,icon:i,classList:r,showWarning:n||s,disable:n}}render(){if(!this.meeting)return null;if(!this.canProduceAudio||["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus))return Z(J,{"data-hidden":!0});const{tooltipLabel:e,label:t,icon:i,classList:r,showWarning:n,disable:s}=this.getState();return Z(J,{title:t},Z("rtk-tooltip",{kind:"block",label:e,part:"tooltip"},Z("rtk-controlbar-button",{part:"controlbar-button",icon:i,label:t,size:this.size,iconPack:this.iconPack,variant:this.variant,class:r,onClick:this.toggleMic,showWarning:n,disabled:s})))}static get watchers(){return{meeting:["meetingChanged"]}}};Du([On()],Ou.prototype,"meeting",void 0),Du([On()],Ou.prototype,"iconPack",void 0),Du([On()],Ou.prototype,"t",void 0),Ou.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}:host(.audioDisabled) :slotted(rtk-icon){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var Nu=Object.freeze({__proto__:null,rtk_mic_toggle:Ou});var Uu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Fu=class{constructor(e){f(this,e),this.layout="row",this.participants=[],this.pinnedParticipants=[],this.screenShareParticipants=[],this.plugins=[],this.aspectRatio="16:9",this.gap=8,this.config=sn(),this.iconPack=pn,this.t=un(),this.gridSize=su}componentWillLoad(){this.initialised=!1,this.screenShareParticipantsChanged(this.screenShareParticipants),this.pluginsChanged(this.plugins),this.initialised=!0}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;null===(e=this.meeting.meta)||void 0===e||e.removeListener("activeTabUpdate",this.activeTabUpdateListener)}meetingChanged(e){var t,i,r,n;null!=e&&(void 0!=(null===(t=e.meta)||void 0===t?void 0:t.selfActiveTab)&&this.onActiveTabUpdate(null===(i=e.meta.selfActiveTab)||void 0===i?void 0:i.type,null===(r=e.meta.selfActiveTab)||void 0===r?void 0:r.id),this.activeTabUpdateListener=e=>{this.onActiveTabUpdate(null===e||void 0===e?void 0:e.type,null===e||void 0===e?void 0:e.id)},null===(n=e.meta)||void 0===n||n.addListener("activeTabUpdate",this.activeTabUpdateListener))}screenShareParticipantsChanged(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(this.initialised||null==this.activeTab)&&(null==this.activeTab&&e.length>0?this.setActiveTab({type:"screenshare",participant:e[0]}):this.revalidateActiveTab())}pluginsChanged(e){if(this.initialised||null==this.activeTab)if(e.length>0){const t=e.length-1;this.setActiveTab({type:"plugin",plugin:e[t]})}else this.revalidateActiveTab()}revalidateActiveTab(){if(null!=this.activeTab)if("screenshare"===this.activeTab.type){const{participant:e}=this.activeTab;this.screenShareParticipants.some(t=>t.id===e.id)||this.reassignActiveTab()}else{const{plugin:e}=this.activeTab;this.plugins.some(t=>t.id===e.id)||this.reassignActiveTab()}}setActiveTab(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i;this.activeTab=e;const r="screenshare"===e.type?e.participant.id:e.plugin.id;t&&(null===(i=this.meeting.meta)||void 0===i||i.setSelfActiveTab({type:e.type,id:r},0))}reassignActiveTab(){if(this.screenShareParticipants.length>0)this.setActiveTab({type:"screenshare",participant:this.screenShareParticipants[0]});else if(this.plugins.length>0){const e=this.plugins.length-1;this.setActiveTab({type:"plugin",plugin:this.plugins[e]})}}onActiveTabUpdate(e,t){if(void 0!=e&&void 0!=t)switch(e){case"plugin":const e=this.plugins.find(e=>e.id===t);void 0!=e&&this.setActiveTab({type:"plugin",plugin:e},!1);break;case"screenshare":const i=this.screenShareParticipants.find(e=>e.id===t);void 0!=i&&this.setActiveTab({type:"screenshare",participant:i},!1)}}getTabs(){const e=this.screenShareParticipants.map(e=>({type:"screenshare",participant:e})),t=this.plugins.map(e=>({type:"plugin",plugin:e}));return e.concat(t)}render(){var e,t;if(!this.meeting)return null;const i={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t};return Z(J,null,Z("main",{id:"main-view",part:"main-view"},(null===(e=this.getTabs())||void 0===e?void 0:e.length)>1&&Z("rtk-tab-bar",Object.assign({activeTab:this.activeTab,tabs:this.getTabs(),onTabChange:e=>this.setActiveTab(e.detail)},i)),Z("div",{id:"tabs",key:"tabs"},this.screenShareParticipants.map(e=>{var t,r;return Z(ws,{element:"rtk-screenshare-view",defaults:i,props:{participant:e,key:e.id,style:{display:"screenshare"===(null===(t=this.activeTab)||void 0===t?void 0:t.type)&&(null===(r=this.activeTab)||void 0===r?void 0:r.participant.id)===e.id?"flex":"none"}},childProps:{participant:e,isScreenShare:!0},deepProps:!0})}),this.plugins.map(e=>{var t,r;return Z("rtk-plugin-main",Object.assign({},i,{plugin:e,key:e.id,style:{display:"plugin"===(null===(t=this.activeTab)||void 0===t?void 0:t.type)&&(null===(r=this.activeTab)||void 0===r?void 0:r.plugin.id)===e.id?"flex":"none"}}))}))),Z(ws,{element:"rtk-mixed-grid",defaults:i,childProps:{part:"participants-grid",class:this.gridSize.mixed?"grid-width-".concat(this.gridSize.mixed):"grid-width-lg",participants:this.participants,pinnedParticipants:this.pinnedParticipants,screenShareParticipants:this.screenShareParticipants,plugins:this.plugins,aspectRatio:this.aspectRatio,gap:this.gap,size:"AUDIO_ROOM"===(null===(t=this.meeting.meta)||void 0===t?void 0:t.viewType)?"md":"sm",layout:"row"},onlyChildren:!0}))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],screenShareParticipants:["screenShareParticipantsChanged"],plugins:["pluginsChanged"]}}};Uu([On()],Fu.prototype,"meeting",void 0),Uu([On()],Fu.prototype,"states",void 0),Uu([On()],Fu.prototype,"config",void 0),Uu([On()],Fu.prototype,"iconPack",void 0),Uu([On()],Fu.prototype,"t",void 0),Fu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:100%;width:100%;display:flex}main{display:flex;flex:1 1 0%;padding-left:var(--rtk-space-4, 16px)}:host([layout='column']) main{padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}main rtk-tab-bar{margin-right:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;height:100%;width:var(--rtk-space-16, 64px);flex-direction:column}main #tabs{height:100%;flex:1 1 0%}rtk-button{z-index:10}.grid-width-sm{width:25%}.grid-width-md{width:50%}.grid-width-lg{width:66.666667%}.col{display:flex;flex-direction:column;align-items:center}.tab{display:flex;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);align-items:center;justify-content:center;margin-bottom:var(--rtk-space-2, 8px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.tab.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}.tab img{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);border-radius:var(--rtk-border-radius-sm, 4px)}:host([size='sm']){flex-direction:column}:host([size='sm']) .grid-width-lg,:host([size='sm']) .grid-width-md{height:50%;width:100%;max-width:100%}:host([size='sm']) .grid-width-sm{height:33.333333%;width:100%;max-width:100%}:host([size='sm']) main{display:flex;flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) rtk-tab-bar{height:var(--rtk-space-12, 48px);width:100%;flex-direction:row}:host([size='sm']) #tabs{flex:1 1 0%}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}:host([layout='column']){flex-direction:column}:host([layout='column']) main{display:flex;flex:1 1 0%}:host([layout='column']) .grid-width-lg,:host([layout='column']) .grid-width-md{height:50%;max-width:100%;width:100%}:host([layout='column']) .grid-width-sm{height:33.333333%;max-width:100%;width:100%}@media (orientation: portrait){:host{flex-direction:column}:host .grid-width-lg{height:50%;width:100%;max-width:100%}:host .grid-width-md{height:33.333333%;width:100%;max-width:100%}:host .grid-width-sm{height:25%;width:100%;max-width:100%}:host main{flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='md']) main{flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host rtk-tab-bar{height:var(--rtk-space-16, 64px);width:100%;flex-direction:row}:host #tabs{flex:1 1 0%}:host .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}}@media (orientation: landscape){:host{flex-direction:row}:host([size='sm']){flex-direction:row}:host .grid-width-lg{height:50%;width:100%;max-width:100%}:host([size='sm']) .grid-width-sm{height:100%;max-height:100%;width:16.666667%}:host([size='sm']) main{flex:1 1 0%;flex-direction:row;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}:host([size='md']) main{flex:1 1 0%;flex-direction:row;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) rtk-tab-bar{margin-right:var(--rtk-space-2, 8px);height:100%;width:var(--rtk-space-12, 48px);flex-direction:column}:host #tabs{flex:1 1 0%}:host .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}}";var ju=Object.freeze({__proto__:null,rtk_mixed_grid:Fu});var Bu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Vu=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un(),this.handleKeyDown=e=>{let{key:t}=e;"Escape"===t&&this.stateUpdate.emit({activeMoreMenu:!1})},this.handleOnClick=e=>{!e.composedPath().includes(this.host)&&this.states.activeMoreMenu&&this.stateUpdate.emit({activeMoreMenu:!1})},this.toggleMoreMenu=()=>{this.stateUpdate.emit({activeMoreMenu:!this.states.activeMoreMenu})}}connectedCallback(){window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("click",this.handleOnClick)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("click",this.handleOnClick)}render(){const e=this.t("more");return Z(J,{key:"8cee20061968a6658b164929fa725c0d56f3c5f4",title:e},this.states.activeMoreMenu&&Z("div",{key:"1cf7d2a85d4d1626a0c469d77c91131e9f86b451",class:"more-menu"},Z("slot",{key:"3c1507fa6561127f2d1a4f9d53899dece5d933a2",name:"more-elements"})),Z("rtk-controlbar-button",{key:"76ea4f7d1a55abc6928c6b6c55d89382d46b34e3",size:this.size,iconPack:this.iconPack,onClick:e=>{e.stopPropagation(),this.toggleMoreMenu()},icon:this.iconPack.horizontal_dots,label:e,part:"controlbar-button"}),Z("slot",{key:"e38000e817552abd2b20668885effaf8a0b73592",name:"expanded"}))}get host(){return ie(this)}};Bu([On()],Vu.prototype,"states",void 0),Bu([On()],Vu.prototype,"iconPack",void 0),Bu([On()],Vu.prototype,"t",void 0),Vu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:visible}.more-menu{position:absolute;right:calc(var(--rtk-space-24, 96px) * -1);bottom:var(--rtk-space-16, 64px);z-index:50;margin-bottom:var(--rtk-space-3, 12px);box-sizing:border-box;max-height:60vh;width:var(--rtk-space-64, 256px);overflow:auto;border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));outline:2px solid transparent;outline-offset:2px;display:flex;flex-direction:column;align-items:stretch}:host([size='sm']) .more-menu{bottom:var(--rtk-space-10, 40px)}.more-menu::-webkit-scrollbar{height:var(--rtk-space-0, 0px);width:var(--rtk-space-1\\.5, 6px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.more-menu::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}";var zu=Object.freeze({__proto__:null,rtk_more_toggle:Vu});var Hu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const $u=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.canDisable=!1,this.permissionsUpdateListener=()=>{var e;this.canDisable=!!(null===(e=this.meeting)||void 0===e?void 0:e.self.permissions.canDisableParticipantAudio)},this.onMuteAll=()=>{this.stateUpdate.emit({activeMuteAllConfirmation:!0})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i;null===(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===i||i.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(e){e&&(this.canDisable=!!(null===e||void 0===e?void 0:e.self.permissions.canDisableParticipantAudio),e.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}render(){if(!this.meeting)return null;if(!this.canDisable)return null;const e=this.t("mute_all");return Z(J,{title:e},Z("rtk-tooltip",{kind:"block",label:e,part:"tooltip"},Z("rtk-controlbar-button",{part:"controlbar-button",icon:this.iconPack.speaker_off,label:e,size:this.size,iconPack:this.iconPack,variant:this.variant,onClick:this.onMuteAll})))}static get watchers(){return{meeting:["meetingChanged"]}}};Hu([On()],$u.prototype,"meeting",void 0),Hu([On()],$u.prototype,"iconPack",void 0),Hu([On()],$u.prototype,"t",void 0),$u.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var Gu=Object.freeze({__proto__:null,rtk_mute_all_button:$u});var Wu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const qu=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.isScreenShare=!1,this.score=10,this.onMediaScoreUpdate=e=>{let{kind:t,isScreenshare:i,score:r}=e;("video"===t||this.isScreenShare&&i)&&(this.score=r)}}connectedCallback(){this.participantChanged(this.participant)}participantChanged(e){e&&e.addListener("mediaScoreUpdate",this.onMediaScoreUpdate)}disconnectedCallback(){var e;null===(e=this.participant)||void 0===e||e.removeListener("mediaScoreUpdate",this.onMediaScoreUpdate)}render(){let e=Math.round(this.score/2),t="good";if(e>3)return null;switch(e<1&&(e=1),e){case 3:case 2:t="poor";break;case 1:t="poorest"}return Z(J,null,Z("rtk-icon",{icon:this.iconPack["signal_".concat(e)],class:t}),Z("rtk-icon",{icon:this.iconPack.signal_5,class:"bg-signal"}))}static get watchers(){return{participant:["participantChanged"]}}};Wu([On()],qu.prototype,"meeting",void 0),Wu([On()],qu.prototype,"iconPack",void 0),Wu([On()],qu.prototype,"t",void 0),qu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block;height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}rtk-icon{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:10;height:100%;width:100%;--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.bg-signal{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:0;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}";var Ku=Object.freeze({__proto__:null,rtk_network_indicator:qu});var Zu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Yu=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.participantCount=0,this.isViewer=!1,this.disconnectMeeting=e=>{null!=e&&null!=this.countListener&&(e.participants.joined.removeListener("participantJoined",this.countListener),e.participants.joined.removeListener("participantLeft",this.countListener),(null===e||void 0===e?void 0:e.stage)&&this.stageUpdateListener&&e.stage.removeListener("stageStatusUpdate",this.stageUpdateListener),e.self.removeListener("roomJoined",this.countListener))}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}meetingChanged(e,t){this.disconnectMeeting(t),null!=e&&(this.countListener=()=>{this.participantCount=e.participants.joined.size+(e.self.roomJoined?1:0)},this.countListener(),this.isViewer=nt(this.meeting),e.participants.joined.addListener("participantJoined",this.countListener),e.participants.joined.addListener("participantLeft",this.countListener),(null===e||void 0===e?void 0:e.stage)&&(this.stageUpdateListener=()=>{this.isViewer=nt(this.meeting)},null===e||void 0===e||e.stage.addListener("stageStatusUpdate",this.stageUpdateListener)),e.self.addListener("roomJoined",this.countListener))}render(){return this.isViewer?Z(J,{"data-hidden":!0}):Z(J,{tabIndex:0,role:"log","aria-label":"".concat(this.participantCount," ").concat(this.t("participants"))},Z("rtk-icon",{icon:this.iconPack.people,tabIndex:-1,"aria-hidden":!0,part:"icon"}),this.participantCount)}static get watchers(){return{meeting:["meetingChanged"]}}};Zu([On()],Yu.prototype,"meeting",void 0),Zu([On()],Yu.prototype,"iconPack",void 0),Zu([On()],Yu.prototype,"t",void 0),Yu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;height:var(--rtk-space-10, 40px);-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";var Ju=Object.freeze({__proto__:null,rtk_participant_count:Yu});var Qu=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Xu=class{constructor(e){f(this,e),this.isPinned=!1,this.nameTagPosition="bottom-left",this.isPreview=!1,this.config=sn(),this.variant="solid",this.iconPack=pn,this.t=un(),this.onVideoUpdate=e=>{this.videoState=e}}connectedCallback(){this.participantsChanged(this.participant)}componentDidLoad(){this.videoStateChanged(this.videoState)}disconnectedCallback(){null!=this.participant&&this.participant.removeListener("videoUpdate",this.onVideoUpdate)}async participantsChanged(e){null!=e&&(this.videoState={videoEnabled:e.videoEnabled,videoTrack:e.videoTrack},this.isPinned=e.isPinned,e.addListener("videoUpdate",this.onVideoUpdate))}videoStateChanged(e){if(null!=e&&null!=this.videoEl)if(e.videoEnabled){const t=new MediaStream;t.addTrack(e.videoTrack),this.videoEl.srcObject=t}else this.videoEl.srcObject=void 0}isMirrored(){var e;if(null!=this.participant){if("preview"in this.participant||this.isPreview){const t=this.states,i=null===(e=null===t||void 0===t?void 0:t.prefs)||void 0===e?void 0:e.mirrorVideo;if("boolean"===typeof i)return i}}return!1}render(){var e,t,i,r;return Z(J,{key:"b1470884fc7e85a79e6d6954547737690dd6923a"},Z("video",{key:"c967c9e6716624e3a484d424fe33a50b4d9799c6",ref:e=>this.videoEl=e,class:{visible:null===(e=this.videoState)||void 0===e?void 0:e.videoEnabled,mirror:this.isMirrored(),[null!==(r=null===(i=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===i?void 0:i.videoFit)&&void 0!==r?r:"cover"]:!0},autoPlay:!0,playsInline:!0,muted:!0}),Z("slot",{key:"fe319fc4aa0cc4049024e3860a8af2b2d6d5bc68"}))}static get watchers(){return{participant:["participantsChanged"],videoState:["videoStateChanged"]}}};Qu([On()],Xu.prototype,"states",void 0),Qu([On()],Xu.prototype,"config",void 0),Qu([On()],Xu.prototype,"iconPack",void 0),Qu([On()],Xu.prototype,"t",void 0),Xu.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:16 / 9;height:var(--rtk-space-56, 224px);overflow:hidden;border-radius:var(--rtk-border-radius-lg, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));transition-property:var(--rtk-transition-property, all);transition-duration:150ms}@media (prefers-reduced-motion){:host{--rtk-transition-property:none}}:host([size='sm'][variant='solid']) ::slotted(rtk-name-tag){left:var(--rtk-space-2, 8px);bottom:var(--rtk-space-2, 8px);height:var(--rtk-space-4, 16px)}video{display:none;position:absolute;height:100%;width:100%;border-radius:var(--rtk-border-radius-lg, 12px)}video.contain{-o-object-fit:contain;object-fit:contain}video.cover{-o-object-fit:cover;object-fit:cover}video.visible{display:block}video::-webkit-media-controls{display:none !important}:host([variant='gradient']) ::slotted(rtk-audio-visualizer){position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px)}:host([variant='gradient']) ::slotted(rtk-name-tag){bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);display:flex;width:100%;align-items:center;justify-content:center;text-align:center;background-color:transparent;background-image:linear-gradient(to top, var(--tw-gradient-stops));--tw-gradient-from:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-gradient-to:rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to:transparent}video.mirror{transform:scaleX(-1)}@media (orientation: portrait){:host{height:var(--rtk-space-44, 176px)}}";var ep=Object.freeze({__proto__:null,rtk_participant_setup:Xu});var tp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ip=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.config=sn(),this.iconPack=pn,this.defaultParticipantsTabId="stage-list",this.t=un(),this.currentParticipantsTabId=this.defaultParticipantsTabId,this.tabs=[],this.hasRequests=!1,this.search="",this.updateParticipantCountsInTabs=qn(()=>{var e;let t=(null===(e=this.meeting.participants.waitlisted)||void 0===e?void 0:e.size)||0,i=0,r=0;this.meeting.participants.joined.toArray().forEach(e=>{"ON_STAGE"===e.stageStatus&&i++,"OFF_STAGE"===e.stageStatus&&r++,"REQUESTED_TO_JOIN_STAGE"===e.stageStatus&&(t++,r++),"ACCEPTED_TO_JOIN_STAGE"===e.stageStatus&&r++}),"ON_STAGE"===this.meeting.self.stageStatus&&i++,"OFF_STAGE"===this.meeting.self.stageStatus&&r++,"REQUESTED_TO_JOIN_STAGE"===this.meeting.self.stageStatus&&(t++,r++),"ACCEPTED_TO_JOIN_STAGE"===this.meeting.self.stageStatus&&r++;const n=[];this.shouldShowRequestsTab()&&n.push({id:"requests",name:Z("span",null,this.t("requests"),"\xa0",Z("span",{class:"tab-participant-count-badge ".concat(t>0?"requests-pending":""," ").concat("requests"===this.currentParticipantsTabId?"selected-tab":"")},t))}),n.push({id:"stage-list",name:Z("span",null,this.t("participants"),"\xa0",Z("span",{class:"tab-participant-count-badge ".concat("stage-list"===this.currentParticipantsTabId?"selected-tab":"")},i))}),this.shouldShowViewersTab()&&n.push({id:"viewer-list",name:Z("span",null,this.t("viewers"),"\xa0",Z("span",{class:"tab-participant-count-badge ".concat("viewer-list"===this.currentParticipantsTabId?"selected-tab":"")},r))}),this.tabs=n,this.hasRequests=t>0}),this.onSearchInput=e=>{this.search=e.target.value},this.shouldShowViewersTab=()=>{var e,t,i;return null===(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===i?void 0:i.stageEnabled},this.shouldShowRequestsTab=()=>{var e;let t=!1;return t="LIVESTREAM"!==this.meeting.meta.viewType&&((null===(e=this.meeting.self.config.waitingRoom)||void 0===e?void 0:e.isEnabled)&&this.meeting.self.permissions.acceptWaitingRequests),this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests||t},this.viewSection=e=>{this.currentParticipantsTabId=e}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.participants.joined.off("participantJoined",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("participantsUpdate",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("participantLeft",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("stageStatusUpdate",this.updateParticipantCountsInTabs),this.meeting.stage.off("stageStatusUpdate",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("participantJoined",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("participantLeft",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("stageStatusUpdate",this.updateParticipantCountsInTabs))}meetingChanged(e){e&&(e.participants.joined.on("participantJoined",this.updateParticipantCountsInTabs),e.participants.joined.on("participantsUpdate",this.updateParticipantCountsInTabs),e.participants.joined.on("participantLeft",this.updateParticipantCountsInTabs),e.participants.joined.on("stageStatusUpdate",this.updateParticipantCountsInTabs),e.stage.on("stageStatusUpdate",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("participantJoined",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("participantLeft",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("stageStatusUpdate",this.updateParticipantCountsInTabs),this.updateParticipantCountsInTabs())}currentParticipantsTabIdChanged(){this.stateUpdate.emit({participantsTabId:this.currentParticipantsTabId}),this.updateParticipantCountsInTabs()}render(){if(!this.meeting)return null;const e={meeting:this.meeting,states:this.states,config:this.config,size:this.size,iconPack:this.iconPack,t:this.t};return Z(J,null,Z("div",{class:"search",part:"search"},Z("rtk-icon",{icon:this.iconPack.search,part:"search-icon"}),Z("input",{type:"search",autocomplete:"off",placeholder:this.t("search"),onInput:this.onSearchInput,part:"search-input"})),Z("slot",{name:"start"}),Z("div",{class:"ctr scrollbar ".concat("requests"!==this.currentParticipantsTabId?"virtualised":""),part:"container"},Z("rtk-sidebar-ui",{tabs:this.tabs,currentTab:this.currentParticipantsTabId,view:"full-screen",hideHeader:!0,hideCloseAction:!0,style:{position:"relative"},onTabChange:e=>{this.viewSection(e.detail),e.stopPropagation()}},(!this.currentParticipantsTabId||"stage-list"===this.currentParticipantsTabId)&&Z("div",{slot:"stage-list",style:{marginTop:"10px",height:"100%"}},Z("rtk-participants-stage-list",Object.assign({},e,{search:this.search,hideHeader:!0}))),"requests"===this.currentParticipantsTabId&&Z("div",{slot:"requests",style:{marginTop:"10px",height:"100%"}},!this.hasRequests&&Z("div",{class:"no-pending-requests"},this.t("participants.no_pending_requests")),Z("rtk-participants-stage-queue",Object.assign({},e)),Z("rtk-participants-waiting-list",Object.assign({},e))),"viewer-list"===this.currentParticipantsTabId&&Z("div",{slot:"viewer-list",style:{marginTop:"10px",height:"100%"}},Z("rtk-participants-viewer-list",Object.assign({},e,{search:this.search,hideHeader:!0}))))),Z("slot",{name:"end"}))}static get watchers(){return{meeting:["meetingChanged"],currentParticipantsTabId:["currentParticipantsTabIdChanged"]}}};tp([On()],ip.prototype,"meeting",void 0),tp([On()],ip.prototype,"states",void 0),tp([On()],ip.prototype,"config",void 0),tp([On()],ip.prototype,"iconPack",void 0),tp([On()],ip.prototype,"t",void 0),ip.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}*{box-sizing:border-box}.ctr{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);box-sizing:border-box;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);overflow-y:auto;flex-grow:1;flex-basis:0}.ctr.virtualised{overflow-y:hidden}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));margin-left:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-3, 12px);margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px)}.search rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search input{box-sizing:border-box;height:var(--rtk-space-9, 36px);width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}:host([size='md']) .search{margin-top:var(--rtk-space-4, 16px) !important;margin-bottom:var(--rtk-space-4, 16px) !important}:host([size='sm']) .search{margin-top:var(--rtk-space-4, 16px) !important;margin-bottom:var(--rtk-space-4, 16px) !important}.no-pending-requests{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}";var rp=Object.freeze({__proto__:null,rtk_participants:ip});class np{constructor(e,t){this.meeting=e,this.audio=null!==t&&void 0!==t?t:document.createElement("audio"),this.audio.autoplay=!0,this.logger=e.__internals__.logger,this.audioStream=new MediaStream,this.audio.srcObject=this.audioStream,this.audioTracks=[]}addTrack(e,t){this.audioTracks.some(t=>t.id===e)||(this.audioTracks.push({id:e,track:t}),this.audioStream.addTrack(t),this.play())}removeTrack(e){const t=this.audioTracks.find(t=>t.id===e);null!=t&&(this.audioStream.removeTrack(t.track),this.audioTracks=this.audioTracks.filter(t=>t.id!==e))}async play(){var e;this.audio.srcObject=this.audioStream,await(null===(e=this.audio.play())||void 0===e?void 0:e.catch(e=>{"NotAllowedError"===e.name?null!=this._onError&&this._onError():"AbortError"!==e.name&&this.logger.error("[rtk-audio] play() error\n",e)}))}async setDevice(e){var t,i,r;mt(this.meeting)||await(null===(r=null===(i=(t=this.audio).setSinkId)||void 0===i?void 0:i.call(t,e))||void 0===r?void 0:r.catch(e=>{this.logger.error("[rtk-audio] setSinkId() error\n",e)}))}onError(e){this._onError=e}}var sp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ap=class{constructor(e){f(this,e),this.dialogClose=re(this,"dialogClose",7),this.iconPack=pn,this.t=un(),this.preloadedAudioElem=void 0,this.showPlayDialog=!1,this.onRtkDialogClose=()=>{this.showPlayDialog=!1,this.dialogClose.emit()}}componentDidLoad(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;this.meeting&&(this.audioUpdateListener&&this.meeting.participants.joined.removeListener("audioUpdate",this.audioUpdateListener),this.screenShareUpdateListener&&this.meeting.participants.joined.removeListener("screenShareUpdate",this.screenShareUpdateListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),this.deviceUpdateListener&&this.meeting.self.removeListener("deviceUpdate",this.deviceUpdateListener),this.stageStatusUpdateListener&&(null===(e=this.meeting.stage)||void 0===e||e.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)))}async setupAudio(){this.audio=new np(this.meeting,this.preloadedAudioElem);const e=this.meeting.self.getCurrentDevices();null!=e.speaker&&await this.audio.setDevice(e.speaker.deviceId)}async handleAutoPlayError(){this.audio||await this.setupAudio(),this.audio.onError(()=>{this.showPlayDialog=!0}),this.audio.play()}async handleEvents(e){this.audioUpdateListener=e=>{let{id:t,audioEnabled:i,audioTrack:r}=e;const n="audio-".concat(t);i&&null!=r?this.audio.addTrack(n,r):this.audio.removeTrack(n)};const t=e.participants.joined.toArray();for(const i of t)this.audioUpdateListener(i);this.participantLeftListener=e=>{let{id:t}=e;this.audio.removeTrack("audio-".concat(t)),this.audio.removeTrack("screenshare-".concat(t))},this.screenShareUpdateListener=e=>{let{id:t,screenShareEnabled:i,screenShareTracks:r}=e;const n="screenshare-".concat(t);i&&null!=r.audio?this.audio.addTrack(n,r.audio):this.audio.removeTrack(n)},this.deviceUpdateListener=e=>{let{device:t,preview:i}=e;i||"audiooutput"===t.kind&&this.audio.setDevice(t.deviceId)},e.participants.joined.addListener("audioUpdate",this.audioUpdateListener),e.participants.joined.addListener("screenShareUpdate",this.screenShareUpdateListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener),e.self.addListener("deviceUpdate",this.deviceUpdateListener)}async meetingChanged(e){var t;e&&(this.setupAudio(),nt(e)?(this.stageStatusUpdateListener=async e=>{"ON_STAGE"===e&&await this.handleAutoPlayError()},null===(t=e.stage)||void 0===t||t.on("stageStatusUpdate",this.stageStatusUpdateListener)):await this.handleAutoPlayError(),await this.handleEvents(e))}render(){return Z(J,{key:"6055104d2d2e54c60d42b51bcb4c296346d13a19"},this.showPlayDialog&&Z("rtk-dialog",{key:"8dce181e5c8f0f33f615bf48f1f85bd3c11efa2b",open:!0,onRtkDialogClose:this.onRtkDialogClose,hideCloseButton:!0,disableEscapeKey:!0,iconPack:this.iconPack,t:this.t},Z("div",{key:"5be7e31e7776eecf09bcc981757d24da71ce6a43",class:"modal"},Z("h3",{key:"9e2df7d9e655102c51f841718e8e365d578e96fb"},this.t("audio_playback.title")),Z("p",{key:"c7c406eeb93ab661cf144e69e0782cbde5588753"},this.t("audio_playback.description")),Z("rtk-button",{key:"0c5e9341edb22e32666591a0fb212aea54c61d0b",kind:"wide",onClick:()=>{this.audio.play(),this.onRtkDialogClose()},title:this.t("audio_playback")},this.t("audio_playback")))))}static get watchers(){return{meeting:["meetingChanged"]}}};sp([On()],ap.prototype,"meeting",void 0),sp([On()],ap.prototype,"iconPack",void 0),sp([On()],ap.prototype,"t",void 0),ap.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;overflow-wrap:break-word;color:rgb(var(--rtk-colors-text-1000, 255 255 255));word-wrap:break-word}.modal{box-sizing:border-box;width:100%;max-width:var(--rtk-space-96, 384px);padding:var(--rtk-space-4, 16px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.modal h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:24px;font-weight:500}.modal p{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-6, 24px)}.modal rtk-button{width:100%}";var op=Object.freeze({__proto__:null,rtk_participants_audio:ap});var cp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const lp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.participantsActive=!1,this.waitlistedParticipants=[],this.stageRequestedParticipants=[],this.badgeCount=0,this.canViewParticipants=!1,this.updateStageRequests=async e=>{var t,i,r;e||(e=null!==(r=null===(i=null===(t=this.meeting.stage)||void 0===t?void 0:t.getAccessRequests())||void 0===i?void 0:i.stageRequests)&&void 0!==r?r:[]),this.stageRequestedParticipants=e,this.stageRequestedParticipants="REQUESTED_TO_JOIN_STAGE"===this.meeting.stage.status?[this.meeting.self,...e]:e,this.updateBadgeCount()},this.updateBadgeCount=()=>{this.badgeCount=this.waitlistedParticipants.length+this.stageRequestedParticipants.length},this.updateCanView=()=>{this.canViewParticipants=Jd(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var e,t,i;this.meeting&&(null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.updateCanView),this.waitlistedParticipantJoinedListener&&this.meeting.participants.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&this.meeting.participants.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),null===(i=this.meeting.stage)||void 0===i||i.removeListener("stageAccessRequestUpdate",this.updateStageRequests))}meetingChanged(e){var t;e&&(this.canViewParticipants=Jd(e),null===(t=null===e||void 0===e?void 0:e.stage)||void 0===t||t.on("stageStatusUpdate",this.updateCanView),e.self.permissions.acceptWaitingRequests&&(this.waitlistedParticipants=e.participants.waitlisted.toArray(),this.waitlistedParticipantJoinedListener=e=>{this.waitlistedParticipants.some(t=>t.id===e.id)||(this.waitlistedParticipants=[...this.waitlistedParticipants,e],this.updateBadgeCount())},this.waitlistedParticipantLeftListener=e=>{this.waitlistedParticipants=this.waitlistedParticipants.filter(t=>t.id!==e.id),this.updateBadgeCount()},e.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),e.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener)),this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests&&(this.updateStageRequests(),null===e||void 0===e||e.stage.on("stageAccessRequestUpdate",this.updateStageRequests)),this.updateBadgeCount())}statesChanged(e){null!=e&&(this.participantsActive=!0===e.activeSidebar&&"participants"===e.sidebar)}toggleParticipantsTab(){const e=this.states;this.participantsActive=!((null===e||void 0===e?void 0:e.activeSidebar)&&"participants"===(null===e||void 0===e?void 0:e.sidebar)),this.stateUpdate.emit({activeSidebar:this.participantsActive,sidebar:this.participantsActive?"participants":void 0,activeMoreMenu:!1,activeAI:!1})}handleParticipantsActiveChange(){this.participantsActive||this.states.activeSidebar||this.buttonEl.focus()}render(){if(!this.canViewParticipants)return Z(J,{"data-hidden":!0});const e=this.t("participants");return Z(J,{title:e},0!==this.badgeCount&&!this.participantsActive&&Z("div",{class:"waiting-participants-count",part:"waiting-participants-count"},Z("span",null,this.badgeCount<=100?this.badgeCount:"99+")),Z("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.participantsActive},onClick:()=>this.toggleParticipantsTab(),icon:this.iconPack.participants,label:e,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],participantsActive:["handleParticipantsActiveChange"]}}};cp([On()],lp.prototype,"meeting",void 0),cp([On()],lp.prototype,"states",void 0),cp([On()],lp.prototype,"iconPack",void 0),cp([On()],lp.prototype,"t",void 0),lp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.waiting-participants-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}:host([variant='horizontal']) .waiting-participants-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}";var dp=Object.freeze({__proto__:null,rtk_participants_toggle:lp});var hp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const up=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.config=sn(),this.iconPack=pn,this.t=un(),this.pipSupported=!1}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(e){var t,i,r;e&&(this.pipSupported=(null===(t=e.participants.pip)||void 0===t?void 0:t.isSupported())&&(null===(i=e.self.config)||void 0===i?void 0:i.pipMode)&&"LIVESTREAM"!==(null===(r=e.self.config)||void 0===r?void 0:r.viewType))}togglePip(){this.meeting.participants.pip&&(this.meeting.participants.pip.isActive?this.meeting.participants.pip.disable():this.meeting.participants.pip.enable(),this.stateUpdate.emit({activeMoreMenu:!1}))}render(){if(!this.meeting)return null;if(!this.pipSupported)return Z(J,{"data-hidden":!0});const e=this.meeting.participants.pip.isActive;return Z(J,{role:"log","aria-label":"Picture-in-Picture mode"},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.togglePip(),icon:e?this.iconPack.pip_on:this.iconPack.pip_off,label:e?this.t("pip_off"):this.t("pip_on"),variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"]}}};hp([On()],up.prototype,"meeting",void 0),hp([On()],up.prototype,"states",void 0),hp([On()],up.prototype,"config",void 0),hp([On()],up.prototype,"iconPack",void 0),hp([On()],up.prototype,"t",void 0),up.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var pp=Object.freeze({__proto__:null,rtk_pip_toggle:up});var gp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const fp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.pluginsActive=!1,this.canViewPlugins=!1,this.updateCanView=()=>{this.canViewPlugins=Qd(this.meeting)}}disconnectedCallback(){var e,t,i,r;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.updateCanView),null===(r=null===(i=this.meeting)||void 0===i?void 0:i.self)||void 0===r||r.permissions.removeListener("pluginsUpdate",this.updateCanView)}connectedCallback(){this.statesChanged(this.states),this.meetingChanged(this.meeting)}meetingChanged(e){var t,i;e&&(this.canViewPlugins=Qd(e),null===(t=null===e||void 0===e?void 0:e.stage)||void 0===t||t.on("stageStatusUpdate",this.updateCanView),null===(i=null===e||void 0===e?void 0:e.self)||void 0===i||i.permissions.addListener("pluginsUpdate",this.updateCanView))}statesChanged(e){null!=e&&(this.pluginsActive=!0===e.activeSidebar&&"plugins"===e.sidebar)}togglePlugins(){const e=this.states;this.pluginsActive=!((null===e||void 0===e?void 0:e.activeSidebar)&&"plugins"===(null===e||void 0===e?void 0:e.sidebar)),this.stateUpdate.emit({activeSidebar:this.pluginsActive,sidebar:this.pluginsActive?"plugins":void 0,activeMoreMenu:!1,activeAI:!1})}handlePluginsActiveChange(){this.pluginsActive||this.states.activeSidebar||this.buttonEl.focus()}render(){if(!this.canViewPlugins)return Z(J,{"data-hidden":!0});const e=this.t("plugins");return Z(J,{title:e},Z("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.pluginsActive},onClick:()=>this.togglePlugins(),icon:this.iconPack.rocket,label:e,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],pluginsActive:["handlePluginsActiveChange"]}}};gp([On()],fp.prototype,"meeting",void 0),gp([On()],fp.prototype,"states",void 0),gp([On()],fp.prototype,"iconPack",void 0),gp([On()],fp.prototype,"t",void 0),fp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var mp=Object.freeze({__proto__:null,rtk_plugins_toggle:fp});var vp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const bp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.pollsActive=!1,this.unreadPollsCount=0,this.canViewPolls=!1,this.onPollsUpdate=e=>{let{newPoll:t}=e;!0===t&&(this.unreadPollsCount+=1)},this.updateCanView=()=>{this.canViewPolls=Yd(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var e,t,i,r,n,s;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.polls)||void 0===t||t.removeListener("pollsUpdate",this.onPollsUpdate),null===(r=null===(i=this.meeting)||void 0===i?void 0:i.self)||void 0===r||r.permissions.removeListener("pollsUpdate",this.updateCanView),null===(s=null===(n=this.meeting)||void 0===n?void 0:n.stage)||void 0===s||s.removeListener("stageStatusUpdate",this.updateCanView)}meetingChanged(e){var t,i;e&&e.polls&&(this.unreadPollsCount=e.polls.items.length,this.meeting.polls.addListener("pollsUpdate",this.onPollsUpdate),null===(t=null===e||void 0===e?void 0:e.self)||void 0===t||t.permissions.addListener("pollsUpdate",this.updateCanView),this.canViewPolls=Yd(e),null===(i=null===e||void 0===e?void 0:e.stage)||void 0===i||i.on("stageStatusUpdate",this.updateCanView))}statesChanged(e){null!=e&&(this.pollsActive=!0===e.activeSidebar&&"polls"===e.sidebar)}togglePollsTab(){const e=this.states;this.unreadPollsCount=0,this.pollsActive=!((null===e||void 0===e?void 0:e.activeSidebar)&&"polls"===(null===e||void 0===e?void 0:e.sidebar)),this.stateUpdate.emit({activeSidebar:this.pollsActive,sidebar:this.pollsActive?"polls":void 0,activeMoreMenu:!1,activeAI:!1})}handlePollsActiveChange(){this.pollsActive||this.states.activeSidebar||this.buttonEl.focus()}render(){if(!this.canViewPolls)return Z(J,{"data-hidden":!0});const e=this.t("polls");return Z(J,{title:e},0!==this.unreadPollsCount&&!this.pollsActive&&Z("div",{class:"unread-count",part:"unread-count"},Z("span",null,this.unreadPollsCount<=100?this.unreadPollsCount:"99+")),Z("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.pollsActive},onClick:()=>this.togglePollsTab(),icon:this.iconPack.poll,label:e,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],pollsActive:["handlePollsActiveChange"]}}};vp([On()],bp.prototype,"meeting",void 0),vp([On()],bp.prototype,"states",void 0),vp([On()],bp.prototype,"iconPack",void 0),vp([On()],bp.prototype,"t",void 0),bp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.unread-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}:host([variant='horizontal']) .unread-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}";var kp=Object.freeze({__proto__:null,rtk_polls_toggle:bp});var yp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const wp=class{constructor(e){f(this,e),this.t=un(),this.iconPack=pn,this.setIsRecording=e=>{this.isRecording="RECORDING"===e}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;null===(e=this.meeting)||void 0===e||e.recording.removeListener("recordingUpdate",this.updateRecordingStatus)}meetingChanged(e){null!=e&&(this.setIsRecording(e.recording.recordingState),this.updateRecordingStatus=e=>{this.setIsRecording(e)},e.recording.addListener("recordingUpdate",this.updateRecordingStatus))}render(){return Z(J,{key:"421715a1e7084f9dc226cdf969393a9c9b58fd66","data-hidden":!this.isRecording},this.isRecording&&Z("div",{key:"fcfd0aa019c6d56ed5a872cdd2cf38ac7ac4258e",class:"indicator","aria-label":this.t("recording.indicator"),part:"indicator"},Z("rtk-icon",{key:"de97c04f6a1d81606285b2430ccf111dd7208bbf",icon:this.iconPack.recording,"aria-hidden":!0,tabIndex:-1,part:"icon"}),Z("span",{key:"6c142e85f186c7cdb77ccbb78453b2101e17f31a"},this.t("recording.label"))))}static get watchers(){return{meeting:["meetingChanged"]}}};yp([On()],wp.prototype,"meeting",void 0),yp([On()],wp.prototype,"t",void 0),yp([On()],wp.prototype,"iconPack",void 0),wp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}:host[size='sm']{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.indicator{display:flex;flex-direction:row;align-items:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);animation:blink 4s linear infinite}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='sm']) .indicator span{display:none}@keyframes blink{0%,10%{opacity:0}11%,100%{opacity:1}}";var Sp=Object.freeze({__proto__:null,rtk_recording_indicator:wp});var xp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ep=class{constructor(e){f(this,e),this.apiError=re(this,"rtkApiError",7),this.variant="button",this.t=un(),this.iconPack=pn,this.disabled=!1,this.canRecord=!1,this.permissionsUpdateListener=()=>{this.canRecord=!0===this.meeting.self.permissions.canRecord},this.toggleRecording=async()=>{var e,t,i;if(!this.isLoading()&&!this.disabled)switch(this.recordingState){case"IDLE":try{return void await(null===(e=this.meeting)||void 0===e?void 0:e.recording.start())}catch(r){this.apiError.emit({trace:this.t("recording.start"),message:this.t("recording.error.start")})}return;case"RECORDING":try{return void await(null===(t=this.meeting)||void 0===t?void 0:t.recording.stop())}catch(n){this.apiError.emit({trace:this.t("recording.stop"),message:this.t("recording.error.stop")})}return;case"PAUSED":try{return void await(null===(i=this.meeting)||void 0===i?void 0:i.recording.resume())}catch(s){this.apiError.emit({trace:this.t("recording.resume"),message:this.t("recording.error.resume")})}return;default:return}},this.isLoading=()=>!this.meeting||"STARTING"===this.recordingState||"STOPPING"===this.recordingState}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t;this.recordingStateUpdateListener&&(null===(e=this.meeting)||void 0===e||e.recording.removeListener("recordingUpdate",this.recordingStateUpdateListener)),null===(t=this.meeting)||void 0===t||t.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(e){null!=e&&(this.recordingState=e.recording.recordingState,this.permissionsUpdateListener(),this.recordingStateUpdateListener=e=>{this.recordingState=e},e.recording.addListener("recordingUpdate",this.recordingStateUpdateListener),e.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}getLabel(){switch(this.recordingState){case"IDLE":return"recording.idle";case"RECORDING":return"recording.stop";case"STARTING":return"recording.starting";case"STOPPING":return"recording.stopping";case"PAUSED":return"recording.resume";default:return"recording.loading"}}getIcon(){switch(this.recordingState){case"IDLE":case"STARTING":case"STOPPING":default:return this.iconPack.recording;case"RECORDING":return this.iconPack.stop_recording}}render(){return this.meeting?this.canRecord?Z(J,{title:this.t("RECORDING"===this.recordingState?"recording.stop":"recording.idle")},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:this.toggleRecording,icon:this.getIcon(),isLoading:this.isLoading(),label:this.t(this.getLabel()),variant:this.variant,disabled:this.disabled})):void 0:null}static get watchers(){return{meeting:["meetingChanged"]}}};xp([On()],Ep.prototype,"meeting",void 0),xp([On()],Ep.prototype,"t",void 0),xp([On()],Ep.prototype,"iconPack",void 0),Ep.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var Tp=Object.freeze({__proto__:null,rtk_recording_toggle:Ep});var _p=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Pp=()=>"undefined"!==typeof navigator&&"undefined"!==typeof navigator.mediaDevices&&"getDisplayMedia"in navigator.mediaDevices,Cp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.apiError=re(this,"rtkApiError",7),this.variant="button",this.iconPack=pn,this.t=un(),this.maxScreenShareCount=-1,this.screenShareCount=0,this.screenShareEnabled=!1,this.canScreenShare=!1,this.shareScreenPermission="NOT_REQUESTED",this.screenShareState={tooltipLabel:this.t("screenshare.start"),label:this.t("screenshare.start"),icon:this.iconPack.share_screen_start,classList:{},showWarning:!1,disable:!1},this.stageStatus="OFF_STAGE",this.screenShareListener=()=>{const e=this.meeting.participants.active.toArray().filter(e=>e.screenShareEnabled).length,t=this.meeting.self.screenShareEnabled?1:0;this.screenShareCount=e+t,this.screenShareEnabled=this.meeting.self.screenShareEnabled,this.getState(),this.meeting.__internals__.logger.info("rtkScreenShare::screenShareUpdate",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount}}})},this.participantLeftListener=e=>{let{screenShareEnabled:t}=e;t&&(this.screenShareCount=Math.max(this.screenShareCount-1,0),this.getState(),this.meeting.__internals__.logger.info("rtkScreenShare::screenShareUpdate",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount}}}))},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canScreenShare="ALLOWED"===this.meeting.self.permissions.canProduceScreenshare},this.mediaPermissionUpdateListener=e=>{let{kind:t,message:i}=e;if("screenshare"===t&&(this.shareScreenPermission=i,this.getState(),"COULD_NOT_START"===i&&this.apiError.emit({trace:this.t("screenshare.permissions"),message:this.t("screenshare.error.unknown")}),this.hasPermissionError())){const e={enabled:!0,kind:"screenshare"};this.stateUpdate.emit({activePermissionsMessage:e})}},this.reachedMaxScreenShares=()=>this.maxScreenShareCount>0&&this.screenShareCount>=this.maxScreenShareCount,this.toggleScreenShare=async()=>{var e;if(this.screenShareState.disable)return;if(this.hasPermissionError()){const e={enabled:!0,kind:"screenshare"};return this.stateUpdate.emit({activePermissionsMessage:e}),!1}const t=null===(e=this.meeting)||void 0===e?void 0:e.self;this.screenShareEnabled?t.disableScreenShare():null==t||!this.canScreenShare||this.reachedMaxScreenShares()||this.hasPermissionError()||(this.screenShareState=Object.assign(Object.assign({},this.screenShareState),{disable:!0}),await t.enableScreenShare(),this.screenShareState=Object.assign(Object.assign({},this.screenShareState),{disable:!1}),this.stateUpdate.emit({activeMoreMenu:!1}))}}connectedCallback(){Pp()?this.meetingChanged(this.meeting):this.meeting.__internals__.logger.error("[rtk-screenshare-toggle] Device does not support screensharing.")}disconnectedCallback(){var e,t,i,r,n,s;null===(e=this.meeting)||void 0===e||e.participants.joined.removeListener("screenShareUpdate",this.screenShareListener),null===(t=this.meeting)||void 0===t||t.participants.joined.removeListener("participantLeft",this.participantLeftListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("screenShareUpdate",this.screenShareListener),null===(r=this.meeting)||void 0===r||r.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===(s=null===(n=this.meeting)||void 0===n?void 0:n.stage)||void 0===s||s.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(e){if(null!=e){const{self:t,stage:i}=e;this.canScreenShare="ALLOWED"===this.meeting.self.permissions.canProduceScreenshare,this.maxScreenShareCount=t.config.maxScreenShareCount,this.screenShareEnabled=t.screenShareEnabled;let r=0;for(const n of e.participants.joined.toArray())n.screenShareEnabled&&r++;this.screenShareCount=r,this.getState(),e.__internals__.logger.info("rtkScreenShare::initialise",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount,maxAllowedCount:this.maxScreenShareCount}}}),this.stageStatus=e.stage.status,e.participants.joined.addListener("screenShareUpdate",this.screenShareListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener),t.addListener("screenShareUpdate",this.screenShareListener),t.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),null===i||void 0===i||i.addListener("stageStatusUpdate",this.stageStatusListener)}}hasPermissionError(){return"SYSTEM_DENIED"===this.shareScreenPermission||"DENIED"===this.shareScreenPermission}getState(){let e="",t="",i="",r={};const n=this.hasPermissionError()&&!this.screenShareEnabled,s=this.reachedMaxScreenShares()&&!this.screenShareEnabled,a="COULD_NOT_START"===this.shareScreenPermission;this.screenShareEnabled&&!n?(t=this.t("screenshare.stop"),i=this.iconPack.share_screen_stop,r["red-icon"]=!0):(t=this.t("screenshare.start"),i=this.iconPack.share_screen_start),"SYSTEM_DENIED"===this.shareScreenPermission?(e=this.t("perm_sys_denied.screenshare"),r["red-icon"]=!0):"DENIED"===this.shareScreenPermission?(e=this.t("perm_denied.screenshare"),r["red-icon"]=!0):e=t,s&&(e=this.t("screenshare.error.max_count")),a&&(e=this.t("screenshare.error.unknown")),this.screenShareState={tooltipLabel:e,label:t,icon:i,classList:r,disable:n||s,showWarning:n||s||a}}render(){return Pp()&&this.canScreenShare&&!["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus)?Z(J,{title:this.screenShareState.label},Z("rtk-tooltip",{placement:"top",kind:"block",label:this.screenShareState.tooltipLabel,delay:600,part:"tooltip"},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,variant:this.variant,label:this.screenShareState.label,icon:this.screenShareState.icon,class:this.screenShareState.classList,onClick:this.toggleScreenShare,disabled:this.screenShareState.disable,showWarning:this.screenShareState.showWarning}))):Z(J,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};_p([On()],Cp.prototype,"states",void 0),_p([On()],Cp.prototype,"meeting",void 0),_p([On()],Cp.prototype,"iconPack",void 0),_p([On()],Cp.prototype,"t",void 0),Cp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var Ap=Object.freeze({__proto__:null,rtk_screen_share_toggle:Cp});const Rp=e=>{null!=e&&(null!=e.requestFullscreen?e.requestFullscreen():null!=e.mozRequestFullScreen?e.mozRequestFullScreen():null!=e.webkitRequestFullscreen?e.webkitRequestFullscreen():null!=e.msRequestFullscreen&&e.msRequestFullscreen())},Lp=()=>{null!=document.exitFullscreen?document.exitFullscreen():null!=document.mozExitFullScreen?document.mozExitFullScreen():null!=document.webkitExitFullscreen?document.webkitExitFullscreen():null!=document.msExitFullscreen&&document.msExitFullscreen()},Ip=()=>null!=document.fullscreenElement||null!=document.webkitCurrentFullScreenElement,Mp=()=>"undefined"!==typeof document&&(document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled);var Dp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Op=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.play=re(this,"screensharePlay",7),this.fullScreenListener=()=>{this.isFullScreen=Ip()},this.participantScreenshareUpdate=e=>{e.id===this.participant.id&&this.screenShareListener(e)},this.hideFullScreenButton=!1,this.nameTagPosition="bottom-left",this.variant="solid",this.iconPack=pn,this.t=un(),this.videoExpanded=!1,this.screenShareEnabled=!1,this.isFullScreen=!1,this.toggleFullScreen=()=>{this.isFullScreen?(Lp(),this.isFullScreen=!1):(Rp(this.host),this.isFullScreen=!0)}}connectedCallback(){null===window||void 0===window||window.addEventListener("fullscreenchange",this.fullScreenListener),null===window||void 0===window||window.addEventListener("webkitfullscreenchange",this.fullScreenListener)}componentDidLoad(){this.participantChanged(this.participant)}disconnectedCallback(){if(!this.meeting)return;const{self:e}=this.meeting;this.participant.id===e.id&&this.screenShareListener?this.participant.removeListener("screenShareUpdate",this.screenShareListener):this.meeting.participants.joined.removeListener("screenShareUpdate",this.participantScreenshareUpdate),null===window||void 0===window||window.removeEventListener("fullscreenchange",this.fullScreenListener),null===window||void 0===window||window.removeEventListener("webkitfullscreenchange",this.fullScreenListener)}participantChanged(e){if(null!=e&&this.meeting){const{self:t}=this.meeting;this.screenShareListener=e=>{let{screenShareEnabled:t,screenShareTracks:i}=e;const r=t&&null!=i.video;if(M(()=>{this.screenShareEnabled=r}),r){const e=new MediaStream;e.addTrack(i.video),null!=this.videoEl&&(this.videoEl.srcObject=e,this.videoEl.play())}else null!=this.videoEl&&(this.videoEl.srcObject=void 0)},this.screenShareListener(e),e.id===t.id?e.addListener("screenShareUpdate",this.screenShareListener):this.meeting.participants.joined.addListener("screenShareUpdate",this.participantScreenshareUpdate)}}render(){var e,t;const i=(null===(e=this.participant)||void 0===e?void 0:e.id)===(null===(t=this.meeting)||void 0===t?void 0:t.self.id),r=this.isFullScreen?this.t("full_screen.exit"):this.t("full_screen"),n=this.isFullScreen?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize;return Z(J,{key:"34b2ef729d2ac2c5bdff2c29412a72d539ab512c",class:{isSelf:i}},Z("div",{key:"video-container",id:"video-container",class:{expand:this.videoExpanded}},Z("video",{key:"2ce3c6939616fa6bb4e487d3ba4ef0a343aaeb6f",ref:e=>this.videoEl=e,class:{visible:this.screenShareEnabled,"fit-in-container":this.participant.supportsRemoteControl},playsInline:!0,onPlay:()=>{this.play.emit({screenshareParticipant:this.participant,participant:this.meeting.self})},autoPlay:!0,muted:!0,id:"screen-share-video-".concat(this.participant.id)})),Z("div",{id:"controls",key:"controls"},!this.hideFullScreenButton&&!i&&Mp()&&Z("rtk-tooltip",{key:"0d85023b8a8347a93279abafde8fbf09cb41b95a",label:r},Z("rtk-button",{key:"1c2de414eaa60015a51b332490a276e1372cd968",id:"full-screen-btn",kind:"icon",onClick:this.toggleFullScreen,title:r},Z("rtk-icon",{key:"4855d0ff22108ab6bb859d771955c5e3eb5d69f6",icon:n,"aria-hidden":!0,tabIndex:-1})))),i&&Z("div",{id:"self-message",key:"self-message"},Z("h3",{key:"052603a136533ed56f70dc1c8aa36f1423925c61"},this.t("screenshare.shared")),Z("div",{key:"25f07fbc055318abcf486ac977ec89fc6c65c191",class:"actions"},null!=this.meeting&&Z("rtk-button",{key:"0740cd5d8b0dc40615d3142e07eb7f4ae36238d7",variant:"danger",onClick:()=>{this.meeting.self.disableScreenShare()}},Z("rtk-icon",{key:"4d2a00a772c9dc2f6cb5b9b42a99b096838d0df0",icon:this.iconPack.share_screen_stop,slot:"start"}),this.t("screenshare.stop")),Z("rtk-button",{key:"5fda78778feed97ac9b5b44a449011927b855cfa",variant:"secondary",id:"expand-btn",onClick:()=>{this.videoExpanded=!this.videoExpanded}},Z("rtk-icon",{key:"e20687dfdbdad334c23cb49e366c24fd1a71047d",icon:this.videoExpanded?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize,slot:"start"}),this.videoExpanded?this.t("screenshare.min_preview"):this.t("screenshare.max_preview")))),Z("slot",{key:"4a2fedd80bef177633ccdfee754d06186692e6bb"}))}get host(){return ie(this)}static get watchers(){return{participant:["participantChanged"]}}};Dp([On()],Op.prototype,"meeting",void 0),Dp([On()],Op.prototype,"iconPack",void 0),Dp([On()],Op.prototype,"t",void 0),Op.style=":host {\n line-height: initial;\n font-family: var(--rtk-font-family, sans-serif);\n\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n\np {\n margin: var(--rtk-space-0, 0px);\n padding: var(--rtk-space-0, 0px);\n}\n\n\n:host {\n height: 100%;\n width: 100%;\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n border-radius: var(--rtk-border-radius-lg, 12px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));\n container-type: inline-size;\n container-name: screentile;\n}\n\n::slotted(rtk-name-tag) {\n position: absolute;\n left: var(--rtk-space-3, 12px);\n bottom: var(--rtk-space-3, 12px);\n opacity: 0.8;\n}\n\n#video-container {\n position: absolute;\n display: block;\n height: 100%;\n width: 100%;\n}\n\n#video-container .fit-in-container {\n -o-object-fit: fill;\n object-fit: fill;\n}\n\nvideo {\n height: 100%;\n width: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n:host([variant='gradient']) ::slotted(rtk-audio-visualizer) {\n position: absolute;\n top: var(--rtk-space-2, 8px);\n right: var(--rtk-space-2, 8px);\n border-radius: 9999px;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n padding: var(--rtk-space-2, 8px);\n}\n\n:host([variant='gradient']) ::slotted(rtk-name-tag) {\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n text-align: center;\n background-color: transparent;\n background-image: linear-gradient(to top, var(--tw-gradient-stops));\n --tw-gradient-from: rgb(var(--rtk-colors-background-1000, 8 8 8));\n --tw-gradient-to: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);\n --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);\n --tw-gradient-to: transparent;\n}\n\n:host([size='sm'][variant='gradient']) ::slotted(rtk-audio-visualizer) {\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n}\n\nvideo.visible {\n animation: video-fadein 0.4s ease;\n}\n\n#controls {\n display: none;\n position: absolute;\n top: var(--rtk-space-3, 12px);\n right: var(--rtk-space-3, 12px);\n align-items: center;\n justify-content: flex-end;\n gap: var(--rtk-space-2, 8px);\n}\n\n:host(:hover) #controls, \n:host(:active) #controls, \n:host(:focus-visible) #controls {\n display: flex;\n}\n\n#full-screen-btn {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n}\n\n/** For self view */\n\nh3 {\n margin-top: var(--rtk-space-10, 40px);\n margin-bottom: var(--rtk-space-6, 24px);\n text-align: center;\n font-size: 20px;\n font-weight: 500;\n}\n\n:host([size='sm']) h3 {\n font-size: 16px;\n}\n\n#self-message {\n padding-left: var(--rtk-space-4, 16px);\n padding-right: var(--rtk-space-4, 16px);\n}\n\n:host(.isSelf) #self-view {\n flex: 1 1 0%;\n}\n\n:host(.isSelf) #video-container {\n position: static;\n aspect-ratio: auto;\n height: auto;\n width: 50%;\n max-width: var(--rtk-space-96, 384px);\n border-radius: var(--rtk-border-radius-md, 8px);\n transition: 0.6s ease;\n}\n\n:host(.isSelf) #video-container.expand {\n width: 60%;\n max-width: 100%;\n}\n\n.actions {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--rtk-space-2, 8px);\n}\n\n:host([size='sm'].isSelf) #video-container,\n:host([size='md'].isSelf) #video-container,\n:host([size='sm'].isSelf) #expand-btn,\n:host([size='md'].isSelf) #expand-btn {\n /** Hide video, fullscreen buttons in sm and md breakpoints */\n display: none;\n}\n\n/** Remote control */\n\np {\n margin: var(--rtk-space-0, 0px);\n padding: var(--rtk-space-0, 0px);\n}\n\n.remote-control {\n z-index: 10;\n height: 100%;\n max-height: 100%;\n flex: 0 1 auto;\n}\n\n#remote-control-self {\n position: absolute;\n top: var(--rtk-space-0, 0px);\n left: 50%;\n z-index: 10;\n width: -moz-max-content;\n width: max-content;\n max-width: 100%;\n box-sizing: border-box;\n display: flex;\n height: var(--rtk-space-8, 32px);\n align-items: center;\n overflow: hidden;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-bg-opacity));\n font-size: 12px;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n transform: translateX(-50%);\n}\n\n#remote-control-self p {\n padding-left: var(--rtk-space-3, 12px);\n padding-right: var(--rtk-space-3, 12px);\n padding-top: var(--rtk-space-2, 8px);\n padding-bottom: var(--rtk-space-2, 8px);\n}\n\n#remote-control-self rtk-button {\n height: 100%;\n border-radius: var(--rtk-border-radius-none, 0);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity));\n font-size: 12px;\n}\n\n:host([size='sm']) #remote-control-self {\n height: auto;\n flex-direction: column;\n}\n\n:host([size='sm']) #remote-control-self rtk-button {\n width: 100%;\n padding-top: var(--rtk-space-1, 4px);\n padding-bottom: var(--rtk-space-1, 4px);\n}\n\n/** Name tag positions */\n\n:host([name-tag-position='bottom-right']) ::slotted(rtk-name-tag) {\n left: auto;\n right: var(--rtk-space-3, 12px);\n}\n\n:host([name-tag-position='bottom-center']) ::slotted(rtk-name-tag) {\n left: auto;\n right: auto;\n}\n\n:host([name-tag-position='top-left']) ::slotted(rtk-name-tag) {\n top: var(--rtk-space-3, 12px);\n bottom: auto;\n}\n\n:host([name-tag-position='top-right']) ::slotted(rtk-name-tag) {\n top: var(--rtk-space-3, 12px);\n right: var(--rtk-space-3, 12px);\n left: auto;\n bottom: auto;\n}\n\n:host([name-tag-position='top-center']) ::slotted(rtk-name-tag) {\n left: auto;\n right: auto;\n bottom: auto;\n top: var(--rtk-space-3, 12px);\n}\n\n/** Keyframes */\n\n@keyframes video-fadein {\n 0% {\n opacity: 0;\n transform: scale(1.4) translateY(20px);\n }\n\n 100% {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n::slotted(rtk-network-indicator) {\n position: absolute;\n right: var(--rtk-space-3, 12px);\n bottom: var(--rtk-space-3, 12px);\n}\n\n@media only screen and (max-height: 480px) and (orientation: landscape) {\n :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag), \n :host([size='sm'][variant='solid']) rtk-name-tag {\n left: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n border-radius: var(--rtk-border-radius-none, 0);\n transform-origin: 0% 110%;\n transform: scale(0.6);\n }\n}\n\n@container screentile (max-width: 400px) {\n ::slotted(rtk-name-tag) {\n transform-origin: 0 130%;\n transform: scale(0.7);\n }\n}\n";var Np=Object.freeze({__proto__:null,rtk_screenshare_view:Op});var Up=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Fp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.keyPressListener=e=>{"Escape"===e.key&&this.close()},this.stageStatusListener=()=>{this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo},this.iconPack=pn,this.t=un(),this.activeTab="connection",this.isMobileMainVisible=!1,this.networkStatus="good",this.canProduceVideo=!1}connectedCallback(){document.addEventListener("keydown",this.keyPressListener),this.meetingChanged(this.meeting)}disconnectedCallback(){var e;this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener),this.poorConnectionListener&&(null===(e=this.meeting)||void 0===e||e.meta.removeListener("poorConnection",this.poorConnectionListener)),this.meeting.stage.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(e){null!=e&&(this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo,this.canProduceVideo?this.activeTab="video":this.activeTab="audio",this.poorConnectionListener=e=>{let{score:t}=e;t<7?this.networkStatus="poor":t<4&&(this.networkStatus="poorest"),setTimeout(()=>{this.networkStatus="good"},5e3)},e.meta.addListener("poorConnection",this.poorConnectionListener),e.stage.addListener("stageStatusUpdate",this.stageStatusListener))}changeTab(e){this.activeTab=e,"sm"===this.size&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeSettings:!1})}render(){if(!this.meeting)return null;const e={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t};return Z(J,null,Z("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},Z("header",null,Z("h2",null,this.t("settings"))),Z("button",{type:"button",class:{active:"audio"===this.activeTab},onClick:()=>this.changeTab("audio")},this.t("audio"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.mic_on}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right}))),this.canProduceVideo&&Z("button",{type:"button",class:{active:"video"===this.activeTab},onClick:()=>this.changeTab("video")},this.t("video"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.video_on}),"sm"===this.size&&Z("rtk-icon",{icon:this.iconPack.chevron_right}))),Z("button",{type:"none",title:"Your network condition is ".concat(this.networkStatus)},this.t("connection"),Z("div",{class:"right"},Z("rtk-icon",{icon:this.iconPack.wifi,class:this.networkStatus})))),Z("main",{class:{active:this.isMobileMainVisible,scrollbar:!0},part:"main-content"},"sm"===this.size&&Z("header",null,Z("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},Z("rtk-icon",{icon:this.iconPack.chevron_left})),Z("h2",null,this.t("audio"===this.activeTab?"audio":"video"))),"audio"===this.activeTab&&Z("rtk-settings-audio",Object.assign({},e)),"video"===this.activeTab&&Z("rtk-settings-video",Object.assign({},e))))}static get watchers(){return{meeting:["meetingChanged"]}}};Up([On()],Fp.prototype,"meeting",void 0),Up([On()],Fp.prototype,"states",void 0),Up([On()],Fp.prototype,"iconPack",void 0),Up([On()],Fp.prototype,"t",void 0),Fp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}.title{font-size:20px;line-height:1}.back-btn,.dismiss-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover,.dismiss-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;min-width:var(--rtk-space-56, 224px);flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:16px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}main{display:flex;flex:1 1 0%;align-items:center;justify-content:center;padding-left:var(--rtk-space-6, 24px);padding-right:var(--rtk-space-6, 24px);box-sizing:border-box;width:100%;max-width:calc(100% - var(--rtk-space-56, 224px))}.dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([size='sm']) .dismiss-btn{top:var(--rtk-space-5, 20px);right:var(--rtk-space-4, 16px)}:host([size='sm']) aside{width:100%;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;max-width:100%;overflow-y:auto;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) main header{justify-content:center}:host([size='sm']) main header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}:host([size='sm']) main.active{display:block}";var jp=Object.freeze({__proto__:null,rtk_settings:Fp});var Bp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Vp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un()}toggleSettings(){const e={activeSettings:!0,activeMoreMenu:!1};this.states=Object.assign(Object.assign({},this.states),e),this.stateUpdate.emit(e)}render(){const e=this.t("settings");return Z(J,{key:"a35e91bc92a802afd3eaf6f3211d1db7693413d1",title:e},Z("rtk-controlbar-button",{key:"03fb21e343891459262180be282065331a6140a3",part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleSettings(),icon:this.iconPack.settings,label:e,variant:this.variant}))}};Bp([On()],Vp.prototype,"states",void 0),Bp([On()],Vp.prototype,"iconPack",void 0),Bp([On()],Vp.prototype,"t",void 0),Vp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}";var zp=Object.freeze({__proto__:null,rtk_settings_toggle:Vp});var Hp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const $p=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.config=sn(),this.iconPack=pn,this.t=un(),this.isJoining=!1,this.canEditName=!0,this.canProduceAudio=!0,this.socketStateUpdate=e=>{let{state:t}=e;this.connectionState=t,"failed"===t&&(this.isJoining=!1)},this.join=async()=>{var e,t,i;if(""!==(null===(e=this.displayName)||void 0===e?void 0:e.trim())&&!this.isJoining){this.isJoining=!0,null===(t=this.meeting)||void 0===t||t.self.setName(this.displayName),mn.setItem("rtk-display-name",this.displayName);try{await(null===(i=this.meeting)||void 0===i?void 0:i.joinRoom())}catch(r){this.isJoining=!1}}}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.meta.removeListener("socketConnectionUpdate",this.socketStateUpdate)}componentDidLoad(){var e;null===(e=this.inputEl)||void 0===e||e.focus()}meetingChanged(e){var t,i,r;e&&(this.connectionState=null===(t=e.meta.socketState)||void 0===t?void 0:t.state,this.canEditName=null===(i=e.self.permissions.canEditDisplayName)||void 0===i||i,this.displayName=(null===(r=e.self.name)||void 0===r?void 0:r.trim())||(this.canEditName?"":"Participant"),e.meta.addListener("socketConnectionUpdate",this.socketStateUpdate))}render(){var e,t,i,r,n,s;if(!this.meeting)return;const a=""===(null===(e=this.displayName)||void 0===e?void 0:e.trim())||"connected"!==this.connectionState||this.isJoining,o={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},c=null===(r=null===(i=null===(t=this.meeting)||void 0===t?void 0:t.meta)||void 0===i?void 0:i.meetingTitle)||void 0===r?void 0:r.trim();return Z(J,null,Z("div",{class:"container"},Z("div",{class:"container-tile"},Z(ws,{element:"rtk-participant-tile",defaults:o,props:{participant:null===(n=this.meeting)||void 0===n?void 0:n.self,size:"md",isPreview:!0},childProps:{participant:null===(s=this.meeting)||void 0===s?void 0:s.self,size:"md"},deepProps:!0}),Z("div",{class:"media-selectors"},Z("rtk-microphone-selector",Object.assign({},o,{variant:"inline"})),Z("rtk-camera-selector",Object.assign({},o,{variant:"inline"})),Z("rtk-speaker-selector",Object.assign({},o,{variant:"inline"})))),Z("div",{class:"metadata"},c&&""!==c&&Z("div",{class:"meeting-title"},c),this.canEditName?Z(Qe,null,Z("div",{class:"join-as"},this.t("setup_screen.join_in_as")),Z("input",{placeholder:this.t("setup_screen.your_name"),value:this.displayName,spellcheck:!1,autoFocus:!0,ref:e=>{this.inputEl=e},onInput:e=>{this.displayName=e.target.value},onKeyDown:e=>{"Enter"===e.key&&this.join()}})):Z("div",{class:"uneditable-name"},Z("span",{class:"text"},this.t("setup_screen.join_in_as")," ")," ",Z("div",{class:"name"},Cn(this.displayName,20))),Z("rtk-button",{size:"lg",kind:"wide",onClick:this.join,disabled:a},this.isJoining?Z("rtk-spinner",{iconPack:this.iconPack}):this.t("join")),"connected"!==this.connectionState&&Z("div",{class:"no-network-badge"},Z("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected}),"failed"===this.connectionState?this.t("network.lost_extended"):this.t("network.lost")))))}static get watchers(){return{meeting:["meetingChanged"]}}};Hp([On()],$p.prototype,"meeting",void 0),Hp([On()],$p.prototype,"states",void 0),Hp([On()],$p.prototype,"config",void 0),Hp([On()],$p.prototype,"iconPack",void 0),Hp([On()],$p.prototype,"t",void 0),$p.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;padding:var(--rtk-space-4, 16px);height:100%;min-height:100%;width:100%;display:flex;place-items:center;justify-content:center;--rtk-controlbar-button-background-color:rgb(var(--rtk-colors-background-700, 44 44 44))}.container{width:100%;max-width:1080px;display:flex;align-items:center;justify-content:space-evenly;gap:var(--rtk-space-4, 16px)}.container-tile{display:flex;height:100%;width:100%;max-width:584px;flex-direction:column;gap:var(--rtk-space-2, 8px)}.metadata{display:flex;width:100%;max-width:var(--rtk-space-80, 320px);flex-direction:column;align-items:center;text-align:center}.meeting-title{margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:24px;font-weight:500}.join-as{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:16px;letter-spacing:-0.025em;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.uneditable-name{margin-bottom:var(--rtk-space-6, 24px)}.uneditable-name .text,.uneditable-name .name{display:inline-block}.uneditable-name .name{font-size:16px;font-weight:500}input{margin-bottom:var(--rtk-space-6, 24px);display:block;height:var(--rtk-space-10, 40px);width:100%;max-width:var(--rtk-space-80, 320px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));box-sizing:border-box;font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}rtk-spinner{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--icon-size:var(--rtk-space-8, 32px)}:host([size='sm']) .container,:host([size='md']) .container{height:100%;flex-direction:column;justify-content:space-evenly}:host([size='sm']) .container-tile,:host([size='md']) .container-tile{height:-moz-min-content;height:min-content;flex-direction:column;justify-content:center}rtk-participant-tile{height:auto;width:100%;max-width:584px}.media-selectors{display:flex;flex-direction:column;justify-content:space-between}.media-selectors .row{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr))}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}";var Gp=Object.freeze({__proto__:null,rtk_setup_screen:$p});var Wp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const qp=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.enabledSections=[],this.defaultSection="chat",this.config=sn(),this.iconPack=pn,this.t=un(),this.view="sidebar",this.currentTab=this.defaultSection,this.isFloating=!1,this.enablePinning=!0,this.getTabs=()=>this.meeting.self.config?this.enabledSections.filter(e=>this.meeting.self.config.controlBar.elements[e.id]):this.enabledSections,this.close=()=>{this.stateUpdate.emit({activeSidebar:!1,sidebar:this.defaultSection})},this.toggleFloating=()=>{this.isFloating=!this.isFloating}}connectedCallback(){var e;this.viewChanged(this.view),this.statesChanged(this.states),this.meetingChanged(this.meeting),this.isFloating=(null===(e=this.states)||void 0===e?void 0:e.sidebarFloating)||!1}disconnectedCallback(){var e,t;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.onStageStatusUpdate),this.onStageStatusUpdate=null}meetingChanged(e){var t,i;e&&(this.updateEnabledSections(e),this.onStageStatusUpdate=e=>{this.updateEnabledSections(this.meeting)},null===(i=null===(t=this.meeting)||void 0===t?void 0:t.stage)||void 0===i||i.on("stageStatusUpdate",this.onStageStatusUpdate))}statesChanged(e){const t=e;(null===t||void 0===t?void 0:t.sidebar)&&(this.currentTab=t.sidebar)}viewChanged(e){this.enablePinning="full-screen"!==e}viewSection(e){this.currentTab=e,this.stateUpdate.emit({activeSidebar:!0,sidebar:this.currentTab})}updateEnabledSections(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.meeting;const t=[];Zd(e)&&t.push({id:"chat",name:this.t("chat")}),Yd(e)&&t.push({id:"polls",name:this.t("polls")}),Jd(e)&&t.push({id:"participants",name:this.t("participants")}),Qd(e)&&t.push({id:"plugins",name:this.t("plugins")}),this.enabledSections=t}render(){var e;if(!this.meeting)return null;const t={meeting:this.meeting,config:this.config,states:this.states,size:this.size,t:this.t,iconPack:this.iconPack};return!1!==(null===(e=t.states)||void 0===e?void 0:e.activeSidebar)&&this.currentTab?Z(J,{class:this.enablePinning?this.isFloating?"floating":"":"floating"},Z("rtk-sidebar-ui",{tabs:this.getTabs(),currentTab:this.currentTab,view:this.view,onTabChange:e=>{this.viewSection(e.detail)},onSidebarClose:this.close},this.enablePinning&&Z("div",{class:"pinned-state",slot:"pinned-state"},Z("rtk-button",{variant:"ghost",kind:"icon",onClick:this.toggleFloating,"aria-label":this.isFloating?this.t("pin"):this.t("unpin")},Z("rtk-icon",{icon:this.isFloating?this.iconPack.pin:this.iconPack.pin_off}))),"chat"===t.states.sidebar&&Z(ws,{element:"rtk-chat",defaults:t,props:{slot:"chat"}}),"polls"===t.states.sidebar&&Z("rtk-polls",Object.assign({},t,{slot:"polls"})),"participants"===t.states.sidebar&&Z(ws,{element:"rtk-participants",defaults:t,props:{slot:"participants"}}),"plugins"===t.states.sidebar&&Z("rtk-plugins",Object.assign({},t,{slot:"plugins"})))):null}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],view:["viewChanged"]}}};Wp([On()],qp.prototype,"meeting",void 0),Wp([On()],qp.prototype,"states",void 0),Wp([On()],qp.prototype,"config",void 0),Wp([On()],qp.prototype,"iconPack",void 0),Wp([On()],qp.prototype,"t",void 0),qp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;max-width:var(--rtk-space-96, 384px);box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-border-opacity))}:host([view='sidebar']){right:var(--rtk-space-2, 8px);overflow:clip;border-radius:var(--rtk-border-radius-lg, 12px);--tw-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-900, 26 26 26));--tw-shadow:var(--tw-shadow-colored)}:host([view='full-screen']){top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);max-width:100%}:host(.floating){position:absolute !important;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);left:auto;z-index:50}.pinned-state{position:absolute;right:var(--rtk-space-1, 4px);display:inline-flex;width:var(--rtk-space-2, 8px);justify-content:flex-end}";var Kp=Object.freeze({__proto__:null,rtk_sidebar:qp});var Zp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Yp=class{constructor(e){f(this,e),this.participants=[],this.aspectRatio="16:9",this.gap=8,this.config=sn(),this.iconPack=pn,this.t=un(),this.dimensions={width:0,height:0},this.setHostDimensions=()=>{const{clientWidth:e,clientHeight:t}=this.host;this.dimensions={width:e,height:t}}}connectedCallback(){this.resizeObserver=new _a(this.setHostDimensions),this.resizeObserver.observe(this.host),this.meetingChanged(this.meeting)}meetingChanged(e){const t=null===e||void 0===e?void 0:e.meta;t&&(this.mediaConnection=Object.assign({},t.mediaState))}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}render(){if(!this.meeting)return null;const e={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},{width:t,height:i,getPosition:r}=ru({dimensions:this.dimensions,count:this.participants.length,aspectRatio:this.aspectRatio,gap:this.gap});return Z(J,null,Z("slot",null,this.participants.map((n,s)=>{const{top:a,left:o}=r(s);return Z(ws,{element:"rtk-participant-tile",defaults:e,props:{participant:n,style:{position:"absolute",top:"".concat(a,"px"),left:"".concat(o,"px"),width:"".concat(t,"px"),height:"".concat(i,"px")},key:n.id,"data-participant":n.id,mediaConnection:this.mediaConnection},childProps:{participant:n},deepProps:!0})})))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"]}}};Zp([On()],Yp.prototype,"meeting",void 0),Zp([On()],Yp.prototype,"states",void 0),Zp([On()],Yp.prototype,"config",void 0),Zp([On()],Yp.prototype,"iconPack",void 0),Zp([On()],Yp.prototype,"t",void 0),Yp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block;height:100%;width:100%}";var Jp=Object.freeze({__proto__:null,rtk_simple_grid:Yp});var Qp=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Xp=class{constructor(e){f(this,e),this.layout="row",this.participants=[],this.pinnedParticipants=[],this.aspectRatio="16:9",this.gap=8,this.config=sn(),this.iconPack=pn,this.t=un(),this.gridSize=su,this.getAdaptiveSize=e=>"sm"===this.size||e>3||"md"===this.size?"sm":"md"}render(){const e={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},t=this.participants.filter(e=>this.pinnedParticipants.some(t=>t.id!=e.id));return Z(J,{key:"7640a44634c724d5964c4b4ac2e1a131483b1251"},Z("main",{key:"ef00af9d4b4eabb86652d7b852c962bc71311012",part:"main"},Z(ws,{key:"6f3665ffdc49b0cb813b5b1a1d09132b685da2f7",element:"rtk-simple-grid",defaults:e,props:{part:"main-grid",participants:this.pinnedParticipants,aspectRatio:this.aspectRatio,gap:this.gap,size:this.getAdaptiveSize(this.pinnedParticipants.length)}})),t.length>0&&Z("aside",{key:"1b4f2c027f011b04a1f22dac96a82d5584f40aeb",part:"aside",class:this.gridSize.spotlight?"grid-width-".concat(this.gridSize.spotlight):"grid-width-md"},Z(ws,{key:"bcc34463bf791b77bb8f5050be2e5aeb3dd01289",element:"rtk-simple-grid",defaults:e,props:{part:"aside-grid",participants:t,aspectRatio:this.aspectRatio,gap:this.gap,size:this.getAdaptiveSize(t.length)}})))}get host(){return ie(this)}};Qp([On()],Xp.prototype,"meeting",void 0),Qp([On()],Xp.prototype,"states",void 0),Qp([On()],Xp.prototype,"config",void 0),Qp([On()],Xp.prototype,"iconPack",void 0),Qp([On()],Xp.prototype,"t",void 0),Xp.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%}main{flex:1 1 0%}.grid-width-sm{width:25%}.grid-width-md{width:50%}.grid-width-lg{width:66.666667%}:host([size='sm']),:host([size='md']){flex-direction:column}:host([size='md']) aside{max-height:var(--rtk-space-96, 384px);width:100%;max-width:100%}:host([size='md']) .grid-width-sm{height:25%}:host([size='md']) .grid-width-md{height:50%}:host([size='md']) .grid-width-lg{height:66.666667%}:host([size='sm']) aside{max-height:var(--rtk-space-96, 384px);width:100%;max-width:100%}:host([size='sm']) .grid-width-sm,:host([size='sm']) .grid-width-md,:host([size='sm']) .grid-width-lg{height:50%}:host([size='xl']) .grid-width-sm,:host([size='xl']) .grid-width-md,:host([size='xl']) .grid-width-lg{width:400px}:host([layout='column']){flex-direction:column}:host([layout='column']) main{flex:4}:host([layout='column']) aside{flex:2;max-width:100%;width:100%}";var eg=Object.freeze({__proto__:null,rtk_spotlight_grid:Xp});var tg=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ig=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un()}render(){return Z(J,{key:"b0f0bb2c16e9965cc7f646624118a8cee13538a5"},Z("slot",{key:"9555e0c26d9ab23b6fb02e1e1d4025eaaf6df704"}))}};tg([On()],ig.prototype,"iconPack",void 0),tg([On()],ig.prototype,"t",void 0),ig.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;position:relative;overflow:hidden}";var rg=Object.freeze({__proto__:null,rtk_stage:ig});var ng=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const sg=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.stageStatus="OFF_STAGE",this.state={label:"",disabled:!1,icon:""},this.stageCallback=async()=>{var e,t,i,r,n,s,a;const o=null===(e=this.meeting.stage)||void 0===e?void 0:e.status;"ON_STAGE"===o&&await(null===(i=null===(t=null===this||void 0===this?void 0:this.meeting)||void 0===t?void 0:t.stage)||void 0===i?void 0:i.leave()),"OFF_STAGE"===o&&(null===(n=null===(r=null===this||void 0===this?void 0:this.meeting)||void 0===r?void 0:r.stage)||void 0===n||n.requestAccess(),(e=>{var t,i;return(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.stageEnabled)&&"ALLOWED"===(null===(i=null===e||void 0===e?void 0:e.self)||void 0===i?void 0:i.permissions.stageAccess)})(this.meeting)&&(this.states.activeJoinStage=!0,this.stateUpdate.emit({activeJoinStage:!0}))),"REQUESTED_TO_JOIN_STAGE"===o&&(null===(a=null===(s=null===this||void 0===this?void 0:this.meeting)||void 0===s?void 0:s.stage)||void 0===a||a.cancelRequestAccess())}}connectedCallback(){this.meetingChanged(this.meeting)}stageStatusHandler(e,t){this.stageStatus=t,"ACCEPTED_TO_JOIN_STAGE"===t&&(e.self.setupTracks({audio:!1,video:!1}),this.stateUpdate.emit({activeJoinStage:!0})),this.state=this.getState()}disconnectedCallback(){var e,t;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",e=>this.stageStatusHandler(this.meeting,e))}meetingChanged(e){var t,i,r,n;e&&(this.stageStatus=null===(t=e.stage)||void 0===t?void 0:t.status,this.stageStatusHandler(e,null===(i=e.stage)||void 0===i?void 0:i.status),null===(n=null===(r=this.meeting)||void 0===r?void 0:r.stage)||void 0===n||n.on("stageStatusUpdate",t=>this.stageStatusHandler(e,t)))}getState(){let e="",t="",i=!1;switch(this.stageStatus){case"ON_STAGE":t=this.iconPack.leave_stage,e=this.t("stage_request.leave_stage"),i=!1;break;case"ACCEPTED_TO_JOIN_STAGE":t=this.iconPack.join_stage,e=this.t("stage_request.request"),i=!0;break;case"REQUESTED_TO_JOIN_STAGE":t=this.iconPack.join_stage,e=this.t("stage_request.requested"),i=!1;break;default:t=this.iconPack.join_stage,e=this.t("stage_request.request"),i=!1}return{label:e,disabled:i,icon:t}}render(){return(e=>{var t,i;return(null===(t=null===e||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions.stageEnabled)&&"NOT_ALLOWED"!==(null===(i=null===e||void 0===e?void 0:e.self)||void 0===i?void 0:i.permissions.stageAccess)})(this.meeting)?Z(J,{title:this.state.label},Z("rtk-tooltip",{placement:"top",kind:"block",label:this.state.label,delay:600,part:"tooltip"},Z("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,variant:this.variant,label:this.state.label,icon:this.state.icon,onClick:this.stageCallback,disabled:this.state.disabled,showWarning:!1}))):Z(J,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};ng([On()],sg.prototype,"meeting",void 0),ng([On()],sg.prototype,"iconPack",void 0),ng([On()],sg.prototype,"states",void 0),ng([On()],sg.prototype,"t",void 0),sg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var ag=Object.freeze({__proto__:null,rtk_stage_toggle:sg});var og=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const cg=class{constructor(e){f(this,e),this.config=sn(),this.t=un(),this.transcripts=[],this.listenerAttached=!1,this.onTranscript=e=>{e.transcript&&this.add(e)}}connectedCallback(){this.meetingChanged(this.meeting)}addListener(e){var t;null===(t=null===e||void 0===e?void 0:e.ai)||void 0===t||t.addListener("transcript",this.onTranscript),this.listenerAttached=!0}clearListeners(e){var t;this.onTranscript&&(null===(t=null===e||void 0===e?void 0:e.ai)||void 0===t||t.removeListener("transcript",this.onTranscript)),this.listenerAttached=!1,clearTimeout(this.disconnectTimeout),this.transcripts=[]}disconnectedCallback(){this.meeting&&this.clearListeners(this.meeting)}meetingChanged(e,t){clearTimeout(this.disconnectTimeout),t&&this.clearListeners(t),e&&this.states.activeCaptions&&this.addListener(e)}statesChanged(e){e&&(e.activeCaptions&&!this.listenerAttached&&this.addListener(this.meeting),!e.activeCaptions&&this.listenerAttached&&this.clearListeners(this.meeting))}transcriptionsReducer(e,t){if(!e.length)return[t];let i=e[e.length-1];return i.peerId!==t.peerId?e.concat(t):i.id===t.id?(i.transcript=t.transcript,e.pop(),e.concat(rn(i))):e.concat(t)}add(e){this.transcripts=this.transcriptionsReducer(this.transcripts,e)}remove(e){this.transcripts=this.transcripts.filter(t=>t.renderedId!==e)}handleDismiss(e){e.stopPropagation();const{id:t,renderedId:i}=e.detail,r=this.host.shadowRoot.querySelector('[data-id="'.concat(t,'"]'));null===r||void 0===r||r.classList.add("exit"),setTimeout(()=>{M(()=>{this.remove(i)})},400)}renderTranscripts(){const e=[];return this.transcripts.forEach(t=>{const i={name:t.name,date:t.date,peerId:t.peerId,transcript:t.transcript,id:t.id,renderedId:t.id};if(!e.length)return t.renderedId=i.renderedId,void e.push(i);const r=e[e.length-1];if(r.transcript.length+i.transcript.length>400||r.peerId!==t.peerId)return t.renderedId=i.renderedId,void e.push(i);r.transcript+=" "+t.transcript,t.renderedId=r.renderedId}),e.splice(0,e.length-2),null===e||void 0===e?void 0:e.map(e=>Z("rtk-transcript",{key:e.id,"data-id":e.id,transcript:e,onRtkTranscriptDismiss:e=>this.handleDismiss(e),t:this.t}))}render(){if(this.states.activeCaptions)return Z(J,null,this.renderTranscripts())}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"]}}};og([On()],cg.prototype,"meeting",void 0),og([On()],cg.prototype,"states",void 0),og([On()],cg.prototype,"config",void 0),og([On()],cg.prototype,"t",void 0),cg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;justify-content:center;width:100%;z-index:5}rtk-transcript{margin-top:var(--rtk-space-2, 8px)}";var lg=Object.freeze({__proto__:null,rtk_transcripts:cg});const dg=class{constructor(e){f(this,e),this.statesUpdate=re(this,"rtkStatesUpdate",7),this.peerStore=null,this.providerId="provider-"+Math.floor(100*Math.random()),this.meeting=null,this.iconPack=pn,this.t=un(),this.config=sn(),this.mode="fixed",this.showSetupScreen=!1,this.roomJoinedListener=()=>{this.updateStates({meeting:"joined"})},this.waitlistedListener=()=>{this.updateStates({meeting:"waiting"})},this.roomLeftListener=e=>{let{state:t}=e;"disconnected"!==t&&"failed"!==t&&this.updateStates({meeting:"ended",roomLeftState:t})},this.mediaPermissionUpdateListener=e=>{let{kind:t,message:i}=e;if(["audio","video"].includes(t)&&("DENIED"===i||"SYSTEM_DENIED"===i)&&!0!==(this.peerStore||xn).state.states.activeDebugger){const e={enabled:!0,kind:t};this.updateStates({activePermissionsMessage:e})}},this.socketConnectionUpdateListener=e=>{let{state:t}=e;"failed"===t&&setTimeout(()=>{this.meeting.leave("disconnected")},1e4)},this.handleChangingMeeting=e=>{const t=this.peerStore.state.states;this.updateStates({activeBreakoutRoomsManager:Object.assign(Object.assign({},t.activeBreakoutRoomsManager),{destinationMeetingId:e})})}}connectedCallback(){"undefined"!==typeof window&&(this.authErrorListener=e=>{e.detail.message.includes("401")&&this.updateStates({meeting:"ended",roomLeftState:"unauthorized"})},window.addEventListener("rtkError",this.authErrorListener)),this.setupStoreRequestListener(),this.meetingChanged(this.meeting),this.iconPackChanged(this.iconPack),this.tChanged(this.t),this.configChanged(this.config)}disconnectedCallback(){window.removeEventListener("rtkError",this.authErrorListener),this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.meeting&&(this.meeting.self.removeListener("roomLeft",this.roomLeftListener),this.meeting.self.removeListener("roomJoined",this.roomJoinedListener),this.meeting.self.removeListener("waitlisted",this.waitlistedListener),this.meeting.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),this.meeting.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener))}updateStates(e){const t=this.peerStore||xn,i=Object.assign({},t.state.states);t.state.states=ta(i,e),this.statesUpdate.emit(t.state.states);const r=new CustomEvent("rtkStatesUpdate",{detail:t.state.states,bubbles:!0,composed:!0});this.host.dispatchEvent(r)}setupStateUpdateListener(){this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=e=>{this.updateStates(e.detail)},this.host.addEventListener("rtkStateUpdate",this.stateUpdateListener)}setupStoreRequestListener(){this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=e=>{if(!this.peerStore)return;const t=new CustomEvent("rtkProvideStore",{detail:{store:this.peerStore,requestId:e.detail.requestId}});document.dispatchEvent(t),e.stopPropagation()},this.host.addEventListener("rtkRequestStore",this.storeRequestListener)}meetingChanged(e){if(e&&(this.peerStore=Tn({meeting:e,config:this.config,iconPack:this.iconPack,t:this.t,providerId:this.providerId}),document.dispatchEvent(new CustomEvent("rtkPeerStoreReady",{detail:{peerId:e.self.id}}))),this.setupStateUpdateListener(),e){(this.peerStore||xn).state.meeting=e,this.updateStates({viewType:e.meta.viewType}),e.self.addListener("roomJoined",this.roomJoinedListener),e.self.addListener("waitlisted",this.waitlistedListener),e.self.addListener("roomLeft",this.roomLeftListener),e.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),e.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),e.connectedMeetings.supportsConnectedMeetings&&e.connectedMeetings.once("changingMeeting",this.handleChangingMeeting),e.self.roomJoined?this.updateStates({meeting:"joined"}):this.showSetupScreen?this.updateStates({meeting:"setup"}):e.joinRoom(),window.removeEventListener("rtkError",this.authErrorListener)}}iconPackChanged(e){this.peerStore&&(this.peerStore.state.iconPack=e)}tChanged(e){this.peerStore&&(this.peerStore.state.t=e)}configChanged(e){this.peerStore&&(this.peerStore.state.config=e),(null===e||void 0===e?void 0:e.designTokens)&&"undefined"!==typeof document&&!0!==(this.peerStore||xn).state.states.activeDebugger&&Ds(document.documentElement,e.designTokens)}render(){return this.meeting?Z(J,null,Z("slot",null)):null}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],iconPack:["iconPackChanged"],t:["tChanged"],config:["configChanged"]}}};dg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}";var hg=Object.freeze({__proto__:null,rtk_ui_provider:dg});var ug=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const pg=class{constructor(e){f(this,e),this.config=sn(),this.iconPack=pn,this.t=un()}render(){return Z(J,{key:"5f35f594c3c621db03b7d29397ebc5436bb8cb0d"},Z("slot",{key:"7e5eb00806056651b1fdd9cce1b7ff758a44afc2"},Z("div",{key:"dd9dc281d1592383d23ad7045fa38f231140ec7e",class:"centered",part:"content"},Z("rtk-logo",{key:"59bbcae1ba6cc66d5a0e3b0994b9801c1eeb1884",meeting:this.meeting,config:this.config,part:"logo",t:this.t}),Z("p",{key:"b7dfb63fc063abf5eeb8cba203cb842f504d2d87"},this.t("waitlist.body_text")))))}};ug([On()],pg.prototype,"meeting",void 0),ug([On()],pg.prototype,"config",void 0),ug([On()],pg.prototype,"iconPack",void 0),ug([On()],pg.prototype,"t",void 0),pg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.centered{display:flex;flex-direction:column;align-items:center}rtk-logo{margin-bottom:var(--rtk-space-8, 32px);height:var(--rtk-space-12, 48px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}";var gg=Object.freeze({__proto__:null,rtk_waiting_screen:pg});var fg=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const mg=class{constructor(e){f(this,e),this.participantQuery="",this.isProcessing=!1,this.t=un(),this.transcriptions=[],this.autoScrollEnabled=!0,this.onScroll=e=>{const{scrollTop:t,clientHeight:i,scrollHeight:r}=e.target,n=t+i;this.autoScrollEnabled=n+10>=r},this.onTranscriptHandler=e=>{this.transcriptions=this.transcriptionsReducer(this.transcriptions,e)}}transcriptionsReducer(e,t){if(!e.length||e[e.length-1].peerId!==t.peerId)return e.concat(t);const i=e[e.length-1];return i.id===t.id?(i.transcript=t.transcript,e.pop(),e.concat(i)):e.concat(t)}connectedCallback(){this.meeting&&this.meetingChanged(this.meeting)}componentDidLoad(){var e;null===(e=this.contentContainer)||void 0===e||e.addEventListener("scroll",this.onScroll)}disconnectedCallback(){var e,t,i;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.ai)||void 0===t||t.off("transcript",this.onTranscriptHandler),null===(i=this.contentContainer)||void 0===i||i.removeEventListener("scroll",this.onScroll)}meetingChanged(e){var t,i;this.transcriptions=rn(null===(t=null===e||void 0===e?void 0:e.ai)||void 0===t?void 0:t.transcripts),this.transcriptions=this.transcriptions.reduce(this.transcriptionsReducer,[]),null===(i=null===e||void 0===e?void 0:e.ai)||void 0===i||i.on("transcript",this.onTranscriptHandler)}transcriptionsChanged(){this.autoScrollEnabled&&setTimeout(()=>{vs(this.contentContainer,!1)},100)}renderTranscripts(){const e=this.transcriptions.filter(e=>!this.participantQuery||e.name.toLowerCase().includes(this.participantQuery.toLowerCase())),t=[];return e.forEach(e=>{const i={name:e.name,date:e.date,peerId:e.peerId,transcript:e.transcript};if(!t.length)return void t.push(i);const r=t[t.length-1];e.peerId===r.peerId?r.transcript+=" "+e.transcript:t.push(i)}),t.map(e=>Z("div",{class:"message"},Z(ms,{name:e.name,time:new Date(e.date),now:new Date}),Z("div",{class:"body"},e.transcript)))}render(){return Z(J,{key:"f9d8cea8917ddb558fd721020c71e32964c4e653"},Z("div",{key:"b35cf0970ccf2b813c99976e1554c2a4dc60ac12",class:"search-bar"},Z("input",{key:"d6c84982fbf1f5b7c9b8264228f622ca74d60672",type:"text",placeholder:"Search Participant",value:this.participantQuery,onInput:e=>this.participantQuery=e.target.value})),this.isProcessing&&Z("div",{key:"fbd031e9acdd967e2e81bcb655d3ff80a33210f5",class:"processing"},Z("p",{key:"7ee274172423aaac3f286f9463ae2c2b0a01d09e"},"Processing audio....")),!this.isProcessing&&Z("div",{key:"e07f3a7314132300113f955e7a83bc2ca18e6bc5",class:"content scrollbar",ref:e=>this.contentContainer=e},Z("div",{key:"3ffd0b4a02a6aaa136a282f145772e2f3afd3bc1",class:"started-message"},"Transcription started"),this.renderTranscripts()))}static get watchers(){return{meeting:["meetingChanged"],transcriptions:["transcriptionsChanged"]}}};fg([On()],mg.prototype,"t",void 0),fg([On()],mg.prototype,"meeting",void 0),mg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.head{display:flex;align-items:center}.head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}*{box-sizing:border-box;border-width:0;border-style:solid}:host{width:100%;display:flex;flex-direction:column}.processing{display:flex;flex:1 1 0%;flex-direction:column;align-items:center;justify-content:center}.content{box-sizing:border-box;display:flex;flex-direction:column;padding:var(--rtk-space-3, 12px);flex:1 0 0px;overflow-y:scroll}.started-message{margin-top:var(--rtk-space-5, 20px);margin-bottom:var(--rtk-space-5, 20px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.search-bar{height:var(--rtk-space-14, 56px);width:100%;border-bottom-width:var(--rtk-border-width-sm, 1px);--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));padding:var(--rtk-space-3, 12px)}input{height:100%;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);font-size:14px;border-radius:var(--rtk-border-radius-sm, 4px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.caption-view{height:var(--rtk-space-12, 48px);width:100%;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));display:flex;align-items:center;justify-content:space-between;font-size:14px}.message .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);font-size:14px;word-break:break-word}.message{margin-bottom:var(--rtk-space-3, 12px)}.message:last-child{margin-bottom:var(--rtk-space-0, 0px)}";var vg=Object.freeze({__proto__:null,rtk_ai_transcriptions:mg});var bg=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const kg=class{constructor(e){f(this,e),this.t=un(),this.iconPack=pn,this.setIsLivestreaming=e=>{this.isLivestreaming="LIVESTREAMING"===e}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.livestream)||void 0===t||t.removeListener("livestreamUpdate",this.setIsLivestreaming)}meetingChanged(e){var t,i;e&&(this.setIsLivestreaming(null===(t=this.meeting.livestream)||void 0===t?void 0:t.state),null===(i=this.meeting.livestream)||void 0===i||i.on("livestreamUpdate",this.setIsLivestreaming))}render(){return at(this.meeting)&&this.isLivestreaming?Z(J,null,Z("div",{class:"indicator","aria-label":this.t("livestream.indicator"),part:"indicator"},Z("rtk-icon",{icon:this.iconPack.start_livestream,size:this.size}),Z("span",null,this.t("LIVE")))):Z(J,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};bg([On()],kg.prototype,"meeting",void 0),bg([On()],kg.prototype,"t",void 0),bg([On()],kg.prototype,"iconPack",void 0),kg.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);display:flex}:host([data-hidden]){display:none}:host[size='sm']{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.indicator{display:flex;flex-direction:row;align-items:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);animation:blink 4s linear infinite}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='sm']) .indicator span{display:none}@keyframes blink{0%,10%{opacity:0}11%,100%{opacity:1}}";const yg=Number.isFinite||function(e){return"number"===typeof e&&isFinite(e)},wg=Number.isSafeInteger||function(e){return"number"===typeof e&&Math.abs(e)<=Sg},Sg=Number.MAX_SAFE_INTEGER||9007199254740991;let xg=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),Eg=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),Tg=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var _g="manifest",Pg="level",Cg="audioTrack",Ag="subtitleTrack",Rg="main",Lg="audio",Ig="subtitle";class Mg{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Dg{constructor(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Mg(e),this.fast_=new Mg(t),this.defaultTTFB_=r,this.ttfb_=new Mg(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Mg(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Mg(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Mg(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function Og(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ng(){return Ng=Object.assign?Object.assign.bind():function(e){for(var t=1;t")):Bg}(e,i)}const $g=zg();const Gg=$g;function Wg(){if("undefined"===typeof self)return;return(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function qg(e,t){const i=Object.keys(e),r=Object.keys(t),n=i.length,s=r.length;return!n||!s||n===s&&!i.some(e=>-1===r.indexOf(e))}function Kg(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("undefined"!==typeof TextDecoder){const i=new TextDecoder("utf-8").decode(e);if(t){const e=i.indexOf("\0");return-1!==e?i.substring(0,e):i}return i.replace(/\0/g,"")}const i=e.length;let r,n,s,a="",o=0;for(;o>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=e[o++],a+=String.fromCharCode((31&r)<<6|63&n);break;case 14:n=e[o++],s=e[o++],a+=String.fromCharCode((15&r)<<12|(63&n)<<6|63&s)}}return a}const Zg=function(e){let t="";for(let i=0;i1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){yg(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}get ref(){return af(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,r,n){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const{elementaryStreams:a}=this,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)):a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:s}}}class cf extends sf{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function lf(e,t){const i=Object.getPrototypeOf(e);if(i){const e=Object.getOwnPropertyDescriptor(i,t);return e||lf(i,t)}}const df=Math.pow(2,32)-1,hf=[].push,uf={video:1,audio:2,id3:3,text:4};function pf(e){return String.fromCharCode.apply(null,e)}function gf(e,t){const i=e[t]<<8|e[t+1];return i<0?65536+i:i}function ff(e,t){const i=vf(e,t);return i<0?4294967296+i:i}function mf(e,t){let i=ff(e,t);return i*=Math.pow(2,32),i+=ff(e,t+4),i}function vf(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function bf(e,t){const i=[];if(!t.length)return i;const r=e.byteLength;for(let n=0;n1?n+s:r;if(pf(e.subarray(n+4,n+8))===t[0])if(1===t.length)i.push(e.subarray(n+8,a));else{const r=bf(e.subarray(n+8,a),t.slice(1));r.length&&hf.apply(i,r)}n=a}return i}function kf(e){const t=[],i=e[0];let r=8;const n=ff(e,r);r+=4;let s=0,a=0;0===i?(s=ff(e,r),a=ff(e,r+4),r+=8):(s=mf(e,r),a=mf(e,r+8),r+=16),r+=2;let o=e.length+a;const c=gf(e,r);r+=2;for(let l=0;l>>31)return Gg.warn("SIDX has hierarchical references (not supported)"),null;const c=ff(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:c,info:{duration:c/n,start:o,end:o+a-1}}),o+=a,i+=4,r=i}return{earliestPresentationTime:s,timescale:n,version:i,referencesCount:c,references:t}}function yf(e){const t=[],i=bf(e,["moov","trak"]);for(let r=0;r{const i=ff(e,4),r=t[i];r&&(r.default={duration:ff(e,12),flags:ff(e,20)})}),t}function wf(e){const t=e.subarray(8),i=t.subarray(86),r=pf(t.subarray(4,8));let n,s=r;const a="enca"===r||"encv"===r;if(a){const e=bf(t,[r])[0];bf(e.subarray("enca"===r?28:78),["sinf"]).forEach(e=>{const t=bf(e,["schm"])[0];if(t){const i=pf(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=bf(e,["frma"])[0];t&&(s=pf(t))}}})}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const e=bf(i,["avcC"])[0];e&&e.length>3&&(s+="."+Ef(e[1])+Ef(e[2])+Ef(e[3]),n=Sf("avc1"===o?"dva1":"dvav",i));break}case"mp4a":{const e=bf(t,[r])[0],i=bf(e.subarray(28),["esds"])[0];if(i&&i.length>7){let e=4;if(3!==i[e++])break;e=xf(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=xf(i,e);const r=i[e++];if(64!==r)break;if(s+="."+Ef(r),e+=12,5!==i[e++])break;e=xf(i,e);const n=i[e++];let a=(248&n)>>3;31===a&&(a+=1+((7&n)<<3)+((224&i[e])>>5)),s+="."+a}break}case"hvc1":case"hev1":{const e=bf(i,["hvcC"])[0];if(e&&e.length>12){const t=e[1],i=["","A","B","C"][t>>6],r=31&t,n=ff(e,2),a=(32&t)>>5?"H":"L",o=e[12],c=e.subarray(6,12);s+="."+i+r,s+="."+function(e){let t=0;for(let i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0}(n).toString(16).toUpperCase(),s+="."+a+o;let l="";for(let e=c.length;e--;){const t=c[e];if(t||l){l="."+t.toString(16).toUpperCase()+l}}s+=l}n=Sf("hev1"==o?"dvhe":"dvh1",i);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=Sf(s,i)||s;break;case"vp09":{const e=bf(i,["vpcC"])[0];if(e&&e.length>6){const t=e[4],i=e[5],r=e[6]>>4&15;s+="."+Tf(t)+"."+Tf(i)+"."+Tf(r)}break}case"av01":{const e=bf(i,["av1C"])[0];if(e&&e.length>2){const t=e[1]>>>5,r=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,c=(32&e[2])>>5,l=2===t&&o?c?12:10:o?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,u=(4&e[2])>>2,p=3&e[2],g=1,f=1,m=1,v=0;s+="."+t+"."+Tf(r)+a+"."+Tf(l)+"."+d+"."+h+u+p+"."+Tf(g)+"."+Tf(f)+"."+Tf(m)+"."+v,n=Sf("dav1",i)}break}}return{codec:s,encrypted:a,supplemental:n}}function Sf(e,t){const i=bf(t,["dvvC"]),r=i.length?i[0]:bf(t,["dvcC"])[0];if(r){const t=r[2]>>1&127,i=r[2]<<5&32|r[3]>>3&31;return e+"."+Tf(t)+"."+Tf(i)}}function xf(e,t){const i=t+5;for(;128&e[t++]&&t{const c=o.byteOffset-8;bf(o,["traf"]).map(o=>{const l=bf(o,["tfdt"]).map(e=>{const t=e[0];let i=ff(e,4);return 1===t&&(i*=Math.pow(2,32),i+=ff(e,8)),i/n})[0];return void 0!==l&&(e=l),bf(o,["tfhd"]).map(l=>{const d=ff(l,4),h=16777215&ff(l,0);let u=0;const p=0!==(16&h);let g=0;const f=0!==(32&h);let m=8;d===s&&(0!==(1&h)&&(m+=8),0!==(2&h)&&(m+=4),0!==(8&h)&&(u=ff(l,m),m+=4),p&&(g=ff(l,m),m+=4),f&&(m+=4),"video"===t.type&&(a=Af(t.codec)),bf(o,["trun"]).map(s=>{const o=s[0],l=16777215&ff(s,0),d=0!==(1&l);let h=0;const p=0!==(4&l),f=0!==(256&l);let m=0;const v=0!==(512&l);let b=0;const k=0!==(1024&l),y=0!==(2048&l);let w=0;const S=ff(s,4);let x=8;d&&(h=ff(s,x),x+=4),p&&(x+=4);let E=h+c;for(let c=0;c>1&63;return 39===e||40===e}return 6===(31&t)}function Lf(e,t,i,r){const n=If(e);let s=0;s+=t;let a=0,o=0,c=0;for(;s=n.length)break;c=n[s++],a+=c}while(255===c);o=0;do{if(s>=n.length)break;c=n[s++],o+=c}while(255===c);const e=n.length-s;let t=s;if(oe){Gg.error("Malformed SEI payload. ".concat(o," is too small, only ").concat(e," bytes left to parse."));break}if(4===a){if(181===n[t++]){const e=gf(n,t);if(t+=2,49===e){const e=ff(n,t);if(t+=4,1195456820===e){const e=n[t++];if(3===e){const s=n[t++],o=64&s,c=o?2+3*(31&s):0,l=new Uint8Array(c);if(o){l[0]=s;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const r=n[t++].toString(16);e.push(1==r.length?"0"+r:r),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const s=o-16,c=new Uint8Array(s);for(let i=0;i0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),a=0,s=8;a>>24;if(0!==n&&1!==n)return{offset:i,size:t};const s=e.buffer,a=Zg(new Uint8Array(s,i+12,16));let o=null,c=null,l=0;if(0===n)l=28;else if(1===n){const n=e.getUint32(28);if(!n||r<32+16*n)return{offset:i,size:t};o=[];for(let e=0;e/\(Windows.+Firefox\//i.test(navigator.userAgent),Nf={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Uf(e,t){const i=Nf[t];return!!i&&!!i[e.slice(0,4)]}function Ff(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!e.split(",").some(e=>!jf(e,t,i))}function jf(e,t){var i;const r=Wg(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);return null!=(i=null==r?void 0:r.isTypeSupported(Bf(e,t)))&&i}function Bf(e,t){return"".concat(t,"/mp4;codecs=").concat(e)}function Vf(e){if(e){const t=e.substring(0,4);return Nf.video[t]}return 2}function zf(e){const t=Of();return e.split(",").reduce((e,i)=>{const r=t&&Af(i)?9:Nf.video[i];return r?(2*r+e)/(e?3:2):(Nf.audio[i]+e)/(e?2:1)},0)}const Hf={};const $f=/flac|opus|mp4a\.40\.34/i;function Gf(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.replace($f,e=>function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(Hf[e])return Hf[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let n=0;n4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(qf(e,"audio")||qf(e,"video")))return e;if(t){const i=t.split(",");if(i.length>1){if(e)for(let t=i.length;t--;)if(i[t].substring(0,4)===e.substring(0,4))return i[t];return i[0]}}return t||e}function qf(e,t){return Uf(e,t)&&jf(e,t)}function Kf(e){if(e.startsWith("av01.")){const t=e.split("."),i=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=i[e-4];return t.join(".")}return e}function Zf(e){const t=Wg(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Yf(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Jf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Qf(e,t){return{supported:!1,configurations:t,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:e}}function Xf(e,t,i,r,n,s){const a=e.videoCodec,o=e.audioCodec?e.audioGroups:null,c=null==s?void 0:s.audioCodec,l=null==s?void 0:s.channels,d=l?parseInt(l):c?1/0:2;let h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((e,i)=>{if(i){const r=t.groups[i];if(!r)throw new Error("Audio track group ".concat(i," not found"));Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch(u){return!0}return void 0!==a&&(a.split(",").some(e=>Af(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(n,8e6))||!!h&&yg(d)&&Object.keys(h).some(e=>parseInt(e)>d)}function em(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=e.videoCodec;if(!n&&!e.audioCodec||!i)return Promise.resolve(Jf);const s=[],a=function(e){var t;const i=null==(t=e.videoCodec)?void 0:t.split(","),r=im(e),n=e.width||640,s=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return i?i.map(e=>{const t={contentType:Bf(Kf(e),"video"),width:n,height:s,bitrate:r,framerate:a};return"sdr"!==o&&(t.transferFunction=o),t}):[]}(e),o=a.length,c=function(e,t,i){var r;const n=null==(r=e.audioCodec)?void 0:r.split(","),s=im(e);if(n&&e.audioGroups)return e.audioGroups.reduce((e,r)=>{var a;const o=r?null==(a=t.groups[r])?void 0:a.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===r){const r=parseFloat(t.channels||"");n.forEach(t=>{const n={contentType:Bf(t,"audio"),bitrate:i?tm(t,s):s};r&&(n.channels=""+r),e.push(n)})}return e},e):e},[]);return[]}(e,t,o>0),l=c.length;for(let d=o||1*l||1;d--;){const e={type:"media-source"};if(o&&(e.video=a[d%o]),l){e.audio=c[d%l];const t=e.audio.bitrate;e.video&&t&&(e.video.bitrate-=t)}s.push(e)}if(n){const e=navigator.userAgent;if(n.split(",").some(e=>Af(e))&&Of())return Promise.resolve(Qf(new Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (".concat(e,")")),s))}return Promise.all(s.map(e=>{const t=function(e){let t="";const{audio:i,video:r}=e;if(r){const e=Yf(r.contentType);t+="".concat(e,"_r").concat(r.height,"x").concat(r.width,"f").concat(Math.ceil(r.framerate)).concat(r.transferFunction||"sd","_").concat(Math.ceil(r.bitrate/1e5))}if(i){const e=Yf(i.contentType);t+="".concat(r?"_":"").concat(e,"_c").concat(i.channels)}return t}(e);return r[t]||(r[t]=i.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:s,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:s,decodingInfoResults:[],error:e}))}function tm(e,t){if(t<=1)return 1;let i=128e3;return"ec-3"===e?i=768e3:"ac-3"===e&&(i=64e4),Math.min(t/2,i)}function im(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}const rm=["NONE","TYPE-0","TYPE-1",null];const nm=["SDR","PQ","HLG"];var sm="",am="YES",om="v2";function cm(e){const{canSkipUntil:t,canSkipDateRanges:i,age:r}=e;return t&&r!!e).map(e=>e.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=null==(t=e.supplemental)?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=",".concat(i.substring(0,4)))}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return hm(this._audioGroups,e)}hasSubtitleGroup(e){return hm(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function hm(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function um(e,t){let i=!1,r=[];if(e&&(i="SDR"!==e,r=[e]),t){r=t.allowedVideoRanges||nm.slice(0);const e="SDR"!==r.join("")&&!t.videoCodec;i=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"===typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),i||(r=["SDR"])}return{preferHDR:i,allowedVideoRanges:r}}const pm=(e,t)=>JSON.stringify(e,(e=>{const t=new WeakSet;return(i,r)=>{if(e&&(r=e(i,r)),"object"===typeof r&&null!==r){if(t.has(r))return;t.add(r)}return r}})(t));function gm(e,t){Gg.log('[abr] start candidates with "'.concat(e,'" ignored because ').concat(t))}function fm(e){return e.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function mm(e){if(!e)return e;const{lang:t,assocLang:i,characteristics:r,channels:n,audioCodec:s}=e;return{lang:t,assocLang:i,characteristics:r,channels:n,audioCodec:s}}function vm(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:"--";if(e.length===t.length)return e===t;return e.startsWith(t)||t.startsWith(e)}(s,t.lang))&&(void 0===s||t.assocLang===a)&&(void 0===o||t.default===o)&&(void 0===c||t.forced===c)&&(!("characteristics"in e)||function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=e.split(","),r=t.split(",");return i.length===r.length&&!i.some(e=>-1===r.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function km(e,t){const{audioCodec:i,channels:r}=e;return(void 0===i||(t.audioCodec||"").substring(0,4)===i.substring(0,4))&&(void 0===r||r===(t.channels||"2"))}function ym(e,t,i){for(let r=t;r>-1;r--)if(i(e[r]))return r;for(let r=t+1;r0)i=n+1;else{if(!(a<0))return s;r=n-1}}return null};function xm(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.005,s=null;if(e){s=t[1+e.sn-t[0].sn]||null;const r=e.endDTS-i;r>0&&r<15e-7&&(i+=15e-7),s&&e.level!==s.level&&s.end<=e.end&&(s=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===Em(i,r,s)||function(e,t,i){if(t&&0===t.start&&t.level0){const r=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),i);return e.start<=r}return!1}(s,e,Math.min(n,r))))return s;const a=Sm(t,Em.bind(null,i,r));return!a||a===e&&s?s:a}function Em(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;if(i.start<=e&&i.start+i.duration>e)return 0;const r=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-r<=e?1:i.start-r>e&&i.start?-1:0}function Tm(e,t,i){const r=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>e}function _m(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){let r=e.fragments;const{fragmentHint:n}=e;let s;return n&&(r=r.concat(n)),Sm(r,e=>e.cct?-1:(s=e,e.end<=i?1:e.start>i?-1:0)),s||null}return null}function Pm(e){switch(e.details){case Eg.FRAG_LOAD_TIMEOUT:case Eg.KEY_LOAD_TIMEOUT:case Eg.LEVEL_LOAD_TIMEOUT:case Eg.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Cm(e,t){const i=Pm(t);return e.default["".concat(i?"timeout":"error","Retry")]}function Am(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Rm(e){return Fg(Fg({},e),{errorRetry:null,timeoutRetry:null})}function Lm(e,t,i,r){if(!e)return!1;const n=null==r?void 0:r.code,s=t499)}(n)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,r,s):s}var Im=0,Mm=2,Dm=3,Om=5,Nm=0,Um=1,Fm=2;function jm(e){const t={action:Im,flags:Nm};return e&&(t.resolved=!0),t}var Bm="NOT_LOADED",Vm="APPENDING",zm="PARTIAL",Hm="OK";class $m{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Tg.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Tg.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const t=i[r];if(!t)break;const n=t.end;if(t.start<=e&&null!==n&&e<=n)return t}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:r}=this,n=Object.keys(r);for(let s=n.length;s--;){const a=r[n[s]];if((null==a?void 0:a.body.type)===t&&(!i||a.buffered)){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,r,n){this.timeRanges&&(this.timeRanges[e]=t);const s=(null==r?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(r=>{const a=this.fragments[r];if(!a)return;if(s>=a.body.sn)return;if(!a.buffered&&(!a.loaded||n))return void(a.body.type===i&&this.removeFragment(a.body));const o=a.range[e];o&&(0!==o.time.length?o.time.some(e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(a.body),i}):this.removeFragment(a.body))})}detectPartialFragments(e){const t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;const i=e.frag,r=Wm(i),n=this.fragments[r];if(!n||n.buffered&&i.gap)return;const s=!i.relurl;if(Object.keys(t).forEach(r=>{const a=i.elementaryStreams[r];if(!a)return;const o=t[r],c=s||!0===a.partial;n.range[r]=this.getBufferedTimes(i,e.part,c,o)}),n.loaded=null,Object.keys(n.range).length){n.buffered=!0;(n.body.endList=i.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),Gm(n)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(n.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=qm(i,t=>t.fragment.sn>=e))}fragBuffered(e,t){const i=Wm(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},s=e.start,a=e.end,o=e.minEndPTS||a,c=e.maxStartPTS||s;for(let l=0;l=e&&o<=t){n.time.push({startPTS:Math.max(s,r.start(l)),endPTS:Math.min(a,r.end(l))});break}if(se){const e=Math.max(s,r.start(l)),t=Math.min(a,r.end(l));t>e&&(n.partial=!0,n.time.push({startPTS:e,endPTS:t}))}else if(a<=e)break}return n}getPartialFragment(e){let t,i,r,n=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach(c=>{const l=o[c];l&&Gm(l)&&(i=l.body.start-a,r=l.body.end+a,e>=i&&e<=r&&(t=Math.min(e-i,r-e),s<=t&&(n=l.body,s=t)))}),n}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Gm(t))}getState(e){const t=Wm(e),i=this.fragments[t];return i?i.buffered?Gm(i)?zm:Hm:Vm:Bm}isTimeBuffered(e,t,i){let r,n;for(let s=0;s=r&&t<=n)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;const i=t.frag,r=t.part?null:t,n=Wm(i);this.fragments[n]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n,type:s}=t;if("initSegment"===i.sn)return;const a=i.type;if(r){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(r)}this.timeRanges=n;const o=n[s];this.detectEvictedFragments(s,o,a,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Wm(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let r=i.length;r--;){const n=t[i[r]];if((null==n?void 0:n.body.type)===e)return!0}return!1}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(s=>{const a=this.fragments[s];if(!a)return;const o=a.body;o.type!==i||r&&!o.gap||o.starte&&(a.buffered||n)&&this.removeFragment(o)})}removeFragment(e){const t=Wm(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=qm(i,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=null==(e=this.hls)||null==(t=e.latestLevelDetails)?void 0:t.partList;i&&i.forEach(e=>e.clearElementaryStreamInfo())}}function Gm(e){var t,i,r;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(r=e.range.audiovideo)?void 0:r.partial))}function Wm(e){return"".concat(e.type,"_").concat(e.level,"_").concat(e.sn)}function qm(e,t){return e.filter(e=>{const i=t(e);return i||e.clearElementaryStreamInfo(),i})}var Km=0,Zm=1;class Ym{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Km:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Zm:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error("[AESCrypto] invalid aes mode ".concat(this.aesMode))}}}class Jm{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(4*r);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],s=i[2],a=i[3],o=this.invSubMix,c=o[0],l=o[1],d=o[2],h=o[3],u=new Uint32Array(256);let p=0,g=0,f=0;for(f=0;f<256;f++)u[f]=f<128?f<<1:f<<1^283;for(f=0;f<256;f++){let i=g^g<<1^g<<2^g<<3^g<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const o=u[p],f=u[o],m=u[f];let v=257*u[i]^16843008*i;r[p]=v<<24|v>>>8,n[p]=v<<16|v>>>16,s[p]=v<<8|v>>>24,a[p]=v,v=16843009*m^65537*f^257*o^16843008*p,c[i]=v<<24|v>>>8,l[i]=v<<16|v>>>16,d[i]=v<<8|v>>>24,h[i]=v,p?(p=o^u[u[u[m^o]]],g^=u[u[g]]):p=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r1&&void 0!==arguments[1]?arguments[1]:{};if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){const t=e.byteLength,i=t&&new DataView(e.buffer).getUint8(t-1);return i?e.slice(0,t-i):e}(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,r){return this.useSoftware?new Promise((n,s)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,i,r);const o=this.flush();o?n(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)}softwareDecrypt(e,t,i,r){const{currentIV:n,currentResult:s,remainderData:a}=this;if(r!==Km||16!==t.byteLength)return Gg.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=Pf(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;n&&(i=n);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new Jm),c.expandKey(t);const l=s;return this.currentResult=c.decrypt(o.buffer,0,i),this.currentIV=o.slice(-16).buffer,l||null}webCryptoDecrypt(e,t,i,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,r));this.key=t,this.fastAesKey=new Qm(this.subtle,t,r)}return this.fastAesKey.expandKey().then(t=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Ym(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,t)}).catch(n=>(Gg.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(n.name,": ").concat(n.message)),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r);const n=this.flush();if(n)return n.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(Gg.log("[decrypter]: ".concat(e)),this.logEnabled=!1)}}const ev=Math.pow(2,17);class tv{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new nv({type:xg.NETWORK_ERROR,details:Eg.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a ".concat(i?"part list":"url")),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,s=r.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some(e=>"GAP"===e[0]))return void o(rv(e));e.gap=!1}const c=this.loader=n?new n(r):new s(r),l=iv(e);e.loader=c;const d=Rm(r.fragLoadPolicy.default),h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:ev};e.stats=c.stats;const u={onSuccess:(t,i,r,n)=>{this.resetLoader(e,c);let s=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),a({frag:e,part:null,payload:s,networkDetails:n})},onError:(t,r,n,s)=>{this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Fg({url:i,data:void 0},t),error:new Error("HTTP Error ".concat(t.code," ").concat(t.text)),networkDetails:n,stats:s}))},onAbort:(t,i,r)=>{this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:r,stats:t}))},onTimeout:(t,i,r)=>{this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after ".concat(h.timeout,"ms")),networkDetails:r,stats:t}))}};t&&(u.onProgress=(i,r,n,s)=>t({frag:e,part:null,payload:n,networkDetails:s})),c.load(l,h,u)})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,s=r.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(rv(e,t));const c=this.loader=n?new n(r):new s(r),l=iv(e,t);e.loader=c;const d=Rm(r.fragLoadPolicy.default),h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ev};t.stats=c.stats,c.load(l,h,{onSuccess:(r,n,s,o)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const l={frag:e,part:t,payload:r.data,networkDetails:o};i(l),a(l)},onError:(i,r,n,s)=>{this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Fg({url:l.url,data:void 0},i),error:new Error("HTTP Error ".concat(i.code," ").concat(i.text)),networkDetails:n,stats:s}))},onAbort:(i,r,n)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:n,stats:i}))},onTimeout:(i,r,n)=>{this.resetLoader(e,c),o(new nv({type:xg.NETWORK_ERROR,details:Eg.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after ".concat(h.timeout,"ms")),networkDetails:n,stats:i}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const r=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/n),r),a=(r-s)*Math.round(i.loaded/s);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const s=i.loading,a=r.loading;s.start?s.first+=a.first-a.start:(s.start=a.start,s.first=a.first),s.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function iv(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},n=i.byteRangeStartOffset,s=i.byteRangeEndOffset;if(yg(n)&&yg(s)){var a;let t=n,i=s;if("initSegment"===e.sn&&("AES-128"===(o=null==(a=e.decryptdata)?void 0:a.method)||"AES-256"===o)){const e=s-n;e%16&&(i=s+(16-e%16)),0!==n&&(r.resetIV=!0,t=n-16)}r.rangeStart=t,r.rangeEnd=i}var o;return r}function rv(e,t){const i=new Error("GAP ".concat(e.gap?"tag":"attribute"," found")),r={type:xg.MEDIA_ERROR,details:Eg.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new nv(r)}class nv extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class sv extends jg{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class av{constructor(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=s}}const ov={length:0,start:()=>0,end:()=>0};class cv{static isBuffered(e,t){if(e){const i=cv.getBuffered(e);for(let e=i.length;e--;)if(t>=i.start(e)&&t<=i.end(e))return!0}return!1}static bufferedRanges(e){if(e){const t=cv.getBuffered(e);return cv.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i1&&e.sort((e,t)=>e.start-t.start||t.end-e.end);let r=-1,n=[];if(i)for(let l=0;l=e[l].start&&t<=e[l].end&&(r=l);const s=n.length;if(s){const t=n[s-1].end;e[l].start-tt&&(n[s-1].end=e[l].end):n.push(e[l])}else n.push(e[l])}else n=e;let s,a=0,o=t,c=t;for(let l=0;l=e&&t<=d&&(r=l),t+i>=e&&t{const r=t.substring(2,t.length-1),n=null==i?void 0:i[r];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(r,'"'))),t):n})}return t}function uv(e,t,i){let r,n,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){r=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(r))throw new Error('"'.concat(r,'" does not match any query parameter in URI: "').concat(i,'"'));n=e.get(r)}catch(a){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(a.message)))}}else r=t.NAME,n=t.VALUE;r in s?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(r,'"'))):s[r]=n||""}function pv(e,t,i){const r=t.IMPORT;if(i&&r in i){let t=e.variableList;t||(e.variableList=t={}),t[r]=i[r]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(r,'"')))}const gv=/^(\d+)x(\d+)$/,fv=/(.+?)=(".*?"|.*?)(?:,|$)/g;class mv{constructor(e,t){"string"===typeof e&&(e=mv.parseAttrList(e,t)),Ng(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return"YES"===this[e]}decimalResolution(e){const t=gv.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const r={};for(fv.lastIndex=0;null!==(i=fv.exec(e));){const n=i[1].trim();let s=i[2];const a=0===s.indexOf('"')&&s.lastIndexOf('"')===s.length-1;let o=!1;if(a)s=s.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(a||o))s=hv(t,s);else if(!o&&!a)switch(n){case"CLOSED-CAPTIONS":if("NONE"===s)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Gg.warn("".concat(e,": attribute ").concat(n," is missing quotes"))}r[n]=s}return r}}function vv(e){return"ID"!==e&&"CLASS"!==e&&"CUE"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function bv(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}class kv{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(r=null==t?void 0:t.tagOrder)?r:i,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){Gg.warn('DATERANGE tag attribute: "'.concat(t,'" does not match for tags with ID: "').concat(e.ID,'"')),this._badValueForSameId=t;break}e=Ng(new mv({}),i,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);yg(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return null===e||null===e.programDateTime?(Gg.warn('Expected tagAnchor Fragment with PDT set for DateRange "'.concat(this.id,'": ').concat(e)),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(yg(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&yg(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class yv{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}get hasProgramDateTime(){return!!this.fragments.length&&yg(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(-1!==t){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function wv(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function Sv(e){switch(e){case"AES-128":case"AES-256":return Km;case"AES-256-CTR":return Zm;default:throw new Error("invalid full segment method ".concat(e))}}function xv(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function Ev(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function Tv(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),r=e[e.length-1].split(",");if(2===r.length){const t="base64"===r[0],n=r[1];t?(e.splice(-1,1),i=xv(n)):i=function(e){const t=Ev(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(n)}}return i}const _v="undefined"!==typeof self?self:void 0;var Pv={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Cv="org.w3.clearkey",Av="com.apple.streamingkeydelivery",Rv="com.microsoft.playready",Lv="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Iv(e){switch(e){case Av:return Pv.FAIRPLAY;case Rv:return Pv.PLAYREADY;case Lv:return Pv.WIDEVINE;case Cv:return Pv.CLEARKEY}}var Mv="1077efecc0b24d02ace33c1e52e2fb4b",Dv="e2719d58a985b3c9781ab030af78d30e",Ov="9a04f07998404286ab92e65be0885f95",Nv="edef8ba979d64acea3c827dcd51d21ed";function Uv(e){return e===Nv?Pv.WIDEVINE:e===Ov?Pv.PLAYREADY:e===Mv||e===Dv?Pv.CLEARKEY:void 0}function Fv(e){switch(e){case Pv.FAIRPLAY:return Av;case Pv.PLAYREADY:return Rv;case Pv.WIDEVINE:return Lv;case Pv.CLEARKEY:return Cv}}function jv(e){const{drmSystems:t,widevineLicenseUrl:i}=e,r=t?[Pv.FAIRPLAY,Pv.WIDEVINE,Pv.PLAYREADY,Pv.CLEARKEY].filter(e=>!!t[e]):[];return!r[Pv.WIDEVINE]&&i&&r.push(Pv.WIDEVINE),r}const Bv=null!=_v&&null!=(Vv=_v.navigator)&&Vv.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Vv;function zv(e){const t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(t)),r=i.substring(i.indexOf("<"),i.length),n=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(n){const e=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(e){const t=xv(e).subarray(0,16);return function(e){const t=function(e,t,i){const r=e[t];e[t]=e[i],e[i]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),t}}return null}let Hv={};class $v{static clearKeyUriToKeyIdMap(){Hv={}}constructor(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!wv(e)}isSupported(){if(this.method){if(wv(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Av:case Lv:case Rv:case Cv:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(wv(this.method)&&this.uri&&!this.iv){"number"!==typeof e&&(Gg.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),e=0);const t=function(e){const t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e);return new $v(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Tv(this.uri);if(t)switch(this.keyFormat){case Lv:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Rv:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Mf(e,0,t),this.keyId=zv(t);break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=Hv[this.uri];if(!e){const t=Object.keys(Hv).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),Hv[this.uri]=e}this.keyId=e}return this}}const Gv=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Wv=/#EXT-X-MEDIA:(.*)/g,qv=/^#EXT(?:INF|-X-TARGETDURATION):/m,Kv=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Zv=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Yv{static findGroup(e,t){for(let i=0;i0&&r.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:s.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(Wv.lastIndex=0;null!==(r=Wv.exec(e));){const e=new mv(r[1],i),s=e.TYPE;if(s){const i=a[s],r=n[s]||[];n[s]=r;const c=e.LANGUAGE,l=e["ASSOC-LANGUAGE"],d=e.CHANNELS,h=e.CHARACTERISTICS,u=e["INSTREAM-ID"],p={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||c||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:c,url:e.URI?Yv.resolve(e.URI,t):""};if(l&&(p.assocLang=l),d&&(p.channels=d),h&&(p.characteristics=h),u&&(p.instreamId=u),null!=i&&i.length){const e=Yv.findGroup(i,p.groupId)||i[0];ib(p,e,"audioCodec"),ib(p,e,"textCodec")}r.push(p)}}return n}static parseLevelPlaylist(e,t,i,r,n,s){var a;const o={url:t},c=new yv(t),l=c.fragments,d=[];let h,u,p,g,f=null,m=0,v=0,b=0,k=0,y=0,w=null,S=new of(r,o),x=-1,E=!1,T=null;if(Kv.lastIndex=0,c.m3u8=e,c.hasVariableRefs=dv(e),"#EXTM3U"!==(null==(a=Kv.exec(e))?void 0:a[0]))return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;null!==(h=Kv.exec(e));){E&&(E=!1,S=new of(r,o),S.playlistOffset=b,S.start=b,S.sn=m,S.cc=k,y&&(S.bitrate=y),S.level=i,f&&(S.initSegment=f,f.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),T&&(S.setByteRange(T),T=null)));const e=h[1];if(e){S.duration=parseFloat(e);const t=(" "+h[2]).slice(1);S.title=t||null,S.tagList.push(t?["INF",e,t]:["INF",e])}else if(h[3]){if(yg(S.duration)){S.playlistOffset=b,S.start=b,p&&sb(S,p,c),S.sn=m,S.level=i,S.cc=k,l.push(S);const e=(" "+h[3]).slice(1);S.relurl=hv(c,e),rb(S,w,d),w=S,b+=S.duration,m++,v=0,E=!0}}else{if(h=h[0].match(Zv),!h){Gg.warn("No matches on slow regex match for level playlist!");continue}for(u=1;u0&&ob(c,e,h),m=c.startSN=parseInt(n);break;case"SKIP":{c.skippedSegments&&ab(c,e,h);const t=new mv(n,c),i=t.decimalInteger("SKIPPED-SEGMENTS");if(yg(i)){c.skippedSegments+=i;for(let e=i;e--;)l.push(null);m+=i}const r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(r.split("\t")));break}case"TARGETDURATION":0!==c.targetduration&&ab(c,e,h),c.targetduration=Math.max(parseInt(n),1);break;case"VERSION":null!==c.version&&ab(c,e,h),c.version=parseInt(n);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||ab(c,e,h),c.live=!1;break;case"#":(n||a)&&S.tagList.push(a?[n,a]:[n]);break;case"DISCONTINUITY":k++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([e]);break;case"BITRATE":S.tagList.push([e,n]),y=1e3*parseInt(n),yg(y)?S.bitrate=y:y=0;break;case"DATERANGE":{const e=new mv(n,c),t=new kv(e,c.dateRanges[e.ID],c.dateRangeTagCount);c.dateRangeTagCount++,t.isValid||c.skippedSegments?c.dateRanges[t.id]=t:Gg.warn('Ignoring invalid DATERANGE tag: "'.concat(n,'"')),S.tagList.push(["EXT-X-DATERANGE",n]);break}case"DEFINE":{const e=new mv(n,c);"IMPORT"in e?pv(c,e,s):uv(c,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==c.startCC?ab(c,e,h):l.length>0&&ob(c,e,h),c.startCC=k=parseInt(n);break;case"KEY":{const e=Xv(n,t,c);if(e.isSupported()){if("NONE"===e.method){p=void 0;break}p||(p={}),p[e.keyFormat]&&(p=Ng({},p)),p[e.keyFormat]=e}else Gg.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'.concat(n,'"'));break}case"START":c.startTimeOffset=eb(n);break;case"MAP":{const e=new mv(n,c);if(S.duration){const t=new of(r,o);nb(t,e,i,p),f=t,S.initSegment=f,f.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime)}else{const t=S.byteRangeEndOffset;if(t){const e=S.byteRangeStartOffset;T="".concat(t-e,"@").concat(e)}else T=null;nb(S,e,i,p),f=S,E=!0}f.cc=k;break}case"SERVER-CONTROL":g&&ab(c,e,h),g=new mv(n),c.canBlockReload=g.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=g.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&g.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=g.optionalFloat("PART-HOLD-BACK",0),c.holdBack=g.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{c.partTarget&&ab(c,e,h);const t=new mv(n);c.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=c.partList;e||(e=c.partList=[]);const t=v>0?e[e.length-1]:void 0,i=v++,r=new mv(n,c),s=new cf(r,S,o,i,t);e.push(s),S.duration+=s.duration;break}case"PRELOAD-HINT":{const e=new mv(n,c);c.preloadHint=e;break}case"RENDITION-REPORT":{const e=new mv(n,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(e);break}default:Gg.warn("line parsed but not handled: ".concat(h))}}}w&&!w.relurl?(l.pop(),b-=w.duration,c.partList&&(c.fragmentHint=w)):c.partList&&(rb(S,w,d),S.cc=k,c.fragmentHint=S,p&&sb(S,p,c)),c.targetduration||(c.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const _=l.length,P=l[0],C=l[_-1];if(b+=c.skippedSegments*c.targetduration,b>0&&_&&C){c.averagetargetduration=b/_;const e=C.sn;c.endSN="initSegment"!==e?e:0,c.live||(C.endList=!0),P&&void 0===c.startCC&&(c.startCC=P.cc),x>0&&(!function(e,t){let i=e[t];for(let r=t;r--;){const t=e[r];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(l,x),P&&d.unshift(P))}else c.endSN=0,c.startCC=0;return c.fragmentHint&&(b+=c.fragmentHint.duration),c.totalduration=b,d.length&&c.dateRangeTagCount&&P&&Jv(d,c),c.endCC=k,c}}function Jv(e,t){const i=e.length;if(!i)return;const r=e[i-1],n=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges);for(let a=s.length;a--;){const o=t.dateRanges[s[a]],c=o.startDate.getTime();o.tagAnchor=r.ref;for(let r=i;r--;){const i=Qv(t,c,e,r,n);if(-1!==i){o.tagAnchor=t.fragments[i].ref;break}}}}function Qv(e,t,i,r,n){const s=i[r];if(s){const o=s.programDateTime;if(t>=o||0===r){var a;if(t<=o+1e3*(((null==(a=i[r+1])?void 0:a.start)||n)-s.start)){const n=i[r].sn-e.startSN,s=e.fragments;if(s.length>i.length){for(let a=(i[r+1]||s[s.length-1]).sn-e.startSN;a>n;a--){const e=s[a].programDateTime;if(t>=e&&te);["video","audio","text"].forEach(e=>{const r=i.filter(t=>Uf(t,e));r.length&&(t["".concat(e,"Codec")]=r.map(e=>e.split("/")[0]).join(","),i=i.filter(e=>-1===r.indexOf(e)))}),t.unknownCodecs=i}function ib(e,t,i){const r=t[i];r&&(e[i]=r)}function rb(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function nb(e,t,i,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",r&&(e.levelkeys=r),e.initSegment=null}function sb(e,t,i){e.levelkeys=t;const{encryptedFragments:r}=i;r.length&&r[r.length-1].levelkeys===t||!Object.keys(t).some(e=>t[e].isCommonEncryption)||r.push(e)}function ab(e,t,i){e.playlistParsingError=new Error("#EXT-X-".concat(t," must not appear more than once (").concat(i[0],")"))}function ob(e,t,i){e.playlistParsingError=new Error("#EXT-X-".concat(t," must appear before the first Media Segment (").concat(i[0],")"))}function cb(e,t){const i=t.startPTS;if(yg(i)){let r,n=0;t.sn>e.sn?(n=i-e.start,r=e):(n=e.start-i,r=t),r.duration!==n&&r.setDuration(n)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration)}else t.setStart(Math.max(e.start-t.duration,0))}function lb(e,t,i,r,n,s){r-i<=0&&(Gg.warn("Fragment should have a positive duration",t),r=i+t.duration,s=n+t.duration);let a=i,o=r;const c=t.startPTS,l=t.endPTS;if(yg(c)){const e=Math.abs(c-i);yg(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,a=Math.max(i,c),i=Math.min(i,c),n=Math.min(n,t.startDTS),o=Math.min(r,l),r=Math.max(r,l),s=Math.max(s,t.endDTS)}const d=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(r-t.start),t.startPTS=i,t.maxStartPTS=a,t.startDTS=n,t.endPTS=r,t.minEndPTS=o,t.endDTS=s;const h=t.sn;if(!e||he.endSN)return 0;let u;const p=h-e.startSN,g=e.fragments;for(g[p]=t,u=p;u>0;u--)cb(g[u],g[u-1]);for(u=p;u=0;l--){const e=r[l].initSegment;if(e){i=e;break}}let n;e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){const r=t.skippedSegments,n=Math.max(e.startSN,t.startSN)-t.startSN,s=(e.fragmentHint?1:0)+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let l=n;l<=s;l++){const n=c[a+l];let s=o[l];if(r&&!s&&n&&(s=t.fragments[l]=n),n&&s){if(i(n,s,l,o),n.url&&n.url!==s.url)return void(t.playlistParsingError=hb("media sequence mismatch ".concat(s.sn,":"),e,t,n,s));if(n.cc!==s.cc)return void(t.playlistParsingError=hb("discontinuity sequence mismatch (".concat(n.cc,"!=").concat(s.cc,")"),e,t,n,s))}}}(e,t,(e,r,s,a)=>{if((!t.startCC||t.skippedSegments)&&r.cc!==e.cc){const i=e.cc-r.cc;for(let e=s;e{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}),t.skippedSegments){if(t.deltaUpdateFailed=s.some(e=>!e),t.deltaUpdateFailed){Gg.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)s.shift();t.startSN=s[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t){const{dateRanges:i,recentlyRemovedDateranges:r}=t,n=Ng({},e);r&&r.forEach(e=>{delete n[e]});const s=Object.keys(n).length;s&&Object.keys(i).forEach(e=>{const t=n[e],r=new kv(i[e].attr,t);r.isValid?(n[e]=r,t||(r.tagOrder+=s)):Gg.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(pm(i[e].attr),'"'))});return n}(e.dateRanges,t));const i=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),n?lb(t,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):ub(e,t),s.length&&(t.totalduration=t.edge-s[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const c=t.advancedDateTime;if(t.advanced&&c){const e=t.edge;t.driftStart||(t.driftStartTime=c,t.driftStart=e),t.driftEndTime=c,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function hb(e,t,i,r,n){return new Error("".concat(e," ").concat(n.url,"\nPlaylist starting @").concat(t.startSN,"\n").concat(t.m3u8,"\n\nPlaylist starting @").concat(i.startSN,"\n").concat(i.m3u8))}function ub(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const r=t.startSN+t.skippedSegments-e.startSN,n=e.fragments,s=r>=0;let a=0;if(s&&r1&&void 0!==arguments[1]?arguments[1]:1/0,i=1e3*e.targetduration;if(e.updated){const r=e.fragments,n=4;if(r.length&&i*n>t){const e=1e3*r[r.length-1].duration;e{var i;null==(i=e.details)||i.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function kb(e,t){for(let r=0,n=e.length;re.startCC)}(t,e))return;const i=Math.min(t.endCC,e.endCC),r=kb(t.fragments,i),n=kb(e.fragments,i);if(!r||!n)return;Gg.log("Aligning playlist at start of dicontinuity sequence ".concat(i));wb(r.start-n.start,e)}function xb(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const i=e.fragments,r=t.fragments;if(!i.length||!r.length)return;let n,s;const a=Math.min(t.endCC,e.endCC);t.startCC{const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,s=i?i.currentTime:0,a=cv.bufferInfo(r||i,s,e.maxBufferHole),o=!a.len;if(this.log("Media seeking to ".concat(yg(s)?s.toFixed(3):s,", state: ").concat(n,", ").concat(o?"out of":"in"," buffer")),this.state===Mb)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,r=t.start-i,n=t.start+t.duration+i;if(o||na.end){const e=s>n;(sthis.lastCurrentTime&&(this.lastCurrentTime=s),!this.loadingParts){const e=Math.max(a.end,s),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log("LL-Part loading ON after seeking to ".concat(s.toFixed(2)," with buffer @").concat(e.toFixed(2))),this.loadingParts=t)}}this.hls.hasEnoughToStart||(this.log("Setting ".concat(o?"startPosition":"nextLoadPosition"," to ").concat(s," for seek without enough to start")),this.nextLoadPosition=s,o&&(this.startPosition=s)),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new tv(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Xm(e.config)}registerListeners(){const{hls:e}=this;e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tg.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Tb)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Tb}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return-1===t&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,r=this.config.timelineOffset||0;if(i<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=cv.bufferedInfo(n,e.start,0));const s=e.nextStart;if(s&&s>r&&s{const t=e.frag;if(this.fragContextChanged(t))return this.warn("".concat(t.type," sn: ").concat(t.sn).concat(e.part?" part: "+e.part.index:""," of ").concat(this.fragInfo(t,!1,e.part),") was dropped during download.")),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)}).then(e=>{if(!e)return;const t=this.state,i=e.frag;this.fragContextChanged(i)?(t===Cb||!this.fragCurrent&&t===Lb)&&(this.fragmentTracker.removeFragment(i),this.state=_b):("payload"in e&&(this.log("Loaded ".concat(i.type," sn: ").concat(i.sn," of ").concat(this.playlistLabel()," ").concat(i.level)),this.hls.trigger(Tg.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))}).catch(t=>{this.state!==Tb&&this.state!==Db&&(this.warn("Frag error: ".concat((null==t?void 0:t.message)||t)),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Vm){const t=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,t),n=Math.max(e.duration,r?r.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(n,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===zm&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null};this.hls.trigger(Tg.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{const t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e}).then(e=>{const{hls:t}=this,{frag:i,payload:r}=e,n=i.decryptdata;if(r&&r.byteLength>0&&null!=n&&n.key&&n.iv&&wv(n.method)){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),n.key.buffer,n.iv.buffer,Sv(n.method)).catch(e=>{throw t.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e}).then(r=>{const n=self.performance.now();return t.trigger(Tg.FRAG_DECRYPTED,{frag:i,payload:r,stats:{tstart:s,tdecrypt:n}}),e.payload=r,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state!==Tb&&this.state!==Db&&(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==Tb&&(this.state=_b),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.fragInfo(e,!1,t)," > buffer:").concat(i?Eb(cv.getBuffered(i)):"(detached)",")")),af(e)){var r;if(e.type!==Ig){const t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e]))return void(this.state=_b)}const t=null==(r=this.levels)?void 0:r[e.level];null!=t&&t.fragmentError&&(this.log("Resetting level fragment error count of ".concat(t.fragmentError," on frag buffered")),t.fragmentError=0)}this.state=_b}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,s=!n||0===n.length||n.some(e=>!e),a=new av(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;var n;this.fragCurrent=e;const s=null==t?void 0:t.details;if(!this.levels||!s)throw new Error("frag load aborted, missing level".concat(s?"":" detail","s"));let a=null;!e.encrypted||null!=(n=e.decryptdata)&&n.key?e.encrypted||(a=this.keyLoader.loadClear(e,s.encryptedFragments),a&&this.log("[eme] blocking frag load until media-keys acquired")):(this.log("Loading key for ".concat(e.sn," of [").concat(s.startSN,"-").concat(s.endSN,"], ").concat(this.playlistLabel()," ").concat(e.level)),this.state=Pb,this.fragCurrent=e,a=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Tg.KEY_LOADED,e),this.state===Pb&&(this.state=_b),e}),this.hls.trigger(Tg.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING"))));const o=this.fragPrevious;if(af(e)&&(!o||e.sn!==o.sn)){const i=this.shouldLoadParts(t.details,e.end);i!==this.loadingParts&&(this.log("LL-Part loading ".concat(i?"ON":"OFF"," loading sn ").concat(null==o?void 0:o.sn,"->").concat(e.sn)),this.loadingParts=i)}if(i=Math.max(e.start,i||0),this.loadingParts&&af(e)){const n=s.partList;if(n&&r){i>e.end&&s.fragmentHint&&(e=s.fragmentHint);const o=this.getNextPart(n,e,i);if(o>-1){const c=n[o];let l;return e=this.fragCurrent=c.fragment,this.log("Loading ".concat(e.type," sn: ").concat(e.sn," part: ").concat(c.index," (").concat(o,"/").concat(n.length-1,") of ").concat(this.fragInfo(e,!1,c),") cc: ").concat(e.cc," [").concat(s.startSN,"-").concat(s.endSN,"], target: ").concat(parseFloat(i.toFixed(3)))),this.nextLoadPosition=c.start+c.duration,this.state=Cb,l=a?a.then(i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,c,t,r)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,c,t,r).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Tg.FRAG_LOADING,{frag:e,part:c,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):l}if(!e.url||this.loadedEndOfParts(n,i))return Promise.resolve(null)}}if(af(e)&&this.loadingParts)this.log("LL-Part loading OFF after next part miss @".concat(i.toFixed(2))),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log("Loading ".concat(e.type," sn: ").concat(e.sn," of ").concat(this.fragInfo(e,!1),") cc: ").concat(e.cc," ").concat(s?"["+s.startSN+"-"+s.endSN+"]":"",", target: ").concat(parseFloat(i.toFixed(3)))),yg(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Cb;const c=this.config.progressive;let l;return l=c&&a?a.then(t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,r)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,c?r:void 0),a]).then(e=>{let[t]=e;return!c&&t&&r&&r(t),t}).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(Tg.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,s)=>{var a;const o=[],c=null==(a=i.details)?void 0:a.partList,l=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{o[t.index]=r;const s=r.part;this.hls.trigger(Tg.FRAG_LOADED,r);const a=mb(i.details,e.sn,t.index+1)||vb(c,e.sn,t.index+1);if(!a)return n({frag:e,part:s,partsLoaded:o});l(a)}).catch(s)};l(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Eg.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(Tg.ERROR,t)}else this.hls.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Lb)return void(this.fragCurrent||this.state===Tb||this.state===Db||(this.state=_b));const{frag:i,part:r,level:n}=t,s=self.performance.now();i.stats.parsing.end=s,r&&(r.stats.parsing.end=s);const a=this.getLevelDetails(),o=a&&i.sn>a.endSN||this.shouldLoadParts(a,i.end);o!==this.loadingParts&&(this.log("LL-Part loading ".concat(o?"ON":"OFF"," after parsing segment ending @").concat(i.end.toFixed(2))),this.loadingParts=o),this.updateLevelTiming(i,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(null!=e&&e.partList){var i;const n=e.partList[0];if(t>=n.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)){var r;if((this.hls.hasEnoughToStart?(null==(r=this.media)?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:s}=e;if(null==t||!t[r])return this.warn("Levels object was unset while buffering fragment ".concat(n," of ").concat(this.playlistLabel()," ").concat(r,". The current chunk will not be buffered.")),null;const a=t[r],o=a.details,c=s>-1?mb(o,n,s):null,l=c?c.fragment:fb(o,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:c,level:a}):null}bufferFragmentData(e,t,i,r,n){var s;if(!e||this.state!==Lb)return;const{data1:a,data2:o}=e;let c=a;if(a&&o&&(c=Pf(a,o)),null==(s=c)||!s.length)return;const l=this.initPTS[t.cc],d=l?-l.baseTime/l.timescale:void 0,h={type:e.type,frag:t,part:i,chunkMeta:r,offset:d,parent:t.type,data:c};if(this.hls.trigger(Tg.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!cv.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const i=t.currentTime,r=cv.bufferInfo(t,i,0),n=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),a=Math.max(Math.min(e.start-s,r.end-s),i+s);e.start-a>s&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var i;const r=this.getLoadPosition();if(!yg(r))return null;const n=this.lastCurrentTime>r||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,n)}getFwdBufferInfoAtPos(e,t,i,r){const n=cv.bufferInfo(e,t,r);if(0===n.len&&void 0!==n.nextStart){const s=this.fragmentTracker.getBufferedFrag(t,i);if(s&&(n.nextStart<=s.end||s.gap)){const i=Math.max(Math.min(n.nextStart,s.end)-t,r);return cv.bufferInfo(e,t,i)}}return n}getMaxBufferLength(e){const{config:t}=this;let i;return i=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t),n=Math.max(e-3*t,i.maxMaxBufferLength/2,r);return n>=r&&(i.maxMaxBufferLength=n,this.warn("Reduce max buffer length to ".concat(n,"s")),!0)}getAppendedFrag(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rg;var i;const r=null==(i=this.fragmentTracker)?void 0:i.getAppendedFrag(e,t);return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,s=i[0].start,a=n.lowLatencyMode&&!!t.partList;let o=null;if(t.live){const i=n.initialLiveManifestSize;if(r=s?i:r)||o.start:e;this.log("Setting startPosition to ".concat(n," to match start frag at live edge. mainStart: ").concat(i," liveSyncPosition: ").concat(r," frag.start: ").concat(null==(c=o)?void 0:c.start)),this.startPosition=this.nextLoadPosition=n}}else e<=s&&(o=i[0]);if(!o){const i=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,i,t)}let l=this.filterReplacedPrimary(o,t);if(!l&&o){const e=o.sn-t.startSN;l=this.filterReplacedPrimary(i[e+1]||null,t)}return this.mapToInitFragWhenRequired(l)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Hm||i===zm&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&i.nextStart)){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(null!==e&&i.len+e.len>=n){const e=s.sn;return this.loopSn!==e&&(this.log('buffer full after gaps in "'.concat(r,'" playlist starting at sn: ').concat(e)),this.loopSn=e),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(Fb(this.hls.config)){var e,t;if(null==(e=this.hls.interstitialsManager)||null==(t=e.playingItem)?void 0:t.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Fb(this.hls.config)&&e.type!==Ig){const i=this.hls.interstitialsManager,r=null==i?void 0:i.bufferingItem;if(r){const i=r.event;if(i){if(i.appendInPlace||Math.abs(e.start-r.start)>1||0===r.start)return null}else{if(e.end<=r.start&&!1===(null==t?void 0:t.live))return null;if(e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}}const n=null==i?void 0:i.playerQueue;if(n)for(let t=n.length;t--;){const i=n[t].interstitial;if(i.appendInPlace&&e.start>=i.startTime&&e.end<=i.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let r=-1,n=!1,s=!0;for(let a=0,o=e.length;a-1&&ii.start&&i.loaded}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(i.programDateTime)),r=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!yg(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r=e.startSN&&n<=e.endSN){const s=t[n-e.startSN];i.cc===s.cc&&(r=s,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(r.sn)))}r||(r=_m(e,i.cc,i.end),r&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(r.sn)))}}else{const t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:s,endSN:a}=i;const{fragmentHint:o}=i,{maxFragLookUpTolerance:c}=r,l=i.partList,d=!!(this.loadingParts&&null!=l&&l.length&&o);let h;if(d&&o&&!this.bitrateTest&&l[l.length-1].fragment.sn===o.sn&&(s=s.concat(o),a=o.sn),et-c||null!=(u=this.media)&&u.paused||!this.startFragRequested?0:c)}else h=s[s.length-1];if(h){const e=h.sn-i.startSN,t=this.fragmentTracker.getState(h);if((t===Hm||t===zm&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!d||l[0].fragment.sn>h.sn||!i.live&&!d)){if(n&&h.level===n.level){const t=s[e+1];h=h.sn").concat(e.startSN," fragments: ").concat(r)),n}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;i=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&af(e)&&e.stats.aborted&&(this.log("Fragment ".concat(e.sn).concat(t?" part "+t.index:""," of ").concat(this.playlistLabel()," ").concat(e.level," was aborted")),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===Ab)||(this.state=_b)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;var r;if(this.fragContextChanged(i))return void this.warn("Frag load error must match current frag to retry ".concat(i.url," > ").concat(null==(r=this.fragCurrent)?void 0:r.url));const n=t.details===Eg.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const s=t.errorAction,{action:a,flags:o,retryCount:c=0,retryConfig:l}=s||{},d=!!s&&!!l,h=d&&a===Om,u=d&&!s.resolved&&o===Um;if(!h&&u&&af(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),s.resolved=!0;else if((h||u)&&c.5;n&&this.reduceMaxBufferLength(r.len,(null==t?void 0:t.duration)||10);const s=!n;return s&&this.warn("Buffer full error while media.currentTime is not buffered, flush ".concat(i," buffer")),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===Lg&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Tb&&(this.state=_b)}afterBufferFlushed(e,t,i){if(!e)return;const r=cv.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===Mb&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Tb&&(this.state=_b)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn("The loading context changed while buffering fragment ".concat(e.sn," of ").concat(this.playlistLabel()," ").concat(e.level,". This chunk will not be buffered.")),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){const n=i.details;if(!n)return void this.warn("level.details undefined");var s;if(!Object.keys(e.elementaryStreams).reduce((t,s)=>{const a=e.elementaryStreams[s];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn("Could not parse fragment ".concat(e.sn," ").concat(s," duration reliably (").concat(o,")")),t||!1;const c=r?0:lb(n,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(Tg.LEVEL_PTS_UPDATED,{details:n,level:i,drift:c,type:s,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t},!1)&&(0===i.fragmentError&&this.treatAsGap(e,i),null===(null==(s=this.transmuxer)?void 0:s.error))){const t=new Error("Found no media in fragment ".concat(e.sn," of ").concat(this.playlistLabel()," ").concat(e.level," resetting transmuxer to fallback to playlist timing"));if(this.warn(t.message),this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:"Found no media in msn ".concat(e.sn," of ").concat(this.playlistLabel(),' "').concat(i.url,'"')}),!this.hls)return;this.resetTransmuxer()}this.state=Ib,this.log("Parsed ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.fragInfo(e,!1,t),")")),this.hls.trigger(Tg.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Rg?"level":"track"}fragInfo(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;var r,n;return"".concat(this.playlistLabel()," ").concat(e.level," (").concat(i?"part":"frag",":[").concat((null!=(r=t&&!i?e.startPTS:(i||e).start)?r:NaN).toFixed(3),"-").concat((null!=(n=t&&!i?e.endPTS:(i||e).end)?n:NaN).toFixed(3),"]").concat(i&&"main"===e.type?"INDEPENDENT="+(i.independent?"YES":"NO"):"")}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log("".concat(t,"->").concat(e)))}get state(){return this._state}}function Fb(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class jb{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let r=0;for(let n=0;n0)return e.subarray(i,i+r)}function Yb(e,t){return 255===e[t]&&240===(246&e[t+1])}function Jb(e,t){return 1&e[t+1]?7:9}function Qb(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Xb(e,t){return t+1=e.length)return!1;const r=Qb(e,t);if(r<=i)return!1;const n=t+r;return n===e.length||Xb(e,n)}return!1}function tk(e,t,i,r,n){if(!e.samplerate){const s=function(e,t,i,r){const n=t[i+2],s=n>>2&15;if(s>12){const t=new Error("invalid ADTS sampling index:".concat(s));return void e.emit(Tg.ERROR,Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}const a=1+(n>>6&3),o=t[i+3]>>6&3|(1&n)<<2,c="mp4a.40."+a,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s];let d=s;5!==a&&29!==a||(d-=3);const h=[a<<3|(14&d)>>1,(1&d)<<7|o<<3];return Gg.log("manifest codec:".concat(r,", parsed codec:").concat(c,", channels:").concat(o,", rate:").concat(l," (ADTS object type:").concat(a," sampling index:").concat(s,")")),{config:h,samplerate:l,channelCount:o,codec:c,parsedCodec:c,manifestCodec:r}}(t,i,r,n);if(!s)return;Ng(e,s)}}function ik(e){return 9216e4/e}function rk(e,t,i,r,n){const s=r+n*ik(e.samplerate),a=function(e,t){const i=Jb(e,t);if(t+i<=e.length){const r=Qb(e,t)-i;if(r>0)return{headerLength:i,frameLength:r}}}(t,i);let o;if(a){const{frameLength:r,headerLength:n}=a,c=n+r,l=Math.max(0,i+c-t.length);l?(o=new Uint8Array(c-n),o.set(t.subarray(i+n,t.length),0)):o=t.subarray(i+n,i+c);const d={unit:o,pts:s};return l||e.samples.push(d),{sample:d,length:c,missing:l}}const c=t.length-i;o=new Uint8Array(c),o.set(t.subarray(i,t.length),0);return{sample:{unit:o,pts:s},length:c,missing:-1}}function nk(e,t){return qb(e,t)&&Kb(e,t+6)+10<=e.length-t}function sk(e){return function(e,t,i,r){const n=function(e){return e instanceof ArrayBuffer?e:e.buffer}(e);let s=1;"BYTES_PER_ELEMENT"in r&&(s=r.BYTES_PER_ELEMENT);const a=(h=e,h&&h.buffer instanceof ArrayBuffer&&void 0!==h.byteLength&&void 0!==h.byteOffset?e.byteOffset:0),o=(a+e.byteLength)/s,c=(a+t)/s,l=Math.floor(Math.max(0,Math.min(c,o))),d=Math.floor(Math.min(l+Math.max(i,0),o));var h;return new r(n,l,d-l)}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,Uint8Array)}function ak(e){const t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");const i=e.data.subarray(1).indexOf(0);if(-1===i)return;const r=Kg(sk(e.data,1,i)),n=e.data[2+i],s=e.data.subarray(3+i).indexOf(0);if(-1===s)return;const a=Kg(sk(e.data,3+i,s));let o;return o="--\x3e"===r?Kg(sk(e.data,4+i+s)):function(e){return e instanceof ArrayBuffer?e:0==e.byteOffset&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}(e.data.subarray(4+i+s)),t.mimeType=r,t.pictureType=n,t.description=a,t.data=o,t}function ok(e){return"PRIV"===e.type?function(e){if(e.size<2)return;const t=Kg(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=Kg(e.data.subarray(t),!0);t+=i.length+1;const r=Kg(e.data.subarray(t));return{key:e.type,info:i,data:r}}const t=Kg(e.data);return{key:e.type,info:"",data:t}}(e):"APIC"===e.type?ak(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=Kg(e.data.subarray(t),!0);t+=i.length+1;const r=Kg(e.data.subarray(t));return{key:e.type,info:i,data:r}}const t=Kg(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}function ck(e){const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=Kb(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}function lk(e){let t=0;const i=[];for(;qb(e,t);){const r=Kb(e,t+6);e[t+5]>>6&1&&(t+=10),t+=10;const n=t+r;for(;t+100&&void 0!==arguments[0]?arguments[0]:"",id:-1,pid:-1,inputTimeScale:arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4,sequenceNumber:-1,samples:[],dropped:0}}class fk{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=Pf(this.cachedData,e),this.cachedData=null);let i,r=Zb(e,0),n=r?r.length:0;const s=this._audioTrack,a=this._id3Track,o=r?uk(r):void 0,c=e.length;for((null===this.basePTS||0===this.frameIndex&&yg(o))&&(this.basePTS=mk(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:pk.audioId3,duration:Number.POSITIVE_INFINITY});n{if(yg(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};let vk=null;const bk=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],kk=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],yk=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],wk=[0,1,1,4];function Sk(e,t,i,r,n){if(i+24>t.length)return;const s=xk(t,i);if(s&&i+s.frameLength<=t.length){const a=r+n*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:t.subarray(i,i+s.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function xk(e,t){const i=e[t+1]>>3&3,r=e[t+1]>>1&3,n=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==i&&0!==n&&15!==n&&3!==s){const a=e[t+2]>>1&1,o=e[t+3]>>6,c=1e3*bk[14*(3===i?3-r:3===r?3:4)+n-1],l=kk[3*(3===i?0:2===i?1:2)+s],d=3===o?1:2,h=yk[i][r],u=wk[r],p=8*h*u,g=Math.floor(h*c/l+a)*u;if(null===vk){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vk=e?parseInt(e[1]):0}return!!vk&&vk<=87&&2===r&&c>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:l,channelCount:d,frameLength:g,samplesPerFrame:p}}}function Ek(e,t){return 255===e[t]&&224===(224&e[t+1])&&0!==(6&e[t+1])}function Tk(e,t){return t+1{let i=0,r=5;t+=r;const n=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;r>0;){a[0]=e[t];const o=Math.min(r,8),c=8-o;s[0]=4278190080>>>24+c<>c,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const s=t[i+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&t[i+4],c=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(i+c>t.length)return-1;const l=t[i+6]>>5;let d=0;2===l?d+=2:(1&l&&1!==l&&(d+=2),4&l&&(d+=2));const h=(t[i+6]<<8|t[i+7])>>12-d&1,u=[2,1,2,3,3,4,4,5][l]+h,p=t[i+5]>>3,g=7&t[i+5],f=new Uint8Array([s<<6|p<<1|g>>2,(3&g)<<6|l<<3|h<<2|o>>4,o<<4&224]),m=r+n*(1536/a*9e4),v=t.subarray(i,i+c);return e.config=f,e.channelCount=u,e.samplerate=a,e.samples.push({unit:v,pts:m}),c}const Rk=/\/emsg[-/]ID3/i;function Lk(e,t){return yg(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class Ik{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Xm(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Km)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),s=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(s).then(n=>{const s=new Uint8Array(n);r.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let r=0;for(let n=32;n{n.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();const n=e[t].units;for(;!(i>=n.length);i++){const s=n[i];if(!(s.data.length<=48||1!==s.type&&5!==s.type)&&(this.decryptAvcSample(e,t,i,r,s),!this.decrypter.isSync()))return}}}}class Mk{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i,r=this.VideoSample;if(r&&0!==r.units.length||(r=e[e.length-1]),null!=(t=r)&&t.units){const e=r.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const i=t.samples,r=i.length;if(!r)return void t.dropped++;{const t=i[r-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,i){const r=t.byteLength;let n=e.naluState||0;const s=n,a=[];let o,c,l,d=0,h=-1,u=0;for(-1===n&&(h=0,u=this.getNALuType(t,0),n=0,d=1);d=0){const e={data:t.subarray(h,c),type:u};a.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(s&&d<=4-s&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-s)),c>0&&(i.data=Pf(i.data,t.subarray(0,c)),i.state=0))}d=0&&n>=0){const e={data:t.subarray(h,r),type:u,state:n};a.push(e)}if(0===a.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Pf(i.data,t))}return e.naluState=n,a}}class Dk{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&Gg.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Ok extends Mk{parsePES(e,t,i,r){const n=this.parseNALu(e,i.data,r);let s,a=this.VideoSample,o=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(r=>{var n,c;switch(r.type){case 1:{let t=!1;s=!0;const n=r.data;if(o&&n.length>4){const e=this.readSliceType(n);2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var l;if(t)null!=(l=a)&&l.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=t;break}case 5:s=!0,null!=(n=a)&&n.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:s=!0,Lf(r.data,1,i.pts,t.samples);break;case 7:{var d,h;s=!0,o=!0;const t=r.data,i=this.readSPS(t);if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(d=e.pixelRatio)?void 0:d[0])!==i.pixelRatio[0]||(null==(h=e.pixelRatio)?void 0:h[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t];const r=t.subarray(1,4);let n="avc1.";for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t="0"+t),n+=t}e.codec=n}break}case 8:s=!0,e.pps=[r.data];break;case 9:s=!0,e.audFound=!0,null!=(c=a)&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:s=!0;break;default:s=!1}if(a&&s){a.units.push(r)}}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return 31&e[t]}readSliceType(e){const t=new Dk(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i,r=8,n=8;for(let s=0;s{var n,c;switch(r.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,s=!0;break;case 16:case 17:case 18:case 21:var l;if(s=!0,o)null!=(l=a)&&l.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:s=!0,null!=(n=a)&&n.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:s=!0,Lf(r.data,2,i.pts,t.samples);break;case 32:s=!0,e.vps||("object"!==typeof e.params&&(e.params={}),e.params=Ng(e.params,this.readVPS(r.data)),this.initVPS=r.data),e.vps=[r.data];break;case 33:if(s=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],r.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const t=this.readSPS(r.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!==typeof e.params&&(e.params={});for(const i in t.params)e.params[i]=t.params[i]}this.pushParameterSet(e.sps,r.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(s=!0,"object"===typeof e.params){if(!e.pps){e.pps=[];const t=this.readPPS(r.data);for(const i in t)e.params[i]=t[i]}this.pushParameterSet(e.pps,r.data,e.vps)}break;case 35:s=!0,e.audFound=!0,null!=(c=a)&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:s=!1}if(a&&s){a.units.push(r)}}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let r=0;r=2&&3===e[r]&&0===e[r-1]&&0===e[r-2]||(t[i]=e[r],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Dk(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);return{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){const t=new Dk(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const r=t.readBits(2),n=t.readBoolean(),s=t.readBits(5),a=t.readUByte(),o=t.readUByte(),c=t.readUByte(),l=t.readUByte(),d=t.readUByte(),h=t.readUByte(),u=t.readUByte(),p=t.readUByte(),g=t.readUByte(),f=t.readUByte(),m=t.readUByte(),v=[],b=[];for(let W=0;W0)for(let W=i;W<8;W++)t.readBits(2);for(let W=0;W1&&t.readEG();for(let e=0;e0&&e<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],D=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(M=t.readBits(16),D=t.readBits(16))}t.readBoolean()&&t.readBoolean();if(t.readBoolean()){t.readBits(3),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())}t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),F=t.readBoolean(),F&&(x+=t.readUEG(),E+=t.readUEG(),T+=t.readUEG(),_+=t.readUEG());if(t.readBoolean()){N=t.readBits(32),U=t.readBits(32);t.readBoolean()&&t.readUEG();if(t.readBoolean()){const e=t.readBoolean(),r=t.readBoolean();let n=!1;(e||r)&&(n=t.readBoolean(),n&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),n&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let s=0;s<=i;s++){O=t.readBoolean();let i=!1;O||t.readBoolean()?t.readEG():i=t.readBoolean();const s=i?1:t.readUEG()+1;if(e)for(let e=0;e>W&1)<<31-W)>>>0;let $=H.toString(16);1===s&&"2"===$&&($="6");const G=n?"H":"L";return{codecString:"hvc1.".concat(V).concat(s,".").concat($,".").concat(G).concat(m,".B0"),params:{general_tier_flag:n,general_profile_idc:s,general_profile_space:r,general_profile_compatibility_flags:[a,o,c,l],general_constraint_indicator_flags:[d,h,u,p,g,f],general_level_idc:m,bit_depth:P+8,bit_depth_luma_minus8:P,bit_depth_chroma_minus8:C,min_spatial_segmentation_idc:I,chroma_format_idc:k,frame_rate:{fixed:O,fps:U/N}},width:j,height:B,pixelRatio:[M,D]}}readPPS(e){const t=new Dk(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2);t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),r=t.readBoolean();let n=1;return r&&i?n=0:r?n=3:i&&(n=2),{parallelismType:n}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Uk=188;class Fk{constructor(e,t,i,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=r,this.videoParser=null}static probe(e,t){const i=Fk.syncOffset(e);return i>0&&t.warn("MPEG2-TS detected but first sync word found @ offset ".concat(i)),-1!==i}static syncOffset(e){const t=e.length;let i=Math.min(940,t-Uk)+1,r=0;for(;r1&&(0===s&&a>2||o+Uk>i))return s}r++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:uf[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Fk.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Fk.createTrack("audio",r),this._id3Track=Fk.createTrack("id3"),this._txtTrack=Fk.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t){let i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,c=this._txtTrack;let l=s.pid,d=s.pesData,h=a.pid,u=o.pid,p=a.pesData,g=o.pesData,f=null,m=this.pmtParsed,v=this._pmtId,b=e.length;if(this.remainderData&&(b=(e=Pf(this.remainderData,e)).length,this.remainderData=null),b>4>1){if(b=S+5+e[S+4],b===S+Uk)continue}else b=S+4;switch(n){case l:if(t){if(d&&(i=$k(d,this.logger))){if(null===this.videoParser)switch(s.segmentCodec){case"avc":this.videoParser=new Ok;break;case"hevc":this.videoParser=new Nk}null!==this.videoParser&&this.videoParser.parsePES(s,c,i,!1)}d={data:[],size:0}}d&&(d.data.push(e.subarray(b,S+Uk)),d.size+=S+Uk-b);break;case h:if(t){if(p&&(i=$k(p,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,i);break;case"mp3":this.parseMPEGPES(a,i);break;case"ac3":this.parseAC3PES(a,i)}p={data:[],size:0}}p&&(p.data.push(e.subarray(b,S+Uk)),p.size+=S+Uk-b);break;case u:t&&(g&&(i=$k(g,this.logger))&&this.parseID3PES(o,i),g={data:[],size:0}),g&&(g.data.push(e.subarray(b,S+Uk)),g.size+=S+Uk-b);break;case 0:t&&(b+=e[b]+1),v=this._pmtId=Bk(e,b);break;case v:{t&&(b+=e[b]+1);const i=Vk(e,b,this.typeSupported,r,this.observer,this.logger);l=i.videoPid,l>0&&(s.pid=l,s.segmentCodec=i.segmentVideoCodec),h=i.audioPid,h>0&&(a.pid=h,a.segmentCodec=i.segmentAudioCodec),u=i.id3Pid,u>0&&(o.pid=u),null===f||m||(this.logger.warn("MPEG-TS PMT found at ".concat(S," after unknown PID '").concat(f,"'. Backtracking to sync byte @").concat(k," to parse all TS packets.")),f=null,S=k-188),m=this.pmtParsed=!0;break}case 17:case 8191:break;default:f=n}}else y++;y>0&&zk(this.observer,new Error("Found ".concat(y," TS packet/s that do not start with 0x47")),void 0,this.logger),s.pesData=d,a.pesData=p,o.pesData=g;const w={audioTrack:a,videoTrack:s,id3Track:o,textTrack:c};return n&&this.extractRemainingSamples(w),w}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,s=i.pesData,a=t.pesData,o=r.pesData;let c;if(s&&(c=$k(s,this.logger))){if(null===this.videoParser)switch(i.segmentCodec){case"avc":this.videoParser=new Ok;break;case"hevc":this.videoParser=new Nk}null!==this.videoParser&&(this.videoParser.parsePES(i,n,c,!0),i.pesData=null)}else i.pesData=s;if(a&&(c=$k(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c)}t.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;o&&(c=$k(o,this.logger))?(this.parseID3PES(r,c),r.pesData=null):r.pesData=o}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new Ik(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&"aac"===r.segmentCodec?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n,s,a,o=t.data;if(r){this.aacOverFlow=null;const t=r.missing,n=r.sample.unit.byteLength;if(-1===t)o=Pf(r.sample.unit,o);else{const s=n-t;r.sample.unit.set(o.subarray(0,t),s),e.samples.push(r.sample),i=r.missing}}for(n=i,s=o.length;n0;)o+=s}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=Ng({},t,{type:this._videoTrack?pk.emsg:pk.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function jk(e,t){return((31&e[t+1])<<8)+e[t+2]}function Bk(e,t){return(31&e[t+10])<<8|e[t+11]}function Vk(e,t,i,r,n,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let r=t+5,n=c;for(;n>2;){if(106===e[r])!0!==i.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const t=e[r+1]+2;r+=t,n-=t}}break;case 194:case 135:return zk(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"))}t+=c+5}return a}function zk(e,t,i,r){r.warn("parsing error: ".concat(t.message)),e.emit(Tg.ERROR,Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function Hk(e,t){t.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function $k(e,t){let i,r,n,s,a,o=0;const c=e.data;if(!e||0===e.size)return null;for(;c[0].length<19&&c.length>1;)c[0]=Pf(c[0],c[1]),c.splice(1,1);i=c[0];if(1===(i[0]<<16)+(i[1]<<8)+i[2]){if(r=(i[4]<<8)+i[5],r&&r>e.size-6)return null;const l=i[7];192&l&&(s=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&l?(a=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2,s-a>54e5&&(t.warn("".concat(Math.round((s-a)/9e4),"s delta between PTS and DTS, align them")),s=a)):a=s),n=i[8];let d=n+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,t=c.length;et){d-=t;continue}i=i.subarray(d),t-=d,d=0}h.set(i,o),o+=t}return r&&(r-=n+3),{data:h,pts:s,dts:a,len:r}}return null}class Gk{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const Wk=Math.pow(2,32)-1;class qk{static init(){let e;for(e in qk.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},qk.types)qk.types.hasOwnProperty(e)&&(qk.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);qk.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);qk.STTS=qk.STSC=qk.STCO=n,qk.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),qk.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),qk.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),qk.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);qk.FTYP=qk.box(qk.types.ftyp,s,o,s,a),qk.DINF=qk.box(qk.types.dinf,qk.box(qk.types.dref,r))}static box(e){let t=8;for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),s=0,t=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}static mdia(e){return qk.box(qk.types.mdia,qk.mdhd(e.timescale||0,e.duration||0),qk.hdlr(e.type),qk.minf(e))}static mfhd(e){return qk.box(qk.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?qk.box(qk.types.minf,qk.box(qk.types.smhd,qk.SMHD),qk.DINF,qk.stbl(e)):qk.box(qk.types.minf,qk.box(qk.types.vmhd,qk.VMHD),qk.DINF,qk.stbl(e))}static moof(e,t,i){return qk.box(qk.types.moof,qk.mfhd(e),qk.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=qk.trak(e[t]);return qk.box.apply(null,[qk.types.moov,qk.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(qk.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=qk.trex(e[t]);return qk.box.apply(null,[qk.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Wk+1)),r=Math.floor(t%(Wk+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return qk.box(qk.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r>>8&255),n.push(255&r),n=n.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),s.push(255&r),s=s.concat(Array.prototype.slice.call(i));const a=qk.box(qk.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(s))),o=e.width,c=e.height,l=e.pixelRatio[0],d=e.pixelRatio[1];return qk.box(qk.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,qk.box(qk.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),qk.box(qk.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,255&l,d>>24,d>>16&255,d>>8&255,255&d])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return qk.box(qk.types.mp4a,qk.audioStsd(e),qk.box(qk.types.esds,qk.esds(e)))}static mp3(e){return qk.box(qk.types[".mp3"],qk.audioStsd(e))}static ac3(e){return qk.box(qk.types["ac-3"],qk.audioStsd(e),qk.box(qk.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return qk.box(qk.types.stsd,qk.STSD,qk.mp4a(e));if("ac3"===t&&e.config)return qk.box(qk.types.stsd,qk.STSD,qk.ac3(e));if("mp3"===t&&"mp3"===e.codec)return qk.box(qk.types.stsd,qk.STSD,qk.mp3(e))}else{if(!e.pps||!e.sps)throw new Error("video track missing pps or sps");if("avc"===t)return qk.box(qk.types.stsd,qk.STSD,qk.avc1(e));if("hevc"===t&&e.vps)return qk.box(qk.types.stsd,qk.STSD,qk.hvc1(e))}throw new Error("unsupported ".concat(e.type," segment codec (").concat(t,"/").concat(e.codec,")"))}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,s=Math.floor(i/(Wk+1)),a=Math.floor(i%(Wk+1));return qk.box(qk.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,n>>8&255,255&n,0,0]))}static traf(e,t){const i=qk.sdtp(e),r=e.id,n=Math.floor(t/(Wk+1)),s=Math.floor(t%(Wk+1));return qk.box(qk.types.traf,qk.box(qk.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),qk.box(qk.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s])),qk.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,qk.box(qk.types.trak,qk.tkhd(e),qk.mdia(e))}static trex(e){const t=e.id;return qk.box(qk.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,s=new Uint8Array(n);let a,o,c,l,d,h;for(t+=8+n,s.set(["video"===e.type?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a>>24&255,c>>>16&255,c>>>8&255,255&c,l>>>24&255,l>>>16&255,l>>>8&255,255&l,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,61440&d.degradPrio,15&d.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a);return qk.box(qk.types.trun,s)}static initSegment(e){qk.types||qk.init();const t=qk.moov(e);return Pf(qk.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let n=r.length;for(let u=0;u>8,255&i[u][e].length]),n),n+=2,s.set(i[u][e],n),n+=i[u][e].length}const o=qk.box(qk.types.hvcC,s),c=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return qk.box(qk.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,255&c,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,qk.box(qk.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),qk.box(qk.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}}qk.types=void 0,qk.HDLR_TYPES=void 0,qk.STTS=void 0,qk.STSC=void 0,qk.STCO=void 0,qk.STSZ=void 0,qk.VMHD=void 0,qk.SMHD=void 0,qk.STSD=void 0,qk.FTYP=void 0,qk.DINF=void 0;function Kk(e,t){const i=e*t*(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1);return arguments.length>3&&void 0!==arguments[3]&&arguments[3]?Math.round(i):i}function Zk(e){return Kk(e,1e3,1/9e4,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}let Yk,Jk=null,Qk=null;function Xk(e,t,i,r){return{duration:t,size:i,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class ey extends jg{constructor(e,t,i,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Jk){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Jk=e?parseInt(e[1]):0}if(null===Qk){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Qk=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,r=e.reduce((e,r)=>{let n=r.pts,s=n-e;return s<-4294967296&&(t=!0,n=ty(n,i),s=n-e),s>0?e:n},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,n,s,a,o){let c,l,d,h,u,p,g=n,f=n;const m=e.pid>-1,v=t.pid>-1,b=t.samples.length,k=e.samples.length>0,y=a&&b>0||b>1;if((!m||k)&&(!v||y)||this.ISGenerated||a){if(this.ISGenerated){var w,S,x,E;const e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(w=t.pixelRatio)?void 0:w[0])!==(null==(S=e.pixelRatio)?void 0:S[0])||(null==(x=t.pixelRatio)?void 0:x[1])!==(null==(E=e.pixelRatio)?void 0:E[1]))||!e&&y||null===this.nextAudioTs&&k)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,n,s));const i=this.isVideoContiguous;let r,a=-1;if(y&&(a=function(e){for(let t=0;t0){this.warn("Dropped ".concat(a," out of ").concat(b," video samples due to a missing keyframe"));const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,f+=(t.samples[0].pts-e)/t.inputTimeScale,r=f}else-1===a&&(this.warn("No keyframe found out of ".concat(b," video samples")),p=!1);if(this.ISGenerated){if(k&&y){const i=this.getVideoStartPts(t.samples),r=(ty(e.samples[0].pts,i)-i)/t.inputTimeScale;g+=Math.max(0,r),f+=Math.max(0,-r)}if(k){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,n,s)),l=this.remuxAudio(e,g,this.isAudioContiguous,s,v||y||o===Lg?f:void 0),y){const r=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,n,s)),c=this.remuxVideo(t,f,i,r)}}else y&&(c=this.remuxVideo(t,f,i,0));c&&(c.firstKeyFrame=a,c.independent=-1!==a,c.firstKeyFramePTS=r)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=iy(i,n,this._initPTS,this._initDTS)),r.samples.length&&(h=ry(r,n,this._initPTS))),{audio:l,video:c,initSegment:d,independent:p,text:h,id3:u}}generateIS(e,t,i,r){const n=e.samples,s=t.samples,a=this.typeSupported,o={},c=this._initPTS;let l,d,h,u,p=!c||r,g="audio/mp4";if(p&&(l=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(g="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}o.audio={id:"audio",container:g,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):qk.initSegment([e]),metadata:{channelCount:e.channelCount}},p&&(u=e.id,h=e.inputTimeScale,c&&h===c.timescale?p=!1:l=d=n[0].pts-Math.round(h*i))}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:qk.initSegment([t]),metadata:{width:t.width,height:t.height}},p)if(u=t.id,h=t.inputTimeScale,c&&h===c.timescale)p=!1;else{const e=this.getVideoStartPts(s),t=Math.round(h*i);d=Math.min(d,ty(s[0].dts,e)-t),l=Math.min(l,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,p?(this._initPTS={baseTime:l,timescale:h},this._initDTS={baseTime:d,timescale:h}):l=h=void 0,{tracks:o,initPTS:l,timescale:h,trackId:u}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,s=e.samples,a=[],o=s.length,c=this._initPTS,l=c.baseTime*n/c.timescale;let d,h,u=this.nextVideoTs,p=8,g=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,v=!1;if(!i||null===u){const e=l+t*n,r=s[0].pts-ty(s[0].dts,s[0].pts);Jk&&null!==u&&Math.abs(e-r-(u+l))<15e3?i=!0:u=e-r-l}const b=u+l;for(let D=0;D0?D-1:D].dts&&(v=!0)}v&&s.sort(function(e,t){const i=e.dts-t.dts,r=e.pts-t.pts;return i||r}),d=s[0].dts,h=s[s.length-1].dts;const k=h-d,y=k?Math.round(k/(o-1)):g||e.inputTimeScale/30;if(i){const i=d-b,r=i>y,n=i<-1;if((r||n)&&(r?this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(Zk(i,!0)," ms (").concat(i,"dts) hole between fragments detected at ").concat(t.toFixed(3))):this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(Zk(-i,!0)," ms (").concat(i,"dts) overlapping between fragments detected at ").concat(t.toFixed(3))),!n||b>=s[0].pts||Jk)){d=b;const e=s[0].pts-i;if(r)s[0].dts=d,s[0].pts=e;else{let t=!0;for(let r=0;re&&t);r++){const e=s[r].pts;if(s[r].dts-=i,s[r].pts-=i,r0?e.dts-s[D-1].dts:y;if(i=D>0?e.pts-s[D-1].pts:y,t.stretchShortVideoTrack&&null!==this.nextAudioTs){const i=Math.floor(t.maxBufferHole*n),s=(r?f+r*n:this.nextAudioTs+l)-e.pts;s>i?(g=s-a,g<0?g=a:P=!0,this.log("It is approximately ".concat(s/90," ms to the next segment; using duration ").concat(g/90," ms for the last video frame."))):g=a}else g=a}const d=Math.round(e.pts-e.dts);C=Math.min(C,g),R=Math.max(R,g),A=Math.min(A,i),L=Math.max(L,i),a.push(Xk(e.key,g,c,d))}if(a.length)if(Jk){if(Jk<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Qk&&L-A0&&(r&&Math.abs(v-(f+m))<9e3||Math.abs(ty(p[0].pts,v)-(f+m))<20*c),p.forEach(function(e){e.pts=ty(e.pts,v)}),!i||f<0){if(p=p.filter(e=>e.pts>=0),!p.length)return;f=0===n?0:r&&!u?Math.max(0,v-m):p[0].pts-m}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,r=f+m;i=t*c&&l<1e4&&u){let t=Math.round(o/c);for(r=a-t*c;r<0&&t&&c;)t--,r+=c;0===i&&(this.nextAudioTs=f=r-m),this.warn("Injecting ".concat(t," audio frames @ ").concat(((r-m)/s).toFixed(3),"s due to ").concat(Math.round(1e3*o/s)," ms gap."));for(let s=0;s0))return;w+=g;try{b=new Uint8Array(w)}catch(U){return void this.observer.emit(Tg.ERROR,Tg.ERROR,{type:xg.MUX_ERROR,details:Eg.REMUX_ALLOC_ERROR,fatal:!1,error:U,bytes:w,reason:"fail allocating audio mdat ".concat(w)})}if(!d){new DataView(b.buffer).setUint32(0,w),b.set(qk.types.mdat,4)}}b.set(r,g);const s=r.byteLength;g+=s,h.push(Xk(!0,o,s,0)),y=n}const x=h.length;if(!x)return;const E=h[h.length-1];f=y-m,this.nextAudioTs=f+a*E.duration;const T=d?new Uint8Array(0):qk.moof(e.sequenceNumber++,k/a,Ng({},e,{samples:h}));e.samples=[];const _=(k-m)/s,P=f/s,C={data1:T,data2:b,startPTS:_,endPTS:P,startDTS:_,endDTS:P,type:"audio",hasAudio:!0,hasVideo:!1,nb:x};return this.isAudioContiguous=!0,C}}function ty(e,t){let i;if(null===t)return e;for(i=t4294967296;)e+=i;return e}function iy(e,t,i,r){const n=e.samples.length;if(!n)return;const s=e.inputTimeScale;for(let o=0;oe.pts-t.pts);const s=e.samples;return e.samples=[],{samples:s}}function ny(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return void 0!==(null==e?void 0:e.start)?(e.start+(i?e.duration:0))/e.timescale:t}function sy(e,t,i){const r=null==e?void 0:e.codec;if(r&&r.length>4)return r;if(t===tf){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r){return Gf(r,!1)}return i.warn('Unhandled audio codec "'.concat(r,'" in mp4 MAP')),r||"mp4a"}return i.warn('Unhandled video codec "'.concat(r,'" in mp4 MAP')),r||"avc1"}try{Yk=self.performance.now.bind(self.performance)}catch(U){Yk=Date.now}const ay=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=gk("video",1),s=this.audioTrack=gk("audio",1),a=this.txtTrack=gk("text",1);if(this.id3Track=gk("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const o=yf(e);if(o.video){const{id:e,timescale:t,codec:i,supplemental:r}=o.video;n.id=e,n.timescale=a.timescale=t,n.codec=i,n.supplemental=r}if(o.audio){const{id:e,timescale:t,codec:i}=o.audio;s.id=e,s.timescale=t,s.codec=i}a.id=uf.text,n.sampleDuration=0,n.duration=s.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=r>1?i+r:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Pf(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=bf(e,["moof"]);if(i.length<2)return t.remainder=e,t;const r=i[i.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}(i);this.remainderData=t.remainder,r.samples=t.valid||new Uint8Array}else r.samples=i;const s=this.extractID3Track(r,t);return n.samples=Cf(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=Cf(e,t),{videoTrack:t,audioTrack:gk(),id3Track:r,textTrack:gk()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=bf(e.samples,["emsg"]);r&&r.forEach(e=>{const r=function(e){const t=e[0];let i="",r="",n=0,s=0,a=0,o=0,c=0,l=0;if(0===t){for(;"\0"!==pf(e.subarray(l,l+1));)i+=pf(e.subarray(l,l+1)),l+=1;for(i+=pf(e.subarray(l,l+1)),l+=1;"\0"!==pf(e.subarray(l,l+1));)r+=pf(e.subarray(l,l+1)),l+=1;r+=pf(e.subarray(l,l+1)),l+=1,n=ff(e,12),s=ff(e,16),o=ff(e,20),c=ff(e,24),l=28}else if(1===t){l+=4,n=ff(e,l),l+=4;const t=ff(e,l);l+=4;const s=ff(e,l);for(l+=4,a=2**32*t+s,wg(a)||(a=Number.MAX_SAFE_INTEGER,Gg.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ff(e,l),l+=4,c=ff(e,l),l+=4;"\0"!==pf(e.subarray(l,l+1));)i+=pf(e.subarray(l,l+1)),l+=1;for(i+=pf(e.subarray(l,l+1)),l+=1;"\0"!==pf(e.subarray(l,l+1));)r+=pf(e.subarray(l,l+1)),l+=1;r+=pf(e.subarray(l,l+1)),l+=1}return{schemeIdUri:i,value:r,timeScale:n,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:c,payload:e.subarray(l,e.byteLength)}}(e);if(Rk.test(r.schemeIdUri)){const e=Lk(r,t);let n=4294967295===r.eventDuration?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;n<=.001&&(n=Number.POSITIVE_INFINITY);const s=r.payload;i.samples.push({data:s,len:s.byteLength,dts:e,pts:e,type:pk.emsg,duration:n})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const e=Lk(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:e,pts:e,type:pk.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends jg{constructor(e,t,i,r){super("passthrough-remuxer",r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&bf(e,["moov","trak"]).forEach(e=>{const t=bf(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let r=bf(t,["enca"]);const n=r.length>0;n||(r=bf(t,["encv"])),r.forEach(e=>{bf(n?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{const t=_f(e);if(t){const e=t.subarray(8,24);e.some(e=>0!==e)||(Gg.log("[eme] Patching keyId in 'enc".concat(n?"a":"v",">sinf>>tenc' box: ").concat(Zg(e)," -> ").concat(Zg(i))),t.set(i,8))}})})});return e}(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const r=this.initData=yf(e);r.audio&&(t=sy(r.audio,tf,this)),r.video&&(i=sy(r.video,rf,this));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,supplemental:r.video.supplemental,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,supplemental:r.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,s){var a,o;let{initPTS:c,lastEndTime:l}=this;const d={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};yg(l)||(l=this.lastEndTime=n||0);const h=t.samples;if(null==h||!h.length)return d;const u={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(h),p=this.initData),null==(o=p)||!o.length)return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const g=function(e,t,i){const r={},n=bf(e,["moof","traf"]);for(let s=0;sr[e].duration)){let t=0;const i=bf(e,["sidx"]);for(let e=0;ee+t.info.duration||0,0);t=Math.max(t,e+r.earliestPresentationTime/r.timescale)}}t&&yg(t)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=t*r[e].timescale-r[e].start)})}return r}(h,p,this),f=p.audio?g[p.audio.id]:null,m=p.video?g[p.video.id]:null,v=ny(m,1/0),b=ny(f,1/0),k=ny(m,0,!0),y=ny(f,0,!0);let w,S=n,x=0;if(f&&(!m||!c&&bn}(c,S,n,x)&&u.timescale===c.timescale||(u.initPTS=S-n,u.timescale=1,c&&1===c.timescale&&this.warn("Adjusting initPTS @".concat(n," from ").concat(c.baseTime/c.timescale," to ").concat(u.initPTS)),this.initPTS=c={baseTime:u.initPTS,timescale:1});const E=e?S-c.baseTime/c.timescale:l,T=E+x;x>0?this.lastEndTime=T:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const _=!!p.audio,P=!!p.video;let C="";_&&(C+="audio"),P&&(C+="video");const A={data1:h,startPTS:E,startDTS:E,endPTS:T,endDTS:T,type:C,hasAudio:_,hasVideo:P,nb:1,dropped:0};d.audio=_&&!P?A:void 0,d.video=P?A:void 0;const R=null==m?void 0:m.sampleCount;if(R){const e=m.keyFrameIndex,t=-1!==e;A.nb=R,A.dropped=0===e||this.isVideoContiguous?0:t?e:R,A.independent=t,A.firstKeyFrame=e,t&&m.keyFrameStart&&(A.firstKeyFramePTS=(m.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(d.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),A.dropped&&this.warn("fmp4 does not start with IDR: firstIDR ".concat(e,"/").concat(R," dropped: ").concat(A.dropped," start: ").concat(A.firstKeyFramePTS||"NA"))}return d.initSegment=u,d.id3=iy(i,n,c,c),r.samples.length&&(d.text=ry(r,n,c)),d}}},{demux:Fk,remux:ey},{demux:class extends fk{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Zb(e,0);let r=(null==i?void 0:i.length)||0;if(_k(e,r))return!1;for(let n=e.length;r0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(s,t);if(k&&wv(k.method)){const e=this.getDecrypter(),t=Sv(k.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(s,k.key.buffer,k.iv.buffer,t).then(e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t}),this.decryptionPromise;{let r=e.softwareDecrypt(s,k.key.buffer,k.iv.buffer,t);if(i.part>-1){const t=e.flush();r=t?t.buffer:t}if(!r)return n.executeEnd=Yk(),cy(i);s=new Uint8Array(r)}}const y=this.needsProbing(l,d);if(y){const e=this.configureTransmuxer(s);if(e)return this.logger.warn("[transmuxer] ".concat(e.message)),this.observer.emit(Tg.ERROR,Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),n.executeEnd=Yk(),cy(i)}(l||d||p||y)&&this.resetInitSegment(b,g,f,v,t),(l||p||y)&&this.resetInitialTimestamp(m),c||this.resetContiguity();const w=this.transmux(s,k,u,h,i);this.asyncResult=ly(w);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,n.executeEnd=Yk(),w}flush(e){const t=e.transmuxing;t.executeStart=Yk();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const s=[],{timeOffset:a}=r;if(i){const t=i.flush();t&&s.push(this.push(t.buffer,null,e))}const{demuxer:o,remuxer:c}=this;if(!o||!c){t.executeEnd=Yk();const i=[cy(e)];return this.asyncResult?Promise.resolve(i):i}const l=o.flush(a);return ly(l)?(this.asyncResult=!0,l.then(t=>(this.flushRemux(s,t,e),s))):(this.flushRemux(s,l,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:s,textTrack:a}=t,{accurateTimeOffset:o,timeOffset:c}=this.currentTransmuxState;this.logger.log("[transmuxer.ts]: Flushed ".concat(this.id," sn: ").concat(i.sn).concat(i.part>-1?" part: "+i.part:""," of ").concat(this.id===Rg?"level":"track"," ").concat(i.level));const l=this.remuxer.remux(r,n,s,a,c,o,!0,this.id);e.push({remuxResult:l,chunkMeta:i}),i.transmuxing.executeEnd=Yk()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let s;return s=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,n):this.transmuxUnencrypted(e,i,r,n),s}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,s,a,o,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r}=this;let n;for(let d=0,h=ay.length;d({remuxResult:{},chunkMeta:e});function ly(e){return"then"in e&&e.then instanceof Function}class dy{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class hy{constructor(e,t,i,r,n,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=s}}let uy=0;class py{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=uy++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{const t=e.data,i=this.hls;if(i&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var r;const e=null==(r=this.workerContext)?void 0:r.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,i.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;const t=new Error("".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")"));this.hls.config.enableWorker=!1,this.hls.logger.warn('Error in "'.concat(this.id,'" Web Worker, fallback to inline')),this.hls.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const s=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===Tg.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Hb,this.observer.on(Tg.FRAG_DECRYPTED,s),this.observer.on(Tg.ERROR,s);const a=Zf(n.preferManagedMediaSource);if(this.useWorker&&"undefined"!==typeof Worker){const i=this.hls.logger;if(n.workerPath||"function"===typeof __HLS_WORKER_BUNDLE__){try{n.workerPath?(i.log("loading Web Worker ".concat(n.workerPath,' for "').concat(t,'"')),this.workerContext=function(e){const t=Gb[e];if(t)return t.clientCount++,t;const i=new self.URL(e,self.location.href).href,r={worker:new self.Worker(i),scriptURL:i,clientCount:1};return Gb[e]=r,r}(n.workerPath)):(i.log('injecting Web Worker for "'.concat(t,'"')),this.workerContext=function(){const e=Gb[$b];if(e)return e.clientCount++,e;const t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(".concat(__HLS_WORKER_BUNDLE__.toString(),")(true);")],{type:"text/javascript"}),i=self.URL.createObjectURL(t),r={worker:new self.Worker(i),objectURL:i,clientCount:1};return Gb[$b]=r,r}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:t,config:pm(n)})}catch(U){i.warn('Error setting up "'.concat(t,'" Web Worker, fallback to inline'),U),this.terminateWorker(),this.error=null,this.transmuxer=new oy(this.observer,a,n,"",t,e.logger)}return}}this.transmuxer=new oy(this.observer,a,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=uy++;const t=this.hls.config,i=Zf(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:pm(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){const t=Gb[e||$b];if(t&&1===t.clientCount--){const{worker:i,objectURL:r}=t;delete Gb[e||$b],r&&self.URL.revokeObjectURL(r),i.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,r,n,s,a,o,c,l){var d,h;c.transmuxing.start=self.performance.now();const{instanceNo:u,transmuxer:p}=this,g=s?s.start:n.start,f=n.decryptdata,m=this.frag,v=!(m&&n.cc===m.cc),b=!(m&&c.level===m.level),k=m?c.sn-m.sn:-1,y=this.part?c.part-this.part.index:-1,w=0===k&&c.id>1&&c.id===(null==m?void 0:m.stats.chunkCount),S=!b&&(1===k||0===k&&(1===y||w&&y<=0)),x=self.performance.now();(b||k||0===n.stats.parsing.start)&&(n.stats.parsing.start=x),!s||!y&&S||(s.stats.parsing.start=x);const E=!(m&&(null==(d=n.initSegment)?void 0:d.url)===(null==(h=m.initSegment)?void 0:h.url)),T=new hy(v,S,o,b,g,E);if(!S||v||E){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for ".concat(n.type," sn: ").concat(c.sn).concat(c.part>-1?" part: "+c.part:""," ").concat(this.id===Rg?"level":"track",": ").concat(c.level," id: ").concat(c.id,"\n discontinuity: ").concat(v,"\n trackSwitch: ").concat(b,"\n contiguous: ").concat(S,"\n accurateTimeOffset: ").concat(o,"\n timeOffset: ").concat(g,"\n initSegmentChange: ").concat(E));const e=new dy(i,r,t,a,l);this.configureTransmuxer(e)}if(this.frag=n,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:u,cmd:"demux",data:e,decryptdata:f,chunkMeta:c,state:T},e instanceof ArrayBuffer?[e]:[]);else if(p){const t=p.push(e,f,c,T);ly(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const t=i.flush(e);ly(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}class gy extends jg{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const r=null==t?void 0:t.renditionReports;if(r){let s=-1;for(let i=0;i=0&&e>t.partTarget&&(a+=1)}const o=i&&cm(i);return new lm(n,a>=0?a:void 0,o)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(i))}return e}playlistLoaded(e,t,i){const{details:r,stats:n}=t,s=self.performance.now(),a=n.loading.first?Math.max(0,s-n.loading.first):0;r.advancedDateTime=Date.now()-a;const o=this.hls.config.timelineOffset;if(o!==r.appliedTimelineOffset){const e=Math.max(o||0,0);r.appliedTimelineOffset=e,r.fragments.forEach(t=>{t.start=t.playlistOffset+e})}if(r.live||null!=i&&i.live){const o="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(i),i&&r.fragments.length>0){db(i,r);const e=r.playlistParsingError;if(e){this.warn(e);const i=this.hls;if(!i.config.ignorePlaylistParsingErrors){var c;const{networkDetails:s}=t;return void i.trigger(Tg.ERROR,{type:xg.NETWORK_ERROR,details:Eg.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(c=r.fragments[0])?void 0:c.type,networkDetails:s,stats:n})}r.playlistParsingError=null}}-1===r.requestScheduled&&(r.requestScheduled=n.loading.start);const l=this.hls.mainForwardBufferInfo,d=l?l.end-l.len:0,h=gb(r,1e3*(r.edge-d));if(r.requestScheduled+h0){if(h>3*r.targetduration)this.log("Playlist last advanced ".concat(d.toFixed(2),"s ago. Omitting segment and part directives.")),p=void 0,g=void 0;else if(null!=i&&i.tuneInGoal&&h-r.partTarget>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: ".concat(i.tuneInGoal," to: ").concat(f," with playlist age: ").concat(r.age)),f=0;else{const e=Math.floor(f/r.targetduration);if(p+=e,void 0!==g){g+=Math.round(f%r.targetduration/r.partTarget)}this.log("CDN Tune-in age: ".concat(r.ageHeader,"s last advanced ").concat(d.toFixed(2),"s goal: ").concat(f," skip sn ").concat(e," to part ").concat(g))}r.tuneInGoal=f}if(u=this.getDeliveryDirectives(r,t.deliveryDirectives,p,g),e||!l)return r.requestScheduled=s,void this.loadingPlaylist(o,u)}else(r.canBlockReload||r.canSkipUntil)&&(u=this.getDeliveryDirectives(r,t.deliveryDirectives,p,g));u&&void 0!==p&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(h-2*a,h/2)),this.scheduleLoading(o,u,r)}else this.clearTimer()}scheduleLoading(e,t,i){const r=i||e.details;if(!r)return void this.loadingPlaylist(e,t);const n=self.performance.now(),s=r.requestScheduled;if(n>=s)return void this.loadingPlaylist(e,t);const a=s-n;this.log("reload live playlist ".concat(e.name||e.bitrate+"bps"," in ").concat(Math.round(a)," ms")),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),a)}getDeliveryDirectives(e,t,i,r){let n=cm(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=sm),new lm(i,r,n)}checkRetry(e){const t=e.details,i=Pm(e),r=e.errorAction,{action:n,retryCount:s=0,retryConfig:a}=r||{},o=!!r&&!!a&&(n===Om||!r.resolved&&n===Mm);if(o){var c;if(s>=a.maxNumRetry)return!1;if(i&&null!=(c=e.context)&&c.deliveryDirectives)this.warn("Retrying playlist loading ".concat(s+1,"/").concat(a.maxNumRetry,' after "').concat(t,'" without delivery-directives')),this.loadPlaylist();else{const e=Am(a,s);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn("Retrying playlist loading ".concat(s+1,"/").concat(a.maxNumRetry,' after "').concat(t,'" in ').concat(e,"ms"))}e.levelRetry=!0,r.resolved=!0}return o}}function fy(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i])}function vy(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class by{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(null===this.queues||null===this.tracks)return;const r=this.queues[t];r.push(e),1!==r.length||i||this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=null==(t=e[0])?void 0:t.label;"async-blocker"!==i&&"async-blocker-prepend"!==i||(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(null===this.queues)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(r){var i;if(n.onError(r),null===this.queues||null===this.tracks)return;const t=null==(i=this.tracks[e])?void 0:i.buffer;null!=t&&t.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return null===e||null===t?"":"\n".concat(this.list("video"),"\n").concat(this.list("audio"),"\n").concat(this.list("audiovideo"),"}")}list(e){var t,i;return null!=(t=this.queues)&&t[e]||null!=(i=this.tracks)&&i[e]?"".concat(e,": (").concat(this.listSbInfo(e),") ").concat(this.listOps(e)):""}listSbInfo(e){var t;const i=null==(t=this.tracks)?void 0:t[e],r=null==i?void 0:i.buffer;return r?"SourceBuffer".concat(r.updating?" updating":"").concat(i.ended?" ended":"").concat(i.ending?" ending":""):"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map(e=>e.label).join(", "))||""}}const ky=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,yy="HlsJsTrackRemovedError";class wy extends Error{constructor(e){super(e),this.name=yy}}function Sy(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}function xy(e){return"audio"===e?1:0}class Ey{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Tg.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tg.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Tg.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tg.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&yg(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log("Setting autoLevelCapping to ".concat(i,": ").concat(e[i].height,"p@").concat(e[i].bitrate," for media ").concat(this.mediaWidth,"x").concat(this.mediaHeight)),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((t,i)=>this.isLevelAllowed(t)&&i<=e);return this.clientRect=null,Ey.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;const r=(e,t)=>!t||(e.width!==t.width||e.height!==t.height);let n=e.length-1;const s=Math.max(t,i);for(let a=0;a=s||t.height>=s)&&r(t,e[a+1])){n=a;break}}return n}}const Ty={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},_y={HLS:"h"},Py="CMCD-Object",Cy="CMCD-Request",Ay="CMCD-Session",Ry="CMCD-Status",Ly={[Py]:["br","d","ot","tb"],[Cy]:["bl","dl","mtp","nor","nrr","su"],[Ay]:["cid","pr","sf","sid","st","v"],[Ry]:["bs","rtp"]};class Iy{constructor(e,t){Array.isArray(e)&&(e=e.map(e=>e instanceof Iy?e:new Iy(e))),this.value=e,this.params=t}}function My(e,t,i,r){return new Error("failed to ".concat(e,' "').concat((n=t,Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":"object"===typeof n?JSON.stringify(n):String(n)),'" as ').concat(i),{cause:r});var n}function Dy(e,t,i){return My("serialize",e,t,i)}class Oy{constructor(e){this.description=e}}const Ny="Bare Item";function Uy(e){if(!1===ArrayBuffer.isView(e))throw Dy(e,"Byte Sequence");return":".concat((t=e,btoa(String.fromCharCode(...t))),":");var t}function Fy(e){if(function(e){return e<-999999999999999||99999999999999912)throw Dy(e,"Decimal");const i=t.toString();return i.includes(".")?i:"".concat(i,".0")}const Vy=/[\x00-\x1f\x7f]+/;function zy(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw Dy(t,"Token");return t}function Hy(e){switch(typeof e){case"number":if(!yg(e))throw Dy(e,Ny);return Number.isInteger(e)?Fy(e):By(e);case"string":return function(e){if(Vy.test(e))throw Dy(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}(e);case"symbol":return zy(e);case"boolean":return function(e){if("boolean"!==typeof e)throw Dy(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return"@".concat(Fy(e.getTime()/1e3))}(e);if(e instanceof Uint8Array)return Uy(e);if(e instanceof Oy)return zy(e);default:throw Dy(e,Ny)}}function $y(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Dy(e,"Key");return e}function Gy(e){return null==e?"":Object.entries(e).map(e=>{let[t,i]=e;return!0===i?";".concat($y(t)):";".concat($y(t),"=").concat(Hy(i))}).join("")}function Wy(e){return e instanceof Iy?"".concat(Hy(e.value)).concat(Gy(e.params)):Hy(e)}function qy(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!==typeof e)throw Dy(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),r=(null===t||void 0===t?void 0:t.whitespace)?" ":"";return Array.from(i).map(e=>{let[t,i]=e;i instanceof Iy===!1&&(i=new Iy(i));let r=$y(t);var n;return!0===i.value?r+=Gy(i.params):(r+="=",Array.isArray(i.value)?r+="(".concat((n=i).value.map(Wy).join(" "),")").concat(Gy(n.params)):r+=Wy(i)),r}).join(",".concat(r))}const Ky=e=>Math.round(e),Zy=e=>100*Ky(e/100),Yy={br:Ky,d:Ky,bl:Zy,dl:Zy,mtp:Zy,nor:(e,t)=>((null===t||void 0===t?void 0:t.baseUrl)&&(e=function(e,t){const i=new URL(e),r=new URL(t);if(i.origin!==r.origin)return e;const n=i.pathname.split("/").slice(1),s=r.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:Zy,tb:Ky};function Jy(e,t){const i={};if(null==e||"object"!==typeof e)return i;const r=Object.keys(e).sort(),n=Ng({},Yy,null===t||void 0===t?void 0:t.formatters),s=null===t||void 0===t?void 0:t.filter;return r.forEach(r=>{if(null===s||void 0===s?void 0:s(r))return;let a=e[r];const o=n[r];o&&(a=o(a,t)),"v"===r&&1===a||"pr"==r&&1===a||function(e){return"number"===typeof e?yg(e):null!=e&&""!==e&&!1!==e}(a)&&(function(e){return"ot"===e||"sf"===e||"st"===e}(r)&&"string"===typeof a&&(a=new Oy(a)),i[r]=a)}),i}function Qy(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?function(e,t){return qy(e,t)}(Jy(e,t),Ng({whitespace:!1},t)):""}function Xy(e,t,i){return Ng(e,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i={};if(!e)return i;const r=Object.entries(e),n=Object.entries(Ly).concat(Object.entries((null===t||void 0===t?void 0:t.customHeaderMap)||{})),s=r.reduce((e,t)=>{var i,r;const[s,a]=t,o=(null===(i=n.find(e=>e[1].includes(s)))||void 0===i?void 0:i[0])||Cy;return null!==(r=e[o])&&void 0!==r||(e[o]={}),e[o][s]=a,e},{});return Object.entries(s).reduce((e,i)=>{let[r,n]=i;return e[r]=Qy(n,t),e},i)}(t,i))}const ew=/CMCD=[^&#]+/;function tw(e,t,i){const r=function(e){if(!e)return"";const t=Qy(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return"".concat("CMCD","=").concat(encodeURIComponent(t))}(t,i);if(!r)return e;if(ew.test(e))return e.replace(ew,r);const n=e.includes("?")?"&":"?";return"".concat(e).concat(n).concat(r)}function iw(e,t,i,r){e&&Object.keys(t).forEach(n=>{const s=e.filter(e=>e.groupId===n).map(e=>{const s=Ng({},e);return s.details=void 0,s.attrs=new mv(s.attrs),s.url=s.attrs.URI=rw(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),s.groupId=s.attrs["GROUP-ID"]=t[n],s.attrs["PATHWAY-ID"]=r,s});e.push(...s)})}function rw(e,t,i,r){const{HOST:n,PARAMS:s,[i]:a}=r;let o;t&&(o=null==a?void 0:a[t],o&&(e=o));const c=new self.URL(e);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(e=>{e&&c.searchParams.set(e,s[e])}),c.href}function nw(e,t,i){sw(e,t,i),e.addEventListener(t,i)}function sw(e,t,i){e.removeEventListener(t,i)}class aw extends jg{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=aw.CDMCleanupPromise?[aw.CDMCleanupPromise]:[],this.onMediaEncrypted=e=>{const{initDataType:t,initData:i}=e,r='"'.concat(e.type,'" event: init data type: "').concat(t,'"');if(this.debug(r),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=jv(this.config));const t=e.map(Fv).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(n=>{const s=Iv(n);let a,o;if("sinf"===t){if(s!==Pv.FAIRPLAY)return void this.warn('Ignoring unexpected "'.concat(e.type,'" event with init data type: "').concat(t,'" for selected key-system ').concat(s));const n=pf(new Uint8Array(i));try{const e=_f(xv(JSON.parse(n).sinf));if(!e)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(e.subarray(8,24)),o=Pv.FAIRPLAY}catch(u){return void this.warn("".concat(r," Failed to parse sinf: ").concat(u))}}else{if(s!==Pv.WIDEVINE&&s!==Pv.PLAYREADY)return void this.warn('Ignoring unexpected "'.concat(e.type,'" event with init data type: "').concat(t,'" for selected key-system ').concat(s));const n=function(e){const t=[];if(e instanceof ArrayBuffer){const i=e.byteLength;let r=0;for(;r+32!!e.systemId&&Uv(e.systemId)===s);c.length>1&&this.warn("".concat(r," Using first of ").concat(c.length," pssh found for selected key-system ").concat(s));const l=c[0];if(!l)return void(0===n.length||n.some(e=>!e.systemId)?this.warn("".concat(r," contains incomplete or invalid pssh data")):this.log("ignoring ".concat(r," for ").concat(n.map(e=>Uv(e.systemId)).join(",")," pssh data in favor of playlist keys")));if(o=Uv(l.systemId),0===l.version&&l.data)if(o===Pv.WIDEVINE){const e=l.data.length-22;a=new Uint8Array(l.data.subarray(e,e+16))}else o===Pv.PLAYREADY&&(a=zv(l.data))}if(!o||!a)return;const c=Zg(a),{keyIdToKeySessionPromise:l,mediaKeySessions:d}=this;let h=l[c];for(let e=0;ethis.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")),h.catch(e=>this.handleError(e));break}}if(!h){if(o!==s)return void this.log('Ignoring "'.concat(e.type,'" event with ').concat(o," init data for selected key-system ").concat(s));h=l[c]=this.getKeySystemSelectionPromise([o]).then(e=>{let{keySystem:r,mediaKeys:n}=e;var s;this.throwIfDestroyed();const o=new $v("ISO-23001-7",c,null!=(s=Fv(r))?s:"");return o.pssh=new Uint8Array(i),o.keyId=a,this.attemptSetMediaKeys(r,n).then(()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({decryptdata:o,keySystem:r,mediaKeys:n});return this.generateRequestWithPreferredKeySession(e,t,i,"encrypted-event-no-match")})}),h.catch(e=>this.handleError(e))}})}},this.onWaitingForKey=e=>{this.log('"'.concat(e.type,'" event'))},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Tg.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(Tg.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Tg.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(Tg.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];return r?r.licenseUrl:e===Pv.WIDEVINE&&i?i:void 0}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error('no license server URL configured for key-system "'.concat(e,'"'));return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'.concat(e,'"]'))}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(i),n=t.map(e=>e.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((t,i)=>{const s=e=>{const a=e.shift();this.getMediaKeysPromise(a,r,n).then(e=>t({keySystem:a,mediaKeys:e})).catch(t=>{e.length?s(e):i(t instanceof ow?t:new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};s(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!==typeof i){let e="Configured requestMediaKeySystemAccess is not a function ".concat(i);return null===Bv&&"http:"===self.location.protocol&&(e="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=function(e,t,i,r){let n;switch(e){case Pv.FAIRPLAY:n=["cenc","sinf"];break;case Pv.WIDEVINE:case Pv.PLAYREADY:n=["cenc"];break;case Pv.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(e))}return function(e,t,i,r){return[{initDataTypes:e,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:t.map(e=>({contentType:"audio/mp4; codecs=".concat(e),robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:i.map(e=>({contentType:"video/mp4; codecs=".concat(e),robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}(n,t,i,r)}(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let s=null==n?void 0:n.keySystemAccess;if(!s){this.log('Requesting encrypted media "'.concat(e,'" key-system access with config: ').concat(pm(r))),s=this.requestMediaKeySystemAccess(e,r);const t=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(t=>{this.log('Failed to obtain access to key-system "'.concat(e,'": ').concat(t))}),s.then(i=>{this.log('Access for key-system "'.concat(i.keySystem,'" obtained'));const r=this.fetchServerCertificate(e);return this.log('Create media-keys for "'.concat(e,'"')),t.mediaKeys=i.createMediaKeys().then(i=>(this.log('Media-keys created for "'.concat(e,'"')),t.hasMediaKeys=!0,r.then(t=>t?this.setMediaKeysServerCertificate(i,e,t):i))),t.mediaKeys.catch(t=>{this.error('Failed to create media-keys for "'.concat(e,'"}: ').concat(t))}),t.mediaKeys})}return s.then(()=>n.mediaKeys)}createMediaKeySessionContext(e){let{decryptdata:t,keySystem:i,mediaKeys:r}=e;this.log('Creating key-system session "'.concat(i,'" keyId: ').concat(Zg(t.keyId||[])));const n=r.createSession(),s={decryptdata:t,keySystem:i,mediaKeys:r,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return Zg(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log('Updating key-session "'.concat(r.sessionId,'" for keyID ').concat(Zg((null==(i=e.decryptdata)?void 0:i.keyId)||[]),"\n } (data length: ").concat(t?t.byteLength:t,")")),r.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(e=>{let{hasMediaKeys:t}=e;return!!t}).map(e=>{let{keySystem:t}=e;return Fv(t)}).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(e=>{let{keySystem:t,mediaKeys:i}=e;return this.attemptSetMediaKeys(t,i)})}selectKeySystem(e){return new Promise((t,i)=>this.getKeySystemSelectionPromise(e).then(e=>{let{keySystem:r}=e;const n=Fv(r);n?t(n):i(new Error('Unable to find format for key-system "'.concat(r,'"')))}).catch(i))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: ".concat(e.sn," ").concat(e.type,": ").concat(e.level,") key formats ").concat(t.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=jv(this.config),i=e.map(Iv).filter(e=>!!e&&-1!==t.indexOf(e));return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r="(keyId: ".concat(i,' format: "').concat(t.keyFormat,'" method: ').concat(t.method," uri: ").concat(t.uri,")");this.log("Starting session for key ".concat(r));let n=this.keyIdToKeySessionPromise[i];if(!n){n=this.getKeySystemForKeyPromise(t).then(i=>{let{keySystem:n,mediaKeys:s}=i;return this.throwIfDestroyed(),this.log("Handle encrypted media sn: ".concat(e.frag.sn," ").concat(e.frag.type,": ").concat(e.frag.level," using key ").concat(r)),this.attemptSetMediaKeys(n,s).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:n,mediaKeys:s,decryptdata:t})))});(this.keyIdToKeySessionPromise[i]=n.then(e=>{const i=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",i,"playlist-key")})).catch(e=>this.handleError(e))}return n}throwIfDestroyed(){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof ow?this.hls.trigger(Tg.ERROR,e.data):this.hls.trigger(Tg.ERROR,{type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=Iv(e.keyFormat),i=t?[t]:jv(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=jv(this.config)),0===e.length)throw new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(pm({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'.concat(e,'"'));const r=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log('Media-keys set for "'.concat(e,'"')),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===i.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,i,r){var n,s;const a=null==(n=this.config.drmSystems)||null==(s=n[e.keySystem])?void 0:s.generateRequest;if(a)try{const r=a.call(this.hls,t,i,e);if(!r)throw new Error("Invalid response from configured generateRequest filter");t=r.initDataType,i=r.initData?r.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(p){var o;if(this.warn(p.message),null!=(o=this.hls)&&o.config.debug)throw p}if(null===i)return this.log('Skipping key-session request for "'.concat(r,'" (no initData)')),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'.concat(r,'": ').concat(c," (init data type: ").concat(t," length: ").concat(i?i.byteLength:null,")"));const l=new Hb,d=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void l.emit("error",new Error("invalid state"));const{messageType:r,message:n}=t;this.log('"'.concat(r,'" message event for session "').concat(i.sessionId,'" message size: ').concat(n.byteLength)),"license-request"===r||"license-renewal"===r?this.renewLicense(e,n).catch(e=>{l.eventNames().length?l.emit("error",e):this.handleError(e)}):"license-release"===r?e.keySystem===Pv.FAIRPLAY&&(this.updateKeySession(e,Ev("acknowledged")),this.removeSession(e)):this.warn('unhandled media key message type "'.concat(r,'"'))},h=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void l.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;l.emit("keyStatus",i),"expired"===i&&(this.warn("".concat(e.keySystem," expired for key ").concat(c)),this.renewKeySession(e))};nw(e.mediaKeysSession,"message",d),nw(e.mediaKeysSession,"keystatuseschange",h);const u=new Promise((e,t)=>{l.on("error",t),l.on("keyStatus",i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'.concat(i,'"'))):"expired"===i?t(new Error("key expired while generating request")):this.warn('unhandled key status change "'.concat(i,'"'))})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var t;this.log('Request generated for key-session "'.concat(null==(t=e.mediaKeysSession)?void 0:t.sessionId,'" keyId: ').concat(c))}).catch(e=>{throw new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},"Error generating key-session request: ".concat(e))}).then(()=>u).catch(t=>{throw l.removeAllListeners(),this.removeSession(e),t}).then(()=>(l.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{if("string"===typeof i&&"object"===typeof t){const e=i;i=t,t=e}this.log('key status change "'.concat(t,'" for keyStatuses keyId: ').concat(Zg("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))," session keyId: ").concat(Zg(new Uint8Array(e.decryptdata.keyId||[]))," uri: ").concat(e.decryptdata.uri)),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),r=this.getServerCertificateUrl(e);return r?(this.log('Fetching server certificate for "'.concat(e,'"')),new Promise((n,s)=>{const a={responseType:"arraybuffer",url:r},o=t.certLoadPolicy.default,c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},l={onSuccess:(e,t,i,r)=>{n(e.data)},onError:(t,i,n,o)=>{s(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:Fg({url:a.url,data:void 0},t)},'"'.concat(e,'" certificate request failed (').concat(r,"). Status: ").concat(t.code," (").concat(t.text,")")))},onTimeout:(t,i,n)=>{s(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:a.url,data:void 0}},'"'.concat(e,'" certificate request timed out (').concat(r,")")))},onAbort:(e,t,i)=>{s(new Error("aborted"))}};i.load(a,c,l)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(n=>{this.log("setServerCertificate ".concat(n?"success":"not supported by CDM"," (").concat(null==i?void 0:i.byteLength,') on "').concat(t,'"')),r(e)}).catch(e=>{n(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(e=>{throw new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=(new DOMParser).parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let t;for(let i=0,r=n.length;i in key message");return Ev(atob(c))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(s=>{if(!i.decryptdata)throw s;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||r}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log("Sending license request to URL: ".concat(s));const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log("License received ".concat(t instanceof ArrayBuffer?t.byteLength:t));const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,s,e)}catch(o){this.error(o)}r(t)}else{const o=i.errorRetry,c=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||a.status>=400&&a.status<500)n(new ow({type:xg.KEY_SYSTEM_ERROR,details:Eg.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:s,data:void 0,code:a.status,text:a.statusText}},"License Request XHR failed (".concat(s,"). Status: ").concat(a.status," (").concat(a.statusText,")")));else{const i=c-this._requestLicenseFailureCount+1;this.warn("Retrying license request, ".concat(i," attempts left")),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,s,e,t).then(t=>{let{xhr:i,licenseChallenge:r}=t;e.keySystem==Pv.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(i,r)),i.send(r)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,nw(i,"encrypted",this.onMediaEncrypted),nw(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(sw(e,"encrypted",this.onMediaEncrypted),sw(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,$v.clearKeyUriToKeyIdMap();const r=i.length;aw.CDMCleanupPromise=Promise.all(i.map(e=>this.removeSession(e)).concat(null==t||null==(e=t.setMediaKeys(null))?void 0:e.catch(e=>{var t;this.log("Could not clear media keys: ".concat(e)),null==(t=this.hls)||t.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: ".concat(e))})}))).catch(e=>{var t;this.log("Could not close sessions and clear media keys: ".concat(e)),null==(t=this.hls)||t.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close sessions and clear media keys: ".concat(e))})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,t){let{sessionKeys:i}=t;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){const e=i.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log("Selecting key-system from session-keys ".concat(e.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log("Remove licenses and keys and close session ".concat(t.sessionId)),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{drmSystemOptions:n}=this.config,s=function(e){var t;return"persistent-license"===e.sessionType||!(null==(t=e.sessionTypes)||!t.some(e=>"persistent-license"===e))}(n)?new Promise((e,i)=>{self.setTimeout(()=>i(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(e)}):Promise.resolve();return s.catch(e=>{var t;this.log("Could not remove session: ".concat(e)),null==(t=this.hls)||t.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: ".concat(e))})}).then(()=>t.close()).catch(e=>{var t;this.log("Could not close session: ".concat(e)),null==(t=this.hls)||t.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: ".concat(e))})})}}}aw.CDMCleanupPromise=void 0;class ow extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function cw(e,t){let i;try{i=new Event("addtrack")}catch(U){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function lw(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: ".concat(t))}catch(U){Gg.debug("[texttrack-utils]: ".concat(U));try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(r){Gg.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(r))}}"disabled"===i&&(e.mode=i)}function dw(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues)for(let r=e.cues.length;r--;)t&&e.cues[r].removeEventListener("enter",t),e.removeCue(e.cues[r]);"disabled"===i&&(e.mode=i)}function hw(e,t,i,r){const n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0){const n=function(e,t,i){const r=[],n=function(e,t){if(t<=e[0].startTime)return 0;const i=e.length-1;if(t>e[i].endTime)return-1;let r,n=0,s=i;for(;n<=s;)if(r=Math.floor((s+n)/2),te[r].startTime&&n-1)for(let s=n,a=e.length;s=t&&n.endTime<=i)r.push(n);else if(n.startTime>i)return r}return r}(e.cues,t,i);for(let t=0;t>>0).toString()}const gw=.025;let fw=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function mw(e,t,i){return"".concat(e.identifier,"-").concat(i+1,"-").concat(pw(t))}class vw{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;if(e<=0||isNaN(i))return!1;if(0===i)return!0;return((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return bw(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime;return t-bw(t,e)<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=yg(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return bw(e,t)}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||null!==this.assetListResponse}toString(){return'["'.concat((e=this).identifier,'" ').concat(e.cue.pre?"
":e.cue.post?"":"").concat(e.timelineStart.toFixed(2),"-").concat(e.resumeTime.toFixed(2),"]");var e}}function bw(e,t){return e-t.start{this.reachedPlayout(this.currentTime)&&this.hls.trigger(Tg.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=i,this.assetItem=r;let s=r.uri;try{s=kw(s,t.primarySessionId).href}catch(o){}n.loadSource(s);const a=()=>{this.hasDetails=!0};n.once(Tg.LEVEL_LOADED,a),n.once(Tg.AUDIO_TRACK_LOADED,a),n.once(Tg.SUBTITLE_TRACK_LOADED,a),n.on(Tg.MEDIA_ATTACHING,(e,t)=>{let{media:i}=t;this.removeMediaListeners(),this.mediaAttached=i;this.interstitial.playoutLimit&&(i.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(Tg.BUFFER_APPENDED,()=>{const e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,n.trigger(Tg.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return(null==(e=this.interstitial)?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,r=cv.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=cv.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var e;this.mediaAttached&&(null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){this.hls.on(e,t)}once(e,t,i){this.hls.once(e,t)}off(e,t,i){this.hls.off(e,t)}toString(){var e;return"HlsAssetPlayer: ".concat(ww(this.assetItem)," ").concat(null==(e=this.hls)?void 0:e.sessionId," ").concat(this.appendInPlace?"append-in-place":"")}}class xw extends jg{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(n=r[i])&&n.event;){var n;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let r=0;rn.start&&e1)for(let n=0;ni&&t!a.includes(e.identifier)):[];s.length&&s.sort((e,t)=>{const i=e.cue.pre,r=e.cue.post,n=t.cue.pre,s=t.cue.post;if(i&&!n)return-1;if(n&&!i)return 1;if(r&&!s)return 1;if(s&&!r)return-1;if(!i&&!n&&!r&&!s){const i=e.startTime,r=t.startTime;if(i!==r)return i-r}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=s,o.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,o)}updateSchedule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const i=this.events||[];if(i.length||t.length||this.length<2){const r=this.items,n=this.parseSchedule(i,e);(t.length||(null==r?void 0:r.length)!==n.length||n.some((e,t)=>Math.abs(e.playout.start-r[t].playout.start)>.005||Math.abs(e.playout.end-r[t].playout.end)>.005))&&(this.items=n,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const r=[],n=Object.keys(e);for(let s=0;s!e.error&&!(e.cue.once&&e.hasPlayed))).length){this.resolveOffsets(e,t);let r=0,o=0;if(e.forEach((t,a)=>{const c=t.cue.pre,l=t.cue.post,d=e[a-1]||null,h=t.appendInPlace,u=l?n:t.startOffset,p=t.duration,g=t.timelineOccupancy===fw.Range?p:0,f=t.resumptionOffset,m=(null==d?void 0:d.startTime)===u,v=u+t.cumulativeDuration;let b=h?v+p:u+f;if(c||!l&&u<=0){const e=o;o+=g,t.timelineStart=v;const r=s;s+=p,i.push({event:t,start:v,end:b,playout:{start:r,end:s},integrated:{start:e,end:o}})}else{if(!(u<=n))return;{if(!m){const n=u-r;if(n>.033){const c=r,l=o;o+=n;const d=s;s+=n;const h={previousEvent:e[a-1]||null,nextEvent:t,start:c,end:c+n,playout:{start:d,end:s},integrated:{start:l,end:o}};i.push(h)}else n>0&&d&&(d.cumulativeDuration+=n,i[i.length-1].end=u)}l&&(b=v),t.timelineStart=v;const n=o;o+=g;const c=s;s+=p,i.push({event:t,start:v,end:b,playout:{start:c,end:s},integrated:{start:n,end:o}})}}const k=t.resumeTime;r=l||k>n?n:k}),r{const c=a.cue.pre,l=a.cue.post,d=c?0:l?r:a.startTime;this.updateAssetDurations(a);if(s===d?a.cumulativeDuration=n:(n=0,s=d),!l&&a.snapOptions.in&&(a.resumeAnchor=xm(null,i.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)}if(!a.appendInPlace&&o+1gw)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," not aligned with estimated timeline end ").concat(r)),!1;if(!t)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," can not be aligned with media (none selected)")),!1;return!Object.keys(t).some(r=>{const n=t[r].details,s=n.edge;if(i>=s)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," past ").concat(r," playlist end ").concat(s)),!1;const a=xm(null,n.fragments,i);if(!a)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," does not align with any fragments in ").concat(r," playlist (").concat(n.fragStart,"-").concat(n.fragmentEnd,")")),!0;const o="audio"===r?.175:0;return!(Math.abs(a.start-i){const a=t+i;e.startOffset=i,e.timelineStart=a,r||(r=null===e.duration),n||(n=!!e.error);const o=e.error?0:e.duration||0;i+=o}),e.duration=r&&!n?Math.max(i,e.duration):i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Ew(e){return"[".concat(e.event?'"'+e.event.identifier+'"':"primary",": ").concat(e.start.toFixed(2),"-").concat(e.end.toFixed(2),"]")}class Tw{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let r;try{r=kw(i,this.hls.sessionId,e.baseUrl)}catch(d){const t=this.assignAssetListError(e,Eg.ASSET_LIST_LOAD_ERROR,d,i);return void this.hls.trigger(Tg.ERROR,t)}t&&"data:"!==r.protocol&&r.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,s=new(0,n.loader)(n),a={responseType:"json",url:r.href},o=n.interstitialAssetListLoadPolicy.default,c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},l={onSuccess:(t,i,r,n)=>{const s=t.data,a=null==s?void 0:s.ASSETS;if(!Array.isArray(a)){const t=this.assignAssetListError(e,Eg.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),r.url,i,n);return void this.hls.trigger(Tg.ERROR,t)}e.assetListResponse=s,this.hls.trigger(Tg.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:n})},onError:(t,i,r,n)=>{const s=this.assignAssetListError(e,Eg.ASSET_LIST_LOAD_ERROR,new Error("Error loading X-ASSET-LIST: HTTP status ".concat(t.code," ").concat(t.text," (").concat(i.url,")")),i.url,n,r);this.hls.trigger(Tg.ERROR,s)},onTimeout:(t,i,r)=>{const n=this.assignAssetListError(e,Eg.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST (".concat(i.url,")")),i.url,t,r);this.hls.trigger(Tg.ERROR,n)}};return s.load(a,c,l),this.hls.trigger(Tg.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,i,r,n,s){return e.error=i,{type:xg.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:s,stats:n}}}function _w(e){null==e||e.play().catch(()=>{})}class Pw{constructor(e){this.buffered=void 0;const t=(t,i,r)=>{if((i>>>=0)>r-1)throw new DOMException("Failed to execute '".concat(t,"' on 'TimeRanges': The index provided (").concat(i,") is greater than the maximum bound (").concat(r,")"));return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}const Cw={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Aw=e=>String.fromCharCode(Cw[e]||e),Rw=15,Lw=100,Iw={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Mw={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Dw={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Ow={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Nw=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Uw{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"===typeof t?t():t;Gg.log("".concat(this.time," [").concat(e,"] ").concat(i))}}}const Fw=function(e){const t=[];for(let i=0;iLw&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Lw)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i=144&&this.backSpace();const t=Aw(e);this.pos>=Lw?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+pm(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+pm(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class Hw{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new zw(i),this.nonDisplayedMemory=new zw(i),this.lastOutputScreen=new zw(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;it+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+pm(t)),this.writeScreen.setPen(t)}outputDataUpdate(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class $w{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const r=this.logger=new Uw;this.channels=[null,new Hw(e,t,r),new Hw(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i"["+Fw([t[i],t[i+1]])+"] -> ("+Fw([e,r])+")");const a=this.cmdHistory;if(e>=16&&e<=31){if(Ww(e,r,a)){Gw(null,null,a),this.logger.log(3,()=>"Repeated command ("+Fw([e,r])+") is dropped");continue}Gw(e,r,this.cmdHistory),n=this.parseCmd(e,r),n||(n=this.parseMidrow(e,r)),n||(n=this.parsePAC(e,r)),n||(n=this.parseBackgroundAttributes(e,r))}else Gw(null,null,a);if(!n&&(s=this.parseChars(e,r),s)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}n||s||this.logger.log(2,()=>"Couldn't parse cleaned data "+Fw([e,r])+" orig: "+Fw([t[i],t[i+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,r=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Fw([e,t])+")"),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const r=e<=23?1:2;i=t>=64&&t<=95?1===r?Iw[e]:Dw[e]:1===r?Mw[e]:Ow[e];const n=this.channels[r];return!!n&&(n.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!0)}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,r.underline=1===(1&i),i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let e;e=17===n?t+80:18===n?t+112:t+144,this.logger.log(2,()=>"Special char '"+Aw(e)+"' in channel "+i),r=[e]}else e>=32&&e<=127&&(r=0===t?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes =  "+Fw(r).join(",")),r}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const r={};16===e||24===e?(i=Math.floor((t-32)/2),r.background=Nw[i],t%2===1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0));const n=e<=23?1:2;return this.channels[n].setBkgData(r),!0}reset(){for(let e=0;e1?t-1:0),r=1;r100)throw new Error("Position must be between 0 and 100.");k=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},c,{get:function(){return y},set:function(e){const t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},c,{get:function(){return w},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");w=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},c,{get:function(){return S},set:function(e){const t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class Kw{decode(e,t){if(!e)return"";if("string"!==typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Zw(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(r||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class Yw{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r=0&&i<=100)return this.set(e,i),!0}return!1}}function Jw(e,t,i,r){const n=r?e.split(r):[e];for(const s in n){if("string"!==typeof n[s])continue;const e=n[s].split(i);if(2!==e.length)continue;t(e[0],e[1])}}const Qw=new qw(0,0,""),Xw="middle"===Qw.align?"middle":"center";function eS(e,t,i){const r=e;function n(){const t=Zw(e);if(null===t)throw new Error("Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=n(),s(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.slice(3),s(),t.endTime=n(),s(),function(e,t){const r=new Yw;Jw(e,function(e,t){let n;switch(e){case"region":for(let n=i.length-1;n>=0;n--)if(i[n].id===t){r.set(e,i[n].region);break}break;case"vertical":r.alt(e,t,["rl","lr"]);break;case"line":n=t.split(","),r.integer(e,n[0]),r.percent(e,n[0])&&r.set("snapToLines",!1),r.alt(e,n[0],["auto"]),2===n.length&&r.alt("lineAlign",n[1],["start",Xw,"end"]);break;case"position":n=t.split(","),r.percent(e,n[0]),2===n.length&&r.alt("positionAlign",n[1],["start",Xw,"end","line-left","line-right","auto"]);break;case"size":r.percent(e,t);break;case"align":r.alt(e,t,["start",Xw,"end","left","right"])}},/:/,/\s/),t.region=r.get("region",null),t.vertical=r.get("vertical","");let n=r.get("line","auto");"auto"===n&&-1===Qw.line&&(n=-1),t.line=n,t.lineAlign=r.get("lineAlign","start"),t.snapToLines=r.get("snapToLines",!0),t.size=r.get("size",100),t.align=r.get("align",Xw);let s=r.get("position","auto");"auto"===s&&50===Qw.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function tS(e){return e.replace(//gi,"\n")}class iS{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Kw,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=tS(e);i2&&void 0!==arguments[2]?arguments[2]:0;return e.slice(i,i+t.length)===t};function sS(e,t,i){return pw(e.toString())+pw(t.toString())+pw(i)}function aS(e,t,i,r,n,s,a){const o=new iS,c=Kg(new Uint8Array(e)).trim().replace(rS,"\n").split("\n"),l=[],d=t?function(e){return Kk(e,9e4,1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1))}(t.baseTime,t.timescale):0;let h,u="00:00.000",p=0,g=0,f=!0;o.oncue=function(e){const s=i[r];let a=i.ccOffset;const o=(p-d)/9e4;if(null!=s&&s.new&&(void 0!==g?a=i.ccOffset=s.start:function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,void(r.new=!1);for(;null!=(s=n)&&s.new;){var s;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i}(i,r,o)),o){if(!t)return void(h=new Error("Missing initPTS for VTT MPEGTS"));a=o-i.presentationOffset}const c=e.endTime-e.startTime,u=ty(9e4*(e.startTime+a-g),9e4*n)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+c,0);const f=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(f)),e.id||(e.id=sS(e.startTime,e.endTime,f)),e.endTime>0&&l.push(e)},o.onparsingerror=function(e){h=e},o.onflush=function(){h?a(h):s(l)},c.forEach(e=>{if(f){if(nS(e,"X-TIMESTAMP-MAP=")){f=!1,e.slice(16).split(",").forEach(e=>{nS(e,"LOCAL:")?u=e.slice(6):nS(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))});try{g=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!yg(t)||!yg(i)||!yg(r)||!yg(n))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*i,t+=6e4*r,t+=36e5*n,t}(u)/1e3}catch(t){h=t}return}""===e&&(f=!1)}o.parse(e+"\n")}),o.flush()}const oS="stpp.ttml.im1t",cS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lS=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,dS={left:"start",center:"center",right:"end",start:"start",end:"end"};function hS(e,t,i,r){const n=bf(new Uint8Array(e),["mdat"]);if(0===n.length)return void r(new Error("Could not parse IMSC1 mdat"));const s=n.map(e=>Kg(e)),a=function(e,t){return Kk(e,t,1/(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1),arguments.length>3&&void 0!==arguments[3]&&arguments[3])}(t.baseTime,1,t.timescale);try{s.forEach(e=>i(function(e,t){const i=(new DOMParser).parseFromString(e,"text/xml"),r=i.getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(n).reduce((e,t)=>(e[t]=r.getAttribute("ttp:".concat(t))||n[t],e),{}),a="preserve"!==r.getAttribute("xml:space"),o=pS(uS(r,"styling","style")),c=pS(uS(r,"layout","region")),l=uS(r,"body","[begin]");return[].map.call(l,e=>{const i=gS(e,a);if(!i||!e.hasAttribute("begin"))return null;const r=vS(e.getAttribute("begin"),s),n=vS(e.getAttribute("dur"),s);let l=vS(e.getAttribute("end"),s);if(null===r)throw mS(e);if(null===l){if(null===n)throw mS(e);l=r+n}const d=new qw(r-t,l-t,i);d.id=sS(d.startTime,d.endTime,d.text);const h=function(e,t,i){const r="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(n=i[a]);return s.reduce((i,s)=>{const a=fS(t,r,s)||fS(e,r,s)||fS(n,r,s);return a&&(i[s]=a),i},{})}(c[e.getAttribute("region")],o[e.getAttribute("style")],o),{textAlign:u}=h;if(u){const e=dS[u];e&&(d.lineAlign=e),d.align=u}return Ng(d,h),d}).filter(e=>null!==e)}(e,a)))}catch(o){r(o)}}function uS(e,t,i){const r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(i)):[]}function pS(e){return e.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function gS(e,t){return[].slice.call(e.childNodes).reduce((e,i,r)=>{var n;return"br"===i.nodeName&&r?e+"\n":null!=(n=i.childNodes)&&n.length?gS(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent},"")}function fS(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function mS(e){return new Error("Could not parse ttml timestamp ".concat(e))}function vS(e,t){if(!e)return null;let i=Zw(e);return null===i&&(cS.test(e)?i=function(e,t){const i=cS.exec(e),r=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+r/t.frameRate}(e,t):lS.test(e)&&(i=function(e,t){const i=lS.exec(e),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/t.frameRate;case"t":return r/t.tickRate}return r}(e,t))),i}class bS{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function kS(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function yS(e,t){return!!e&&e.kind===kS(t)&&vy(t,e)}function wS(e,t,i,r){return Math.min(t,r)-Math.max(e,i)}const SS=/\s/,xS={newCue(e,t,i,r){const n=[];let s,a,o,c,l;const d=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?c--:c++;const r=tS(l.trim()),p=sS(t,i,r);null!=e&&null!=(h=e.cues)&&h.getCueById(p)||(a=new d(t,i,r),a.id=p,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*c/32)),n.push(a))}return e&&n.length&&(n.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),n.forEach(t=>lw(e,t))),n}};const ES=/(\d+)-(\d+)\/(\d+)/;class TS{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||_S,this.controller=new self.AbortController,this.stats=new ef}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Ng({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),s="arraybuffer"===e.responseType,a=s?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=o&&yg(o)?o:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout);(ly(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(i=>{var n;this.response=this.loader=i;const a=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},c-(a-r.loading.start)),!i.ok){const{status:e,statusText:t}=i;throw new PS(t||"fetch, bad network response",e,i)}r.loading.first=a,r.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=ES.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(yg(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(i.headers)||r.total;const o=null==(n=this.callbacks)?void 0:n.onProgress;return o&&yg(t.highWaterMark)?this.loadProgressively(i,r,e,t.highWaterMark,o):s?i.arrayBuffer():"json"===e.responseType?i.json():i.text()}).then(i=>{var n,s;const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const c=i[a];c&&(r.loaded=r.total=c);const l={url:o.url,data:i,code:o.status},d=null==(n=this.callbacks)?void 0:n.onProgress;d&&!yg(t.highWaterMark)&&d(r,e,i,o),null==(s=this.callbacks)||s.onSuccess(l,r,e,o)}).catch(t=>{var i;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const n=t&&t.code||0,s=t?t.message:null;null==(i=this.callbacks)||i.onError({code:n,text:s},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0;const s=new jb,a=e.body.getReader(),o=()=>a.read().then(a=>{if(a.done)return s.dataLength&&n(t,i,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const c=a.value,l=c.length;return t.loaded+=l,l=r&&n(t,i,s.flush().buffer,e)):n(t,i,c.buffer,e),o()}).catch(()=>Promise.reject());return o()}}function _S(e,t){return new self.Request(e.url,t)}class PS extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const CS=/^age:\s*[\d.]+\s*$/im;class AS{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new ef,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(this.loader===i&&!this.stats.aborted)return n(i,t.url)}).catch(e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(e=>{var n;null==(n=this.callbacks)||n.onError({code:i.status,text:e.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:s}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&yg(n)?n:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===r)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const r=t.status,c="text"===t.responseType?t.responseText:null;if(r>=200&&r<300){const n=null!=c?c:t.response;if(null!=n){var s,a;i.loading.end=Math.max(self.performance.now(),i.loading.first);const o="arraybuffer"===t.responseType?n.byteLength:n.length;i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);const c=null==(s=this.callbacks)?void 0:s.onProgress;c&&c(i,e,n,t);const l={url:t.responseURL,data:n,code:r};return void(null==(a=this.callbacks)||a.onSuccess(l,i,e,t))}}const l=n.loadPolicy.errorRetry;var o;if(Lm(l,i.retry,!1,{url:e.url,data:void 0,code:r}))this.retry(l);else Gg.error("".concat(r," while loading ").concat(e.url)),null==(o=this.callbacks)||o.onError({code:r,text:t.statusText},e,t,i)}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(Lm(e,this.stats.retry,!0))this.retry(e);else{var t;Gg.warn("timeout while loading ".concat(null==(t=this.context)?void 0:t.url));const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Am(e,i.retry),i.retry++,Gg.warn("".concat(status?"HTTP Status "+status:"Timeout"," while loading ").concat(null==t?void 0:t.url,", retrying ").concat(i.retry,"/").concat(e.maxNumRetry," in ").concat(this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&CS.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp("^".concat(e,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const RS=Fg(Fg({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:AS,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends jg{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;const{fragCurrent:i,partCurrent:r,hls:n}=this,{autoLevelEnabled:s,media:a}=n;if(!i||!a)return;const o=performance.now(),c=r?r.stats:i.stats,l=r?r.duration:i.duration,d=o-c.loading.start,h=n.minAutoLevel,u=i.level,p=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||u<=h)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s)return;const g=p>-1&&p!==u,f=!!e||g;if(!f&&(a.paused||!a.playbackRate||!a.readyState))return;const m=n.mainForwardBufferInfo;if(!f&&null===m)return;const v=this.bwEstimator.getEstimateTTFB(),b=Math.abs(a.playbackRate);if(d<=Math.max(v,l/(2*b)*1e3))return;const k=m?m.len/b:0,y=c.loading.first?c.loading.first-c.loading.start:-1,w=c.loaded&&y>-1,S=this.getBwEstimate(),x=n.levels,E=x[u],T=Math.max(c.loaded,Math.round(l*(i.bitrate||E.averageBitrate)/8));let _=w?d-y:d;_<1&&w&&(_=Math.min(d,8*c.loaded/S));const P=w?1e3*c.loaded/_:0,C=v/1e3,A=P?(T-c.loaded)/P:8*T/S+C;if(A<=k)return;const R=P?8*P:S,L=!0===(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live),I=this.hls.config.abrBandWidthUpFactor;let M,D=Number.POSITIVE_INFINITY;for(M=u-1;M>h;M--){const e=x[M].maxBitrate,t=!x[M].details||L;if(D=this.getTimeToLoadFrag(C,R,l*e,t),D=A)return;if(D>10*l)return;w?this.bwEstimator.sample(d-Math.min(v,y),c.loaded):this.bwEstimator.sampleTTFB(d);const O=x[M].maxBitrate;this.getBwEstimate()*I>O&&this.resetEstimator(O);const N=this.findBestLevel(O,h,M,0,k,1,1);N>-1&&(M=N),this.warn("Fragment ".concat(i.sn).concat(r?" part "+r.index:""," of level ").concat(u," is loading too slowly;\n      Fragment duration: ").concat(i.duration.toFixed(3),"\n      Time to underbuffer: ").concat(k.toFixed(3)," s\n      Estimated load time for current fragment: ").concat(A.toFixed(3)," s\n      Estimated load time for down switch fragment: ").concat(D.toFixed(3)," s\n      TTFB estimate: ").concat(0|y," ms\n      Current BW estimate: ").concat(yg(S)?0|S:"Unknown"," bps\n      New BW estimate: ").concat(0|this.getBwEstimate()," bps\n      Switching to level ").concat(M," @ ").concat(0|O," bps")),n.nextLoadLevel=n.nextAutoLevel=M,this.clearTimer();const U=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===M&&M>0){const e=this.getStarvationDelay();if(this.warn("Aborting inflight request ".concat(M>0?"and switching down":"","\n      Fragment duration: ").concat(i.duration.toFixed(3)," s\n      Time to underbuffer: ").concat(e.toFixed(3)," s")),i.abortRequests(),this.fragCurrent=this.partCurrent=null,M>h){let t=this.findBestLevel(this.hls.levels[h].bitrate,h,M,0,e,1,1);-1===t&&(t=h),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};g||A>2*D?U():this.timer=self.setInterval(U,1e3*D),n.trigger(Tg.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:c})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log("setting initial bwe to ".concat(e)),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Dg(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.FRAG_LOADING,this.onFragLoading,this),e.on(Tg.FRAG_LOADED,this.onFragLoaded,this),e.on(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tg.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.FRAG_LOADING,this.onFragLoading,this),e.off(Tg.FRAG_LOADED,this.onFragLoaded,this),e.off(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tg.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Tg.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var r;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Eg.BUFFER_ADD_CODEC_ERROR:case Eg.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Eg.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:r}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=r?r.stats:e.stats,n=t-i.loading.start,s=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&s>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(n-Math.min(e,s),i.loaded)}else this.bwEstimator.sampleTTFB(n)}break}}}getTimeToLoadFrag(e,t,i,r){return e+i/t+(r?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;yg(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,t){let{frag:i,part:r}=t;const n=r?r.stats:i.stats;if(i.type===Rg&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),i.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=r?r.duration:i.duration,t=this.hls.levels[i.level],s=(t.loaded?t.loaded.bytes:0)+n.loaded,a=(t.loaded?t.loaded.duration:0)+e;t.loaded={bytes:s,duration:a},t.realBitrate=Math.round(8*s/a)}if(i.bitrateTest){const e={stats:n,frag:i,part:r,id:i.type};this.onFragBuffered(Tg.FRAG_BUFFERED,e),i.bitrateTest=!1}else this.lastLoadedFragLevel=i.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=null!=r&&r.stats.loaded?r.stats:i.stats;if(n.aborted)return;if(this.ignoreFragment(i))return;const s=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Rg||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const s=this.hls.firstLevel,a=Math.min(Math.max(s,t),e);return this.warn("Could not find best starting auto level. Defaulting to first in playlist ".concat(s," clamped to ").concat(a)),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(-1!==e&&(!t||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return"".concat(this.getBwEstimate(),"_").concat(this.getStarvationDelay().toFixed(2))}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:r,config:n,minAutoLevel:s}=i,a=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),c=this.getStarvationDelay();let l=n.abrBandWidthFactor,d=n.abrBandWidthUpFactor;if(c){const e=this.findBestLevel(o,s,r,c,0,l,d);if(e>=0)return this.rebufferNotice=-1,e}let h=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!c){const e=this.bitrateTestDelay;if(e){h=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-e,this.info("bitrate test took ".concat(Math.round(1e3*e),"ms, set first fragment max fetchDuration to ").concat(Math.round(1e3*h)," ms")),l=d=1}}const u=this.findBestLevel(o,s,r,c,h,l,d);if(this.rebufferNotice!==u&&(this.rebufferNotice=u,this.info("".concat(c?"rebuffering expected":"buffer is empty",", optimal quality level ").concat(u))),u>-1)return u;const p=i.levels[s],g=i.loadLevelObj;return g&&(null==p?void 0:p.bitrate){if(!i.codecSet)return e;const n=i.audioGroups;let s=e[i.codecSet];s||(e[i.codecSet]=s={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),s.minBitrate=Math.min(s.minBitrate,i.bitrate);const a=Math.min(i.height,i.width);return s.minHeight=Math.min(s.minHeight,a),s.minFramerate=Math.min(s.minFramerate,i.frameRate),s.minIndex=Math.min(s.minIndex,r),s.maxScore=Math.max(s.maxScore,i.score),s.fragmentError+=i.fragmentError,s.videoRanges[i.videoRange]=(s.videoRanges[i.videoRange]||0)+1,n&&n.forEach(e=>{if(!e)return;const i=t.groups[e];i&&(s.hasDefaultAudio=s.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach(e=>{s.channels[e]=(s.channels[e]||0)+i.channels[e]}))}),e},{})}(p,T,t,i)),n=function(e,t,i,r,n){const s=Object.keys(e),a=null==r?void 0:r.channels,o=null==r?void 0:r.audioCodec,c=null==n?void 0:n.videoCodec,l=a&&2===parseInt(a);let d=!1,h=!1,u=1/0,p=1/0,g=1/0,f=1/0,m=0,v=[];const{preferHDR:b,allowedVideoRanges:k}=um(t,n);for(let x=s.length;x--;){const t=e[s[x]];d||(d=t.channels[2]>0),u=Math.min(u,t.minHeight),p=Math.min(p,t.minFramerate),g=Math.min(g,t.minBitrate),k.filter(e=>t.videoRanges[e]>0).length>0&&(h=!0)}u=yg(u)?u:0,p=yg(p)?p:0;const y=Math.max(1080,u),w=Math.max(30,p);g=yg(g)?g:i,i=Math.max(g,i),h||(t=void 0);const S=s.length>1;return{codecSet:s.reduce((t,r)=>{const n=e[r];if(r===t)return t;if(v=h?k.filter(e=>n.videoRanges[e]>0):[],S){if(n.minBitrate>i)return gm(r,"min bitrate of ".concat(n.minBitrate," > current estimate of ").concat(i)),t;if(!n.hasDefaultAudio)return gm(r,"no renditions with default or auto-select sound found"),t;if(o&&r.indexOf(o.substring(0,4))%5!==0)return gm(r,'audio codec preference "'.concat(o,'" not found')),t;if(a&&!l){if(!n.channels[a])return gm(r,"no renditions with ".concat(a," channel sound found (channels options: ").concat(Object.keys(n.channels),")")),t}else if((!o||l)&&d&&0===n.channels[2])return gm(r,"no renditions with stereo sound found"),t;if(n.minHeight>y)return gm(r,"min resolution of ".concat(n.minHeight," > maximum of ").concat(y)),t;if(n.minFramerate>w)return gm(r,"min framerate of ".concat(n.minFramerate," > maximum of ").concat(w)),t;if(!v.some(e=>n.videoRanges[e]>0))return gm(r,"no variants with VIDEO-RANGE of ".concat(pm(v)," found")),t;if(c&&r.indexOf(c.substring(0,4))%5!==0)return gm(r,'video codec preference "'.concat(c,'" not found')),t;if(n.maxScore=zf(t)||n.fragmentError>e[t].fragmentError)?t:(f=n.minIndex,m=n.maxScore,r)},void 0),videoRanges:v,preferHDR:b,minFramerate:p,minBitrate:g,minIndex:f}}(r,w,e,x,E),{codecSet:s,videoRanges:a,minFramerate:o,minBitrate:c,minIndex:l,preferHDR:d}=n;_=l,y=s,w=d?a[a.length-1]:a[0],S=o,e=Math.max(e,c),this.log("picked start tier ".concat(pm(n)))}else y=null==v?void 0:v.codecSet,w=null==v?void 0:v.videoRange;const P=u?u.duration:h?h.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,A=[];for(let I=i;I>=t;I--){var R,L;const t=p[I],o=I>d;if(!t)continue;if(m.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"===typeof(null==i?void 0:i.decodingInfo)&&Xf(t,T,w,S,e,x)?(t.supportedPromise=em(t,T,i,this.supportedCache),t.supportedPromise.then(e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,r=i.indexOf(t);e.error?this.warn('MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ').concat(r," ").concat(pm(e))):e.supported?e.decodingInfoResults.some(e=>!1===e.smooth||!1===e.powerEfficient)&&this.log("MediaCapabilities decodingInfo for level ".concat(r," not smooth or powerEfficient: ").concat(pm(e))):(this.warn("Unsupported MediaCapabilities decodingInfo result for level ".concat(r," ").concat(pm(e))),r>-1&&i.length>1&&(this.log("Removing unsupported level ".concat(r)),this.hls.removeLevel(r),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))})):t.supportedResult=Jf}if((y&&t.codecSet!==y||w&&t.videoRange!==w||o&&S>t.frameRate||!o&&S>0&&S!1===e.smooth))&&(!k||I!==_)){A.push(I);continue}const h=t.details,g=(u?null==h?void 0:h.partTarget:null==h?void 0:h.averagetargetduration)||P;let v;v=o?a*e:s*e;const E=P&&r>=2*P&&0===n?t.averageBitrate:t.maxBitrate,M=this.getTimeToLoadFrag(C,v,E*g,void 0===h);if(v>=E&&(I===l||0===t.loadError&&0===t.fragmentError)&&(M<=C||!yg(M)||b&&!this.bitrateTestDelay||M").concat(I," adjustedbw(").concat(Math.round(v),")-bitrate=").concat(Math.round(v-E)," ttfb:").concat(C.toFixed(1)," avgDuration:").concat(g.toFixed(1)," maxFetchDuration:").concat(c.toFixed(1)," fetchDuration:").concat(M.toFixed(1)," firstSelection:").concat(k," codecSet:").concat(t.codecSet," videoRange:").concat(t.videoRange," hls.loadLevel:").concat(f))),k&&(this.firstSelection=I),I}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}},bufferController:class extends jg{constructor(e,t){var i;super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{var t;this.hls&&"open"===(null==(t=this.mediaSource)?void 0:t.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{const{media:t,mediaSource:i}=this;e&&this.log("Media source opened"),t&&i&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(Tg.MEDIA_ATTACHED,{media:t,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error("Media element src was set while attaching MediaSource (".concat(t," > ").concat(e,")"))},this.hls=e,this.fragmentTracker=t,this.appendSource=(i=Wg(e.config.preferManagedMediaSource),"undefined"!==typeof self&&i===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.BUFFER_RESET,this.onBufferReset,this),e.on(Tg.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Tg.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Tg.BUFFER_EOS,this.onBufferEos,this),e.on(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Tg.FRAG_PARSED,this.onFragParsed,this),e.on(Tg.FRAG_CHANGED,this.onFragChanged,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.BUFFER_RESET,this.onBufferReset,this),e.off(Tg.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Tg.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Tg.BUFFER_EOS,this.onBufferEos,this),e.off(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Tg.FRAG_PARSED,this.onFragParsed,this),e.off(Tg.FRAG_CHANGED,this.onFragChanged,this),e.off(Tg.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const e=this.isUpdating();e||this.operationQueue.removeBlockers();const t=this.isQueued();(e||t)&&this.warn("Transfering MediaSource with".concat(t?" operations in queue":"").concat(e?" updating SourceBuffer(s)":""," ").concat(this.operationQueue)),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?Ng(i,r.tracks):this.sourceBuffers.forEach(e=>{const[t]=e;t&&(i[t]=Ng({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log("".concat(r," bufferCodec event(s) expected.")),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media,r=Wg(this.appendSource);if(this.transferData=this.overrides=void 0,i&&r){const e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const s=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(s),e)this._objectUrl=i.src,this.attachTransferred();else{const e=this._objectUrl=self.URL.createObjectURL(s);if(this.appendSource)try{i.removeAttribute("src");const t=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||t&&s instanceof t,Sy(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,e),i.load()}catch(n){i.src=e}else i.src=e}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log("".concat((null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"," media source: ").concat(null==(i=e.constructor)?void 0:i.name)),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,r=t.tracks,n=r?Object.keys(r):null,s=n?n.length:0,a=()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()};if(r&&n&&s){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log("attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ").concat(pm(i,(e,t)=>"initSegment"===e?void 0:t),";\ntransfer tracks: ").concat(pm(r,(e,t)=>"initSegment"===e?void 0:t),"}")),!qg(r,i)){t.mediaSource=null,t.tracks=void 0;const n=e.currentTime,s=this.details,a=Math.max(n,(null==s?void 0:s.fragments[0].start)||0);return a-n>1?void this.log("attachTransferred: waiting for playback to reach new tracks start time ".concat(n," -> ").concat(a)):(this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(Object.keys(r),'"->"').concat(Object.keys(i),'") start time: ').concat(a," currentTime: ").concat(n)),this.onMediaDetaching(Tg.MEDIA_DETACHING,{}),this.onMediaAttaching(Tg.MEDIA_ATTACHING,t),void(e.currentTime=a))}this.transferData=void 0,n.forEach(e=>{const t=e,i=r[t];if(i){const e=i.buffer;if(e){const r=this.fragmentTracker,n=i.id;if(r.hasFragments(n)||r.hasParts(n)){const i=cv.getBuffered(e);r.detectEvictedFragments(t,i,n,null,!0)}const s=xy(t),a=[t,e];this.sourceBuffers[s]=a,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,i)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:n,_objectUrl:s}=this;if(n){if(this.log("media source ".concat(i?"transferring":"detaching")),i)this.sourceBuffers.forEach(e=>{let[t]=e;t&&this.removeBuffer(t)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const e="open"===n.readyState;try{const t=n.sourceBuffers;for(let i=t.length;i--;)e&&t[i].abort(),n.removeSourceBuffer(t[i]);e&&n.endOfStream()}catch(U){this.warn("onMediaDetaching: ".concat(U.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),i||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(r.removeAttribute("src"),this.appendSource&&Sy(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(Tg.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(e=>{let[t]=e;t&&this.resetBuffer(t)}),this.initTracks()}resetBuffer(e){var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),i)try{var r;null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(U){this.warn("onBufferReset ".concat(e),U)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[xy(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new by(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,r=Object.keys(t);this.log('BUFFER_CODECS: "'.concat(r,'" (current SB count ').concat(this.sourceBufferCount,")"));const n="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),s=!n&&this.sourceBufferCount&&this.media&&r.some(e=>!i[e]);n||s?this.warn('Unsupported transition between "'.concat(Object.keys(i),'" and "').concat(r,'" SourceBuffers')):(r.forEach(e=>{var r,n,s;const a=t[e],{id:o,codec:c,levelCodec:l,container:d,metadata:h,supplemental:u}=a;let p=i[e];const g=null==(r=this.transferData)||null==(n=r.tracks)?void 0:n[e],f=null!=g&&g.buffer?g:p,m=(null==f?void 0:f.pendingCodec)||(null==f?void 0:f.codec),v=null==f?void 0:f.levelCodec;p||(p=i[e]={buffer:void 0,listeners:[],codec:c,supplemental:u,container:d,levelCodec:l,metadata:h,id:o});const b=Wf(m,v),k=null==b?void 0:b.replace(ky,"$1");let y=Wf(c,l);const w=null==(s=y)?void 0:s.replace(ky,"$1");y&&b&&k!==w&&("audio"===e.slice(0,5)&&(y=Gf(y,this.appendSource)),this.log("switching codec ".concat(m," to ").concat(y)),y!==(p.pendingCodec||p.codec)&&(p.pendingCodec=y),p.container=d,this.appendChangeType(e,d,y))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const r="".concat(t,";codecs=").concat(i),n={label:"change-type=".concat(r),execute:()=>{const n=this.tracks[e];if(n){const s=n.buffer;null!=s&&s.changeType&&(this.log("changing ".concat(e," sourceBuffer type to ").concat(r)),s.changeType(r),n.codec=i,n.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn("Failed to change ".concat(e," SourceBuffer type"),t)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,r=i+.05*e.duration;if(!0===(null==(t=this.fragmentTracker.getAppendedFrag(i,Rg))?void 0:t.gap))return;const n={label:"block-audio",execute:()=>{var e;const t=this.tracks.video;(this.lastVideoAppendEnd>r||null!=t&&t.buffer&&cv.isBuffered(t.buffer,r)||!0===(null==(e=this.fragmentTracker.getAppendedFrag(r,Rg))?void 0:e.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:n,frag:e},this.append(n,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:r,type:n,parent:s,frag:a,part:o,chunkMeta:c,offset:l}=t,d=c.buffering[n],{sn:h,cc:u}=a,p=self.performance.now();d.start=p;const g=a.stats.buffering,f=o?o.stats.buffering:null;0===g.start&&(g.start=p),f&&0===f.start&&(f.start=p);const m=i.audio;let v=!1;"audio"===n&&"audio/mpeg"===(null==m?void 0:m.container)&&(v=!this.lastMpegAudioChunk||1===c.id||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const b=i.video,k=null==b?void 0:b.buffer;if(k&&"initSegment"!==h){const e=o||a,t=this.blockedAudioAppend;if("audio"!==n||"main"===s||this.blockedAudioAppend){if("video"===n){const i=e.end;if(t){const e=t.frag.start;(i>e||i{var e;d.executeStart=self.performance.now();const t=null==(e=this.tracks[n])?void 0:e.buffer;t&&(v?this.updateTimestampOffset(t,y,.1,n,h,u):void 0!==l&&yg(l)&&this.updateTimestampOffset(t,l,1e-6,n,h,u)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();d.executeEnd=d.end=e,0===g.first&&(g.first=e),f&&0===f.first&&(f.first=e);const t={};this.sourceBuffers.forEach(e=>{let[i,r]=e;i&&(t[i]=cv.getBuffered(r))}),this.appendErrors[n]=0,"audio"===n||"video"===n?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Tg.BUFFER_APPENDED,{type:n,frag:a,part:o,chunkMeta:c,parent:a.type,timeRanges:t})},onError:e=>{var t;const i={type:xg.MEDIA_ERROR,parent:a.type,details:Eg.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:a,part:o,chunkMeta:c,error:e,err:e,fatal:!1},r=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)i.details=Eg.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!r)i.errorAction=jm(!0);else if(e.name===yy&&0===this.sourceBufferCount)i.errorAction=jm(!0);else{const e=++this.appendErrors[n];this.warn("Failed ".concat(e,"/").concat(this.hls.config.appendErrorMaxRetry,' times to append segment in "').concat(n,'" sourceBuffer (').concat(r||"no media error",")")),(e>=this.hls.config.appendErrorMaxRetry||r)&&(i.fatal=!0)}this.hls.trigger(Tg.ERROR,i)}};this.append(w,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,i){return this.log('queuing "'.concat(e,'" remove ').concat(t,"-").concat(i)),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(Tg.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn("Failed to remove ".concat(t,"-").concat(i,' from "').concat(e,'" SourceBuffer'),r)}}}onBufferFlushing(e,t){const{type:i,startOffset:r,endOffset:n}=t;i?this.append(this.getFlushOp(i,r,n),i):this.sourceBuffers.forEach(e=>{let[t]=e;t&&this.append(this.getFlushOp(t,r,n),t)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],s=r?r.elementaryStreams:i.elementaryStreams;s[nf]?n.push("audiovideo"):(s[tf]&&n.push("audio"),s[rf]&&n.push("video"));0===n.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: ".concat(i.type," level: ").concat(i.level," sn: ").concat(i.sn)),this.blockBuffers(()=>{const e=self.performance.now();i.stats.buffering.end=e,r&&(r.stats.buffering.end=e);const t=r?r.stats:i.stats;this.hls.trigger(Tg.FRAG_BUFFERED,{frag:i,part:r,stats:t,id:i.type})},n).catch(e=>{this.warn("Fragment buffered callback ".concat(e)),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(e=>{let[t]=e;var i,r;return t&&(!(null!=(i=this.tracks[t])&&i.ended)||(null==(r=this.tracks[t])?void 0:r.ending))})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(e=>{let[i]=e;if(i){const e=this.tracks[i];t.type&&t.type!==i||(e.ending=!0,e.ended||(e.ended=!0,this.log("".concat(i," buffer reached EOS"))))}});const r=!1!==(null==(i=this.overrides)?void 0:i.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some(e=>{let[t]=e;var i;return t&&!(null!=(i=this.tracks[t])&&i.ended)})&&(r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(Tg.BUFFERED_TO_END,void 0)):e&&this.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(e.readyState))})):(this.tracksEnded(),this.hls.trigger(Tg.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(e=>{let[t]=e;if(null!==t){const e=this.tracks[t];e&&(e.ending=!1)}})}onLevelUpdated(e,t){let{details:i}=t;i.fragments.length&&(this.details=i,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===Eg.BUFFER_APPEND_ERROR&&t.frag){var i;const e=null==(i=t.errorAction)?void 0:i.nextAutoLevel;yg(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.sourceBufferCount)return;const r=e.config,n=i.currentTime,s=t.levelTargetDuration,a=t.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(yg(a)&&a>=0){const e=Math.max(a,s),t=Math.floor(n/s)*s-e;this.flushBackBuffer(n,s,t)}if(yg(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const e=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),t=Math.max(e,s),i=Math.floor(n/s)*s+t;this.flushFrontBuffer(n,s,i)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(e=>{let[t,r]=e;if(r){const e=cv.getBuffered(r);if(e.length>0&&i>e.start(0)){var n;this.hls.trigger(Tg.BACK_BUFFER_REACHED,{bufferEnd:i});const e=this.tracks[t];if(null!=(n=this.details)&&n.live)this.hls.trigger(Tg.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=e&&e.ended)return void this.log("Cannot flush ".concat(t," back buffer while SourceBuffer is in ended state"));this.hls.trigger(Tg.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:t})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(t=>{let[r,n]=t;if(n){const t=cv.getBuffered(n),s=t.length;if(s<2)return;const a=t.start(s-1),o=t.end(s-1);if(i>a||e>=a&&e<=o)return;this.hls.trigger(Tg.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||"open"!==(null==i?void 0:i.readyState))return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&i.setLiveSeekableRange){const e=Math.max(0,t.fragmentStart);return{duration:1/0,start:e,end:Math.max(e,r)}}return{duration:1/0}}const n=null==(e=this.overrides)?void 0:e.duration;if(n)return yg(n)?{duration:n}:null;const s=this.media.duration;return r>(yg(i.duration)?i.duration:0)&&r>s||!yg(s)?{duration:r}:null}updateMediaSource(e){let{duration:t,start:i,end:r}=e;const n=this.mediaSource;this.media&&n&&"open"===n.readyState&&(n.duration!==t&&(yg(t)&&this.log("Updating MediaSource duration to ".concat(t.toFixed(3))),n.duration=t),void 0!==i&&void 0!==r&&(this.log("MediaSource duration is set to ".concat(n.duration,". Setting seekable range to ").concat(i,"-").concat(r,".")),n.setLiveSeekableRange(i,r)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log("checkPendingTracks (pending: ".concat(t," codec events expected: ").concat(e,") ").concat(pm(i))),this.tracksReady){var r;const e=null==(r=this.transferData)?void 0:r.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(t=>{let[i,r]=t;if(i){const t=this.tracks[i];e[i]={buffer:r,container:t.container,codec:t.codec,supplemental:t.supplemental,levelCodec:t.levelCodec,id:t.id,metadata:t.metadata}}}),this.hls.trigger(Tg.BUFFER_CREATED,{tracks:e}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),this.sourceBuffers.forEach(e=>{let[t]=e;this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const a=s,o=e[a];if(this.isPending(o)){const e=this.getTrackCodec(o,a),s="".concat(o.container,";codecs=").concat(e);o.codec=e,this.log("creating sourceBuffer(".concat(s,")").concat(this.currentOp(a)?" Queued":""," ").concat(pm(o)));try{const e=i.addSourceBuffer(s),r=xy(a),n=[a,e];t[r]=n,o.buffer=e}catch(n){var r;return this.error("error while trying to add sourceBuffer: ".concat(n.message)),this.shiftAndExecuteNext(a),null==(r=this.operationQueue)||r.removeBlockers(),delete this.tracks[a],void this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:n,sourceBufferName:a,mimeType:s,parent:o.id})}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let r=e.codec;i&&("video"===t||"audiovideo"===t)&&Ff(i,"video")&&(r=function(e,t){const i=[];if(e){const t=e.split(",");for(let e=0;e{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(Tg.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;const i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const r=new Error("".concat(e," SourceBuffer error. MediaSource readyState: ").concat(null==(i=this.mediaSource)?void 0:i.readyState));this.error("".concat(r),t),this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.currentOp(e);n&&n.onError(r)}updateTimestampOffset(e,t,i,r,n,s){const a=t-e.timestampOffset;Math.abs(a)>=i&&(this.log("Updating ".concat(r," SourceBuffer timestampOffset to ").concat(t," (sn: ").concat(n," cc: ").concat(s,")")),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:r,mediaSource:n}=this,s=this.tracks[e],a=null==s?void 0:s.buffer;if(!r||!n||!a)return this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),void this.shiftAndExecuteNext(e);const o=yg(r.duration)?r.duration:1/0,c=yg(n.duration)?n.duration:1/0,l=Math.max(0,t),d=Math.min(i,o,c);d>l&&(!s.ending||s.ended)?(s.ended=!1,this.log("Removing [".concat(l,",").concat(d,"] from the ").concat(e," SourceBuffer")),a.remove(l,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],r=null==i?void 0:i.buffer;if(!r)throw new wy("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"));i.ending=!1,i.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn("SourceBuffer blocked callback ".concat(e)),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn("Callback run without blocking ".concat(this.operationQueue," ").concat(t))}}isUpdating(){return this.sourceBuffers.some(e=>{let[t,i]=e;return t&&i.updating})}isQueued(){return this.sourceBuffers.some(e=>{let[t]=e;return t&&!!this.currentOp(t)})}isPending(e){return!!e&&!e.buffer}blockBuffers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.sourceBufferTypes;if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,r=t.map(e=>this.appendBlocker(e));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(t=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;i&&!i.updating&&this.shiftAndExecuteNext(e)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,t)=>{let[i]=t;return e+(i?1:0)},0)}get sourceBufferTypes(){return this.sourceBuffers.map(e=>{let[t]=e;return t}).filter(e=>!!e)}addBufferListener(e,t,i){const r=this.tracks[e];if(!r)return;const n=r.buffer;if(!n)return;const s=i.bind(this,e);r.listeners.push({event:t,listener:s}),n.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(e=>{i.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}},capLevelController:Ey,errorController:class extends jg{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Tg.ERROR,this.onError,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Tg.ERROR,this.onError,this),e.off(Tg.ERROR,this.onErrorOut,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Rg?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case Eg.FRAG_LOAD_ERROR:case Eg.FRAG_LOAD_TIMEOUT:case Eg.KEY_LOAD_ERROR:case Eg.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Eg.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction=jm());case Eg.FRAG_GAP:case Eg.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Mm);case Eg.LEVEL_EMPTY_ERROR:case Eg.LEVEL_PARSING_ERROR:{var s,a;const e=t.parent===Rg?t.level:r.loadLevel;t.details===Eg.LEVEL_EMPTY_ERROR&&null!=(s=t.context)&&null!=(a=s.levelDetails)&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Eg.LEVEL_LOAD_ERROR:case Eg.LEVEL_LOAD_TIMEOUT:return void("number"===typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case Eg.AUDIO_TRACK_LOAD_ERROR:case Eg.AUDIO_TRACK_LOAD_TIMEOUT:case Eg.SUBTITLE_LOAD_ERROR:case Eg.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const e=r.loadLevelObj;if(e&&(n.type===Cg&&e.hasAudioGroup(n.groupId)||n.type===Ag&&e.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=Mm,void(t.errorAction.flags=Um)}return;case Eg.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.loadLevelObj,i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:Mm,flags:Fm,hdcpLevel:i}:this.keySystemError(t)}return;case Eg.BUFFER_ADD_CODEC_ERROR:case Eg.REMUX_ALLOC_ERROR:case Eg.BUFFER_APPEND_ERROR:var o;if(!t.errorAction)t.errorAction=this.getLevelSwitchAction(t,null!=(o=t.level)?o:r.loadLevel);return;case Eg.INTERNAL_EXCEPTION:case Eg.BUFFER_APPENDING_ERROR:case Eg.BUFFER_FULL_ERROR:case Eg.LEVEL_SWITCH_ERROR:case Eg.BUFFER_STALLED_ERROR:case Eg.BUFFER_SEEK_OVER_HOLE:case Eg.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=jm())}t.type===xg.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=Cm(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++;if(Lm(i,r,Pm(e),e.response))return{action:Om,flags:Nm,retryConfig:i,retryCount:r};const n=this.getLevelSwitchAction(e,t);return i&&(n.retryConfig=i,n.retryCount=r),n}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:s}=t.config,a=Cm(e.details.startsWith("key")?s:n,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(r){e.details!==Eg.FRAG_GAP&&r.fragmentError++;if(Lm(a,o,Pm(e),e.response))return{action:Om,flags:Nm,retryConfig:a,retryCount:o}}const c=this.getLevelSwitchAction(e,i);return a&&(c.retryConfig=a,c.retryCount=o),c}getLevelSwitchAction(e,t){const i=this.hls;null!==t&&void 0!==t||(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,s;const t=e.details;r.loadError++,t===Eg.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:l,loadLevel:d,minAutoLevel:h,maxAutoLevel:u}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);const p=null==(n=e.frag)?void 0:n.type,g=(p===Lg&&t===Eg.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===Eg.BUFFER_ADD_CODEC_ERROR||t===Eg.BUFFER_APPEND_ERROR))&&l.some(e=>{let{audioCodec:t}=e;return r.audioCodec!==t}),f="video"===e.sourceBufferName&&(t===Eg.BUFFER_ADD_CODEC_ERROR||t===Eg.BUFFER_APPEND_ERROR)&&l.some(e=>{let{codecSet:t,audioCodec:i}=e;return r.codecSet!==t&&r.audioCodec===i}),{type:m,groupId:v}=null!=(s=e.context)?s:{};for(let i=l.length;i--;){const n=(i+d)%l.length;if(n!==d&&n>=h&&n<=u&&0===l[n].loadError){var a,o;const i=l[n];if(t===Eg.FRAG_GAP&&p===Rg&&e.frag){const t=l[n].details;if(t){const i=xm(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(m===Cg&&i.hasAudioGroup(v)||m===Ag&&i.hasSubtitleGroup(v))continue;if(p===Lg&&null!=(a=r.audioGroups)&&a.some(e=>i.hasAudioGroup(e))||p===Ig&&null!=(o=r.subtitleGroups)&&o.some(e=>i.hasSubtitleGroup(e))||g&&r.audioCodec===i.audioCodec||!g&&r.audioCodec!==i.audioCodec||f&&r.codecSet===i.codecSet)continue}c=n;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Mm,flags:Nm,nextAutoLevel:c}}return{action:Mm,flags:Um}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Im:break;case Mm:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Eg.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'.concat(t.sourceBufferName,'" sourceBuffer append error. Attempting to recover from media error.')),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:s}=i;switch(r){case Nm:this.switchLevel(e,s);break;case Fm:n&&(t.maxHdcpLevel=rm[rm.indexOf(n)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))}i.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn("switching to level ".concat(t," after ").concat(e.details)),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===Eg.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){const t=Yf(e.mimeType),i=this.hls.levels;for(let r=i.length;r--;)i[r]["".concat(e.sourceBufferName,"Codec")]===t&&this.hls.removeLevel(r)}}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"===typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const e=r-this.lastTime,n=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,a=1e3*n/e,o=this.hls;if(o.trigger(Tg.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:i}),a>0&&n>o.config.fpsDroppedMonitoringThreshold*s){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(Tg.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Bv,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:xS,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Ub{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",Ig),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tg.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Tg.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Tg.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Tg.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tg.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Tg.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Tg.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Tg.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=_b,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragContextChanged(i)||(af(i)&&(this.fragPrevious=i),this.state=_b),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let s;const a=i.start;for(let c=0;c=n[c].start&&a<=n[c].end){s=n[c];break}const o=i.start+i.duration;s?s.end=o:(s={start:a,end:o},n.push(s)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(0===i&&r!==Number.POSITIVE_INFINITY){const e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let i=0;inew dm(e)):(this.tracksBuffered=[],this.levels=i.map(e=>{const t=new dm(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ig),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const r=this.levels[this.currentTrackId];null!=r&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==Tb&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:s,id:a}=t;if(!n)return void this.warn("Subtitle tracks were reset while loading level ".concat(a));const o=n[a];if(a>=n.length||!o)return;this.log("Subtitle track ".concat(a," loaded [").concat(s.startSN,",").concat(s.endSN,"]").concat(s.lastPartSn?"[part-".concat(s.lastPartSn,"-").concat(s.lastPartIndex,"]"):"",",duration:").concat(s.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(s.live||null!=(i=o.details)&&i.live){if(s.deltaUpdateFailed)return;const e=this.mainDetails;if(!e)return void(this.startFragRequested=!1);const t=e.fragments[0];var l;if(o.details)c=this.alignPlaylists(s,o.details,null==(l=this.levelLastLoaded)?void 0:l.details),0===c&&t&&(c=t.start,pb(s,c));else s.hasProgramDateTime&&e.hasProgramDateTime?(xb(s,e),c=s.fragmentStart):t&&(c=t.start,pb(s,c));e&&!this.startFragRequested&&this.setStartPosition(e,c)}if(o.details=s,this.levelLastLoaded=o,a===r&&(this.hls.trigger(Tg.SUBTITLE_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===_b)){xm(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=r&&r.key&&r.iv&&wv(r.method)){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,Sv(r.method)).catch(e=>{throw n.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(i=>{const r=performance.now();n.trigger(Tg.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:r}})}).catch(e=>{this.warn("".concat(e.name,": ").concat(e.message)),this.state=_b})}}doTick(){if(this.media){if(this.state===_b){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;if(this.waitForLive(i))return;const{config:r}=this,n=this.getLoadPosition(),s=cv.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:o}=s,c=i.details;if(o>this.hls.maxBufferLength+c.levelTargetDuration)return;const l=c.fragments,d=l.length,h=c.edge;let u=null;const p=this.fragPrevious;if(ah-e?0:e;u=xm(p,l,Math.max(l[0].start,a),t),!u&&p&&p.startthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=uw(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tg.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tg.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Tg.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;uw(i.textTracks).forEach(e=>{dw(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn("Subtitle track with id:".concat(i," and group:").concat(r," not found in active group ").concat(null==s?void 0:s.groupId));const a=s.details;s.details=t.details,this.log("Subtitle track ".concat(i,' "').concat(s.name,'" lang:').concat(s.lang," group:").concat(r," loaded [").concat(n.startSN,"-").concat(n.endSN,"]")),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>-1===(null==r?void 0:r.indexOf(e)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!n&&t){this.selectDefaultTrack=!1;const i=vm(t,e);if(i>-1)n=e[i];else{const e=vm(t,this.tracks);n=this.tracks[e]}}let r=this.findTrackId(n);-1===r&&n&&(r=this.findTrackId(null));const s={subtitleTracks:e};this.log("Updating subtitle tracks, ".concat(e.length,' track(s) found in "').concat(null==i?void 0:i.join(","),'" group-id')),this.hls.trigger(Tg.SUBTITLE_TRACKS_UPDATED,s),-1!==r&&-1===this.trackId&&this.setSubtitleTrack(r)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r-1){const e=this.tracksInGroup[r];return this.setSubtitleTrack(r),e}if(i)return null;{const i=vm(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),s=e.details,a=null==s?void 0:s.age;this.log("Loading subtitle ".concat(i,' "').concat(e.name,'" lang:').concat(e.lang," group:").concat(r).concat(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"").concat(a&&s.live?" age "+a.toFixed(1)+(s.type?" "+s.type||0:""):""," ").concat(n)),this.hls.trigger(Tg.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=uw(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(e=>vy(i,e))[0],r||this.warn('Unable to find subtitle TextTrack with name "'.concat(i.name,'" and language "').concat(i.lang,'"'))),[].slice.call(t).forEach(e=>{"disabled"!==e.mode&&e!==r&&(e.mode="disabled")}),r){const e=this.subtitleDisplay?"showing":"hidden";r.mode!==e&&(r.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!yg(e))return void this.warn("Invalid subtitle track id: ".concat(e));this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(Tg.SUBTITLE_TRACK_SWITCH,{id:e});const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log("Switching to subtitle-track ".concat(e)+(r?' "'.concat(r.name,'" lang:').concat(r.lang," group:").concat(r.groupId):""));const{id:s,groupId:a="",name:o,type:c,url:l}=r;this.hls.trigger(Tg.SUBTITLE_TRACK_SWITCH,{id:s,groupId:a,name:o,type:c,url:l});const d=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(d)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tg.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Tg.FRAG_LOADING,this.onFragLoading,this),e.on(Tg.FRAG_LOADED,this.onFragLoaded,this),e.on(Tg.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Tg.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Tg.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Tg.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tg.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Tg.FRAG_LOADING,this.onFragLoading,this),e.off(Tg.FRAG_LOADED,this.onFragLoaded,this),e.off(Tg.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Tg.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Tg.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Tg.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new bS(this,"textTrack1"),t=new bS(this,"textTrack2"),i=new bS(this,"textTrack3"),r=new bS(this,"textTrack4");this.cea608Parser1=new $w(1,e,t),this.cea608Parser2=new $w(3,i,r)}addCues(e,t,i,r,n){let s=!1;for(let a=n.length;a--;){const e=n[a],r=wS(e[0],e[1],t,i);if(r>=0&&(e[0]=Math.min(e[0],t),e[1]=Math.max(e[1],i),s=!0,r/(i-t)>.5))return}if(s||n.push([t,i]),this.config.renderTextTracksNatively){const n=this.captionsTracks[e];this.Cues.newCue(n,t,i,r)}else{const n=this.Cues.newCue(null,t,i,r);this.hls.trigger(Tg.CUES_PARSED,{type:"captions",cues:n,track:e})}}onInitPtsFound(e,t){let{frag:i,id:r,initPTS:n,timescale:s}=t;const{unparsedVttFrags:a}=this;r===Rg&&(this.initPTS[i.cc]={baseTime:n,timescale:s}),a.length&&(this.unparsedVttFrags=[],a.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(Tg.FRAG_LOADED,e):this.hls.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r{dw(r[e]),delete r[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;ie.textCodec===oS);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(fy(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?uw(e.textTracks):null;if(this.tracks.forEach((e,i)=>{let r;if(t){let i=null;for(let r=0;rnull!==e).map(e=>e.label);e.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: ".concat(e.join(", "),". Replace media element for each source to clear TextTracks and captions menu."))}}else if(this.tracks.length){const e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(Tg.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i="textTrack".concat(t[1]),r=this.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Rg){var i,r;const{cea608Parser1:e,cea608Parser2:n,lastSn:s}=this,{cc:a,sn:o}=t.frag,c=null!=(i=null==(r=t.part)?void 0:r.index)?i:-1;e&&n&&(o!==s+1||o===s&&c!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===Ig)if(r.byteLength){const e=i.decryptdata,n="stats"in t;if(null==e||!e.encrypted||n){const e=this.tracks[i.level],n=this.vttCCs;n[i.cc]||(n[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===oS?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;hS(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),i.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{i.logger.log("Failed to parse IMSC1: ".concat(t)),i.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:s}=this,a=n.length-1;if(!n[i.cc]&&-1===a)return void s.push(e);const o=this.hls;aS(null!=(t=i.initSegment)&&t.data?Pf(i.initSegment.data,new Uint8Array(r)).buffer:r,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,e=>{this._appendCues(e,i.level),o.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},t=>{const n="Missing initPTS for VTT MPEGTS"===t.message;n?s.push(e):this._fallbackToIMSC1(i,r),o.logger.log("Failed to parse VTT cue: ".concat(t)),n&&a>i.cc||o.trigger(Tg.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||hS(t,this.initPTS[e.cc],()=>{i.textCodec=oS,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach(e=>lw(i,e))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(Tg.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ig&&this.onFragLoaded(Tg.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:r}=t;if(i.type!==Rg||"NONE"!==this.closedCaptionsForLevel(i))for(let n=0;nhw(e[t],i,r))}if(this.config.renderTextTracksNatively&&0===i&&void 0!==n){const{textTracks:e}=this;Object.keys(e).forEach(t=>hw(e[t],i,n))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let r=2;for(let n=0;n=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const r=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(t&&(null==r?void 0:r.cc)===t.cc)return;const n=(r||e).cc,s=_m(this.getLevelDetails(),n,this.getLoadPosition());s&&(this.log("Waiting fragment cc (".concat(null==t?void 0:t.cc,") cancelled because video is at cc ").concat(e.cc)),this.startFragRequested=!1,this.nextLoadPosition=s.start,this.resetLoadingState(),this.state===_b&&this.doTickIdle())}startLoad(e,t){if(!this.levels)return this.startPosition=e,void(this.state=Tb);const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===e?(this.log("Override startPosition with lastCurrentTime @".concat(i.toFixed(3))),e=i,this.state=_b):this.state=Rb,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case _b:this.doTickIdle();break;case Rb:{const{levels:e,trackId:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=Ob}break}case Ab:{var e;const t=performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=_b}break}case Ob:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:r,complete:n}=e,s=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=Cb;const e={frag:t,part:i,payload:r.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),n&&super._handleFragmentLoadComplete(e)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=_b}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:r,trackId:n}=this,s=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||null==i||!i[n])return;const a=i[n],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o))return this.state=Rb,void(this.startFragRequested=!1);const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,tf,Lg));const l=this.getFwdBufferInfo(c,Lg);if(null===l)return;if(!this.switchingTrack&&this._streamEnded(l,o))return t.trigger(Tg.BUFFER_EOS,{type:"audio"}),void(this.state=Mb);const d=l.len,h=t.maxBufferLength,u=o.fragments,p=u[0].start,g=this.getLoadPosition(),f=this.flushing?g:l.end;if(this.switchingTrack&&r){const e=g;o.PTSKnown&&ep||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=p+.05)}if(d>=h&&!this.switchingTrack&&fv.end){const e=this.fragmentTracker.getFragAtPos(f,Rg);e&&e.end>v.end&&(v=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(m.start>v.end)return}this.loadFragment(m,a,f)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,t){let{audioTracks:i}=t;this.resetTransmuxer(),this.levels=i.map(e=>new dm(e))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Tb&&(this.setInterval(100),this.state=_b,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(Tg.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:r}=this,{details:n,id:s,groupId:a,track:o}=t;if(!r)return void this.warn("Audio tracks reset while loading track ".concat(s,' "').concat(o.name,'" of "').concat(a,'"'));const c=this.mainDetails;if(!c||n.endCC>c.endCC||c.expired)return this.cachedTrackLoadedData=t,void(this.state!==Tb&&(this.state=Rb));this.cachedTrackLoadedData=null,this.log("Audio track ".concat(s,' "').concat(o.name,'" of "').concat(a,'" loaded [').concat(n.startSN,",").concat(n.endSN,"]").concat(n.lastPartSn?"[part-".concat(n.lastPartSn,"-").concat(n.lastPartIndex,"]"):"",",duration:").concat(n.totalduration));const l=r[s];let d=0;if(n.live||null!=(i=l.details)&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;var h;if(l.details)d=this.alignPlaylists(n,l.details,null==(h=this.levelLastLoaded)?void 0:h.details);n.alignedSliding||(Sb(n,c),n.alignedSliding||xb(n,c),d=n.fragmentStart)}l.details=n,this.levelLastLoaded=l,this.startFragRequested||this.setStartPosition(c,d),this.hls.trigger(Tg.AUDIO_TRACK_UPDATED,{details:n,id:s,groupId:t.groupId}),this.state!==Rb||this.waitForCdnTuneIn(n)||(this.state=_b),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:r,payload:n}=e,{config:s,trackId:a,levels:o}=this;if(!o)return void this.warn("Audio tracks were reset while fragment load was in progress. Fragment ".concat(i.sn," of level ").concat(i.level," will not be buffered"));const c=o[a];if(!c)return void this.warn("Audio track is undefined on fragment load progress");const l=c.details;if(!l)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const d=s.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new py(this.hls,Lg,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=r?r.index:-1,s=-1!==t,a=new av(i.level,i.sn,i.stats.chunkCount,n.byteLength,t,s);h.push(n,p,d,"",i,r,l.totalduration,e,a,u)}else{this.log("Unknown video PTS for cc ".concat(i.cc,", waiting for video PTS before demuxing audio frag ").concat(i.sn," of [").concat(l.startSN," ,").concat(l.endSN,"],track ").concat(a));const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new jb,complete:!1};e.push(new Uint8Array(n)),this.state!==Tb&&(this.state=Ob)}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Rg&&af(t.frag)&&(this.mainFragLoading=t,this.state===_b&&this.tick())}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type===Lg)if(this.fragContextChanged(i))this.warn("Fragment ".concat(i.sn).concat(r?" p: "+r.index:""," of level ").concat(i.level," finished buffering, but was aborted. state: ").concat(this.state,", audioSwitch: ").concat(this.switchingTrack?this.switchingTrack.name:"false"));else{if(af(i)){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Tg.AUDIO_TRACK_SWITCHED,Fg({},e)))}this.fragBufferedComplete(i,r),this.media&&this.tick()}else this.audioOnly||i.type!==Rg||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(e,t){var i;if(t.fatal)this.state=Db;else switch(t.details){case Eg.FRAG_GAP:case Eg.FRAG_PARSING_ERROR:case Eg.FRAG_DECRYPT_ERROR:case Eg.FRAG_LOAD_ERROR:case Eg.FRAG_LOAD_TIMEOUT:case Eg.KEY_LOAD_ERROR:case Eg.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Lg,t);break;case Eg.AUDIO_TRACK_LOAD_ERROR:case Eg.AUDIO_TRACK_LOAD_TIMEOUT:case Eg.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Rb||(null==(i=t.context)?void 0:i.type)!==Cg||(this.state=_b);break;case Eg.BUFFER_ADD_CODEC_ERROR:case Eg.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Eg.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Eg.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,t){let{type:i}=t;i!==rf&&(this.flushing=!0)}onBufferFlushed(e,t){let{type:i}=t;if(i!==rf){this.flushing=!1,this.bufferFlushed=!0,this.state===Mb&&(this.state=_b);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,i,Lg),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:c,level:l}=a,{details:d}=l,{audio:h,text:u,id3:p,initSegment:g}=n;if(!this.fragContextChanged(o)&&d){if(this.state=Lb,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){const e=o.initSegment||o;this._bufferInitSegment(l,g.tracks,e,s),r.trigger(Tg.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:g.tracks})}if(h){const{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=h;c&&(c.elementaryStreams[tf]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(tf,e,t,i,r),this.bufferFragmentData(h,o,c,s)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=Ng({id:i,frag:o,details:d},p);r.trigger(Tg.FRAG_PARSING_METADATA,e)}if(u){const e=Ng({id:i,frag:o,details:d},u);r.trigger(Tg.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(e,t,i,r){if(this.state!==Lb)return;if(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio)return;const n=t.audio;n.id=Lg;const s=e.audioCodec;this.log("Init audio buffer, container:".concat(n.container,", codecs[level/parsed]=[").concat(s,"/").concat(n.codec,"]")),s&&1===s.split(",").length&&(n.levelCodec=s),this.hls.trigger(Tg.BUFFER_CODECS,t);const a=n.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(Tg.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);var n;if(this.switchingTrack||r===Bm||r===zm)if(af(e))if(null!=(n=t.details)&&n.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ").concat(e.sn," of level ").concat(this.trackId)),this.state=Ob;const i=this.mainDetails;i&&i.fragmentStart!==t.details.fragmentStart&&xb(t.details,i)}else super.loadFragment(e,t,i);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:r,characteristics:n,audioCodec:s,channels:a}=this.bufferedTrack;bm({name:t,lang:i,assocLang:r,characteristics:n,audioCodec:s,channels:a},e,km)||(wm(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Tg.AUDIO_TRACK_SWITCHED,Fg({},e))}},audioTrackController:class extends gy{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tg.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tg.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tg.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Tg.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==r)return void this.warn("Audio track with id:".concat(i," and group:").concat(r," not found in active group ").concat(null==s?void 0:s.groupId));const a=s.details;s.details=t.details,this.log("Audio track ".concat(i,' "').concat(s.name,'" lang:').concat(s.lang," group:").concat(r," loaded [").concat(n.startSN,"-").concat(n.endSN,"]")),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>-1===(null==r?void 0:r.indexOf(e)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!n&&t){const i=vm(t,e,km);if(i>-1)n=e[i];else{const e=vm(t,this.tracks);n=this.tracks[e]}}let r=this.findTrackId(n);-1===r&&n&&(r=this.findTrackId(null));const a={audioTracks:e};this.log("Updating audio tracks, ".concat(e.length," track(s) found in group(s): ").concat(null==i?void 0:i.join(","))),this.hls.trigger(Tg.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==r&&-1===o)this.setAudioTrack(r);else if(e.length&&-1===o){var s;const t=new Error("No audio track selected for current audio group-ID(s): ".concat(null==(s=this.groupIds)?void 0:s.join(",")," track count: ").concat(e.length));this.warn(t.message),this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==Cg||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const r=this.currentTrack;if(r&&bm(e,r,km))return r;const n=vm(e,this.tracksInGroup,km);if(n>-1){const e=this.tracksInGroup[n];return this.setAudioTrack(n),e}if(r){let r=t.loadLevel;-1===r&&(r=t.firstAutoLevel);const n=function(e,t,i,r,n){const s=t[r],a=t.reduce((e,t,i)=>{const r=t.uri;return(e[r]||(e[r]=[])).push(i),e},{}),o=a[s.uri];o.length>1&&(r=Math.max.apply(Math,o));const c=s.videoRange,l=s.frameRate,d=s.codecSet.substring(0,4),h=ym(t,r,t=>{if(t.videoRange!==c||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const r=t.audioGroups,s=i.filter(e=>!r||-1!==r.indexOf(e.groupId));return vm(e,s,n)>-1});return h>-1?h:ym(t,r,t=>{const r=t.audioGroups,s=i.filter(e=>!r||-1!==r.indexOf(e.groupId));return vm(e,s,n)>-1})}(e,t.levels,i,r,km);if(-1===n)return null;t.nextLoadLevel=n}if(e.channels||e.audioCodec){const t=vm(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn("Invalid audio track id: ".concat(e));this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;if(this.log("Switching to audio-track ".concat(e,' "').concat(r.name,'" lang:').concat(r.lang," group:").concat(r.groupId," channels:").concat(r.channels)),this.trackId=e,this.currentTrack=r,this.hls.trigger(Tg.AUDIO_TRACK_SWITCHING,Fg({},r)),n)return;const s=this.switchParams(r.url,null==i?void 0:i.details,r.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Ty.MANIFEST,su:!this.initialized})}catch(t){this.hls.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=e=>{try{const{frag:t,part:i}=e,r=this.hls.levels[t.level],n=this.getObjectType(t),s={d:1e3*(i||t).duration,ot:n};n!==Ty.VIDEO&&n!==Ty.AUDIO&&n!=Ty.MUXED||(s.br=r.bitrate/1e3,s.tb=this.getTopBandwidth(n)/1e3,s.bl=this.getBufferLength(n));const a=i?this.getNextPart(i):this.getNextFrag(t);null!=a&&a.url&&a.url!==t.url&&(s.nor=a.url),this.apply(e,s)}catch(t){this.hls.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Tg.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Tg.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(r=t.tracks.video)?void 0:r.buffer}createData(){var e;return{v:1,sf:_y.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ng(t,this.createData());const i=t.ot===Ty.INIT||t.ot===Ty.VIDEO||t.ot===Ty.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,i)=>(r.includes(i)&&(e[i]=t[i]),e),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Xy(e.headers,t,n)):e.url=tw(e.url,t,n)}getNextFrag(e){var t;const i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){const t=e.sn-i.startSN;return i.fragments[t+1]}}getNextPart(e){var t,i;const{index:r,fragment:n}=e,s=null==(t=this.hls.levels[n.level])||null==(i=t.details)?void 0:i.partList;if(s){const{sn:e}=n;for(let t=s.length-1;t>=0;t--){const i=s[t];if(i.index===r&&i.fragment.sn===e)return s[t+1]}}}getObjectType(e){const{type:t}=e;return"subtitle"===t?Ty.TIMED_TEXT:"initSegment"===e.sn?Ty.INIT:"audio"===t?Ty.AUDIO:"main"===t?this.hls.audioTracks.length?Ty.VIDEO:Ty.MUXED:void 0}getTopBandwidth(e){let t,i=0;const r=this.hls;if(e===Ty.AUDIO)t=r.audioTracks;else{const e=r.maxAutoLevel,i=e>-1?e+1:r.levels.length;t=r.levels.slice(0,i)}return t.forEach(e=>{e.bitrate>i&&(i=e.bitrate)}),i>0?i:NaN}getBufferLength(e){const t=this.media,i=e===Ty.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*cv.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}}}},contentSteeringController:class extends jg{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===Mm&&i.flags===Um){const e=this.levels;let r=this._pathwayPriority,n=this.pathwayId;if(t.context){const{groupId:i,pathwayId:r,type:s}=t.context;i&&e?n=this.getPathwayForGroupId(i,s,n):r&&(n=r)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!r&&e&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==n),t.details!==Eg.BUFFER_APPEND_ERROR||t.fatal?i.resolved||this.warn("Could not resolve ".concat(t.details,' ("').concat(t.error.message,'") with content-steering for Pathway: ').concat(n," levels: ").concat(e?e.length:e," priorities: ").concat(pm(r)," penalized: ").concat(pm(this.penalizedPathways))):i.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log("No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "').concat(i,'"')),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log("Found ".concat(t.length,"/").concat(e.length,' levels in Pathway "').concat(this.pathwayId,'"')),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this._pathwayPriority=e;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(e=>{r-i[e]>3e5&&delete i[e]});for(let n=0;n0){this.log('Setting Pathway to "'.concat(r,'"')),this.pathwayId=r,bb(t),this.hls.trigger(Tg.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[s];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log("Unstable Pathways change from bitrate ".concat(a.bitrate," to ").concat(e.bitrate)),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n{const{ID:n,"BASE-ID":s,"URI-REPLACEMENT":a}=e;if(t.some(e=>e.pathwayId===n))return;const o=this.getLevelsForPathway(s).map(e=>{const t=new mv(e.attrs);t["PATHWAY-ID"]=n;const s=t.AUDIO&&"".concat(t.AUDIO,"_clone_").concat(n),o=t.SUBTITLES&&"".concat(t.SUBTITLES,"_clone_").concat(n);s&&(i[t.AUDIO]=s,t.AUDIO=s),o&&(r[t.SUBTITLES]=o,t.SUBTITLES=o);const c=rw(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),l=new dm({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let i=1;i{this.log('Loaded steering manifest: "'.concat(r,'"'));const s=e.data;if(1!==(null==s?void 0:s.VERSION))return void this.log("Steering VERSION ".concat(s.VERSION," not supported!"));this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":c}=s;if(a)try{this.uri=new self.URL(a,r).href}catch(l){return this.enabled=!1,void this.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(a))}this.scheduleRefresh(this.uri||i.url),o&&this.clonePathways(o);const d={steeringManifest:s,url:r.toString()};this.hls.trigger(Tg.STEERING_MANIFEST_LOADED,d),c&&this.updatePathwayPriority(c)},onError:(e,t,i,r)=>{if(this.log("Error loading steering manifest: ".concat(e.code," ").concat(e.text," (").concat(t.url,")")),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log("Steering manifest ".concat(t.url," no longer available"));let n=1e3*this.timeToLoad;if(429===e.code){const e=this.loader;if("function"===typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(n=1e3*parseFloat(t))}return void this.log("Steering manifest ".concat(t.url," rate limited"))}this.scheduleRefresh(this.uri||t.url,n)},onTimeout:(e,t,i)=>{this.log("Timeout loading steering manifest (".concat(t.url,")")),this.scheduleRefresh(this.uri||t.url)}};this.log("Requesting steering manifest: ".concat(r)),this.loader.load(n,o,c)}scheduleRefresh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*this.timeToLoad;this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)},t)}},interstitialsController:class extends jg{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;const t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;const i=t<=-.01;this.timelinePos=e,this.bufferedPos=e;const r=this.playingItem;if(!r)return void this.checkBuffer();if(i){this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule()}if(this.checkBuffer(),i&&e=r.end){var n;const e=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(r)&&null!=(n=this.media)&&n.paused&&(this.shouldPlay=!1),!i){const t=this.findItemIndex(r);if(e>t){const i=this.schedule.findJumpRestrictedIndex(t+1,e);if(i>t)return void this.setSchedulePosition(i)}}return void this.setSchedulePosition(e)}const s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(r)){const t=r.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}const a=s.timelineStart,o=s.duration||0;(i&&e=a+o)&&this.setScheduleToAssetAtTime(e,s)},this.onTimeupdate=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;if(!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();const t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}const i=this.playingAsset;if(!i)return;e>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(e,i)},this.onScheduleUpdate=(e,t)=>{const i=this.schedule,r=this.playingItem,n=i.events||[],s=i.items||[],a=i.durations,o=e.map(e=>e.identifier),c=!(!n.length&&!o.length);(c||t)&&this.log("INTERSTITIALS_UPDATED (".concat(n.length,"): ").concat(n,"\nSchedule: ").concat(s.map(e=>Ew(e))," pos: ").concat(this.timelinePos)),o.length&&this.log("Removed events ".concat(o)),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){const i=e.assetItem.timelineStart,r=e.timelineOffset-i;if(r)try{e.timelineOffset=i}catch(t){Math.abs(r)>gw&&this.warn("".concat(t,' ("').concat(e.assetId,'" ').concat(e.timelineOffset,"->").concat(i,")"))}}});let l=null;if(r){const e=this.updateItem(r,this.timelinePos);this.itemsMatch(r,e)&&(this.playingItem=e,this.waitingItem=this.endedItem=null,l=()=>this.trimInPlace(e,r))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d){const e=this.updateItem(d,this.bufferedPos);this.itemsMatch(d,e)?(this.bufferingItem=e,l||(l=()=>this.trimInPlace(e,d))):d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))}if(e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),c||t){if(this.hls.trigger(Tg.INTERSTITIALS_UPDATED,{events:n.slice(0),schedule:s.slice(0),durations:a,removedIds:o}),this.isInterstitial(r)&&o.includes(r.event.identifier))return this.warn('Interstitial "'.concat(r.event.identifier,'" removed while playing')),void this.primaryFallback(r.event);l&&l(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Tw(e),this.schedule=new xw(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Tg.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Tg.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(Tg.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Tg.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(Tg.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(Tg.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(Tg.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Tg.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Tg.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(Tg.MEDIA_ENDED,this.onMediaEnded,this),e.on(Tg.ERROR,this.onError,this),e.on(Tg.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Tg.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Tg.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(Tg.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Tg.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(Tg.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(Tg.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(Tg.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Tg.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Tg.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Tg.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(Tg.MEDIA_ENDED,this.onMediaEnded,this),e.off(Tg.ERROR,this.onError,this),e.off(Tg.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){sw(e,"play",this.onPlay),sw(e,"pause",this.onPause),sw(e,"seeking",this.onSeeking),sw(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;nw(i,"seeking",this.onSeeking),nw(i,"timeupdate",this.onTimeupdate),nw(i,"play",this.onPlay),nw(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!r){this.clearScheduleState();const e=this.findItemIndex(i);this.setSchedulePosition(e)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){const e=this.getBufferingPlayer();e&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=t=>t?e.getAssetPlayer(t.identifier):t,r=(t,r,n,a,o)=>{if(t){let c=t[r].start;const l=t.event;if(l){if("playout"===r||l.timelineOccupancy!==fw.Point){const e=i(n);(null==e?void 0:e.interstitial)===l&&(c+=e.assetItem.startOffset+e[o])}}else{c+=("bufferedPos"===a?s():e[a])-t.start}return c}return 0},n=(t,i)=>{if(0!==t&&"primary"!==i&&e.schedule.length){var r;const n=e.schedule.findItemIndexAtTime(t),s=null==(r=e.schedule.items)?void 0:r[n];if(s){return t+(s[i].start-s.start)}}return t},s=()=>{const t=e.bufferedPos;return t===Number.MAX_VALUE?a("primary"):Math.max(t,0)},a=t=>{var i;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:e.schedule.durations[t]},o=(t,n)=>{var s,a;const o=e.effectivePlayingItem;if(null!=o&&null!=(s=o.event)&&s.restrictions.skip)return;e.log("seek to ".concat(t,' "').concat(n,'"'));const c=e.effectivePlayingItem,l=e.schedule.findItemIndexAtTime(t,n),d=null==(a=e.schedule.items)?void 0:a[l],h=e.getBufferingPlayer(),u=null==h?void 0:h.interstitial,p=null==u?void 0:u.appendInPlace,g=c&&e.itemsMatch(c,d);if(c&&(p||g)){const s=i(e.playingAsset),a=(null==s?void 0:s.media)||e.primaryMedia;if(a){const i="primary"===n?a.currentTime:r(c,n,e.playingAsset,"timelinePos","currentTime"),o=t-i,l=(p?i:a.currentTime)+o;if(l>=0&&(!s||p||l<=s.duration))return void(a.currentTime=l)}}if(d){let i=t;if("primary"!==n){const e=t-d[n].start;i=d.start+e}const r=!e.isInterstitial(d);if(e.isInterstitial(c)&&!c.event.appendInPlace||!r&&!d.event.appendInPlace){if(c){const s=e.findItemIndex(c);if(l>s){const t=e.schedule.findJumpRestrictedIndex(s+1,l);if(t>s)return void e.setSchedulePosition(t)}let a=0;if(r)e.timelinePos=i,e.checkBuffer();else{var f;const e=null==d||null==(f=d.event)?void 0:f.assetList;if(e){const i=t-(d[n]||d).start;for(let t=e.length;t--;){const r=e[t];if(r.duration&&i>=r.startOffset&&i{const i=e.effectivePlayingItem;if(e.isInterstitial(i))return i;const r=t();return e.isInterstitial(r)?r:null},l={get currentTime(){const t=c(),i=e.effectivePlayingItem;return i&&i===t?r(i,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-i.playout.start:0},set currentTime(t){const i=c(),r=e.effectivePlayingItem;r&&r===i&&o(t+r.playout.start,"playout")},get duration(){const e=c();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t;const i=null==(t=c())?void 0:t.event.assetList;return i?i.map(t=>e.getAssetPlayer(t.identifier)):[]},get playingIndex(){var t;const i=null==(t=c())?void 0:t.event;return i&&e.effectivePlayingAsset?i.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};this.manager={get events(){var t,i;return(null==(t=e.schedule)||null==(i=t.events)?void 0:i.slice(0))||[]},get schedule(){var t,i;return(null==(t=e.schedule)||null==(i=t.items)?void 0:i.slice(0))||[]},get interstitialPlayer(){return c()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const i=t();return e.findItemIndex(i)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return s()},get currentTime(){const t=e.timelinePos;return t>0?t:0},set currentTime(e){o(e,"primary")},get duration(){return a("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){o(e,"integrated")},get duration(){return a("integrated")},get seekableStart(){var t;return n((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")}},skip:()=>{const t=e.effectivePlayingItem,i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){const r=e.findItemIndex(t);if(i.appendInPlace){const e=t.playout.start+t.event.duration;o(e+.001,"playout")}else e.advanceAfterAssetEnded(i,r,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&i)&&this.findItemIndex(t)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t,i;if(null===this.mediaSelection)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let n=this.media;!n&&null!=(e=this.bufferingItem)&&null!=(t=e.event)&&t.appendInPlace&&(n=this.primaryMedia);const s=null==(i=n)?void 0:i.currentTime;return void 0!==s&&yg(s)?s:void 0}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!(null==e||!e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,r=e.media;if(i&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r)return void(this.detachedData={media:r});const i=e.transferMedia();this.log("transfer MediaSource from ".concat(e," ").concat(pm(i))),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;if(e.media===t)return;let n=null;const s=this.hls,a=e!==s,o=a&&e.interstitial.appendInPlace,c=null==(i=this.detachedData)?void 0:i.mediaSource;let l;if(s.media)o&&(n=s.transferMedia(),this.detachedData=n),l="Primary";else if(c){const e=this.getBufferingPlayer();e?(n=e.transferMedia(),l="".concat(e)):l="detached MediaSource"}else l="detached media";if(!n)if(c)n=this.detachedData,this.log("using detachedData: MediaSource ".concat(pm(n)));else if(!this.detachedData||s.media===t){const e=this.playerQueue;e.length>1&&e.forEach(e=>{if(a&&e.interstitial.appendInPlace!==o){const t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn("Could not change append strategy for queued assets ".concat(t))}}),this.hls.detachMedia(),this.detachedData={media:t}}const d=n&&"mediaSource"in n&&"closed"!==(null==(r=n.mediaSource)?void 0:r.readyState),h=d&&n?n:t;if(this.log("".concat(d?"transfering MediaSource":"attaching media"," to ").concat(a?e:"Primary"," from ").concat(l)),h===n){const t=a&&e.assetId===this.schedule.assetIdAtEnd;h.overrides={duration:this.schedule.duration,endOfStream:!a||t,cueRemoval:!a}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e.events;if(!t||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const i=this.timelinePos,r=this.effectivePlayingItem;if(-1===i){const i=this.hls.startPosition;if(this.timelinePos=i,t.length&&t[0].cue.pre){const i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(i>=0||!this.primaryLive){const t=this.timelinePos=i>0?i:0,r=e.findItemIndexAtTime(t);this.setSchedulePosition(r)}}else if(r&&!this.playingItem){const t=e.findItemIndex(r);this.setSchedulePosition(t)}}advanceAfterAssetEnded(e,t,i){const r=yw(e,i);if(e.isAssetPastPlayoutLimit(r)){const i=this.schedule.items;if(i){const r=t+1;if(r>=i.length)return void this.setSchedulePosition(-1);const n=e.resumeTime;this.timelinePos=0?i[e]:null,n=this.playingItem,s=this.playingLastItem;if(this.isInterstitial(n)){var a;const c=n.event,l=this.playingAsset,d=null==l?void 0:l.identifier,h=d?this.getAssetPlayer(d):null;if(h&&d&&(!this.eventItemsMatch(n,r)||void 0!==t&&d!==(null==(a=c.assetList)?void 0:a[t].identifier))){var o;const t=c.findAssetIndex(l);if(this.log("INTERSTITIAL_ASSET_ENDED ".concat(t+1,"/").concat(c.assetList.length," ").concat(ww(l))),this.endedAsset=l,this.playingAsset=null,this.hls.trigger(Tg.INTERSTITIAL_ASSET_ENDED,{asset:l,assetListIndex:t,event:c,schedule:i.slice(0),scheduleIndex:e,player:h}),n!==this.playingItem)return void(this.itemsMatch(n,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),t));this.retreiveMediaSource(d,r),!h.media||null!=(o=this.detachedData)&&o.mediaSource||h.detachMedia()}if(!this.eventItemsMatch(n,r)&&(this.endedItem=n,this.playingItem=null,this.log("INTERSTITIAL_ENDED ".concat(c," ").concat(Ew(n))),c.hasPlayed=!0,this.hls.trigger(Tg.INTERSTITIAL_ENDED,{event:c,schedule:i.slice(0),scheduleIndex:e}),c.cue.once)){this.updateSchedule();const e=this.schedule.items;if(r&&e){const i=this.findItemIndex(r);this.advanceSchedule(i,e,t,n,s)}return}}this.advanceSchedule(e,i,t,n,s)}advanceSchedule(e,t,i,r,n){const s=e>=0?t[e]:null,a=this.primaryMedia,o=this.playerQueue;if(o.length&&o.forEach(t=>{const i=t.interstitial,r=this.schedule.findEventIndex(i.identifier);(re+1)&&this.clearInterstitial(i,s)}),this.isInterstitial(s)){this.timelinePos=Math.min(Math.max(this.timelinePos,s.start),s.end);const n=s.event;if(void 0===i){const t=yw(n,(i=this.schedule.findAssetIndex(n,this.timelinePos))-1);if(n.isAssetPastPlayoutLimit(t))return void this.advanceAfterAssetEnded(n,e,i);i=t}const o=this.waitingItem;this.assetsBuffered(s,a)||this.setBufferingItem(s);let c=this.preloadAssets(n,i);if(this.eventItemsMatch(s,o||r)||(this.waitingItem=s,this.log("INTERSTITIAL_STARTED ".concat(Ew(s)," ").concat(n.appendInPlace?"append in place":"")),this.hls.trigger(Tg.INTERSTITIAL_STARTED,{event:n,schedule:t.slice(0),scheduleIndex:e})),!n.assetListLoaded)return void this.log("Waiting for ASSET-LIST to complete loading ".concat(n));if(n.assetListLoader&&(n.assetListLoader.destroy(),n.assetListLoader=void 0),!a)return void this.log("Waiting for attachMedia to start Interstitial ".concat(n));this.waitingItem=this.endedItem=null,this.playingItem=s;const l=n.assetList[i];if(!l){const r=t[e+1],s=this.media;return r&&s&&!this.isInterstitial(r)&&s.currentTime=e.end)&&(i=this.getPrimaryResumption(e,t),this.timelinePos=i),this.attachPrimary(i,e)}if(!i)return;const n=this.schedule.items;n&&(this.log("INTERSTITIALS_PRIMARY_RESUMED ".concat(Ew(e))),this.hls.trigger(Tg.INTERSTITIALS_PRIMARY_RESUMED,{schedule:n.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(ie.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);if(null!=t&&t.hls)return t.hls.bufferedToEnd;return cv.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs(((null==(i=r.mainForwardBufferInfo)?void 0:i.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(Tg.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(Tg.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level)return;const i=this.hls.levels[t.level],r=Fg(Fg({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r)return void(this.altSelection=Fg(Fg({},this.altSelection),{},{audio:i}));const n=Fg(Fg({},r),{},{audio:i});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r)return void(this.altSelection=Fg(Fg({},this.altSelection),{},{subtitles:i}));const n=Fg(Fg({},r),{},{subtitles:i});this.mediaSelection=n}onAudioTrackSwitching(e,t){const i=mm(t);this.playerQueue.forEach(e=>e.hls.setAudioOption(t)||e.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,t){const i=mm(t);this.playerQueue.forEach(e=>e.hls.setSubtitleOption(t)||-1!==t.id&&e.hls.setSubtitleOption(i))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((t,i)=>{e.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(t.identifier,null)});const t=e.end+.25,i=cv.bufferInfo(this.primaryMedia,t,0);(i.end>t||(i.nextStart||0)>t)&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.identifier))}findItemIndex(e,t){return e?this.schedule.findItemIndex(e,t):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const t=this.schedule.items;if(!t)return;const i=cv.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,t,e)}updateBufferedPos(e,t,i){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e)return;if(1===t.length&&this.itemsMatch(t[0],n))return void(this.bufferedPos=e);const s=this.playingItem,a=this.findItemIndex(s);let o=r.findItemIndexAtTime(e);if(this.bufferedPos=n.end||null!=(c=s.event)&&c.appendInPlace&&e+.01>=s.start)&&(o=r),r-a>1&&!1===(null==n||null==(l=n.event)?void 0:l.appendInPlace))return;if(this.bufferedPos=e,o>i&&o>a)this.bufferedToItem(s);else{const t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&s.start{const i=this.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,t))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:r,events:n}=i;if(!r||!n)return t;const s=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const o=a?a.remaining:t?t.end-this.timelinePos:0;this.log("INTERSTITIALS_BUFFERED_TO_BOUNDARY ".concat(Ew(e))+(t?" (".concat(o.toFixed(2)," remaining)"):"")),this.playbackDisabled||(s?e.event.assetList.forEach(e=>{const t=this.getAssetPlayer(e.identifier);t&&t.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering()))),this.hls.trigger(Tg.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;const t=this.detachedData;if(t)if(t.mediaSource){const t=!0;this.attachPrimary(e.start,e,t)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,r=0===i.assetList.length&&!i.assetListLoader,n=i.cue.once;if(r||!n){const e=this.preloadAssets(i,t);if(null!=e&&e.interstitial.appendInPlace){const r=i.assetList[t],n=this.primaryMedia;r&&n&&this.bufferAssetPlayer(e,n)}}}preloadAssets(e,t){const i=e.assetUrl,r=e.assetList.length,n=0===r&&!e.assetListLoader,s=e.cue.once;if(n){const n=e.timelineStart;if(e.appendInPlace){var a;const t=this.playingItem;this.isInterstitial(t)||(null==t||null==(a=t.nextEvent)?void 0:a.identifier)!==e.identifier||this.flushFrontBuffer(n+.25)}let s,o=0;if(!this.playingItem&&this.primaryLive&&(o=this.hls.startPosition,-1===o&&(o=this.hls.liveSyncPosition||0)),o&&!e.cue.pre&&!e.cue.post){const e=o-n;e>0&&(s=Math.round(1e3*e)/1e3)}if(this.log("Load interstitial asset ".concat(t+1,"/").concat(i?1:r," ").concat(e).concat(s?" live-start: ".concat(o," start-offset: ").concat(s):"")),i)return this.createAsset(e,0,0,n,e.duration,i);const c=this.assetListLoader.loadAssetList(e,s);c&&(e.assetListLoader=c)}else if(!s&&r){for(let i=t;i{this.hls.trigger(Tg.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i1){const i=t.duration;i&&e{if(r.live){const t=new Error("Interstitials MUST be VOD assets ".concat(e)),r={fatal:!0,type:xg.OTHER_ERROR,details:Eg.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};return void this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),i,t.message)}const n=r.edge-r.fragmentStart,s=t.duration;(null===s||n>s)&&(this.log('Interstitial asset "'.concat(d,'" duration change ').concat(s," > ").concat(n)),t.duration=n,this.updateSchedule())};p.on(Tg.LEVEL_UPDATED,(e,t)=>{let{details:i}=t;return g(i)}),p.on(Tg.LEVEL_PTS_UPDATED,(e,t)=>{let{details:i}=t;return g(i)});const f=(e,t)=>{const i=this.getAssetPlayer(d);if(i&&t.tracks){i.off(Tg.BUFFER_CODECS,f),i.tracks=t.tracks;const e=this.primaryMedia;this.bufferingAsset===i.assetItem&&e&&!i.media&&this.bufferAssetPlayer(i,e)}};p.on(Tg.BUFFER_CODECS,f);const m=()=>{var i;const r=this.getAssetPlayer(d);if(this.log("buffered to end of asset ".concat(r)),!r)return;const n=this.schedule.findEventIndex(e.identifier),s=null==(i=this.schedule.items)?void 0:i[n];if(this.isInterstitial(s)){const i=e.findAssetIndex(t),r=yw(e,i);if(e.isAssetPastPlayoutLimit(r)){var a;const e=null==(a=this.schedule.items)?void 0:a[n+1];e&&this.bufferedToItem(e)}else this.bufferedToItem(s,r)}};p.on(Tg.BUFFERED_TO_END,m);const v=t=>()=>{if(!this.getAssetPlayer(d))return;this.shouldPlay=!0;const i=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,t)};return p.once(Tg.MEDIA_ENDED,v(i)),p.once(Tg.PLAYOUT_LIMIT_REACHED,v(1/0)),p.on(Tg.ERROR,(t,r)=>{const n=this.getAssetPlayer(d);if(r.details!==Eg.BUFFER_STALLED_ERROR)this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),i,"Asset player error ".concat(r.error," ").concat(e));else if(null!=n&&n.media){const t=n.currentTime,i=n.duration-t;t&&e.appendInPlace&&i/n.media.playbackRate<.5?(this.log("Advancing buffer past end of asset ".concat(d," ").concat(e," at ").concat(n.media.currentTime)),m()):(this.warn("Stalled at ".concat(t," of ").concat(t+i," in asset ").concat(d," ").concat(e)),this.onTimeupdate(),this.checkBuffer(!0))}}),p.on(Tg.DESTROYING,()=>{if(!this.getAssetPlayer(d))return;const t=new Error("Asset player destroyed unexpectedly ".concat(d)),r={fatal:!0,type:xg.OTHER_ERROR,details:Eg.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(r,e,this.schedule.findEventIndex(e.identifier),i,t.message)}),this.log("INTERSTITIAL_ASSET_PLAYER_CREATED ".concat(ww(t))),this.hls.trigger(Tg.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:p}),p}clearInterstitial(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log('reset asset player "'.concat(e,'" after error'));const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(-1!==i){this.log('clear asset player "'.concat(e,'" toSegment: ').concat(t?Ew(t):t));const r=this.playerQueue[i];this.transferMediaFromPlayer(r,t),this.playerQueue.splice(i,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,r,n){const{interstitial:s,assetItem:a,assetId:o}=e,c=s.assetList.length,l=this.playingAsset;this.endedAsset=null,this.playingAsset=a,l&&l.identifier===o||(l&&(this.clearAssetPlayer(l.identifier,i[r]),delete l.error),this.log("INTERSTITIAL_ASSET_STARTED ".concat(t+1,"/").concat(c," ").concat(ww(a))),this.hls.trigger(Tg.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:s,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var i,r;const{interstitial:n,assetItem:s}=e,a=this.schedule.findEventIndex(n.identifier),o=null==(i=this.schedule.items)?void 0:i[a];if(!o)return;this.setBufferingItem(o),this.bufferingAsset=s;const c=this.getBufferingPlayer();if(c===e)return;const l=n.appendInPlace;if(l&&!1===(null==c?void 0:c.interstitial.appendInPlace))return;const d=(null==c?void 0:c.tracks)||(null==(r=this.detachedData)?void 0:r.tracks)||this.requiredTracks;if(l&&s!==this.playingAsset){if(!e.tracks)return;if(d&&!qg(d,e.tracks)){const t=new Error("Asset ".concat(ww(s)," SourceBuffer tracks ('").concat(Object.keys(e.tracks),"') are not compatible with primary content tracks ('").concat(Object.keys(d),"')")),i={fatal:!0,type:xg.OTHER_ERROR,details:Eg.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},r=n.findAssetIndex(s);return void this.handleAssetItemError(i,n,a,r,t.message)}}this.transferMediaTo(e,t)}handleAssetItemError(e,t,i,r,n){if(e.details===Eg.BUFFER_STALLED_ERROR)return;const s=t.assetList[r];this.warn("INTERSTITIAL_ASSET_ERROR ".concat(s?ww(s):s," ").concat(e.error));const a=null==s?void 0:s.identifier,o=this.getAssetPlayerQueueIndex(a),c=this.playerQueue[o]||null,l=this.schedule.items,d=Ng({},e,{fatal:!1,errorAction:jm(!0),asset:s,assetListIndex:r,event:t,schedule:l,scheduleIndex:i,player:c});if(this.hls.trigger(Tg.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const h=this.playingAsset,u=new Error(n);if(s&&(this.clearAssetPlayer(a,null),s.error=u),t.assetList.some(e=>!e.error)){for(let e=r;e"," error: ").concat(e.error));let r=this.timelinePos;-1===r&&(r=this.hls.startPosition);const n=this.updateItem(i,r);this.itemsMatch(i,n)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));const s=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(e,t){var i;const r=t.event,n=r.identifier,s=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(n))return;const a=r.timelineStart,o=r.duration;let c=0;s.forEach((e,t)=>{const i=parseFloat(e.DURATION);this.createAsset(r,t,c,a+c,i,e.URI),c+=i}),r.duration=c,this.log("Loaded asset-list with duration: ".concat(c," (was: ").concat(o,") ").concat(r));const l=this.waitingItem,d=(null==l?void 0:l.event.identifier)===n;this.updateSchedule();const h=null==(i=this.bufferingItem)?void 0:i.event;if(d){var u;const e=this.schedule.findEventIndex(n),t=null==(u=this.schedule.items)?void 0:u[e];if(t){if(!this.playingItem&&this.timelinePos>t.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==e)return r.error=new Error("Interstitial no longer within playback range ".concat(this.timelinePos," ").concat(r)),void this.primaryFallback(r)}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==h?void 0:h.identifier)===n&&h.appendInPlace){const e=r.assetList[0],t=this.getAssetPlayer(e.identifier),i=this.primaryMedia;e&&t&&i&&this.bufferAssetPlayer(t,i)}}onError(e,t){switch(t.details){case Eg.ASSET_LIST_PARSING_ERROR:case Eg.ASSET_LIST_LOAD_ERROR:case Eg.ASSET_LIST_LOAD_TIMEOUT:{const e=t.interstitial;e&&this.primaryFallback(e);break}case Eg.BUFFER_STALLED_ERROR:this.onTimeupdate(),this.checkBuffer(!0)}}}});function LS(e){return e&&"object"===typeof e?Array.isArray(e)?e.map(LS):Object.keys(e).reduce((t,i)=>(t[i]=LS(e[i]),t),{}):e}function IS(e,t){const i=e.loader;if(i!==TS&&i!==AS)t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=TS,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class MS extends sv{constructor(e,t){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var e;this.hls&&(this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(Tg.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;const i=this.media=t.media;nw(i,"playing",this.onMediaPlaying),nw(i,"waiting",this.onMediaWaiting),nw(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(sw(i,"playing",this.onMediaPlaying),sw(i,"waiting",this.onMediaWaiting),sw(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(null==(e=this.media)||!e.readyState||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,r;const n=null==(i=this.hls)?void 0:i.config;if(!n)return;const s=this.media;if(!s)return;const{seeking:a}=s,o=this.seeking&&!a,c=!this.seeking&&a,l=s.paused&&!a||s.ended||0===s.playbackRate;if(this.seeking=a,e!==t)return t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!l&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(c||o)return void(o&&this.stallResolved(e));if(l)return this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(Tg.MEDIA_ENDED,{stalled:!1})));if(!cv.getBuffered(s).length)return void(this.nudgeRetry=0);const d=cv.bufferInfo(s,e,0),h=d.nextStart||0,u=this.fragmentTracker;if(a&&u&&this.hls){const t=DS(this.hls.inFlightFragments,e),i=d.len>2,r=!h||t||h-e>2&&!u.getPartialFragment(e);if(i||r)return;this.moved=!1}const p=null==(r=this.hls)?void 0:r.latestLevelDetails;if(!this.moved&&null!==this.stalled&&u){if(!(d.len>0)&&!h)return;const t=Math.max(h,d.start||0)-e,i=!(null==p||!p.live)?2*p.targetduration:2,r=u.getPartialFragment(e);if(t>0&&(t<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const g=n.detectStallWithCurrentTimeMs,f=self.performance.now(),m=this.waiting;let v=this.stalled;if(null===v){if(!(m>0&&f-m=g||m)&&this.hls){var k;if("ended"===(null==(k=this.mediaSource)?void 0:k.readyState)&&(null==p||!p.live)&&Math.abs(e-((null==p?void 0:p.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(Tg.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(d),!this.media||!this.hls)return}const y=cv.bufferInfo(s,e,n.maxBufferHole);this._tryFixBufferStall(y,b,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log("playback not stuck anymore @".concat(e,", after ").concat(Math.round(i),"ms")),this.stallReported=!1,this.waiting=0,this.hls.trigger(Tg.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&r&&r.length>1&&e>r.end(0)){const i=cv.bufferedInfo(cv.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const i=cv.timeRangesToArray(r),n=cv.bufferedInfo(i,t,0).bufferedIndex;if(n>-1&&nn)&&s-r<1&&e-r<2){const i=new Error("nudging playhead to flush pipeline after video hole. currentTime: ".concat(e," hole: ").concat(r," -> ").concat(s," buffered index: ").concat(t));this.warn(i.message),this.media.currentTime+=1e-6;const n=this.fragmentTracker.getPartialFragment(e)||void 0,a=cv.bufferInfo(this.media,e,0);this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:n,buffer:a.len,bufferInfo:a})}}}}}_tryFixBufferStall(e,t,i){var r,n;const{fragmentTracker:s,media:a}=this,o=null==(r=this.hls)?void 0:r.config;if(!a||!s||!o)return;const c=null==(n=this.hls)?void 0:n.latestLevelDetails,l=s.getPartialFragment(i);if(l||null!=c&&c.live&&i1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-i1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,r=e.nextStart;if(i&&r){const e=i.getFragAtPos(t,Rg),n=i.getFragAtPos(r,Rg);if(e&&n)return n.sn-e.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:r,stalled:n}=this;if(!r&&null!==n&&i&&t){this.stallReported=!0;const r=new Error("Playback stalling at @".concat(i.currentTime," due to low buffer (").concat(pm(e),")"));this.warn(r.message),t.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:r}=this,n=null==(t=this.hls)?void 0:t.config;if(!r||!i||!n)return 0;const s=r.currentTime,a=cv.bufferInfo(r,s,0),o=s0&&a.len<1&&r.readyState<3,d=o-s;if(d>0&&(t||l)){if(d>n.maxBufferHole){let t=!1;if(0===s){const e=i.getAppendedFrag(0,Rg);e&&o{const e=NS();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function jS(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class BS{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(Tg.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Tg.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tg.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Tg.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Tg.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,t){var i;this.media=t.media,!1===(null==(i=t.overrides)?void 0:i.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null;!!t.transferMedia||(this.id3Track&&(this.removeCues&&dw(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tFS&&(r=FS);r-i<=0&&(r=i+.25);for(let n=0;ne.type===pk.audioId3&&c:"video"===n?e=>e.type===pk.emsg&&o:e=>e.type===pk.audioId3&&c||e.type===pk.emsg&&o,hw(s,i,r,e)}}onLevelUpdated(e,t){let{details:i}=t;this.updateDateRangeCues(i,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:r}=e,n=Object.keys(r);let s=this.dateRangeCuesAppended;var a;if(i&&t)if(null!=(a=i.cues)&&a.length){const e=Object.keys(s).filter(e=>!n.includes(e));for(let t=e.length;t--;){const r=e[t],n=s[r].cues;delete s[r],Object.keys(n).forEach(e=>{try{const t=n[e];t.removeEventListener("enter",this.onEventCueEnter),i.removeCue(t)}catch(t){}})}}else s=this.dateRangeCuesAppended={};const o=e.fragments[e.fragments.length-1];if(0===n.length||!yg(null==o?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const c=NS();for(let l=0;l{if(i!==t.id){const n=r[i];if(n.class===t.class&&n.startDate>t.startDate&&(!e||t.startDate.01&&(s.startTime=i,s.endTime=h);else if(c){let r=t.attr[n];bv(n)&&(r=jS(r));const s=US(c,i,h,{key:n,data:r},pk.dateRange);s&&(s.id=e,this.id3Track.addCue(s),o[n]=s,this.hls.config.interstitialsController&&("X-ASSET-LIST"!==n&&"X-ASSET-URL"!==n||s.addEventListener("enter",this.onEventCueEnter)))}}s[e]={cues:o,dateRange:t,durationKnown:d}}}}class VS{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||1===n||!t.live)return;const s=this.targetLatency;if(null===s)return;const a=i-s;if(a.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,n)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,r=Math.min(t,Math.max(1,i));this.changeMediaPlaybackRate(e,r)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(null===e||null===this.hls)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let c=a&&i||t;(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===c)&&(c=void 0!==n?n:s*r);const l=r;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,l)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;const i=this.levelDetails;if(null===i)return null;const r=i.edge,n=e-t-this.edgeStalled,s=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(s,n),a)}get drift(){const e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Tg.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Tg.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tg.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Tg.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,t){let{details:i}=t;i.advanced&&this.onTimeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===Eg.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,r;e.playbackRate!==t&&(null==(i=this.hls)||i.logger.debug("[latency-controller]: latency=".concat(this.latency.toFixed(3),", targetLatency=").concat(null==(r=this.targetLatency)?void 0:r.toFixed(3),", forwardBufferLength=").concat(this.forwardBufferLength.toFixed(3),": adjusting playback rate from ").concat(e.playbackRate," to ").concat(t)),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class zS extends gy{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Tg.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tg.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Tg.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,r=[],n={},s={};let a=!1,o=!1,c=!1;t.levels.forEach(e=>{const t=e.attrs;let{audioCodec:l,videoCodec:d}=e;l&&(e.audioCodec=l=Gf(l,i)||void 0),d&&(d=e.videoCodec=function(e){const t=e.split(",");for(let i=0;i2&&"avc1"===e[0]&&(t[i]="avc1.".concat(parseInt(e[1]).toString(16)).concat(("000"+parseInt(e[2]).toString(16)).slice(-4)))}return t.join(",")}(d));const{width:h,height:u,unknownCodecs:p}=e;let g=p?p.length:0;if(p)for(let i=g;i--;){const t=p[i];this.isAudioSupported(t)?(e.audioCodec=l=l?"".concat(l,",").concat(t):t,g--,Nf.audio[l.substring(0,4)]=2):this.isVideoSupported(t)&&(e.videoCodec=d=d?"".concat(d,",").concat(t):t,g--,Nf.video[d.substring(0,4)]=2)}if(a||(a=!(!h||!u)),o||(o=!!d),c||(c=!!l),g||l&&!this.isAudioSupported(l)||d&&!this.isVideoSupported(d))return void this.log('Some or all CODECS not supported "'.concat(t.CODECS,'"'));const{CODECS:f,"FRAME-RATE":m,"HDCP-LEVEL":v,"PATHWAY-ID":b,RESOLUTION:k,"VIDEO-RANGE":y}=t,w="".concat(b||".","-"),S="".concat(w).concat(e.bitrate,"-").concat(k,"-").concat(m,"-").concat(f,"-").concat(y,"-").concat(v);if(n[S])if(n[S].uri===e.url||e.attrs["PATHWAY-ID"])n[S].addGroupId("audio",t.AUDIO),n[S].addGroupId("text",t.SUBTITLES);else{const t=s[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=this.createLevel(e);n[S]=i,r.push(i)}else{const t=this.createLevel(e);n[S]=t,s[S]=1,r.push(t)}}),this.filterAndSortMediaOptions(r,t,a,o,c)}createLevel(e){const t=new dm(e),i=e.supplemental;if(null!=i&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const e=new Error('SUPPLEMENTAL-CODECS not supported "'.concat(i.videoCodec,'"'));this.log(e.message),t.supportedResult=Qf(e,[])}return t}isAudioSupported(e){return Ff(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Ff(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,r,n){let s=[],a=[],o=e;if((i||r)&&n&&(o=o.filter(e=>{let{videoCodec:t,videoRange:i,width:r,height:n}=e;return(!!t||!(!r||!n))&&(!!(s=i)&&nm.indexOf(s)>-1);var s})),0===o.length)return void Promise.resolve().then(()=>{if(this.hls){let e="no level with compatible codecs found in manifest",i=e;t.levels.length&&(i="one or more CODECS in variant not supported: ".concat(pm(t.levels.map(e=>e.attrs.CODECS).filter((e,t,i)=>i.indexOf(e)===t))),this.warn(i),e+=" (".concat(i,")"));const r=new Error(e);this.hls.trigger(Tg.ERROR,{type:xg.MEDIA_ERROR,details:Eg.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:i})}});t.audioTracks&&(s=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),HS(s)),t.subtitles&&(a=t.subtitles,HS(a));const c=o.slice(0);o.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return nm.indexOf(e.videoRange)-nm.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=Vf(e.videoCodec),r=Vf(t.videoCodec);if(i!==r)return r-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=zf(e.codecSet),r=zf(t.codecSet);if(i!==r)return r-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let l=c[0];if(this.steering&&(o=this.steering.filterParsedLevels(o),o.length!==c.length))for(let f=0;ft&&t===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=i)}break}const h=n&&!r,u=this.hls.config,p=!(!u.audioStreamController||!u.audioTrackController),g={levels:o,audioTracks:s,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:p&&!h&&s.some(e=>!!e.url)};this.hls.trigger(Tg.MANIFEST_PARSED,g)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),r=e<0;if(this.hls.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:i,reason:i.message}),r)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,s=t[e],a=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,i===e&&r&&n===a)return;this.log("Switching to level ".concat(e," (").concat(s.height?s.height+"p ":"").concat(s.videoRange?s.videoRange+" ":"").concat(s.codecSet?s.codecSet+" ":"","@").concat(s.bitrate,")").concat(a?" with Pathway "+a:""," from level ").concat(i).concat(n?" with Pathway "+n:""));const o={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(Tg.LEVEL_SWITCHING,o);const c=s.details;if(!c||c.live){const e=this.switchParams(s.uri,null==r?void 0:r.details,c);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(e=>-1!==t.indexOf(e));if(e.length<1)return void this.warn("pathwayPriority ".concat(e," should contain at least one pathway from list: ").concat(t));this.steering.pathwayPriority=i}}onError(e,t){!t.fatal&&t.context&&t.context.type===Pg&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,t){let{frag:i}=t;if(void 0!==i&&i.type===Rg){const e=i.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;const t=this._levels[i.level];null!=t&&t.loadError&&(this.log("Resetting level error count of ".concat(t.loadError," on frag buffered")),t.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,s=t.levelInfo;var a;if(!s)return this.warn("Invalid level index ".concat(r)),void(null!=(a=t.deliveryDirectives)&&a.skip&&(n.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let e=s.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(r,t,e)}else null!=(i=t.deliveryDirectives)&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],s=e.details,a=null==s?void 0:s.age;this.log("Loading level index ".concat(r).concat(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"").concat(n?" Pathway "+n:"").concat(a&&s.live?" age "+a.toFixed(1)+(s.type?" "+s.type||0:""):""," ").concat(i)),this.hls.trigger(Tg.LEVEL_LOADING,{url:i,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;const i=this._levels.filter((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));bb(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=i.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(Tg.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,t){let{levels:i}=t;this._levels=i}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Tg.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function HS(e){const t={};e.forEach(e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}function $S(){return self.SourceBuffer||self.WebKitSourceBuffer}function GS(){if(!Wg())return!1;const e=$S();return!e||e.prototype&&"function"===typeof e.prototype.appendBuffer&&"function"===typeof e.prototype.remove}class WS extends Ub{constructor(e,t,i){super(e,t,i,"stream-controller",Rg),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const e=this.media,t=e?e.currentTime:null;if(null===t||!yg(t))return;if(this.log("Media seeked to ".concat(t.toFixed(3))),!this.getBufferedFrag(t))return;const i=this.getFwdBufferInfoAtPos(e,t,Rg,0);null!==i&&0!==i.len?this.tick():this.warn("Main forward buffer length at ".concat(t,' on "seeked" event ').concat(i?i.len:"empty",")"))},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tg.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(Tg.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Tg.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(Tg.BUFFER_CREATED,this.onBufferCreated,this),e.on(Tg.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tg.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Tg.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tg.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tg.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(Tg.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Tg.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(Tg.BUFFER_CREATED,this.onBufferCreated,this),e.off(Tg.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tg.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=r.startLevel;-1===e&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}i>0&&-1===e&&!t&&(this.log("Override startPosition with lastCurrentTime @".concat(i.toFixed(3))),e=i),this.state=_b,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Tb}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Nb:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(r&&(!r.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(r))break;this.state=_b;break}if(this.hls.nextLoadLevel!==this.level){this.state=_b;break}break}case Ab:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=_b}}}this.state===_b&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(null===t||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(null==i||!i[n])return;const s=i[n],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const e={};return 2===this.altAudio&&(e.type="video"),this.hls.trigger(Tg.BUFFER_EOS,e),void(this.state=Mb)}if(!this.buffering)return;e.loadLevel!==n&&-1===e.manualLevel&&this.log("Adapting to level ".concat(n," from level ").concat(this.level)),this.level=e.nextLoadLevel=n;const c=s.details;if(!c||this.state===Nb||this.waitForLive(s))return this.level=n,this.state=Nb,void(this.startFragRequested=!1);const l=a.len,d=this.getMaxBufferLength(s.maxBitrate);if(l>=d)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(h,c);if(this.couldBacktrack&&!this.fragPrevious&&u&&af(u)&&this.fragmentTracker.getState(u)!==Hm){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-c.startSN,t=c.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,h)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?tf:rf,t=(e===rf?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Rg)}u=this.getNextFragmentLoopLoading(u,c,a,Rg,d)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,s,h))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);r===Bm||r===zm?af(e)?this.bitrateTest?(this.log("Fragment ".concat(e.sn," of level ").concat(e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Rg)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(null!=n&&n.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*n.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;i=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else i=0;const s=this.getBufferedFrag(t.currentTime+i);if(s){const e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,r=Math.max(s.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Pb:case Cb:case Ab:case Lb:case Ib:this.state=_b}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;nw(i,"playing",this.onMediaPlaying),nw(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(sw(i,"playing",this.onMediaPlaying),sw(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t);!!t.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(Tg.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),r=r||-1!==t.indexOf("mp4a.40.5"))}),this.audioCodecSwitch=i&&r&&!function(){var e;const t=$S();return"function"===typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==_b)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Nb)}onLevelLoaded(e,t){var i;const{levels:r,startFragRequested:n}=this,s=t.level,a=t.details,o=a.totalduration;if(!r)return void this.warn("Levels were reset while loading level ".concat(s));this.log("Level ".concat(s," loaded [").concat(a.startSN,",").concat(a.endSN,"]").concat(a.lastPartSn?"[part-".concat(a.lastPartSn,"-").concat(a.lastPartIndex,"]"):"",", cc [").concat(a.startCC,", ").concat(a.endCC,"] duration:").concat(o));const c=t.levelInfo,l=this.fragCurrent;!l||this.state!==Cb&&this.state!==Ab||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(a.live||null!=(i=c.details)&&i.live){var h;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,c.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(c.details=a,this.levelLastLoaded=c,n||this.setStartPosition(a,d),this.hls.trigger(Tg.LEVEL_UPDATED,{details:a,level:s}),this.state===Nb){if(this.waitForCdnTuneIn(a))return;this.state=_b}n&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=this.getLoadPosition(),s=e.fragmentStart,a=e.edge,o=n>=s-t.maxFragLookUpTolerance&&n<=a;if(null!==r&&i.duration>r&&(n{var e;null==(e=this.hls)||e.trigger(Tg.AUDIO_TRACK_SWITCHED,t)}),void i.trigger(Tg.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});i.trigger(Tg.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=wm(t.url,this.hls);if(i){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,s=!1;for(const a in i){const e=i[a];if("main"===e.id){if(n=a,r=e,"video"===a){const e=i[a];e&&(this.videoBuffer=e.buffer)}}else s=!0}s&&r?(this.log("Alternate track found, use ".concat(n,".buffered to schedule main fragment loading")),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t,n=i.type===Rg;if(n){if(this.fragContextChanged(i))return this.warn("Fragment ".concat(i.sn).concat(r?" p: "+r.index:""," of level ").concat(i.level," finished buffering, but was aborted. state: ").concat(this.state)),void(this.state===Ib&&(this.state=_b));const e=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),af(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}const s=this.media;s&&(!this._hasEnoughToStart&&cv.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal)this.state=Db;else switch(t.details){case Eg.FRAG_GAP:case Eg.FRAG_PARSING_ERROR:case Eg.FRAG_DECRYPT_ERROR:case Eg.FRAG_LOAD_ERROR:case Eg.FRAG_LOAD_TIMEOUT:case Eg.KEY_LOAD_ERROR:case Eg.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Rg,t);break;case Eg.LEVEL_LOAD_ERROR:case Eg.LEVEL_LOAD_TIMEOUT:case Eg.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Nb||(null==(i=t.context)?void 0:i.type)!==Pg||(this.state=_b);break;case Eg.BUFFER_ADD_CODEC_ERROR:case Eg.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Eg.BUFFER_FULL_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Eg.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=_b,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,t){let{type:i}=t;if(i!==tf||!this.altAudio){const e=(i===rf?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,i,Rg),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(o{const{hls:i}=this,r=null==e?void 0:e.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=_b,this.startFragRequested=!1,this.bitrateTest=!1;const n=r.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),i.trigger(Tg.FRAG_LOADED,e),r.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i=this.playlistType,{hls:r}=this,{remuxResult:n,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:c,level:l}=a,{video:d,text:h,id3:u,initSegment:p}=n,{details:g}=l,f=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Lb,p){if(null!=p&&p.tracks){const e=o.initSegment||o;this._bufferInitSegment(l,p.tracks,e,s),r.trigger(Tg.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale,n=this.initPTS[o.cc];!yg(e)||n&&n.baseTime===e&&n.timescale===t||(this.initPTS[o.cc]={baseTime:e,timescale:t},r.trigger(Tg.INIT_PTS_FOUND,{frag:o,id:i,initPTS:e,timescale:t}))}if(d&&g){f&&"audiovideo"===d.type&&this.logMuxedErr(o);const e=g.fragments[o.sn-1-g.startSN],t=o.sn===g.startSN,i=!e||o.cc>e.cc;if(!1!==n.independent){const{startPTS:e,endPTS:r,startDTS:n,endDTS:a}=d;if(c)c.elementaryStreams[d.type]={startPTS:e,endPTS:r,startDTS:n,endDTS:a};else if(d.firstKeyFrame&&d.independent&&1===s.id&&!i&&(this.couldBacktrack=!0),d.dropped&&d.independent){const n=this.getMainFwdBufferInfo(),s=(n?n.end:this.getLoadPosition())+this.config.maxBufferHole,c=d.firstKeyFramePTS?d.firstKeyFramePTS:e;if(!t&&s2&&(o.gap=!0);o.setElementaryStreamInfo(d.type,e,r,n,a),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(d,o,c,s,t||i)}else{if(!t&&!i)return void this.backtrack(o);o.gap=!0}}if(f){const{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=f;c&&(c.elementaryStreams[tf]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(tf,e,t,i,r),this.bufferFragmentData(f,o,c,s)}if(g&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:o,details:g,samples:u.samples};r.trigger(Tg.FRAG_PARSING_METADATA,e)}if(g&&h){const e={id:i,frag:o,details:g,samples:h.samples};r.trigger(Tg.FRAG_PARSING_USERDATA,e)}}}logMuxedErr(e){this.warn("".concat(af(e)?"Media":"Init"," segment with muxed audiovideo where only video expected: ").concat(e.url))}_bufferInitSegment(e,t,i,r){if(this.state!==Lb)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:n,video:s,audiovideo:a}=t;if(n){const i=e.audioCodec;let r=Wf(n.codec,i);"mp4a"===r&&(r="mp4a.40.5");const s=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){r&&(r=-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=n.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===s.indexOf("firefox")&&(r="mp4a.40.5")}r&&-1!==r.indexOf("mp4a.40.5")&&-1!==s.indexOf("android")&&"audio/mpeg"!==n.container&&(r="mp4a.40.2",this.log("Android: force audio codec to ".concat(r))),i&&i!==r&&this.log('Swapping manifest audio codec "'.concat(i,'" for "').concat(r,'"')),n.levelCodec=r,n.id=Rg,this.log("Init audio buffer, container:".concat(n.container,", codecs[selected/level/parsed]=[").concat(r||"","/").concat(i||"","/").concat(n.codec,"]")),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=Rg;const i=s.codec;if(4===(null==i?void 0:i.length))switch(i){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log("Init video buffer, container:".concat(s.container,", codecs[level/parsed]=[").concat(e.videoCodec||"","/").concat(i,"]").concat(s.codec!==i?" parsed-corrected="+s.codec:"").concat(s.supplemental?" supplemental="+s.supplemental:"")),delete t.audiovideo}a&&(this.log("Init audiovideo buffer, container:".concat(a.container,", codecs[level/parsed]=[").concat(e.codecs,"/").concat(a.codec,"]")),delete t.video,delete t.audio);const o=Object.keys(t);if(o.length){if(this.hls.trigger(Tg.BUFFER_CODECS,t),!this.hls)return;o.forEach(e=>{const n=t[e].initSegment;null!=n&&n.byteLength&&this.hls.trigger(Tg.BUFFER_APPENDING,{type:e,data:n,frag:i,part:null,chunkMeta:r,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Rg)}get maxBufferLength(){const{levels:e,level:t}=this,i=null==e?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=_b}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(cv.isBuffered(e,i)?t=this.getAppendedFrag(i):cv.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(Tg.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(Tg.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return yg(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(yg(t)){const e=this.getLevelDetails(),i=this.currentFrag||(e?xm(null,e.fragments,t):null);if(i){const e=i.programDateTime;if(null!==e){const r=e+1e3*(t-i.start);return new Date(r)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class qS{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==(null==(t=r.context)?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Eg.KEY_LOAD_ERROR,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;return new nv({type:xg.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length)if(t.length){const{sn:i,cc:r}=e;for(let e=0;e{if(n.setKeyFormat(e),this.emeController&&this.config.requireKeySystemAccessOnStart){const t=Iv(e);if(t)return this.emeController.getKeySystemAccess([t])}})}}else if(this.config.requireKeySystemAccessOnStart){const e=jv(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const i=new Error(t?"Expected frag.decryptdata to be defined after setting format ".concat(t):"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Eg.KEY_LOAD_ERROR,i))}const s=n.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,Eg.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(s,'"'))));let a=this.keyUriToKeyInfo[s];if(null!=(i=a)&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});var o;if(null!=(r=a)&&r.keyLoadPromise)switch(null==(o=a.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(t=>(n.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}switch(a=this.keyUriToKeyInfo[s]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===n.keyFormat?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Eg.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(n.method,'"'))))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then(t=>(e.mediaKeySessionContext=t,i))).catch(t=>{throw e.keyLoadPromise=null,t})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=new(0,i.loader)(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((n,s)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=i.keyLoadPolicy.default,c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},l={onSuccess:(e,t,i,r)=>{const{frag:a,keyInfo:o,url:c}=i;if(!a.decryptdata||o!==this.keyUriToKeyInfo[c])return s(this.createKeyLoadError(a,Eg.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),r));o.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,o.loader=null,n({frag:a,keyInfo:o})},onError:(e,i,r,n)=>{this.resetLoader(i),s(this.createKeyLoadError(t,Eg.KEY_LOAD_ERROR,new Error("HTTP Error ".concat(e.code," loading key ").concat(e.text)),r,Fg({url:a.url,data:void 0},e)))},onTimeout:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,Eg.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),r))},onAbort:(e,i,r)=>{this.resetLoader(i),s(this.createKeyLoadError(t,Eg.INTERNAL_ABORTED,new Error("key loading aborted"),r))}};r.load(a,c,l)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function KS(e){const{type:t}=e;switch(t){case Cg:return Lg;case Ag:return Ig;default:return Rg}}function ZS(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class YS{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tg.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Tg.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(Tg.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tg.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tg.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Tg.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(Tg.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=new(i||r)(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:_g,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:s,deliveryDirectives:a,levelInfo:o}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:Pg,url:s,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:s,track:a}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Cg,url:n,deliveryDirectives:s,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:s,track:a}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Ag,url:n,deliveryDirectives:s,levelOrTrack:a})}onLevelsUpdated(e,t){const i=this.loaders[Pg];if(i){const e=i.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(i.abort(),delete this.loaders[Pg])}}load(e){var t;const i=this.hls.config;let r,n=this.getInternalLoader(e);if(n){const t=this.hls.logger,i=n.context;if(i&&i.levelOrTrack===e.levelOrTrack&&(i.url===e.url||i.deliveryDirectives&&!e.deliveryDirectives))return void(i.url===e.url?t.log("[playlist-loader]: ignore ".concat(e.url," ongoing request")):t.log("[playlist-loader]: ignore ".concat(e.url," in favor of ").concat(i.url)));t.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),n.abort()}if(r=e.type===_g?i.manifestLoadPolicy.default:Ng({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),yg(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Pg&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Cg&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===Ag&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);r=Ng({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,r.maxTimeToFirstByteMs)})}}}const s=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},o={onSuccess:(e,t,i,r)=>{const n=this.getInternalLoader(i);this.resetInternalLoader(i.type);const s=e.data;0===s.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Yv.isMediaPlaylist(s)||i.type!==_g?this.handleTrackOrLevelPlaylist(e,t,i,r||null,n):this.handleMasterPlaylist(e,t,i,r)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),r||null,t)},onError:(e,t,i,r)=>{this.handleNetworkError(t,i,!1,e,r)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};n.load(e,a,o)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log("".concat(e?"auto":"force"," startLoad with configured startPosition ").concat(t)),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,r){const n=this.hls,s=e.data,a=ZS(e,i),o=Yv.parseMasterPlaylist(s,a);if(o.playlistParsingError)return void this.handleManifestParsingError(e,i,o.playlistParsingError,r,t);const{contentSteering:c,levels:l,sessionData:d,sessionKeys:h,startTimeOffset:u,variableList:p}=o;this.variableList=p;const{AUDIO:g=[],SUBTITLES:f,"CLOSED-CAPTIONS":m}=Yv.parseMasterPlaylistMedia(s,a,o);if(g.length){g.some(e=>!e.url)||!l[0].audioCodec||l[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new mv({}),bitrate:0,url:""}))}n.trigger(Tg.MANIFEST_LOADED,{levels:l,audioTracks:g,subtitles:f,captions:m,contentSteering:c,url:a,stats:t,networkDetails:r,sessionData:d,sessionKeys:h,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,r,n){const s=this.hls,{id:a,level:o,type:c}=i,l=ZS(e,i),d=yg(o)?o:yg(a)?a:0,h=KS(i),u=Yv.parseLevelPlaylist(e.data,l,d,h,0,this.variableList);if(c===_g){const e={attrs:new mv({}),bitrate:0,details:u,name:"",url:l};u.requestScheduled=t.loading.start+gb(u,0),s.trigger(Tg.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:l,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(Tg.ERROR,{type:xg.NETWORK_ERROR,details:Eg.MANIFEST_PARSING_ERROR,fatal:t.type===_g,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,s="A network ".concat(i?"timeout":"error"+(r?" (status "+r.code+")":"")," occurred while loading ").concat(e.type);e.type===Pg?s+=": ".concat(e.level," id: ").concat(e.id):e.type!==Cg&&e.type!==Ag||(s+=" id: ".concat(e.id,' group-id: "').concat(e.groupId,'"'));const a=new Error(s);this.hls.logger.warn("[playlist-loader]: ".concat(s));let o=Eg.UNKNOWN,c=!1;const l=this.getInternalLoader(e);switch(e.type){case _g:o=i?Eg.MANIFEST_LOAD_TIMEOUT:Eg.MANIFEST_LOAD_ERROR,c=!0;break;case Pg:o=i?Eg.LEVEL_LOAD_TIMEOUT:Eg.LEVEL_LOAD_ERROR,c=!1;break;case Cg:o=i?Eg.AUDIO_TRACK_LOAD_TIMEOUT:Eg.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Ag:o=i?Eg.SUBTITLE_TRACK_LOAD_TIMEOUT:Eg.SUBTITLE_LOAD_ERROR,c=!1}l&&this.resetInternalLoader(e.type);const d={type:xg.NETWORK_ERROR,details:o,fatal:c,url:e.url,loader:l,context:e,error:a,networkDetails:t,stats:n};if(r){const i=(null==t?void 0:t.url)||e.url;d.response=Fg({url:i,data:void 0},r)}this.hls.trigger(Tg.ERROR,d)}handlePlaylistLoaded(e,t,i,r,n,s){const a=this.hls,{type:o,level:c,id:l,groupId:d,deliveryDirectives:h}=r,u=ZS(t,r),p=KS(r),g="number"===typeof r.level&&p===Rg?c:void 0;if(!e.fragments.length){const s=e.playlistParsingError=new Error("No Segments found in Playlist");return void a.trigger(Tg.ERROR,{type:xg.NETWORK_ERROR,details:Eg.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:s,reason:s.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const f=e.playlistParsingError;if(f){if(this.hls.logger.warn(f),!a.config.ignorePlaylistParsingErrors)return void a.trigger(Tg.ERROR,{type:xg.NETWORK_ERROR,details:Eg.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:f,reason:f.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:i});e.playlistParsingError=null}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case _g:case Pg:a.trigger(Tg.LEVEL_LOADED,{details:e,levelInfo:r.levelOrTrack||a.levels[0],level:g||0,id:l||0,stats:i,networkDetails:n,deliveryDirectives:h,withoutMultiVariant:o===_g});break;case Cg:a.trigger(Tg.AUDIO_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:l||0,groupId:d||"",stats:i,networkDetails:n,deliveryDirectives:h});break;case Ag:a.trigger(Tg.SUBTITLE_TRACK_LOADED,{details:e,track:r.levelOrTrack,id:l||0,groupId:d||"",stats:i,networkDetails:n,deliveryDirectives:h})}}}class JS{static get version(){return $b}static isMSESupported(){return GS()}static isSupported(){return function(){if(!GS())return!1;const e=Wg();return"function"===typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(Bf(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(Bf(t,"audio"))))}()}static getMediaSource(){return Wg()}static get Events(){return Tg}static get MetadataSchema(){return pk}static get ErrorTypes(){return xg}static get ErrorDetails(){return Eg}static get DefaultConfig(){return JS.defaultConfig?JS.defaultConfig:RS}static set DefaultConfig(e){JS.defaultConfig=e}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Hb,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=function(e,t,i){const r=zg();if("object"===typeof console&&!0===e||"object"===typeof e){const s=["debug","log","info","warn","error"];s.forEach(t=>{r[t]=Hg(t,e,i)});try{r.log('Debug logs enabled for "'.concat(t,'" in hls.js version ',"1.6.6"))}catch(n){return zg()}s.forEach(t=>{$g[t]=Hg(t,e)})}else Ng($g,r);return r}(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=function(e,t,i){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const r=LS(e),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{const s="".concat("level"===e?"playlist":e,"LoadPolicy"),a=void 0===t[s],o=[];n.forEach(i=>{const n="".concat(e,"Loading").concat(i),c=t[n];if(void 0!==c&&a){o.push(n);const e=r[s].default;switch(t[s]={default:e},i){case"TimeOut":e.maxLoadTimeMs=c,e.maxTimeToFirstByteMs=c;break;case"MaxRetry":e.errorRetry.maxNumRetry=c,e.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":e.errorRetry.retryDelayMs=c,e.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=c,e.timeoutRetry.maxRetryDelayMs=c}}}),o.length&&i.warn('hls.js config: "'.concat(o.join('", "'),'" setting(s) are deprecated, use "').concat(s,'": ').concat(pm(t[s])))}),Fg(Fg({},r),t)}(JS.DefaultConfig,e,t);this.userConfig=e,i.progressive&&IS(i,t);const{abrController:r,bufferController:n,capLevelController:s,errorController:a,fpsController:o}=i,c=new a(this),l=this.abrController=new r(this),d=new $m(this),h=i.interstitialsController,u=h?this.interstitialsController=new h(this,JS):null,p=this.bufferController=new n(this,d),g=this.capLevelController=new s(this),f=new o(this),m=new YS(this),v=i.contentSteeringController,b=v?new v(this):null,k=this.levelController=new zS(this,b),y=new BS(this),w=new qS(this.config),S=this.streamController=new WS(this,d,w),x=this.gapController=new MS(this,d);g.setStreamController(S),f.setStreamController(S);const E=[m,k,S];u&&E.splice(1,0,u),b&&E.splice(1,0,b),this.networkControllers=E;const T=[l,p,x,g,f,y,d];this.audioTrackController=this.createController(i.audioTrackController,E);const _=i.audioStreamController;_&&E.push(this.audioStreamController=new _(this,d,w)),this.subtitleTrackController=this.createController(i.subtitleTrackController,E);const P=i.subtitleStreamController;P&&E.push(this.subtititleStreamController=new P(this,d,w)),this.createController(i.timelineController,T),w.emeController=this.emeController=this.createController(i.emeController,T),this.cmcdController=this.createController(i.cmcdController,T),this.latencyController=this.createController(VS,T),this.coreComponents=T,E.push(c);const C=c.onErrorOut;"function"===typeof C&&this.on(Tg.ERROR,C,c),this.on(Tg.MANIFEST_LOADED,m.onManifestLoaded,m)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.on(e,t,i)}once(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,r=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const t=e===Tg.ERROR;this.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.INTERNAL_EXCEPTION,fatal:t,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(Tg.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const t=new Error("attachMedia failed: invalid argument (".concat(e,")"));return void this.trigger(Tg.ERROR,{type:xg.OTHER_ERROR,details:Eg.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,r=t?e:{media:i};this._media=i,this.trigger(Tg.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(Tg.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(Tg.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,r=this._url=Xg.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(r)),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Tg.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1?arguments[1]:void 0;this.logger.log("startLoad(".concat(e+(t?", ":""),")")),this.started=!0,this.resumeBuffering();for(let i=0;i{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Rg]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Lg]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Ig]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)})}}}()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log("set currentLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log("set nextLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log("set loadLevel:".concat(e)),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log("set firstLevel:".concat(e)),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log("set startLevel:".concat(e)),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log("set autoLevelCapping:".concat(e)),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return rm.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(r=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let n=r;n--;){const t=e[n].attrs["HDCP-LEVEL"];if(t&&t<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e){return em(e,fm(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.allAudioTracks),navigator.mediaCapabilities)}}function QS(e){const t=Math.floor(e/3600),i=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?"".concat(t,":").concat(i.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0")):"".concat(i,":").concat(r.toString().padStart(2,"0"))}JS.defaultConfig=void 0;var XS=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ex=class{constructor(e){f(this,e),this.apiError=re(this,"rtkApiError",7),this.statsIntervalTimer=null,this.t=un(),this.iconPack=pn,this.isSupported=!0,this.playerState=ot.IDLE,this.livestreamState="IDLE",this.livestreamId=null,this.audioPlaybackError=!1,this.qualityLevels=[],this.selectedQuality=-1,this.currentTime=0,this.duration=0,this.hideControls=!0,this.isDragging=!1,this.seekPosition=0,this.isSeeking=!1,this.hideControlsTimeout=null,this.seekingTimeout=null,this.livestreamUpdateListener=e=>{this.playbackUrl=this.meeting.livestream.playbackUrl,this.livestreamState=e},this.updateProgress=()=>{this.isSeeking||(this.currentTime=this.videoRef.currentTime)},this.updateHlsStatsPeriodically=()=>{var e,t,i;(null===(e=this.videoRef)||void 0===e?void 0:e.seekable)&&this.videoRef.seekable.length>0?this.duration=this.videoRef.seekable.end(this.videoRef.seekable.length-1):this.duration=((null===(t=this.videoRef)||void 0===t?void 0:t.currentTime)||0)+((null===(i=this.hls)||void 0===i?void 0:i.latency)||0)},this.fastForwardToLatest=()=>{var e;(null===(e=this.videoRef)||void 0===e?void 0:e.seekable)&&this.videoRef.seekable.length>0?this.videoRef.currentTime=this.videoRef.seekable.end(this.videoRef.seekable.length-1)-1:this.videoRef.currentTime=this.duration-1},this.togglePlay=()=>{this.videoRef.paused?(this.videoRef.play(),this.playerState=ot.PLAYING):(this.videoRef.pause(),this.playerState=ot.IDLE)},this.changeQuality=e=>{this.selectedQuality=e,this.hls&&(this.hls.currentLevel=e)},this.cleanupPlayer=()=>{var e;this.playerState=ot.IDLE,this.videoRef&&(null===(e=this.hls)||void 0===e||e.destroy(),this.hls=null)},this.onMouseMovePlayer=()=>{this.hideControls=!1,clearTimeout(this.hideControlsTimeout),this.hideControlsTimeout=setTimeout(()=>{this.hideControls=!0},5e3)},this.seekToPosition=e=>{if(!this.videoRef)return;const t=Math.max(0,Math.min(e,this.duration));this.isSeeking=!0,this.currentTime=t;try{this.videoRef.currentTime=t,this.seekingTimeout&&clearTimeout(this.seekingTimeout),this.seekingTimeout=setTimeout(()=>{this.isSeeking=!1,this.currentTime=this.videoRef.currentTime},200)}catch(i){this.isSeeking=!1,this.meeting.__internals__.logger.warn("rtk-livestream-player:: Seek failed",{error:i})}},this.onSeekbarMouseDown=e=>{e.preventDefault(),this.isDragging=!0,this.updateSeekPosition(e),document.addEventListener("mousemove",this.onSeekbarMouseMove),document.addEventListener("mouseup",this.onSeekbarMouseUp)},this.onSeekbarMouseMove=e=>{this.isDragging&&this.updateSeekPosition(e)},this.onSeekbarMouseUp=e=>{this.isDragging&&(this.isDragging=!1,this.updateSeekPosition(e),this.seekToPosition(this.seekPosition),document.removeEventListener("mousemove",this.onSeekbarMouseMove),document.removeEventListener("mouseup",this.onSeekbarMouseUp))},this.onSeekbarClick=e=>{this.isDragging||(this.updateSeekPosition(e),this.seekToPosition(this.seekPosition))},this.updateSeekPosition=e=>{const t=e.currentTarget.getBoundingClientRect(),i=e.clientX-t.left,r=Math.max(0,Math.min(1,i/t.width));this.seekPosition=r*this.duration},this.getSeekbarProgress=()=>this.isDragging?this.duration>0?this.seekPosition/this.duration:0:this.duration>0?this.currentTime/this.duration:0,this.getLoadingState=()=>{let e="",t=!1,i=!1;switch(this.livestreamState){case"IDLE":e=this.t("livestream.idle"),t=!0,i=!1;break;case"STARTING":e=this.t("livestream.starting"),t=!0,i=!0;break;case"STOPPING":e=this.t("livestream.stopping"),t=!0,i=!0;break;case"LIVESTREAMING":this.playerState!==ot.PLAYING&&this.playerState!==ot.PAUSED&&(e=this.t("livestream.starting"),i=!0,t=!0);break;default:t=!1,e=this.t(""),i=!0}return{isLoading:t,loadingMessage:e,showIcon:i}},this.getErrorState=()=>{var e,t;let i=!1,r="";return"LIVESTREAMING"!==this.livestreamState?(i=!1,r=this.t(""),{isError:i,errorMessage:r}):(this.isSupported||(i=!0,r=this.t("livestream.error.not_supported")),this.playbackUrl||(i=!0,r=this.t("livestream.error.not_found")),this.playerError&&(i=!0,r=this.t(null!==(t=null===(e=this.playerError)||void 0===e?void 0:e.message)&&void 0!==t?t:"livestream.error.unknown")),{isError:i,errorMessage:r})},this.initialiseAndPlayStream=async()=>{try{this.meeting.__internals__.logger.info("rtk-livestream-player:: About to initialise HLS. VideoRef? ".concat(!!this.videoRef," playbackUrl: ").concat(this.playbackUrl)),JS.isSupported()?(this.meeting.__internals__.logger.info("rtk-livestream-player:: Initialising HLS. HLS is Supported"),this.hls=new JS({lowLatencyMode:!1}),window.rtk_hls=this.hls,this.meeting.__internals__.logger.info("rtk-livestream-player:: Loading source"),this.hls.loadSource(this.playbackUrl+"?dvrEnabled=true"),this.meeting.__internals__.logger.info("rtk-livestream-player:: Attaching video element to HLS"),this.hls.attachMedia(this.videoRef),this.meeting.__internals__.logger.info("rtk-livestream-player:: Waiting async for HLS manifest parsing"),this.hls.on(JS.Events.ERROR,(e,t)=>{if(t.fatal){if(this.meeting.__internals__.logger.error("rtk-livestream-player:: fatal error: ".concat(t.details),{error:t.error}),this.playbackUrl&&"LIVESTREAMING"===this.livestreamState)return void setTimeout(()=>{this.playbackUrl&&"LIVESTREAMING"===this.livestreamState&&(this.meeting.__internals__.logger.info("rtk-livestream-player:: Retrying playbackUrl"),this.hls.loadSource(this.playbackUrl+"?dvrEnabled=true"))},5e3)}else this.meeting.__internals__.logger.warn("rtk-livestream-player:: non-fatal error: ".concat(t.details),{error:t.error})}),this.hls.on(JS.Events.MEDIA_ATTACHED,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: media attached")}),this.hls.on(JS.Events.MEDIA_DETACHED,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: media detached")}),this.hls.on(JS.Events.DESTROYING,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: hls is getting destroyed")}),this.hls.on(JS.Events.MANIFEST_PARSED,async(e,t)=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: HLS manifest parsed");const{levels:i,autoLevelChangeAllowed:r}=function(e){let{meeting:t,hlsLevels:i}=e,r=t.self.config.livestreamViewerQualities||[];if(!r.length)return{autoLevelChangeAllowed:!0,levels:i};const n=i.filter(e=>r.includes(e.height));return n.length?{autoLevelChangeAllowed:!1,levels:n}:{autoLevelChangeAllowed:!0,levels:i}}({meeting:this.meeting,hlsLevels:t.levels});this.qualityLevels=i.map((e,t)=>({level:t,resolution:e.height?"".concat(e.height,"p"):"auto"})),r&&(this.qualityLevels=[{level:-1,resolution:"Auto"},...this.qualityLevels]),this.hls.currentLevel=this.qualityLevels[0].level;try{this.meeting.__internals__.logger.info("rtk-livestream-player:: About to start video."),await this.videoRef.play(),this.meeting.__internals__.logger.info("rtk-livestream-player:: Video has started playing."),this.playerState=ot.PLAYING}catch(n){this.audioPlaybackError=!0,this.meeting.__internals__.logger.error("rtk-livestream-player:: Video couldn't start. Trying with user gesture again.",{error:n})}}),this.videoRef.addEventListener("timeupdate",this.updateProgress),this.statsIntervalTimer=setInterval(this.updateHlsStatsPeriodically,1e3)):this.isSupported=!1}catch(e){this.meeting.__internals__.logger.error("rtk-livestream-player:: HLS couldn't initialise.",{error:e})}}}async updateLivestreamId(){const e=this.meeting.livestream.playbackUrl;if(!e||"LIVESTREAMING"!==this.livestreamState)return this.playbackUrl=null,this.livestreamId=null,void this.cleanupPlayer();const t=e.split("/"),i=t.findIndex(e=>"manifest"===e),r=t[i-1];this.livestreamId=r,await this.conditionallyStartLivestreamViewer()}async conditionallyStartLivestreamViewer(){this.videoRef&&this.playbackUrl&&!this.hls&&await this.initialiseAndPlayStream()}async connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.livestream.removeListener("livestreamUpdate",this.livestreamUpdateListener),this.videoRef.removeEventListener("timeupdate",this.updateProgress),clearInterval(this.statsIntervalTimer),this.seekingTimeout&&clearTimeout(this.seekingTimeout),this.videoRef=null,this.hls&&this.hls.destroy(),window.rtk_hls=null}meetingChanged(e){e&&(this.playbackUrl=this.meeting.livestream.playbackUrl,this.livestreamState=this.meeting.livestream.state,this.meeting.livestream.on("livestreamUpdate",this.livestreamUpdateListener))}render(){if(!at(this.meeting))return;const{isError:e,errorMessage:t}=this.getErrorState(),{isLoading:i,loadingMessage:r,showIcon:n}=this.getLoadingState();return Z(J,null,Z("div",{class:"player-container h-full max-h-full min-h-full w-full min-w-full max-w-full"},Z("div",{ref:async e=>{this.videoContainerRef=e},class:"video-container relative flex h-full w-full flex-col items-center justify-center"},Z("video",{onMouseMove:this.onMouseMovePlayer,ref:async e=>{this.videoRef=e,await this.conditionallyStartLivestreamViewer()},id:"livestream-video",class:"livestream-video",controls:!1,onPlay:()=>{this.playerState===ot.PAUSED&&(this.playerState=ot.PLAYING)},onPause:()=>this.playerState=ot.PAUSED}),this.playerState!==ot.IDLE&&!this.hideControls&&Z("div",{class:"control-bar"},Z("div",{class:"control-groups"},Z("rtk-icon",{id:"playPause",onClick:this.togglePlay,size:"lg",class:"control-btn",icon:this.playerState===ot.PLAYING?this.iconPack.pause:this.iconPack.play}),Z("rtk-icon",{size:"lg",class:"control-btn",icon:this.iconPack.fastForward,onClick:this.fastForwardToLatest}),Z("span",{class:"timings"},QS(this.currentTime)," /"," ",QS(this.duration))),Z("div",{class:"seekbar-container"},Z("div",{class:"seekbar",onMouseDown:this.onSeekbarMouseDown,onClick:this.onSeekbarClick},Z("div",{class:"seekbar-track"},Z("div",{class:"seekbar-progress",style:{width:"".concat(100*this.getSeekbarProgress(),"%")}}),Z("div",{class:"seekbar-handle",style:{left:"".concat(100*this.getSeekbarProgress(),"%")}})))),Z("div",{class:"control-groups"},Z("select",{class:"level-select",onChange:e=>this.changeQuality(parseInt(e.target.value))},this.qualityLevels.map(e=>Z("option",{value:e.level,selected:this.selectedQuality===e.level},e.resolution))),Z("rtk-fullscreen-toggle",{id:"fullscreen",class:"control-btn fullscreen-btn",targetElement:this.videoContainerRef,size:"sm",iconPack:this.iconPack,t:this.t,ref:e=>{var t;const i=document.createElement("style");i.textContent="\n                        rtk-controlbar-button {\n                          display: contents;\n                          background-color: var(--bg-brand-500);\n                          color: var(--text-text-on-brand);\n                        }\n                      ",null===(t=null===e||void 0===e?void 0:e.shadowRoot)||void 0===t||t.appendChild(i)}})))),this.audioPlaybackError&&Z("div",{class:"unmute-popup"},Z("h3",null,this.t("audio_playback.title")),Z("p",null,this.t("audio_playback.description")),Z("rtk-button",{kind:"wide",onClick:()=>{this.audioPlaybackError=!1,this.videoRef&&(this.videoRef.muted=!1,this.videoRef.play(),this.playerState=ot.PLAYING)},title:this.t("audio_playback")},this.t("audio_playback"))),e&&Z("div",{class:"loader"},Z("rtk-icon",{icon:this.iconPack.warning}),Z("p",null,t)),!e&&i&&Z("div",{class:"loader"},n&&Z("rtk-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack,size:"md"}),Z("p",null,r))))}get el(){return ie(this)}static get watchers(){return{livestreamState:["updateLivestreamId"],meeting:["meetingChanged"]}}};XS([On()],ex.prototype,"meeting",void 0),XS([On()],ex.prototype,"t",void 0),XS([On()],ex.prototype,"iconPack",void 0),ex.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;max-height:100%;min-height:100%;width:100%;min-width:100%;max-width:100%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.player-container{position:relative;margin-left:var(--rtk-space-4, 16px);margin-right:var(--rtk-space-4, 16px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-0, 0px);display:flex;flex-grow:1;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-md, 8px)}.loader{position:absolute;z-index:10;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column;align-items:center;justify-content:center}p{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);font-size:16px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.unmute-popup{position:absolute;z-index:30 !important;display:flex;width:var(--rtk-space-72, 288px);flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-4, 16px);text-align:center;max-width:70%}.unmute-popup h3{margin:var(--rtk-space-0, 0px);font-size:16px;font-weight:500}.unmute-popup p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);font-size:14px}.control-bar{position:absolute;bottom:0;left:16px;right:16px;display:flex;height:auto;align-items:center;padding:12px 16px;z-index:30;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:6px;border-radius:var(--rtk-border-radius-md, 8px);background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / 0.8);gap:12px}.timings{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.control-btn{border:none;margin-right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));cursor:pointer;font-size:24px;height:30px;width:30px}.fullscreen-btn{margin-right:20px;height:30px}.control-btn:hover{opacity:0.8}.control-btn:focus{outline:none}.control-groups{display:flex;align-items:center;gap:12px;flex-shrink:0}#livestream-video,.livestream-video{position:absolute;top:0;left:0;width:100% !important;height:100% !important;max-width:none !important;max-height:none !important;min-width:100% !important;min-height:100% !important;-o-object-fit:fill !important;object-fit:fill !important;z-index:10;border-radius:var(--rtk-border-radius-md, 8px);border-width:0px}:host:not(:fullscreen) .video-container{padding:16px 16px 0 16px}:host(:fullscreen) .video-container,:host(:-webkit-full-screen) .video-container,:host(:-moz-full-screen) .video-container{padding:0}.level-select{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border:none;padding:5px 10px;font-size:14px;height:30px;cursor:pointer;border-radius:5px;margin-right:10px}.level-select:focus{outline:none}.level-select option{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.volume-control-holder{display:flex;justify-content:center;align-items:center}.seekbar-container{flex:1;min-width:100px;padding:0 12px;display:flex;align-items:center}.seekbar{width:100%;height:20px;cursor:pointer;display:flex;align-items:center}.seekbar-track{position:relative;width:100%;height:4px;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.seekbar-progress{position:absolute;top:0;left:0;height:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));transition:width 0.1s ease}.seekbar-handle{position:absolute;top:50%;width:12px;height:12px;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));transform:translate(-50%, -50%);transition:left 0.1s ease;opacity:0}.seekbar:hover .seekbar-handle{opacity:1}.seekbar:hover .seekbar-track{height:6px}.seekbar:hover .seekbar-handle{width:14px;height:14px}";var tx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ix=class{constructor(e){f(this,e),this.variant="primary",this.iconPack=pn,this.t=un(),this.viewerCount=0,this.disconnectMeeting=e=>{var t;null!=e&&null!=this.countListener&&(null===(t=e.livestream)||void 0===t||t.removeListener("viewerCountUpdate",this.countListener))}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}meetingChanged(e,t){var i;this.disconnectMeeting(t),null!=e&&(this.countListener=()=>{var t;this.viewerCount=null===(t=e.livestream)||void 0===t?void 0:t.viewerCount},this.countListener(),null===(i=e.livestream)||void 0===i||i.addListener("viewerCountUpdate",this.countListener))}render(){return at(this.meeting)?Z(J,{tabIndex:0,role:"log","aria-label":"".concat(this.viewerCount," ").concat(this.t("viewers"))},Z("rtk-icon",{icon:this.iconPack.viewers,tabIndex:-1,"aria-hidden":!0,part:"icon"}),this.viewerCount," ",this.t("viewers")):Z(J,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};tx([On()],ix.prototype,"meeting",void 0),tx([On()],ix.prototype,"iconPack",void 0),tx([On()],ix.prototype,"t",void 0),ix.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;height:var(--rtk-space-10, 40px);-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;font-size:14px}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([variant='embedded']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));opacity:0.5;margin-top:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:12px}:host([variant='embedded']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";var rx=Object.freeze({__proto__:null,rtk_livestream_indicator:kg,rtk_livestream_player:ex,rtk_viewer_count:ix});var nx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const sx=class{constructor(e){f(this,e),this.isScreenShare=!1,this.variant="default",this.iconPack=pn,this.t=un(),this.length=13}sizeChanged(e){this.length="sm"===e?8:13}formatNameTag(e,t){return this.isScreenShare?t?"".concat(this.t("screen")," - ").concat(Cn(e,this.length-3)," (").concat(this.t("you"),")"):"".concat(this.t("screen")," - ").concat(Cn(e,this.length)):t?"".concat(Cn(e,this.length-3)," (").concat(this.t("you"),")"):Cn(e,this.length)}render(){var e,t,i;const r=Ln((null===(e=this.participant)||void 0===e?void 0:e.name)||""),n=(null===(t=this.participant)||void 0===t?void 0:t.id)===(null===(i=this.meeting)||void 0===i?void 0:i.self.id);return Z(J,{key:"d42b26fe39b4a8643e32b420ec6cded7450dde20",title:r},Z("slot",{key:"5235adedfaef8eb0b99d46f9b6e89efe40e53f68",name:"start"}),Z("span",{key:"bd15296809e2caf334c6786e45e3b751633ff001",class:"name"},this.formatNameTag(r,n)),Z("slot",{key:"6f5a39cfecf90b9d449b08274eb20b450bcba196",name:"end"}))}static get watchers(){return{size:["sizeChanged"]}}};nx([On()],sx.prototype,"meeting",void 0),nx([On()],sx.prototype,"iconPack",void 0),nx([On()],sx.prototype,"t",void 0),sx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);font-size:14px;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}span.name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}::slotted(rtk-audio-visualizer[slot='start']){margin-right:var(--rtk-space-1\\.5, 6px)}::slotted(rtk-audio-visualizer[slot='end']){margin-left:var(--rtk-space-1\\.5, 6px)}:host([size='sm']){font-size:12px;--tw-bg-opacity:0.6}:host([variant='text']){background-color:transparent;padding:var(--rtk-space-0, 0px)}";var ax=Object.freeze({__proto__:null,rtk_name_tag:sx});var ox=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const cx=class{constructor(e){f(this,e),this.config=sn(),this.hideHeader=!1,this.iconPack=pn,this.view="sidebar",this.t=un(),this.search="",this.participants=[],this.createParticipantNode=e=>{const t={meeting:this.meeting,view:this.view,t:this.t,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack};return Z("div",null,Z(ws,{element:"rtk-participant",defaults:t,props:{role:"listitem",participant:e,key:e.id},childProps:Object.assign(Object.assign({},t),{participant:e,size:this.size}),deepProps:!0}))},this.updateStageList=()=>{this.getParticipants(this.search)}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}disconnectedCallback(){if(!this.meeting)return;const{participants:e,stage:t}=this.meeting;this.participantJoinedListener&&this.meeting.participants.joined.removeListener("participantJoined",this.participantJoinedListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),e.joined.removeListener("stageStatusUpdate",this.updateStageList),null===t||void 0===t||t.removeListener("stageStatusUpdate",this.updateStageList)}meetingChanged(e){e&&(this.participantJoinedListener=e=>{if("ON_STAGE"!==e.stageStatus)return;const t=this.search.toLowerCase();e.name.toLowerCase().includes(t)&&e.id.toLowerCase().includes(t)&&(this.participants=[...this.participants.filter(t=>t.id!==e.id),e])},this.participantLeftListener=e=>{this.participants=this.participants.filter(t=>t.id!==e.id)},e.participants.joined.addListener("participantJoined",this.participantJoinedListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener),this.updateStageList(),null===e||void 0===e||e.participants.joined.on("stageStatusUpdate",this.updateStageList),null===e||void 0===e||e.stage.on("stageStatusUpdate",this.updateStageList))}searchChanged(e){this.getParticipants(e)}getParticipants(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.search,t="ON_STAGE"===this.meeting.stage.status?[this.meeting.self]:[];t=[...t,...this.meeting.participants.joined.toArray().filter(e=>"ON_STAGE"===e.stageStatus)],this.participants=""===e?t:t.filter(t=>{var i;return(null!==(i=t.name)&&void 0!==i?i:t.id).toLowerCase().includes(e.toLowerCase())})}render(){return Z(J,{key:"d799034511ea2f1b1125e0a5ba4ea52add1ac748"},Z("div",{key:"e46415181eaa216bc46470ebbce23f4dfe3b96b8",class:"participants-container"},!this.hideHeader&&Z("div",{key:"83a22247b44cfd8a7bee2c89fdd199310d2cc008",class:"heading-count",part:"heading-count"},this.t("participants")," (",this.participants.length,")"),Z("rtk-virtualized-participant-list",{key:"64876afecf04945ed6ab8f567dd19298add079e9",items:this.participants,renderItem:this.createParticipantNode,part:"participants",class:"participants",emptyListElement:Z("div",{class:"empty-stage-list"},this.search.length>0?this.t("search.could_not_find"):this.t("search.empty"))})))}static get watchers(){return{meeting:["meetingChanged"],search:["searchChanged"]}}};ox([On()],cx.prototype,"meeting",void 0),ox([On()],cx.prototype,"states",void 0),ox([On()],cx.prototype,"config",void 0),ox([On()],cx.prototype,"iconPack",void 0),ox([On()],cx.prototype,"t",void 0),cx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column;font-size:14px}.participants-container{margin-bottom:var(--rtk-space-4, 16px);height:100%;width:100%}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.empty-stage-list{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}rtk-participant{width:100%}";var lx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const dx=class{constructor(e){f(this,e),this.config=sn(),this.iconPack=pn,this.view="sidebar",this.t=un(),this.stageRequestedParticipants=[],this.updateStageRequestedParticipants=()=>{this.stageRequestedParticipants=this.meeting.participants.joined.toArray().filter(e=>"REQUESTED_TO_JOIN_STAGE"===e.stageStatus)},this.acceptStageRequest=async e=>{const{userId:t}=e;await this.meeting.stage.grantAccess([t])},this.rejectStageRequest=async e=>{const{userId:t}=e;await this.meeting.stage.denyAccess([t])},this.acceptAllStageRequest=async()=>{await this.meeting.stage.grantAccess(this.stageRequestedParticipants.map(e=>e.userId))},this.denyAllStageRequest=async()=>{var e;await(null===(e=this.meeting.stage)||void 0===e?void 0:e.denyAccess(this.stageRequestedParticipants.map(e=>e.userId)))},this.shouldShowStageRequests=()=>this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests&&this.stageRequestedParticipants.length>0,this.updateRequestList=async e=>{var t,i,r,n,s,a,o;this.meeting.self.permissions.acceptStageRequests&&this.meeting.self.permissions.stageEnabled?"LIVESTREAM"===this.meeting.meta.viewType||"HIVE"===(null===(r=null===(i=null===(t=this.meeting)||void 0===t?void 0:t.self)||void 0===i?void 0:i.permissions)||void 0===r?void 0:r.mediaRoomType)?(e||(e=null!==(a=null===(s=await(null===(n=this.meeting.stage)||void 0===n?void 0:n.getAccessRequests()))||void 0===s?void 0:s.stageRequests)&&void 0!==a?a:[]),this.stageRequestedParticipants=e.map(e=>Object.assign(Object.assign({},e),{name:e.displayName}))):this.stageRequestedParticipants=null===(o=[this.meeting.self,...this.meeting.participants.joined.toArray()])||void 0===o?void 0:o.filter(e=>"REQUESTED_TO_JOIN_STAGE"===e.stageStatus):this.stageRequestedParticipants=[]}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;const{stage:t}=this.meeting;null===t||void 0===t||t.removeListener("stageAccessRequestUpdate",this.updateRequestList),null===(e=this.meeting.participants.joined)||void 0===e||e.removeListener("stageStatusUpdate",this.updateStageRequestedParticipants)}meetingChanged(e){var t;e&&(this.updateRequestList(),e.participants.joined.on("stageStatusUpdate",this.updateStageRequestedParticipants),null===(t=e.stage)||void 0===t||t.on("stageAccessRequestUpdate",this.updateRequestList))}render(){return this.meeting?"sidebar"===this.view&&this.shouldShowStageRequests()?Z("div",{class:"stage-requested-participants"},Z("div",{class:"heading-count",part:"staged-heading-count"},this.t("stage_request.header_title")," (",this.stageRequestedParticipants.length,")"),Z("ul",{class:"participants",part:"staged-participants"},this.stageRequestedParticipants.map(e=>Z("li",{class:"waiting-participant",key:e.id},Z("div",{class:"participant-details"},Z("rtk-avatar",{participant:e,size:"sm",iconPack:this.iconPack,t:this.t}),Z("p",{class:"name",title:e.name},e.name)),Z("div",{class:"waitlist-controls"},Z("rtk-tooltip",{label:this.t("stage_request.deny_request"),variant:"secondary"},Z("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.rejectStageRequest(e)},Z("rtk-icon",{class:"deny",icon:this.iconPack.dismiss}))),Z("rtk-tooltip",{label:this.t("stage_request.accept_request"),variant:"secondary"},Z("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.acceptStageRequest(e)},Z("rtk-icon",{class:"accept",icon:this.iconPack.checkmark}))))))),Z("div",{class:"bulk-actions"},Z("rtk-button",{class:"accept-all-button",variant:"secondary",onClick:this.acceptAllStageRequest},this.t("stage_request.accept_all")),Z("rtk-button",{class:"deny-all-button",variant:"danger",onClick:this.denyAllStageRequest},this.t("stage_request.deny_all")))):void 0:null}static get watchers(){return{meeting:["meetingChanged"]}}};lx([On()],dx.prototype,"meeting",void 0),lx([On()],dx.prototype,"config",void 0),lx([On()],dx.prototype,"iconPack",void 0),lx([On()],dx.prototype,"t",void 0),dx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:column;font-size:14px}.stage-requested-participants{margin-bottom:var(--rtk-space-8, 32px)}.stage-requested-participants .bulk-actions{display:flex;gap:var(--rtk-space-2, 8px)}.stage-requested-participants .bulk-actions .accept-all-button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.stage-requested-participants .bulk-actions rtk-button{flex:1 1 0%}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.waiting-participant{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.waiting-participant .participant-details{margin-right:auto;display:flex;align-items:center}.waiting-participant .participant-details rtk-avatar{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);flex-shrink:0;font-size:14px}.waiting-participant .participant-details .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}@media (min-width: 1080px){.waiting-participant .participant-details .name{max-width:var(--rtk-space-40, 160px)}}.waiting-participant .waitlist-controls{display:flex}.waiting-participant .waitlist-controls rtk-button{margin-left:var(--rtk-space-2, 8px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px)}.waiting-participant .waitlist-controls rtk-icon.accept{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.waiting-participant .waitlist-controls rtk-icon.deny{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var hx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const ux=class{constructor(e){f(this,e),this.updateStageViewers=()=>{this.getViewers(this.search)},this.config=sn(),this.hideHeader=!1,this.iconPack=pn,this.view="sidebar",this.search="",this.t=un(),this.stageViewers=[],this.createParticipantNode=e=>Z("rtk-participant",{role:"listitem",key:e.id,meeting:this.meeting,participant:e,view:this.view,iconPack:this.iconPack,config:this.config,t:this.t}),this.shouldShowViewers=()=>{var e,t,i;return null===(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.self)||void 0===t?void 0:t.permissions)||void 0===i?void 0:i.stageEnabled}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}meetingChanged(e){e&&(this.participantJoinedListener=e=>{if("ON_STAGE"===e.stageStatus)return;const t=this.search.toLowerCase();t.length>0&&!e.name.toLowerCase().includes(t)||(this.stageViewers=[...this.stageViewers.filter(t=>t.id!==e.id),e])},this.participantLeftListener=e=>{this.stageViewers=this.stageViewers.filter(t=>t.id!==e.id)},e.participants.joined.addListener("participantJoined",this.participantJoinedListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener),e.participants.joined.on("stageStatusUpdate",this.updateStageViewers),e.stage.on("stageStatusUpdate",this.updateStageViewers))}searchChanged(e){this.getViewers(e)}disconnectedCallback(){const{participants:e,stage:t}=this.meeting;this.participantJoinedListener&&this.meeting.participants.joined.removeListener("participantJoined",this.participantJoinedListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),e.joined.removeListener("stageStatusUpdate",this.updateStageViewers),t.removeListener("stageStatusUpdate",this.updateStageViewers)}getViewers(e){let t="ON_STAGE"===this.meeting.stage.status?[]:[this.meeting.self];t=[...t,...this.meeting.participants.joined.toArray()].filter(e=>"ON_STAGE"!==e.stageStatus),this.stageViewers=""===e?t:t.filter(t=>{var i;return(null!==(i=t.name)&&void 0!==i?i:t.id).toLowerCase().includes(e.toLowerCase())})}render(){return this.meeting?"sidebar"===this.view&&this.shouldShowViewers()?Z("div",{class:"list"},!this.hideHeader&&Z("div",{class:"heading-count",part:"heading-count"},this.t("viewers")," (",this.stageViewers.length,")"),Z("rtk-virtualized-participant-list",{items:this.stageViewers,renderItem:this.createParticipantNode,class:"participants",part:"participants",style:{height:"100%"},emptyListElement:Z("div",{class:"empty-viewers-list"},this.search.length>0?this.t("participants.errors.empty_results"):this.t("participants.empty_list"))})):void 0:null}static get watchers(){return{meeting:["meetingChanged"],search:["searchChanged"]}}};hx([On()],ux.prototype,"meeting",void 0),hx([On()],ux.prototype,"config",void 0),hx([On()],ux.prototype,"iconPack",void 0),hx([On()],ux.prototype,"t",void 0),ux.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}.list{margin-bottom:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column}h3,.heading-count{margin:var(--rtk-space-0, 0px);align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.empty-viewers-list{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}";var px=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const gx=class{constructor(e){f(this,e),this.config=sn(),this.iconPack=pn,this.view="sidebar",this.t=un(),this.acceptWaitingRoomRequest=async e=>{await this.meeting.participants.acceptWaitingRoomRequest(e)},this.waitlistedParticipants=[],this.acceptAllWaitingRoomRequests=async()=>{await this.meeting.participants.acceptAllWaitingRoomRequest(this.waitlistedParticipants.map(e=>e.id))},this.rejectWaitingRoomRequest=async e=>{await this.meeting.participants.rejectWaitingRoomRequest(e)},this.shouldShowWaitlist=()=>"LIVESTREAM"!==this.meeting.meta.viewType&&(this.meeting.self.permissions.acceptWaitingRequests&&0!==this.waitlistedParticipants.length)}disconnectedCallback(){const{participants:e}=this.meeting;this.waitlistedParticipantJoinedListener&&e.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&e.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),this.waitlistedParticipantsClearedListener&&e.waitlisted.removeListener("participantsCleared",this.waitlistedParticipantsClearedListener)}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(e){e&&(this.waitlistedParticipants=e.participants.waitlisted.toArray(),this.waitlistedParticipantJoinedListener=e=>{this.waitlistedParticipants.some(t=>t.id===e.id)||(this.waitlistedParticipants=[...this.waitlistedParticipants,e])},this.waitlistedParticipantLeftListener=e=>{this.waitlistedParticipants=this.waitlistedParticipants.filter(t=>t.id!==e.id)},this.waitlistedParticipantsClearedListener=()=>{this.waitlistedParticipants=[]},e.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),e.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener),e.participants.waitlisted.addListener("participantsCleared",this.waitlistedParticipantsClearedListener))}render(){if("sidebar"===this.view&&this.shouldShowWaitlist())return Z("div",{class:"waiting-participants"},Z("div",{class:"heading-count",part:"waitlisted-heading-count"},this.t("waitlist.header_title")," (",this.waitlistedParticipants.length,")"),Z("ul",{class:"participants",part:"waitlisted-participants"},this.waitlistedParticipants.map(e=>Z("li",{class:"waiting-participant",key:e.id},Z("div",{class:"participant-details"},Z("rtk-avatar",{participant:e,size:"sm",iconPack:this.iconPack,t:this.t}),Z("p",{class:"name",title:e.name},e.name)),Z("div",{class:"waitlist-controls"},Z("rtk-tooltip",{label:this.t("waitlist.deny_request"),variant:"secondary"},Z("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.rejectWaitingRoomRequest(e.id)},Z("rtk-icon",{class:"deny",icon:this.iconPack.dismiss}))),Z("rtk-tooltip",{label:this.t("waitlist.accept_request"),variant:"secondary"},Z("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.acceptWaitingRoomRequest(e.id)},Z("rtk-icon",{class:"accept",icon:this.iconPack.checkmark}))))))),Z("rtk-button",{class:"accept-all-button",variant:"secondary",kind:"wide",onClick:this.acceptAllWaitingRoomRequests},this.t("waitlist.accept_all")))}static get watchers(){return{meeting:["meetingChanged"]}}};px([On()],gx.prototype,"meeting",void 0),px([On()],gx.prototype,"config",void 0),px([On()],gx.prototype,"iconPack",void 0),px([On()],gx.prototype,"t",void 0),gx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-top:var(--rtk-space-4, 16px);margin-bottom:calc(var(--rtk-space-2, 8px) * -1);display:flex;width:100%;flex-direction:column;font-size:14px}.waiting-participants{margin-bottom:var(--rtk-space-8, 32px)}.waiting-participants .accept-all-button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.waiting-participant{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.waiting-participant .participant-details{margin-right:auto;display:flex;align-items:center}.waiting-participant .participant-details rtk-avatar{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);flex-shrink:0;font-size:14px}.waiting-participant .participant-details .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (min-width: 1080px){.waiting-participant .participant-details .name{max-width:var(--rtk-space-40, 160px)}}.waiting-participant .waitlist-controls{display:flex}.waiting-participant .waitlist-controls rtk-button{margin-left:var(--rtk-space-2, 8px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px)}.waiting-participant .waitlist-controls rtk-icon.accept{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.waiting-participant .waitlist-controls rtk-icon.deny{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var fx=Object.freeze({__proto__:null,rtk_participants_stage_list:cx,rtk_participants_stage_queue:dx,rtk_participants_viewer_list:ux,rtk_participants_waiting_list:gx});var mx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const vx=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.canClosePlugin=!1,this.viewModeEnabled=!1,this.onIframeRef=e=>{var t;e!==this.iframeEl&&(this.iframeEl=e,null===(t=this.plugin)||void 0===t||t.addPluginView(e,"plugin-main"))},this.canInteractWithPlugin=()=>{const e=this.plugin.id;if(!e)return!0;const t=this.meeting.self.permissions.plugins.config[e];return!t||(!t.accessControl||"FULL_ACCESS"===t.accessControl)}}componentDidLoad(){this.meetingChanged(this.meeting),this.pluginChanged(this.plugin)}meetingChanged(e){if(!e)return;const t=this.canInteractWithPlugin();this.viewModeEnabled=!t,M(()=>{this.canClosePlugin=e.self.permissions.plugins.canClose||this.plugin.enabledBy===e.self.id})}pluginChanged(e){this.toggleViewModeListener=e=>{this.canInteractWithPlugin()||(this.viewModeEnabled=e)},null!=e&&(this.iframeEl&&e.addPluginView(this.iframeEl,"plugin-main"),e.addListener("toggleViewMode",this.toggleViewModeListener))}disconnectedCallback(){var e,t;null===(e=this.plugin)||void 0===e||e.removePluginView("plugin-main"),null===(t=this.plugin)||void 0===t||t.removeListener("toggleViewMode",this.toggleViewModeListener)}render(){return null==this.plugin?null:Z(J,null,Z("header",{part:"header"},Z("div",null,this.plugin.name),this.canClosePlugin&&Z("div",null,Z("rtk-button",{kind:"icon",onClick:()=>this.plugin.deactivate(),part:"button"},Z("rtk-icon",{icon:this.iconPack.dismiss})))),Z("div",{class:"iframe-container"},!this.canInteractWithPlugin()&&this.viewModeEnabled?Z("div",{class:"block-inputs"}):null,Z("iframe",{ref:e=>this.onIframeRef(e),part:"iframe"})))}static get watchers(){return{meeting:["meetingChanged"],plugin:["pluginChanged"]}}};mx([On()],vx.prototype,"meeting",void 0),mx([On()],vx.prototype,"iconPack",void 0),mx([On()],vx.prototype,"t",void 0),vx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-lg, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;height:var(--rtk-space-8, 32px);align-items:center;justify-content:space-between;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}header>div{display:flex;align-items:center}rtk-button{display:flex;height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);flex-direction:column;align-items:center;border-radius:9999px}rtk-button rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}iframe{display:block;flex:1 1 0%;margin:var(--rtk-space-0, 0px);border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-0, 0px);outline:2px solid transparent;outline-offset:2px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity))}.iframe-container{position:relative;height:100%;width:100%}.block-inputs{position:absolute;z-index:10;height:100%;width:100%;border-left-width:var(--rtk-border-width-none, 0);border-top-width:var(--rtk-border-width-lg, 4px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity))}iframe{height:100%;width:100%}";var bx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const kx=class{constructor(e){f(this,e),this.tabChange=re(this,"tabChange",7),this.config=sn(),this.layout="row",this.iconPack=pn,this.t=un(),this.tabs=[]}render(){return Z(J,{key:"f586079ea469d413cdd8c2bb495bb06d9315417c"},Z("rtk-spotlight-indicator",{key:"b9d139ef77a33c6470f4cbd7af1f7ded017b197d",meeting:this.meeting,iconPack:this.iconPack,t:this.t,size:this.size}),this.tabs.map(e=>{var t,i,r,n,s;let a=!1;if(("plugin"===(null===(t=this.activeTab)||void 0===t?void 0:t.type)&&e.plugin&&(null===(i=this.activeTab)||void 0===i?void 0:i.plugin.id)===e.plugin.id||"screenshare"===(null===(r=this.activeTab)||void 0===r?void 0:r.type)&&e.participant&&(null===(n=this.activeTab)||void 0===n?void 0:n.participant.id)===e.participant.id)&&(a=!0),"screenshare"===e.type){const t=e.participant,i=Ln(t.name);return Z("rtk-button",{title:"".concat(i,"'s Screen Share"),key:e.participant.id,kind:"icon",variant:a?"primary":"secondary",class:{tab:!0,active:a},onClick:()=>this.tabChange.emit(e)},Z("div",{class:"center col"},Z("rtk-icon",{icon:this.iconPack.share_screen_person}),Z("span",{class:"name"},t.id===(null===(s=this.meeting)||void 0===s?void 0:s.self.id)?this.t("you"):Cn(i,6))))}if("plugin"===e.type){const t=e.plugin;return Z("rtk-button",{title:t.name,key:t.id,kind:"icon",variant:a?"primary":"secondary",class:{tab:!0,active:a},onClick:()=>this.tabChange.emit(e)},Z("div",{class:"center col"},Z("img",{src:t.picture}),Z("span",{class:"name"},Cn(t.name,6))))}}))}};bx([On()],kx.prototype,"meeting",void 0),bx([On()],kx.prototype,"states",void 0),bx([On()],kx.prototype,"config",void 0),bx([On()],kx.prototype,"iconPack",void 0),bx([On()],kx.prototype,"t",void 0),kx.style=".scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{box-sizing:border-box;display:flex;height:100%;width:var(--rtk-space-16, 64px);flex-direction:column;gap:var(--rtk-space-2, 8px);overflow-y:auto;font-family:var(--rtk-font-family, sans-serif)}rtk-button{z-index:10}.col{display:flex;flex-direction:column;align-items:center}.tab{display:flex;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);align-items:center;justify-content:center;margin-bottom:var(--rtk-space-2, 8px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.tab.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}.tab img{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);border-radius:var(--rtk-border-radius-sm, 4px)}.tab .name{margin-top:var(--rtk-space-0\\.5, 2px)}:host([size='sm']){flex-direction:column;margin-top:var(--rtk-space-4, 16px);height:var(--rtk-space-16, 64px);width:100%;flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-x:auto}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);text-overflow:clip;min-width:100px;height:40px}:host([size='sm']) .tab .col{display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-2, 8px)}:host([size='sm']) .tab .col img,:host([size='sm']) .tab .col rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) .tab .col .name{gap:var(--rtk-space-1, 4px)}:host([layout='column']){flex-direction:column}:host([layout='column']) .aside{flex:2;max-width:100%;width:100%}@media (orientation: portrait){:host([size='sm']){margin-top:var(--rtk-space-2, 8px);height:var(--rtk-space-16, 64px);width:100%;flex-direction:row;transition:all 0.3s linear}:host([size='md']){height:var(--rtk-space-24, 96px);width:100%;flex-direction:row;transition:all 0.3s linear}:host .tab{margin:var(--rtk-space-0, 0px)}}@media (orientation: landscape){:host([size='sm']){margin-right:var(--rtk-space-4, 16px);height:100%;width:var(--rtk-space-14, 56px);flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-y:auto;overflow-x:hidden;transition:all 0.3s linear}:host([size='md']){margin-right:var(--rtk-space-4, 16px);height:100%;width:var(--rtk-space-14, 56px);flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-y:auto;overflow-x:hidden;transition:all 0.3s linear}:host .tab{margin:var(--rtk-space-0, 0px)}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);width:100%;text-overflow:clip;min-width:0px;min-height:40px}:host([size='sm']) .tab .col{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-2, 8px);font-size:10px}:host([size='sm']) .tab .col img,:host([size='sm']) .tab .col rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}:host([size='sm']) .tab .col .name{gap:var(--rtk-space-1, 4px)}}";var yx=Object.freeze({__proto__:null,rtk_plugin_main:vx,rtk_tab_bar:kx});var wx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Sx=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.config=sn(),this.iconPack=pn,this.t=un(),this.plugins=[],this.canStartPlugins=!1,this.canClosePlugins=!1,this.activatedPluginsId=[],this.close=()=>{this.stateUpdate.emit({activeSidebar:!1,sidebar:void 0})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;null===(e=this.meeting)||void 0===e||e.plugins.all.removeListener("stateUpdate",this.updateActivePlugins)}meetingChanged(e){null!=e&&(this.canStartPlugins=e.self.permissions.plugins.canStart,this.canClosePlugins=e.self.permissions.plugins.canClose,this.plugins=e.plugins.all.toArray().filter(t=>{var i;return!(null===(i=e.self.config.disabledPlugins)||void 0===i?void 0:i.includes(t.id))}),this.updateActivePlugins=()=>{this.activatedPluginsId=e.plugins.active.toArray().map(e=>e.id)},this.updateActivePlugins(),e.plugins.all.addListener("stateUpdate",this.updateActivePlugins))}render(){return Z(J,{key:"c0621bcd1d64b1eb9e4b913bb2707d66179848a8"},Z("ul",{key:"2796e509a4df169a3b6455b06e33bcf9e1e634d4",class:"scrollbar"},this.plugins.map(e=>Z("li",{key:e.name,class:"plugin"},Z("div",{class:"metadata"},Z("img",{src:e.picture}),Z("div",{class:"name"},e.name)),!this.activatedPluginsId.includes(e.id)&&this.canStartPlugins&&Z("div",{class:"buttons"},Z("rtk-button",{kind:"icon",size:"lg",onClick:()=>{e.activate(),this.close()},"aria-label":"".concat(this.t("activate")," ").concat(e.name)},Z("rtk-icon",{icon:this.iconPack.rocket,tabIndex:-1,"aria-hidden":!0}))),this.activatedPluginsId.includes(e.id)&&this.canClosePlugins&&Z("div",{class:"buttons"},Z("rtk-button",{kind:"icon",size:"lg",onClick:()=>{e.deactivate()},"aria-label":"".concat(this.t("close")," ").concat(e.name)},Z("rtk-icon",{icon:this.iconPack.dismiss,tabIndex:-1,"aria-hidden":!0})))))))}static get watchers(){return{meeting:["meetingChanged"]}}};wx([On()],Sx.prototype,"meeting",void 0),wx([On()],Sx.prototype,"config",void 0),wx([On()],Sx.prototype,"iconPack",void 0),wx([On()],Sx.prototype,"t",void 0),Sx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;height:100%;width:100%;flex-direction:column;font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}h3{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);display:block;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}ul{overflow-y:auto;padding:var(--rtk-space-0, 0px);flex-grow:1;flex-basis:0}.metadata{display:flex;align-items:center}.metadata img{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-sm, 4px)}.metadata .name{margin-left:var(--rtk-space-2, 8px);font-weight:500}.plugin{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.plugin .buttons{display:flex;align-items:center}rtk-button:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-ring-opacity));--tw-ring-offset-width:2px;--tw-ring-offset-color:rgb(var(--rtk-colors-background-1000, 8 8 8))}";var xx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ex=class{constructor(e){f(this,e),this.config=sn(),this.iconPack=pn,this.t=un(),this.create=!1,this.polls=[],this.onPollsUpdate=e=>{this.polls=[...e.polls]},this.onUpdatePermissions=()=>{this.permissions=this.meeting.self.permissions}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;this.meeting&&(null===(e=this.meeting.polls)||void 0===e||e.removeListener("pollsUpdate",this.onPollsUpdate),this.meeting.self.permissions.removeListener("pollsUpdate",this.onUpdatePermissions))}meetingChanged(e){e&&e.polls&&(this.permissions=this.meeting.self.permissions,this.polls=[...e.polls.items],e.polls.addListener("pollsUpdate",this.onPollsUpdate),this.meeting.self.permissions.addListener("pollsUpdate",this.onUpdatePermissions),this.onCreate=async t=>{this.create=!1,await e.polls.create(t.question,t.options,t.anonymous,t.hideVotes)},this.onVote=async(t,i)=>{await e.polls.vote(t,i)})}toggleCreateState(){this.create=!this.create}componentDidRender(){vs(this.pollEl)}render(){var e,t;return Z(J,{key:"41908b79966d12fc13782a05b2763e233d0ef8c7"},Z("div",{key:"87f36d5e811009624ffc1f1d18f55aefc50f6c8e",class:"ctr",part:"container"},Z("div",{key:"cc5170445db169e2de47e18d7d0dac0bf932726a",class:"polls-view scrollbar",ref:e=>this.pollEl=e,part:"polls"},0==this.polls.length&&!0!==this.create&&Z("div",{key:"9d1db7791f35b78137726957bcac10cba381227e",class:"empty-polls"},this.t("polls.empty")),this.polls.map(e=>{var t;return Z("rtk-poll",{key:e.id,poll:e,onRtkVotePoll:e=>{this.onVote(e.detail.id,e.detail.index)},self:null===(t=this.meeting)||void 0===t?void 0:t.self.userId,iconPack:this.iconPack,t:this.t,permissions:this.permissions})}),this.create&&Z("rtk-poll-form",{key:"9f73d645076a512dfffc3009dada18c137b918d0",part:"poll-form",onRtkCreatePoll:e=>{this.onCreate(e.detail)},iconPack:this.iconPack,t:this.t})),(null===(t=null===(e=this.permissions)||void 0===e?void 0:e.polls)||void 0===t?void 0:t.canCreate)&&Z("rtk-button",{key:"e24dd4ab4c0e61acdbcff002ef16553214cfb94e",kind:"wide",onClick:()=>this.toggleCreateState(),variant:this.create?"secondary":"primary",part:"button"},this.create?this.t("polls.cancel"):this.t("polls.create"))))}static get watchers(){return{meeting:["meetingChanged"]}}};xx([On()],Ex.prototype,"meeting",void 0),xx([On()],Ex.prototype,"config",void 0),xx([On()],Ex.prototype,"iconPack",void 0),xx([On()],Ex.prototype,"t",void 0),Ex.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{margin-top:var(--rtk-space-2, 8px);display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}*{box-sizing:border-box}.ctr{box-sizing:border-box;padding:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-0, 0px);display:flex;flex:1 1 0%;flex-direction:column}.polls-view{overflow-y:auto;flex:1 1 0%;flex-basis:0}.empty-polls{display:flex;height:100%;width:100%;align-items:center;justify-content:center}";var Tx=Object.freeze({__proto__:null,rtk_plugins:Sx,rtk_polls:Ex});var _x=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Px=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un()}render(){var e,t;if(!this.meeting)return null;const i={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},r=this.states,n=!0===(null===(e=null===r||void 0===r?void 0:r.prefs)||void 0===e?void 0:e.muteNotificationSounds)||"true"===kn("mute-notification-sounds");return Z(J,null,Z("rtk-microphone-selector",Object.assign({},i),Z("rtk-audio-visualizer",{participant:null===(t=this.meeting)||void 0===t?void 0:t.self,iconPack:this.iconPack,t:this.t,slot:"indicator"})),Z("rtk-speaker-selector",Object.assign({},i)),Z("div",{class:"group",part:"notification-toggle"},Z("div",{class:"row"},Z("label",{htmlFor:"notification-toggle"},this.t("settings.notification_sound")),Z("rtk-switch",{id:"notification-toggle",checked:!n,onRtkChange:e=>{const{checked:t}=e.target,i=!t;this.stateUpdate.emit({prefs:{muteNotificationSounds:i}}),bn("mute-notification-sounds",i)},iconPack:this.iconPack,t:this.t}))))}};_x([On()],Px.prototype,"meeting",void 0),_x([On()],Px.prototype,"states",void 0),_x([On()],Px.prototype,"iconPack",void 0),_x([On()],Px.prototype,"t",void 0),Px.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column}audio{visibility:hidden}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}rtk-audio-visualizer{flex-shrink:0}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}rtk-button rtk-icon{margin-right:var(--rtk-space-2, 8px)}";var Cx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ax=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.iconPack=pn,this.t=un(),this.onVideoUpdate=e=>{this.videoEnabled=e.videoEnabled}}componentDidLoad(){this.meetingChanged(this.meeting)}meetingChanged(e){var t;e&&(this.videoEnabled=e.self.videoEnabled,null===(t=e.self)||void 0===t||t.addListener("videoUpdate",this.onVideoUpdate))}disconnectedCallback(){var e;null===(e=this.meeting.self)||void 0===e||e.removeListener("videoUpdate",this.onVideoUpdate)}render(){var e,t,i;if(!this.meeting)return null;const r={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},n=this.states,s=!0===(null===(e=null===n||void 0===n?void 0:n.prefs)||void 0===e?void 0:e.mirrorVideo)||"true"===kn("mirror-video");return Z(J,null,Z("div",{class:"section",part:"tile-preview"},Z("div",{class:"group",part:"tile-preview"},!0===this.videoEnabled?Z("rtk-participant-tile",{meeting:this.meeting,participant:null===(t=this.meeting)||void 0===t?void 0:t.self,iconPack:this.iconPack,t:this.t,states:n,size:this.size,isPreview:!0}):Z("div",{class:"camera-off-helper"},Z("rtk-participant-tile",{meeting:this.meeting,participant:null===(i=this.meeting)||void 0===i?void 0:i.self,size:this.size},Z("div",null,Z("rtk-icon",{id:"icon",icon:this.iconPack.video_off,tabIndex:-1,"aria-hidden":!0}),Z("div",null,this.t("settings.camera_off"))))))),Z("rtk-camera-selector",Object.assign({},r)),Z("div",{class:"group",part:"mirror-toggle"},Z("div",{class:"row"},Z("label",{htmlFor:"mirror-toggle"},this.t("settings.mirror_video")),Z("rtk-switch",{checked:s,iconPack:this.iconPack,t:this.t,onRtkChange:e=>{const{checked:t}=e.target;this.stateUpdate.emit({prefs:{mirrorVideo:t}}),bn("mirror-video",t)}}))))}static get watchers(){return{meeting:["meetingChanged"]}}};Cx([On()],Ax.prototype,"meeting",void 0),Cx([On()],Ax.prototype,"states",void 0),Cx([On()],Ax.prototype,"iconPack",void 0),Cx([On()],Ax.prototype,"t",void 0),Ax.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5)}:host{display:flex;width:100%;flex-direction:column}.rtk-select{width:100%;text-overflow:ellipsis}rtk-participant-tile{margin-left:auto;margin-right:auto;margin-bottom:var(--rtk-space-4, 16px);max-width:100%}#icon{padding-bottom:var(--rtk-space-1, 4px)}.apply-button{height:var(--rtk-space-10, 40px)}label{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:14px}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.section{display:flex;flex-direction:column}@media only screen and (max-height: 480px) and (orientation: landscape){:host{flex-direction:row}:host([size='sm']){flex-direction:row}.section[part='tile-preview']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);max-height:90%;max-width:40%;flex-shrink:1}.section[part='video-settings']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);flex-grow:1}}";var Rx=Object.freeze({__proto__:null,rtk_settings_audio:Px,rtk_settings_video:Ax});const Lx=class{constructor(e){f(this,e),this.dismiss=re(this,"rtkTranscriptDismiss",7),this.t=un()}connectedCallback(){this.transcriptChanged(this.transcript)}transcriptChanged(e,t){if((null===t||void 0===t?void 0:t.renderedId)===e.renderedId&&(null===t||void 0===t?void 0:t.transcript)===e.transcript)return;if(clearTimeout(this.timeout),!(null===e||void 0===e?void 0:e.name)||!(null===e||void 0===e?void 0:e.transcript))return;const{id:i,renderedId:r}=e;this.timeout=setTimeout(()=>{this.dismiss.emit({id:i,renderedId:r})},1e4)}render(){return Z(J,{key:"f114d024507ae77ac2597ecd060e3ff44ff14b62"},Z("div",{key:"0a2b1de3c21d77fcf73a0e025e8faa82b61ac23e",class:"ctr"},Z("p",{key:"eee54f37929772f547113c899cbbcd89e451f64d",class:"message"},Z("span",{key:"3599abf0271f4847d0e19629c9966b02a168bdb8",class:"name"},this.transcript.name),": ",this.transcript.transcript)))}static get watchers(){return{transcript:["transcriptChanged"]}}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],Lx.prototype,"t",void 0),Lx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;color:rgb(var(--rtk-colors-text-1000, 255 255 255));display:flex;justify-content:center;vertical-align:middle;animation:show 0.4s ease;transition:0.4s;z-index:5;width:100%}.ctr{box-sizing:border-box;display:inline-flex;height:100%;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto;padding:var(--rtk-space-3, 12px);overflow:auto;max-width:50%}.message{margin:var(--rtk-space-0, 0px);display:inline-block;justify-content:center;max-width:100%;text-wrap:wrap;line-height:1.5rem}.message .name{font-weight:bold}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateY(120px)}100%{opacity:1;transform:translateY(0px)}}@keyframes exit{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-120px)}}:host([size='sm']){font-size:14px}";var Ix=Object.freeze({__proto__:null,rtk_transcript:Lx});const Mx=(e,t)=>{if(null==e)return;const i=Math.round(1.5),r=[...Array(3)].map((e,r)=>{let n=r;return n>i-1&&(n=3-n-1),Math.round((n+1)/(i+1)*t)}),{width:n,height:s}=e,a=e.getContext("2d");let o=2;const c=1*n/r.length,l=c-4;a.clearRect(0,0,n,s),a.fillStyle="rgb(0,0,0,0.0)",a.fillRect(0,0,n,s);const d=getComputedStyle(e).getPropertyValue("color");a.fillStyle=d,a.strokeStyle=d,a.lineCap="round",a.lineWidth=4,a.beginPath();for(const h of r){const e=Math.min(-Math.abs(1.2*h/10*s)+s/2,s/2-2.5),t=Math.max(2*(s/2-e),5);a.moveTo(o+l/2,e),a.lineTo(o+l/2,e+t),o+=c}a.stroke()};var Dx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ox=class{constructor(e){f(this,e),this.variant="bars",this.iconPack=pn,this.t=un(),this.hideMuted=!1,this.isScreenShare=!1,this.volume=0}connectedCallback(){this.participantChanged(this.participant)}componentDidLoad(){Mx(this.visualizer,0)}disconnectedCallback(){var e,t,i;null===(e=this.hark)||void 0===e||e.stop(),this.audioUpdateListener&&(null===(t=this.participant)||void 0===t||t.removeListener("audioUpdate",this.audioUpdateListener)),this.screenShareUpdateListener&&(null===(i=this.participant)||void 0===i||i.removeListener("screenShareUpdate",this.screenShareUpdateListener))}participantChanged(e){null!=e&&(this.audioUpdateListener=e=>{let{audioEnabled:t,audioTrack:i}=e;var r;if(null===(r=this.hark)||void 0===r||r.stop(),t&&null!=i){this.audioEnabled=!0;const e=new MediaStream;e.addTrack(i),this.calcVolume(e),Mx(this.visualizer,0)}else this.volume=0,this.audioEnabled=!1},this.isScreenShare?(this.screenShareUpdateListener=e=>{let{screenShareEnabled:t,screenShareTracks:i}=e;this.audioUpdateListener({audioEnabled:t&&null!=i.audio,audioTrack:i.audio})},this.screenShareUpdateListener({screenShareEnabled:e.screenShareEnabled,screenShareTracks:{audio:e.screenShareTracks.audio,video:e.screenShareTracks.video}}),e.addListener("screenShareUpdate",this.screenShareUpdateListener)):(this.audioUpdateListener(e),e.addListener("audioUpdate",this.audioUpdateListener)))}calcVolume(e){this.hark=_d(e,{play:!1,interval:100}),this.hark.on("volume_change",e=>{const t=this.volume;let i=Math.round(10**(e/115)*10);i<3&&(i=0);let r=Math.round((2*t+i)/3);t!==r&&(this.volume=r,Mx(this.visualizer,this.volume))})}render(){return this.hideMuted&&!this.audioEnabled?null:Z(J,null,Z("div",{class:{audioActivePadding:this.hideMuted&&this.audioEnabled}},Z("canvas",{width:"24",height:"24",class:{bars:!0,visible:this.audioEnabled},ref:e=>this.visualizer=e,part:"canvas"}),!this.isScreenShare&&!this.audioEnabled&&Z("rtk-icon",{icon:this.iconPack.mic_off,part:"mic-off-icon"})))}static get watchers(){return{participant:["participantChanged"]}}};Dx([On()],Ox.prototype,"iconPack",void 0),Dx([On()],Ox.prototype,"t",void 0),Ox.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;width:-moz-fit-content;width:fit-content}.audioActivePadding{padding:var(--rtk-space-1, 4px)}canvas,rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){transform:scale(0.9)}canvas{display:none}canvas.visible{display:block}canvas.bars{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}";var Nx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Ux=class{constructor(e){f(this,e),this.iconPack=pn,this.variant="full",this.t=un(),this.audioinputDevices=[],this.canProduceAudio=!0,this.currentDevices={audio:void 0},this.stageStateListener=()=>{this.canProduceAudio="ALLOWED"===this.meeting.self.permissions.canProduceAudio},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getAudioDevices();this.audioinputDevices=e},this.deviceUpdateListener=e=>{let{device:t}=e;"audioinput"===t.kind&&(this.currentDevices={audio:t})},this.mediaPermissionUpdateListener=async e=>{let{kind:t,message:i}=e;this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.audioinputDevices=await this.meeting.self.getAudioDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i,r,n;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.stageStateListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(r=this.meeting)||void 0===r||r.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(n=this.meeting)||void 0===n||n.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}meetingChanged(e){e&&M(async()=>{var t,i;const{self:r,stage:n}=e,s=await e.self.getAudioDevices(),a=null===(t=e.self.getCurrentDevices())||void 0===t?void 0:t.audio;this.currentDevices={audio:a},this.canProduceAudio="ALLOWED"===e.self.permissions.canProduceAudio,null===n||void 0===n||n.addListener("stageStatusUpdate",this.stageStateListener),r.addListener("deviceListUpdate",this.deviceListUpdateListener),r.addListener("deviceUpdate",this.deviceUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),this.audioinputDevices=void 0!=a?[null!==(i=s.find(e=>e.deviceId===a.deviceId))&&void 0!==i?i:a,...s.filter(e=>e.deviceId!==a.deviceId)]:s})}setDevice(e){var t;if(mt(this.meeting))return;const i=this.audioinputDevices.find(t=>t.deviceId===e);null!=i&&(this.currentDevices={audio:i},null===(t=this.meeting)||void 0===t||t.self.setDevice(i))}render(){if(!this.meeting)return null;let e=0;return Z(J,null,this.canProduceAudio&&Z("div",{part:"microphone-selection",class:"group container "+this.variant},Z("label",{slot:"label"},"inline"!==this.variant&&this.t("settings.microphone_input"),Z("rtk-icon",{icon:this.iconPack.mic_on,size:"sm"})),Z("div",{class:"row"},Z("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.audioinputDevices.map(t=>{let{deviceId:i,label:r}=t;var n;return Z("option",{value:i,selected:(null===(n=this.currentDevices.audio)||void 0===n?void 0:n.deviceId)===i},r||"Microphone ".concat(++e))})),Z("slot",{name:"indicator"}))))}static get watchers(){return{meeting:["meetingChanged"]}}};Nx([On()],Ux.prototype,"meeting",void 0),Nx([On()],Ux.prototype,"iconPack",void 0),Nx([On()],Ux.prototype,"t",void 0),Ux.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var Fx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const jx=class{constructor(e){f(this,e),this.variant="full",this.iconPack=pn,this.t=un(),this.speakerDevices=[],this.currentDevices={speaker:void 0},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getSpeakerDevices();this.speakerDevices=e},this.deviceUpdateListener=e=>{let{device:t}=e;"audiooutput"===t.kind&&(this.currentDevices={speaker:t})},this.mediaPermissionUpdate=async e=>{let{kind:t,message:i}=e;this.meeting&&"audio"===t&&"ACCEPTED"===i&&(this.speakerDevices=await this.meeting.self.getSpeakerDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i;null===(e=this.meeting)||void 0===e||e.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(t=this.meeting)||void 0===t||t.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(i=this.meeting)||void 0===i||i.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate)}meetingChanged(e){e&&M(async()=>{var t,i;const{self:r}=e,n=await e.self.getSpeakerDevices(),s=null===(t=e.self.getCurrentDevices())||void 0===t?void 0:t.speaker;this.currentDevices={speaker:s},r.addListener("deviceListUpdate",this.deviceListUpdateListener),r.addListener("deviceUpdate",this.deviceUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate),this.speakerDevices=void 0!=s?[null!==(i=n.find(e=>e.deviceId===s.deviceId))&&void 0!==i?i:s,...n.filter(e=>e.deviceId!==s.deviceId)]:n})}testAudio(){var e;null===(e=this.testAudioEl)||void 0===e||e.play()}setDevice(e){var t,i;if(mt(this.meeting))return;const r=this.speakerDevices.find(t=>t.deviceId===e);this.currentDevices={speaker:r},null!=r&&(null===(t=this.meeting)||void 0===t||t.self.setDevice(r),null===(i=this.testAudioEl)||void 0===i||i.setSinkId(r.deviceId))}render(){if(!this.meeting)return null;let e=0;return Z(J,null,Z("audio",{preload:"auto",src:"https://rtk-assets.realtime.cloudflare.com/ui-kit/speaker-test.mp3",ref:e=>this.testAudioEl=e}),Z("div",{class:"group "+this.variant,part:"speaker-selection"},this.speakerDevices.length>0&&!mt(this.meeting)&&Z("div",{class:"container"},Z("label",null,"inline"!==this.variant&&this.t("settings.speaker_output"),Z("rtk-icon",{icon:this.iconPack.speaker,size:"sm"})),Z("div",{class:"row"},Z("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.speakerDevices.map(t=>{let{deviceId:i,label:r}=t;var n;return Z("option",{value:i,selected:(null===(n=this.currentDevices.speaker)||void 0===n?void 0:n.deviceId)===i},r||"Speaker ".concat(++e))})))),"full"===this.variant&&Z("rtk-button",{variant:"secondary",onClick:()=>this.testAudio()},Z("rtk-icon",{icon:this.iconPack.speaker,slot:"start"}),this.t("test"))))}static get watchers(){return{meeting:["meetingChanged"]}}};Fx([On()],jx.prototype,"meeting",void 0),Fx([On()],jx.prototype,"states",void 0),Fx([On()],jx.prototype,"iconPack",void 0),Fx([On()],jx.prototype,"t",void 0),jx.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline .container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var Bx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Vx=class{constructor(e){f(this,e),this.onChange=re(this,"rtkChange",4),this.checked=!1,this.readonly=!1,this.disabled=!1,this.iconPack=pn,this.t=un(),this.onClick=()=>{this.readonly||this.disabled||(this.checked=!this.checked)},this.onKeyPress=e=>{if(!this.readonly)switch(e.key){case"Enter":case" ":this.checked=!this.checked}}}connectedCallback(){this.checkedChange(this.checked)}checkedChange(e){this.checked=e,this.onChange.emit(e)}render(){return Z(J,{key:"74affe48ce91e7be340e9d37507859fdd473bcb1",role:"switch",tabIndex:this.disabled&&0,"aria-readonly":this.readonly,"aria-checked":this.checked,"aria-disabled":this.disabled,class:{checked:this.checked},onClick:this.onClick,onKeyPress:this.onKeyPress},Z("div",{key:"24ae27603c839d40d6452c5ee669342acb60f73d",class:"switch",part:"switch"}))}static get watchers(){return{checked:["checkedChange"]}}};Bx([On()],Vx.prototype,"iconPack",void 0),Bx([On()],Vx.prototype,"t",void 0),Vx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-10, 40px);align-items:center;padding:var(--rtk-space-1, 4px);border-radius:9999px;background-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));cursor:pointer}.switch{box-sizing:border-box;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);background-color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:9999px;transition-property:var(--rtk-transition-property, all);transition-duration:200ms}:host(.checked){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host(.checked) .switch{transform:translateX(100%)}:host([readonly]),:host([disabled]){cursor:not-allowed;opacity:0.6}";var zx=Object.freeze({__proto__:null,rtk_audio_visualizer:Ox,rtk_microphone_selector:Ux,rtk_speaker_selector:jx,rtk_switch:Vx});var Hx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const $x=class{constructor(e){f(this,e),this.stateUpdate=re(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=pn,this.t=un(),this.fullScreenActive=!1,this.isFullScreenSupported=!0,this.onFullScreenchange=()=>{this.fullScreenActive=Ip()},this.toggleFullScreen=()=>{let e=this.targetElement||document.querySelector("rtk-meeting");e&&(this.fullScreenActive?(Lp(),this.fullScreenActive=!1):(Rp(e),this.fullScreenActive=!0),this.stateUpdate.emit({activeMoreMenu:!1}))}}connectedCallback(){this.isFullScreenSupported=Mp(),this.onFullScreenchange(),window.addEventListener("webkitfullscreenchange",this.onFullScreenchange),window.addEventListener("fullscreenchange",this.onFullScreenchange)}disconnectedCallback(){window.removeEventListener("webkitfullscreenchange",this.onFullScreenchange),window.removeEventListener("fullscreenchange",this.onFullScreenchange)}render(){return this.isFullScreenSupported?Z(J,{title:this.t("full_screen")},Z("rtk-controlbar-button",{size:this.size,iconPack:this.iconPack,onClick:this.toggleFullScreen,icon:this.fullScreenActive?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize,label:this.fullScreenActive?this.t("full_screen.exit"):this.t("full_screen"),variant:this.variant})):Z(J,{"data-hidden":!0})}};Hx([On()],$x.prototype,"states",void 0),Hx([On()],$x.prototype,"iconPack",void 0),Hx([On()],$x.prototype,"t",void 0),$x.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}";var Gx=Object.freeze({__proto__:null,rtk_fullscreen_toggle:$x});var Wx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const qx=class{constructor(e){f(this,e),this.rtkSendNotification=re(this,"rtkSendNotification",7),this.pinnedListener=e=>{let{isPinned:t}=e;this.isPinned=t},this.toggleTileListener=e=>{let{hidden:t}=e;this.isHidden=t},this.stageListener=e=>{let{stageStatus:t}=e;this.isOnStage="ON_STAGE"===t},this.view="sidebar",this.iconPack=pn,this.t=un(),this.config=sn(),this.audioEnabled=!1,this.videoEnabled=!1,this.isPinned=!1,this.isHidden=!1,this.isOnStage=!1,this.canDisableParticipantAudio=!1,this.canDisableParticipantVideo=!1,this.canKickParticipant=!1,this.canPinParticipant=!1,this.canAllowParticipantOnStage=!1,this.menuOpen=!1,this.permissionsUpdateListener=()=>{this.meetingChanged(this.meeting)},this.inviteToStageToggle=async()=>{const e=this.participant,{stage:t}=this.meeting;"ACCEPTED_TO_JOIN_STAGE"!==e.stageStatus?(this.isOnStage?(e.isPinned&&e.unpin(),await t.kick([e.userId])):(await t.grantAccess([e.userId]),this.rtkSendNotification.emit({message:"".concat(e.name," ").concat(this.t("stage.invited_notification")),trace:"join-stage-invite-".concat(e.id)})),this.isOnStage="ON_STAGE"===e.stageStatus):this.rtkSendNotification.emit({message:"".concat(e.name," ").concat(this.t("stage.invited_notification")),trace:"join-stage-".concat(e.id)})},this.handleOutsideClick=e=>{!e.composedPath().includes(this.host)&&this.menuOpen&&(this.menuOpen=!1)},this.update=()=>{const e=this.host.shadowRoot.getElementById("trigger"),t=this.host.shadowRoot.getElementById("menu-list");ic(e,t,{placement:"bottom-end",middleware:[Jo({allowedPlacements:["bottom-end","top-end"],alignment:"end"}),Yo(4),Qo({padding:8}),ec()]}).then(e=>{let{x:i,y:r,placement:n}=e,s=null;s="bottom-end"===n?{right:"".concat(i,"px"),top:"".concat(r,"px")}:{right:"".concat(i,"px"),bottom:"".concat(r,"px")},Object.assign(t.style,s)})},this.onMenuToggle=()=>{this.menuOpen=!this.menuOpen,this.menuOpen&&this.update()}}connectedCallback(){this.meetingChanged(this.meeting),this.participantChanged(this.participant),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){var e;document.removeEventListener("click",this.handleOutsideClick),null===(e=this.meeting)||void 0===e||e.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener),null!=this.participant&&void 0!=this.participant.removeListener&&(this.audioUpdateListener&&this.participant.removeListener("audioUpdate",this.audioUpdateListener),this.videoUpdateListener&&this.participant.removeListener("videoUpdate",this.videoUpdateListener),this.participant.removeListener("pinned",this.pinnedListener),this.participant.removeListener("unpinned",this.pinnedListener),this.participant.removeListener("stageStatusUpdate",this.stageListener),this.participant.removeListener("toggleTile",this.toggleTileListener))}meetingChanged(e){var t,i,r,n,s,a,o;if(null!=e){const{self:c}=e;this.canDisableParticipantAudio=c.permissions.canAllowParticipantAudio||c.permissions.canDisableParticipantAudio,this.canDisableParticipantVideo=c.permissions.canAllowParticipantVideo||c.permissions.canDisableParticipantVideo,this.canKickParticipant=c.permissions.kickParticipant&&!0!==(null===(t=this.meeting)||void 0===t?void 0:t.__internals__.features.hasFeature(ht))&&(!0!==(null===(i=this.meeting)||void 0===i?void 0:i.__internals__.features.hasFeature(ut))||"webinar_admin"!==(null===(r=this.participant)||void 0===r?void 0:r.presetName)),this.canPinParticipant=c.permissions.pinParticipant,this.canAllowParticipantOnStage=c.permissions.acceptStageRequests&&c.permissions.stageEnabled&&(!0!==(null===(n=this.meeting)||void 0===n?void 0:n.__internals__.features.hasFeature(ut))||"webinar_admin"!==(null===(s=this.participant)||void 0===s?void 0:s.presetName))&&(!0!==(null===(a=this.meeting)||void 0===a?void 0:a.__internals__.features.hasFeature(pt))||"webinar_viewer"!==(null===(o=this.participant)||void 0===o?void 0:o.presetName)),e.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener)}}participantChanged(e){var t;if(null!=e){if(this.audioEnabled=e.audioEnabled,this.videoEnabled=e.videoEnabled,this.isPinned=e.isPinned,this.isHidden=null!==(t=e.hidden)&&void 0!==t&&t,this.isOnStage="ON_STAGE"===e.stageStatus,this.audioUpdateListener=e=>{let{audioEnabled:t}=e;this.audioEnabled=t},this.videoUpdateListener=e=>{let{videoEnabled:t}=e;this.videoEnabled=t},void 0==e.addListener)return;e.addListener("audioUpdate",this.audioUpdateListener),e.addListener("videoUpdate",this.videoUpdateListener),e.addListener("pinned",this.pinnedListener),e.addListener("unpinned",this.pinnedListener),e.addListener("stageStatusUpdate",this.stageListener),this.participant.addListener("toggleTile",this.toggleTileListener)}}render(){var e,t,i,r,n,s,a,o,c;const l="AUDIO_ROOM"===(null===(e=this.meeting)||void 0===e?void 0:e.meta.viewType),d=(null===(t=this.meeting)||void 0===t?void 0:t.self.id)===this.participant.id,h=this.canDisableParticipantAudio&&this.audioEnabled||this.canDisableParticipantVideo&&this.videoEnabled&&!l||this.canKickParticipant||this.canPinParticipant&&this.isOnStage||this.canAllowParticipantOnStage,u=Ln((null===(i=this.participant)||void 0===i?void 0:i.name)||""),p=this.isOnStage||["GROUP_CALL","AUDIO_ROOM"].includes(null===(r=this.meeting)||void 0===r?void 0:r.meta.viewType),g={meeting:this.meeting,size:"sm",states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return Z(J,{key:"804f9c2daf473fd518c6697a51b82f5baf63fb17"},Z("div",{class:"left",key:null===(n=this.participant)||void 0===n?void 0:n.id},Z("rtk-avatar",{key:"98f6f1a031269f5ca6523ed38228bcb64a3fe97d",participant:this.participant,size:"sm",iconPack:this.iconPack,t:this.t}),Z("p",{key:"de05ef0806cb0e614bae951715ec263cb2271492",class:"name",title:u},Cn(u,16)," ",(null===(s=this.meeting)||void 0===s?void 0:s.self.id)===(null===(a=this.participant)||void 0===a?void 0:a.id)&&this.t("(you)"))),"sidebar"===this.view&&Z("div",{key:"8393d899384cac8ff0e248a76f4095922f98e1cb",class:"right"},p&&Z("rtk-icon",{key:"7b99b6269a101d01a8014dc4038b6bcada21203f",class:{red:!this.audioEnabled},icon:this.audioEnabled?this.iconPack.mic_on:this.iconPack.mic_off}),p&&!l&&Z("rtk-icon",{key:"e6e7d7e8a50a9ad0be657b85245252300182c539",class:{red:!this.videoEnabled},icon:this.videoEnabled?this.iconPack.video_on:this.iconPack.video_off}),(h||(e=>{let{element:t,defaults:i,props:r={},elementProps:n={}}=e;var s;const{config:a,size:o,states:c}=i;let l,d={},h=[];Array.isArray(t)?[l,d,...h]=t:l=t;const u=null===(s=null===a||void 0===a?void 0:a.root)||void 0===s?void 0:s[l];null!=u&&"props"in u&&(r=Object.assign(Object.assign({},u.props),r)),r=Object.assign(Object.assign({},r),d),l in n&&(r=Object.assign(Object.assign({},r),n[l]));const p=bs({element:l,size:o,states:c,config:a});return ks({selectors:p,root:a.root}).length})({element:"rtk-participant",defaults:g,childProps:{participant:this.participant}})>0)&&Z("div",{key:"085e0ffe3c230ef1f21ed5de6c11ef70ccfeb69b",class:"menu"},Z("span",{key:"ab295b485204509824a6bce511a80ec939e31fbb",id:"trigger",onClick:this.onMenuToggle},Z("rtk-button",{key:"0f0cb35c69e63ba8d8b3835cec42aba9f65dc6b8",variant:"ghost",kind:"icon",slot:"trigger"},Z("rtk-icon",{key:"ebd5705879751573de28ddad204d8f16b055a2b9",class:"more",icon:this.iconPack.more_vertical}))),Z("span",{key:"98ec81219c735d44ba36eb2e677b734cc43e478d",id:"menu-list"},this.menuOpen&&Z("rtk-menu-list",{key:"243c43eacd1c429f4c7bd2fcd24fef3983209226",iconPack:this.iconPack,t:this.t},this.canPinParticipant&&p&&!l&&Z("rtk-menu-item",{key:"93b74a42b5b37fe15bcbe7a5217258c8cb2b48b9",onClick:()=>{this.isPinned?this.participant.unpin():this.participant.pin()},iconPack:this.iconPack,t:this.t},Z("rtk-icon",{key:"0c1c8f6cc7b10c2fdea37f79ad0fc00cbb50f1d6",icon:this.isPinned?this.iconPack.pin_off:this.iconPack.pin,slot:"start"}),this.isPinned?this.t("unpin"):this.t("pin")),d&&Z("rtk-menu-item",{key:"dd4d5dff2c77f93a233a5f565d9d64fddb660c0d",iconPack:this.iconPack,t:this.t,onClick:()=>{this.isHidden?this.participant.show():this.participant.hide()}},Z("rtk-icon",{key:"fdfc1cfeca1b1c63dd27fcc31a658f1d1a8d5c17",icon:this.isHidden?this.iconPack.minimize:this.iconPack.maximize,slot:"start"}),this.meeting.self.hidden?this.t("maximize"):this.t("minimize")),this.canDisableParticipantAudio&&p&&this.audioEnabled&&Z("rtk-menu-item",{key:"95edf3439889a9c468acce8ef88ababef747e018",iconPack:this.iconPack,t:this.t,onClick:()=>{this.participant.disableAudio()}},Z("rtk-icon",{key:"1df60ff6541717369a5c8c1fa47dcb09e2499f8d",icon:this.iconPack.mic_off,slot:"start"}),this.t("mute")),this.canDisableParticipantVideo&&p&&this.videoEnabled&&Z("rtk-menu-item",{key:"e3812a8631be2f84695b90ac80f0214a26495071",iconPack:this.iconPack,t:this.t,onClick:()=>{this.participant.disableVideo()}},Z("rtk-icon",{key:"634c9c452ecd36d6c024cbb0e22a79059f4b85a6",icon:this.iconPack.video_off,slot:"start"}),this.t("participants.turn_off_video")),this.canAllowParticipantOnStage&&(null===(o=this.participant)||void 0===o?void 0:o.id)!==(null===(c=this.meeting)||void 0===c?void 0:c.self.id)&&Z("rtk-menu-item",{key:"3428e0c1d22f675bbec3a920670a26dd3c7c66e5",iconPack:this.iconPack,t:this.t,class:this.isOnStage?"red":"",onClick:this.inviteToStageToggle},Z("rtk-icon",{key:"55cdf3825acd959945ce82b19fd69f36e26aa476",icon:this.isOnStage?this.iconPack.leave_stage:this.iconPack.join_stage,slot:"start"}),this.isOnStage?this.t("stage.remove_from_stage"):this.t("stage.add_to_stage")),!d&&this.canKickParticipant&&Z("rtk-menu-item",{key:"affe710adb04e305b6a46b9de2d25984d6c075d6",iconPack:this.iconPack,t:this.t,class:"red",onClick:()=>{var e,t;null===(e=this.meeting)||void 0===e||e.participants.kick(null===(t=this.participant)||void 0===t?void 0:t.id)}},Z("rtk-icon",{key:"d9c55c666231f76f00dd68ce0e2bedd92462ef89",icon:this.iconPack.dismiss,slot:"start"}),this.t("kick")),Z("slot",{key:"7017ef52152b1908e93ce539f762120425e50562"},Z(ws,{key:"28c3eacd6a4572c806748a7d09a861f000430b90",element:"rtk-participant",defaults:g,childProps:{participant:this.participant},deepProps:!0,onlyChildren:!0})))))))}get host(){return ie(this)}static get watchers(){return{meeting:["meetingChanged"],participant:["participantChanged"]}}};Wx([On()],qx.prototype,"meeting",void 0),Wx([On()],qx.prototype,"states",void 0),Wx([On()],qx.prototype,"iconPack",void 0),Wx([On()],qx.prototype,"t",void 0),Wx([On()],qx.prototype,"config",void 0),qx.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;height:var(--rtk-space-14, 56px);align-items:center;justify-content:space-between;cursor:pointer;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host rtk-avatar{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);font-size:14px}.left{display:flex;align-items:center}.left>*{margin-right:var(--rtk-space-2, 8px)}.left>*:last-child{margin-right:var(--rtk-space-0, 0px)}.right{display:flex;align-items:center;justify-content:flex-end}.right>*{margin-left:var(--rtk-space-2, 8px)}.right>*:first-child{margin-left:var(--rtk-space-0, 0px)}.name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}rtk-icon.red{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.more{cursor:pointer}.menu{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20}";const Kx=class{constructor(e){f(this,e),this.items=[],this.itemHeight=55,this.bufferedItemsCount=5,this.emptyListElement=null,this.visibleStart=0,this.visibleEnd=0,this.containerHeight=0,this.lastScrollTop=0,this.recalculatePositioning=()=>{this.updateContainerHeight(),requestAnimationFrame(()=>{this.updateItemHeight()})},this.updateContainerHeight=()=>{this.el.querySelector(".virtual-list-container").clientHeight&&(requestAnimationFrame(()=>{this.updateItemHeight()}),this.containerHeight=this.el.querySelector(".virtual-list-container").clientHeight,this.updateVisibleRange())},this.onScroll=qn(()=>{const e=this.el.querySelector(".virtual-list-container").scrollTop;e>this.lastScrollTop&&this.visibleEnd===this.items.length||(this.lastScrollTop=e,this.updateVisibleRange())})}itemsChanged(){this.recalculatePositioning()}componentDidLoad(){this.recalculatePositioning(),this.el.querySelector(".virtual-list-container").addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.recalculatePositioning)}componentDidUpdate(){this.updateItemHeight()}disconnectedCallback(){this.el.querySelector(".virtual-list-container").removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.recalculatePositioning)}updateVisibleRange(){const e=this.el.querySelector(".virtual-list-container").scrollTop,t=Math.floor(e/this.itemHeight),i=Math.ceil(this.containerHeight/this.itemHeight),r=Math.min(this.items.length,t+i+this.bufferedItemsCount);this.visibleStart=t,this.visibleEnd=r,this.el.querySelector(".virtual-list-container").scrollTop=this.lastScrollTop}updateItemHeight(){const e=this.el.querySelector(".virtual-list-item");if(e){const t=e.style.height;e.style.height="auto";const i=e.getBoundingClientRect().height;t&&(e.style.height=t),i&&Math.floor(i)!==Math.floor(this.itemHeight)&&(this.itemHeight=i)}}renderItems(){return this.items.slice(this.visibleStart,this.visibleEnd).map((e,t)=>{const i=this.visibleStart+t;return Z("div",{class:"virtual-list-item",key:e.id,style:{position:"absolute",top:"".concat(i*this.itemHeight,"px"),height:"".concat(this.itemHeight,"px"),width:"100%"}},this.renderItem(e,i))})}render(){var e;const t=this.items.length*this.itemHeight;return Z("div",{key:"8928758911fd6ac3b955e727306f1ebfe19aba9b",class:"virtual-list-container",style:{position:"relative",height:"100%",overflowX:"hidden",overflowY:"auto"}},Z("div",{key:"4812952f05b7cbcb920cf5bfe54cd30c26cb8b0d",style:{height:"".concat(t,"px"),position:"relative"}},(null===(e=this.items)||void 0===e?void 0:e.length)?this.renderItems():this.emptyListElement),Z("div",{key:"0f9cd358e2d49af44765dbe560a323c9e8fa09f7",style:{height:"".concat(this.itemHeight,"px")}}))}get el(){return ie(this)}static get watchers(){return{items:["itemsChanged"]}}};Kx.style=":host{height:100%;width:100%}";var Zx=Object.freeze({__proto__:null,rtk_participant:qx,rtk_virtualized_participant_list:Kx});var Yx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Jx=class{constructor(e){f(this,e),this.iconPack=pn,this.variant="full",this.t=un(),this.videoDevices=[],this.canProduceVideo=!0,this.stageStateListener=()=>{this.canProduceVideo="ALLOWED"===this.meeting.self.permissions.canProduceVideo},this.deviceListUpdateListener=e=>{let{devices:t}=e;this.videoDevices=t.filter(e=>"videoinput"===e.kind)},this.deviceUpdateListener=e=>{let{device:t}=e;"videoinput"===t.kind&&(this.currentDevice=t)},this.mediaPermissionUpdateListener=async e=>{let{kind:t,message:i}=e;this.meeting&&"video"===t&&"ACCEPTED"===i&&(this.videoDevices=await this.meeting.self.getVideoDevices())}}meetingChanged(e){var t,i,r;e&&(null===(t=e.self)||void 0===t||t.addListener("deviceListUpdate",this.deviceListUpdateListener),null===(i=e.self)||void 0===i||i.addListener("deviceUpdate",this.deviceUpdateListener),null===(r=e.self)||void 0===r||r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),M(async()=>{var t,i;const r=await e.self.getVideoDevices(),n=null===(t=e.self.getCurrentDevices())||void 0===t?void 0:t.video;this.videoDevices=void 0!=n?[null!==(i=r.find(e=>e.deviceId===n.deviceId))&&void 0!==i?i:n,...r.filter(e=>e.deviceId!==n.deviceId)]:r}))}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e,t,i,r,n;null===(t=null===(e=this.meeting)||void 0===e?void 0:e.stage)||void 0===t||t.removeListener("stageStatusUpdate",this.stageStateListener),null===(i=this.meeting)||void 0===i||i.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),null===(r=this.meeting)||void 0===r||r.self.removeListener("deviceUpdate",this.deviceUpdateListener),null===(n=this.meeting)||void 0===n||n.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}async setDevice(e){var t;const i=this.videoDevices.find(t=>t.deviceId===e);this.currentDevice=i,null!=i&&await(null===(t=this.meeting)||void 0===t?void 0:t.self.setDevice(i))}render(){if(!this.meeting)return null;let e=0;return Z(J,null,this.canProduceVideo&&Z("div",{class:"group container "+this.variant,part:"camera-selection"},Z("label",null,"inline"!==this.variant&&this.t("camera"),Z("rtk-icon",{icon:this.iconPack.video_on,size:"sm"})),Z("div",{class:"row"},Z("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.videoDevices.map(t=>{let{deviceId:i,label:r}=t;var n;return Z("option",{selected:(null===(n=this.currentDevice)||void 0===n?void 0:n.deviceId)===i,value:i},r||"Camera ".concat(++e))})))))}static get watchers(){return{meeting:["meetingChanged"]}}};Yx([On()],Jx.prototype,"meeting",void 0),Yx([On()],Jx.prototype,"iconPack",void 0),Yx([On()],Jx.prototype,"t",void 0),Jx.style=".rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px)}.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}";var Qx=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const Xx=class{onVideoRef(e){this.participant&&this.meeting&&e!==this.videoEl&&(this.videoEl=e,this.participant.registerVideoElement(this.videoEl,this.isPreview),this.tileLoad.emit({participant:this.participant,videoElement:this.videoEl}))}connectedCallback(){this.meeting?this.meetingChanged(this.meeting):this.participantsChanged(this.participant)}constructor(e){f(this,e),this.tileLoad=re(this,"tileLoad",7),this.tileUnload=re(this,"tileUnload",7),this.isPinned=!1,this.mediaConnectionError=!1,this.nameTagPosition="bottom-left",this.isPreview=!1,this.config=sn(),this.variant="solid",this.iconPack=pn,this.t=un(),this.onPinned=e=>{let{isPinned:t}=e;this.isPinned=t},this.isSelf=()=>{var e;return this.isPreview||this.participant.id===(null===(e=this.meeting)||void 0===e?void 0:e.self.id)},this.onPause=e=>{var t,i;this.isSelf()&&(null===(t=this.meeting)||void 0===t?void 0:t.__internals__.features.hasFeature(lt))&&(this.meeting.__internals__.logger.warn("Video player paused for ".concat(this.participant.id," isSelf: ").concat(this.isSelf())),null===(i=null===e||void 0===e?void 0:e.target)||void 0===i||i.play())},this.onPlaying=()=>{this.playTimeout&&clearTimeout(this.playTimeout)},this.mediaConnectionUpdateListener=this.mediaConnectionUpdateListener.bind(this)}disconnectedCallback(){this.playTimeout&&clearTimeout(this.playTimeout),null!=this.participant&&(this.participant.deregisterVideoElement(this.videoEl,this.isPreview),this.participant.removeListener("pinned",this.onPinned),this.participant.removeListener("unpinned",this.onPinned),this.meeting.meta.off("mediaConnectionUpdate",this.mediaConnectionUpdateListener),this.tileUnload.emit(this.participant))}meetingChanged(e){e&&this.participantsChanged(this.participant)}participantsChanged(e){e&&(this.meeting?(this.isPinned=e.isPinned,this.videoEl&&this.participant.registerVideoElement(this.videoEl,this.isPreview),e.addListener("pinned",this.onPinned),e.addListener("unpinned",this.onPinned),this.meeting.meta.off("mediaConnectionUpdate",this.mediaConnectionUpdateListener),this.meeting.meta.on("mediaConnectionUpdate",this.mediaConnectionUpdateListener)):this.isPreview&&this.videoEl&&this.participant.registerVideoElement(this.videoEl,this.isPreview))}mediaConnectionUpdateListener(){var e,t,i;const{recv:r,send:n}=null!==(i=null===(t=null===(e=this.meeting)||void 0===e?void 0:e.meta)||void 0===t?void 0:t.mediaState)&&void 0!==i?i:{};"connected"===(null===r||void 0===r?void 0:r.state)||this.isSelf()?"connected"!==(null===n||void 0===n?void 0:n.state)&&this.isSelf()?this.mediaConnectionError=!0:this.mediaConnectionError=!1:this.mediaConnectionError=!0}isMirrored(){var e;if(null!=this.participant&&this.isSelf()){const t=this.states,i=null===(e=null===t||void 0===t?void 0:t.prefs)||void 0===e?void 0:e.mirrorVideo;if("boolean"===typeof i)return i}return!1}render(){var e,t,i;if(!this.meeting)return null;const r={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return Z(J,null,Z("video",{ref:e=>this.onVideoRef(e),class:{mirror:this.isMirrored(),[null!==(i=null===(t=null===(e=this.config)||void 0===e?void 0:e.config)||void 0===t?void 0:t.videoFit)&&void 0!==i?i:"cover"]:!0},onPlaying:this.onPlaying,onPause:this.onPause,autoPlay:!0,playsInline:!0,muted:!0,part:"video"}),this.isPinned&&Z("rtk-icon",{class:"pinned-icon",icon:this.iconPack.pin,"aria-label":this.t("pinned"),part:"pinned-icon"}),this.mediaConnectionError&&Z("div",{class:"network-container",part:"network-indicator"},Z("rtk-icon",{class:"network-icon",icon:this.iconPack.disconnected,"aria-label":this.t("pinned"),part:"pinned-icon"})),Z("slot",null,!this.isPreview&&Z(ws,{element:"rtk-participant-tile",defaults:r,childProps:{participant:this.participant},deepProps:!0,onlyChildren:!0})))}static get watchers(){return{meeting:["meetingChanged"],participant:["participantsChanged"]}}};Qx([On()],Xx.prototype,"meeting",void 0),Qx([On()],Xx.prototype,"states",void 0),Qx([On()],Xx.prototype,"config",void 0),Qx([On()],Xx.prototype,"iconPack",void 0),Qx([On()],Xx.prototype,"t",void 0),Xx.style=":host {\n  line-height: initial;\n  font-family: var(--rtk-font-family, sans-serif);\n\n  font-feature-settings: normal;\n  font-variation-settings: normal;\n}\n\np {\n  margin: var(--rtk-space-0, 0px);\n  padding: var(--rtk-space-0, 0px);\n}\n\n\n:host {\n  position: relative;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  aspect-ratio: 16 / 9;\n  height: var(--rtk-space-56, 224px);\n  overflow: hidden;\n  border-radius: var(--rtk-border-radius-lg, 12px);\n  -webkit-user-select: none;\n     -moz-user-select: none;\n          user-select: none;\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));\n\n  transition-property: var(--rtk-transition-property, all);\n  transition-duration: 150ms;\n  container-type: inline-size;\n  container-name: participanttile;\n}\n\n@media (prefers-reduced-motion) {\n  /* No transitions when disabled */\n  :host {\n    --rtk-transition-property: none;\n  }\n}\n\nrtk-avatar {\n  z-index: -1;\n}\n\n/**\n  NOTE: provided :slotted(rtk-name-tag) & rtk-name-tag separately\n  because ::slotted isn't applied on default slots.\n*/\n\n::slotted(rtk-name-tag), \nrtk-name-tag {\n  position: absolute;\n  left: var(--rtk-space-3, 12px);\n  bottom: var(--rtk-space-3, 12px);\n}\n\n:host([size='sm'][variant='solid']) ::slotted(rtk-name-tag), \n  :host([size='sm'][variant='solid']) rtk-name-tag {\n  left: var(--rtk-space-2, 8px);\n  bottom: var(--rtk-space-2, 8px);\n  height: var(--rtk-space-4, 16px);\n}\n\n::slotted(rtk-network-indicator), \nrtk-network-indicator {\n  position: absolute;\n  right: var(--rtk-space-3, 12px);\n  bottom: var(--rtk-space-3, 12px);\n}\n\n:host([size='sm']) ::slotted(rtk-network-indicator), \n  :host([size='sm']) rtk-network-indicator {\n  right: var(--rtk-space-2, 8px);\n  bottom: var(--rtk-space-2, 8px);\n}\n\nvideo {\n  position: absolute;\n  height: 100%;\n  width: 100%;\n  border-radius: var(--rtk-border-radius-lg, 12px);\n}\n\nvideo.contain {\n  -o-object-fit: contain;\n     object-fit: contain;\n}\n\nvideo.cover {\n  -o-object-fit: cover;\n     object-fit: cover;\n}\n\nvideo::-webkit-media-controls {\n  display: none !important;\n}\n\n.pinned-icon {\n  position: absolute;\n  left: var(--rtk-space-3, 12px);\n  top: var(--rtk-space-3, 12px);\n  height: var(--rtk-space-5, 20px);\n  width: var(--rtk-space-5, 20px);\n  padding: var(--rtk-space-1, 4px);\n  border-radius: var(--rtk-border-radius-md, 8px);\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n}\n\n.network-container {\n  position: absolute;\n  right: var(--rtk-space-3, 12px);\n  bottom: var(--rtk-space-3, 12px);\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  padding: var(--rtk-space-2, 8px);\n  font-size: 12px;\n  border-radius: var(--rtk-border-radius-md, 8px);\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n}\n.network-icon {\n  height: var(--rtk-space-5, 20px);\n  width: var(--rtk-space-5, 20px);\n  --tw-text-opacity: 1;\n  color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity));\n}\n\n:host([size='sm']) .pinned-icon {\n  top: var(--rtk-space-2, 8px);\n  left: var(--rtk-space-2, 8px);\n}\n\n:host([variant='gradient']) ::slotted(rtk-audio-visualizer), \n  :host([variant='gradient']) rtk-audio-visualizer {\n  position: absolute;\n  top: var(--rtk-space-2, 8px);\n  right: var(--rtk-space-2, 8px);\n  border-radius: 9999px;\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n  padding: var(--rtk-space-2, 8px);\n}\n\n:host([variant='gradient']) ::slotted(rtk-name-tag), \n  :host([variant='gradient']) rtk-name-tag {\n  bottom: var(--rtk-space-0, 0px);\n  left: var(--rtk-space-0, 0px);\n  display: flex;\n  width: 100%;\n  align-items: center;\n  justify-content: center;\n  text-align: center;\n  background-color: transparent;\n  background-image: linear-gradient(to top, var(--tw-gradient-stops));\n  --tw-gradient-from: rgb(var(--rtk-colors-background-1000, 8 8 8));\n  --tw-gradient-to: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);\n  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);\n  --tw-gradient-to: transparent;\n}\n\nvideo.mirror {\n  transform: scaleX(-1);\n}\n\n/** Name tag positions */\n\n:host([name-tag-position='bottom-right']) ::slotted(rtk-name-tag), \n  :host([name-tag-position='bottom-right']) rtk-name-tag {\n  left: auto;\n  right: var(--rtk-space-3, 12px);\n}\n\n:host([name-tag-position='bottom-center']) ::slotted(rtk-name-tag), \n  :host([name-tag-position='bottom-center']) rtk-name-tag {\n  left: auto;\n  right: auto;\n}\n\n:host([name-tag-position='top-left']) ::slotted(rtk-name-tag), \n  :host([name-tag-position='top-left']) rtk-name-tag {\n  top: var(--rtk-space-3, 12px);\n  bottom: auto;\n}\n\n:host([name-tag-position='top-right']) ::slotted(rtk-name-tag), \n  :host([name-tag-position='top-right']) rtk-name-tag {\n  top: var(--rtk-space-3, 12px);\n  right: var(--rtk-space-3, 12px);\n  left: auto;\n  bottom: auto;\n}\n\n:host([name-tag-position='top-center']) ::slotted(rtk-name-tag), \n  :host([name-tag-position='top-center']) rtk-name-tag {\n  left: auto;\n  right: auto;\n  bottom: auto;\n  top: var(--rtk-space-3, 12px);\n}\n\n@media only screen and (max-height: 480px) and (orientation: landscape) {\n  :host([size='sm']) {\n    border-radius: var(--rtk-border-radius-sm, 4px);\n  }\n\n  :host([size='sm']) > video {\n    border-radius: var(--rtk-border-radius-sm, 4px);\n  }\n\n  ::slotted(rtk-avatar), \n  rtk-avatar {\n    height: var(--rtk-space-12, 48px);\n    width: var(--rtk-space-12, 48px);\n  }\n    :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag),\n    :host([size='sm'][variant='solid']) rtk-name-tag {\n      transform-origin: -2% 100%;\n      transform: scale(0.6);\n      z-index: 10;\n      left: var(--rtk-space-0, 0px);\n      bottom: var(--rtk-space-0, 0px);\n      border-radius: var(--rtk-border-radius-none, 0);\n    }\n}\n\n@media only screen and (max-width: 480px) and (orientation: portrait) {\n  :host([size='sm']) {\n    border-radius: var(--rtk-border-radius-sm, 4px);\n  }\n\n  :host([size='sm']) > video {\n    border-radius: var(--rtk-border-radius-sm, 4px);\n  }\n\n  ::slotted(rtk-avatar), \n  rtk-avatar {\n    height: var(--rtk-space-12, 48px);\n    width: var(--rtk-space-12, 48px);\n  }\n    :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag),\n    :host([size='sm'][variant='solid']) rtk-name-tag {\n      transform-origin: -5% 110%;\n      transform: scale(0.6);\n      z-index: 10;\n      left: var(--rtk-space-0, 0px);\n      bottom: var(--rtk-space-0, 0px);\n      border-radius: var(--rtk-border-radius-none, 0);\n    }\n}\n\n@container participanttile (max-width: 300px) {\n  ::slotted(rtk-name-tag),\n  rtk-name-tag {\n    transform-origin: 0 100%;\n    transform: scale(0.8);\n  }\n\n  ::slotted(rtk-avatar), \n  rtk-avatar {\n    height: var(--rtk-space-8, 32px) !important;\n    width: var(--rtk-space-8, 32px) !important;\n  }\n}\n\n@container participanttile (max-width: 150px) {\n  ::slotted(rtk-name-tag),\n  rtk-name-tag[variant='solid'] {\n    transform-origin: -10% 130%;\n    transform: scale(0.6);\n    z-index: 10;\n    border-radius: 9999px;\n  }\n\n  ::slotted(rtk-avatar), \n  rtk-avatar {\n    height: 6 !important;\n    width: 6 !important;\n  }\n}\n";var eE=Object.freeze({__proto__:null,rtk_camera_selector:Jx,rtk_participant_tile:Xx});var tE=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const iE=class{constructor(e){f(this,e),this.onVote=re(this,"rtkVotePoll",7),this.iconPack=pn,this.t=un(),this.MAX_VOTES_RENDER=10}vote(e,t){this.poll.voted.includes(this.self)?e.preventDefault():this.onVote.emit({id:this.poll.id,index:t})}render(){const e=this.poll.voted.includes(this.self);return Z(J,{key:"f279288f91b6fe8d525fc8498733763081c8d33b"},Z("div",{key:"5919d49691938b1886af73aed2e84c9281d400ae",class:"ctr"},Z("p",{key:"9881e172379add503d5b7057719214ff7094e66d",class:"poll-title"},this.t("polls.by")," ",Cn(Ln(this.poll.createdBy),20)),Z("div",{key:"f94d3f1184e1e40048cc2f3a5545a643b747b5f3",class:"poll"},Z("p",{key:"f8a37e64dc447ca65308d7ca5024b19fd845492d",class:"poll-question"},this.poll.question),Z("div",{key:"89a0c12e8c9423c188c25e130852b0ead854eccd",class:"poll-answers"},Z("span",{key:"73c48104ca4ab450b6a16f17dfdaffa5802198a2"},this.t("polls.answers")),Z("span",{key:"3e2bf9df6ffcdc3d04bff203e7a6b5cfbc449d2c"},this.poll.voted.length)),this.poll.options.map((t,i)=>Z("div",{class:{active:t.votes.some(e=>e.id===this.self),"open-vote":this.permissions.polls.canVote&&!e,"poll-option":!0}},Z("div",{class:"poll-option-header","data-disabled":!this.permissions.polls.canVote},Z("label",null,!e&&Z("input",{disabled:!this.permissions.polls.canVote,readOnly:e,type:"radio",checked:t.votes.some(e=>e.id===this.self),onClick:e=>this.vote(e,i)}),Z("p",null,t.text)),Z("span",{class:"counter"},t.count)),Z("div",{class:"votes"},t.votes.slice(0,this.MAX_VOTES_RENDER).map(e=>{if(!this.poll.anonymous||this.self===this.poll.createdByUserId)return Z("rtk-tooltip",{label:e.name},Z("div",{class:"vote"},Dn(e.name)))}),t.votes.length>this.MAX_VOTES_RENDER&&Z("rtk-tooltip",{label:"+".concat(t.votes.length-this.MAX_VOTES_RENDER," more ")},Z("div",{class:"vote"},"+",t.votes.length-this.MAX_VOTES_RENDER))))))))}};tE([On()],iE.prototype,"iconPack",void 0),tE([On()],iE.prototype,"t",void 0),iE.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.ctr{margin-bottom:var(--rtk-space-3, 12px);display:flex;width:100%;flex-direction:column;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.poll-title{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-4, 16px);font-size:12px}.poll{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));display:flex;flex-direction:column;padding:var(--rtk-space-4, 16px)}.poll-question{padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;overflow-wrap:break-word}.poll-answers{display:flex;flex-direction:row;justify-content:space-between;font-size:12px;margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-3, 12px)}.poll-option{display:flex;flex-direction:column;margin-top:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);word-break:break-word}.poll-option.open-vote:hover{cursor:pointer}.poll-option label{display:flex;flex-direction:row;cursor:inherit}.poll-option-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--rtk-space-1, 4px)}.poll-option-header[data-disabled='true']:hover{cursor:default}.poll-option-header input{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0\\.5, 2px);margin-right:var(--rtk-space-2, 8px);cursor:inherit}.poll-option-header .counter{color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:12px}.votes{margin-top:var(--rtk-space-1, 4px);display:flex;flex-direction:row;flex-wrap:wrap}.vote{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);display:flex;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));border-radius:var(--rtk-border-radius-none, 0);clip-path:circle()}.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}.active .counter{color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}";var rE=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const nE=class{constructor(e){f(this,e),this.onCreate=re(this,"rtkCreatePoll",7),this.iconPack=pn,this.t=un(),this.options=["",""],this.anonymous=!1,this.hideVotes=!0}removeOption(e){var t;this.options=this.options.filter((t,i)=>i!==e),1===(null===(t=this.error)||void 0===t?void 0:t.code)&&(this.error=void 0)}addOption(){this.options=[...this.options,""]}updateOption(e,t){var i;this.options[t]=e.target.value,1===(null===(i=this.error)||void 0===i?void 0:i.code)&&(this.error=void 0)}handleSubmit(){const e={question:this.question.value,options:this.options,anonymous:this.anonymous,hideVotes:!!this.anonymous||this.hideVotes};e.question?this.options.filter(e=>""===e.trim()).length>0?this.error={code:1,message:this.t("polls.errors.empty_option")}:this.onCreate.emit(e):this.error={code:0,message:this.t("polls.errors.question_required")}}render(){return Z(J,{key:"625bbf35e528f16b4a982a159c3631af1d444a85"},Z("div",{key:"f0d20f8d5e53d1f8fd5063b7e533dc50d8184dc5",class:"create-poll"},Z("p",{key:"2dbcff9b0828790c4315e62f45c139f30971b72c"},this.t("polls.question")),Z("textarea",{key:"6ff40a7fe19cded416f45474065b9361de83d5a2",onInput:()=>{this.error&&0===this.error.code&&(this.error=void 0)},ref:e=>this.question=e,placeholder:this.t("polls.question.placeholder")}),this.options.map((e,t)=>Z("div",{class:"option"},Z("input",{placeholder:this.t("polls.option.placeholder"),value:e,onInput:e=>this.updateOption(e,t)}),t>1&&Z("rtk-button",{kind:"icon",class:"auto remove-option",variant:"secondary",onClick:()=>this.removeOption(t)},Z("rtk-icon",{icon:this.iconPack.subtract})))),Z("rtk-button",{key:"565c530735bf27e14b0a5ee33afca6f45b1e4fc5",class:"add-option",variant:"secondary",onClick:()=>this.addOption()},this.t("polls.option")),Z("label",{key:"c38d4c9bee1c086cb481a94b17853749d5de6b63"},Z("input",{key:"64f21e59d497ae0182da74064d96ad66a522515d",id:"anonymous",type:"checkbox",onChange:e=>this.anonymous=e.target.checked}),this.t("polls.results.anon")),Z("label",{key:"ec293dc473b4d9d0df7fe9d93e036ff28c0ea3d1"},Z("input",{key:"bef5ee43cee42d3c16927efc810ad4b76cb8994b",id:"hideVotes",type:"checkbox",disabled:this.anonymous,checked:!!this.anonymous||this.hideVotes,onChange:e=>this.hideVotes=e.target.checked}),this.t("polls.results.hide")),Z("rtk-button",{key:"7b5646a77576a2836370d16dc2104d267c573de2",kind:"wide",onClick:()=>this.handleSubmit()},this.t("polls.create")),this.error&&Z("span",{key:"d51a6301dba0c3686a5f1e59ebdc98eccfa7488b",class:"error-text"},this.error.message)))}};rE([On()],nE.prototype,"iconPack",void 0),rE([On()],nE.prototype,"t",void 0),nE.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.create-poll{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);display:flex;flex:1 1 0%;flex-direction:column;padding:var(--rtk-space-3, 12px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.create-poll p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);text-align:center}.create-poll textarea{display:flex;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);font-family:var(--rtk-font-family, sans-serif);border-width:var(--rtk-border-width-none, 0);border-style:none;font-weight:500;outline:2px solid transparent;outline-offset:2px;margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);resize:vertical;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.create-poll textarea:focus{outline-style:solid;outline-offset:2px;outline-color:rgb(var(--rtk-colors-background-600, 60 60 60))}.option{display:flex;flex-direction:row;align-items:center;margin-bottom:var(--rtk-space-3, 12px);width:100%}.option input{width:100%;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.remove-option{margin-left:var(--rtk-space-2, 8px);width:var(--rtk-space-10, 40px);border-radius:var(--rtk-border-radius-sm, 4px)}.add-option{margin-bottom:var(--rtk-space-3, 12px)}label{margin-bottom:var(--rtk-space-3, 12px)}.error-text{margin-top:var(--rtk-space-3, 12px);text-align:center;font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";var sE=Object.freeze({__proto__:null,rtk_poll:iE,rtk_poll_form:nE});const aE=class{constructor(e){f(this,e),this.tabChange=re(this,"tabChange",7),this.sidebarClose=re(this,"sidebarClose",7),this.view="sidebar",this.tabs=[],this.hideHeader=!1,this.hideCloseAction=!1,this.iconPack=pn,this.focusCloseButton=!0,this.t=un(),this.onClose=()=>{var e;this.sidebarClose.emit(),document.activeElement instanceof HTMLElement&&(null===(e=document.activeElement.tagName)||void 0===e?void 0:e.includes("RTK-"))&&document.activeElement.blur instanceof Function&&document.activeElement.blur()}}componentDidLoad(){this.keydownListener=e=>{"Escape"===e.key&&this.onClose()},this.hostEl.addEventListener("keydown",this.keydownListener),this.handleFocusCloseButton()}handleFocusCloseButton(){"chat"===this.currentTab||this.hideCloseAction||this.closeButton.focus()}disconnectedCallback(){this.hostEl.removeEventListener("keydown",this.keydownListener)}render(){const e="full-screen"===this.view,t=this.tabs.find(e=>e.id===this.currentTab);return Z(J,{key:"bc9969254516bb334f0bbc6216432121d675a83e",ref:e=>this.hostEl=e,class:this.view},!this.hideCloseAction&&Z("rtk-button",{key:"ce9dabf448e0914fa516c717825ee00ad476d412",ref:e=>this.closeButton=e,variant:"ghost",kind:"icon",class:"close",onClick:this.onClose,"aria-label":this.t("close")},Z("rtk-icon",{key:"5966e4c6a7bbdea25fa64e197c47fcded0625754",icon:this.iconPack.dismiss})),t&&!this.hideHeader&&Z("header",{key:"3b7109ba37e019a3da3a0aeb07b54fcf28e869b4",class:"main-header"},Z("h3",{key:"c57a8719fe6dca4ed092fbb21733c0d0ac074dc3"},t.name),Z("slot",{key:"f95589b898e0b4a8001d45d5b4c833576fab4fd8",name:"pinned-state"})),e&&Z("header",{key:"72cd52ea2a27caf4dc826d4222738325853281c8",class:"mobile-tabs"},this.tabs.map(e=>Z("button",{onClick:()=>{this.tabChange.emit(e.id)},class:{active:this.currentTab===e.id}},e.name))),Z("slot",{key:"266ec59a2d04803b2d035f7929394e66e92aa542",name:this.currentTab}))}static get watchers(){return{currentTab:["handleFocusCloseButton"]}}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],aE.prototype,"t",void 0),aE.style=":host {\n  line-height: initial;\n  font-family: var(--rtk-font-family, sans-serif);\n\n  font-feature-settings: normal;\n  font-variation-settings: normal;\n}\n\np {\n  margin: var(--rtk-space-0, 0px);\n  padding: var(--rtk-space-0, 0px);\n}\n\n\n:host {\n  position: relative;\n  height: 100%;\n  width: 100%;\n  font-family: var(--rtk-font-family, sans-serif);\n  z-index: 50;\n  display: flex;\n  flex-direction: column;\n\n  container-type: size;\n  container-name: sidebarui;\n}\n\n@container sidebarui (height < 370px) {\n  .main-header {\n    height: var(--rtk-space-8, 32px) !important;\n  }\n  .close {\n    top: var(--rtk-space-0\\.5, 2px) !important;\n    left: var(--rtk-space-0, 0px) !important;\n    color: rgba(var(--rtk-colors-danger, 255 45 45) / 0.6);\n  }\n}\n\n:host([view='sidebar']) {\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n}\n\n:host([view='full-screen']) {\n  position: absolute;\n  top: var(--rtk-space-0, 0px);\n  right: var(--rtk-space-0, 0px);\n  bottom: var(--rtk-space-0, 0px);\n  left: var(--rtk-space-0, 0px);\n  max-width: 100%;\n  border: none;\n}\n\n::slotted(*) {\n  flex-grow: 1;\n}\n\n.close {\n  position: absolute;\n  top: var(--rtk-space-2, 8px);\n  left: var(--rtk-space-2, 8px);\n  z-index: 10;\n}\n\n.main-header {\n  position: relative;\n  display: flex;\n  height: var(--rtk-space-12, 48px);\n  place-items: center;\n  justify-content: center;\n}\n\n.main-header, \n.mobile-tabs {\n  flex-shrink: 0;\n}\n\n.mobile-tabs {\n  display: flex;\n  place-items: center;\n  justify-content: space-evenly;\n  border-bottom: 1px solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.mobile-tabs button {\n  margin: var(--rtk-space-0, 0px);\n  border-width: var(--rtk-border-width-none, 0);\n  border-style: none;\n  background-color: transparent;\n  padding: var(--rtk-space-0, 0px);\n  color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));\n  height: var(--rtk-space-10, 40px);\n  cursor: pointer;\n  padding-left: var(--rtk-space-4, 16px);\n  padding-right: var(--rtk-space-4, 16px);\n  font-weight: 500;\n  border-bottom: 1px solid transparent;\n}\n\n.mobile-tabs button.active {\n  --tw-border-opacity: 1;\n  border-color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));\n  --tw-text-opacity: 1;\n  color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));\n}\n\nheader h3 {\n  font-size: 14px;\n  font-weight: 500;\n}\n\n@media only screen and (max-device-height: 480px) and (orientation: landscape) {\n  .main-header {\n    display: none !important;\n  }\n}\n\n.tab-participant-count-badge {\n  display: inline-block;\n  padding: 2px 5px;\n  border-radius: 9999px;\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n  font-size: 12px;\n  color: rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));\n}\n\n.tab-participant-count-badge:not(.selected-tab) {\n  --tw-bg-opacity: 1;\n  background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n}\n\n.tab-participant-count-badge.requests-pending{\n  background-color: rgba(var(--rtk-colors-danger));\n}\n";var oE=Object.freeze({__proto__:null,rtk_sidebar_ui:aE});var cE=function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};const lE=class{constructor(e){f(this,e),this.iconPack=pn,this.t=un(),this.permissionsUpdateListener=()=>{this.canSpotlight=this.meeting.self.permissions.canSpotlight}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;null===(e=this.meeting)||void 0===e||e.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(e){var t,i;null!=e&&(this.canSpotlight=e.self.permissions.canSpotlight,this.isSpotlighted=null!==(i=null===(t=e.meta)||void 0===t?void 0:t.broadcastTabChanges)&&void 0!==i&&i,e.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}updateSpotlightState(e){var t;try{null===(t=this.meeting.meta)||void 0===t||t.setBroadcastTabChanges(e),this.isSpotlighted=e}catch(i){console.error(i)}}render(){if(this.canSpotlight)return Z(J,null,Z("rtk-tooltip",{size:"md",label:this.t("remote_access.indicator")},Z("div",{id:"sync-button",class:{tab:!0,active:this.isSpotlighted},onClick:()=>this.updateSpotlightState(!this.isSpotlighted)},Z("span",{class:"name"},"Sync"),Z("rtk-icon",{id:"icon",icon:this.isSpotlighted?this.iconPack.checkmark:this.iconPack.warning,tabIndex:-1,"aria-hidden":!0}))))}static get watchers(){return{meeting:["meetingChanged"]}}};cE([On()],lE.prototype,"meeting",void 0),cE([On()],lE.prototype,"iconPack",void 0),cE([On()],lE.prototype,"t",void 0),lE.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{font-size:12px}#sync-button{flex-direction:row;border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-1, 4px);display:flex;align-items:center;justify-content:center;margin-bottom:var(--rtk-space-1, 4px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) rtk-tooltip,:host([size='md']) rtk-tooltip{width:100%}:host([size='sm'])>#sync-button{height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px);padding-left:var(--rtk-space-0, 0px)}:host([size='md'])>#sync-button{height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px)}:host([size='lg'])>#sync-button{flex-direction:row;height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px)}@media (orientation: portrait){:host([size='lg']) #sync-button{flex-direction:column-reverse;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px)}:host([size='md']) #sync-button{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px)}:host([size='sm']) #sync-button{height:var(--rtk-space-10, 40px);width:var(--rtk-space-16, 64px);flex-direction:row}}#sync-button>rtk-icon{max-height:14px}#sync-button rtk-icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='sm']) #sync-button>rtk-icon{width:auto}#sync-button.active rtk-icon{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}div{align-content:center;line-height:2rem}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-8, 32px)}#sync-button.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-bg-opacity))}";var dE=Object.freeze({__proto__:null,rtk_spotlight_indicator:lE});const hE=class{constructor(e){f(this,e),this.variant="button",this.showWarning=!1,this.disabled=!1,this.iconPack=pn,this.brandIcon=!1}render(){return Z(J,{key:"f8af1b318f555c5d98d146be871c5bef3e53fae7"},Z("button",{key:"de25b31b07be84a5041431e6547822e445d7f446","aria-label":this.label,part:"button"},this.isLoading?Z("rtk-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack}):Z("rtk-icon",{id:"icon",icon:this.icon,tabIndex:-1,"aria-hidden":!0,part:"icon"}),Z("span",{key:"620c5c4c08ed9740b3705f9c36bc19e7b77b1d73",class:"label",part:"label"},this.label),this.showWarning&&Z("rtk-icon",{key:"a8b2fb7570f7a4268d5290ece1807b6ab530f664",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})))}static get delegatesFocus(){return!0}};!function(e,t,i,r){var n,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(s<3?n(a):s>3?n(t,i,a):n(t,i))||a);s>3&&a&&Object.defineProperty(t,i,a)}([On()],hE.prototype,"iconPack",void 0),hE.style=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(\n    --rtk-controlbar-button-background-color,\n    rgb(var(--rtk-colors-background-1000, 8 8 8))\n  );--icon-size:var(--rtk-controlbar-button-icon-size, var(--rtk-space-7, 28px));position:relative;box-sizing:border-box;display:inline-flex;height:100%;width:auto;min-width:var(--rtk-space-20, 80px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));background-color:var(--background-color)}button{padding:var(--rtk-space-1, 4px)}:host(.red-icon) #icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([disabled]){color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}button{box-sizing:border-box;display:inline-flex;height:100%;width:100%;flex:1 1 0%;flex-direction:column;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-1, 4px);align-items:center;justify-content:center;cursor:pointer;border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:inherit;outline-offset:-2px;border:var(--rtk-border-width-md, 2px) solid transparent}.label{text-align:center;font-size:12px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}#warning-indicator{position:absolute;top:var(--rtk-space-1, 4px);right:var(--rtk-space-2, 8px);height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}:host([size='sm']) #warning-indicator{right:var(--rtk-space-0, 0px);top:var(--rtk-space-0, 0px);height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}:host(:hover) button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}#icon{width:var(--icon-size);height:var(--icon-size)}:host(.leave:hover) button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity));border:var(--rtk-border-width-md, 2px) solid rgb(var(--rtk-colors-danger, 255 45 45))}:host(.active) button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));border:var(--rtk-border-width-md, 2px) solid rgb(var(--rtk-colors-brand-400, 53 110 253))}button:focus-visible{outline:2px solid rgb(var(--rtk-colors-brand-400, 53 110 253))}:host(.active-livestream){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='sm']){min-width:var(--rtk-space-14, 56px)}:host([size='sm']) .label{display:none}:host([variant='horizontal']){width:100%}:host([variant='horizontal']) button{border-radius:7px;height:var(--rtk-space-12, 48px);width:100%;padding-left:var(--rtk-space-5, 20px);padding-right:var(--rtk-space-5, 20px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);flex-direction:row;justify-content:flex-start;gap:var(--rtk-space-3, 12px)}:host([variant='horizontal']) #icon{width:var(--rtk-space-6, 24px)}:host([variant='horizontal']) .label{display:block;font-size:14px;line-height:1.25rem}:host([variant='horizontal']) #warning-indicator{right:auto;left:var(--rtk-space-4, 16px)}:host([brand-icon]) rtk-icon#icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host .label{display:none}:slotted(rtk-icon){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}}";var uE=Object.freeze({__proto__:null,rtk_controlbar_button:hE})},2730(e,t,i){"use strict";var r=i(5043),n=i(2123),s=i(8853);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i