this._cellMetadata[f]=p,this.getSections(p).forEach(function(o){return o.addCellIndex({index:f})})}}]),SectionManager}();function calculateSizeAndPositionData_calculateSizeAndPositionData(o){for(var p=o.cellCount,f=o.cellSizeAndPositionGetter,m=o.sectionSize,_=[],w=new eM(m),I=0,k=0,M=0;M
=0&&ff||_0;){var U=B.startIndex-1;if(p({index:U}))break;B.startIndex=U}return I}function forceUpdateReactVirtualizedComponent(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f="function"==typeof o.recomputeGridSize?o.recomputeGridSize:o.recomputeRowHeights;f?f.call(o,p):o.forceUpdate()}(0,el.A)(eR,"defaultProps",{minimumBatchSize:10,rowCount:0,threshold:15}),eR.propTypes={};var eO=($=U=function(o){function List(){(0,ei.A)(this,List);for(var o,p,f=arguments.length,m=Array(f),_=0;_0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.recomputeGridSize({rowIndex:void 0===f?0:f,columnIndex:void 0===p?0:p})}},{key:"recomputeRowHeights",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:o,columnIndex:0})}},{key:"scrollToPosition",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:o})}},{key:"scrollToRow",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:o})}},{key:"render",value:function(){var o=this.props,p=o.className,f=o.noRowsRenderer,m=o.scrollToIndex,_=o.width,w=clsx_m("ReactVirtualized__List",p);return ed.createElement(eb,(0,eu.A)({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,className:w,columnWidth:_,columnCount:1,noContentRenderer:f,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,scrollToRow:m}))}}]),List}(ed.PureComponent),(0,el.A)(U,"propTypes",null),$);(0,el.A)(eO,"defaultProps",{autoHeight:!1,estimatedRowSize:30,onScroll:function(){},noRowsRenderer:function(){return null},onRowsRendered:function(){},overscanIndicesGetter:accessibilityOverscanIndicesGetter_defaultOverscanIndicesGetter,overscanRowCount:10,scrollToAlignment:"auto",scrollToIndex:-1,style:{}});var eD=f(0x20d9752e1);function _GEA(o,p,f,m){for(var _=f+1;p<=f;){var w=p+f>>>1;o[w]>=m?(_=w,f=w-1):p=w+1}return _}function _GEP(o,p,f,m,_){for(var w=f+1;p<=f;){var I=p+f>>>1;_(o[I],m)>=0?(w=I,f=I-1):p=I+1}return w}let eL=function(o,p,f,m,_){return"function"==typeof f?_GEP(o,void 0===m?0:0|m,void 0===_?o.length-1:0|_,p,f):_GEA(o,void 0===f?0:0|f,void 0===m?o.length-1:0|m,p)};function IntervalTreeNode(o,p,f,m,_){this.mid=o,this.left=p,this.right=f,this.leftPoints=m,this.rightPoints=_,this.count=(p?p.count:0)+(f?f.count:0)+m.length}var eN=IntervalTreeNode.prototype;function copy(o,p){o.mid=p.mid,o.left=p.left,o.right=p.right,o.leftPoints=p.leftPoints,o.rightPoints=p.rightPoints,o.count=p.count}function rebuild(o,p){var f=createIntervalTree(p);o.mid=f.mid,o.left=f.left,o.right=f.right,o.leftPoints=f.leftPoints,o.rightPoints=f.rightPoints,o.count=f.count}function rebuildWithInterval(o,p){var f=o.intervals([]);f.push(p),rebuild(o,f)}function rebuildWithoutInterval(o,p){var f=o.intervals([]),m=f.indexOf(p);return m<0?0:(f.splice(m,1),rebuild(o,f),1)}function reportLeftRange(o,p,f){for(var m=0;m=0&&o[m][1]>=p;--m){var _=f(o[m]);if(_)return _}}function reportRange(o,p){for(var f=0;f>1],_=[],w=[],I=[],f=0;f3*(p+1)?rebuildWithInterval(this,o):this.left.insert(o):this.left=createIntervalTree([o]);else if(o[0]>this.mid)this.right?4*(this.right.count+1)>3*(p+1)?rebuildWithInterval(this,o):this.right.insert(o):this.right=createIntervalTree([o]);else{var f=eL(this.leftPoints,o,compareBegin),m=eL(this.rightPoints,o,compareEnd);this.leftPoints.splice(f,0,o),this.rightPoints.splice(m,0,o)}},eN.remove=function(o){var p=this.count-this.leftPoints;if(o[1]3*(p-1))return rebuildWithoutInterval(this,o);var f=this.left.remove(o);return 2===f?(this.left=null,this.count-=1,1):(1===f&&(this.count-=1),f)}if(o[0]>this.mid){if(!this.right)return 0;if(4*(this.left?this.left.count:0)>3*(p-1))return rebuildWithoutInterval(this,o);var f=this.right.remove(o);return 2===f?(this.right=null,this.count-=1,1):(1===f&&(this.count-=1),f)}if(1===this.count)if(this.leftPoints[0]===o)return 2;else return 0;if(1===this.leftPoints.length&&this.leftPoints[0]===o){if(this.left&&this.right){for(var m=this,_=this.left;_.right;)m=_,_=_.right;if(m===this)_.right=this.right;else{var w=this.left,f=this.right;m.count-=_.count,m.right=_.left,_.left=w,_.right=f}copy(this,_),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?copy(this,this.left):copy(this,this.right);return 1}for(var w=eL(this.leftPoints,o,compareBegin);wthis.mid))return reportRange(this.leftPoints,p);if(this.right){var f=this.right.queryPoint(o,p);if(f)return f}return reportRightRange(this.rightPoints,o,p)},eN.queryInterval=function(o,p,f){if(othis.mid&&this.right){var m=this.right.queryInterval(o,p,f);if(m)return m}return pthis.mid?reportRightRange(this.rightPoints,o,f):reportRange(this.leftPoints,f)};var eF=IntervalTree.prototype;function createWrapper(o){return new IntervalTree(o&&0!==o.length?createIntervalTree(o):null)}eF.insert=function(o){this.root?this.root.insert(o):this.root=new IntervalTreeNode(o[0],null,null,[o],[o])},eF.remove=function(o){if(this.root){var p=this.root.remove(o);return 2===p&&(this.root=null),0!==p}return!1},eF.queryPoint=function(o,p){if(this.root)return this.root.queryPoint(o,p)},eF.queryInterval=function(o,p,f){if(o<=p&&this.root)return this.root.queryInterval(o,p,f)},Object.defineProperty(eF,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(eF,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});var eV=function(){function PositionCache(){(0,ei.A)(this,PositionCache),(0,el.A)(this,"_columnSizeMap",{}),(0,el.A)(this,"_intervalTree",createWrapper()),(0,el.A)(this,"_leftMap",{})}return(0,er.A)(PositionCache,[{key:"estimateTotalHeight",value:function(o,p,f){var m=o-this.count;return this.tallestColumnSize+Math.ceil(m/p)*f}},{key:"range",value:function(o,p,f){var m=this;this._intervalTree.queryInterval(o,o+p,function(o){var p=(0,eD.A)(o,3),_=p[0],w=(p[1],p[2]);return f(w,m._leftMap[w],_)})}},{key:"setPosition",value:function(o,p,f,m){this._intervalTree.insert([f,f+m,o]),this._leftMap[o]=p;var _=this._columnSizeMap,w=_[p];void 0===w?_[p]=f+m:_[p]=Math.max(w,f+m)}},{key:"count",get:function(){return this._intervalTree.count}},{key:"shortestColumnSize",get:function(){var o=this._columnSizeMap,p=0;for(var f in o){var m=o[f];p=0===p?m:Math.min(p,m)}return p}},{key:"tallestColumnSize",get:function(){var o=this._columnSizeMap,p=0;for(var f in o)p=Math.max(p,o[f]);return p}}]),PositionCache}();function Masonry_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function Masonry_objectSpread(o){for(var p=1;p0&&void 0!==arguments[0]?arguments[0]:{};(0,ei.A)(this,CellMeasurerCacheDecorator),(0,el.A)(this,"_cellMeasurerCache",void 0),(0,el.A)(this,"_columnIndexOffset",void 0),(0,el.A)(this,"_rowIndexOffset",void 0),(0,el.A)(this,"columnWidth",function(p){var f=p.index;o._cellMeasurerCache.columnWidth({index:f+o._columnIndexOffset})}),(0,el.A)(this,"rowHeight",function(p){var f=p.index;o._cellMeasurerCache.rowHeight({index:f+o._rowIndexOffset})});var f=p.cellMeasurerCache,m=p.columnIndexOffset,_=p.rowIndexOffset;this._cellMeasurerCache=f,this._columnIndexOffset=void 0===m?0:m,this._rowIndexOffset=void 0===_?0:_}return(0,er.A)(CellMeasurerCacheDecorator,[{key:"clear",value:function(o,p){this._cellMeasurerCache.clear(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"clearAll",value:function(){this._cellMeasurerCache.clearAll()}},{key:"hasFixedHeight",value:function(){return this._cellMeasurerCache.hasFixedHeight()}},{key:"hasFixedWidth",value:function(){return this._cellMeasurerCache.hasFixedWidth()}},{key:"getHeight",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getHeight(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"getWidth",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.getWidth(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"has",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._cellMeasurerCache.has(o+this._rowIndexOffset,p+this._columnIndexOffset)}},{key:"set",value:function(o,p,f,m){this._cellMeasurerCache.set(o+this._rowIndexOffset,p+this._columnIndexOffset,f,m)}},{key:"defaultHeight",get:function(){return this._cellMeasurerCache.defaultHeight}},{key:"defaultWidth",get:function(){return this._cellMeasurerCache.defaultWidth}}]),CellMeasurerCacheDecorator}();function MultiGrid_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function MultiGrid_objectSpread(o){for(var p=1;p0?new eU({cellMeasurerCache:m,columnIndexOffset:0,rowIndexOffset:w}):m,f._deferredMeasurementCacheBottomRightGrid=_>0||w>0?new eU({cellMeasurerCache:m,columnIndexOffset:_,rowIndexOffset:w}):m,f._deferredMeasurementCacheTopRightGrid=_>0?new eU({cellMeasurerCache:m,columnIndexOffset:_,rowIndexOffset:0}):m),f}return(0,ea.A)(MultiGrid,o),(0,er.A)(MultiGrid,[{key:"forceUpdateGrids",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.forceUpdate(),this._bottomRightGrid&&this._bottomRightGrid.forceUpdate(),this._topLeftGrid&&this._topLeftGrid.forceUpdate(),this._topRightGrid&&this._topRightGrid.forceUpdate()}},{key:"invalidateCellSizeAfterRender",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=void 0===p?0:p,m=o.rowIndex,_=void 0===m?0:m;this._deferredInvalidateColumnIndex="number"==typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,f):f,this._deferredInvalidateRowIndex="number"==typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,_):_}},{key:"measureAllCells",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.measureAllCells(),this._bottomRightGrid&&this._bottomRightGrid.measureAllCells(),this._topLeftGrid&&this._topLeftGrid.measureAllCells(),this._topRightGrid&&this._topRightGrid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=void 0===p?0:p,m=o.rowIndex,_=void 0===m?0:m,w=this.props,I=w.fixedColumnCount,k=w.fixedRowCount,M=Math.max(0,f-I),x=Math.max(0,_-k);this._bottomLeftGrid&&this._bottomLeftGrid.recomputeGridSize({columnIndex:f,rowIndex:x}),this._bottomRightGrid&&this._bottomRightGrid.recomputeGridSize({columnIndex:M,rowIndex:x}),this._topLeftGrid&&this._topLeftGrid.recomputeGridSize({columnIndex:f,rowIndex:_}),this._topRightGrid&&this._topRightGrid.recomputeGridSize({columnIndex:M,rowIndex:_}),this._leftGridWidth=null,this._topGridHeight=null,this._maybeCalculateCachedStyles(!0)}},{key:"componentDidMount",value:function(){var o=this.props,p=o.scrollLeft,f=o.scrollTop;if(p>0||f>0){var m={};p>0&&(m.scrollLeft=p),f>0&&(m.scrollTop=f),this.setState(m)}this._handleInvalidatedGridSize()}},{key:"componentDidUpdate",value:function(){this._handleInvalidatedGridSize()}},{key:"render",value:function(){var o=this.props,p=o.onScroll,f=o.onSectionRendered,m=(o.onScrollbarPresenceChange,o.scrollLeft,o.scrollToColumn),_=(o.scrollTop,o.scrollToRow),w=_objectWithoutProperties(o,["onScroll","onSectionRendered","onScrollbarPresenceChange","scrollLeft","scrollToColumn","scrollTop","scrollToRow"]);if(this._prepareForRender(),0===this.props.width||0===this.props.height)return null;var I=this.state,k=I.scrollLeft,M=I.scrollTop;return ed.createElement("div",{style:this._containerOuterStyle},ed.createElement("div",{style:this._containerTopStyle},this._renderTopLeftGrid(w),this._renderTopRightGrid(MultiGrid_objectSpread({},w,{onScroll:p,scrollLeft:k}))),ed.createElement("div",{style:this._containerBottomStyle},this._renderBottomLeftGrid(MultiGrid_objectSpread({},w,{onScroll:p,scrollTop:M})),this._renderBottomRightGrid(MultiGrid_objectSpread({},w,{onScroll:p,onSectionRendered:f,scrollLeft:k,scrollToColumn:m,scrollToRow:_,scrollTop:M}))))}},{key:"_getBottomGridHeight",value:function(o){return o.height-this._getTopGridHeight(o)}},{key:"_getLeftGridWidth",value:function(o){var p=o.fixedColumnCount,f=o.columnWidth;if(null==this._leftGridWidth)if("function"==typeof f){for(var m=0,_=0;_=0?o.scrollLeft:p.scrollLeft,scrollTop:null!=o.scrollTop&&o.scrollTop>=0?o.scrollTop:p.scrollTop}:null}}]),MultiGrid}(ed.PureComponent);(0,el.A)(ej,"defaultProps",{classNameBottomLeftGrid:"",classNameBottomRightGrid:"",classNameTopLeftGrid:"",classNameTopRightGrid:"",enableFixedColumnScroll:!1,enableFixedRowScroll:!1,fixedColumnCount:0,fixedRowCount:0,scrollToColumn:-1,scrollToRow:-1,style:{},styleBottomLeftGrid:{},styleBottomRightGrid:{},styleTopLeftGrid:{},styleTopRightGrid:{},hideTopRightGridScrollbar:!1,hideBottomLeftGridScrollbar:!1}),ej.propTypes={},(0,ec.polyfill)(ej);let eH=ej;function defaultCellDataGetter(o){var p=o.dataKey,f=o.rowData;return"function"==typeof f.get?f.get(p):f[p]}function defaultCellRenderer(o){var p=o.cellData;return null==p?"":String(p)}function defaultHeaderRowRenderer(o){var p=o.className,f=o.columns,m=o.style;return ed.createElement("div",{className:p,role:"row",style:m},f)}(function(o){function ScrollSync(o,p){var f;return(0,ei.A)(this,ScrollSync),(f=(0,en.A)(this,(0,eo.A)(ScrollSync).call(this,o,p))).state={clientHeight:0,clientWidth:0,scrollHeight:0,scrollLeft:0,scrollTop:0,scrollWidth:0},f._onScroll=f._onScroll.bind((0,es.A)(f)),f}return(0,ea.A)(ScrollSync,o),(0,er.A)(ScrollSync,[{key:"render",value:function(){var o=this.props.children,p=this.state,f=p.clientHeight,m=p.clientWidth,_=p.scrollHeight,w=p.scrollLeft,I=p.scrollTop,k=p.scrollWidth;return o({clientHeight:f,clientWidth:m,onScroll:this._onScroll,scrollHeight:_,scrollLeft:w,scrollTop:I,scrollWidth:k})}},{key:"_onScroll",value:function(o){var p=o.clientHeight,f=o.clientWidth,m=o.scrollHeight,_=o.scrollLeft,w=o.scrollTop,I=o.scrollWidth;this.setState({clientHeight:p,clientWidth:f,scrollHeight:m,scrollLeft:_,scrollTop:w,scrollWidth:I})}}]),ScrollSync})(ed.PureComponent).propTypes={},defaultHeaderRowRenderer.propTypes=null;let ez="DESC";function SortIndicator(o){var p=o.sortDirection,f=clsx_m("ReactVirtualized__Table__sortableHeaderIcon",{"ReactVirtualized__Table__sortableHeaderIcon--ASC":"ASC"===p,"ReactVirtualized__Table__sortableHeaderIcon--DESC":p===ez});return ed.createElement("svg",{className:f,width:18,height:18,viewBox:"0 0 24 24"},"ASC"===p?ed.createElement("path",{d:"M7 14l5-5 5 5z"}):ed.createElement("path",{d:"M7 10l5 5 5-5z"}),ed.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}function defaultHeaderRenderer(o){var p=o.dataKey,f=o.label,m=o.sortBy,_=o.sortDirection,w=[ed.createElement("span",{className:"ReactVirtualized__Table__headerTruncatedText",key:"label",title:"string"==typeof f?f:null},f)];return m===p&&w.push(ed.createElement(SortIndicator,{key:"SortIndicator",sortDirection:_})),w}function defaultRowRenderer(o){var p=o.className,f=o.columns,m=o.index,_=o.key,w=o.onRowClick,I=o.onRowDoubleClick,k=o.onRowMouseOut,M=o.onRowMouseOver,x=o.onRowRightClick,O=o.rowData,L=o.style,B={"aria-rowindex":m+1};return(w||I||k||M||x)&&(B["aria-label"]="row",B.tabIndex=0,w&&(B.onClick=function(o){return w({event:o,index:m,rowData:O})}),I&&(B.onDoubleClick=function(o){return I({event:o,index:m,rowData:O})}),k&&(B.onMouseOut=function(o){return k({event:o,index:m,rowData:O})}),M&&(B.onMouseOver=function(o){return M({event:o,index:m,rowData:O})}),x&&(B.onContextMenu=function(o){return x({event:o,index:m,rowData:O})})),ed.createElement("div",(0,eu.A)({},B,{className:p,key:_,role:"row",style:L}),f)}SortIndicator.propTypes={},defaultHeaderRenderer.propTypes=null,defaultRowRenderer.propTypes=null;var eG=function(o){function Column(){return(0,ei.A)(this,Column),(0,en.A)(this,(0,eo.A)(Column).apply(this,arguments))}return(0,ea.A)(Column,o),Column}(ed.Component);function Table_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function Table_objectSpread(o){for(var p=1;p0&&void 0!==arguments[0]?arguments[0]:{},p=o.columnIndex,f=o.rowIndex;this.Grid&&this.Grid.recomputeGridSize({rowIndex:void 0===f?0:f,columnIndex:void 0===p?0:p})}},{key:"recomputeRowHeights",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:o})}},{key:"scrollToPosition",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:o})}},{key:"scrollToRow",value:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:o})}},{key:"getScrollbarWidth",value:function(){if(this.Grid){var o=(0,eT.findDOMNode)(this.Grid),p=o.clientWidth||0;return(o.offsetWidth||0)-p}return 0}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var o=this,p=this.props,f=p.children,m=p.className,_=p.disableHeader,w=p.gridClassName,I=p.gridStyle,k=p.headerHeight,M=p.headerRowRenderer,x=p.height,O=p.id,L=p.noRowsRenderer,B=p.rowClassName,U=p.rowStyle,$=p.scrollToIndex,q=p.style,Z=p.width,ee=this.state.scrollbarWidth,et="function"==typeof B?B({index:-1}):B,ei="function"==typeof U?U({index:-1}):U;return this._cachedColumnStyles=[],ed.Children.toArray(f).forEach(function(p,f){var m=o._getFlexStyleForColumn(p,p.props.style);o._cachedColumnStyles[f]=Table_objectSpread({overflow:"hidden"},m)}),ed.createElement("div",{"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-colcount":ed.Children.toArray(f).length,"aria-rowcount":this.props.rowCount,className:clsx_m("ReactVirtualized__Table",m),id:O,role:"grid",style:q},!_&&M({className:clsx_m("ReactVirtualized__Table__headerRow",et),columns:this._getHeaderColumns(),style:Table_objectSpread({height:k,overflow:"hidden",paddingRight:ee,width:Z},ei)}),ed.createElement(eb,(0,eu.A)({},this.props,{"aria-readonly":null,autoContainerWidth:!0,className:clsx_m("ReactVirtualized__Table__Grid",w),cellRenderer:this._createRow,columnWidth:Z,columnCount:1,height:_?x:x-k,id:void 0,noContentRenderer:L,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,role:"rowgroup",scrollbarWidth:ee,scrollToRow:$,style:Table_objectSpread({},I,{overflowX:"hidden"})})))}},{key:"_createColumn",value:function(o){var p=o.column,f=o.columnIndex,m=o.isScrolling,_=o.parent,w=o.rowData,I=o.rowIndex,k=this.props.onColumnClick,M=p.props,x=M.cellDataGetter,O=M.cellRenderer,L=M.className,B=M.columnData,U=M.dataKey,$=M.id,q=O({cellData:x({columnData:B,dataKey:U,rowData:w}),columnData:B,columnIndex:f,dataKey:U,isScrolling:m,parent:_,rowData:w,rowIndex:I}),Z=this._cachedColumnStyles[f],ee="string"==typeof q?q:null;return ed.createElement("div",{"aria-colindex":f+1,"aria-describedby":$,className:clsx_m("ReactVirtualized__Table__rowColumn",L),key:"Row"+I+"-Col"+f,onClick:function(o){k&&k({columnData:B,dataKey:U,event:o})},role:"gridcell",style:Z,title:ee},q)}},{key:"_createHeader",value:function(o){var p,f,m,_,w,I=o.column,k=o.index,M=this.props,x=M.headerClassName,O=M.headerStyle,L=M.onHeaderClick,B=M.sort,U=M.sortBy,$=M.sortDirection,q=I.props,Z=q.columnData,ee=q.dataKey,et=q.defaultSortDirection,ei=q.disableSort,er=q.headerRenderer,en=q.id,eo=q.label,es=!ei&&B,ea=clsx_m("ReactVirtualized__Table__headerColumn",x,I.props.headerClassName,{ReactVirtualized__Table__sortableHeaderColumn:es}),el=this._getFlexStyleForColumn(I,Table_objectSpread({},O,{},I.props.headerStyle)),ec=er({columnData:Z,dataKey:ee,disableSort:ei,label:eo,sortBy:U,sortDirection:$});if(es||L){var eu=U!==ee?et:$===ez?"ASC":ez,onClick=function(o){es&&B({defaultSortDirection:et,event:o,sortBy:ee,sortDirection:eu}),L&&L({columnData:Z,dataKey:ee,event:o})};w=I.props["aria-label"]||eo||ee,_="none",m=0,p=onClick,f=function(o){("Enter"===o.key||" "===o.key)&&onClick(o)}}return U===ee&&(_="ASC"===$?"ascending":"descending"),ed.createElement("div",{"aria-label":w,"aria-sort":_,className:ea,id:en,key:"Header-Col"+k,onClick:p,onKeyDown:f,role:"columnheader",style:el,tabIndex:m},ec)}},{key:"_createRow",value:function(o){var p=this,f=o.rowIndex,m=o.isScrolling,_=o.key,w=o.parent,I=o.style,k=this.props,M=k.children,x=k.onRowClick,O=k.onRowDoubleClick,L=k.onRowRightClick,B=k.onRowMouseOver,U=k.onRowMouseOut,$=k.rowClassName,q=k.rowGetter,Z=k.rowRenderer,ee=k.rowStyle,et=this.state.scrollbarWidth,ei="function"==typeof $?$({index:f}):$,er="function"==typeof ee?ee({index:f}):ee,en=q({index:f}),eo=ed.Children.toArray(M).map(function(o,_){return p._createColumn({column:o,columnIndex:_,isScrolling:m,parent:w,rowData:en,rowIndex:f,scrollbarWidth:et})}),es=clsx_m("ReactVirtualized__Table__row",ei),ea=Table_objectSpread({},I,{height:this._getRowHeight(f),overflow:"hidden",paddingRight:et},er);return Z({className:es,columns:eo,index:f,isScrolling:m,key:_,onRowClick:x,onRowDoubleClick:O,onRowRightClick:L,onRowMouseOver:B,onRowMouseOut:U,rowData:en,style:ea})}},{key:"_getFlexStyleForColumn",value:function(o){var p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f="".concat(o.props.flexGrow," ").concat(o.props.flexShrink," ").concat(o.props.width,"px"),m=Table_objectSpread({},p,{flex:f,msFlex:f,WebkitFlex:f});return o.props.maxWidth&&(m.maxWidth=o.props.maxWidth),o.props.minWidth&&(m.minWidth=o.props.minWidth),m}},{key:"_getHeaderColumns",value:function(){var o=this,p=this.props,f=p.children;return(p.disableHeader?[]:ed.Children.toArray(f)).map(function(p,f){return o._createHeader({column:p,index:f})})}},{key:"_getRowHeight",value:function(o){var p=this.props.rowHeight;return"function"==typeof p?p({index:o}):p}},{key:"_onScroll",value:function(o){var p=o.clientHeight,f=o.scrollHeight,m=o.scrollTop;(0,this.props.onScroll)({clientHeight:p,scrollHeight:f,scrollTop:m})}},{key:"_onSectionRendered",value:function(o){var p=o.rowOverscanStartIndex,f=o.rowOverscanStopIndex,m=o.rowStartIndex,_=o.rowStopIndex;(0,this.props.onRowsRendered)({overscanStartIndex:p,overscanStopIndex:f,startIndex:m,stopIndex:_})}},{key:"_setRef",value:function(o){this.Grid=o}},{key:"_setScrollbarWidth",value:function(){var o=this.getScrollbarWidth();this.setState({scrollbarWidth:o})}}]),Table}(ed.PureComponent);(0,el.A)(eW,"defaultProps",{disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanIndicesGetter:accessibilityOverscanIndicesGetter_defaultOverscanIndicesGetter,overscanRowCount:10,rowRenderer:defaultRowRenderer,headerRowRenderer:defaultHeaderRowRenderer,rowStyle:{},scrollToAlignment:"auto",scrollToIndex:-1,style:{}}),eW.propTypes={};var e$=[],eK=null,eq=null;function enablePointerEventsIfDisabled(){eq&&(eq=null,document.body&&null!=eK&&(document.body.style.pointerEvents=eK),eK=null)}function enablePointerEventsAfterDelayCallback(){enablePointerEventsIfDisabled(),e$.forEach(function(o){return o.__resetIsScrolling()})}function enablePointerEventsAfterDelay(){eq&&cancelAnimationTimeout(eq);var o=0;e$.forEach(function(p){o=Math.max(o,p.props.scrollingResetTimeInterval)}),eq=requestAnimationTimeout(enablePointerEventsAfterDelayCallback,o)}function onScrollWindow(o){o.currentTarget===window&&null==eK&&document.body&&(eK=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),enablePointerEventsAfterDelay(),e$.forEach(function(p){p.props.scrollElement===o.currentTarget&&p.__handleWindowScrollEvent()})}function registerScrollListener(o,p){e$.some(function(o){return o.props.scrollElement===p})||p.addEventListener("scroll",onScrollWindow),e$.push(o)}function unregisterScrollListener(o,p){!(e$=e$.filter(function(p){return p!==o})).length&&(p.removeEventListener("scroll",onScrollWindow),eq&&(cancelAnimationTimeout(eq),enablePointerEventsIfDisabled()))}var isWindow=function(o){return o===window},getBoundingBox=function(o){return o.getBoundingClientRect()};function getDimensions(o,p){if(!o)return{height:p.serverHeight,width:p.serverWidth};if(!isWindow(o))return getBoundingBox(o);var f=window,m=f.innerHeight,_=f.innerWidth;return{height:"number"==typeof m?m:0,width:"number"==typeof _?_:0}}function getPositionOffset(o,p){if(isWindow(p)&&document.documentElement){var f=document.documentElement,m=getBoundingBox(o),_=getBoundingBox(f);return{top:m.top-_.top,left:m.left-_.left}}var w=getScrollOffset(p),I=getBoundingBox(o),k=getBoundingBox(p);return{top:I.top+w.top-k.top,left:I.left+w.left-k.left}}function getScrollOffset(o){return isWindow(o)&&document.documentElement?{top:"scrollY"in window?window.scrollY:document.documentElement.scrollTop,left:"scrollX"in window?window.scrollX:document.documentElement.scrollLeft}:{top:o.scrollTop,left:o.scrollLeft}}function WindowScroller_ownKeys(o,p){var f=Object.keys(o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(o);p&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),f.push.apply(f,m)}return f}function WindowScroller_objectSpread(o){for(var p=1;ptypeof window?window:void 0},eJ=(et=ee=function(o){function WindowScroller(){(0,ei.A)(this,WindowScroller);for(var o,p,f=arguments.length,m=Array(f),_=0;_0&&void 0!==arguments[0]?arguments[0]:this.props.scrollElement,p=this.props.onResize,f=this.state,m=f.height,_=f.width,w=this._child||eT.findDOMNode(this);if(w instanceof Element&&o){var I=getPositionOffset(w,o);this._positionFromTop=I.top,this._positionFromLeft=I.left}var k=getDimensions(o,this.props);(m!==k.height||_!==k.width)&&(this.setState({height:k.height,width:k.width}),p({height:k.height,width:k.width}))}},{key:"componentDidMount",value:function(){var o=this.props.scrollElement;this._detectElementResize=createDetectElementResize(),this.updatePosition(o),o&&(registerScrollListener(this,o),this._registerResizeListener(o)),this._isMounted=!0}},{key:"componentDidUpdate",value:function(o,p){var f=this.props.scrollElement,m=o.scrollElement;m!==f&&null!=m&&null!=f&&(this.updatePosition(f),unregisterScrollListener(this,m),registerScrollListener(this,f),this._unregisterResizeListener(m),this._registerResizeListener(f))}},{key:"componentWillUnmount",value:function(){var o=this.props.scrollElement;o&&(unregisterScrollListener(this,o),this._unregisterResizeListener(o)),this._isMounted=!1}},{key:"render",value:function(){var o=this.props.children,p=this.state,f=p.isScrolling,m=p.scrollTop,_=p.scrollLeft,w=p.height,I=p.width;return o({onChildScroll:this._onChildScroll,registerChild:this._registerChild,height:w,isScrolling:f,scrollLeft:_,scrollTop:m,width:I})}}]),WindowScroller}(ed.PureComponent),(0,el.A)(ee,"propTypes",null),et);(0,el.A)(eJ,"defaultProps",{onResize:function(){},onScroll:function(){},scrollingResetTimeInterval:150,scrollElement:getWindow(),serverHeight:0,serverWidth:0})},0x1cebff0c0:(o,p,f)=>{"use strict";f.d(p,{P:()=>thunk});var thunk=({dispatch:o,getState:p})=>f=>m=>"function"==typeof m?m(o,p,void 0):f(m)},0x182690375:(o,p,f)=>{"use strict";f.d(p,{Q:()=>w,c:()=>I});var m,_,w=((m={})[m.ID=25]="ID",m[m.FRECENCY=0]="FRECENCY",m[m.RAW_FRECENCY=65]="RAW_FRECENCY",m[m.FRECENCY_BONUS=76]="FRECENCY_BONUS",m[m.FRECENCY_WEIGHT_HIT_VISITS=91]="FRECENCY_WEIGHT_HIT_VISITS",m[m.FRECENCY_HIT_COUNT=92]="FRECENCY_HIT_COUNT",m[m.FRECENCY_WEIGHT_ITEM_VISITS=93]="FRECENCY_WEIGHT_ITEM_VISITS",m[m.FRECENCY_ITEM_COUNT=94]="FRECENCY_ITEM_COUNT",m[m.FRECENCY_LOG_HIT_COUNT=105]="FRECENCY_LOG_HIT_COUNT",m[m.FRECENCY_LOG_HIT_COUNT_SCALED=106]="FRECENCY_LOG_HIT_COUNT_SCALED",m[m.FRECENCY_LOG_ITEM_COUNT=159]="FRECENCY_LOG_ITEM_COUNT",m[m.FRECENCY_LOG_ITEM_COUNT_SCALED=160]="FRECENCY_LOG_ITEM_COUNT_SCALED",m[m.FRECENCY_HIT_VISIT_DECAY_2H=162]="FRECENCY_HIT_VISIT_DECAY_2H",m[m.FRECENCY_HIT_VISIT_DECAY_7D=163]="FRECENCY_HIT_VISIT_DECAY_7D",m[m.FRECENCY_ITEM_VISIT_DECAY_2H=164]="FRECENCY_ITEM_VISIT_DECAY_2H",m[m.FRECENCY_ITEM_VISIT_DECAY_7D=165]="FRECENCY_ITEM_VISIT_DECAY_7D",m[m.FRECENCY_HIT_VISITS_4H=242]="FRECENCY_HIT_VISITS_4H",m[m.FRECENCY_HIT_VISITS_1D=243]="FRECENCY_HIT_VISITS_1D",m[m.FRECENCY_HIT_VISITS_3D=244]="FRECENCY_HIT_VISITS_3D",m[m.FRECENCY_HIT_VISITS_1W=245]="FRECENCY_HIT_VISITS_1W",m[m.FRECENCY_HIT_VISITS_1M=246]="FRECENCY_HIT_VISITS_1M",m[m.FRECENCY_HIT_VISITS_90D=247]="FRECENCY_HIT_VISITS_90D",m[m.FRECENCY_ITEM_VISITS_4H=248]="FRECENCY_ITEM_VISITS_4H",m[m.FRECENCY_ITEM_VISITS_1D=249]="FRECENCY_ITEM_VISITS_1D",m[m.FRECENCY_ITEM_VISITS_3D=250]="FRECENCY_ITEM_VISITS_3D",m[m.FRECENCY_ITEM_VISITS_1W=251]="FRECENCY_ITEM_VISITS_1W",m[m.FRECENCY_ITEM_VISITS_1M=252]="FRECENCY_ITEM_VISITS_1M",m[m.FRECENCY_ITEM_VISITS_90D=253]="FRECENCY_ITEM_VISITS_90D",m[m.TYPE_NAVIGATION_CHANNEL=2]="TYPE_NAVIGATION_CHANNEL",m[m.TYPE_NAVIGATION_LINK=172]="TYPE_NAVIGATION_LINK",m[m.TYPE_NAVIGATION_MPIM=4]="TYPE_NAVIGATION_MPIM",m[m.TYPE_NAVIGATION_MODAL=177]="TYPE_NAVIGATION_MODAL",m[m.TYPE_NAVIGATION_USER=5]="TYPE_NAVIGATION_USER",m[m.TYPE_QUERY=6]="TYPE_QUERY",m[m.TYPE_QUERY_HISTORY=7]="TYPE_QUERY_HISTORY",m[m.TYPE_EMOJI=178]="TYPE_EMOJI",m[m.ACTIVE_TOKEN_FILTER_IN=8]="ACTIVE_TOKEN_FILTER_IN",m[m.ACTIVE_TOKEN_FILTER_FROM=9]="ACTIVE_TOKEN_FILTER_FROM",m[m.ACTIVE_TOKEN_FILTER_TO=10]="ACTIVE_TOKEN_FILTER_TO",m[m.ACTIVE_TOKEN_FILTER_BEFORE=11]="ACTIVE_TOKEN_FILTER_BEFORE",m[m.ACTIVE_TOKEN_FILTER_DURING=12]="ACTIVE_TOKEN_FILTER_DURING",m[m.ACTIVE_TOKEN_FILTER_ON=13]="ACTIVE_TOKEN_FILTER_ON",m[m.ACTIVE_TOKEN_FILTER_AFTER=14]="ACTIVE_TOKEN_FILTER_AFTER",m[m.ACTIVE_TOKEN_FILTER_HAS=15]="ACTIVE_TOKEN_FILTER_HAS",m[m.ACTIVE_TOKEN_FILTER_IS=155]="ACTIVE_TOKEN_FILTER_IS",m[m.ACTIVE_TOKEN_FILTER_WITH=233]="ACTIVE_TOKEN_FILTER_WITH",m[m.ACTIVE_TOKEN_MEMBER=16]="ACTIVE_TOKEN_MEMBER",m[m.ACTIVE_TOKEN_STRING=17]="ACTIVE_TOKEN_STRING",m[m.ACTIVE_TOKEN_PHRASE=18]="ACTIVE_TOKEN_PHRASE",m[m.STRING_EXACT_MATCH=19]="STRING_EXACT_MATCH",m[m.STRING_EXACT_PREFIX_MATCH=20]="STRING_EXACT_PREFIX_MATCH",m[m.STRING_NORMAL_MATCH=21]="STRING_NORMAL_MATCH",m[m.STRING_NORMAL_PREFIX_MATCH=22]="STRING_NORMAL_PREFIX_MATCH",m[m.STRING_SAME_NUMBER_WORDS=23]="STRING_SAME_NUMBER_WORDS",m[m.EXCESS_STRING_LENGTH=24]="EXCESS_STRING_LENGTH",m[m.EXACT_MATCH_LOG_RESULTS=229]="EXACT_MATCH_LOG_RESULTS",m[m.FILE_SUGGESTION_SCORE=26]="FILE_SUGGESTION_SCORE",m[m.ACTIVE_TOKEN_QUERY_SUGGESTION=27]="ACTIVE_TOKEN_QUERY_SUGGESTION",m[m.QUERY_SUGGESTION_SCORE_V2=28]="QUERY_SUGGESTION_SCORE_V2",m[m.TYPE_NAVIGATION_TEAM=31]="TYPE_NAVIGATION_TEAM",m[m.TYPE_NAVIGATION_VIEW=32]="TYPE_NAVIGATION_VIEW",m[m.TYPE_USER_QUERY=33]="TYPE_USER_QUERY",m[m.NAV_EXACT_MATCH=35]="NAV_EXACT_MATCH",m[m.NAV_EXACT_PREFIX_MATCH=36]="NAV_EXACT_PREFIX_MATCH",m[m.NAV_NORMAL_MATCH=37]="NAV_NORMAL_MATCH",m[m.NAV_NORMAL_PREFIX_MATCH=75]="NAV_NORMAL_PREFIX_MATCH",m[m.CHANNEL_IS_PREVIOUS_NAME_EXACT_MATCH=38]="CHANNEL_IS_PREVIOUS_NAME_EXACT_MATCH",m[m.CHANNEL_IS_PREVIOUS_NAME_PREFIX_MATCH=39]="CHANNEL_IS_PREVIOUS_NAME_PREFIX_MATCH",m[m.CHANNEL_IS_ARCHIVED=40]="CHANNEL_IS_ARCHIVED",m[m.CHANNEL_IS_MEMBER=41]="CHANNEL_IS_MEMBER",m[m.CHANNEL_IS_STARRED=42]="CHANNEL_IS_STARRED",m[m.MPIM_IS_STARRED=43]="MPIM_IS_STARRED",m[m.CHANNEL_IS_UNREAD=44]="CHANNEL_IS_UNREAD",m[m.MPIM_IS_UNREAD=45]="MPIM_IS_UNREAD",m[m.CHANNEL_IS_OTHER_TEAM=46]="CHANNEL_IS_OTHER_TEAM",m[m.USER_IS_ACTIVE=47]="USER_IS_ACTIVE",m[m.USER_IS_CURRENT_USER=48]="USER_IS_CURRENT_USER",m[m.USER_DM_IS_STARRED=49]="USER_DM_IS_STARRED",m[m.USER_DM_IS_UNREAD=50]="USER_DM_IS_UNREAD",m[m.CHANNEL_PRIORITY=51]="CHANNEL_PRIORITY",m[m.CHANNEL_READ_AGE_DECAY_7D=52]="CHANNEL_READ_AGE_DECAY_7D",m[m.CHANNEL_READ_AGE_DECAY_2H=53]="CHANNEL_READ_AGE_DECAY_2H",m[m.MPIM_READ_AGE_DECAY_2H=54]="MPIM_READ_AGE_DECAY_2H",m[m.MPIM_READ_AGE_DECAY_7D=55]="MPIM_READ_AGE_DECAY_7D",m[m.USER_DM_READ_AGE_DECAY_7D=56]="USER_DM_READ_AGE_DECAY_7D",m[m.USER_DM_READ_AGE_DECAY_2H=57]="USER_DM_READ_AGE_DECAY_2H",m[m.USER_DM_READ_AGE_DECAY_7D_V2=274]="USER_DM_READ_AGE_DECAY_7D_V2",m[m.USER_DM_READ_AGE_DECAY_2H_V2=275]="USER_DM_READ_AGE_DECAY_2H_V2",m[m.QUERY_LENGTH=61]="QUERY_LENGTH",m[m.NAV_QUERY_LENGTH=62]="NAV_QUERY_LENGTH",m[m.SUGGESTION_TEXT_LENGTH=63]="SUGGESTION_TEXT_LENGTH",m[m.NAV_TEXT_LENGTH=64]="NAV_TEXT_LENGTH",m[m.MPIM_PRIORITY=66]="MPIM_PRIORITY",m[m.QUERY_RATIO_LENGTH_STRING=68]="QUERY_RATIO_LENGTH_STRING",m[m.NAV_QUERY_RATIO_LENGTH_STRING=69]="NAV_QUERY_RATIO_LENGTH_STRING",m[m.USER_QUERY_RATIO_LENGTH_STRING=70]="USER_QUERY_RATIO_LENGTH_STRING",m[m.CHANNEL_QUERY_RATIO_LENGTH_STRING=71]="CHANNEL_QUERY_RATIO_LENGTH_STRING",m[m.MPIM_QUERY_RATIO_LENGTH_STRING=72]="MPIM_QUERY_RATIO_LENGTH_STRING",m[m.FUZZY_SCORE=73]="FUZZY_SCORE",m[m.MPIM_WITH_DEACTIVATED_USER=74]="MPIM_WITH_DEACTIVATED_USER",m[m.USER_FIRST_NAME_EXACT_MATCH=81]="USER_FIRST_NAME_EXACT_MATCH",m[m.USER_FIRST_NAME_EXACT_PREFIX_MATCH=82]="USER_FIRST_NAME_EXACT_PREFIX_MATCH",m[m.USER_FIRST_NAME_NORMAL_MATCH=83]="USER_FIRST_NAME_NORMAL_MATCH",m[m.USER_FIRST_NAME_NORMAL_PREFIX_MATCH=84]="USER_FIRST_NAME_NORMAL_PREFIX_MATCH",m[m.USER_LAST_NAME_EXACT_MATCH=85]="USER_LAST_NAME_EXACT_MATCH",m[m.USER_LAST_NAME_EXACT_PREFIX_MATCH=86]="USER_LAST_NAME_EXACT_PREFIX_MATCH",m[m.USER_LAST_NAME_NORMAL_MATCH=87]="USER_LAST_NAME_NORMAL_MATCH",m[m.USER_LAST_NAME_NORMAL_PREFIX_MATCH=88]="USER_LAST_NAME_NORMAL_PREFIX_MATCH",m[m.USER_PRIORITY=89]="USER_PRIORITY",m[m.ONLY_MATCHES_PREVIOUS_NAME=90]="ONLY_MATCHES_PREVIOUS_NAME",m[m.NAV_NORMAL_MATCH_USER=95]="NAV_NORMAL_MATCH_USER",m[m.NAV_NORMAL_PREFIX_MATCH_USER=96]="NAV_NORMAL_PREFIX_MATCH_USER",m[m.NAV_NORMAL_MATCH_NO_USER=97]="NAV_NORMAL_MATCH_NO_USER",m[m.NAV_NORMAL_PREFIX_MATCH_NO_USER=98]="NAV_NORMAL_PREFIX_MATCH_NO_USER",m[m.CHANNEL_LATEST_MSG_AGE_DECAY_7D=99]="CHANNEL_LATEST_MSG_AGE_DECAY_7D",m[m.CHANNEL_LATEST_MSG_AGE_DECAY_2H=100]="CHANNEL_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_LATEST_MSG_AGE_DECAY_2H=101]="MPIM_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_LATEST_MSG_AGE_DECAY_7D=102]="MPIM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_DM_LATEST_MSG_AGE_DECAY_7D=103]="USER_DM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_DM_LATEST_MSG_AGE_DECAY_2H=104]="USER_DM_LATEST_MSG_AGE_DECAY_2H",m[m.USER_DM_LATEST_MSG_AGE_DECAY_7D_V2=260]="USER_DM_LATEST_MSG_AGE_DECAY_7D_V2",m[m.USER_DM_LATEST_MSG_AGE_DECAY_2H_V2=261]="USER_DM_LATEST_MSG_AGE_DECAY_2H_V2",m[m.FUZZY_SCORE_50=127]="FUZZY_SCORE_50",m[m.FUZZY_SCORE_25=128]="FUZZY_SCORE_25",m[m.FUZZY_SCORE_ALL=129]="FUZZY_SCORE_ALL",m[m.FUZZY_SCORE_SCALED_EXP=291]="FUZZY_SCORE_SCALED_EXP",m[m.FUZZY_SCORE_SCALED_FLIPPED=292]="FUZZY_SCORE_SCALED_FLIPPED",m[m.FUZZY_SCORE_SCALED_SUBTRACT=293]="FUZZY_SCORE_SCALED_SUBTRACT",m[m.HERE_KEYWORD=131]="HERE_KEYWORD",m[m.HERE_KEYWORD_EXACT_MATCH=132]="HERE_KEYWORD_EXACT_MATCH",m[m.IS_BROADCAST_KEYWORD=133]="IS_BROADCAST_KEYWORD",m[m.BROADCAST_KEYWORD_NORMAL_MATCH=134]="BROADCAST_KEYWORD_NORMAL_MATCH",m[m.MEMBER_OF_CURRENT_CHANNEL=153]="MEMBER_OF_CURRENT_CHANNEL",m[m.QUERY_LENGTH_DECAY_NORMAL_MATCH_CHANNEL=154]="QUERY_LENGTH_DECAY_NORMAL_MATCH_CHANNEL",m[m.USER_EMAIL_MATCH=170]="USER_EMAIL_MATCH",m[m.USER_EMAIL_ONLY_MATCH=171]="USER_EMAIL_ONLY_MATCH",m[m.QUERY_IS_SELF=193]="QUERY_IS_SELF",m[m.CURRENT_USER_TEXTY=194]="CURRENT_USER_TEXTY",m[m.USER_IS_EXTERNAL=234]="USER_IS_EXTERNAL",m[m.USER_SAME_TEAM=235]="USER_SAME_TEAM",m[m.USER_IS_BOT=254]="USER_IS_BOT",m[m.MEMBER_OF_SEARCHER_DEFAULT_TEAM=294]="MEMBER_OF_SEARCHER_DEFAULT_TEAM",m[m.HAS_WORKSPACE_INTERSECTION_WITH_SEARCHER=295]="HAS_WORKSPACE_INTERSECTION_WITH_SEARCHER",m[m.NUM_WORKSPACES_INTERSECTING_WITH_SEARCHER=296]="NUM_WORKSPACES_INTERSECTING_WITH_SEARCHER",m[m.USER_IS_DEACTIVATED=297]="USER_IS_DEACTIVATED",m[m.USER_IS_IN_CURRENT_THREAD=298]="USER_IS_IN_CURRENT_THREAD",m[m.MEMBER_FILTER_USER_IN_CHANNEL=299]="MEMBER_FILTER_USER_IN_CHANNEL",m[m.FROM_AND_CHANNEL_FILTERS_USER_IN_CHANNEL=300]="FROM_AND_CHANNEL_FILTERS_USER_IN_CHANNEL",m[m.CHANNEL_TEAM_CTR_90DD=189]="CHANNEL_TEAM_CTR_90DD",m[m.CHANNEL_USER_CTR_30DD=190]="CHANNEL_USER_CTR_30DD",m[m.NAV_NORMAL_MATCH_CHANNEL_LOG_RESULTS=199]="NAV_NORMAL_MATCH_CHANNEL_LOG_RESULTS",m[m.HISTORY_AGE_DECAY_2H=230]="HISTORY_AGE_DECAY_2H",m[m.HISTORY_AGE_DECAY_7D=231]="HISTORY_AGE_DECAY_7D",m[m.HISTORY_POSITION=232]="HISTORY_POSITION",m[m.CHANNEL_IS_NOT_MEMBER=310]="CHANNEL_IS_NOT_MEMBER",m[m.USER_DM_NULL=179]="USER_DM_NULL",m[m.USER_DM_EMPTY=180]="USER_DM_EMPTY",m[m.USER_DM_NOT_OPEN=181]="USER_DM_NOT_OPEN",m[m.USER_DM_OPEN=182]="USER_DM_OPEN",m[m.USER_DM_LATEST_OLDER_30D=183]="USER_DM_LATEST_OLDER_30D",m[m.USER_DM_LATEST_OLDER_90D=184]="USER_DM_LATEST_OLDER_90D",m[m.USER_DM_EMPTY_V2=257]="USER_DM_EMPTY_V2",m[m.USER_DM_LATEST_OLDER_30D_V2=258]="USER_DM_LATEST_OLDER_30D_V2",m[m.USER_DM_LATEST_OLDER_90D_V2=259]="USER_DM_LATEST_OLDER_90D_V2",m[m.USER_HAS_DMED=284]="USER_HAS_DMED",m[m.USER_DM_READ_AGE_DECAY_2H_V3=285]="USER_DM_READ_AGE_DECAY_2H_V3",m[m.USER_DM_READ_AGE_DECAY_7D_V3=286]="USER_DM_READ_AGE_DECAY_7D_V3",m[m.USER_DM_READ_OLDER_7D=287]="USER_DM_READ_OLDER_7D",m[m.USER_DM_READ_OLDER_30D=288]="USER_DM_READ_OLDER_30D",m[m.USER_DM_READ_OLDER_90D=289]="USER_DM_READ_OLDER_90D",m[m.USER_MPIM_READ_AGE_DECAY_7D=236]="USER_MPIM_READ_AGE_DECAY_7D",m[m.USER_MPIM_READ_AGE_DECAY_2H=237]="USER_MPIM_READ_AGE_DECAY_2H",m[m.USER_MPIM_LATEST_MSG_AGE_DECAY_7D=238]="USER_MPIM_LATEST_MSG_AGE_DECAY_7D",m[m.USER_MPIM_LATEST_MSG_AGE_DECAY_2H=239]="USER_MPIM_LATEST_MSG_AGE_DECAY_2H",m[m.USER_MPIM_FRECENCY_LOG_HIT_COUNT=240]="USER_MPIM_FRECENCY_LOG_HIT_COUNT",m[m.USER_MPIM_FRECENCY_LOG_ITEM_COUNT=241]="USER_MPIM_FRECENCY_LOG_ITEM_COUNT",m[m.USER_HAS_MPDMED=303]="USER_HAS_MPDMED",m[m.USER_MPIM_LOG1P_MEMBERSHIP_COUNT=304]="USER_MPIM_LOG1P_MEMBERSHIP_COUNT",m[m.USER_MPIM_GTE5_MEMBERSHIP_COUNT=305]="USER_MPIM_GTE5_MEMBERSHIP_COUNT",m[m.USER_MPIM_GTE25_MEMBERSHIP_COUNT=306]="USER_MPIM_GTE25_MEMBERSHIP_COUNT",m[m.USER_MPIM_READ_AGE_DECAY_7D_V2=307]="USER_MPIM_READ_AGE_DECAY_7D_V2",m[m.USER_MPIM_READ_AGE_DECAY_2H_V2=308]="USER_MPIM_READ_AGE_DECAY_2H_V2",m[m.MPIM_MEMBERS=166]="MPIM_MEMBERS",m[m.MPIM_MEMBER_NAME_MATCHES=167]="MPIM_MEMBER_NAME_MATCHES",m[m.MPIM_MEMBER_ALL_MATCHES=168]="MPIM_MEMBER_ALL_MATCHES",m[m.MPIM_MATCHER_SCORE=169]="MPIM_MATCHER_SCORE",m[m.MPIM_MATCHER_SCORE_0=173]="MPIM_MATCHER_SCORE_0",m[m.MPIM_MATCHER_SCORE_1=174]="MPIM_MATCHER_SCORE_1",m[m.MPIM_MATCHER_SCORE_2=175]="MPIM_MATCHER_SCORE_2",m[m.MPIM_MATCHER_SCORE_3=176]="MPIM_MATCHER_SCORE_3",m[m.MPIM_TEAM_CTR_90DD=187]="MPIM_TEAM_CTR_90DD",m[m.MPIM_USER_CTR_30DD=188]="MPIM_USER_CTR_30DD",m[m.MPIM_NUM_OTHER_MEMBERS_EQUALS_NUM_QUERY_WORDS=301]="MPIM_NUM_OTHER_MEMBERS_EQUALS_NUM_QUERY_WORDS",m[m.MPIM_ALL_OTHER_MEMBERS_NAMES_HAVE_PREFIX_MATCH=302]="MPIM_ALL_OTHER_MEMBERS_NAMES_HAVE_PREFIX_MATCH",m[m.MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_2H=262]="MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_7D=263]="MPIM_USERS_MAX_LATEST_MSG_AGE_DECAY_7D",m[m.MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_2H=264]="MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_2H",m[m.MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_7D=265]="MPIM_USERS_AVG_LATEST_MSG_AGE_DECAY_7D",m[m.MPIM_USERS_MAX_MSG_READ_AGE_DECAY_2H=266]="MPIM_USERS_MAX_MSG_READ_AGE_DECAY_2H",m[m.MPIM_USERS_MAX_MSG_READ_AGE_DECAY_7D=267]="MPIM_USERS_MAX_MSG_READ_AGE_DECAY_7D",m[m.MPIM_USERS_AVG_MSG_READ_AGE_DECAY_2H=268]="MPIM_USERS_AVG_MSG_READ_AGE_DECAY_2H",m[m.MPIM_USERS_AVG_MSG_READ_AGE_DECAY_7D=269]="MPIM_USERS_AVG_MSG_READ_AGE_DECAY_7D",m[m.MPIM_USERS_PCT_NON_EMPTY_DMS=270]="MPIM_USERS_PCT_NON_EMPTY_DMS",m[m.MPIM_USERS_PCT_NON_NULL_DMS=271]="MPIM_USERS_PCT_NON_NULL_DMS",m[m.MPIM_USERS_ALL_INTERNAL=272]="MPIM_USERS_ALL_INTERNAL",m[m.EMOJI_EXACT_MATCH=136]="EMOJI_EXACT_MATCH",m[m.EMOJI_QUERY_LENGTH_RATIO=150]="EMOJI_QUERY_LENGTH_RATIO",m[m.EMOJI_TOTAL_COMBO_BREAKS=151]="EMOJI_TOTAL_COMBO_BREAKS",m[m.EMOJI_COMBO_BREAK_0=161]="EMOJI_COMBO_BREAK_0",m[m.EMOJI_COMBO_BREAK_1=156]="EMOJI_COMBO_BREAK_1",m[m.EMOJI_COMBO_BREAK_2=157]="EMOJI_COMBO_BREAK_2",m[m.EMOJI_COMBO_BREAK_3=158]="EMOJI_COMBO_BREAK_3",m[m.EMOJI_TEAM_CTR_90DD=185]="EMOJI_TEAM_CTR_90DD",m[m.EMOJI_USER_CTR_30DD=186]="EMOJI_USER_CTR_30DD",m[m.CHANNEL_IS_FROZEN=146]="CHANNEL_IS_FROZEN",m[m.USER_DM_IS_FROZEN=147]="USER_DM_IS_FROZEN",m[m.CHANNEL_HAS_DRAFT=148]="CHANNEL_HAS_DRAFT",m[m.USER_DM_HAS_DRAFT=149]="USER_DM_HAS_DRAFT",m[m.QUERY_FRECENCY_RAW=107]="QUERY_FRECENCY_RAW",m[m.QUERY_FRECENCY_WEIGHT_HIT_VISITS=108]="QUERY_FRECENCY_WEIGHT_HIT_VISITS",m[m.QUERY_FRECENCY_HIT_COUNT=109]="QUERY_FRECENCY_HIT_COUNT",m[m.QUERY_FRECENCY_WEIGHT_ITEM_VISITS=110]="QUERY_FRECENCY_WEIGHT_ITEM_VISITS",m[m.QUERY_FRECENCY_ITEM_COUNT=111]="QUERY_FRECENCY_ITEM_COUNT",m[m.QUERY_FUZZY_SCORE=112]="QUERY_FUZZY_SCORE",m[m.QUERY_FRECENCY_BONUS=113]="QUERY_FRECENCY_BONUS",m[m.QUERY_LOG_HIT_COUNT=130]="QUERY_LOG_HIT_COUNT",m[m.QUERY_TOKEN_NORMAL_MATCH=137]="QUERY_TOKEN_NORMAL_MATCH",m[m.QUERY_TOKEN_NORMAL_PREFIX_MATCH=138]="QUERY_TOKEN_NORMAL_PREFIX_MATCH",m[m.QUERY_HISTORY_AGE_DECAY_30D=282]="QUERY_HISTORY_AGE_DECAY_30D",m[m.QUERY_HISTORY_LOG_INDEX=283]="QUERY_HISTORY_LOG_INDEX",m[m.FILTER_USER_IS_ACTIVE=114]="FILTER_USER_IS_ACTIVE",m[m.FILTER_USER_IS_CURRENT_USER=115]="FILTER_USER_IS_CURRENT_USER",m[m.FILTER_USER_DM_IS_STARRED=116]="FILTER_USER_DM_IS_STARRED",m[m.FILTER_USER_DM_IS_UNREAD=117]="FILTER_USER_DM_IS_UNREAD",m[m.FILTER_USER_DM_READ_AGE_DECAY_7D=118]="FILTER_USER_DM_READ_AGE_DECAY_7D",m[m.FILTER_USER_DM_READ_AGE_DECAY_2H=119]="FILTER_USER_DM_READ_AGE_DECAY_2H",m[m.FILTER_USER_DM_LATEST_MSG_AGE_DECAY_7D=120]="FILTER_USER_DM_LATEST_MSG_AGE_DECAY_7D",m[m.FILTER_USER_DM_LATEST_MSG_AGE_DECAY_2H=121]="FILTER_USER_DM_LATEST_MSG_AGE_DECAY_2H",m[m.FILTER_USER_FIRST_NAME_NORMAL_MATCH=122]="FILTER_USER_FIRST_NAME_NORMAL_MATCH",m[m.FILTER_USER_FIRST_NAME_NORMAL_PREFIX_MATCH=123]="FILTER_USER_FIRST_NAME_NORMAL_PREFIX_MATCH",m[m.FILTER_USER_LAST_NAME_NORMAL_MATCH=124]="FILTER_USER_LAST_NAME_NORMAL_MATCH",m[m.FILTER_USER_LAST_NAME_NORMAL_PREFIX_MATCH=125]="FILTER_USER_LAST_NAME_NORMAL_PREFIX_MATCH",m[m.FILTER_USER_PRIORITY=126]="FILTER_USER_PRIORITY",m[m.FILTER_CHANNEL_IS_ARCHIVED=139]="FILTER_CHANNEL_IS_ARCHIVED",m[m.FILTER_CHANNEL_IS_MEMBER=140]="FILTER_CHANNEL_IS_MEMBER",m[m.FILTER_CHANNEL_IS_STARRED=141]="FILTER_CHANNEL_IS_STARRED",m[m.FILTER_CHANNEL_IS_UNREAD=142]="FILTER_CHANNEL_IS_UNREAD",m[m.FILTER_CHANNEL_READ_AGE_DECAY_7D=143]="FILTER_CHANNEL_READ_AGE_DECAY_7D",m[m.FILTER_CHANNEL_READ_AGE_DECAY_2H=144]="FILTER_CHANNEL_READ_AGE_DECAY_2H",m[m.FILTER_CHANNEL_PRIORITY=145]="FILTER_CHANNEL_PRIORITY",m[m.USER_ENTITY_TYPE_CTR_30DD=191]="USER_ENTITY_TYPE_CTR_30DD",m[m.NUM_RESULTS=192]="NUM_RESULTS",m[m.TYPE_NAVIGATION_FILE=3]="TYPE_NAVIGATION_FILE",m[m.FILE_AGE_DECAY_7D=195]="FILE_AGE_DECAY_7D",m[m.FILE_AGE_DECAY_28D=196]="FILE_AGE_DECAY_28D",m[m.FILE_AGE_DECAY_90D=197]="FILE_AGE_DECAY_90D",m[m.FILE_FROM_CURRENT_USER=198]="FILE_FROM_CURRENT_USER",m[m.FILE_LOG_PRIVATE_SHARES=200]="FILE_LOG_PRIVATE_SHARES",m[m.FILE_LOG_PUBLIC_SHARES=201]="FILE_LOG_PUBLIC_SHARES",m[m.FILE_LOG_ACTIONS=202]="FILE_LOG_ACTIONS",m[m.FILE_LATEST_ACTION_AGE_DECAY_2H=203]="FILE_LATEST_ACTION_AGE_DECAY_2H",m[m.FILE_LATEST_ACTION_AGE_DECAY_7D=204]="FILE_LATEST_ACTION_AGE_DECAY_7D",m[m.FILE_LATEST_ACTION_AGE_DECAY_90D=205]="FILE_LATEST_ACTION_AGE_DECAY_90D",m[m.FILE_LATEST_SHARE_AGE_DECAY_2H=206]="FILE_LATEST_SHARE_AGE_DECAY_2H",m[m.FILE_LATEST_SHARE_AGE_DECAY_7D=207]="FILE_LATEST_SHARE_AGE_DECAY_7D",m[m.FILE_LATEST_SHARE_AGE_DECAY_90D=208]="FILE_LATEST_SHARE_AGE_DECAY_90D",m[m.FILE_CHANNEL_CTR=209]="FILE_CHANNEL_CTR",m[m.FILE_SUGGESTIONS_SEARCHER=210]="FILE_SUGGESTIONS_SEARCHER",m[m.FILE_USER_CTR=211]="FILE_USER_CTR",m[m.FILE_NAME_CONTAINS_QUERY_NORMALIZED=273]="FILE_NAME_CONTAINS_QUERY_NORMALIZED",m[m.FILE_IS_CANVAS=276]="FILE_IS_CANVAS",m[m.FILE_HAS_DMS_WITH_CREATOR=277]="FILE_HAS_DMS_WITH_CREATOR",m[m.FILE_LATEST_VIEW_BY_USER_OLDER_90D=278]="FILE_LATEST_VIEW_BY_USER_OLDER_90D",m[m.FILE_HAS_DMS_WITH_CREATOR_V2=290]="FILE_HAS_DMS_WITH_CREATOR_V2",m[m.FILE_IS_SFDC_LIST=309]="FILE_IS_SFDC_LIST",m[m.APP_NAME_PREFIX_MATCH=215]="APP_NAME_PREFIX_MATCH",m[m.BEST_NAME_MATCH_LOG_RESULTS=218]="BEST_NAME_MATCH_LOG_RESULTS",m[m.SHORTCUT_ENTITY_TYPE_CTR=226]="SHORTCUT_ENTITY_TYPE_CTR",m[m.TYPE_SLASH_COMMAND=212]="TYPE_SLASH_COMMAND",m[m.SLASH_COMMAND_TEAM_CTR=227]="SLASH_COMMAND_TEAM_CTR",m[m.SLASH_COMMAND_USER_CTR=219]="SLASH_COMMAND_USER_CTR",m[m.TYPE_GLOBAL_ACTION=213]="TYPE_GLOBAL_ACTION",m[m.IS_INVITE_WORKSPACE=217]="IS_INVITE_WORKSPACE",m[m.GLOBAL_ACTION_TEAM_CTR=220]="GLOBAL_ACTION_TEAM_CTR",m[m.GLOBAL_ACTION_USER_CTR=221]="GLOBAL_ACTION_USER_CTR",m[m.TYPE_CHANNEL_ACTION=214]="TYPE_CHANNEL_ACTION",m[m.CHANNEL_ACTION_TEAM_CTR=222]="CHANNEL_ACTION_TEAM_CTR",m[m.CHANNEL_ACTION_USER_CTR=223]="CHANNEL_ACTION_USER_CTR",m[m.TYPE_APP_ACTION=152]="TYPE_APP_ACTION",m[m.APP_ACTION_TEAM_CTR=224]="APP_ACTION_TEAM_CTR",m[m.APP_ACTION_USER_CTR=225]="APP_ACTION_USER_CTR",m[m.OS_APP_ACTION=228]="OS_APP_ACTION",m[m.TYPE_APP=216]="TYPE_APP",m[m.TYPE_NAVIGATION_MESSAGE=255]="TYPE_NAVIGATION_MESSAGE",m[m.TYPE_WORKFLOW_TRIGGER=256]="TYPE_WORKFLOW_TRIGGER",m[m.WORKFLOW_TRIGGER_TEAM_CTR=279]="WORKFLOW_TRIGGER_TEAM_CTR",m[m.WORKFLOW_TRIGGER_USER_CTR=280]="WORKFLOW_TRIGGER_USER_CTR",m[m.HAS_CHANNEL_ASSOCIATION=281]="HAS_CHANNEL_ASSOCIATION",m[m.DEPRECATED_QUERY_SUGGESTION_SCORE=1]="DEPRECATED_QUERY_SUGGESTION_SCORE",m[m.DEPRECATED_TYPE_NAVIGATION_EXPERT_CHANNEL=29]="DEPRECATED_TYPE_NAVIGATION_EXPERT_CHANNEL",m[m.DEPRECATED_BM25_SCORE=30]="DEPRECATED_BM25_SCORE",m[m.DEPRECATED_NAV_EXCESS_STRING_LENGTH=34]="DEPRECATED_NAV_EXCESS_STRING_LENGTH",m[m.DEPRECATED_CHANNEL_EXCESS_STRING_LENGTH=58]="DEPRECATED_CHANNEL_EXCESS_STRING_LENGTH",m[m.DEPRECATED_USER_EXCESS_STRING_LENGTH=59]="DEPRECATED_USER_EXCESS_STRING_LENGTH",m[m.DEPRECATED_MPIM_EXCESS_STRING_LENGTH=60]="DEPRECATED_MPIM_EXCESS_STRING_LENGTH",m[m.DEPRECATED_LOG_FRECENCY=67]="DEPRECATED_LOG_FRECENCY",m[m.DEPRECATED_LOG_FRECENCY_BONUS=77]="DEPRECATED_LOG_FRECENCY_BONUS",m[m.DEPRECATED_LOG_FRECENCY_CHANNEL=78]="DEPRECATED_LOG_FRECENCY_CHANNEL",m[m.DEPRECATED_LOG_FRECENCY_USER=79]="DEPRECATED_LOG_FRECENCY_USER",m[m.DEPRECATED_LOG_FRECENCY_MPIM=80]="DEPRECATED_LOG_FRECENCY_MPIM",m[m.DEPRECATED_EMOJI_SCORE_BONUS=135]="DEPRECATED_EMOJI_SCORE_BONUS",m[m.TEST_FEATURE_1=1e3]="TEST_FEATURE_1",m[m.TEST_FEATURE_2=1001]="TEST_FEATURE_2",m[m.TEST_FEATURE_3=1002]="TEST_FEATURE_3",m[m.TEST_FEATURE_4=1003]="TEST_FEATURE_4",m[m.TEST_FEATURE_5=1004]="TEST_FEATURE_5",m[m.TEST_FEATURE_6=1005]="TEST_FEATURE_6",m[m.TEST_FEATURE_7=1006]="TEST_FEATURE_7",m[m.TEST_FEATURE_8=1007]="TEST_FEATURE_8",m[m.TEST_FEATURE_9=1008]="TEST_FEATURE_9",m[m.TEST_FEATURE_10=1009]="TEST_FEATURE_10",m),I=((_={})[_.NUMERICAL=1]="NUMERICAL",_[_.BINARY=2]="BINARY",_[_.TEXT=3]="TEXT",_)},0x21fa18925:(o,p,f)=>{"use strict";f.d(p,{i1:()=>I});var m=f(0x15ee65f83),_=f(0x13ffa45d4);let w=(0,m.w)("ChVjYWxscy9hbmFseXRpY3MucHJvdG8SFXNsYWNrLmNhbGxzLmFuYWx5dGljcyLDBQoJUmVjdk1lZGlhEg4KBnBlZXJJZBgBIAEoBBIVCg1ieXRlc1JlY2VpdmVkGAIgASgEEhcKD3BhY2tldHNSZWNlaXZlZBgDIAEoBBIUCgxmcmFjdGlvbkxvc3QYBCABKAESDgoGaml0dGVyGAUgASgBEhMKC3BhY2tldHNMb3N0GAYgASgEEisKBWNvZGVjGAcgASgOMhwuc2xhY2suY2FsbHMuYW5hbHl0aWNzLkNvZGVjEg4KBnVzZXJJZBgKIAEoCRIUCgxwZWVySWRTdHJpbmcYCyABKAkSPAoKYXVkaW9TdGF0cxgIIAEoCzImLnNsYWNrLmNhbGxzLmFuYWx5dGljcy5SZWN2TWVkaWEuQXVkaW9IABI8Cgp2aWRlb1N0YXRzGAkgASgLMiYuc2xhY2suY2FsbHMuYW5hbHl0aWNzLlJlY3ZNZWRpYS5WaWRlb0gAGmsKBUF1ZGlvEhIKCmF1ZGlvTGV2ZWwYASABKAESGQoRaml0dGVyQnVmZmVyRGVsYXkYAiABKAESGQoRY29uY2VhbG1lbnRFdmVudHMYAyABKAQSGAoQY29uY2VhbGVkU2FtcGxlcxgEIAEoBBrxAQoFVmlkZW8SEAoIZmlyQ291bnQYASABKAQSEQoJbmFja0NvdW50GAIgASgEEhAKCHBsaUNvdW50GAMgASgEEhAKCHNsaUNvdW50GAQgASgEEhMKC2ZyYW1lSGVpZ2h0GAUgASgEEhIKCmZyYW1lV2lkdGgYBiABKAQSFwoPZnJhbWVzUGVyU2Vjb25kGAcgASgBEhcKD2ZyYW1lc0NvcnJ1cHRlZBgIIAEoBBIVCg1mcmFtZXNEZWNvZGVkGAkgASgEEhUKDWZyYW1lc0Ryb3BwZWQYCiABKAQSFgoOZnJhbWVzUmVjZWl2ZWQYCyABKARCCwoJbWVkaWFUeXBlIq8ECglTZW5kTWVkaWESDgoGcGVlcklkGAEgASgEEhEKCWJ5dGVzU2VudBgCIAEoBBITCgtwYWNrZXRzU2VudBgDIAEoBBIrCgVjb2RlYxgEIAEoDjIcLnNsYWNrLmNhbGxzLmFuYWx5dGljcy5Db2RlYxIUCgxwZWVySWRTdHJpbmcYByABKAkSPAoKYXVkaW9TdGF0cxgFIAEoCzImLnNsYWNrLmNhbGxzLmFuYWx5dGljcy5TZW5kTWVkaWEuQXVkaW9IABI8Cgp2aWRlb1N0YXRzGAYgASgLMiYuc2xhY2suY2FsbHMuYW5hbHl0aWNzLlNlbmRNZWRpYS5WaWRlb0gAGo4BCgVBdWRpbxISCgphdWRpb0xldmVsGAEgASgBEhYKDmVjaG9SZXR1cm5Mb3NzGAIgASgBEiEKGWVjaG9SZXR1cm5Mb3NzRW5oYW5jZW1lbnQYAyABKAESGAoQdG90YWxBdWRpb0VuZXJneRgEIAEoARIcChR0b3RhbFNhbXBsZXNEdXJhdGlvbhgFIAEoARqMAQoFVmlkZW8SEwoLZnJhbWVIZWlnaHQYASABKAQSEgoKZnJhbWVXaWR0aBgCIAEoBBIXCg9mcmFtZXNQZXJTZWNvbmQYAyABKAESEgoKZnJhbWVzU2VudBgEIAEoBBIVCg1mcmFtZXNFbmNvZGVkGAUgASgEEhYKDmh1Z2VGcmFtZXNTZW50GAYgASgEQgsKCW1lZGlhVHlwZSJACgpNZW1vcnlJbmZvEhYKDndvcmtpbmdTZXRTaXplGAEgASgBEhoKEnBlYWtXb3JraW5nU2V0U2l6ZRgCIAEoASJMCgpBcHBNZXRyaWNzEgsKA2NwdRgBIAEoARIxCgZtZW1vcnkYAiABKAsyIS5zbGFjay5jYWxscy5hbmFseXRpY3MuTWVtb3J5SW5mbyLLAwoGUmVwb3J0EhYKDnRvdGFsQnl0ZXNTZW50GAEgASgEEhoKEnRvdGFsQnl0ZXNSZWNlaXZlZBgCIAEoBBIaChJ0b3RhbFJvdW5kVHJpcFRpbWUYAyABKAESHAoUY3VycmVudFJvdW5kVHJpcFRpbWUYBCABKAESIAoYYXZhaWxhYmxlT3V0Z29pbmdCaXRyYXRlGAUgASgEEjEKCHByb3RvY29sGAYgASgOMh8uc2xhY2suY2FsbHMuYW5hbHl0aWNzLlByb3RvY29sEjEKCHBhdGhUeXBlGAcgASgOMh8uc2xhY2suY2FsbHMuYW5hbHl0aWNzLlBhdGhUeXBlEi4KBHJlY3YYCCADKAsyIC5zbGFjay5jYWxscy5hbmFseXRpY3MuUmVjdk1lZGlhEi4KBHNlbmQYCSADKAsyIC5zbGFjay5jYWxscy5hbmFseXRpY3MuU2VuZE1lZGlhEhIKCmNsaWVudFRpbWUYCiABKAQSIAoYYXZhaWxhYmxlSW5jb21pbmdCaXRyYXRlGAsgASgEEjUKCmFwcE1ldHJpY3MYDCABKAsyIS5zbGFjay5jYWxscy5hbmFseXRpY3MuQXBwTWV0cmljcyo6CgVDb2RlYxILCgdVTktOT1dOEAASCAoET1BVUxABEgcKA1ZQOBACEgcKA1ZQORADEggKBEgyNjQQBCocCghQcm90b2NvbBIHCgNVRFAQABIHCgNUQ1AQASohCghQYXRoVHlwZRIKCgZESVJFQ1QQABIJCgVSRUxBWRABYgZwcm90bzM"),I=(0,_.Z)(w,3)},0x4a33e69:(o,p,f)=>{"use strict";f.d(p,{Ae:()=>O,Om:()=>U,Q7:()=>B,VG:()=>Z,br:()=>ee,e$:()=>q,e4:()=>L,lP:()=>x,xD:()=>$});var m,_,w,I=f(0x15ee65f83),k=f(0x13ffa45d4);let M=(0,I.w)("Ch9jYWxscy9jbGllbnQvcGVlcl9tZXNzYWdlLnByb3RvIqoOCgtQZWVyTWVzc2FnZRIjCgZyZWFjamkYASABKAsyEy5QZWVyTWVzc2FnZS5SZWFjamkSHwoEZHJhdxgCIAEoCzIRLlBlZXJNZXNzYWdlLkRyYXcSEgoKZnJvbVBlZXJJZBgDIAEoBBIYChBmcm9tUGVlcklkU3RyaW5nGAQgASgJEi8KDGNhcGFiaWxpdGllcxgFIAEoCzIZLlBlZXJNZXNzYWdlLkNhcGFiaWxpdGllcxIrCgpiYWNrZ3JvdW5kGAYgASgLMhcuUGVlck1lc3NhZ2UuQmFja2dyb3VuZBItCgttdXRlUmVxdWVzdBgKIAEoCzIYLlBlZXJNZXNzYWdlLk11dGVSZXF1ZXN0EjsKEmF3YXJlbmVzc0Jyb2FkY2FzdBgLIAEoCzIfLlBlZXJNZXNzYWdlLkF3YXJlbmVzc0Jyb2FkY2FzdBIzCg5hd2FyZW5lc3NRdWVyeRgMIAEoCzIbLlBlZXJNZXNzYWdlLkF3YXJlbmVzc1F1ZXJ5EjMKDmF3YXJlbmVzc0Nsb3NlGA0gASgLMhsuUGVlck1lc3NhZ2UuQXdhcmVuZXNzQ2xvc2USMwoOanVrZWJveFJlcXVlc3QYDiABKAsyGy5QZWVyTWVzc2FnZS5KdWtlYm94UmVxdWVzdBI9ChNjb250ZW50U2hhcmVEZXRhaWxzGA8gASgLMiAuUGVlck1lc3NhZ2UuQ29udGVudFNoYXJlRGV0YWlscxJLChpyZWNvcmRpbmdTdGFydE5vdGlmaWNhdGlvbhgQIAEoCzInLlBlZXJNZXNzYWdlLlJlY29yZGluZ1N0YXJ0Tm90aWZpY2F0aW9uGpcBCgZSZWFjamkSDQoFZW1vamkYASABKAkSJgoEdHlwZRgCIAEoDjIYLlBlZXJNZXNzYWdlLlJlYWNqaS5UeXBlEhAKCGVtb2ppVXJsGAMgASgJIkQKBFR5cGUSGQoVVW5rbm93bl9yZWFjdGlvbl90eXBlEAASCgoGRWZmZWN0EAESDAoIU3RhbmRhcmQQAhIHCgNHaWYQAxodCgVQb2ludBIJCgF4GAEgASgBEgkKAXkYAiABKAEahQEKB1NlZ21lbnQSHQoBYRgBIAEoCzISLlBlZXJNZXNzYWdlLlBvaW50Eh0KAWIYAiABKAsyEi5QZWVyTWVzc2FnZS5Qb2ludBIdCgFjGAMgASgLMhIuUGVlck1lc3NhZ2UuUG9pbnQSHQoBZBgEIAEoCzISLlBlZXJNZXNzYWdlLlBvaW50Gt8BCgREcmF3EiQKBHR5cGUYASABKA4yFi5QZWVyTWVzc2FnZS5EcmF3LlR5cGUSJQoHc2VnbWVudBgCIAEoCzIULlBlZXJNZXNzYWdlLlNlZ21lbnQSCwoDaHVlGAMgASgFEg4KBml0ZW1JZBgEIAEoCRIJCgF4GAUgASgBEgkKAXkYBiABKAEiVwoEVHlwZRIVChFVTktOT1dOX0RSQVdfVFlQRRAAEgcKA05FVxABEggKBEVESVQQAhIHCgNFTkQQAxIOCgpDSEFOR0VfSFVFEAQSDAoIUE9TSVRJT04QBRolCgxDYXBhYmlsaXRpZXMSFQoNaXNEcmF3RW5hYmxlZBgBIAEoCBo5ChNDb250ZW50U2hhcmVEZXRhaWxzEhIKCnNvdXJjZVR5cGUYASABKAkSDgoGaXRlbUlkGAIgASgJGhkKCkJhY2tncm91bmQSCwoDdXJsGAEgASgJGh0KC011dGVSZXF1ZXN0Eg4KBnBlZXJJZBgBIAEoCRovCg5KdWtlYm94UmVxdWVzdBIPCgdzb25nS2V5GAEgASgJEgwKBHN0b3AYAiABKAgafwoaUmVjb3JkaW5nU3RhcnROb3RpZmljYXRpb24SOgoEdHlwZRgBIAEoDjIsLlBlZXJNZXNzYWdlLlJlY29yZGluZ1N0YXJ0Tm90aWZpY2F0aW9uLlR5cGUiJQoEVHlwZRIQCgxVTktOT1dOX1RZUEUQABILCgdTVU1NQVJZEAEacwoQQXdhcmVuZXNzUGF5bG9hZBISCgpmaWVsZF9uYW1lGAEgASgJEhMKC2ZpZWxkX3ZhbHVlGAIgASgJEh8KEmZpZWxkX3RpbWVzdGFtcF9tcxgDIAEoA0gAiAEBQhUKE19maWVsZF90aW1lc3RhbXBfbXMaagoSQXdhcmVuZXNzQnJvYWRjYXN0Eg8KB2NoYW5uZWwYASABKAkSDAoEdXNlchgCIAEoCRI1Cg5hd2FyZW5lc3NTdGF0ZRgDIAMoCzIdLlBlZXJNZXNzYWdlLkF3YXJlbmVzc1BheWxvYWQaLwoOQXdhcmVuZXNzUXVlcnkSDwoHY2hhbm5lbBgBIAEoCRIMCgR1c2VyGAIgASgJGi8KDkF3YXJlbmVzc0Nsb3NlEg8KB2NoYW5uZWwYASABKAkSDAoEdXNlchgCIAEoCWIGcHJvdG8z"),x=(0,k.Z)(M,0);var O=((m={})[m.Unknown_reaction_type=0]="Unknown_reaction_type",m[m.Effect=1]="Effect",m[m.Standard=2]="Standard",m[m.Gif=3]="Gif",m);let L=(0,k.Z)(M,0,3);var B=((_={})[_.UNKNOWN_DRAW_TYPE=0]="UNKNOWN_DRAW_TYPE",_[_.NEW=1]="NEW",_[_.EDIT=2]="EDIT",_[_.END=3]="END",_[_.CHANGE_HUE=4]="CHANGE_HUE",_[_.POSITION=5]="POSITION",_),U=((w={})[w.UNKNOWN_TYPE=0]="UNKNOWN_TYPE",w[w.SUMMARY=1]="SUMMARY",w);let $=(0,k.Z)(M,0,10),q=(0,k.Z)(M,0,11),Z=(0,k.Z)(M,0,12),ee=(0,k.Z)(M,0,13)},0x11d924e73:(o,p,f)=>{"use strict";f.d(p,{j:()=>m});let m={Active:"active",Eligible:"eligible"}},0xff3799b7:(o,p,f)=>{"use strict";f.d(p,{X:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("activity.feed generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"activity.feed",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to activity.feed
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"activityFeedFetcher",key:"createFetcherActivityFeedFetcher",description:"activity.feed generated fetcher"}},0x20dc45706:(o,p,f)=>{"use strict";f.d(p,{h:()=>x,u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={QueryFailed:"query_failed",InvalidInput:"invalid_input",QueryIncomplete:"query_incomplete",UnauthorizedEnv:"unauthorized_env"},x=(0,w.A)("analytics.clogData generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"analytics.clogData",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to analytics.clogData
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"analyticsClogDataFetcher",key:"createFetcherAnalyticsClogDataFetcher",description:"analytics.clogData generated fetcher"}},0x14444f66c:(o,p,f)=>{"use strict";f.d(p,{O:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("connectInvites.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"connectInvites.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to connectInvites.list
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"connectInvitesListFetcher",key:"createFetcherConnectInvitesListFetcher",description:"connectInvites.list generated fetcher"}},0xadf93c56:(o,p,f)=>{"use strict";f.d(p,{T:()=>M,W:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={ChannelConversionInProgress:"channel_conversion_in_progress",ConnectionLimitExceeded:"connection_limit_exceeded",EmailDoesNotMatch:"email_does_not_match",FailedToStartTrial:"failed_to_start_trial",HasAlreadyConnectedToOrg:"has_already_connected_to_org",InvalidArguments:"invalid_arguments",InvalidEmojiNotAllowed:"invalid_emoji_not_allowed",InvalidHostTeam:"invalid_host_team",InvalidLink:"invalid_link",InvalidName:"invalid_name",InvalidNameMaxlength:"invalid_name_maxlength",InvalidNamePunctuation:"invalid_name_punctuation",InvalidNameRequired:"invalid_name_required",InvalidNameSpecials:"invalid_name_specials",InviteFromSameOrg:"invite_from_same_org",InviteNotFound:"invite_not_found",InvalidPrivacy:"invalid_privacy",InvalidRecipientTeam:"invalid_recipient_team",InvalidTargetTeam:"invalid_target_team",InviteUsed:"invite_used",IsPendingConnectedToOrg:"is_pending_connected_to_org",LegacyConnectionInvalidOrg:"legacy_connection_invalid_org",LegacyConnectionLimitExceeded:"legacy_connection_limit_exceeded",NameTaken:"name_taken",NotAllowedForGridWorkspace:"not_allowed_for_grid_workspace",NotPaid:"not_paid",RestrictedAction:"restricted_action",TeamNotFound:"team_not_found",UserCannotCreateChannel:"user_cannot_create_channel",UserIsRestricted:"user_is_restricted",UserNotFound:"user_not_found",UserRequiredToAcceptAsPrivateButCannot:"user_required_to_accept_as_private_but_cannot"},x=(0,w.A)("conversations.acceptSharedInvite generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.acceptSharedInvite",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.acceptSharedInvite
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"conversationsAcceptSharedInviteFetcher",key:"createFetcherConversationsAcceptSharedInviteFetcher",description:"conversations.acceptSharedInvite generated fetcher"}},0x164b95e6a:(o,p,f)=>{"use strict";f.d(p,{_:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("conversations.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.info",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.info
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"conversationsInfoFetcher",key:"createFetcherConversationsInfoFetcher",description:"conversations.info generated fetcher"}},0x8c156709:(o,p,f)=>{"use strict";f.d(p,{U:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("conversations.listPrefs generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.listPrefs",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.listPrefs
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"conversationsListPrefsFetcher",key:"createFetcherConversationsListPrefsFetcher",description:"conversations.listPrefs generated fetcher"}},0x1dc28e3a1:(o,p,f)=>{"use strict";f.d(p,{Sv:()=>M,a0:()=>O,jB:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={Unknown:"unknown",UserCannotCreateChannel:"user_cannot_create_channel",IsPendingConnectedToOrg:"is_pending_connected_to_org",HasAlreadyConnectedToOrg:"has_already_connected_to_org",EmailDoesNotMatch:"email_does_not_match",InviteFromSameOrg:"invite_from_same_org",UserIsRestricted:"user_is_restricted",NotAllowedForGridWorkspace:"not_allowed_for_grid_workspace",GridWorkspaceRequired:"grid_workspace_required",RestrictedAction:"restricted_action",ConnectionLimitExceeded:"connection_limit_exceeded",LegacyConnectionLimitExceeded:"legacy_connection_limit_exceeded",LegacyConnectionInvalidOrg:"legacy_connection_invalid_org",UserRequiredToAcceptAsPrivateButCannot:"user_required_to_accept_as_private_but_cannot",NotPaid:"not_paid",UpgradeRequiredButUserCannot:"upgrade_required_but_user_cannot",InvalidRecipientTeam:"invalid_recipient_team"},x={InvalidArguments:"invalid_arguments",InviteNotFound:"invite_not_found",TeamNotFound:"team_not_found",UserNotFound:"user_not_found",DomainClaimed:"domain_claimed"},O=(0,w.A)("conversations.sharedInviteAcceptanceEligibility generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"conversations.sharedInviteAcceptanceEligibility",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to conversations.sharedInviteAcceptanceEligibility
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));O.meta={name:"conversationsSharedInviteAcceptanceEligibilityFetcher",key:"createFetcherConversationsSharedInviteAcceptanceEligibilityFetcher",description:"conversations.sharedInviteAcceptanceEligibility generated fetcher"}},0x1c429b447:(o,p,f)=>{"use strict";f.d(p,{D:()=>x,G:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={FeatureNotEnabled:"feature_not_enabled",InviteNotFound:"invite_not_found",WorkspaceNotFound:"workspace_not_found",OperationNotAllowed:"operation_not_allowed",ExternalWorkspaceLimitReached:"external_workspace_limit_reached",FailedToFetchTermsOfService:"failed_to_fetch_terms_of_service",TermsOfServiceNotAccepted:"terms_of_service_not_accepted",GuestUserNotAllowed:"guest_user_not_allowed",EmailDoesNotMatch:"email_does_not_match",InvalidRecipientTeam:"invalid_recipient_team",DomainClaimed:"domain_claimed",NotPaid:"not_paid"},x=(0,w.A)("externalWorkspaces.invites.accept generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"externalWorkspaces.invites.accept",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to externalWorkspaces.invites.accept
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"externalWorkspacesInvitesAcceptFetcher",key:"createFetcherExternalWorkspacesInvitesAcceptFetcher",description:"externalWorkspaces.invites.accept generated fetcher"}},0xa676c83f:(o,p,f)=>{"use strict";f.d(p,{I:()=>M,l:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={InviteNotFound:"invite_not_found",InviteInvalid:"invite_invalid",RateLimited:"rate_limited",InviteUsed:"invite_used",FailedGeneratingInviteOutput:"failed_generating_invite_output"},x=(0,w.A)("externalWorkspaces.invites.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"externalWorkspaces.invites.info",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to externalWorkspaces.invites.info
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"externalWorkspacesInvitesInfoFetcher",key:"createFetcherExternalWorkspacesInvitesInfoFetcher",description:"externalWorkspaces.invites.info generated fetcher"}},0x87ff5a19:(o,p,f)=>{"use strict";f.d(p,{I:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("help.issues.ticketStats generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"help.issues.ticketStats",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to help.issues.ticketStats
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpIssuesTicketStatsFetcher",key:"createFetcherHelpIssuesTicketStatsFetcher",description:"help.issues.ticketStats generated fetcher"}},0xc20486ad:(o,p,f)=>{"use strict";f.d(p,{l:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("help.productHelpCard.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"help.productHelpCard.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to help.productHelpCard.list
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpProductHelpCardListFetcher",key:"createFetcherHelpProductHelpCardListFetcher",description:"help.productHelpCard.list generated fetcher"}},0x1f1fa752e:(o,p,f)=>{"use strict";f.d(p,{G:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.categories generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.categories",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.categories
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskCategoriesFetcher",key:"createFetcherHelpdeskCategoriesFetcher",description:"helpdesk.categories generated fetcher"}},0x1200f8ad6:(o,p,f)=>{"use strict";f.d(p,{h:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.getSectionsAndArticlesByCategory generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.getSectionsAndArticlesByCategory",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.getSectionsAndArticlesByCategory
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskGetSectionsAndArticlesByCategoryFetcher",key:"createFetcherHelpdeskGetSectionsAndArticlesByCategoryFetcher",description:"helpdesk.getSectionsAndArticlesByCategory generated fetcher"}},0x1257faab2:(o,p,f)=>{"use strict";f.d(p,{a:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("helpdesk.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"helpdesk.get",args:L,abortSignal:M,reason:x,computeToken:!1})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to helpdesk.get
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"helpdeskGetFetcher",key:"createFetcherHelpdeskGetFetcher",description:"helpdesk.get generated fetcher"}},0x14691160d:(o,p,f)=>{"use strict";f.d(p,{z:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("lists.records.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"lists.records.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to lists.records.list
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"listsRecordsListFetcher",key:"createFetcherListsRecordsListFetcher",description:"lists.records.list generated fetcher"}},0x1e1870ede:(o,p,f)=>{"use strict";f.d(p,{u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("megaphone.visualizer.notifications.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"megaphone.visualizer.notifications.get",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to megaphone.visualizer.notifications.get
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"megaphoneVisualizerNotificationsGetFetcher",key:"createFetcherMegaphoneVisualizerNotificationsGetFetcher",description:"megaphone.visualizer.notifications.get generated fetcher"}},0x160dba631:(o,p,f)=>{"use strict";f.d(p,{l:()=>k});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3);let k=(0,w.A)("onboarding.fetch generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:k,reason:M,...x}=f;o((0,_.apiCall)({method:"onboarding.fetch",args:x,abortSignal:k,reason:M})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to onboarding.fetch
with reason ${M} failed, initiated by generated fetcher`),w(o)})}));k.meta={name:"onboardingFetchFetcher",key:"createFetcherOnboardingFetchFetcher",description:"onboarding.fetch generated fetcher"}},0x171e9fa85:(o,p,f)=>{"use strict";f.d(p,{n:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("payments.checkout.config generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"payments.checkout.config",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to payments.checkout.config
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"paymentsCheckoutConfigFetcher",key:"createFetcherPaymentsCheckoutConfigFetcher",description:"payments.checkout.config generated fetcher"}},0x1f0b97483:(o,p,f)=>{"use strict";f.d(p,{b:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("payments.status.get generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"payments.status.get",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to payments.status.get
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"paymentsStatusGetFetcher",key:"createFetcherPaymentsStatusGetFetcher",description:"payments.status.get generated fetcher"}},0x161b73cc3:(o,p,f)=>{"use strict";f.d(p,{T:()=>x,W:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={AlreadyPinned:"already_pinned",BadTimestamp:"bad_timestamp",ChannelNotFound:"channel_not_found",ExternalChannelMigrating:"external_channel_migrating",FileNotFound:"file_not_found",FileNotShared:"file_not_shared",MessageNotFound:"message_not_found",NoItemSpecified:"no_item_specified",NotInChannel:"not_in_channel",NotPinnable:"not_pinnable",RestrictedAction:"restricted_action",TooManyPins:"too_many_pins"},x=(0,w.A)("pins.add generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.add",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.add
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"pinsAddFetcher",key:"createFetcherPinsAddFetcher",description:"pins.add generated fetcher"}},0x1adb11c14:(o,p,f)=>{"use strict";f.d(p,{u:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("pins.list generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.list",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.list
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"pinsListFetcher",key:"createFetcherPinsListFetcher",description:"pins.list generated fetcher"}},0x1bb57acec:(o,p,f)=>{"use strict";f.d(p,{w:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("pins.remove generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"pins.remove",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to pins.remove
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"pinsRemoveFetcher",key:"createFetcherPinsRemoveFetcher",description:"pins.remove generated fetcher"}},0x1930533e1:(o,p,f)=>{"use strict";f.d(p,{Q:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.inviteResponse generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.inviteResponse",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.inviteResponse
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsInviteResponseFetcher",key:"createFetcherRoomsInviteResponseFetcher",description:"rooms.inviteResponse generated fetcher"}},0x22dfce16c:(o,p,f)=>{"use strict";f.d(p,{g:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={InvalidUser:"invalid_user",ChannelNotFound:"channel_not_found",InvalidChannelId:"invalid_channel_id",PermissionDenied:"permission_denied",CannotInviteExternal:"cannot_invite_external",InviteFailed:"invite_failed",HuddleNotFound:"huddle_not_found",TeamNotFound:"team_not_found",MaxPotentialParticipants:"max_potential_participants",RecipientHuddlesDisabled:"recipient_huddles_disabled",FreemiumMaxParticipants:"freemium_max_participants"};(0,w.A)("rooms.notifyMember generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.notifyMember",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.notifyMember
with reason ${x} failed, initiated by generated fetcher`),w(o)})})).meta={name:"roomsNotifyMemberFetcher",key:"createFetcherRoomsNotifyMemberFetcher",description:"rooms.notifyMember generated fetcher"}},0x11becc36f:(o,p,f)=>{"use strict";f.d(p,{i:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.startTranscription generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.startTranscription",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.startTranscription
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsStartTranscriptionFetcher",key:"createFetcherRoomsStartTranscriptionFetcher",description:"rooms.startTranscription generated fetcher"}},0x2317cea27:(o,p,f)=>{"use strict";f.d(p,{W:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("rooms.stopTranscription generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"rooms.stopTranscription",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to rooms.stopTranscription
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"roomsStopTranscriptionFetcher",key:"createFetcherRoomsStopTranscriptionFetcher",description:"rooms.stopTranscription generated fetcher"}},0x173d2b811:(o,p,f)=>{"use strict";f.d(p,{z:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("search.autocomplete.topEngagedFiles generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"search.autocomplete.topEngagedFiles",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to search.autocomplete.topEngagedFiles
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"searchAutocompleteTopEngagedFilesFetcher",key:"createFetcherSearchAutocompleteTopEngagedFilesFetcher",description:"search.autocomplete.topEngagedFiles generated fetcher"}},0x98b79679:(o,p,f)=>{"use strict";f.d(p,{v:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("search.autocomplete.triggers generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"search.autocomplete.triggers",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to search.autocomplete.triggers
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"searchAutocompleteTriggersFetcher",key:"createFetcherSearchAutocompleteTriggersFetcher",description:"search.autocomplete.triggers generated fetcher"}},0xe55c52c1:(o,p,f)=>{"use strict";f.d(p,{Z:()=>x,q:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={MissingArgument:"missing_argument",NotPaid:"not_paid",InvalidLink:"invalid_link",InviteInactive:"invite_inactive",InviteAlreadyUsed:"invite_already_used",InviteNotAllowed:"invite_not_allowed",AcceptNotAllowed:"accept_not_allowed",FeatureDisabled:"feature_disabled",OrgsSevered:"orgs_severed",InternalError:"internal_error",CustomInvitesNotSupported:"custom_invites_not_supported",InvalidRecipientTeam:"invalid_recipient_team",EmailDoesNotMatch:"email_does_not_match",SlackConnectDmNotAllowedOnTeam:"slack_connect_dm_not_allowed_on_team",InviteNotFound:"invite_not_found"},x=(0,w.A)("sharedInvites.accept generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"sharedInvites.accept",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to sharedInvites.accept
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"sharedInvitesAcceptFetcher",key:"createFetcherSharedInvitesAcceptFetcher",description:"sharedInvites.accept generated fetcher"}},0x104b72550:(o,p,f)=>{"use strict";f.d(p,{K:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("team.feature.request generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"team.feature.request",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to team.feature.request
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"teamFeatureRequestFetcher",key:"createFetcherTeamFeatureRequestFetcher",description:"team.feature.request generated fetcher"}},0x23561f5d7:(o,p,f)=>{"use strict";f.d(p,{p:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("teams.trials.info generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"teams.trials.info",args:L,abortSignal:M,reason:x})).then(o=>{m((0,k.XK)(o))}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to teams.trials.info
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"teamsTrialsInfoFetcher",key:"createFetcherTeamsTrialsInfoFetcher",description:"teams.trials.info generated fetcher"}},0x1d2c85d59:(o,p,f)=>{"use strict";f.d(p,{k:()=>M,n:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={BadUsername:"bad_username",CannotUpdateAdminUser:"cannot_update_admin_user",EmailBad:"email_bad",EmailTaken:"email_taken",DisplayNameNotAllowed:"display_name_not_allowed",InvalidNamePunctuation:"invalid_name_punctuation",InvalidNameRequired:"invalid_name_required",InvalidNameSpecials:"invalid_name_specials",InvalidProfile:"invalid_profile",InvalidReservedWord:"invalid_reserved_word",InvalidUser:"invalid_user",LongUsername:"long_username",MustClearBothStatusTextAndStatusEmoji:"must_clear_both_status_text_and_status_emoji",NameNotAllowed:"name_not_allowed",NotAdmin:"not_admin",NotAppAdmin:"not_app_admin",PartialProfileSetFailed:"partial_profile_set_failed",ProfileSetFailed:"profile_set_failed",ProfileStatusSetFailedNotEmojiSyntax:"profile_status_set_failed_not_emoji_syntax",ProfileStatusSetFailedNotValidEmoji:"profile_status_set_failed_not_valid_emoji",ProfileStatusSetFailedWritingExpiration:"profile_status_set_failed_writing_expiration",ReadOnlyProfileField:"read_only_profile_field",ReservedName:"reserved_name",SudoRequired:"sudo_required",TooLong:"too_long",UserNotFound:"user_not_found",UserNotSpecified:"user_not_specified",UserRemovedFromTeam:"user_removed_from_team",UsernameEmpty:"username_empty",UsernameTaken:"username_taken",CannotUpdateStatus:"cannot_update_status",PermissionDenied:"permission_denied",UsernameSame:"username_same",InvalidEmojiNotAllowed:"invalid_emoji_not_allowed",InvalidOooMessage:"invalid_ooo_message",InvalidStartsWithAt:"invalid_starts_with_at"},x=(0,w.A)("users.profile.set generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"users.profile.set",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to users.profile.set
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"usersProfileSetFetcher",key:"createFetcherUsersProfileSetFetcher",description:"users.profile.set generated fetcher"}},0x238e7f805:(o,p,f)=>{"use strict";f.d(p,{B:()=>M});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M=(0,w.A)("workflows.triggers.tripPreCheck generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"workflows.triggers.tripPreCheck",args:L,abortSignal:M,reason:x})).then(o=>{m((0,k.XK)(o))}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to workflows.triggers.tripPreCheck
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));M.meta={name:"workflowsTriggersTripPreCheckFetcher",key:"createFetcherWorkflowsTriggersTripPreCheckFetcher",description:"workflows.triggers.tripPreCheck generated fetcher"}},0x1da389b54:(o,p,f)=>{"use strict";f.d(p,{d:()=>M,e:()=>x});var m=f(0xe874a88a),_=f(0x22a29f141),w=f(0x1dfdeb1c8),I=f(0x1ec68d6a3),k=f(0xe747dd27);let M={UnknownMethod:"unknown_method",AccessDenied:"access_denied",CannotTripNonWorkflowFunction:"cannot_trip_non_workflow_function",InvalidUrl:"invalid_url",InvalidContext:"invalid_context",TriggerNotFound:"trigger_not_found",FunctionNotFound:"function_not_found",ParameterValidationFailed:"parameter_validation_failed",InvalidInteractiveTriggerInputs:"invalid_interactive_trigger_inputs",InvalidTriggerInput:"invalid_trigger_input",WorkflowNotPublished:"workflow_not_published",UnableToFindUserInChannelForTrigger:"unable_to_find_user_in_channel_for_trigger",ProviderNotFound:"provider_not_found",MissingOauthToken:"missing_oauth_token",InvalidChannel:"invalid_channel",InvalidMessage:"invalid_message",InvalidBlockId:"invalid_block_id",InvalidActionId:"invalid_action_id",InputTriggerUrlDoesntMatchButtonTriggerUrl:"input_trigger_url_doesnt_match_button_trigger_url",InvalidSpeedbumpCustomizableInputParameters:"invalid_speedbump_customizable_input_parameters",CommunicationDisabled:"communication_disabled",InvalidTriggerType:"invalid_trigger_type",NotOptedIntoOverages:"not_opted_into_overages",ReachedUpperSpendLimit:"reached_upper_spend_limit",FreeTeamNotAllowed:"free_team_not_allowed",PretripAckRequired:"pretrip_ack_required"},x=(0,w.A)("workflows.triggers.trip generated fetcher",(o,p,f)=>new m.S((m,w)=>{let{abortSignal:M,reason:x,...O}=f,L=(0,k.VA)(O);o((0,_.apiCall)({method:"workflows.triggers.trip",args:L,abortSignal:M,reason:x})).then(o=>{m(o)}).catch(o=>{(0,I.Ay)({getState:p}).error(`API call to workflows.triggers.trip
with reason ${x} failed, initiated by generated fetcher`),w(o)})}));x.meta={name:"workflowsTriggersTripFetcher",key:"createFetcherWorkflowsTriggersTripFetcher",description:"workflows.triggers.trip generated fetcher"}},0xce04fe24:(o,p,f)=>{"use strict";f.d(p,{U:()=>m});let m={AllContent:"all_content",SelectedSources:"selected_sources"}},0x15e7d1996:(o,p,f)=>{"use strict";f.d(p,{k:()=>m});let m={NotPaid:"not_paid",InvalidLink:"invalid_link",InviteInactive:"invite_inactive",InviteAlreadyUsed:"invite_already_used",InviteNotAllowed:"invite_not_allowed",AcceptNotAllowed:"accept_not_allowed",OrgsSevered:"orgs_severed",OrgNotVerified:"org_not_verified",UserIsRestricted:"user_is_restricted",InvalidRecipientTeam:"invalid_recipient_team",EmailDoesNotMatch:"email_does_not_match",Generic:"generic",SlackConnectDmNotAllowedOnTeam:"slack_connect_dm_not_allowed_on_team"}},0x1d9cb8d92:(o,p,f)=>{"use strict";f.d(p,{t:()=>m});let m={PendingApproval:"pending_approval",Approved:"approved",Rejected:"rejected",Expired:"expired"}},0x11bfbac9:(o,p,f)=>{"use strict";f.d(p,{c:()=>m});let m={Sent:"sent",Expired:"expired",Revoked:"revoked",Requested:"requested"}},0xfaf2a52c:(o,p,f)=>{"use strict";f.d(p,{D:()=>m,z:()=>_});let m={Incoming:"incoming",Outgoing:"outgoing"},_={Incoming:"incoming",Outgoing:"outgoing"}},0x23ebbcda7:(o,p,f)=>{"use strict";f.d(p,{k:()=>m});let m={Channel:"channel",Im:"im",Workspace:"workspace"}},0x93c830b7:(o,p,f)=>{"use strict";f.d(p,{S:()=>m});let m={ActionItem:"action_item",LatestUnreadAndActivity:"latest_unread_and_activity",Topic:"topic",SuggestedTopic:"suggested_topic",StalledConversations:"stalled_conversations",FocusTopic:"focus_topic"}},0x510b1d7f:(o,p,f)=>{"use strict";let m;f.r(p),f.d(p,{$Command:()=>Command,AllowNotifications:()=>tq,AssociateChannelFlowCommand:()=>AssociateChannelFlowCommand,BadRequestException:()=>BadRequestException,BatchChannelMembershipsFilterSensitiveLog:()=>BatchChannelMembershipsFilterSensitiveLog,BatchCreateChannelMembershipCommand:()=>BatchCreateChannelMembershipCommand,BatchCreateChannelMembershipResponseFilterSensitiveLog:()=>BatchCreateChannelMembershipResponseFilterSensitiveLog,ChannelAssociatedWithFlowSummaryFilterSensitiveLog:()=>ChannelAssociatedWithFlowSummaryFilterSensitiveLog,ChannelBanFilterSensitiveLog:()=>ChannelBanFilterSensitiveLog,ChannelBanSummaryFilterSensitiveLog:()=>ChannelBanSummaryFilterSensitiveLog,ChannelFilterSensitiveLog:()=>ChannelFilterSensitiveLog,ChannelFlowCallbackCommand:()=>ChannelFlowCallbackCommand,ChannelFlowCallbackRequestFilterSensitiveLog:()=>ChannelFlowCallbackRequestFilterSensitiveLog,ChannelFlowFilterSensitiveLog:()=>ChannelFlowFilterSensitiveLog,ChannelFlowSummaryFilterSensitiveLog:()=>ChannelFlowSummaryFilterSensitiveLog,ChannelMembershipFilterSensitiveLog:()=>ChannelMembershipFilterSensitiveLog,ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog:()=>ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog,ChannelMembershipPreferencesFilterSensitiveLog:()=>ChannelMembershipPreferencesFilterSensitiveLog,ChannelMembershipSummaryFilterSensitiveLog:()=>ChannelMembershipSummaryFilterSensitiveLog,ChannelMembershipType:()=>tJ,ChannelMessageCallbackFilterSensitiveLog:()=>ChannelMessageCallbackFilterSensitiveLog,ChannelMessageFilterSensitiveLog:()=>ChannelMessageFilterSensitiveLog,ChannelMessagePersistenceType:()=>t3,ChannelMessageStatus:()=>t4,ChannelMessageSummaryFilterSensitiveLog:()=>ChannelMessageSummaryFilterSensitiveLog,ChannelMessageType:()=>t5,ChannelMode:()=>tQ,ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog:()=>ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog,ChannelModeratorFilterSensitiveLog:()=>ChannelModeratorFilterSensitiveLog,ChannelModeratorSummaryFilterSensitiveLog:()=>ChannelModeratorSummaryFilterSensitiveLog,ChannelPrivacy:()=>tZ,ChannelSummaryFilterSensitiveLog:()=>ChannelSummaryFilterSensitiveLog,ChimeSDKMessaging:()=>ChimeSDKMessaging,ChimeSDKMessagingClient:()=>ChimeSDKMessagingClient,ChimeSDKMessagingServiceException:()=>ChimeSDKMessagingServiceException,ConflictException:()=>ConflictException,CreateChannelBanCommand:()=>CreateChannelBanCommand,CreateChannelBanResponseFilterSensitiveLog:()=>CreateChannelBanResponseFilterSensitiveLog,CreateChannelCommand:()=>CreateChannelCommand,CreateChannelFlowCommand:()=>CreateChannelFlowCommand,CreateChannelFlowRequestFilterSensitiveLog:()=>CreateChannelFlowRequestFilterSensitiveLog,CreateChannelMembershipCommand:()=>CreateChannelMembershipCommand,CreateChannelMembershipResponseFilterSensitiveLog:()=>CreateChannelMembershipResponseFilterSensitiveLog,CreateChannelModeratorCommand:()=>CreateChannelModeratorCommand,CreateChannelModeratorResponseFilterSensitiveLog:()=>CreateChannelModeratorResponseFilterSensitiveLog,CreateChannelRequestFilterSensitiveLog:()=>CreateChannelRequestFilterSensitiveLog,DeleteChannelBanCommand:()=>DeleteChannelBanCommand,DeleteChannelCommand:()=>DeleteChannelCommand,DeleteChannelFlowCommand:()=>DeleteChannelFlowCommand,DeleteChannelMembershipCommand:()=>DeleteChannelMembershipCommand,DeleteChannelMessageCommand:()=>DeleteChannelMessageCommand,DeleteChannelModeratorCommand:()=>DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand:()=>DeleteMessagingStreamingConfigurationsCommand,DescribeChannelBanCommand:()=>DescribeChannelBanCommand,DescribeChannelBanResponseFilterSensitiveLog:()=>DescribeChannelBanResponseFilterSensitiveLog,DescribeChannelCommand:()=>DescribeChannelCommand,DescribeChannelFlowCommand:()=>DescribeChannelFlowCommand,DescribeChannelFlowResponseFilterSensitiveLog:()=>DescribeChannelFlowResponseFilterSensitiveLog,DescribeChannelMembershipCommand:()=>DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand:()=>DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog:()=>DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog,DescribeChannelMembershipResponseFilterSensitiveLog:()=>DescribeChannelMembershipResponseFilterSensitiveLog,DescribeChannelModeratedByAppInstanceUserCommand:()=>DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog,DescribeChannelModeratorCommand:()=>DescribeChannelModeratorCommand,DescribeChannelModeratorResponseFilterSensitiveLog:()=>DescribeChannelModeratorResponseFilterSensitiveLog,DescribeChannelResponseFilterSensitiveLog:()=>DescribeChannelResponseFilterSensitiveLog,DisassociateChannelFlowCommand:()=>DisassociateChannelFlowCommand,ErrorCode:()=>tY,ExpirationCriterion:()=>tX,FallbackAction:()=>t1,ForbiddenException:()=>ForbiddenException,GetChannelMembershipPreferencesCommand:()=>GetChannelMembershipPreferencesCommand,GetChannelMembershipPreferencesResponseFilterSensitiveLog:()=>GetChannelMembershipPreferencesResponseFilterSensitiveLog,GetChannelMessageCommand:()=>GetChannelMessageCommand,GetChannelMessageResponseFilterSensitiveLog:()=>GetChannelMessageResponseFilterSensitiveLog,GetChannelMessageStatusCommand:()=>GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand:()=>GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand:()=>GetMessagingStreamingConfigurationsCommand,IdentityFilterSensitiveLog:()=>IdentityFilterSensitiveLog,InvocationType:()=>t0,ListChannelBansCommand:()=>ListChannelBansCommand,ListChannelBansRequestFilterSensitiveLog:()=>ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog:()=>ListChannelBansResponseFilterSensitiveLog,ListChannelFlowsCommand:()=>ListChannelFlowsCommand,ListChannelFlowsRequestFilterSensitiveLog:()=>ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog:()=>ListChannelFlowsResponseFilterSensitiveLog,ListChannelMembershipsCommand:()=>ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand:()=>ListChannelMembershipsForAppInstanceUserCommand,ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog:()=>ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog:()=>ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog,ListChannelMembershipsRequestFilterSensitiveLog:()=>ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog:()=>ListChannelMembershipsResponseFilterSensitiveLog,ListChannelMessagesCommand:()=>ListChannelMessagesCommand,ListChannelMessagesRequestFilterSensitiveLog:()=>ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog:()=>ListChannelMessagesResponseFilterSensitiveLog,ListChannelModeratorsCommand:()=>ListChannelModeratorsCommand,ListChannelModeratorsRequestFilterSensitiveLog:()=>ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog:()=>ListChannelModeratorsResponseFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowCommand:()=>ListChannelsAssociatedWithChannelFlowCommand,ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog:()=>ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog:()=>ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog,ListChannelsCommand:()=>ListChannelsCommand,ListChannelsModeratedByAppInstanceUserCommand:()=>ListChannelsModeratedByAppInstanceUserCommand,ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog,ListChannelsRequestFilterSensitiveLog:()=>ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog:()=>ListChannelsResponseFilterSensitiveLog,ListSubChannelsCommand:()=>ListSubChannelsCommand,ListSubChannelsRequestFilterSensitiveLog:()=>ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog:()=>ListSubChannelsResponseFilterSensitiveLog,ListTagsForResourceCommand:()=>ListTagsForResourceCommand,ListTagsForResourceResponseFilterSensitiveLog:()=>ListTagsForResourceResponseFilterSensitiveLog,MessageAttributeValueFilterSensitiveLog:()=>MessageAttributeValueFilterSensitiveLog,MessagingDataType:()=>t6,NotFoundException:()=>NotFoundException,ProcessorFilterSensitiveLog:()=>ProcessorFilterSensitiveLog,PushNotificationConfigurationFilterSensitiveLog:()=>PushNotificationConfigurationFilterSensitiveLog,PushNotificationPreferencesFilterSensitiveLog:()=>PushNotificationPreferencesFilterSensitiveLog,PushNotificationType:()=>t2,PutChannelExpirationSettingsCommand:()=>PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand:()=>PutChannelMembershipPreferencesCommand,PutChannelMembershipPreferencesRequestFilterSensitiveLog:()=>PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog:()=>PutChannelMembershipPreferencesResponseFilterSensitiveLog,PutMessagingStreamingConfigurationsCommand:()=>PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand:()=>RedactChannelMessageCommand,ResourceLimitExceededException:()=>ResourceLimitExceededException,SearchChannelsCommand:()=>SearchChannelsCommand,SearchChannelsRequestFilterSensitiveLog:()=>SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog:()=>SearchChannelsResponseFilterSensitiveLog,SearchFieldKey:()=>t9,SearchFieldOperator:()=>t7,SendChannelMessageCommand:()=>SendChannelMessageCommand,SendChannelMessageRequestFilterSensitiveLog:()=>SendChannelMessageRequestFilterSensitiveLog,ServiceFailureException:()=>ServiceFailureException,ServiceUnavailableException:()=>ServiceUnavailableException,SortOrder:()=>t8,TagFilterSensitiveLog:()=>TagFilterSensitiveLog,TagResourceCommand:()=>TagResourceCommand,TagResourceRequestFilterSensitiveLog:()=>TagResourceRequestFilterSensitiveLog,ThrottledClientException:()=>ThrottledClientException,UnauthorizedClientException:()=>UnauthorizedClientException,UntagResourceCommand:()=>UntagResourceCommand,UntagResourceRequestFilterSensitiveLog:()=>UntagResourceRequestFilterSensitiveLog,UpdateChannelCommand:()=>UpdateChannelCommand,UpdateChannelFlowCommand:()=>UpdateChannelFlowCommand,UpdateChannelFlowRequestFilterSensitiveLog:()=>UpdateChannelFlowRequestFilterSensitiveLog,UpdateChannelMessageCommand:()=>UpdateChannelMessageCommand,UpdateChannelMessageRequestFilterSensitiveLog:()=>UpdateChannelMessageRequestFilterSensitiveLog,UpdateChannelReadMarkerCommand:()=>UpdateChannelReadMarkerCommand,UpdateChannelRequestFilterSensitiveLog:()=>UpdateChannelRequestFilterSensitiveLog,__Client:()=>Client,paginateListChannelBans:()=>iR,paginateListChannelFlows:()=>iO,paginateListChannelMemberships:()=>iL,paginateListChannelMembershipsForAppInstanceUser:()=>iD,paginateListChannelMessages:()=>iN,paginateListChannelModerators:()=>iF,paginateListChannels:()=>iU,paginateListChannelsAssociatedWithChannelFlow:()=>iV,paginateListChannelsModeratedByAppInstanceUser:()=>iB,paginateListSubChannels:()=>ij,paginateSearchChannels:()=>iH}),(et=el||(el={})).HEADER="header",et.QUERY="query",(ei=ed||(ed={})).HEADER="header",ei.QUERY="query",(er=ec||(ec={})).HTTP="http",er.HTTPS="https",(en=eu||(eu={})).MD5="md5",en.CRC32="crc32",en.CRC32C="crc32c",en.SHA1="sha1",en.SHA256="sha256",(eo=eh||(eh={}))[eo.HEADER=0]="HEADER",eo[eo.TRAILER=1]="TRAILER";let _="__smithy_context";(es=ep||(ep={})).PROFILE="profile",es.SSO_SESSION="sso-session",es.SERVICES="services",(ea=ef||(ef={})).HTTP_0_9="http/0.9",ea.HTTP_1_0="http/1.0",ea.TDS_8_0="tds/8.0";let httpRequest_HttpRequest=class httpRequest_HttpRequest{constructor(o){this.method=o.method||"GET",this.hostname=o.hostname||"localhost",this.port=o.port,this.query=o.query||{},this.headers=o.headers||{},this.body=o.body,this.protocol=o.protocol?":"!==o.protocol.slice(-1)?`${o.protocol}:`:o.protocol:"https:",this.path=o.path?"/"!==o.path.charAt(0)?`/${o.path}`:o.path:"/",this.username=o.username,this.password=o.password,this.fragment=o.fragment}static clone(o){let p=new httpRequest_HttpRequest({...o,headers:{...o.headers}});return p.query&&(p.query=cloneQuery(p.query)),p}static isInstance(o){return!!o&&"method"in o&&"protocol"in o&&"hostname"in o&&"path"in o&&"object"==typeof o.query&&"object"==typeof o.headers}clone(){return httpRequest_HttpRequest.clone(this)}};function cloneQuery(o){return Object.keys(o).reduce((p,f)=>{let m=o[f];return{...p,[f]:Array.isArray(m)?[...m]:m}},{})}let HttpResponse=class HttpResponse{constructor(o){this.statusCode=o.statusCode,this.reason=o.reason,this.headers=o.headers||{},this.body=o.body}static isInstance(o){return!!o&&"number"==typeof o.statusCode&&"object"==typeof o.headers}};function resolveHostHeaderConfig(o){return o}let w={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},I={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},k="X-Amzn-Trace-Id",M={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};function resolveUserAgentConfig(o){return{...o,customUserAgent:"string"==typeof o.customUserAgent?[[o.customUserAgent]]:o.customUserAgent}}let EndpointCache=class EndpointCache{constructor({size:o,params:p}){this.data=new Map,this.parameters=[],this.capacity=o??50,p&&(this.parameters=p)}get(o,p){let f=this.hash(o);if(!1===f)return p();if(!this.data.has(f)){if(this.data.size>this.capacity+10){let o=this.data.keys(),p=0;for(;;){let{value:f,done:m}=o.next();if(this.data.delete(f),m||++p>10)break}}this.data.set(f,p())}return this.data.get(f)}size(){return this.data.size}hash(o){let p="",{parameters:f}=this;if(0===f.length)return!1;for(let m of f){let f=String(o[m]??"");if(f.includes("|;"))return!1;p+=f+"|;"}return p}};let x=RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),isIpAddress=o=>x.test(o)||o.startsWith("[")&&o.endsWith("]"),O=RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(o,p=!1)=>{if(!p)return O.test(o);for(let p of o.split("."))if(!isValidHostLabel(p))return!1;return!0},L={},B="endpoints";function toDebugString(o){return"object"!=typeof o||null==o?o:"ref"in o?`$${toDebugString(o.ref)}`:"fn"in o?`${o.fn}(${(o.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(o,null,2)}let EndpointError=class EndpointError extends Error{constructor(o){super(o),this.name="EndpointError"}};let getAttr=(o,p)=>(o=>{let p=o.split("."),f=[];for(let m of p){let p=m.indexOf("[");if(-1!==p){if(m.indexOf("]")!==m.length-1)throw new EndpointError(`Path: '${o}' does not end with ']'`);let _=m.slice(p+1,-1);if(Number.isNaN(parseInt(_)))throw new EndpointError(`Invalid array index: '${_}' in path: '${o}'`);0!==p&&f.push(m.slice(0,p)),f.push(_)}else f.push(m)}return f})(p).reduce((f,m)=>{if("object"!=typeof f)throw new EndpointError(`Index '${m}' in '${p}' not found in '${JSON.stringify(o)}'`);return Array.isArray(f)?f[parseInt(m)]:f[m]},o),U={[ec.HTTP]:80,[ec.HTTPS]:443},$={booleanEquals:(o,p)=>o===p,getAttr:getAttr,isSet:o=>null!=o,isValidHostLabel:isValidHostLabel,not:o=>!o,parseURL:o=>{let p=(()=>{try{if(o instanceof URL)return o;if("object"==typeof o&&"hostname"in o){let{hostname:p,port:f,protocol:m="",path:_="",query:w={}}=o,I=new URL(`${m}//${p}${f?`:${f}`:""}${_}`);return I.search=Object.entries(w).map(([o,p])=>`${o}=${p}`).join("&"),I}return new URL(o)}catch{return null}})();if(!p)return console.error(`Unable to parse ${JSON.stringify(o)} as a whatwg URL.`),null;let f=p.href,{host:m,hostname:_,pathname:w,protocol:I,search:k}=p;if(k)return null;let M=I.slice(0,-1);if(!Object.values(ec).includes(M))return null;let x=isIpAddress(_),O=f.includes(`${m}:${U[M]}`)||"string"==typeof o&&o.includes(`${m}:${U[M]}`),L=`${m}${O?`:${U[M]}`:""}`;return{scheme:M,authority:L,path:w,normalizedPath:w.endsWith("/")?w:`${w}/`,isIp:x}},stringEquals:(o,p)=>o===p,substring:(o,p,f,m)=>p>=f||o.lengthencodeURIComponent(o).replace(/[!*'()]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`)},evaluateTemplate=(o,p)=>{let f=[],m={...p.endpointParams,...p.referenceRecord},_=0;for(;_{if("string"==typeof o)return evaluateTemplate(o,f);if(o.fn)return callFunction(o,f);if(o.ref)return(({ref:o},p)=>({...p.endpointParams,...p.referenceRecord})[o])(o,f);throw new EndpointError(`'${p}': ${String(o)} is not a string, function or reference.`)},callFunction=({fn:o,argv:p},f)=>{let m=p.map(o=>["boolean","number"].includes(typeof o)?o:evaluateExpression(o,"arg",f)),_=o.split(".");return _[0]in L&&null!=_[1]?L[_[0]][_[1]](...m):$[o](...m)},evaluateCondition=({assign:o,...p},f)=>{if(o&&o in f.referenceRecord)throw new EndpointError(`'${o}' is already defined in Reference Record.`);let m=callFunction(p,f);return f.logger?.debug?.(`${B} evaluateCondition: ${toDebugString(p)} = ${toDebugString(m)}`),{result:""===m||!!m,...null!=o&&{toAssign:{name:o,value:m}}}},evaluateConditions=(o=[],p)=>{let f={};for(let m of o){let{result:o,toAssign:_}=evaluateCondition(m,{...p,referenceRecord:{...p.referenceRecord,...f}});if(!o)return{result:o};_&&(f[_.name]=_.value,p.logger?.debug?.(`${B} assign: ${_.name} := ${toDebugString(_.value)}`))}return{result:!0,referenceRecord:f}},getEndpointProperty=(o,p)=>{if(Array.isArray(o))return o.map(o=>getEndpointProperty(o,p));switch(typeof o){case"string":return evaluateTemplate(o,p);case"object":if(null===o)throw new EndpointError(`Unexpected endpoint property: ${o}`);return getEndpointProperties(o,p);case"boolean":return o;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof o}`)}},getEndpointProperties=(o,p)=>Object.entries(o).reduce((o,[f,m])=>({...o,[f]:getEndpointProperty(m,p)}),{}),evaluateEndpointRule=(o,p)=>{let{conditions:f,endpoint:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(!_)return;let I={...p,referenceRecord:{...p.referenceRecord,...w}},{url:k,properties:M,headers:x}=m;return p.logger?.debug?.(`${B} Resolving endpoint from template: ${toDebugString(m)}`),{...void 0!=x&&{headers:Object.entries(x).reduce((o,[p,f])=>({...o,[p]:f.map(o=>{let f=evaluateExpression(o,"Header value entry",I);if("string"!=typeof f)throw new EndpointError(`Header '${p}' value '${f}' is not a string`);return f})}),{})},...void 0!=M&&{properties:getEndpointProperties(M,I)},url:((o,p)=>{let f=evaluateExpression(o,"Endpoint URL",p);if("string"==typeof f)try{return new URL(f)}catch(o){throw console.error(`Failed to construct URL with ${f}`,o),o}throw new EndpointError(`Endpoint URL must be a string, got ${typeof f}`)})(k,I)}},evaluateErrorRule=(o,p)=>{let{conditions:f,error:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(_)throw new EndpointError(evaluateExpression(m,"Error",{...p,referenceRecord:{...p.referenceRecord,...w}}))},evaluateTreeRule=(o,p)=>{let{conditions:f,rules:m}=o,{result:_,referenceRecord:w}=evaluateConditions(f,p);if(_)return evaluateRules(m,{...p,referenceRecord:{...p.referenceRecord,...w}})},evaluateRules=(o,p)=>{for(let f of o)if("endpoint"===f.type){let o=evaluateEndpointRule(f,p);if(o)return o}else if("error"===f.type)evaluateErrorRule(f,p);else if("tree"===f.type){let o=evaluateTreeRule(f,p);if(o)return o}else throw new EndpointError(`Unknown endpoint rule: ${f}`);throw new EndpointError("Rules evaluation failed")},isVirtualHostableS3Bucket=(o,p=!1)=>{if(p){for(let p of o.split("."))if(!isVirtualHostableS3Bucket(p))return!1;return!0}return!(!isValidHostLabel(o)||o.length<3||o.length>63||o!==o.toLowerCase()||isIpAddress(o))};var q,Z,ee,et,ei,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev=f(0x48128888);let eb=f.n(ev)(),ey={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:o=>{let p=o.split(":");if(p.length<6)return null;let[f,m,_,w,I,...k]=p;return"arn"!==f||""===m||""===_||""===k.join(":")?null:{partition:m,service:_,region:w,accountId:I,resourceId:k.map(o=>o.split("/")).flat()}},partition:o=>{let{partitions:p}=eb;for(let f of p){let{regions:p,outputs:m}=f;for(let[f,_]of Object.entries(p))if(f===o)return{...m,..._}}for(let f of p){let{regionRegex:p,outputs:m}=f;if(new RegExp(p).test(o))return{...m}}let f=p.find(o=>"aws"===o.id);if(!f)throw Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...f.outputs}}};L.aws=ey;let e_="user-agent",eC="x-amz-user-agent",eT=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,eE=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,escapeUserAgent=o=>{let p=o[0].split("/").map(o=>o.replace(eT,"-")).join("/"),f=o[1]?.replace(eE,"-"),m=p.indexOf("/"),_=p.substring(0,m),w=p.substring(m+1);return"api"===_&&(w=w.toLowerCase()),[_,w,f].filter(o=>o&&o.length>0).reduce((o,p,f)=>{switch(f){case 0:return p;case 1:return`${o}/${p}`;default:return`${o}#${p}`}},"")},ew={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0};(q=em||(em={})).ENV="env",q.CONFIG="shared config entry";let getSmithyContext=o=>o[_]||(o[_]={}),normalizeProvider_normalizeProvider=o=>{if("function"==typeof o)return o;let p=Promise.resolve(o);return()=>p},isFipsRegion=o=>"string"==typeof o&&(o.startsWith("fips-")||o.endsWith("-fips")),getRealRegion=o=>isFipsRegion(o)?["fips-aws-global","aws-fips"].includes(o)?"us-east-1":o.replace(/fips-(dkr-|prod-)?|-fips/,""):o;function convertHttpAuthSchemesToMap(o){let p=new Map;for(let f of o)p.set(f.schemeId,f);return p}let resolveParamsForS3=async o=>{let p=o?.Bucket||"";if("string"==typeof o.Bucket&&(o.Bucket=p.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(p)){if(!0===o.ForcePathStyle)throw Error("Path-style addressing cannot be used with ARN buckets")}else isDnsCompatibleBucketName(p)&&(-1===p.indexOf(".")||String(o.Endpoint).startsWith("http:"))&&p.toLowerCase()===p&&!(p.length<3)||(o.ForcePathStyle=!0);return o.DisableMultiRegionAccessPoints&&(o.disableMultiRegionAccessPoints=!0,o.DisableMRAP=!0),o},eI=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,eA=/(\d+\.){3}\d+/,ek=/\.\./,isDnsCompatibleBucketName=o=>eI.test(o)&&!eA.test(o)&&!ek.test(o),isArnBucketName=o=>{let[p,f,m,,,_]=o.split(":"),w="arn"===p&&o.split(":").length>=6,I=!!(w&&f&&m&&_);if(w&&!I)throw Error(`Invalid ARN: ${o} was an invalid ARN.`);return I},createConfigValueProvider=(o,p,f)=>{let configProvider=async()=>{let m=f[o]??f[p];return"function"==typeof m?m():m};return"credentialScope"===o||"CredentialScope"===p?async()=>{let o="function"==typeof f.credentials?await f.credentials():f.credentials;return o?.credentialScope??o?.CredentialScope}:"accountId"===o||"AccountId"===p?async()=>{let o="function"==typeof f.credentials?await f.credentials():f.credentials;return o?.accountId??o?.AccountId}:"endpoint"===o||"endpoint"===p?async()=>{let o=await configProvider();if(o&&"object"==typeof o){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:p,hostname:f,port:m,path:_}=o;return`${p}//${f}${m?":"+m:""}${_}`}}return o}:configProvider},getEndpointFromConfig=async o=>void 0;function parseQueryString(o){let p={};if(o=o.replace(/^\?/,""))for(let f of o.split("&")){let[o,m=null]=f.split("=");o=decodeURIComponent(o),m&&(m=decodeURIComponent(m)),o in p?Array.isArray(p[o])?p[o].push(m):p[o]=[p[o],m]:p[o]=m}return p}let parseUrl=o=>{let p;if("string"==typeof o)return parseUrl(new URL(o));let{hostname:f,pathname:m,port:_,protocol:w,search:I}=o;return I&&(p=parseQueryString(I)),{hostname:f,port:_?parseInt(_):void 0,protocol:w,path:m,query:p}},toEndpointV1=o=>"object"==typeof o?"url"in o?parseUrl(o.url):o:parseUrl(o),getEndpointFromInstructions=async(o,p,f,m)=>{if(!f.endpoint){let o;(o=f.serviceConfiguredEndpoint?await f.serviceConfiguredEndpoint():await getEndpointFromConfig(f.serviceId))&&(f.endpoint=()=>Promise.resolve(toEndpointV1(o)))}let _=await resolveParams(o,p,f);if("function"!=typeof f.endpointProvider)throw Error("config.endpointProvider is not set.");return f.endpointProvider(_,m)},resolveParams=async(o,p,f)=>{let m={},_=p?.getEndpointParameterInstructions?.()||{};for(let[p,w]of Object.entries(_))switch(w.type){case"staticContextParams":m[p]=w.value;break;case"contextParams":m[p]=o[w.name];break;case"clientContextParams":case"builtInParams":m[p]=await createConfigValueProvider(w.name,p,f)();break;default:throw Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(w))}return 0===Object.keys(_).length&&Object.assign(m,f),"s3"===String(f.serviceId).toLowerCase()&&await resolveParamsForS3(m),m},eM={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ex={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(o,p,f){return{applyToStack:m=>{m.add(p=>async m=>{let{response:_}=await p(m);try{let p=await f(_,o);return{response:_,output:p}}catch(o){throw Object.defineProperty(o,"$response",{value:_}),"$metadata"in o||(o.message+=`
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`,void 0!==o.$responseBodyText&&o.$response&&(o.$response.body=o.$responseBodyText)),o}},eM),m.add((f,m)=>async _=>{let w=m.endpointV2?.url&&o.urlParser?async()=>o.urlParser(m.endpointV2.url):o.endpoint;if(!w)throw Error("No valid endpoint provider available.");let I=await p(_.input,{...o,endpoint:w});return f({..._,request:I})},ex)}}}let eP={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ex.name},getEndpointPlugin=(o,p)=>({applyToStack:f=>{f.addRelativeTo((({config:o,instructions:p})=>(f,m)=>async _=>{let w=await getEndpointFromInstructions(_.input,{getEndpointParameterInstructions:()=>p},{...o},m);m.endpointV2=w,m.authSchemes=w.properties?.authSchemes;let I=m.authSchemes?.[0];if(I){m.signing_region=I.signingRegion,m.signing_service=I.signingName;let o=getSmithyContext(m),p=o?.selectedHttpAuthScheme?.httpAuthOption;p&&(p.signingProperties=Object.assign(p.signingProperties||{},{signing_region:I.signingRegion,signingRegion:I.signingRegion,signing_service:I.signingName,signingName:I.signingName,signingRegionSet:I.signingRegionSet},I.properties))}return f({..._})})({config:o,instructions:p}),eP)}}),eR={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:eP.name};ex.name,(Z=eg||(eg={})).STANDARD="standard",Z.ADAPTIVE="adaptive";let eO=eg.STANDARD,eD=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],eL=["TimeoutError","RequestTimeout","RequestTimeoutException"],eN=[500,502,503,504],eF=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],isThrottlingError=o=>o.$metadata?.httpStatusCode===429||eD.includes(o.name)||o.$retryable?.throttling==!0,isTransientError=o=>o.$metadata?.clockSkewCorrected||eL.includes(o.name)||eF.includes(o?.code||"")||eN.includes(o.$metadata?.httpStatusCode||0);let DefaultRateLimiter=class DefaultRateLimiter{constructor(o){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=o?.beta??.7,this.minCapacity=o?.minCapacity??1,this.minFillRate=o?.minFillRate??.5,this.scaleConstant=o?.scaleConstant??.4,this.smooth=o?.smooth??.8;const p=this.getCurrentTimeInSeconds();this.lastThrottleTime=p,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(o){if(this.enabled){if(this.refillTokenBucket(),o>this.currentCapacity){let p=(o-this.currentCapacity)/this.fillRate*1e3;await new Promise(o=>setTimeout(o,p))}this.currentCapacity=this.currentCapacity-o}}refillTokenBucket(){let o=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=o;return}let p=(o-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+p),this.lastTimestamp=o}updateClientSendingRate(o){let p;if(this.updateMeasuredRate(),isThrottlingError(o)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),p=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),p=this.cubicSuccess(this.getCurrentTimeInSeconds());let f=Math.min(p,2*this.measuredTxRate);this.updateTokenBucketRate(f)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(o){return this.getPrecise(o*this.beta)}cubicSuccess(o){return this.getPrecise(this.scaleConstant*Math.pow(o-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(o){this.refillTokenBucket(),this.fillRate=Math.max(o,this.minFillRate),this.maxCapacity=Math.max(o,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let o=Math.floor(2*this.getCurrentTimeInSeconds())/2;if(this.requestCount++,o>this.lastTxRateBucket){let p=this.requestCount/(o-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(p*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=o}}getPrecise(o){return parseFloat(o.toFixed(8))}};let createDefaultRetryToken=({retryDelay:o,retryCount:p,retryCost:f})=>({getRetryCount:()=>p,getRetryDelay:()=>Math.min(2e4,o),getRetryCost:()=>f});let StandardRetryStrategy=class StandardRetryStrategy{constructor(o){this.maxAttempts=o,this.mode=eg.STANDARD,this.capacity=500,this.retryBackoffStrategy=(()=>{let o=100;return{computeNextBackoffDelay:p=>Math.floor(Math.min(2e4,Math.random()*2**p*o)),setDelayBase:p=>{o=p}}})(),this.maxAttemptsProvider="function"==typeof o?o:async()=>o}async acquireInitialRetryToken(o){return createDefaultRetryToken({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(o,p){let f=await this.getMaxAttempts();if(this.shouldRetry(o,p,f)){let f=p.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===f?500:100);let m=this.retryBackoffStrategy.computeNextBackoffDelay(o.getRetryCount()),_=p.retryAfterHint?Math.max(p.retryAfterHint.getTime()-Date.now()||0,m):m,w=this.getCapacityCost(f);return this.capacity-=w,createDefaultRetryToken({retryDelay:_,retryCount:o.getRetryCount()+1,retryCost:w})}throw Error("No retry token available")}recordSuccess(o){this.capacity=Math.max(500,this.capacity+(o.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(o,p,f){return o.getRetryCount()+1=this.getCapacityCost(p.errorType)&&this.isRetryableError(p.errorType)}getCapacityCost(o){return"TRANSIENT"===o?10:5}isRetryableError(o){return"THROTTLING"===o||"TRANSIENT"===o}};let AdaptiveRetryStrategy=class AdaptiveRetryStrategy{constructor(o,p){this.maxAttemptsProvider=o,this.mode=eg.ADAPTIVE;const{rateLimiter:f}=p??{};this.rateLimiter=f??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(o)}async acquireInitialRetryToken(o){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(o)}async refreshRetryTokenForRetry(o,p){return this.rateLimiter.updateClientSendingRate(p),this.standardRetryStrategy.refreshRetryTokenForRetry(o,p)}recordSuccess(o){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(o)}};let eV="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eB=new Uint8Array(16);function rng(){if(!m&&!(m="u">typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(eB)}let eU=[];for(let o=0;o<256;++o)eU.push((o+256).toString(16).slice(1));function unsafeStringify(o,p=0){return eU[o[p+0]]+eU[o[p+1]]+eU[o[p+2]]+eU[o[p+3]]+"-"+eU[o[p+4]]+eU[o[p+5]]+"-"+eU[o[p+6]]+eU[o[p+7]]+"-"+eU[o[p+8]]+eU[o[p+9]]+"-"+eU[o[p+10]]+eU[o[p+11]]+eU[o[p+12]]+eU[o[p+13]]+eU[o[p+14]]+eU[o[p+15]]}let esm_browser_v4=function(o,p,f){if(eV&&!p&&!o)return eV();let m=(o=o||{}).random||(o.rng||rng)();if(m[6]=15&m[6]|64,m[8]=63&m[8]|128,p){f=f||0;for(let o=0;o<16;++o)p[f+o]=m[o];return p}return unsafeStringify(m)},asSdkError=o=>o instanceof Error?o:o instanceof Object?Object.assign(Error(),o):"string"==typeof o?Error(o):Error(`AWS SDK error wrapper for ${o}`),getAllAliases=(o,p)=>{let f=[];if(o&&f.push(o),p)for(let o of p)f.push(o);return f},getMiddlewareNameWithAliases=(o,p)=>`${o||"anonymous"}${p&&p.length>0?` (a.k.a. ${p.join(",")})`:""}`,constructStack=()=>{let o=[],p=[],f=!1,m=new Set,cloneTo=f=>(o.forEach(o=>{f.add(o.middleware,{...o})}),p.forEach(o=>{f.addRelativeTo(o.middleware,{...o})}),f.identifyOnResolve?.(_.identifyOnResolve()),f),expandRelativeMiddlewareList=o=>{let p=[];return o.before.forEach(o=>{0===o.before.length&&0===o.after.length?p.push(o):p.push(...expandRelativeMiddlewareList(o))}),p.push(o),o.after.reverse().forEach(o=>{0===o.before.length&&0===o.after.length?p.push(o):p.push(...expandRelativeMiddlewareList(o))}),p},getMiddlewareList=(f=!1)=>{let m=[],_=[],w={};return o.forEach(o=>{let p={...o,before:[],after:[]};for(let o of getAllAliases(p.name,p.aliases))w[o]=p;m.push(p)}),p.forEach(o=>{let p={...o,before:[],after:[]};for(let o of getAllAliases(p.name,p.aliases))w[o]=p;_.push(p)}),_.forEach(o=>{if(o.toMiddleware){let p=w[o.toMiddleware];if(void 0===p){if(f)return;throw Error(`${o.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(o.name,o.aliases)} middleware ${o.relation} ${o.toMiddleware}`)}"after"===o.relation&&p.after.push(o),"before"===o.relation&&p.before.push(o)}}),m.sort((o,p)=>ej[p.step]-ej[o.step]||eH[p.priority||"normal"]-eH[o.priority||"normal"]).map(expandRelativeMiddlewareList).reduce((o,p)=>(o.push(...p),o),[])},_={add:(p,f={})=>{let{name:_,override:w,aliases:I}=f,k={step:"initialize",priority:"normal",middleware:p,...f},M=getAllAliases(_,I);if(M.length>0){if(M.some(o=>m.has(o))){if(!w)throw Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(_,I)}'`);for(let p of M){let f=o.findIndex(o=>o.name===p||o.aliases?.some(o=>o===p));if(-1===f)continue;let m=o[f];if(m.step!==k.step||k.priority!==m.priority)throw Error(`"${getMiddlewareNameWithAliases(m.name,m.aliases)}" middleware with ${m.priority} priority in ${m.step} step cannot be overridden by "${getMiddlewareNameWithAliases(_,I)}" middleware with ${k.priority} priority in ${k.step} step.`);o.splice(f,1)}}for(let o of M)m.add(o)}o.push(k)},addRelativeTo:(o,f)=>{let{name:_,override:w,aliases:I}=f,k={middleware:o,...f},M=getAllAliases(_,I);if(M.length>0){if(M.some(o=>m.has(o))){if(!w)throw Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(_,I)}'`);for(let o of M){let f=p.findIndex(p=>p.name===o||p.aliases?.some(p=>p===o));if(-1===f)continue;let m=p[f];if(m.toMiddleware!==k.toMiddleware||m.relation!==k.relation)throw Error(`"${getMiddlewareNameWithAliases(m.name,m.aliases)}" middleware ${m.relation} "${m.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(_,I)}" middleware ${k.relation} "${k.toMiddleware}" middleware.`);p.splice(f,1)}}for(let o of M)m.add(o)}p.push(k)},clone:()=>cloneTo(constructStack()),use:o=>{o.applyToStack(_)},remove:f=>{let _,w;if("string"==typeof f){let _,w;return _=!1,w=o=>{let p=getAllAliases(o.name,o.aliases);if(p.includes(f)){for(let o of(_=!0,p))m.delete(o);return!1}return!0},o=o.filter(w),p=p.filter(w),_}return _=!1,w=o=>{if(o.middleware===f){for(let p of(_=!0,getAllAliases(o.name,o.aliases)))m.delete(p);return!1}return!0},o=o.filter(w),p=p.filter(w),_},removeByTag:f=>{let _=!1,filterCb=o=>{let{tags:p,name:w,aliases:I}=o;if(p&&p.includes(f)){for(let o of getAllAliases(w,I))m.delete(o);return _=!0,!1}return!0};return o=o.filter(filterCb),p=p.filter(filterCb),_},concat:o=>{let p=cloneTo(constructStack());return p.use(o),p.identifyOnResolve(f||p.identifyOnResolve()||(o.identifyOnResolve?.()??!1)),p},applyToStack:cloneTo,identify:()=>getMiddlewareList(!0).map(o=>{let p=o.step??o.relation+" "+o.toMiddleware;return getMiddlewareNameWithAliases(o.name,o.aliases)+" - "+p}),identifyOnResolve:o=>("boolean"==typeof o&&(f=o),f),resolve:(o,p)=>{for(let f of getMiddlewareList().map(o=>o.middleware).reverse())o=f(o,p);return f&&console.log(_.identify()),o}};return _},ej={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},eH={high:3,normal:2,low:1};let Client=class Client{constructor(o){this.config=o,this.middlewareStack=constructStack()}send(o,p,f){let m,_="function"!=typeof p?p:void 0,w="function"==typeof p?p:f;if(void 0===_&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=new WeakMap);let p=this.handlers;p.has(o.constructor)?m=p.get(o.constructor):(m=o.resolveMiddleware(this.middlewareStack,this.config,_),p.set(o.constructor,m))}else delete this.handlers,m=o.resolveMiddleware(this.middlewareStack,this.config,_);if(!w)return m(o).then(o=>o.output);m(o).then(o=>w(null,o.output),o=>w(o)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};let ez={},eG=Array(64);for(let o=0;o+65<=90;o++){let p=String.fromCharCode(o+65);ez[p]=o,eG[o]=p}for(let o=0;o+97<=122;o++){let p=String.fromCharCode(o+97),f=o+26;ez[p]=f,eG[f]=p}for(let o=0;o<10;o++){ez[o.toString(10)]=o+52;let p=o.toString(10),f=o+52;ez[p]=f,eG[f]=p}ez["+"]=62,eG[62]="+",ez["/"]=63,eG[63]="/";let fromBase64=o=>{let p=o.length/4*3;"=="===o.slice(-2)?p-=2:"="===o.slice(-1)&&p--;let f=new ArrayBuffer(p),m=new DataView(f);for(let p=0;p>=6;let w=p/4*3;f>>=_%8;let I=Math.floor(_/8);for(let o=0;o>p)}}return new Uint8Array(f)},fromUtf8=o=>new TextEncoder().encode(o);function toBase64_browser_toBase64(o){let p,f="object"==typeof(p="string"==typeof o?fromUtf8(o):o)&&"number"==typeof p.length,m="object"==typeof p&&"number"==typeof p.byteOffset&&"number"==typeof p.byteLength;if(!f&&!m)throw Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let _="";for(let o=0;o>p]}_+="==".slice(0,4-w)}return _}let toUtf8_browser_toUtf8=o=>{if("string"==typeof o)return o;if("object"!=typeof o||"number"!=typeof o.byteOffset||"number"!=typeof o.byteLength)throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(o)};function transformToString(o,p="utf-8"){return"base64"===p?toBase64_browser_toBase64(o):toUtf8_browser_toUtf8(o)}function transformFromString(o,p){return"base64"===p?Uint8ArrayBlobAdapter.mutate(fromBase64(o)):Uint8ArrayBlobAdapter.mutate(fromUtf8(o))}let Uint8ArrayBlobAdapter=class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(o,p="utf-8"){if("string"==typeof o)return transformFromString(o,p);throw Error(`Unsupported conversion from ${typeof o} to Uint8ArrayBlobAdapter.`)}static mutate(o){return Object.setPrototypeOf(o,Uint8ArrayBlobAdapter.prototype),o}transformToString(o="utf-8"){return transformToString(this,o)}};let escapeUri=o=>encodeURIComponent(o).replace(/[!'()*]/g,hexEncode),hexEncode=o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString(o){let p=[];for(let f of Object.keys(o).sort()){let m=o[f];if(f=escapeUri(f),Array.isArray(m))for(let o=0,_=m.length;o<_;o++)p.push(`${f}=${escapeUri(m[o])}`);else{let o=f;(m||"string"==typeof m)&&(o+=`=${escapeUri(m)}`),p.push(o)}}return p.join("&")}function requestTimeout(o=0){return new Promise((p,f)=>{o&&setTimeout(()=>{let p=Error(`Request did not complete within ${o} ms`);p.name="TimeoutError",f(p)},o)})}let eW={supported:void 0};let FetchHttpHandler=class FetchHttpHandler{static create(o){return"function"==typeof o?.handle?o:new FetchHttpHandler(o)}constructor(o){"function"==typeof o?this.configProvider=o().then(o=>o||{}):(this.config=o??{},this.configProvider=Promise.resolve(this.config)),void 0===eW.supported&&(eW.supported=!!("u">typeof Request&&"keepalive"in new Request("https://[::1]")))}destroy(){}async handle(o,{abortSignal:p}={}){this.config||(this.config=await this.configProvider);let f=this.config.requestTimeout,m=!0===this.config.keepAlive,_=this.config.credentials;if(p?.aborted){let o=Error("Request aborted");return o.name="AbortError",Promise.reject(o)}let w=o.path,I=buildQueryString(o.query||{});I&&(w+=`?${I}`),o.fragment&&(w+=`#${o.fragment}`);let k="";if(null!=o.username||null!=o.password){let p=o.username??"",f=o.password??"";k=`${p}:${f}@`}let{port:M,method:x}=o,O=`${o.protocol}//${k}${o.hostname}${M?`:${M}`:""}${w}`,L="GET"===x||"HEAD"===x?void 0:o.body,B={body:L,headers:new Headers(o.headers),method:x,credentials:_};this.config?.cache&&(B.cache=this.config.cache),L&&(B.duplex="half"),"u">typeof AbortController&&(B.signal=p),eW.supported&&(B.keepalive=m),"function"==typeof this.config.requestInit&&Object.assign(B,this.config.requestInit(o));let removeSignalEventListener=()=>{},U=[fetch(new Request(O,B)).then(o=>{let p=o.headers,f={};for(let o of p.entries())f[o[0]]=o[1];return void 0==o.body?o.blob().then(p=>({response:new HttpResponse({headers:f,reason:o.statusText,statusCode:o.status,body:p})})):{response:new HttpResponse({headers:f,reason:o.statusText,statusCode:o.status,body:o.body})}}),requestTimeout(f)];return p&&U.push(new Promise((o,f)=>{let onAbort=()=>{let o=Error("Request aborted");o.name="AbortError",f(o)};"function"==typeof p.addEventListener?(p.addEventListener("abort",onAbort,{once:!0}),removeSignalEventListener=()=>p.removeEventListener("abort",onAbort)):p.onabort=onAbort})),Promise.race(U).finally(removeSignalEventListener)}updateHttpClientConfig(o,p){this.config=void 0,this.configProvider=this.configProvider.then(f=>(f[o]=p,f))}httpHandlerConfigs(){return this.config??{}}};let stream_collector_streamCollector=o=>"function"==typeof Blob&&o instanceof Blob?collectBlob(o):collectStream(o);async function collectBlob(o){return new Uint8Array(fromBase64(await readToBase64(o)))}async function collectStream(o){let p=[],f=o.getReader(),m=!1,_=0;for(;!m;){let{done:o,value:w}=await f.read();w&&(p.push(w),_+=w.length),m=o}let w=new Uint8Array(_),I=0;for(let o of p)w.set(o,I),I+=o.length;return w}function readToBase64(o){return new Promise((p,f)=>{let m=new FileReader;m.onloadend=()=>{if(2!==m.readyState)return f(Error("Reader aborted too early"));let o=m.result??"",_=o.indexOf(","),w=_>-1?_+1:o.length;p(o.substring(w))},m.onabort=()=>f(Error("Read aborted")),m.onerror=()=>f(m.error),m.readAsDataURL(o)})}let e$={},eK={};for(let o=0;o<256;o++){let p=o.toString(16).toLowerCase();1===p.length&&(p=`0${p}`),e$[o]=p,eK[p]=o}function fromHex(o){if(o.length%2!=0)throw Error("Hex encoded strings must have an even number length");let p=new Uint8Array(o.length/2);for(let f=0;f{if(o instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(o);if(!o)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);let f=p.streamCollector(o);return Uint8ArrayBlobAdapter.mutate(await f)};let Command=class Command{constructor(){this.middlewareStack=constructStack()}static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(o,p,f,{middlewareFn:m,clientName:w,commandName:I,inputFilterSensitiveLog:k,outputFilterSensitiveLog:M,smithyContext:x,additionalContext:O,CommandCtor:L}){for(let _ of m.bind(this)(L,o,p,f))this.middlewareStack.use(_);let B=o.concat(this.middlewareStack),{logger:U}=p,$={logger:U,clientName:w,commandName:I,inputFilterSensitiveLog:k,outputFilterSensitiveLog:M,[_]:{commandInstance:this,...x},...O},{requestHandler:q}=p;return B.resolve(o=>q.handle(o.request,f||{}),$)}};let ClassBuilder=class ClassBuilder{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=o=>o,this._outputFilterSensitiveLog=o=>o,this._serializer=null,this._deserializer=null}init(o){this._init=o}ep(o){return this._ep=o,this}m(o){return this._middlewareFn=o,this}s(o,p,f={}){return this._smithyContext={service:o,operation:p,...f},this}c(o={}){return this._additionalContext=o,this}n(o,p){return this._clientName=o,this._commandName=p,this}f(o=o=>o,p=o=>o){return this._inputFilterSensitiveLog=o,this._outputFilterSensitiveLog=p,this}ser(o){return this._serializer=o,this}de(o){return this._deserializer=o,this}build(){let o,p=this;return o=class extends Command{static getEndpointParameterInstructions(){return p._ep}constructor(...[o]){super(),this.serialize=p._serializer,this.deserialize=p._deserializer,this.input=o??{},p._init(this)}resolveMiddleware(f,m,_){return this.resolveMiddlewareWithContext(f,m,_,{CommandCtor:o,middlewareFn:p._middlewareFn,clientName:p._clientName,commandName:p._commandName,inputFilterSensitiveLog:p._inputFilterSensitiveLog,outputFilterSensitiveLog:p._outputFilterSensitiveLog,smithyContext:p._smithyContext,additionalContext:p._additionalContext})}}}};let eq="***SensitiveInformation***",expectBoolean=o=>{if(null!=o){if("number"==typeof o){if((0===o||1===o)&&eY.warn(stackTraceWarning(`Expected boolean, got ${typeof o}: ${o}`)),0===o)return!1;if(1===o)return!0}if("string"==typeof o){let p=o.toLowerCase();if(("false"===p||"true"===p)&&eY.warn(stackTraceWarning(`Expected boolean, got ${typeof o}: ${o}`)),"false"===p)return!1;if("true"===p)return!0}if("boolean"==typeof o)return o;throw TypeError(`Expected boolean, got ${typeof o}: ${o}`)}},expectNumber=o=>{if(null!=o){if("string"==typeof o){let p=parseFloat(o);if(!Number.isNaN(p))return String(p)!==String(o)&&eY.warn(stackTraceWarning(`Expected number but observed string: ${o}`)),p}if("number"==typeof o)return o;throw TypeError(`Expected number, got ${typeof o}: ${o}`)}},expectNonNull=(o,p)=>{if(null==o){if(p)throw TypeError(`Expected a non-null value for ${p}`);throw TypeError("Expected a non-null value")}return o},expectObject=o=>{if(null==o)return;if("object"==typeof o&&!Array.isArray(o))return o;let p=Array.isArray(o)?"array":typeof o;throw TypeError(`Expected object, got ${p}: ${o}`)},expectString=o=>{if(null!=o){if("string"==typeof o)return o;if(["boolean","number","bigint"].includes(typeof o))return eY.warn(stackTraceWarning(`Expected string, got ${typeof o}: ${o}`)),String(o);throw TypeError(`Expected string, got ${typeof o}: ${o}`)}},eJ=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,stackTraceWarning=o=>String(TypeError(o).stack||o).split(`
`).slice(0,5).filter(o=>!o.includes("stackTraceWarning")).join(`
`),eY={warn:console.warn},parseEpochTimestamp=o=>{let p;if(null!=o){if("number"==typeof o)p=o;else if("string"==typeof o)p="string"==typeof o?expectNumber((o=>{let p=o.match(eJ);if(null===p||p[0].length!==o.length)throw TypeError("Expected real number, got implicit NaN");return parseFloat(o)})(o)):expectNumber(o);else if("object"==typeof o&&1===o.tag)p=o.value;else throw TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(p)||p===1/0||p===-1/0)throw TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*p))}};let ServiceException=class ServiceException extends Error{constructor(o){super(o.message),Object.setPrototypeOf(this,ServiceException.prototype),this.name=o.name,this.$fault=o.$fault,this.$metadata=o.$metadata}};let decorateServiceException=(o,p={})=>{Object.entries(p).filter(([,o])=>void 0!==o).forEach(([p,f])=>{(void 0==o[p]||""===o[p])&&(o[p]=f)});let f=o.message||o.Message||"UnknownError";return o.message=f,delete o.Message,o},loadConfigsForDefaultMode=o=>{switch(o){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},isSerializableHeaderValue=o=>null!=o,StringWrapper=function(){let o=Object.getPrototypeOf(this).constructor,p=Function.bind.apply(String,[null,...arguments]),f=new p;return Object.setPrototypeOf(f,o.prototype),f};StringWrapper.prototype=Object.create(String.prototype,{constructor:{value:StringWrapper,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(StringWrapper,String);let NoOpLogger=class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}};function map(o,p,f){let m,_;if(void 0===p&&void 0===f)m={},_=o;else{if(m=o,"function"==typeof p)return mapWithFilter(m,p,_=f);_=p}for(let o of Object.keys(_)){if(!Array.isArray(_[o])){m[o]=_[o];continue}applyInstruction(m,null,_,o)}return m}let take=(o,p)=>{let f={};for(let m in p)applyInstruction(f,o,p,m);return f},mapWithFilter=(o,p,f)=>map(o,Object.entries(f).reduce((o,[f,m])=>(Array.isArray(m)?o[f]=m:"function"==typeof m?o[f]=[p,m()]:o[f]=[p,m],o),{})),applyInstruction=(o,p,f,m)=>{if(null!==p){let _=f[m];"function"==typeof _&&(_=[,_]);let[w=nonNullish,I=pass,k=m]=_;("function"==typeof w&&w(p[k])||"function"!=typeof w&&w)&&(o[m]=I(p[k]));return}let[_,w]=f[m];if("function"==typeof w){let p,f=void 0===_&&null!=(p=w()),I="function"==typeof _&&!!_(void 0)||"function"!=typeof _&&!!_;f?o[m]=p:I&&(o[m]=w())}else{let p=void 0===_&&null!=w,f="function"==typeof _&&!!_(w)||"function"!=typeof _&&!!_;(p||f)&&(o[m]=w)}},nonNullish=o=>null!=o,pass=o=>o;function extendedEncodeURIComponent(o){return encodeURIComponent(o).replace(/[!'()*]/g,function(o){return"%"+o.charCodeAt(0).toString(16).toUpperCase()})}let serializeDateTime=o=>o.toISOString().replace(".000Z","Z"),_json=o=>{if(null==o)return{};if(Array.isArray(o))return o.filter(o=>null!=o).map(_json);if("object"==typeof o){let p={};for(let f of Object.keys(o))null!=o[f]&&(p[f]=_json(o[f]));return p}return o},isStreamingPayload=o=>o?.body instanceof ReadableStream,getRetryErrorInfo=o=>{let p={error:o,errorType:getRetryErrorType(o)},f=getRetryAfterHint(o.$response);return f&&(p.retryAfterHint=f),p},getRetryErrorType=o=>isThrottlingError(o)?"THROTTLING":isTransientError(o)?"TRANSIENT":(o=>{if(o.$metadata?.httpStatusCode!==void 0){let p=o.$metadata.httpStatusCode;if(500<=p&&p<=599&&!isTransientError(o))return!0}return!1})(o)?"SERVER_ERROR":"CLIENT_ERROR",eX={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryAfterHint=o=>{if(!HttpResponse.isInstance(o))return;let p=Object.keys(o.headers).find(o=>"retry-after"===o.toLowerCase());if(!p)return;let f=o.headers[p],m=Number(f);return new Date(Number.isNaN(m)?f:1e3*m)},eQ={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:eX.name};let DefaultIdentityProviderConfig=class DefaultIdentityProviderConfig{constructor(o){for(const[p,f]of(this.authSchemes=new Map,Object.entries(o)))void 0!==f&&this.authSchemes.set(p,f)}getIdentityProvider(o){return this.authSchemes.get(o)}};let isIdentityExpired=o=>doesIdentityRequireRefresh(o)&&o.expiration.getTime()-Date.now()<3e5,doesIdentityRequireRefresh=o=>void 0!==o.expiration,dist_es_normalizeProvider_normalizeProvider=o=>{if("function"==typeof o)return o;let p=Promise.resolve(o);return()=>p};function requestBuilder(o,p){return new RequestBuilder(o,p)}let RequestBuilder=class RequestBuilder{constructor(o,p){this.input=o,this.context=p,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){let{hostname:o,protocol:p="https",port:f,path:m}=await this.context.endpoint();for(let o of(this.path=m,this.resolvePathStack))o(this.path);return new httpRequest_HttpRequest({protocol:p,hostname:this.hostname||o,port:f,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(o){return this.hostname=o,this}bp(o){return this.resolvePathStack.push(p=>{this.path=`${p?.endsWith("/")?p.slice(0,-1):p||""}`+o}),this}p(o,p,f,m){return this.resolvePathStack.push(_=>{this.path=((o,p,f,m,_,w)=>{if(null!=p&&void 0!==p[f]){let p=m();if(p.length<=0)throw Error("Empty value provided for input HTTP label: "+f+".");o=o.replace(_,w?p.split("/").map(o=>extendedEncodeURIComponent(o)).join("/"):extendedEncodeURIComponent(p))}else throw Error("No value provided for input HTTP label: "+f+".");return o})(_,this.input,o,p,f,m)}),this}h(o){return this.headers=o,this}q(o){return this.query=o,this}b(o){return this.body=o,this}m(o){return this.method=o,this}};let makePagedClientRequest=async(o,p,f,...m)=>await p.send(new o(f),...m);function createPaginator(o,p,f,m,_){return async function*(w,I,...k){let M,x=w.startingToken||void 0,O=!0;for(;O;){if(I[f]=x,_&&(I[_]=I[_]??w.pageSize),w.client instanceof o)M=await makePagedClientRequest(p,w.client,I,...k);else throw Error(`Invalid client, expected instance of ${o.name}`);yield M;let L=x;O=!!((x=get(M,m))&&(!w.stopOnSameToken||x!==L))}}}let get=(o,p)=>{let f=o;for(let o of p.split(".")){if(!f||"object"!=typeof f)return;f=f[o]}return f},eZ="content-length";function contentLengthMiddleware(o){return p=>async f=>{let m=f.request;if(httpRequest_HttpRequest.isInstance(m)){let{body:p,headers:f}=m;if(p&&-1===Object.keys(f).map(o=>o.toLowerCase()).indexOf(eZ))try{let f=o(p);m.headers={...m.headers,[eZ]:String(f)}}catch{}}return p({...f,request:m})}}let e0={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},toUint8Array=o=>"string"==typeof o?fromUtf8(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o),e1="X-Amz-Date",e2="X-Amz-Signature",e3="X-Amz-Security-Token",e4="authorization",e5=e1.toLowerCase(),e6=[e4,e5,"date"],e8=e2.toLowerCase(),e9="x-amz-content-sha256",e7=e3.toLowerCase(),te={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},tt=/^proxy-/,ti=/^sec-/,tr="AWS4-HMAC-SHA256",tn="aws4_request",to={},ts=[],createScope=(o,p,f)=>`${o}/${p}/${f}/${tn}`,getSigningKey=async(o,p,f,m,_)=>{let w=await hmac(o,p.secretAccessKey,p.accessKeyId),I=`${f}:${m}:${_}:${dist_es_toHex(w)}:${p.sessionToken}`;if(I in to)return to[I];for(ts.push(I);ts.length>50;)delete to[ts.shift()];let k=`AWS4${p.secretAccessKey}`;for(let p of[f,m,_,tn])k=await hmac(o,k,p);return to[I]=k},hmac=(o,p,f)=>{let m=new o(p);return m.update(toUint8Array(f)),m.digest()},getCanonicalHeaders=({headers:o},p,f)=>{let m={};for(let _ of Object.keys(o).sort()){if(void 0==o[_])continue;let w=_.toLowerCase();(!(w in te||p?.has(w)||tt.test(w)||ti.test(w))||f&&(!f||f.has(w)))&&(m[w]=o[_].trim().replace(/\s+/g," "))}return m},getPayloadHash=async({headers:o,body:p},f)=>{for(let p of Object.keys(o))if(p.toLowerCase()===e9)return o[p];if(void 0==p)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof p||ArrayBuffer.isView(p)||"function"==typeof ArrayBuffer&&p instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(p)){let o=new f;return o.update(toUint8Array(p)),dist_es_toHex(await o.digest())}return"UNSIGNED-PAYLOAD"};let HeaderFormatter=class HeaderFormatter{format(o){let p=[];for(let f of Object.keys(o)){let m=fromUtf8(f);p.push(Uint8Array.from([m.byteLength]),m,this.formatHeaderValue(o[f]))}let f=new Uint8Array(p.reduce((o,p)=>o+p.byteLength,0)),m=0;for(let o of p)f.set(o,m),m+=o.byteLength;return f}formatHeaderValue(o){switch(o.type){case"boolean":return Uint8Array.from([+!o.value]);case"byte":return Uint8Array.from([2,o.value]);case"short":let p=new DataView(new ArrayBuffer(3));return p.setUint8(0,3),p.setInt16(1,o.value,!1),new Uint8Array(p.buffer);case"integer":let f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,o.value,!1),new Uint8Array(f.buffer);case"long":let m=new Uint8Array(9);return m[0]=5,m.set(o.value.bytes,1),m;case"binary":let _=new DataView(new ArrayBuffer(3+o.value.byteLength));_.setUint8(0,6),_.setUint16(1,o.value.byteLength,!1);let w=new Uint8Array(_.buffer);return w.set(o.value,3),w;case"string":let I=fromUtf8(o.value),k=new DataView(new ArrayBuffer(3+I.byteLength));k.setUint8(0,7),k.setUint16(1,I.byteLength,!1);let M=new Uint8Array(k.buffer);return M.set(I,3),M;case"timestamp":let x=new Uint8Array(9);return x[0]=8,x.set(Int64.fromNumber(o.value.valueOf()).bytes,1),x;case"uuid":if(!ta.test(o.value))throw Error(`Invalid UUID received: ${o.value}`);let O=new Uint8Array(17);return O[0]=9,O.set(fromHex(o.value.replace(/\-/g,"")),1),O}}};(ee=eS||(eS={}))[ee.boolTrue=0]="boolTrue",ee[ee.boolFalse=1]="boolFalse",ee[ee.byte=2]="byte",ee[ee.short=3]="short",ee[ee.integer=4]="integer",ee[ee.long=5]="long",ee[ee.byteArray=6]="byteArray",ee[ee.string=7]="string",ee[ee.timestamp=8]="timestamp",ee[ee.uuid=9]="uuid";let ta=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let Int64=class Int64{constructor(o){if(this.bytes=o,8!==o.byteLength)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(o){if(o>0x8000000000000000||o<-0x8000000000000000)throw Error(`${o} is too large (or, if negative, too small) to represent as an Int64`);let p=new Uint8Array(8);for(let f=7,m=Math.abs(Math.round(o));f>-1&&m>0;f--,m/=256)p[f]=m;return o<0&&negate(p),new Int64(p)}valueOf(){let o=this.bytes.slice(0),p=128&o[0];return p&&negate(o),parseInt(dist_es_toHex(o),16)*(p?-1:1)}toString(){return String(this.valueOf())}};function negate(o){for(let p=0;p<8;p++)o[p]^=255;for(let p=7;p>-1&&(o[p]++,0===o[p]);p--);}let prepareRequest=o=>{for(let p of Object.keys((o=httpRequest_HttpRequest.clone(o)).headers))e6.indexOf(p.toLowerCase())>-1&&delete o.headers[p];return o};let SignatureV4=class SignatureV4{constructor({applyChecksum:o,credentials:p,region:f,service:m,sha256:_,uriEscapePath:w=!0}){this.headerFormatter=new HeaderFormatter,this.service=m,this.sha256=_,this.uriEscapePath=w,this.applyChecksum="boolean"!=typeof o||o,this.regionProvider=normalizeProvider_normalizeProvider(f),this.credentialProvider=normalizeProvider_normalizeProvider(p)}async presign(o,p={}){let{signingDate:f=new Date,expiresIn:m=3600,unsignableHeaders:_,unhoistableHeaders:w,signableHeaders:I,hoistableHeaders:k,signingRegion:M,signingService:x}=p,O=await this.credentialProvider();this.validateResolvedCredentials(O);let L=M??await this.regionProvider(),{longDate:B,shortDate:U}=formatDate(f);if(m>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let $=createScope(U,L,x??this.service),q=((o,p={})=>{let{headers:f,query:m={}}=httpRequest_HttpRequest.clone(o);for(let o of Object.keys(f)){let _=o.toLowerCase();("x-amz-"===_.slice(0,6)&&!p.unhoistableHeaders?.has(_)||p.hoistableHeaders?.has(_))&&(m[o]=f[o],delete f[o])}return{...o,headers:f,query:m}})(prepareRequest(o),{unhoistableHeaders:w,hoistableHeaders:k});O.sessionToken&&(q.query[e3]=O.sessionToken),q.query["X-Amz-Algorithm"]=tr,q.query["X-Amz-Credential"]=`${O.accessKeyId}/${$}`,q.query[e1]=B,q.query["X-Amz-Expires"]=m.toString(10);let Z=getCanonicalHeaders(q,_,I);return q.query["X-Amz-SignedHeaders"]=getCanonicalHeaderList(Z),q.query[e2]=await this.getSignature(B,$,this.getSigningKey(O,L,U,x),this.createCanonicalRequest(q,Z,await getPayloadHash(o,this.sha256))),q}async sign(o,p){return"string"==typeof o?this.signString(o,p):o.headers&&o.payload?this.signEvent(o,p):o.message?this.signMessage(o,p):this.signRequest(o,p)}async signEvent({headers:o,payload:p},{signingDate:f=new Date,priorSignature:m,signingRegion:_,signingService:w}){let I=_??await this.regionProvider(),{shortDate:k,longDate:M}=formatDate(f),x=createScope(k,I,w??this.service),O=await getPayloadHash({headers:{},body:p},this.sha256),L=new this.sha256;L.update(o);let B=["AWS4-HMAC-SHA256-PAYLOAD",M,x,m,dist_es_toHex(await L.digest()),O].join(`
`);return this.signString(B,{signingDate:f,signingRegion:I,signingService:w})}async signMessage(o,{signingDate:p=new Date,signingRegion:f,signingService:m}){return this.signEvent({headers:this.headerFormatter.format(o.message.headers),payload:o.message.body},{signingDate:p,signingRegion:f,signingService:m,priorSignature:o.priorSignature}).then(p=>({message:o.message,signature:p}))}async signString(o,{signingDate:p=new Date,signingRegion:f,signingService:m}={}){let _=await this.credentialProvider();this.validateResolvedCredentials(_);let w=f??await this.regionProvider(),{shortDate:I}=formatDate(p),k=new this.sha256(await this.getSigningKey(_,w,I,m));return k.update(toUint8Array(o)),dist_es_toHex(await k.digest())}async signRequest(o,{signingDate:p=new Date,signableHeaders:f,unsignableHeaders:m,signingRegion:_,signingService:w}={}){let I=await this.credentialProvider();this.validateResolvedCredentials(I);let k=_??await this.regionProvider(),M=prepareRequest(o),{longDate:x,shortDate:O}=formatDate(p),L=createScope(O,k,w??this.service);M.headers[e5]=x,I.sessionToken&&(M.headers[e7]=I.sessionToken);let B=await getPayloadHash(M,this.sha256);!((o,p)=>{for(let f of(o=o.toLowerCase(),Object.keys(p)))if(o===f.toLowerCase())return!0;return!1})(e9,M.headers)&&this.applyChecksum&&(M.headers[e9]=B);let U=getCanonicalHeaders(M,m,f),$=await this.getSignature(x,L,this.getSigningKey(I,k,O,w),this.createCanonicalRequest(M,U,B));return M.headers[e4]=`${tr} Credential=${I.accessKeyId}/${L}, SignedHeaders=${getCanonicalHeaderList(U)}, Signature=${$}`,M}createCanonicalRequest(o,p,f){let m=Object.keys(p).sort();return`${o.method}
${this.getCanonicalPath(o)}
${(({query:o={}})=>{let p=[],f={};for(let m of Object.keys(o)){if(m.toLowerCase()===e8)continue;let _=escapeUri(m);p.push(_);let w=o[m];"string"==typeof w?f[_]=`${_}=${escapeUri(w)}`:Array.isArray(w)&&(f[_]=w.slice(0).reduce((o,p)=>o.concat([`${_}=${escapeUri(p)}`]),[]).sort().join("&"))}return p.sort().map(o=>f[o]).filter(o=>o).join("&")})(o)}
${m.map(o=>`${o}:${p[o]}`).join(`
`)}
${m.join(";")}
${f}`}async createStringToSign(o,p,f){let m=new this.sha256;m.update(toUint8Array(f));let _=await m.digest();return`${tr}
${o}
${p}
${dist_es_toHex(_)}`}getCanonicalPath({path:o}){if(this.uriEscapePath){let p=[];for(let f of o.split("/"))f?.length!==0&&"."!==f&&(".."===f?p.pop():p.push(f));return escapeUri(`${o?.startsWith("/")?"/":""}${p.join("/")}${p.length>0&&o?.endsWith("/")?"/":""}`).replace(/%2F/g,"/")}return o}async getSignature(o,p,f,m){let _=await this.createStringToSign(o,p,m),w=new this.sha256(await f);return w.update(toUint8Array(_)),dist_es_toHex(await w.digest())}getSigningKey(o,p,f,m){return getSigningKey(this.sha256,o,f,p,m||this.service)}validateResolvedCredentials(o){if("object"!=typeof o||"string"!=typeof o.accessKeyId||"string"!=typeof o.secretAccessKey)throw Error("Resolved credential object is not valid")}};let formatDate=o=>{var p;let f=("number"==typeof(p=o)?new Date(1e3*p):"string"==typeof p?new Date(Number(p)?1e3*Number(p):p):p).toISOString().replace(/\.\d{3}Z$/,"Z").replace(/[\-:]/g,"");return{longDate:f,shortDate:f.slice(0,8)}},getCanonicalHeaderList=o=>Object.keys(o).sort().join(";"),defaultChimeSDKMessagingHttpAuthSchemeParametersProvider=async(o,p,f)=>({operation:getSmithyContext(p).operation,region:await normalizeProvider_normalizeProvider(o.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(o){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"chime",region:o.region},propertiesExtractor:(o,p)=>({signingProperties:{config:o,context:p}})}}let defaultChimeSDKMessagingHttpAuthSchemeProvider=o=>{let p=[];return o.operation,p.push(createAwsAuthSigv4HttpAuthOption(o)),p},tl={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var td=f(0x1aee62d78),tc=f.n(td),tu="u">typeof Buffer&&Buffer.from?function(o){return Buffer.from(o,"utf8")}:o=>new TextEncoder().encode(o);function convertToBuffer(o){return o instanceof Uint8Array?o:"string"==typeof o?tu(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}function isEmptyData(o){return"string"==typeof o?0===o.length:0===o.byteLength}var th={name:"SHA-256"},tp={name:"HMAC",hash:th},tf=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);let tm={};function locateWindow(){return"u">typeof window?window:"u">typeof self?self:tm}var tg=function(){function Sha256(o){this.toHash=new Uint8Array(0),this.secret=o,this.reset()}return Sha256.prototype.update=function(o){if(!isEmptyData(o)){var p=convertToBuffer(o),f=new Uint8Array(this.toHash.byteLength+p.byteLength);f.set(this.toHash,0),f.set(p,this.toHash.byteLength),this.toHash=f}},Sha256.prototype.digest=function(){var o=this;return this.key?this.key.then(function(p){return locateWindow().crypto.subtle.sign(tp,p,o.toHash).then(function(o){return new Uint8Array(o)})}):isEmptyData(this.toHash)?Promise.resolve(tf):Promise.resolve().then(function(){return locateWindow().crypto.subtle.digest(th,o.toHash)}).then(function(o){return Promise.resolve(new Uint8Array(o))})},Sha256.prototype.reset=function(){var o=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(p,f){locateWindow().crypto.subtle.importKey("raw",convertToBuffer(o.secret),tp,!1,["sign"]).then(p,f)}),this.key.catch(function(){}))},Sha256}();function tslib_es6_awaiter(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})}function tslib_es6_generator(o,p){var f,m,_,w,I={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return w={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(w[Symbol.iterator]=function(){return this}),w;function verb(o){return function(p){return step([o,p])}}function step(k){if(f)throw TypeError("Generator is already executing.");for(;w&&(w=0,k[0]&&(I=0)),I;)try{if(f=1,m&&(_=2&k[0]?m.return:k[0]?m.throw||((_=m.return)&&_.call(m),0):m.next)&&!(_=_.call(m,k[1])).done)return _;switch(m=0,_&&(k=[2&k[0],_.value]),k[0]){case 0:case 1:_=k;break;case 4:return I.label++,{value:k[1],done:!1};case 5:I.label++,m=k[1],k=[0];continue;case 7:k=I.ops.pop(),I.trys.pop();continue;default:if(!(_=(_=I.trys).length>0&&_[_.length-1])&&(6===k[0]||2===k[0])){I=0;continue}if(3===k[0]&&(!_||k[1]>_[0]&&k[1]<_[3])){I.label=k[1];break}if(6===k[0]&&I.label<_[1]){I.label=_[1],_=k;break}if(_&&I.label<_[2]){I.label=_[2],I.ops.push(k);break}_[2]&&I.ops.pop(),I.trys.pop();continue}k=p.call(o,I)}catch(o){k=[6,o],m=0}finally{f=_=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}}"function"==typeof SuppressedError&&SuppressedError;var tS=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),tv=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],tb=function(){function RawSha256(){this.state=Int32Array.from(tv),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return RawSha256.prototype.update=function(o){if(this.finished)throw Error("Attempted to update an already finished hash.");var p=0,f=o.byteLength;if(this.bytesHashed+=f,8*this.bytesHashed>0x1fffffffffffff)throw Error("Cannot hash more than 2^53 - 1 bits");for(;f>0;)this.buffer[this.bufferLength++]=o[p++],f--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0)},RawSha256.prototype.digest=function(){if(!this.finished){var o=8*this.bytesHashed,p=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),f=this.bufferLength;if(p.setUint8(this.bufferLength++,128),f%64>=56){for(var m=this.bufferLength;m<64;m++)p.setUint8(m,0);this.hashBuffer(),this.bufferLength=0}for(var m=this.bufferLength;m<56;m++)p.setUint8(m,0);p.setUint32(56,Math.floor(o/0x100000000),!0),p.setUint32(60,o),this.hashBuffer(),this.finished=!0}for(var _=new Uint8Array(32),m=0;m<8;m++)_[4*m]=this.state[m]>>>24&255,_[4*m+1]=this.state[m]>>>16&255,_[4*m+2]=this.state[m]>>>8&255,_[4*m+3]=this.state[m]>>>0&255;return _},RawSha256.prototype.hashBuffer=function(){for(var o=this.buffer,p=this.state,f=p[0],m=p[1],_=p[2],w=p[3],I=p[4],k=p[5],M=p[6],x=p[7],O=0;O<64;O++){if(O<16)this.temp[O]=(255&o[4*O])<<24|(255&o[4*O+1])<<16|(255&o[4*O+2])<<8|255&o[4*O+3];else{var L=this.temp[O-2],B=(L>>>17|L<<15)^(L>>>19|L<<13)^L>>>10,U=((L=this.temp[O-15])>>>7|L<<25)^(L>>>18|L<<14)^L>>>3;this.temp[O]=(B+this.temp[O-7]|0)+(U+this.temp[O-16]|0)}var $=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&k^~I&M)|0)+(x+(tS[O]+this.temp[O]|0)|0)|0,q=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&m^f&_^m&_)|0;x=M,M=k,k=I,I=w+$|0,w=_,_=m,m=f,f=$+q|0}p[0]+=f,p[1]+=m,p[2]+=_,p[3]+=w,p[4]+=I,p[5]+=k,p[6]+=M,p[7]+=x},RawSha256}(),ty=function(){function Sha256(o){this.secret=o,this.hash=new tb,this.reset()}return Sha256.prototype.update=function(o){if(!isEmptyData(o)&&!this.error)try{this.hash.update(convertToBuffer(o))}catch(o){this.error=o}},Sha256.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},Sha256.prototype.digest=function(){return tslib_es6_awaiter(this,void 0,void 0,function(){return tslib_es6_generator(this,function(o){return[2,this.digestSync()]})})},Sha256.prototype.reset=function(){if(this.hash=new tb,this.secret){this.outer=new tb;var o=bufferFromSecret(this.secret),p=new Uint8Array(64);p.set(o);for(var f=0;f<64;f++)o[f]^=54,p[f]^=92;this.hash.update(o),this.outer.update(p);for(var f=0;f64){var f=new tb;f.update(p),p=f.digest()}var m=new Uint8Array(64);return m.set(p),m}var t_=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(o){return!!supportsSecureRandom(o)&&"object"==typeof o.crypto.subtle&&supportsSubtleCrypto(o.crypto.subtle)}function supportsSecureRandom(o){return"object"==typeof o&&"object"==typeof o.crypto&&"function"==typeof o.crypto.getRandomValues}function supportsSubtleCrypto(o){return o&&t_.every(function(p){return"function"==typeof o[p]})}var tC=function(){function Sha256(o){supportsWebCrypto(locateWindow())?this.hash=new tg(o):this.hash=new ty(o)}return Sha256.prototype.update=function(o,p){this.hash.update(convertToBuffer(o))},Sha256.prototype.digest=function(){return this.hash.digest()},Sha256.prototype.reset=function(){this.hash.reset()},Sha256}(),tT=f(0x6fb93939),tE=f.n(tT);let tw="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=o=>{if("string"==typeof o){if(tw)return tw.encode(o).byteLength;let p=o.length;for(let f=p-1;f>=0;f--){let m=o.charCodeAt(f);m>127&&m<=2047?p++:m>2047&&m<=65535&&(p+=2),m>=56320&&m<=57343&&f--}return p}if("number"==typeof o.byteLength)return o.byteLength;if("number"==typeof o.size)return o.size;throw Error(`Body Length computation failed for ${o}`)},getSkewCorrectedDate=o=>new Date(Date.now()+o),getDateHeader=o=>HttpResponse.isInstance(o)?o.headers?.date??o.headers?.Date:void 0,getUpdatedSystemClockOffset=(o,p)=>{let f=Date.parse(o);return Math.abs(getSkewCorrectedDate(p).getTime()-f)>=3e5?f-Date.now():p},throwSigningPropertyError=(o,p)=>{if(!p)throw Error(`Property \`${o}\` is not resolved for AWS SDK SigV4Auth`);return p},validateSigningProperties=async o=>{let p=throwSigningPropertyError("context",o.context),f=throwSigningPropertyError("config",o.config),m=p.endpointV2?.properties?.authSchemes?.[0],_=throwSigningPropertyError("signer",f.signer),w=await _(m),I=o?.signingRegion;return{config:f,signer:w,signingRegion:I,signingRegionSet:o?.signingRegionSet,signingName:o?.signingName}};let AwsSdkSigV4Signer=class AwsSdkSigV4Signer{async sign(o,p,f){if(!httpRequest_HttpRequest.isInstance(o))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let m=await validateSigningProperties(f),{config:_,signer:w}=m,{signingRegion:I,signingName:k}=m,M=f.context;if(M?.authSchemes?.length){let[o,p]=M.authSchemes;o?.name==="sigv4a"&&p?.name==="sigv4"&&(I=p?.signingRegion??I,k=p?.signingName??k)}return await w.sign(o,{signingDate:getSkewCorrectedDate(_.systemClockOffset),signingRegion:I,signingService:k})}errorHandler(o){return p=>{let f=p.ServerTime??getDateHeader(p.$response);if(f){let m=throwSigningPropertyError("config",o.config),_=m.systemClockOffset;m.systemClockOffset=getUpdatedSystemClockOffset(f,m.systemClockOffset),m.systemClockOffset!==_&&p.$metadata&&(p.$metadata.clockSkewCorrected=!0)}throw p}}successHandler(o,p){let f=getDateHeader(o);if(f){let o=throwSigningPropertyError("config",p.config);o.systemClockOffset=getUpdatedSystemClockOffset(f,o.systemClockOffset)}}};let tI="required",tA="argv",tk="isSet",tM="booleanEquals",tx="error",tP="endpoint",tR="tree",tO="PartitionResult",tD={[tI]:!1,type:"String"},tL={[tI]:!0,default:!1,type:"Boolean"},tN={ref:"Endpoint"},tF={fn:tM,[tA]:[{ref:"UseFIPS"},!0]},tV={fn:tM,[tA]:[{ref:"UseDualStack"},!0]},tB={},tU={fn:"getAttr",[tA]:[{ref:tO},"supportsFIPS"]},tj={fn:tM,[tA]:[!0,{fn:"getAttr",[tA]:[{ref:tO},"supportsDualStack"]}]},tH=[tF],tz=[tV],tG=[{ref:"Region"}],tW={version:"1.0",parameters:{Region:tD,UseDualStack:tL,UseFIPS:tL,Endpoint:tD},rules:[{conditions:[{fn:tk,[tA]:[tN]}],rules:[{conditions:tH,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:tx},{conditions:tz,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:tx},{endpoint:{url:tN,properties:tB,headers:tB},type:tP}],type:tR},{conditions:[{fn:tk,[tA]:tG}],rules:[{conditions:[{fn:"aws.partition",[tA]:tG,assign:tO}],rules:[{conditions:[tF,tV],rules:[{conditions:[{fn:tM,[tA]:[!0,tU]},tj],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:tx}],type:tR},{conditions:tH,rules:[{conditions:[{fn:tM,[tA]:[tU,!0]}],rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"FIPS is enabled but this partition does not support FIPS",type:tx}],type:tR},{conditions:tz,rules:[{conditions:[tj],rules:[{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR},{error:"DualStack is enabled but this partition does not support DualStack",type:tx}],type:tR},{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dnsSuffix}",properties:tB,headers:tB},type:tP}],type:tR}],type:tR},{error:"Invalid Configuration: Missing Region",type:tx}]},t$=new EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver=(o,p={})=>t$.get(o,()=>((o,p)=>{let{endpointParams:f,logger:m}=p,{parameters:_,rules:w}=o;p.logger?.debug?.(`${B} Initial EndpointParams: ${toDebugString(f)}`);let I=Object.entries(_).filter(([,o])=>null!=o.default).map(([o,p])=>[o,p.default]);if(I.length>0)for(let[o,p]of I)f[o]=f[o]??p;for(let o of Object.entries(_).filter(([,o])=>o.required).map(([o])=>o))if(null==f[o])throw new EndpointError(`Missing required parameter: '${o}'`);let k=evaluateRules(w,{endpointParams:f,logger:m,referenceRecord:{}});return p.logger?.debug?.(`${B} Resolved endpoint: ${toDebugString(k)}`),k})(tW,{endpointParams:o,logger:p.logger}));L.aws=ey;let tK=["in-region","cross-region","mobile","standard","legacy"];let ChimeSDKMessagingClient=class ChimeSDKMessagingClient extends Client{constructor(...[o]){const p=((o,p)=>{var f;let m,_,w,I,k,M,x,O,L={...(w=async()=>{if(void 0===o.region)throw Error("Region is missing from runtimeConfig");let p=o.region;return"string"==typeof p?p:p()},{setRegion(o){w=o},region:()=>w}),...(o=>{let p=[];for(let f in eu){let m=eu[f];void 0!==o[m]&&p.push({algorithmId:()=>m,checksumConstructor:()=>o[m]})}return{_checksumAlgorithms:p,addChecksumAlgorithm(o){this._checksumAlgorithms.push(o)},checksumAlgorithms(){return this._checksumAlgorithms}}})(o),...(I=o.retryStrategy,{setRetryStrategy(o){I=o},retryStrategy:()=>I}),...(k=o.httpHandler,{setHttpHandler(o){k=o},httpHandler:()=>k,updateHttpClientConfig(o,p){k.updateHttpClientConfig(o,p)},httpHandlerConfigs:()=>k.httpHandlerConfigs()}),...(M=o.httpAuthSchemes,x=o.httpAuthSchemeProvider,O=o.credentials,{setHttpAuthScheme(o){let p=M.findIndex(p=>p.schemeId===o.schemeId);-1===p?M.push(o):M.splice(p,1,o)},httpAuthSchemes:()=>M,setHttpAuthSchemeProvider(o){x=o},httpAuthSchemeProvider:()=>x,setCredentials(o){O=o},credentials:()=>O})};p.forEach(o=>o.configure(L));return{...o,...{region:L.region()},...{...(m={},(f=L).checksumAlgorithms().forEach(o=>{m[o.algorithmId()]=o.checksumConstructor()}),m),...((_={}).retryStrategy=f.retryStrategy(),_)},...{httpHandler:L.httpHandler()},...{httpAuthSchemes:L.httpAuthSchemes(),httpAuthSchemeProvider:L.httpAuthSchemeProvider(),credentials:L.credentials()}}})((o=>({...(o=>{let p,f;o.credentials&&(p=((o,p,f)=>{let m,_,w;if(void 0===o)return;let I="function"!=typeof o?async()=>Promise.resolve(o):o,k=!1,coalesceProvider=async o=>{_||(_=I(o));try{m=await _,w=!0,k=!1}finally{_=void 0}return m};return void 0===p?async o=>((!w||o?.forceRefresh)&&(m=await coalesceProvider(o)),m):async o=>((!w||o?.forceRefresh)&&(m=await coalesceProvider(o)),k||(f(m)?p(m)&&await coalesceProvider(o):k=!0),m)})(o.credentials,isIdentityExpired,doesIdentityRequireRefresh)),p||(p=o.credentialDefaultProvider?dist_es_normalizeProvider_normalizeProvider(o.credentialDefaultProvider(Object.assign({},o,{parentClientConfig:o}))):async()=>{throw Error("`credentials` is missing")});let{signingEscapePath:m=!0,systemClockOffset:_=o.systemClockOffset||0,sha256:w}=o;return f=o.signer?dist_es_normalizeProvider_normalizeProvider(o.signer):o.regionInfoProvider?()=>dist_es_normalizeProvider_normalizeProvider(o.region)().then(async p=>[await o.regionInfoProvider(p,{useFipsEndpoint:await o.useFipsEndpoint(),useDualstackEndpoint:await o.useDualstackEndpoint()})||{},p]).then(([f,_])=>{let{signingRegion:I,signingService:k}=f;o.signingRegion=o.signingRegion||I||_,o.signingName=o.signingName||k||o.serviceId;let M={...o,credentials:p,region:o.signingRegion,service:o.signingName,sha256:w,uriEscapePath:m};return new(o.signerConstructor||SignatureV4)(M)}):async f=>{let _=(f=Object.assign({},{name:"sigv4",signingName:o.signingName||o.defaultSigningName,signingRegion:await dist_es_normalizeProvider_normalizeProvider(o.region)(),properties:{}},f)).signingRegion,I=f.signingName;o.signingRegion=o.signingRegion||_,o.signingName=o.signingName||I||o.serviceId;let k={...o,credentials:p,region:o.signingRegion,service:o.signingName,sha256:w,uriEscapePath:m};return new(o.signerConstructor||SignatureV4)(k)},{...o,systemClockOffset:_,signingEscapePath:m,credentials:p,signer:f}})(o)}))((o=>{let p,f=o.tls??!0,{endpoint:m}=o,_={...o,endpoint:null!=m?async()=>toEndpointV1(await normalizeProvider_normalizeProvider(m)()):void 0,tls:f,isCustomEndpoint:!!m,useDualstackEndpoint:normalizeProvider_normalizeProvider(o.useDualstackEndpoint??!1),useFipsEndpoint:normalizeProvider_normalizeProvider(o.useFipsEndpoint??!1)};return _.serviceConfiguredEndpoint=async()=>(o.serviceId&&!p&&(p=getEndpointFromConfig(o.serviceId)),p),_})(resolveHostHeaderConfig((o=>{let{region:p,useFipsEndpoint:f}=o;if(!p)throw Error("Region is missing");return{...o,region:async()=>"string"==typeof p?getRealRegion(p):getRealRegion(await p()),useFipsEndpoint:async()=>!!isFipsRegion("string"==typeof p?p:await p())||("function"!=typeof f?Promise.resolve(!!f):f())}})((o=>{let{retryStrategy:p}=o,f=normalizeProvider_normalizeProvider(o.maxAttempts??3);return{...o,maxAttempts:f,retryStrategy:async()=>p||(await normalizeProvider_normalizeProvider(o.retryMode)()===eg.ADAPTIVE?new AdaptiveRetryStrategy(f):new StandardRetryStrategy(f))}})(resolveUserAgentConfig((o=>({...o,useDualstackEndpoint:o.useDualstackEndpoint??!1,useFipsEndpoint:o.useFipsEndpoint??!1,defaultSigningName:"chime"}))((o=>{let p=(({defaultsMode:o}={})=>{var p,f,m;let _,w,I,k,M;return p=async()=>{let p="function"==typeof o?await o():o;switch(p?.toLowerCase()){case"auto":let f,m;return Promise.resolve((f="u">typeof window&&window?.navigator?.userAgent?tE().parse(window.navigator.userAgent):void 0,"tablet"===(m=f?.platform?.type)||"mobile"===m)?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(p?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw Error(`Invalid parameter for "defaultsMode", expect ${tK.join(", ")}, got ${p}`)}},k=!1,M=async()=>{w||(w=p());try{_=await w,I=!0,k=!1}finally{w=void 0}return _},void 0===f?async o=>((!I||o?.forceRefresh)&&(_=await M()),_):async o=>((!I||o?.forceRefresh)&&(_=await M()),k||(m&&!m(_)?k=!0:f(_)&&await M()),_)})(o),defaultConfigProvider=()=>p().then(loadConfigsForDefaultMode),f={apiVersion:"2021-05-15",base64Decoder:o?.base64Decoder??fromBase64,base64Encoder:o?.base64Encoder??toBase64_browser_toBase64,disableHostPrefix:o?.disableHostPrefix??!1,endpointProvider:o?.endpointProvider??defaultEndpointResolver,extensions:o?.extensions??[],httpAuthSchemeProvider:o?.httpAuthSchemeProvider??defaultChimeSDKMessagingHttpAuthSchemeProvider,httpAuthSchemes:o?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:o=>o.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:o?.logger??new NoOpLogger,serviceId:o?.serviceId??"Chime SDK Messaging",urlParser:o?.urlParser??parseUrl,utf8Decoder:o?.utf8Decoder??fromUtf8,utf8Encoder:o?.utf8Encoder??toUtf8_browser_toUtf8};return{...f,...o,runtime:"browser",defaultsMode:p,bodyLengthChecker:o?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:o?.credentialDefaultProvider??(o=>()=>Promise.reject(Error("Credential is missing"))),defaultUserAgentProvider:o?.defaultUserAgentProvider??(({serviceId:o,clientVersion:p})=>async()=>{let f="u">typeof window&&window?.navigator?.userAgent?tE().parse(window.navigator.userAgent):void 0,m=[["aws-sdk-js",p],["ua","2.0"],[`os/${f?.os?.name||"other"}`,f?.os?.version],["lang/js"],["md/browser",`${f?.browser?.name??"unknown"}_${f?.browser?.version??"unknown"}`]];return o&&m.push([`api/${o}`,p]),m})({serviceId:f.serviceId,clientVersion:tc().version}),maxAttempts:o?.maxAttempts??3,region:o?.region??(()=>Promise.reject("Region is missing")),requestHandler:FetchHttpHandler.create(o?.requestHandler??defaultConfigProvider),retryMode:o?.retryMode??(async()=>(await defaultConfigProvider()).retryMode||eO),sha256:o?.sha256??tC,streamCollector:o?.streamCollector??stream_collector_streamCollector,useDualstackEndpoint:o?.useDualstackEndpoint??(()=>Promise.resolve(!1)),useFipsEndpoint:o?.useFipsEndpoint??(()=>Promise.resolve(!1))}})(o||{})))))))),o?.extensions||[]);super(p),this.config=p,this.middlewareStack.use((o=>({applyToStack:p=>{p.add((p,f)=>async m=>{let{request:_}=m;if(!httpRequest_HttpRequest.isInstance(_))return p(m);let{headers:w}=_,I=f?.userAgent?.map(escapeUserAgent)||[],k=(await o.defaultUserAgentProvider()).map(escapeUserAgent),M=o?.customUserAgent?.map(escapeUserAgent)||[],x=[].concat([...k,...I,...M]).join(" "),O=[...k.filter(o=>o.startsWith("aws-sdk-")),...M].join(" ");return"browser"!==o.runtime?(O&&(w[eC]=w[eC]?`${w[e_]} ${O}`:O),w[e_]=x):w[eC]=x,p({...m,request:_})},ew)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add((p,f)=>async m=>{let _,w=await o.retryStrategy(),I=await o.maxAttempts();if(void 0===(_=w).acquireInitialRetryToken||void 0===_.refreshRetryTokenForRetry||void 0===_.recordSuccess)return w?.mode&&(f.userAgent=[...f.userAgent||[],["cfg/retry-mode",w.mode]]),w.retry(p,m);{let o=await w.acquireInitialRetryToken(f.partition_id),_=Error(),k=0,M=0,{request:x}=m,O=httpRequest_HttpRequest.isInstance(x);for(O&&(x.headers["amz-sdk-invocation-id"]=esm_browser_v4());;)try{O&&(x.headers["amz-sdk-request"]=`attempt=${k+1}; max=${I}`);let{response:f,output:_}=await p(m);return w.recordSuccess(o),_.$metadata.attempts=k+1,_.$metadata.totalRetryDelay=M,{response:f,output:_}}catch(I){let p=getRetryErrorInfo(I);if(_=asSdkError(I),O&&isStreamingPayload(x))throw(f.logger instanceof NoOpLogger?console:f.logger)?.warn("An error was encountered in a non-retryable streaming request."),_;try{o=await w.refreshRetryTokenForRetry(o,p)}catch{throw _.$metadata||(_.$metadata={}),_.$metadata.attempts=k+1,_.$metadata.totalRetryDelay=M,_}k=o.getRetryCount();let m=o.getRetryDelay();M+=m,await new Promise(o=>setTimeout(o,m))}}},eX)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(contentLengthMiddleware(o.bodyLengthChecker),e0)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(p=>async f=>{if(!httpRequest_HttpRequest.isInstance(f.request))return p(f);let{request:m}=f,{handlerProtocol:_=""}=o.requestHandler.metadata||{};if(_.indexOf("h2")>=0&&!m.headers[":authority"])delete m.headers.host,m.headers[":authority"]=m.hostname+(m.port?":"+m.port:"");else if(!m.headers.host){let o=m.hostname;null!=m.port&&(o+=`:${m.port}`),m.headers.host=o}return p(f)},w)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:o=>{o.add((o,p)=>async f=>{try{let m=await o(f),{clientName:_,commandName:w,logger:I,dynamoDbDocumentClientOptions:k={}}=p,{overrideInputFilterSensitiveLog:M,overrideOutputFilterSensitiveLog:x}=k,O=M??p.inputFilterSensitiveLog,L=x??p.outputFilterSensitiveLog,{$metadata:B,...U}=m.output;return I?.info?.({clientName:_,commandName:w,input:O(f.input),output:L(U),metadata:B}),m}catch(M){let{clientName:o,commandName:m,logger:_,dynamoDbDocumentClientOptions:w={}}=p,{overrideInputFilterSensitiveLog:I}=w,k=I??p.inputFilterSensitiveLog;throw _?.error?.({clientName:o,commandName:m,input:k(f.input),error:M,metadata:M.$metadata}),M}},I)}}))(this.config)),this.middlewareStack.use((o=>({applyToStack:p=>{p.add(p=>async f=>{let{request:m}=f;if(!httpRequest_HttpRequest.isInstance(m)||"node"!==o.runtime||m.headers.hasOwnProperty(k))return p(f);let _,nonEmptyString=o=>"string"==typeof o&&o.length>0;return nonEmptyString(void 0)&&nonEmptyString(_)&&(m.headers[k]=_),p({...f,request:m})},M)}}))(this.config)),this.middlewareStack.use(((o,{httpAuthSchemeParametersProvider:p,identityProviderConfigProvider:f})=>({applyToStack:m=>{let _;m.addRelativeTo((_={httpAuthSchemeParametersProvider:p,identityProviderConfigProvider:f},(p,f)=>async m=>{let w=o.httpAuthSchemeProvider(await _.httpAuthSchemeParametersProvider(o,f,m.input)),I=convertHttpAuthSchemesToMap(o.httpAuthSchemes),k=getSmithyContext(f),M=[];for(let p of w){let m=I.get(p.schemeId);if(!m){M.push(`HttpAuthScheme \`${p.schemeId}\` was not enabled for this service.`);continue}let w=m.identityProvider(await _.identityProviderConfigProvider(o));if(!w){M.push(`HttpAuthScheme \`${p.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:x={},signingProperties:O={}}=p.propertiesExtractor?.(o,f)||{};p.identityProperties=Object.assign(p.identityProperties||{},x),p.signingProperties=Object.assign(p.signingProperties||{},O),k.selectedHttpAuthScheme={httpAuthOption:p,identity:await w(p.identityProperties),signer:m.signer};break}if(!k.selectedHttpAuthScheme)throw Error(M.join(`
`));return p(m)}),eR)}}))(this.config,{httpAuthSchemeParametersProvider:defaultChimeSDKMessagingHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async o=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":o.credentials})})),this.middlewareStack.use((o=>({applyToStack:o=>{o.addRelativeTo((o,p)=>async f=>{if(!httpRequest_HttpRequest.isInstance(f.request))return o(f);let m=getSmithyContext(p).selectedHttpAuthScheme;if(!m)throw Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:_={}},identity:w,signer:I}=m,k=await o({...f,request:await I.sign(f.request,w,_)}).catch((I.errorHandler||(o=>o=>{throw o}))(_));return(I.successHandler||((o,p)=>{}))(k.response,_),k},eQ)}}))(this.config))}destroy(){super.destroy()}};let parseJsonBody=(o,p)=>collect_stream_body_collectBody(o,p).then(o=>p.utf8Encoder(o)).then(o=>{if(o.length)try{return JSON.parse(o)}catch(p){throw p?.name==="SyntaxError"&&Object.defineProperty(p,"$responseBodyText",{value:o}),p}return{}}),parseJsonErrorBody=async(o,p)=>{let f=await parseJsonBody(o,p);return f.message=f.message??f.Message,f};let ChimeSDKMessagingServiceException=class ChimeSDKMessagingServiceException extends ServiceException{constructor(o){super(o),Object.setPrototypeOf(this,ChimeSDKMessagingServiceException.prototype)}};let tq={ALL:"ALL",FILTERED:"FILTERED",NONE:"NONE"},tJ={DEFAULT:"DEFAULT",HIDDEN:"HIDDEN"},tY={AccessDenied:"AccessDenied",BadRequest:"BadRequest",Conflict:"Conflict",Forbidden:"Forbidden",NotFound:"NotFound",PhoneNumberAssociationsExist:"PhoneNumberAssociationsExist",PreconditionFailed:"PreconditionFailed",ResourceLimitExceeded:"ResourceLimitExceeded",ServiceFailure:"ServiceFailure",ServiceUnavailable:"ServiceUnavailable",Throttled:"Throttled",Throttling:"Throttling",Unauthorized:"Unauthorized",Unprocessable:"Unprocessable",VoiceConnectorGroupAssociationsExist:"VoiceConnectorGroupAssociationsExist"};let BadRequestException=class BadRequestException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"BadRequestException",$fault:"client",...o}),this.name="BadRequestException",this.$fault="client",Object.setPrototypeOf(this,BadRequestException.prototype),this.Code=o.Code,this.Message=o.Message}};let ConflictException=class ConflictException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ConflictException",$fault:"client",...o}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,ConflictException.prototype),this.Code=o.Code,this.Message=o.Message}};let ForbiddenException=class ForbiddenException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ForbiddenException",$fault:"client",...o}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,ForbiddenException.prototype),this.Code=o.Code,this.Message=o.Message}};let NotFoundException=class NotFoundException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"NotFoundException",$fault:"client",...o}),this.name="NotFoundException",this.$fault="client",Object.setPrototypeOf(this,NotFoundException.prototype),this.Code=o.Code,this.Message=o.Message}};let ServiceFailureException=class ServiceFailureException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ServiceFailureException",$fault:"server",...o}),this.name="ServiceFailureException",this.$fault="server",Object.setPrototypeOf(this,ServiceFailureException.prototype),this.Code=o.Code,this.Message=o.Message}};let ServiceUnavailableException=class ServiceUnavailableException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ServiceUnavailableException",$fault:"server",...o}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,ServiceUnavailableException.prototype),this.Code=o.Code,this.Message=o.Message}};let ThrottledClientException=class ThrottledClientException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ThrottledClientException",$fault:"client",...o}),this.name="ThrottledClientException",this.$fault="client",Object.setPrototypeOf(this,ThrottledClientException.prototype),this.Code=o.Code,this.Message=o.Message}};let UnauthorizedClientException=class UnauthorizedClientException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"UnauthorizedClientException",$fault:"client",...o}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,UnauthorizedClientException.prototype),this.Code=o.Code,this.Message=o.Message}};let ResourceLimitExceededException=class ResourceLimitExceededException extends ChimeSDKMessagingServiceException{constructor(o){super({name:"ResourceLimitExceededException",$fault:"client",...o}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Code=o.Code,this.Message=o.Message}};let tX={CREATED_TIMESTAMP:"CREATED_TIMESTAMP",LAST_MESSAGE_TIMESTAMP:"LAST_MESSAGE_TIMESTAMP"},tQ={RESTRICTED:"RESTRICTED",UNRESTRICTED:"UNRESTRICTED"},tZ={PRIVATE:"PRIVATE",PUBLIC:"PUBLIC"},t0={ASYNC:"ASYNC"},t1={ABORT:"ABORT",CONTINUE:"CONTINUE"},t2={DEFAULT:"DEFAULT",VOIP:"VOIP"},t3={NON_PERSISTENT:"NON_PERSISTENT",PERSISTENT:"PERSISTENT"},t4={DENIED:"DENIED",FAILED:"FAILED",PENDING:"PENDING",SENT:"SENT"},t5={CONTROL:"CONTROL",STANDARD:"STANDARD"},t6={Channel:"Channel",ChannelMessage:"ChannelMessage"},t8={ASCENDING:"ASCENDING",DESCENDING:"DESCENDING"},t9={MEMBERS:"MEMBERS"},t7={EQUALS:"EQUALS",INCLUDES:"INCLUDES"},IdentityFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq}}),BatchChannelMembershipsFilterSensitiveLog=o=>({...o,...o.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(o.InvitedBy)},...o.Members&&{Members:o.Members.map(o=>IdentityFilterSensitiveLog(o))}}),BatchCreateChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.BatchChannelMemberships&&{BatchChannelMemberships:BatchChannelMembershipsFilterSensitiveLog(o.BatchChannelMemberships)}}),ChannelFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelAssociatedWithFlowSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),ChannelBanFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelBanSummaryFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ProcessorFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq}}),ChannelFlowFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq}}),MessageAttributeValueFilterSensitiveLog=o=>({...o,...o.StringValues&&{StringValues:eq}}),PushNotificationConfigurationFilterSensitiveLog=o=>({...o,...o.Title&&{Title:eq},...o.Body&&{Body:eq}}),ChannelMessageCallbackFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(o.PushNotification)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelFlowCallbackRequestFilterSensitiveLog=o=>({...o,...o.ChannelMessage&&{ChannelMessage:ChannelMessageCallbackFilterSensitiveLog(o.ChannelMessage)}}),ChannelFlowSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))}}),ChannelMembershipFilterSensitiveLog=o=>({...o,...o.InvitedBy&&{InvitedBy:IdentityFilterSensitiveLog(o.InvitedBy)},...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ChannelSummaryFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog=o=>({...o,...o.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(o.ChannelSummary)}}),PushNotificationPreferencesFilterSensitiveLog=o=>({...o,...o.FilterRule&&{FilterRule:eq}}),ChannelMembershipPreferencesFilterSensitiveLog=o=>({...o,...o.PushNotifications&&{PushNotifications:PushNotificationPreferencesFilterSensitiveLog(o.PushNotifications)}}),ChannelMembershipSummaryFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),ChannelMessageFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.Sender&&{Sender:IdentityFilterSensitiveLog(o.Sender)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelMessageSummaryFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.Sender&&{Sender:IdentityFilterSensitiveLog(o.Sender)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog=o=>({...o,...o.ChannelSummary&&{ChannelSummary:ChannelSummaryFilterSensitiveLog(o.ChannelSummary)}}),ChannelModeratorFilterSensitiveLog=o=>({...o,...o.Moderator&&{Moderator:IdentityFilterSensitiveLog(o.Moderator)},...o.CreatedBy&&{CreatedBy:IdentityFilterSensitiveLog(o.CreatedBy)}}),ChannelModeratorSummaryFilterSensitiveLog=o=>({...o,...o.Moderator&&{Moderator:IdentityFilterSensitiveLog(o.Moderator)}}),TagFilterSensitiveLog=o=>({...o,...o.Key&&{Key:eq},...o.Value&&{Value:eq}}),CreateChannelRequestFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq},...o.ClientRequestToken&&{ClientRequestToken:eq},...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))},...o.ChannelId&&{ChannelId:eq}}),CreateChannelBanResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),CreateChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq},...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))},...o.ClientRequestToken&&{ClientRequestToken:eq}}),CreateChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)}}),CreateChannelModeratorResponseFilterSensitiveLog=o=>({...o,...o.ChannelModerator&&{ChannelModerator:IdentityFilterSensitiveLog(o.ChannelModerator)}}),DescribeChannelResponseFilterSensitiveLog=o=>({...o,...o.Channel&&{Channel:ChannelFilterSensitiveLog(o.Channel)}}),DescribeChannelBanResponseFilterSensitiveLog=o=>({...o,...o.ChannelBan&&{ChannelBan:ChannelBanFilterSensitiveLog(o.ChannelBan)}}),DescribeChannelFlowResponseFilterSensitiveLog=o=>({...o,...o.ChannelFlow&&{ChannelFlow:ChannelFlowFilterSensitiveLog(o.ChannelFlow)}}),DescribeChannelMembershipResponseFilterSensitiveLog=o=>({...o,...o.ChannelMembership&&{ChannelMembership:ChannelMembershipFilterSensitiveLog(o.ChannelMembership)}}),DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.ChannelMembership&&{ChannelMembership:ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(o.ChannelMembership)}}),DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.Channel&&{Channel:ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(o.Channel)}}),DescribeChannelModeratorResponseFilterSensitiveLog=o=>({...o,...o.ChannelModerator&&{ChannelModerator:ChannelModeratorFilterSensitiveLog(o.ChannelModerator)}}),GetChannelMembershipPreferencesResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),GetChannelMessageResponseFilterSensitiveLog=o=>({...o,...o.ChannelMessage&&{ChannelMessage:ChannelMessageFilterSensitiveLog(o.ChannelMessage)}}),ListChannelBansRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelBansResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelBans&&{ChannelBans:o.ChannelBans.map(o=>ChannelBanSummaryFilterSensitiveLog(o))}}),ListChannelFlowsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelFlowsResponseFilterSensitiveLog=o=>({...o,...o.ChannelFlows&&{ChannelFlows:o.ChannelFlows.map(o=>ChannelFlowSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsResponseFilterSensitiveLog=o=>({...o,...o.ChannelMemberships&&{ChannelMemberships:o.ChannelMemberships.map(o=>ChannelMembershipSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.ChannelMemberships&&{ChannelMemberships:o.ChannelMemberships.map(o=>ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelMessagesRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelMessagesResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelMessages&&{ChannelMessages:o.ChannelMessages.map(o=>ChannelMessageSummaryFilterSensitiveLog(o))}}),ListChannelModeratorsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelModeratorsResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq},...o.ChannelModerators&&{ChannelModerators:o.ChannelModerators.map(o=>ChannelModeratorSummaryFilterSensitiveLog(o))}}),ListChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelAssociatedWithFlowSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),ListSubChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListSubChannelsResponseFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),ListTagsForResourceResponseFilterSensitiveLog=o=>({...o,...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))}}),PutChannelMembershipPreferencesRequestFilterSensitiveLog=o=>({...o,...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),PutChannelMembershipPreferencesResponseFilterSensitiveLog=o=>({...o,...o.Member&&{Member:IdentityFilterSensitiveLog(o.Member)},...o.Preferences&&{Preferences:ChannelMembershipPreferencesFilterSensitiveLog(o.Preferences)}}),SearchChannelsRequestFilterSensitiveLog=o=>({...o,...o.NextToken&&{NextToken:eq}}),SearchChannelsResponseFilterSensitiveLog=o=>({...o,...o.Channels&&{Channels:o.Channels.map(o=>ChannelSummaryFilterSensitiveLog(o))},...o.NextToken&&{NextToken:eq}}),SendChannelMessageRequestFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.ClientRequestToken&&{ClientRequestToken:eq},...o.PushNotification&&{PushNotification:PushNotificationConfigurationFilterSensitiveLog(o.PushNotification)},...o.MessageAttributes&&{MessageAttributes:Object.entries(o.MessageAttributes).reduce((o,[p,f])=>(o[p]=MessageAttributeValueFilterSensitiveLog(f),o),{})},...o.ContentType&&{ContentType:eq}}),TagResourceRequestFilterSensitiveLog=o=>({...o,...o.Tags&&{Tags:o.Tags.map(o=>TagFilterSensitiveLog(o))}}),UntagResourceRequestFilterSensitiveLog=o=>({...o,...o.TagKeys&&{TagKeys:eq}}),UpdateChannelRequestFilterSensitiveLog=o=>({...o,...o.Name&&{Name:eq},...o.Metadata&&{Metadata:eq}}),UpdateChannelFlowRequestFilterSensitiveLog=o=>({...o,...o.Processors&&{Processors:o.Processors.map(o=>ProcessorFilterSensitiveLog(o))},...o.Name&&{Name:eq}}),UpdateChannelMessageRequestFilterSensitiveLog=o=>({...o,...o.Content&&{Content:eq},...o.Metadata&&{Metadata:eq},...o.ContentType&&{ContentType:eq}}),se_AssociateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/channel-flow"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ChannelFlowArn:[]})),m.m("PUT").h(_).b(f),m.build()},se_BatchCreateChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iw]:[,"batch-create"]});return f=JSON.stringify(take(o,{MemberArns:o=>_json(o),SubChannelId:[],Type:[]})),m.m("POST").h(_).q(w).b(f),m.build()},se_ChannelFlowCallbackCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let _=map({[iw]:[,"channel-flow-callback"]});return f=JSON.stringify(take(o,{CallbackId:[!0,o=>o??esm_browser_v4()],ChannelMessage:o=>_json(o),DeleteResource:[]})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_CreateChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels"),f=JSON.stringify(take(o,{AppInstanceArn:[],ChannelId:[],ClientRequestToken:[!0,o=>o??esm_browser_v4()],ElasticChannelConfiguration:o=>_json(o),ExpirationSettings:o=>_json(o),MemberArns:o=>_json(o),Metadata:[],Mode:[],ModeratorArns:o=>_json(o),Name:[],Privacy:[],Tags:o=>_json(o)})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{MemberArn:[]})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows"),f=JSON.stringify(take(o,{AppInstanceArn:[],ClientRequestToken:[!0,o=>o??esm_browser_v4()],Name:[],Processors:o=>_json(o),Tags:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).b(f),m.build()},se_CreateChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{MemberArn:[],SubChannelId:[],Type:[]})),m.m("POST").h(_).b(f),m.build()},se_CreateChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ChannelModeratorArn:[]})),m.m("POST").h(_).b(f),m.build()},se_DeleteChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("DELETE").h({}).b(f),m.build()},se_DeleteChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1);let w=map({[ik]:[,o[ip]]});return m.m("DELETE").h(_).q(w).b(f),m.build()},se_DeleteChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[ik]:[,o[ip]]});return m.m("DELETE").h(_).q(w).b(f),m.build()},se_DeleteChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelModeratorArn",()=>o.ChannelModeratorArn,"{ChannelModeratorArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_DeleteMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),m.m("DELETE").h({}).b(f),m.build()},se_DescribeChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DescribeChannelBanCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/bans/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DescribeChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("GET").h({}).b(f),m.build()},se_DescribeChannelMembershipCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships/{MemberArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1);let w=map({[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelMembershipForAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iA]:[,"app-instance-user-membership"],[ib]:[,expectNonNull(o[ii],"AppInstanceUserArn")]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelModeratedByAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iA]:[,"app-instance-user-moderated-channel"],[ib]:[,expectNonNull(o[ii],"AppInstanceUserArn")]});return m.m("GET").h(_).q(w).b(f),m.build()},se_DescribeChannelModeratorCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelModeratorArn",()=>o.ChannelModeratorArn,"{ChannelModeratorArn}",!1),m.m("GET").h(_).b(f),m.build()},se_DisassociateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),m.m("DELETE").h(_).b(f),m.build()},se_GetChannelMembershipPreferencesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),m.m("GET").h(_).b(f),m.build()},se_GetChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_GetChannelMessageStatusCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[iA]:[,"message-status"],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_GetMessagingSessionEndpointCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/endpoints/messaging-session"),m.m("GET").h({}).b(f),m.build()},se_GetMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),m.m("GET").h({}).b(f),m.build()},se_ListChannelBansCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/bans"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelFlowsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channel-flows");let _=map({[iv]:[,expectNonNull(o[ie],"AppInstanceArn")],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h({}).q(_).b(f),m.build()},se_ListChannelMembershipsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/memberships"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[ix]:[,o[ig]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelMembershipsForAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iA]:[,"app-instance-user-memberships"],[ib]:[,o[ii]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelMessagesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[iM]:[,o[im]],[iT]:[()=>void 0!==o.NotBefore,()=>serializeDateTime(o[id]).toString()],[iC]:[()=>void 0!==o.NotAfter,()=>serializeDateTime(o[il]).toString()],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]],[ik]:[,o[ip]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelModeratorsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/moderators"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iv]:[,expectNonNull(o[ie],"AppInstanceArn")],[iI]:[,o[iu]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListChannelsAssociatedWithChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/channels");let _=map({[iA]:[,"channel-flow-associations"],[iy]:[,expectNonNull(o[io],"ChannelFlowArn")],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h({}).q(_).b(f),m.build()},se_ListChannelsModeratedByAppInstanceUserCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels");let w=map({[iA]:[,"app-instance-user-moderated-channels"],[ib]:[,o[ii]],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListSubChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});m.bp("/channels/{ChannelArn}/subchannels"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1);let w=map({[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return m.m("GET").h(_).q(w).b(f),m.build()},se_ListTagsForResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iS]:[,expectNonNull(o[ih],"ResourceARN")]});return m.m("GET").h({}).q(_).b(f),m.build()},se_PutChannelExpirationSettingsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/expiration-settings"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ExpirationSettings:o=>_json(o)})),m.m("PUT").h(_).b(f),m.build()},se_PutChannelMembershipPreferencesCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/memberships/{MemberArn}/preferences"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MemberArn",()=>o.MemberArn,"{MemberArn}",!1),f=JSON.stringify(take(o,{Preferences:o=>_json(o)})),m.m("PUT").h(_).b(f),m.build()},se_PutMessagingStreamingConfigurationsCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/app-instances/{AppInstanceArn}/streaming-configurations"),m.p("AppInstanceArn",()=>o.AppInstanceArn,"{AppInstanceArn}",!1),f=JSON.stringify(take(o,{StreamingConfigurations:o=>_json(o)})),m.m("PUT").h({"content-type":"application/json"}).b(f),m.build()},se_RedactChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1);let w=map({[iw]:[,"redact"]});return f=JSON.stringify(take(o,{SubChannelId:[]})),m.m("POST").h(_).q(w).b(f),m.build()},se_SearchChannelsCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});m.bp("/channels");let w=map({[iw]:[,"search"],[i_]:[()=>void 0!==o.MaxResults,()=>o[ia].toString()],[iE]:[,o[ic]]});return f=JSON.stringify(take(o,{Fields:o=>_json(o)})),m.m("POST").h(_).q(w).b(f),m.build()},se_SendChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/messages"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{ClientRequestToken:[!0,o=>o??esm_browser_v4()],Content:[],ContentType:[],MessageAttributes:o=>_json(o),Metadata:[],Persistence:[],PushNotification:o=>_json(o),SubChannelId:[],Target:o=>_json(o),Type:[]})),m.m("POST").h(_).b(f),m.build()},se_TagResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iw]:[,"tag-resource"]});return f=JSON.stringify(take(o,{ResourceARN:[],Tags:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_UntagResourceCommand=async(o,p)=>{let f,m=requestBuilder(o,p);m.bp("/tags");let _=map({[iw]:[,"untag-resource"]});return f=JSON.stringify(take(o,{ResourceARN:[],TagKeys:o=>_json(o)})),m.m("POST").h({"content-type":"application/json"}).q(_).b(f),m.build()},se_UpdateChannelCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),f=JSON.stringify(take(o,{Metadata:[],Mode:[],Name:[]})),m.m("PUT").h(_).b(f),m.build()},se_UpdateChannelFlowCommand=async(o,p)=>{let f,m=requestBuilder(o,p);return m.bp("/channel-flows/{ChannelFlowArn}"),m.p("ChannelFlowArn",()=>o.ChannelFlowArn,"{ChannelFlowArn}",!1),f=JSON.stringify(take(o,{Name:[],Processors:o=>_json(o)})),m.m("PUT").h({"content-type":"application/json"}).b(f),m.build()},se_UpdateChannelMessageCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{"content-type":"application/json",[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/messages/{MessageId}"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.p("MessageId",()=>o.MessageId,"{MessageId}",!1),f=JSON.stringify(take(o,{Content:[],ContentType:[],Metadata:[],SubChannelId:[]})),m.m("PUT").h(_).b(f),m.build()},se_UpdateChannelReadMarkerCommand=async(o,p)=>{let f,m=requestBuilder(o,p),_=map({},isSerializableHeaderValue,{[iP]:o[ir]});return m.bp("/channels/{ChannelArn}/readMarker"),m.p("ChannelArn",()=>o.ChannelArn,"{ChannelArn}",!1),m.m("PUT").h(_).b(f),m.build()},de_AssociateChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_BatchCreateChannelMembershipCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{BatchChannelMemberships:_json,Errors:_json})),f},de_ChannelFlowCallbackCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{CallbackId:expectString,ChannelArn:expectString})),f},de_CreateChannelCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_CreateChannelBanCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json})),f},de_CreateChannelFlowCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlowArn:expectString})),f},de_CreateChannelMembershipCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,SubChannelId:expectString})),f},de_CreateChannelModeratorCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelModerator:_json})),f},de_DeleteChannelCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelBanCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelFlowCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelMembershipCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelMessageCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteChannelModeratorCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DeleteMessagingStreamingConfigurationsCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_DescribeChannelCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channel:o=>de_Channel(o,p)})),f},de_DescribeChannelBanCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelBan:o=>de_ChannelBan(o,p)})),f},de_DescribeChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlow:o=>de_ChannelFlow(o,p)})),f},de_DescribeChannelMembershipCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMembership:o=>de_ChannelMembership(o,p)})),f},de_DescribeChannelMembershipForAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMembership:o=>de_ChannelMembershipForAppInstanceUserSummary(o,p)})),f},de_DescribeChannelModeratedByAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channel:o=>de_ChannelModeratedByAppInstanceUserSummary(o,p)})),f},de_DescribeChannelModeratorCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelModerator:o=>de_ChannelModerator(o,p)})),f},de_DisassociateChannelFlowCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_GetChannelMembershipPreferencesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,Preferences:_json})),f},de_GetChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMessage:o=>de_ChannelMessage(o,p)})),f},de_GetChannelMessageStatusCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Status:_json})),f},de_GetMessagingSessionEndpointCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Endpoint:_json})),f},de_GetMessagingStreamingConfigurationsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{StreamingConfigurations:_json})),f},de_ListChannelBansCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelBans:_json,NextToken:expectString})),f},de_ListChannelFlowsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlows:_json,NextToken:expectString})),f},de_ListChannelMembershipsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelMemberships:_json,NextToken:expectString})),f},de_ListChannelMembershipsForAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelMemberships:o=>de_ChannelMembershipForAppInstanceUserSummaryList(o,p),NextToken:expectString})),f},de_ListChannelMessagesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelMessages:o=>de_ChannelMessageSummaryList(o,p),NextToken:expectString,SubChannelId:expectString})),f},de_ListChannelModeratorsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ChannelModerators:_json,NextToken:expectString})),f},de_ListChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelSummaryList(o,p),NextToken:expectString})),f},de_ListChannelsAssociatedWithChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:_json,NextToken:expectString})),f},de_ListChannelsModeratedByAppInstanceUserCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelModeratedByAppInstanceUserSummaryList(o,p),NextToken:expectString})),f},de_ListSubChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,NextToken:expectString,SubChannels:_json})),f},de_ListTagsForResourceCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Tags:_json})),f},de_PutChannelExpirationSettingsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,ExpirationSettings:_json})),f},de_PutChannelMembershipPreferencesCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,Member:_json,Preferences:_json})),f},de_PutMessagingStreamingConfigurationsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{StreamingConfigurations:_json})),f},de_RedactChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,SubChannelId:expectString})),f},de_SearchChannelsCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{Channels:o=>de_ChannelSummaryList(o,p),NextToken:expectString})),f},de_SendChannelMessageCommand=async(o,p)=>{if(201!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString})),f},de_TagResourceCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_UntagResourceCommand=async(o,p)=>{if(204!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return await collect_stream_body_collectBody(o.body,p),f},de_UpdateChannelCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_UpdateChannelFlowCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelFlowArn:expectString})),f},de_UpdateChannelMessageCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString,MessageId:expectString,Status:_json,SubChannelId:expectString})),f},de_UpdateChannelReadMarkerCommand=async(o,p)=>{if(200!==o.statusCode&&o.statusCode>=300)return de_CommandError(o,p);let f=map({$metadata:Aws_restJson1_deserializeMetadata(o)});return Object.assign(f,take(expectNonNull(expectObject(await parseJsonBody(o.body,p)),"body"),{ChannelArn:expectString})),f},de_CommandError=async(o,p)=>{var f,m;let _,w,I={...o,body:await parseJsonErrorBody(o.body,p)},k=(f=o,m=I.body,_=o=>{let p=o;return"number"==typeof p&&(p=p.toString()),p.indexOf(",")>=0&&(p=p.split(",")[0]),p.indexOf(":")>=0&&(p=p.split(":")[0]),p.indexOf("#")>=0&&(p=p.split("#")[1]),p},void 0!==(w=Object.keys(f.headers).find(o=>"x-amzn-errortype"===o.toLowerCase()))?_(f.headers[w]):void 0!==m.code?_(m.code):void 0!==m.__type?_(m.__type):void 0);switch(k){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await de_BadRequestExceptionRes(I,p);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await de_ConflictExceptionRes(I,p);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await de_ForbiddenExceptionRes(I,p);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await de_NotFoundExceptionRes(I,p);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await de_ServiceFailureExceptionRes(I,p);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await de_ServiceUnavailableExceptionRes(I,p);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await de_ThrottledClientExceptionRes(I,p);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await de_UnauthorizedClientExceptionRes(I,p);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(I,p);default:return Aws_restJson1_throwDefaultError({output:o,parsedBody:I.body,errorCode:k})}},Aws_restJson1_throwDefaultError=({output:o,parsedBody:p,errorCode:f})=>{(({output:o,parsedBody:p,exceptionCtor:f,errorCode:m})=>{let _,w={httpStatusCode:(_=o).statusCode,requestId:_.headers["x-amzn-requestid"]??_.headers["x-amzn-request-id"]??_.headers["x-amz-request-id"],extendedRequestId:_.headers["x-amz-id-2"],cfId:_.headers["x-amz-cf-id"]},I=w.httpStatusCode?w.httpStatusCode+"":void 0;throw decorateServiceException(new f({name:p?.code||p?.Code||m||I||"UnknownError",$fault:"client",$metadata:w}),p)})({output:o,parsedBody:p,exceptionCtor:ChimeSDKMessagingServiceException,errorCode:f})},de_BadRequestExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new BadRequestException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ConflictExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ConflictException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ForbiddenExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ForbiddenException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_NotFoundExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new NotFoundException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ResourceLimitExceededExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ResourceLimitExceededException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ServiceFailureExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ServiceFailureException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ServiceUnavailableExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ServiceUnavailableException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_ThrottledClientExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new ThrottledClientException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_UnauthorizedClientExceptionRes=async(o,p)=>{let f=map({});return Object.assign(f,take(o.body,{Code:expectString,Message:expectString})),decorateServiceException(new UnauthorizedClientException({$metadata:Aws_restJson1_deserializeMetadata(o),...f}),o.body)},de_Channel=(o,p)=>take(o,{ChannelArn:expectString,ChannelFlowArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),ElasticChannelConfiguration:_json,ExpirationSettings:_json,LastMessageTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelBan=(o,p)=>take(o,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Member:_json}),de_ChannelFlow=(o,p)=>take(o,{ChannelFlowArn:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Name:expectString,Processors:_json}),de_ChannelMembership=(o,p)=>take(o,{ChannelArn:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),InvitedBy:_json,LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Member:_json,SubChannelId:expectString,Type:expectString}),de_ChannelMembershipForAppInstanceUserSummary=(o,p)=>take(o,{AppInstanceUserMembershipSummary:o=>take(o,{ReadMarkerTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),SubChannelId:expectString,Type:expectString}),ChannelSummary:o=>de_ChannelSummary(o,p)}),de_ChannelMembershipForAppInstanceUserSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelMembershipForAppInstanceUserSummary(o,p)),de_ChannelMessage=(o,p)=>take(o,{ChannelArn:expectString,Content:expectString,ContentType:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastEditedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Persistence:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,SubChannelId:expectString,Target:_json,Type:expectString}),de_ChannelMessageSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>take(o,{Content:expectString,ContentType:expectString,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastEditedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),LastUpdatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),MessageAttributes:_json,MessageId:expectString,Metadata:expectString,Redacted:expectBoolean,Sender:_json,Status:_json,Target:_json,Type:expectString})),de_ChannelModeratedByAppInstanceUserSummary=(o,p)=>take(o,{ChannelSummary:o=>de_ChannelSummary(o,p)}),de_ChannelModeratedByAppInstanceUserSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelModeratedByAppInstanceUserSummary(o,p)),de_ChannelModerator=(o,p)=>take(o,{ChannelArn:expectString,CreatedBy:_json,CreatedTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Moderator:_json}),de_ChannelSummary=(o,p)=>take(o,{ChannelArn:expectString,LastMessageTimestamp:o=>expectNonNull(parseEpochTimestamp(expectNumber(o))),Metadata:expectString,Mode:expectString,Name:expectString,Privacy:expectString}),de_ChannelSummaryList=(o,p)=>(o||[]).filter(o=>null!=o).map(o=>de_ChannelSummary(o,p)),Aws_restJson1_deserializeMetadata=o=>({httpStatusCode:o.statusCode,requestId:o.headers["x-amzn-requestid"]??o.headers["x-amzn-request-id"]??o.headers["x-amz-request-id"],extendedRequestId:o.headers["x-amz-id-2"],cfId:o.headers["x-amz-cf-id"]}),ie="AppInstanceArn",ii="AppInstanceUserArn",ir="ChimeBearer",io="ChannelFlowArn",ia="MaxResults",il="NotAfter",id="NotBefore",ic="NextToken",iu="Privacy",ih="ResourceARN",ip="SubChannelId",im="SortOrder",ig="Type",iS="arn",iv="app-instance-arn",ib="app-instance-user-arn",iy="channel-flow-arn",i_="max-results",iC="not-after",iT="not-before",iE="next-token",iw="operation",iI="privacy",iA="scope",ik="sub-channel-id",iM="sort-order",ix="type",iP="x-amz-chime-bearer";let AssociateChannelFlowCommand=class AssociateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","AssociateChannelFlow",{}).n("ChimeSDKMessagingClient","AssociateChannelFlowCommand").f(void 0,void 0).ser(se_AssociateChannelFlowCommand).de(de_AssociateChannelFlowCommand).build(){};let BatchCreateChannelMembershipCommand=class BatchCreateChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","BatchCreateChannelMembership",{}).n("ChimeSDKMessagingClient","BatchCreateChannelMembershipCommand").f(void 0,BatchCreateChannelMembershipResponseFilterSensitiveLog).ser(se_BatchCreateChannelMembershipCommand).de(de_BatchCreateChannelMembershipCommand).build(){};let ChannelFlowCallbackCommand=class ChannelFlowCallbackCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ChannelFlowCallback",{}).n("ChimeSDKMessagingClient","ChannelFlowCallbackCommand").f(ChannelFlowCallbackRequestFilterSensitiveLog,void 0).ser(se_ChannelFlowCallbackCommand).de(de_ChannelFlowCallbackCommand).build(){};let CreateChannelBanCommand=class CreateChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelBan",{}).n("ChimeSDKMessagingClient","CreateChannelBanCommand").f(void 0,CreateChannelBanResponseFilterSensitiveLog).ser(se_CreateChannelBanCommand).de(de_CreateChannelBanCommand).build(){};let CreateChannelCommand=class CreateChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannel",{}).n("ChimeSDKMessagingClient","CreateChannelCommand").f(CreateChannelRequestFilterSensitiveLog,void 0).ser(se_CreateChannelCommand).de(de_CreateChannelCommand).build(){};let CreateChannelFlowCommand=class CreateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelFlow",{}).n("ChimeSDKMessagingClient","CreateChannelFlowCommand").f(CreateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_CreateChannelFlowCommand).de(de_CreateChannelFlowCommand).build(){};let CreateChannelMembershipCommand=class CreateChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelMembership",{}).n("ChimeSDKMessagingClient","CreateChannelMembershipCommand").f(void 0,CreateChannelMembershipResponseFilterSensitiveLog).ser(se_CreateChannelMembershipCommand).de(de_CreateChannelMembershipCommand).build(){};let CreateChannelModeratorCommand=class CreateChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","CreateChannelModerator",{}).n("ChimeSDKMessagingClient","CreateChannelModeratorCommand").f(void 0,CreateChannelModeratorResponseFilterSensitiveLog).ser(se_CreateChannelModeratorCommand).de(de_CreateChannelModeratorCommand).build(){};let DeleteChannelBanCommand=class DeleteChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelBan",{}).n("ChimeSDKMessagingClient","DeleteChannelBanCommand").f(void 0,void 0).ser(se_DeleteChannelBanCommand).de(de_DeleteChannelBanCommand).build(){};let DeleteChannelCommand=class DeleteChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannel",{}).n("ChimeSDKMessagingClient","DeleteChannelCommand").f(void 0,void 0).ser(se_DeleteChannelCommand).de(de_DeleteChannelCommand).build(){};let DeleteChannelFlowCommand=class DeleteChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelFlow",{}).n("ChimeSDKMessagingClient","DeleteChannelFlowCommand").f(void 0,void 0).ser(se_DeleteChannelFlowCommand).de(de_DeleteChannelFlowCommand).build(){};let DeleteChannelMembershipCommand=class DeleteChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMembership",{}).n("ChimeSDKMessagingClient","DeleteChannelMembershipCommand").f(void 0,void 0).ser(se_DeleteChannelMembershipCommand).de(de_DeleteChannelMembershipCommand).build(){};let DeleteChannelMessageCommand=class DeleteChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelMessage",{}).n("ChimeSDKMessagingClient","DeleteChannelMessageCommand").f(void 0,void 0).ser(se_DeleteChannelMessageCommand).de(de_DeleteChannelMessageCommand).build(){};let DeleteChannelModeratorCommand=class DeleteChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteChannelModerator",{}).n("ChimeSDKMessagingClient","DeleteChannelModeratorCommand").f(void 0,void 0).ser(se_DeleteChannelModeratorCommand).de(de_DeleteChannelModeratorCommand).build(){};let DeleteMessagingStreamingConfigurationsCommand=class DeleteMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DeleteMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","DeleteMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_DeleteMessagingStreamingConfigurationsCommand).de(de_DeleteMessagingStreamingConfigurationsCommand).build(){};let DescribeChannelBanCommand=class DescribeChannelBanCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelBan",{}).n("ChimeSDKMessagingClient","DescribeChannelBanCommand").f(void 0,DescribeChannelBanResponseFilterSensitiveLog).ser(se_DescribeChannelBanCommand).de(de_DescribeChannelBanCommand).build(){};let DescribeChannelCommand=class DescribeChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannel",{}).n("ChimeSDKMessagingClient","DescribeChannelCommand").f(void 0,DescribeChannelResponseFilterSensitiveLog).ser(se_DescribeChannelCommand).de(de_DescribeChannelCommand).build(){};let DescribeChannelFlowCommand=class DescribeChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelFlow",{}).n("ChimeSDKMessagingClient","DescribeChannelFlowCommand").f(void 0,DescribeChannelFlowResponseFilterSensitiveLog).ser(se_DescribeChannelFlowCommand).de(de_DescribeChannelFlowCommand).build(){};let DescribeChannelMembershipCommand=class DescribeChannelMembershipCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembership",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipCommand").f(void 0,DescribeChannelMembershipResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipCommand).de(de_DescribeChannelMembershipCommand).build(){};let DescribeChannelMembershipForAppInstanceUserCommand=class DescribeChannelMembershipForAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelMembershipForAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelMembershipForAppInstanceUserCommand").f(void 0,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelMembershipForAppInstanceUserCommand).de(de_DescribeChannelMembershipForAppInstanceUserCommand).build(){};let DescribeChannelModeratedByAppInstanceUserCommand=class DescribeChannelModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratedByAppInstanceUserCommand").f(void 0,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_DescribeChannelModeratedByAppInstanceUserCommand).de(de_DescribeChannelModeratedByAppInstanceUserCommand).build(){};let DescribeChannelModeratorCommand=class DescribeChannelModeratorCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DescribeChannelModerator",{}).n("ChimeSDKMessagingClient","DescribeChannelModeratorCommand").f(void 0,DescribeChannelModeratorResponseFilterSensitiveLog).ser(se_DescribeChannelModeratorCommand).de(de_DescribeChannelModeratorCommand).build(){};let DisassociateChannelFlowCommand=class DisassociateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","DisassociateChannelFlow",{}).n("ChimeSDKMessagingClient","DisassociateChannelFlowCommand").f(void 0,void 0).ser(se_DisassociateChannelFlowCommand).de(de_DisassociateChannelFlowCommand).build(){};let GetChannelMembershipPreferencesCommand=class GetChannelMembershipPreferencesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","GetChannelMembershipPreferencesCommand").f(void 0,GetChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_GetChannelMembershipPreferencesCommand).de(de_GetChannelMembershipPreferencesCommand).build(){};let GetChannelMessageCommand=class GetChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessage",{}).n("ChimeSDKMessagingClient","GetChannelMessageCommand").f(void 0,GetChannelMessageResponseFilterSensitiveLog).ser(se_GetChannelMessageCommand).de(de_GetChannelMessageCommand).build(){};let GetChannelMessageStatusCommand=class GetChannelMessageStatusCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetChannelMessageStatus",{}).n("ChimeSDKMessagingClient","GetChannelMessageStatusCommand").f(void 0,void 0).ser(se_GetChannelMessageStatusCommand).de(de_GetChannelMessageStatusCommand).build(){};let GetMessagingSessionEndpointCommand=class GetMessagingSessionEndpointCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingSessionEndpoint",{}).n("ChimeSDKMessagingClient","GetMessagingSessionEndpointCommand").f(void 0,void 0).ser(se_GetMessagingSessionEndpointCommand).de(de_GetMessagingSessionEndpointCommand).build(){};let GetMessagingStreamingConfigurationsCommand=class GetMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","GetMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","GetMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_GetMessagingStreamingConfigurationsCommand).de(de_GetMessagingStreamingConfigurationsCommand).build(){};let ListChannelBansCommand=class ListChannelBansCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelBans",{}).n("ChimeSDKMessagingClient","ListChannelBansCommand").f(ListChannelBansRequestFilterSensitiveLog,ListChannelBansResponseFilterSensitiveLog).ser(se_ListChannelBansCommand).de(de_ListChannelBansCommand).build(){};let ListChannelFlowsCommand=class ListChannelFlowsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelFlows",{}).n("ChimeSDKMessagingClient","ListChannelFlowsCommand").f(ListChannelFlowsRequestFilterSensitiveLog,ListChannelFlowsResponseFilterSensitiveLog).ser(se_ListChannelFlowsCommand).de(de_ListChannelFlowsCommand).build(){};let ListChannelMembershipsCommand=class ListChannelMembershipsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMemberships",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsCommand").f(ListChannelMembershipsRequestFilterSensitiveLog,ListChannelMembershipsResponseFilterSensitiveLog).ser(se_ListChannelMembershipsCommand).de(de_ListChannelMembershipsCommand).build(){};let ListChannelMembershipsForAppInstanceUserCommand=class ListChannelMembershipsForAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMembershipsForAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelMembershipsForAppInstanceUserCommand").f(ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelMembershipsForAppInstanceUserCommand).de(de_ListChannelMembershipsForAppInstanceUserCommand).build(){};let ListChannelMessagesCommand=class ListChannelMessagesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelMessages",{}).n("ChimeSDKMessagingClient","ListChannelMessagesCommand").f(ListChannelMessagesRequestFilterSensitiveLog,ListChannelMessagesResponseFilterSensitiveLog).ser(se_ListChannelMessagesCommand).de(de_ListChannelMessagesCommand).build(){};let ListChannelModeratorsCommand=class ListChannelModeratorsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelModerators",{}).n("ChimeSDKMessagingClient","ListChannelModeratorsCommand").f(ListChannelModeratorsRequestFilterSensitiveLog,ListChannelModeratorsResponseFilterSensitiveLog).ser(se_ListChannelModeratorsCommand).de(de_ListChannelModeratorsCommand).build(){};let ListChannelsAssociatedWithChannelFlowCommand=class ListChannelsAssociatedWithChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsAssociatedWithChannelFlow",{}).n("ChimeSDKMessagingClient","ListChannelsAssociatedWithChannelFlowCommand").f(ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog).ser(se_ListChannelsAssociatedWithChannelFlowCommand).de(de_ListChannelsAssociatedWithChannelFlowCommand).build(){};let ListChannelsCommand=class ListChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannels",{}).n("ChimeSDKMessagingClient","ListChannelsCommand").f(ListChannelsRequestFilterSensitiveLog,ListChannelsResponseFilterSensitiveLog).ser(se_ListChannelsCommand).de(de_ListChannelsCommand).build(){};let ListChannelsModeratedByAppInstanceUserCommand=class ListChannelsModeratedByAppInstanceUserCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListChannelsModeratedByAppInstanceUser",{}).n("ChimeSDKMessagingClient","ListChannelsModeratedByAppInstanceUserCommand").f(ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog).ser(se_ListChannelsModeratedByAppInstanceUserCommand).de(de_ListChannelsModeratedByAppInstanceUserCommand).build(){};let ListSubChannelsCommand=class ListSubChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListSubChannels",{}).n("ChimeSDKMessagingClient","ListSubChannelsCommand").f(ListSubChannelsRequestFilterSensitiveLog,ListSubChannelsResponseFilterSensitiveLog).ser(se_ListSubChannelsCommand).de(de_ListSubChannelsCommand).build(){};let ListTagsForResourceCommand=class ListTagsForResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","ListTagsForResource",{}).n("ChimeSDKMessagingClient","ListTagsForResourceCommand").f(void 0,ListTagsForResourceResponseFilterSensitiveLog).ser(se_ListTagsForResourceCommand).de(de_ListTagsForResourceCommand).build(){};let PutChannelExpirationSettingsCommand=class PutChannelExpirationSettingsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelExpirationSettings",{}).n("ChimeSDKMessagingClient","PutChannelExpirationSettingsCommand").f(void 0,void 0).ser(se_PutChannelExpirationSettingsCommand).de(de_PutChannelExpirationSettingsCommand).build(){};let PutChannelMembershipPreferencesCommand=class PutChannelMembershipPreferencesCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutChannelMembershipPreferences",{}).n("ChimeSDKMessagingClient","PutChannelMembershipPreferencesCommand").f(PutChannelMembershipPreferencesRequestFilterSensitiveLog,PutChannelMembershipPreferencesResponseFilterSensitiveLog).ser(se_PutChannelMembershipPreferencesCommand).de(de_PutChannelMembershipPreferencesCommand).build(){};let PutMessagingStreamingConfigurationsCommand=class PutMessagingStreamingConfigurationsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","PutMessagingStreamingConfigurations",{}).n("ChimeSDKMessagingClient","PutMessagingStreamingConfigurationsCommand").f(void 0,void 0).ser(se_PutMessagingStreamingConfigurationsCommand).de(de_PutMessagingStreamingConfigurationsCommand).build(){};let RedactChannelMessageCommand=class RedactChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","RedactChannelMessage",{}).n("ChimeSDKMessagingClient","RedactChannelMessageCommand").f(void 0,void 0).ser(se_RedactChannelMessageCommand).de(de_RedactChannelMessageCommand).build(){};let SearchChannelsCommand=class SearchChannelsCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SearchChannels",{}).n("ChimeSDKMessagingClient","SearchChannelsCommand").f(SearchChannelsRequestFilterSensitiveLog,SearchChannelsResponseFilterSensitiveLog).ser(se_SearchChannelsCommand).de(de_SearchChannelsCommand).build(){};let SendChannelMessageCommand=class SendChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","SendChannelMessage",{}).n("ChimeSDKMessagingClient","SendChannelMessageCommand").f(SendChannelMessageRequestFilterSensitiveLog,void 0).ser(se_SendChannelMessageCommand).de(de_SendChannelMessageCommand).build(){};let TagResourceCommand=class TagResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","TagResource",{}).n("ChimeSDKMessagingClient","TagResourceCommand").f(TagResourceRequestFilterSensitiveLog,void 0).ser(se_TagResourceCommand).de(de_TagResourceCommand).build(){};let UntagResourceCommand=class UntagResourceCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UntagResource",{}).n("ChimeSDKMessagingClient","UntagResourceCommand").f(UntagResourceRequestFilterSensitiveLog,void 0).ser(se_UntagResourceCommand).de(de_UntagResourceCommand).build(){};let UpdateChannelCommand=class UpdateChannelCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannel",{}).n("ChimeSDKMessagingClient","UpdateChannelCommand").f(UpdateChannelRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelCommand).de(de_UpdateChannelCommand).build(){};let UpdateChannelFlowCommand=class UpdateChannelFlowCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelFlow",{}).n("ChimeSDKMessagingClient","UpdateChannelFlowCommand").f(UpdateChannelFlowRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelFlowCommand).de(de_UpdateChannelFlowCommand).build(){};let UpdateChannelMessageCommand=class UpdateChannelMessageCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelMessage",{}).n("ChimeSDKMessagingClient","UpdateChannelMessageCommand").f(UpdateChannelMessageRequestFilterSensitiveLog,void 0).ser(se_UpdateChannelMessageCommand).de(de_UpdateChannelMessageCommand).build(){};let UpdateChannelReadMarkerCommand=class UpdateChannelReadMarkerCommand extends Command.classBuilder().ep(tl).m(function(o,p,f,m){return[getSerdePlugin(f,this.serialize,this.deserialize),getEndpointPlugin(f,o.getEndpointParameterInstructions())]}).s("ChimeMessagingService","UpdateChannelReadMarker",{}).n("ChimeSDKMessagingClient","UpdateChannelReadMarkerCommand").f(void 0,void 0).ser(se_UpdateChannelReadMarkerCommand).de(de_UpdateChannelReadMarkerCommand).build(){};let ChimeSDKMessaging=class ChimeSDKMessaging extends ChimeSDKMessagingClient{};((o,p)=>{for(let f of Object.keys(o)){let m=o[f],methodImpl=async function(o,p,f){let _=new m(o);if("function"==typeof p)this.send(_,p);else{if("function"!=typeof f)return this.send(_,p);if("object"!=typeof p)throw Error(`Expected http options but got ${typeof p}`);this.send(_,p||{},f)}},_=(f[0].toLowerCase()+f.slice(1)).replace(/Command$/,"");p.prototype[_]=methodImpl}})({AssociateChannelFlowCommand:AssociateChannelFlowCommand,BatchCreateChannelMembershipCommand:BatchCreateChannelMembershipCommand,ChannelFlowCallbackCommand:ChannelFlowCallbackCommand,CreateChannelCommand:CreateChannelCommand,CreateChannelBanCommand:CreateChannelBanCommand,CreateChannelFlowCommand:CreateChannelFlowCommand,CreateChannelMembershipCommand:CreateChannelMembershipCommand,CreateChannelModeratorCommand:CreateChannelModeratorCommand,DeleteChannelCommand:DeleteChannelCommand,DeleteChannelBanCommand:DeleteChannelBanCommand,DeleteChannelFlowCommand:DeleteChannelFlowCommand,DeleteChannelMembershipCommand:DeleteChannelMembershipCommand,DeleteChannelMessageCommand:DeleteChannelMessageCommand,DeleteChannelModeratorCommand:DeleteChannelModeratorCommand,DeleteMessagingStreamingConfigurationsCommand:DeleteMessagingStreamingConfigurationsCommand,DescribeChannelCommand:DescribeChannelCommand,DescribeChannelBanCommand:DescribeChannelBanCommand,DescribeChannelFlowCommand:DescribeChannelFlowCommand,DescribeChannelMembershipCommand:DescribeChannelMembershipCommand,DescribeChannelMembershipForAppInstanceUserCommand:DescribeChannelMembershipForAppInstanceUserCommand,DescribeChannelModeratedByAppInstanceUserCommand:DescribeChannelModeratedByAppInstanceUserCommand,DescribeChannelModeratorCommand:DescribeChannelModeratorCommand,DisassociateChannelFlowCommand:DisassociateChannelFlowCommand,GetChannelMembershipPreferencesCommand:GetChannelMembershipPreferencesCommand,GetChannelMessageCommand:GetChannelMessageCommand,GetChannelMessageStatusCommand:GetChannelMessageStatusCommand,GetMessagingSessionEndpointCommand:GetMessagingSessionEndpointCommand,GetMessagingStreamingConfigurationsCommand:GetMessagingStreamingConfigurationsCommand,ListChannelBansCommand:ListChannelBansCommand,ListChannelFlowsCommand:ListChannelFlowsCommand,ListChannelMembershipsCommand:ListChannelMembershipsCommand,ListChannelMembershipsForAppInstanceUserCommand:ListChannelMembershipsForAppInstanceUserCommand,ListChannelMessagesCommand:ListChannelMessagesCommand,ListChannelModeratorsCommand:ListChannelModeratorsCommand,ListChannelsCommand:ListChannelsCommand,ListChannelsAssociatedWithChannelFlowCommand:ListChannelsAssociatedWithChannelFlowCommand,ListChannelsModeratedByAppInstanceUserCommand:ListChannelsModeratedByAppInstanceUserCommand,ListSubChannelsCommand:ListSubChannelsCommand,ListTagsForResourceCommand:ListTagsForResourceCommand,PutChannelExpirationSettingsCommand:PutChannelExpirationSettingsCommand,PutChannelMembershipPreferencesCommand:PutChannelMembershipPreferencesCommand,PutMessagingStreamingConfigurationsCommand:PutMessagingStreamingConfigurationsCommand,RedactChannelMessageCommand:RedactChannelMessageCommand,SearchChannelsCommand:SearchChannelsCommand,SendChannelMessageCommand:SendChannelMessageCommand,TagResourceCommand:TagResourceCommand,UntagResourceCommand:UntagResourceCommand,UpdateChannelCommand:UpdateChannelCommand,UpdateChannelFlowCommand:UpdateChannelFlowCommand,UpdateChannelMessageCommand:UpdateChannelMessageCommand,UpdateChannelReadMarkerCommand:UpdateChannelReadMarkerCommand},ChimeSDKMessaging);let iR=createPaginator(ChimeSDKMessagingClient,ListChannelBansCommand,"NextToken","NextToken","MaxResults"),iO=createPaginator(ChimeSDKMessagingClient,ListChannelFlowsCommand,"NextToken","NextToken","MaxResults"),iD=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsForAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),iL=createPaginator(ChimeSDKMessagingClient,ListChannelMembershipsCommand,"NextToken","NextToken","MaxResults"),iN=createPaginator(ChimeSDKMessagingClient,ListChannelMessagesCommand,"NextToken","NextToken","MaxResults"),iF=createPaginator(ChimeSDKMessagingClient,ListChannelModeratorsCommand,"NextToken","NextToken","MaxResults"),iV=createPaginator(ChimeSDKMessagingClient,ListChannelsAssociatedWithChannelFlowCommand,"NextToken","NextToken","MaxResults"),iB=createPaginator(ChimeSDKMessagingClient,ListChannelsModeratedByAppInstanceUserCommand,"NextToken","NextToken","MaxResults"),iU=createPaginator(ChimeSDKMessagingClient,ListChannelsCommand,"NextToken","NextToken","MaxResults"),ij=createPaginator(ChimeSDKMessagingClient,ListSubChannelsCommand,"NextToken","NextToken","MaxResults"),iH=createPaginator(ChimeSDKMessagingClient,SearchChannelsCommand,"NextToken","NextToken","MaxResults")},0x249059e84:(o,p,f)=>{"use strict";f.r(p),f.d(p,{fromHex:()=>fromHex,toHex:()=>toHex});let m={},_={};for(let o=0;o<256;o++){let p=o.toString(16).toLowerCase();1===p.length&&(p=`0${p}`),m[o]=p,_[p]=o}function fromHex(o){if(o.length%2!=0)throw Error("Hex encoded strings must have an even number length");let p=new Uint8Array(o.length/2);for(let f=0;f{"use strict";function whatwgEncodingApi_fromUtf8(o){return new TextEncoder().encode(o)}function whatwgEncodingApi_toUtf8(o){return new TextDecoder("utf-8").decode(o)}f.r(p),f.d(p,{fromUtf8:()=>dist_es_fromUtf8,toUtf8:()=>dist_es_toUtf8});let dist_es_fromUtf8=o=>"function"==typeof TextEncoder?whatwgEncodingApi_fromUtf8(o):(o=>{let p=[];for(let f=0,m=o.length;f>6|192,63&m|128);else if(f+1>18|240,_>>12&63|128,_>>6&63|128,63&_|128)}else p.push(m>>12|224,m>>6&63|128,63&m|128)}return Uint8Array.from(p)})(o),dist_es_toUtf8=o=>"function"==typeof TextDecoder?whatwgEncodingApi_toUtf8(o):(o=>{let p="";for(let f=0,m=o.length;fo.toString(16)).join("%")):p+=String.fromCharCode((15&m)<<12|(63&o[++f])<<6|63&o[++f])}return p})(o)},0x23b480992:(o,p,f)=>{"use strict";f.d(p,{X:()=>m});let m="en-US"},0xfb32b180:(o,p,f)=>{"use strict";f.d(p,{Xp:()=>_});var m,_=((m={}).DOGFOOD="dogfood",m.BETA="beta",m.PROD="prod",m)},0x1d159ee8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xd475f02c));p.default=class{constructor(o,p,f,m=1e3,_=200){this.realtimeController=o,this.selfAttendeeId=p,this.hasBandwidthPriorityCallback=f,this.waitIntervalMs=m,this.updateIntervalMs=_,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(o){return!this.activeSpeakers||0===this.speakerScores[o]&&this.activeSpeakers.includes(o)||this.speakerScores[o]>0&&!this.activeSpeakers.includes(o)}updateActiveSpeakers(o,p,f){if(!this.needUpdate(f))return;let m=[],_=Object.keys(this.speakerScores);for(let o=0;o<_.length;o++){let p=_[o];m.push({attendeeId:p,activeScore:this.speakerScores[p]})}let w=m.sort((o,p)=>p.activeScore-o.activeScore).filter(function(o){return o.activeScore>0}).map(function(o){return o.attendeeId});this.activeSpeakers=w,p(w);let I=w.length>0&&w[0]===this.selfAttendeeId&&o.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==I&&(this.hasBandwidthPriority=I,this.hasBandwidthPriorityCallback(I))}updateScore(o,p,f,m,_){let w=o.calculateScore(f,m,_);this.speakerScores[f]!==w&&(this.speakerScores[f]=w,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f))}subscribe(o,p,f,m){let handler=(f,m)=>{if(!m){this.speakerScores[f]=0,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f);return}this.realtimeController.realtimeSubscribeToVolumeIndicator(f,(f,m,_,w)=>{this.mostRecentUpdateTimestamp[f]=Date.now(),null!==_&&(this.speakerMuteState[f]=_),this.updateScore(o,p,f,m,_)})};this.detectorCallbackToHandler.set(p,handler);let _=new w.default(this.updateIntervalMs);if(_.start(()=>{for(let f in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[f]>this.waitIntervalMs&&this.updateScore(o,p,f,0,this.speakerMuteState[f])}),this.detectorCallbackToActivityTimer.set(p,_),f&&m){let o=new w.default(m);o.start(()=>{f(this.speakerScores)}),this.detectorCallbackToScoresTimer.set(p,o)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)}unsubscribe(o){let p=this.detectorCallbackToHandler.get(o);this.detectorCallbackToHandler.delete(o),p&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(p);let f=this.detectorCallbackToActivityTimer.get(o);f&&(f.stop(),this.detectorCallbackToActivityTimer.delete(o));let m=this.detectorCallbackToScoresTimer.get(o);m&&(m.stop(),this.detectorCallbackToHandler.delete(o))}destroy(){return m(this,void 0,void 0,function*(){for(let o of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o);for(let o of this.detectorCallbackToActivityTimer.values())o.stop();for(let o of this.detectorCallbackToScoresTimer.values())o.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()})}}},0x1055669a4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=.9,p=.01,f=.2,m=.2){this.speakerWeight=o,this.cutoffThreshold=p,this.silenceThreshold=f,this.takeoverRate=m,this.volumes={}}calculateScore(o,p,f){(f||null===p)&&(p=0),this.volumes.hasOwnProperty(o)||(this.volumes[o]=0),p=+(p>this.silenceThreshold);let m=this.volumes[o]*this.speakerWeight+p*(1-this.speakerWeight);for(let f in this.volumes[o]=m,this.volumes)f!==o&&(this.volumes[f]=Math.max(this.volumes[f]-this.takeoverRate*p,0));return m{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ApplicationMetadata{constructor(o,p){this.appName=o,this.appVersion=p}static create(o,p){let f=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!o||o.length>32)throw Error("appName should be a valid string and 1 to 32 characters in length");if(!f.test(o))throw Error(`appName must satisfy ${f} regular expression`);if(!p||p.length>32)throw Error("appVersion should be a valid string and 1 to 32 characters in length");if(!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm.test(p))throw Error("appVersion must satisfy Semantic Versioning format");return new ApplicationMetadata(o,p)}}},0x977823e1:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x197b329a2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1158c4d3));p.default=class{constructor(o){this.logger=o,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new w.default,this.observers=new Set}bindAudioElement(o){return m(this,void 0,void 0,function*(){if(!o)throw Error(`Cannot bind audio element: ${o}`);return this.audioElement=o,this.audioElement.autoplay=!0,this.bindAudioMix()})}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null,this.forEachObserver(o=>{this.audioStream&&o.meetingAudioStreamBecameInactive(this.audioStream)}))}bindAudioStream(o){return m(this,void 0,void 0,function*(){if(o){this.audioStream=o;try{yield this.bindAudioMix()}catch(o){this.logger&&this.logger.warn(`Failed to bind audio stream: ${o}`)}}})}bindAudioDevice(o){return m(this,void 0,void 0,function*(){if(o&&!this.browserBehavior.supportsSetSinkId())throw Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=o,this.bindAudioMix()})}forEachObserver(o){for(let p of this.observers)I.default.nextTick(()=>{o(p)})}bindAudioMix(){var o,p;return m(this,void 0,void 0,function*(){if(!this.audioElement)return;let f=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),f!==this.audioStream&&this.forEachObserver(o=>{f&&o.meetingAudioStreamBecameInactive(f),this.audioStream&&o.meetingAudioStreamBecameActive(this.audioStream)});let m=(null==(o=this.audioDevice)?void 0:o.deviceId)!==this.audioElement.sinkId;if(m&&void 0===this.audioElement.sinkId)throw Error("Cannot select audio output device. This browser does not support setSinkId.");let _=this.audioDevice?this.audioDevice.deviceId:"";if(_===this.audioElement.sinkId)return;let w=this.audioElement,I=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=null),m)try{yield w.setSinkId(_)}catch(o){throw null==(p=this.logger)||p.error(`Failed to set sinkId for audio element: ${o}`),o}this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=I)})}getCurrentMeetingAudioStream(){return m(this,void 0,void 0,function*(){return this.audioStream})}addAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.add(o)})}removeAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.delete(o)})}audioOutputDidChange(o){return m(this,void 0,void 0,function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(o)})}}},0x1be31fc8b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2));p.default=class AudioProfile{constructor(o=null,p=!0){this.audioBitrateBps=o,this.enableAudioRedundancy=new _.default().supportsAudioRedundancy()&&p}static fullbandSpeechMono(o=!0){return new AudioProfile(4e4,o)}static fullbandMusicMono(o=!0){return new AudioProfile(64e3,o)}static fullbandMusicStereo(o=!0){return new AudioProfile(128e3,o)}isStereo(){return 128e3===this.audioBitrateBps}hasRedundancyEnabled(){return this.enableAudioRedundancy}}},0xb1f38e48:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=void 0;let _=m(f(0x5b4a3d7a));p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=25;let w=class{constructor(){this.logger=null,this.browserBehavior=null,this.meetingSessionConfiguration=null,this.signalingClient=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,this.audioMixController=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.prioritizedSendVideoCodecCapabilities=[],this.degradedVideoSendCodecs=[],this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.enableSVC=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null,this.retryCount=0,this.isSessionConnected=!1}resetConnectionSpecificState(){this.peer&&this.peer.close(),this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,void 0!==this.transceiverController&&this.transceiverController.reset(),this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.videoDownlinkBandwidthPolicy.reset(),this.videoUplinkBandwidthPolicy.reset&&this.videoUplinkBandwidthPolicy.reset(),this.lastVideosToReceive=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptions=null,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videosToReceive=new _.default,this.videosPaused=new _.default,this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.videoDuplexMode=null,this.isSessionConnected=!1}};p.default=w},0x11418f4a2:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x1d159ee8)),x=k(f(0x197b329a2)),O=k(f(0x1be31fc8b)),L=k(f(0x9a4430b2)),B=k(f(0x18c985af)),U=k(f(0x202eb6fd7)),$=k(f(0x170a3ef32)),q=f(0x8fff55e5),Z=k(f(0x194415c85)),ee=k(f(0x11a9e868)),et=k(f(0x1d61c1795)),ei=k(f(0x230534cc6)),er=k(f(0x138580412)),en=k(f(0x24bb989ba)),eo=k(f(0x1158c4d3)),es=k(f(0x178bce6ff)),ea=k(f(0x1f3b38cfe)),el=k(f(0x247795129)),ed=k(f(0x1ac272bbc)),ec=k(f(0x15a2e95ed)),eu=k(f(0x1bd55d3c4)),eh=w(f(0xf8b13aac)),ep=k(f(0x216f98b8d)),ef=k(f(0x1217c7f3f)),em=f(0x252035ee7),eg=k(f(0x69c93909)),eS=k(f(0x1c7d226ae)),ev=k(f(0x435994a8)),eb=k(f(0xbf52f99d)),ey=k(f(0x73c142bf)),e_=k(f(0x44174156)),eC=k(f(0xa567a7ba)),eT=k(f(0x1b7bc4701)),eE=k(f(0x10a1c2ebe)),ew=k(f(0x8c94ea05)),eI=k(f(0x1f9f2eb05)),eA=k(f(0xc8b2a6fb)),ek=k(f(0x1a50cfb5)),eM=k(f(0x8ef9a2fd)),ex=k(f(0x26b16a9c)),eP=k(f(0x141765a48)),eR=k(f(0x117aaca57)),eO=k(f(0x13a00d587)),eD=k(f(0x164fd248f)),eL=k(f(0x11bbef2ec)),eN=k(f(0x23693b9e4)),eF=k(f(0x1c9808277)),eV=k(f(0x22ef5bfc)),eB=k(f(0xe6d64708)),eU=k(f(0x112462f64)),ej=k(f(0x238ca30a)),eH=k(f(0xf1a8ac2)),ez=k(f(0x4287252)),eG=k(f(0x72848aa)),eW=f(0xab1ef933),e$=k(f(0x17f8c39ba)),eK=k(f(0x38bf5f74)),eq=k(f(0x171bbd0a0)),eJ=f(0xb8e111a8),eY=k(f(0x5b4a3d7a)),eX=k(f(0x151b9e5ee)),eQ=k(f(0x25113bad6)),eZ=k(f(0x129e504bc)),e0=k(f(0x86c4609a)),e1=k(f(0x11b1e3853)),e2=k(f(0xf9210d7b)),e3=k(f(0x20da5c30a)),e4=k(f(0xb1f38e48)),e5=class DefaultAudioVideoController{constructor(o,p,f,m,_,w){this._audioProfile=new O.default,this.connectionHealthData=new B.default,this.observerQueue=new Set,this.meetingSessionContext=new e4.default,this.enableSimulcast=!1,this.enableSVC=!1,this.useUpdateTransceiverControllerForUplink=!1,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.receiveRemotePauseResumeTask=void 0,this.destroyed=!1,this._logger=p,this.sessionStateController=new ea.default(this._logger),this._configuration=o,this._webSocketAdapter=f,this._realtimeController=new en.default(m),this._realtimeController.realtimeSetLocalAttendeeId(o.credentials.attendeeId,o.credentials.externalUserId),this._mediaStreamBroker=m,this._reconnectController=_,this._videoTileController=new eZ.default(new e0.default,this,this._logger),this._audioMixController=new x.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=w,this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers||(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)&&new L.default().hasChromiumWebRTC()?this.videoSendCodecPreferences=[es.default.av1Main(),es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()]:this.videoSendCodecPreferences=[es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()])}destroy(){return I(this,void 0,void 0,function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0})}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new M.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(o){return(this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),this.rtcPeerConnection)?this.rtcPeerConnection.getStats(o):null}setAudioProfile(o){this._audioProfile=o}addObserver(o){this.logger.info("adding meeting observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing meeting observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)eo.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}initSignalingClient(){this.connectionHealthData.reset(),this.meetingSessionContext.signalingClient||(this.meetingSessionContext=new e4.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new L.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.audioProfile=this._audioProfile,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new eu.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then(()=>{let handleClosed=()=>I(this,void 0,void 0,function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()});this.preStartObserver={handleSignalingClientEvent(o){o.type===ep.default.WebSocketClosed&&handleClosed()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)}).catch(o=>{this.logger.error(`Signaling task pre-start failed: ${o}`),this.signalingTask=void 0})}start(o){this.startReturningPromise(o).then(()=>{this.logger.info("start completed")}).catch(o=>{this.logger.error(`start failed: ${o}`)})}startReturningPromise(o){return(null==o?void 0:o.signalingOnly)===!0?this.prestart():(this.activeSpeakerDetector,new Promise((o,p)=>{this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!1).then(o).catch(p)})}))}connectWithPromises(o){let p=this.meetingSessionContext,timeout=(o,p)=>new eB.default(this.logger,p,o);this.monitorTask=new eI.default(p,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);let f=this.monitorTask.once(),m=new ex.default(p).once();this.receiveIndexTask=new eO.default(p),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();let _=new eL.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new ew.default(p),new eD.default(p),new eT.default(p),this.receiveIndexTask]).once(),w=new ey.default(p).once(_),I=new eS.default(p).once(w,m),k=new e_.default(p).once(I),M=new eN.default(p).once(k),x=new eC.default(p).once(M),O=new eV.default(p).once(x);return this.receiveRemotePauseResumeTask=new eP.default(p),this.receiveRemotePauseResumeTask.once(O),new eL.default(this.logger,this.wrapTaskName("AudioVideoStart"),[f,timeout(this.configuration.connectionTimeoutMs,new eL.default(this.logger,"Peer",[O,this.receiveRemotePauseResumeTask,o?new eB.default(this.logger,new ek.default(this.logger,"FinalizeConnection",[new eU.default(p),new eF.default(p)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new eF.default(p)]))])}actionConnect(o){var p;return I(this,void 0,void 0,function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&new L.default().hasChromiumWebRTC(),this.enableSimulcast&&this.configuration.enableSVC&&this.logger.warn("SVC cannot be enabled at the same time as simulcast. Disabling SVC, using simulcast."),this.enableSVC=!this.enableSimulcast&&this.configuration.enableSVC&&new L.default().supportsScalableVideoCoding();let f=!!this.configuration.urls.audioHostURL;if(f?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new eH.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext):this.meetingSessionContext.transceiverController=new ez.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new ej.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new eG.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)),this.meetingSessionContext.volumeIndicatorAdapter=new e3.default(this.logger,this._realtimeController,DefaultAudioVideoController.MIN_VOLUME_DECIBELS,DefaultAudioVideoController.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.meetingSessionContext.enableSVC=this.enableSVC,this.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy;o||(o=new e1.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=o),o.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eq.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new eQ.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new eX.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new e2.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.videoUplinkBandwidthPolicy.setSVCEnabled(this.enableSVC)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eK.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&(this.useUpdateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;if(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)){let o=this.configuration.meetingFeatures.contentMaxResolution===$.default.VideoResolutionUHD;o&&this.setVideoMaxBandwidthKbps(2500),this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}else{let o=this.configuration.meetingFeatures.videoMaxResolution===$.default.VideoResolutionFHD;this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver(()=>this.update({needsRenegotiation:!1})),this.meetingSessionContext.lastKnownVideoAvailability=new et.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new e$.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new eY.default,this.meetingSessionContext.videosPaused=new eY.default,this.meetingSessionContext.statsCollector=new eg.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new U.default(this,this._realtimeController,this.connectionHealthData,new er.default(this.meetingSessionContext.signalingClient,DefaultAudioVideoController.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},this._videoTileController.registerVideoTileResolutionObserver(this.meetingSessionContext.statsCollector),o||(this.meetingSessionContext.retryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!1))}),null==(p=this.eventController)||p.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);let m=f&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;this.logger.info("Needs to wait for attendee presence? "+m);let _=this.connectWithPromises(m);try{yield _.run(),this.connectionHealthData.setConnectionStartTime();let o=new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT);this.connectionHealthData.setIsContentShare(o),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var o;this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,null==(o=this.eventController)||o.publishEvent("meetingStartSucceeded",q.audioVideoEventAttributesFromState(this.meetingSessionContext)),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()})}catch(p){this.signalingTask=void 0;let o=new Z.default(this.getMeetingStatusCode(p)||ee.default.TaskFailed);if(this.logger.info(`Start failed: ${o} due to error ${p}.`),this.sessionStateController.state()===ed.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(el.default.Fail,()=>I(this,void 0,void 0,function*(){yield this.actionDisconnect(o,!0,p),this.handleMeetingSessionStatus(o,p)||this.notifyStop(o,p)}))}})}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new eB.default(this.logger,new eA.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=em.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.meetingSessionContext.isSessionConnected=!0,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStart).map(p=>p.bind(o)())}),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var o;return(this._reconnectController.disableReconnect(),this.sessionStateController.state()===ed.default.NotConnected)?(null==(o=this.meetingSessionContext.signalingClient)||o.closeConnection(),this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise((o,p)=>{this.sessionStateController.perform(el.default.Disconnect,()=>{this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new Z.default(ee.default.Left),!1,null).then(o).catch(p)})})}stop(){this.stopReturningPromise()}actionDisconnect(o,p,f){return I(this,void 0,void 0,function*(){try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new eB.default(this.logger,new eE.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(o){this.logger.info("fail to stop")}try{let o=[new eB.default(this.logger,new eb.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new eL.default(this.logger,this.wrapTaskName("AudioVideoClean"),o).run()}catch(o){this.logger.info("fail to clean")}this.sessionStateController.perform(el.default.FinishDisconnecting,()=>{p||this.notifyStop(o,f)}),this._videoTileController.removeVideoTileResolutionObserver(this.meetingSessionContext.statsCollector)})}update(o={needsRenegotiation:!0}){let p=o.needsRenegotiation;if(p||(p=void 0===this.meetingSessionContext.peer),p||(p=!this.updateRemoteVideosFromPolicy()),p||(p=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!p)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe"),this.updateNumberOfPublishedVideoSources();let f=this.sessionStateController.perform(el.default.Update,()=>{this.actionUpdateWithRenegotiation(!0)});return f===ec.default.Transitioned||f===ec.default.DeferredTransition}updateNumberOfPublishedVideoSources(){let o=this.configuration.credentials.attendeeId,p=this._videoTileController.hasStartedLocalVideoTile();if(null!==this.meetingSessionContext.videoStreamIndex){let f=this.meetingSessionContext.videoStreamIndex.numberOfVideoPublishingParticipantsExcludingSelf(o)+ +!!p;this.connectionHealthData.setNumberOfPublishedVideoSources(f)}}updateRemoteVideosFromPolicy(){if(this.meetingSessionContext.videoDownlinkBandwidthPolicy&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getVideoPreferences&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&!eh.serverSideNetworkAdaptionIsNoneOrDefault(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())){if(!this.sendRemoteVideoUpdate())return!1;if(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()===eh.default.BandwidthProbingAndRemoteVideoQualityAdaption)return this.isNotAddingOrRemovingStreams()}return this.updateRemoteVideosIfNotAddingOrRemovingStreams()}updateRemoteVideosIfNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.simulcastStreamUpdates,m=o.removed,_=this.meetingSessionContext,w=[];for(let[o,p]of f.entries()){let f=new ef.default;if(f.streamId=p,f.attendeeId=_.videoStreamIndex.attendeeIdForStreamId(p),f.mid=_.transceiverController.getMidForStreamId(o),void 0===f.mid)return this.logger.info(`No MID found for stream ID ${o}, cannot update stream without renegotiation`),!1;if(w.push(f),_.transceiverController.setStreamIdForMid(f.mid,p),_.videoStreamIndex.overrideStreamIdMappings(o,p),_.videoTileController.haveVideoTileForAttendeeId(f.attendeeId)){let o=_.videoTileController.getVideoTileForAttendeeId(f.attendeeId);if(!o.setStreamId)return!1;o.setStreamId(p)}}return 0!==w.length&&_.signalingClient.remoteVideoUpdate(w,[]),0===p.length&&0===m.length&&(_.videoStreamIndex.remoteVideoUpdateSent(),!0)}detectChangesInVideosToReceive(){let o=this.meetingSessionContext;if(null===o.videosToReceive||!o.transceiverController||!o.transceiverController.getMidForStreamId||!o.transceiverController.setStreamIdForMid||!o.videosToReceive.forEach||!o.signalingClient.remoteVideoUpdate||!o.videoStreamIndex.overrideStreamIdMappings)return;let p=[],f=new Map,m=[];if(null===o.lastVideosToReceive)p=o.videosToReceive.array();else{let _=o.videoStreamIndex;o.videosToReceive.forEach(m=>{if(o.lastVideosToReceive.contain(m))return;let w=!1;o.lastVideosToReceive.forEach(o=>{!w&&_.StreamIdsInSameGroup(o,m)&&(f.set(o,m),w=!0)}),w||p.push(m)}),m=o.lastVideosToReceive.array().filter(p=>{let m=o.videosToReceive.contain(p),_=f.has(p);return!m&&!_})}return this.logger.info(`Request to update remote videos with added: [${p}], updated: [${Array.from(f.entries()).map(([o,p])=>`${o}->${p}`).join(",")}], removed: [${m}]`),{added:p,removed:m,simulcastStreamUpdates:f}}isNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.removed;return 0===p.length&&0===f.length&&(this.meetingSessionContext.videoStreamIndex.remoteVideoUpdateSent(),!0)}sendRemoteVideoUpdate(){let o=this.meetingSessionContext;if(null===o.videosToReceive)return!1;let p=o.videosToReceive.array().map(p=>o.videoStreamIndex.groupIdForStreamId(p));this.receiveRemotePauseResumeTask.updateSubscribedGroupdIds(new Set(p));let f=eJ.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(o,p,o.videoDownlinkBandwidthPolicy.getVideoPreferences()),m=new Map,_=[];for(let p of f){let f=!1;if(o.lastVideoSubscriptionConfiguration.has(p.groupId)){let m=o.lastVideoSubscriptionConfiguration.get(p.groupId);p.equals(m)||(this.logger.debug(`${JSON.stringify(p)} does not equal ${JSON.stringify(m)}, sending update`),f=!0)}else f=!0;m.set(p.groupId,p),f&&_.push(p)}o.lastVideoSubscriptionConfiguration=m;let w=[];if(null!==o.lastVideosToReceive){let f=new Set(p);for(let p of o.lastVideosToReceive.array()){let m=o.videoStreamIndex.groupIdForStreamId(p);if(!f.has(m)){let p=o.transceiverController.getMidForGroupId(m);if(void 0===p){o.logger.warn(`Could not find MID for group ID to remove: ${m}`);continue}w.push(p)}}}return(0!==_.length||0!==w.length)&&o.signalingClient.remoteVideoUpdate(_,w),!0}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&this.meetingSessionContext.transceiverController.hasVideoInput()&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(o)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;let o=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!!o&&!!o.headerExtensions&&o.headerExtensions.some(o=>"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"===o.uri)}restartLocalVideo(o){let restartVideo=()=>I(this,void 0,void 0,function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdateWithRenegotiation(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdateWithRenegotiation(!0),o()}),p=this.sessionStateController.perform(el.default.Update,()=>{restartVideo()});return p===ec.default.Transitioned||p===ec.default.DeferredTransition}replaceLocalVideo(o){return I(this,void 0,void 0,function*(){if(!o||o.getVideoTracks().length<1)throw Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");let p=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(p){let f=p.state(),m=o.getVideoTracks()[0].getSettings();p.bindVideoStream(f.boundAttendeeId,!0,o,m.width,m.height,f.streamId,f.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(o.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=o,this.logger.info("Local video input is updated")})}replaceLocalAudio(o){return I(this,void 0,void 0,function*(){if(!o||o.getAudioTracks().length<1)throw Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(o.getAudioTracks()[0])))throw Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=o,this.logger.info("Local audio input is updated")})}actionUpdateWithRenegotiation(o){return I(this,void 0,void 0,function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),o&&this.sessionStateController.perform(el.default.FinishUpdating,()=>{this.actionFinishUpdating()})}catch(o){this.sessionStateController.perform(el.default.FinishUpdating,()=>{let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);p.statusCode()!==ee.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(p,o)})}})}notifyStop(o,p){var f;if(this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoDidStop).map(f=>f.bind(p)(o))}),this.eventController){let m=Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]}),_=p&&p.message||(null==(f=o.toString)?void 0:f.call(o))||"";null===this.meetingSessionContext.startTimeMs?(m.meetingErrorMessage=_,delete m.meetingDurationMs,delete m.attendeePresenceDurationMs,delete m.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",m)):o.isFailure()||o.isAudioConnectionFailure()?(m.meetingErrorMessage=_,this.eventController.publishEvent("meetingFailed",m)):this.eventController.publishEvent("meetingEnded",m)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{let o=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(o)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(o,p){this.promotedToPrimaryMeeting&&(this.promotedToPrimaryMeeting=!1,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.AudioVideoDisconnectedWhilePromoted)))}));let f=this._reconnectController.retryWithBackoff(()=>I(this,void 0,void 0,function*(){this.sessionStateController.state()===ed.default.NotConnected?this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!0)}):this.sessionStateController.perform(el.default.Reconnect,()=>{this.actionReconnect(o)}),this.meetingSessionContext.retryCount+=1}),()=>{this.logger.info("canceled retry")});return f||this.sessionStateController.perform(el.default.Fail,()=>{this.actionDisconnect(o,!1,p)}),f}actionReconnect(o){return I(this,void 0,void 0,function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!0))})),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset(),this.receiveRemotePauseResumeTask=new eP.default(this.meetingSessionContext);try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new eB.default(this.logger,new eL.default(this.logger,"Media",[new ev.default(this.meetingSessionContext),new eL.default(this.logger,"Signaling",[new eA.default(this.meetingSessionContext),new eT.default(this.meetingSessionContext)]),new ey.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext),this.receiveRemotePauseResumeTask]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var p;null==(p=this.eventController)||p.publishEvent("meetingReconnected",Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]})),this.actionFinishConnecting()})}catch(o){this.sessionStateController.perform(el.default.FinishConnecting,()=>{this.logger.info("failed to reconnect audio-video session");let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);this.handleMeetingSessionStatus(p,o)})}this.connectionHealthData.setConnectionStartTime()})}wrapTaskName(o){return`${o}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(o){let p=/the meeting status code: (\d+)/.exec(o&&o.message);return p&&p.length>1?Number.parseInt(p[1],10):null}enforceBandwidthLimitationForSender(o){return I(this,void 0,void 0,function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(o)})}handleMeetingSessionStatus(o,p){if(this.logger.info(`handling status: ${ee.default[o.statusCode()]}`),!o.isTerminal()&&this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(o),o.statusCode()===ee.default.IncompatibleSDP)return this.restartLocalVideo(()=>{this.logger.info("handled incompatible SDP by attempting to restart video")}),!0;if(o.statusCode()===ee.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver(o=>{eW.Maybe.of(o.videoSendDidBecomeUnavailable).map(p=>p.bind(o)())}),!1;if(o.statusCode()===ee.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoWasDemotedFromPrimaryMeeting).map(f=>f.bind(p)(o))}),!1;if(o.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(o.isFailure()||o.isTerminal())&&this.meetingSessionContext.reconnectController){let f=this.reconnect(o,p);return f?this.logger.warn(`The audio video controller will reconnect due to status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`):this.logger.error(`The audio video controller failed with status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`),f}return!1}setVideoMaxBandwidthKbps(o){if(o<=0)throw Error("Max bandwidth kbps has to be greater than 0");this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${o} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(o)),this.maxUplinkBandwidthKbps=o}handleHasBandwidthPriority(o){return I(this,void 0,void 0,function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink){this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o),yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();return}let p=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o);let f=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();p!==f&&(this.logger.info(`video send bandwidth priority ${o} max has changed from ${p} kbps to ${f} kbps`),yield this.enforceBandwidthLimitationForSender(f))}})}pauseReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([o])}resumeReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([o])}setVideoCodecSendPreferences(o){this.videoSendCodecPreferences=o,this.meetingSessionContext.videoSendCodecPreferences=o,this.sessionStateController.state()!==ed.default.NotConnected&&this.update({needsRenegotiation:!0})}getRemoteVideoSources(){let{videoStreamIndex:o}=this.meetingSessionContext;if(!o)return this.logger.info("meeting has not started"),[];let p=this.configuration.credentials.attendeeId;return o.allVideoSendingSourcesExcludingSelf(p)}encodingSimulcastLayersDidChange(o){this.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver(p=>{eW.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}promoteToPrimaryMeeting(o){return this.actionPromoteToPrimaryMeeting(o)}actionPromoteToPrimaryMeeting(o){return I(this,void 0,void 0,function*(){let p=new Z.default(ee.default.SignalingRequestFailed);return yield new eL.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new eB.default(this.logger,new eM.default(this.meetingSessionContext,o,o=>{p=o}),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=p.statusCode()===ee.default.OK,p})}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.OK)))})}videoInputDidChange(o){return I(this,void 0,void 0,function*(){(this.logger.info("Receive a video input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer)?this._videoTileController.hasStartedLocalVideoTile()&&(o?yield this.replaceLocalVideo(o):this._videoTileController.stopLocalVideoTile()):this.logger.info("Skip updating video input because there is no active meeting and peer connection")})}audioInputDidChange(o){return I(this,void 0,void 0,function*(){if(this.logger.info("Receive an audio input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer)return void this.logger.info("Skip updating audio input because there is no active meeting and peer connection");if(!o)try{o=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(o){this.logger.error("Could not acquire audio track from mediaStreamBroker");return}yield this.replaceLocalAudio(o)})}};p.default=e5,e5.MIN_VOLUME_DECIBELS=-42,e5.MAX_VOLUME_DECIBELS=-14,e5.PING_PONG_INTERVAL_MS=1e4},0x191a3194b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a)),w=m(f(0x18e4b58c2)),I=m(f(0x1e9fbf678)),k=m(f(0x203f02bb7)),M=m(f(0x18e1c570f)),x=m(f(0x614ebca7)),O=m(f(0x194415c85)),L=m(f(0x11a9e868)),B=m(f(0xfce8eb05)),U=m(f(0x100e5c30c)),$=m(f(0x947abb4a)),q=m(f(0x11418f4a2));p.default=class extends q.default{constructor(o){const p=new M.default;p.meetingId="",p.externalMeetingId="",p.credentials=new x.default,p.credentials.attendeeId="",p.credentials.joinToken="",p.urls=new B.default,p.urls.turnControlURL="",p.urls.audioHostURL="",p.urls.signalingURL="wss://localhost/";const f=new I.default;super(o||p,f,new $.default(new I.default),new k.default,new U.default(0,new _.default(0,0,0)),new w.default(o||p,f))}setAudioProfile(o){}start(){}stop(){}promoteToPrimaryMeeting(o){return Promise.resolve(new O.default(L.default.OK))}demoteFromPrimaryMeeting(){}}},0xf2ec2ef2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1a86248d4);p.default=class{constructor(o,p,f,m,_,w){this.audioVideoController=o,this.videoTileController=p,this.realtimeController=f,this.audioMixController=m,this.deviceController=_,this.contentShareController=w}addObserver(o){this.audioVideoController.addObserver(o),this.trace("addObserver")}removeObserver(o){this.audioVideoController.removeObserver(o),this.trace("removeObserver")}setAudioProfile(o){this.trace("setAudioProfile",o),this.audioVideoController.setAudioProfile(o)}start(o){this.audioVideoController.start(o),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(o){return this.trace("getRTCPeerConnectionStats",o?o.id:null),this.audioVideoController.getRTCPeerConnectionStats(o)}bindAudioElement(o){let p=this.audioMixController.bindAudioElement(o);return this.trace("bindAudioElement",o.id,p),p}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(o){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(o)}removeAudioMixObserver(o){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(o)}bindVideoElement(o,p){this.videoTileController.bindVideoElement(o,p),this.trace("bindVideoElement",{tileId:o,videoElementId:p.id})}unbindVideoElement(o,p=!0){this.videoTileController.unbindVideoElement(o,p),this.trace("unbindVideoElement",{tileId:o,cleanUpVideoElement:p})}startLocalVideoTile(){let o=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,o),o}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){let o=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,o),o}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){let o=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),o}pauseVideoTile(o){this.videoTileController.pauseVideoTile(o),this.trace("pauseVideoTile",o)}unpauseVideoTile(o){this.videoTileController.unpauseVideoTile(o),this.trace("unpauseVideoTile",o)}getVideoTile(o){let p=this.videoTileController.getVideoTile(o);return this.trace("getVideoTile",o),p}getAllRemoteVideoTiles(){let o=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),o}getAllVideoTiles(){let o=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),o}addVideoTile(){let o=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,o.state()),o}removeVideoTile(o){this.videoTileController.removeVideoTile(o),this.trace("removeVideoTile",o)}removeVideoTilesByAttendeeId(o){let p=this.videoTileController.removeVideoTilesByAttendeeId(o);return this.trace("removeVideoTilesByAttendeeId",o,p),p}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(o){let p=this.videoTileController.captureVideoTile(o);return this.trace("captureVideoTile",o),p}realtimeSubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSetCanUnmuteLocalAudio(o),this.trace("realtimeSetCanUnmuteLocalAudio",o)}realtimeSubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}realtimeCanUnmuteLocalAudio(){let o=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,o),o}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){let o=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),o}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}realtimeIsLocalAudioMuted(){let o=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),o}realtimeSubscribeToVolumeIndicator(o,p){this.realtimeController.realtimeSubscribeToVolumeIndicator(o,p),this.trace("realtimeSubscribeToVolumeIndicator",o)}realtimeUnsubscribeFromVolumeIndicator(o,p){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(o,p),this.trace("realtimeUnsubscribeFromVolumeIndicator",o,p)}realtimeSubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(o),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(o,p,f){this.realtimeController.realtimeSendDataMessage(o,p,f),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(o,p){this.realtimeController.realtimeSubscribeToReceiveDataMessage(o,p),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(o){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(o),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(o){this.realtimeController.realtimeSubscribeToFatalError(o),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(o){this.realtimeController.realtimeUnsubscribeToFatalError(o),this.trace("realtimeUnsubscribeToFatalError")}subscribeToActiveSpeakerDetector(o,p,f,m){this.audioVideoController.activeSpeakerDetector.subscribe(o,p,f,m),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(o){this.audioVideoController.activeSpeakerDetector.unsubscribe(o),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioInputDevices(o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listVideoInputDevices(o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioOutputDevices(o);return this.trace("listAudioOutputDevices",o,p),p})}startAudioInput(o){return m(this,void 0,void 0,function*(){return this.trace("startAudioInput",o),this.deviceController.startAudioInput(o)})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()})}startVideoInput(o){return m(this,void 0,void 0,function*(){return _.isVideoTransformDevice(o)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",o),this.deviceController.startVideoInput(o)})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()})}chooseAudioOutput(o){let p=this.deviceController.chooseAudioOutput(o);return this.trace("chooseAudioOutput",o),p}addDeviceChangeObserver(o){this.deviceController.addDeviceChangeObserver(o),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.deviceController.removeDeviceChangeObserver(o),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){let o=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),o}startVideoPreviewForVideoInput(o){this.deviceController.startVideoPreviewForVideoInput(o),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){this.deviceController.stopVideoPreviewForVideoInput(o),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){this.deviceController.setDeviceLabelTrigger(o),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=this.deviceController.mixIntoAudioInput(o);return this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){this.deviceController.chooseVideoInputQuality(o,p,f),this.trace("chooseVideoInputQuality",{width:o,height:p,frameRate:f})}setVideoMaxBandwidthKbps(o){this.audioVideoController.setVideoMaxBandwidthKbps(o),this.trace("setVideoMaxBandwidthKbps",o)}setVideoCodecSendPreferences(o){this.audioVideoController.setVideoCodecSendPreferences(o),this.trace("setVideoCodecSendPreferences",o)}getVideoInputQualitySettings(){let o=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),o}setContentAudioProfile(o){this.trace("setContentAudioProfile",o),this.contentShareController.setContentAudioProfile(o)}enableSimulcastForContentShare(o,p){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(o,p)}enableSVCForContentShare(o){this.trace("enableSVCForContentShare"),this.contentShareController.enableSVCForContentShare(o)}startContentShare(o){let p=this.contentShareController.startContentShare(o);return this.trace("startContentShare"),p}startContentShareFromScreenCapture(o,p){let f=this.contentShareController.startContentShareFromScreenCapture(o,p);return this.trace("startContentShareFromScreenCapture"),f}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(o){this.contentShareController.addContentShareObserver(o),this.trace("addContentShareObserver")}removeContentShareObserver(o){this.contentShareController.removeContentShareObserver(o),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(o){this.contentShareController.setContentShareVideoCodecPreferences(o),this.trace("setContentShareVideoCodecPreferences")}trace(o,p,f){let m=this.audioVideoController.configuration.meetingId,_=this.audioVideoController.configuration.credentials.attendeeId,w=`API/DefaultAudioVideoFacade/${m}/${_}/${o}`;void 0!==p&&(w+=` ${JSON.stringify(p)}`),void 0!==f&&(w+=` -> ${JSON.stringify(f)}`),this.audioVideoController.logger.info(w)}getRemoteVideoSources(){let o=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,o),o}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(o){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);let p=this.audioVideoController.promoteToPrimaryMeeting(o);return this.trace("promoteToPrimaryMeeting",null,p),p}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(o){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}}},0x1626f4452:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xbbf88408)),I=f(0x11bb8da88);p.default=class extends w.default{constructor(o,p){super(o,p),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("BackgroundBlur processor using builtin blur")}drawImageWithMask(o,p){let f=this.blurredImage,{canvasCtx:m,targetCanvas:_}=this,{width:w,height:I}=_;p&&f?(this.scaledCanvas.getContext("2d").putImageData(p,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),m.save(),m.clearRect(0,0,w,I),m.drawImage(this.scaledCanvas,0,0,w,I),m.globalCompositeOperation="source-in",m.drawImage(o,0,0,w,I),m.globalCompositeOperation="destination-over",m.drawImage(this.blurCanvas,0,0,w,I),m.restore()):m.clearRect(0,0,w,I)}setBlurStrength(o){if(super.setBlurStrength(o),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});let o=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:o.path,inputHeight:o.input.height,inputWidth:o.input.width,inputChannels:4,modelRangeMin:o.input.range[0],modelRangeMax:o.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(o){this.blurredImage=o.payload.blurOutput,super.handlePredict(o)}destroy(){var o;let p=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){p.destroy.call(this),null==(o=this.blurCanvas)||o.remove(),this.blurCanvas=void 0})}}},0xbbf88408:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x190179907)),I=f(0x11bb8da88),k=_(f(0x7295d348));p.default=class extends w.default{constructor(o,p){super("background blur",o,p,new k.default),this.blurAmount=0,this.setBlurStrength(p.blurStrength),this.logger.info("BackgroundBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: { blurStrength: ${p.blurStrength}, filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}validateOptions(o){if(super.validateOptions(o),!o.blurStrength)throw Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.filter=`blur(${this.blurAmount}px)`,f.drawImage(o,0,0,m.width,m.height),f.restore()}setBlurStrength(o){this._blurStrength=o,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}static isSupported(){return m(this,void 0,void 0,function*(){let o=document.createElement("canvas"),p=void 0!==o.getContext("2d").filter;return o.remove(),p})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){let o={backgroundBlurEnabled:"true",backgroundBlurStrength:this._blurStrength,backgroundReplacementEnabled:"false",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}}},0x11bb8da88:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.BlurStrengthMapper=void 0;let f=class{static getBlurAmount(o,p){if(o<=0)throw Error(`invalid value for blur strength: ${o}`);return Math.round(o*p.height/this.BLUR_STRENGTH_DIVISOR)}};p.BlurStrengthMapper=f,f.BLUR_STRENGTH_DIVISOR=540,p.default={LOW:7,MEDIUM:15,HIGH:30}},0x93cc4db7:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x217eb324b)),I=_(f(0x12346a842)),k=_(f(0x19a5566fd)),M=_(f(0x84671e3f)),x=_(f(0x1626f4452)),O=_(f(0xbbf88408)),L=_(f(0x11bb8da88)),B=class extends M.default{setBlurStrength(){}loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}};p.default=class BackgroundBlurVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){let f;o=BackgroundBlurVideoFrameProcessor.resolveSpec(o);let{logger:m}=p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),_=yield BackgroundBlurVideoFrameProcessor.isSupported(o,p);return(m.info(`processor is ${_?"":"not"} supported`),_)?((yield O.default.isSupported())?(m.info("Using browser-provided background blur"),f=new O.default(o,p)):(m.info("Using built-in background blur"),f=new x.default(o,p)),yield f.loadAssets(),f):(m.warn("Using no-op processor because background blur is not supported"),new B)})}static resolveOptions(o={}){let p=Object.assign({},o);return p.blurStrength||(p.blurStrength=L.default.MEDIUM),p.logger||(p.logger=new I.default("BackgroundBlurProcessor",k.default.INFO)),p=super.resolveOptions(p)}static isSupported(o,p){return o=BackgroundBlurVideoFrameProcessor.resolveSpec(o),p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),super.isSupported(o,p)}}},0x7295d348:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f9d952c4));p.default=class extends _.default{}},0x18769c7b5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ModelSpecBuilder{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new ModelSpecBuilder}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){return this.path="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite",this.input={height:144,width:256,range:[0,1],channels:3},this.output={height:144,width:256,range:[0,1],channels:1},this}withPath(o){return this.path=o,this}withInput(o){return this.input=o,this}withOutput(o){return this.output=o,this}validate(){if(!this.path)throw Error("model spec path is not set");if(!this.input)throw Error("model spec input is not set");if(!this.output)throw Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}}},0xd154b86a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.delegate=o,this.reportingPeriodMillis=p,this.filterCPUUtilization=f,this.logger=m,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(o){let p=o-this.lastReportedEventTimestamp;if(p>=this.reportingPeriodMillis){let f=this.filterCount,m=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=o,0===this.framerate||0===f)return;let _=Math.round(m/f),w=Math.round(this.framerate*(p/1e3))-f,I=Math.round(100*m/p);_>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:w,avgFilterDurationMillis:_,framerate:this.framerate,periodMillis:p}),I>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:I,filterMillis:m,periodMillis:p})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(o){o!==this.framerate&&(this.framerate=o,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());let p=Date.now();this.reportEvent(p)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},0x190179907:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.BackgroundFilterMonitor=void 0;let w=f(0x1e62759b2),I=_(f(0x8cc00a0b)),k=_(f(0xd154b86a)),M=class{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise(o=>this.resolve=o)),this.promise}next(o){this.value=o,this.resolve(o),delete this.promise}};p.default=class BackgroundFilterProcessor{constructor(o,p,f,m,_){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new I.default(this.targetCanvas),this.mask$=new M,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=BackgroundFilterProcessor.createWorkerPromise(),this.loadModelPromise=BackgroundFilterProcessor.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=o,this.validateSpec(p),this.validateOptions(f),this.spec=p,this.logger=f.logger,this.delegate=m,this.initCPUMonitor(f),this.eventController=_}static createWorkerPromise(){let o={resolve:null,reject:null,promise:null};return o.promise=new Promise((p,f)=>{o.resolve=p,o.reject=f}),o}validateSpec(o){if(!o)throw Error("processor has null spec");if(!o.model)throw Error("processor spec has null model");if(!o.paths)throw Error("processor spec has null paths")}validateOptions(o){if(!o)throw Error("processor has null options");if(!o.logger)throw Error("processor has null options - logger");if(!o.reportingPeriodMillis)throw Error("processor has null options - reportingPeriodMillis");if(!o.filterCPUUtilization)throw Error("processor has null options - filterCPUUtilization")}initCPUMonitor(o){this.videoFramesPerFilterUpdate=1,this.frameCounter=new k.default(this.delegate,o.reportingPeriodMillis,o.filterCPUUtilization,this.logger),this.cpuMonitor=new x(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(o){return JSON.stringify(o,null,2)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(o){if(this.logger.info(`received load model message: ${this.stringify(o)}`),2!==o.payload){this.logger.error("failed to load model! status: "+o.payload),this.loadModelPromise.reject(Error("failed to load model! status: "+o.payload));return}this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(o){this.mask$.next(o.payload.output)}handleWorkerEvent(o){let p=o.data;switch(p.msg){case"initialize":this.handleInitialize(p);break;case"loadModel":this.handleLoadModel(p);break;case"predict":this.handlePredict(p);break;default:this.logger.info(`unexpected event msg: ${this.stringify(p)}`)}}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("start initializing the processor");try{this.worker=yield w.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},null),this.worker.addEventListener("message",o=>this.handleWorkerEvent(o)),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(o){throw Error(`could not initialize the ${this.filterType} video frame processor due to '${o.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)})}process(o){return m(this,void 0,void 0,function*(){if(this.destroyed)return o;this.frameCounter.frameReceived(o[0].framerate),this.cpuMonitor.frameReceived();let p=o[0].asCanvasElement();if(!p)return o;if(!this.modelInitialized)return o[0]=this.canvasVideoFrameBuffer,o;let f=p.width,m=p.height;if(0===f||0===m)return o;0===this.sourceWidth&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),(this.sourceWidth!==f||this.sourceHeight!==m)&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let o=this.mask$.value,f=this.spec.model.input.width/p.width,m=this.spec.model.input.height/p.height;void 0===this.scaledCanvas&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);let _=this.scaledCanvas.getContext("2d");_.save(),_.scale(f,m),_.drawImage(p,0,0),_.restore();let w=_.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate==0){let p=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:w},[w.data.buffer]),o=yield p}this.destroyed||this.drawImageWithMask(p,o)}catch(p){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${p}`),o}finally{this.frameCounter.filterComplete(),this.frameNumber++}return o[0]=this.canvasVideoFrameBuffer,o})}updateVideoFramesPerFilterUpdate(o){o!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=o,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var o,p,f,_;return m(this,void 0,void 0,function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),null==(o=this.worker)||o.postMessage({msg:"destroy"}),null==(p=this.worker)||p.postMessage({msg:"stop"}),null==(f=this.targetCanvas)||f.remove(),this.targetCanvas=void 0,null==(_=this.scaledCanvas)||_.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)})}};let x=class{constructor(o,p){this.monitoringPeriodMillis=o,this.observer=p,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){let o=Date.now();o-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.reduceCPUUtilization())}frameReceived(){let o=Date.now();o-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.increaseCPUUtilization())}};p.BackgroundFilterMonitor=x},0x217eb324b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1e62759b2),I=f(0x1676280b0),k=_(f(0x18769c7b5)),M=_(f(0x9a4430b2)),x=_(f(0x22a0f7c69)),O="https://static.sdkassets.chime.aws",L={worker:`${O}/bgblur/workers/worker.js`,wasm:`${O}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${O}/bgblur/wasm/_cwt-wasm-simd.wasm`};p.default=class{static defaultAssetSpec(){let o=x.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}}static createUrlWithParams(o,p){let f=new URL(o);for(let o of Object.keys(p))void 0!==p[o]&&f.searchParams.set(o,p[o]);return f.toString()}static resolveSpec(o){let{paths:p=L,model:f=k.default.builder().withSelfieSegmentationDefaults().build(),assetGroup:m=this.defaultAssetSpec().assetGroup,revisionID:_=this.defaultAssetSpec().revisionID}=o||{},w={assetGroup:m,revisionID:_,sdk:encodeURIComponent(x.default.sdkVersion),ua:encodeURIComponent(x.default.sdkUserAgentLowResolution)};return p.worker=this.createUrlWithParams(p.worker,w),p.wasm=this.createUrlWithParams(p.wasm,w),p.simd=this.createUrlWithParams(p.simd,w),f.path=this.createUrlWithParams(f.path,w),{paths:p,model:f,assetGroup:m,revisionID:_}}static resolveOptions(o){return o.reportingPeriodMillis||(o.reportingPeriodMillis=1e3),o.filterCPUUtilization?(o.filterCPUUtilization<0||o.filterCPUUtilization>100)&&(o.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),o.filterCPUUtilization=30):o.filterCPUUtilization=30,o}static isSupported(o,p){let{logger:f}=p;return"u"{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}filterFrameDurationHigh(o){var p;for(let f of this.observers)null==(p=f.filterFrameDurationHigh)||p.call(f,o)}filterCPUUtilizationHigh(o){var p;for(let f of this.observers)null==(p=f.filterCPUUtilizationHigh)||p.call(f,o)}}},0x22c476071:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x190179907)),I=_(f(0xdfc1fc4a));p.default=class BackgroundReplacementFilter extends w.default{constructor(o,p){super("background replacement",o,p,new I.default),this.replacementBlob=p.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: { filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}setImageBlob(o){return m(this,void 0,void 0,function*(){this.replacementBlob=o,this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl())})}initOnFirstExecution(){}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.drawImage(this.replacementImage,0,0,m.width,m.height),f.restore()}static loadImageExecutor(o,p,f){let m=new Image;m.crossOrigin="Anonymous",m.addEventListener("load",()=>{o(m)},!1),m.addEventListener("error",o=>{p(Error(`Could not load replacement image ${m.src}: ${o.message}`))},!1),m.src=f}static loadImage(o){return m(this,void 0,void 0,function*(){return new Promise((p,f)=>this.loadImageExecutor(p,f,o))})}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){let o=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return m(this,void 0,void 0,function*(){this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl()),o.loadAssets.call(this)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}destroy(){let o=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){o.destroy.call(this),this.revokeReplacementObjectUrl()})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){this.eventController.publishEvent("backgroundFilterConfigSelected",{backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1})}}},0x36f3f7d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x217eb324b)),I=_(f(0x12346a842)),k=_(f(0x19a5566fd)),M=_(f(0x84671e3f)),x=_(f(0x22c476071)),O=class extends M.default{loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}setImageBlob(){return m(this,void 0,void 0,function*(){})}};p.default=class BackgroundReplacementVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let{logger:f}=p;if(!(yield BackgroundReplacementVideoFrameProcessor.isSupported(o,p)))return f.warn("Using no-op processor because background replacement is not supported"),new O;f.info("Using background replacement filter");let m=new x.default(o,p);return yield m.loadAssets(),m})}static resolveOptions(o={}){let p=Object.assign({},o);return p.logger||(p.logger=new I.default("BackgroundReplacementProcessor",k.default.INFO)),super.resolveOptions(p)}static resolveOptionsAsync(o){return m(this,void 0,void 0,function*(){if(!o.imageBlob){let p=document.createElement("canvas");p.width=100,p.height=100;let f=p.getContext("2d");f.fillStyle="blue",f.fillRect(0,0,100,100),o.imageBlob=yield new Promise(o=>{p.toBlob(o)})}})}static isSupported(o,p){let f=Object.create(null,{isSupported:{get:()=>super.isSupported}});return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let m=p.imageBlob,_=URL.createObjectURL(m);try{yield x.default.loadImage(_)}catch(o){return p.logger.info(`Failed to fetch load replacement image ${o.message}`),!1}finally{URL.revokeObjectURL(_)}return f.isSupported.call(this,o,p)})}}},0xdfc1fc4a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f9d952c4));p.default=class extends _.default{}},0x14915840a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){let o=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,o}}},0x6e5ae8b8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a)),w=m(f(0x1e2c96978));p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f}create(){return new _.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(o){return new w.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,o)}}},0x1e2c96978:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14915840a));p.default=class extends _.default{constructor(o,p,f,m){super(o,p,f),this.limit=m,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw Error("retry limit exceeded");return super.nextBackoffAmountMs()}}},0x9a4430b2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x22e89c4d),w=f(0x2056040c6),I=class DefaultBrowserBehavior{constructor(){this.FALLBACK_BROWSER={type:"browser",name:"unknown",version:"unknown",os:"unknown"},this.browser=_.detect()||this.FALLBACK_BROWSER,this.uaParserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null,this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview","edge-ios"]}version(){return this.browser.version}majorVersion(){return null!==this.version()?parseInt(this.version().split(".")[0]):-1}osMajorVersion(){return parseInt(this.uaParserResult.os.version.split(".")[0])}engine(){return this.uaParserResult.engine.name}engineMajorVersion(){return parseInt(this.uaParserResult.engine.version.split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(let o of this.chromeLike)if(o===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(let o of this.webkitBrowsers)if(o===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}requiresPlaybackLatencyHintForAudioContext(){return -1!==navigator.userAgent.indexOf("Windows")}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()&&!this.isIOSEdge()||this.isIOSSafari()&&this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK||this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK}supportsBackgroundFilter(){return("safari"!==this.name()||15!==this.majorVersion())&&!!this.supportsCanvasCapturedStreamPlayback()}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsDependencyDescriptorRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsScalableVideoCoding(){return this.hasChromiumWebRTC()&&"Blink"===this.engine()&&this.engineMajorVersion()>=111}supportsAudioRedundancy(){return this.hasChromiumWebRTC()?this.engineMajorVersion()>=107:!this.hasFirefoxWebRTC()}requiresResolutionAlignment(o,p){return this.isAndroid()&&this.isPixel3()?[64*Math.ceil(o/64),64*Math.ceil(p/64)]:[o,p]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()o.includes("a=rtpmap:")).map(o=>o.replace(/.* /,"").replace(/\/.*/,"")).filter((o,p,f)=>f.indexOf(o)===p).filter(o=>"rtx"!==o&&"red"!==o&&"ulpfec"!==o)})}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return this.isIOS()&&("15.1.0"===this.version()||/( OS 15_1)/i.test(navigator.userAgent))}requiresVideoPlayWorkaround(){return this.isSafari()}requiresAudioContextResetOnDeviceFailureForWebAudio(){return this.isIOS()}isVideoFxSupportedBrowser(){return this.supportsBackgroundFilter()}isIOSSafari(){return"ios"===this.browser.name||"ios-webview"===this.browser.name||"safari"===this.browser.name&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}isSafari(){return"safari"===this.browser.name||this.isIOSSafari()}isFirefox(){return"firefox"===this.browser.name}isIOSFirefox(){return"fxios"===this.browser.name}isIOSChrome(){return"crios"===this.browser.name}isChrome(){return"chrome"===this.browser.name}isEdge(){return"edge-chromium"===this.browser.name}isIOSEdge(){return"edge-ios"===this.browser.name}isSamsungInternet(){return"samsung"===this.browser.name}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isIOS(){return this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox()}};p.default=I,I.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16,I.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK=106},0x176b792fb:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x243b8874c)),I=m(f(0xebe235e1)),k=m(f(0x1bb68f383));p.default=class ClientMetricReport{constructor(o,p,f){this.logger=o,this.videoStreamIndex=p,this.selfAttendeeId=f,this.globalMetricReport=new k.default,this.streamMetricReports={},this.rtcStatsReport={},this.customStatsReports=[],this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.overriddenObservableMetrics=new Map,this.identityValue=(o,p)=>Number((p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.decoderLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.concealedSamples-(f.previousMetrics.concealedSamples||0),_=f.currentMetrics.totalSamplesReceived-(f.previousMetrics.totalSamplesReceived||0);return _<=0||_-m<=0?0:m/_*100},this.packetLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics[o]-(f.previousMetrics[o]||0),_=f.currentMetrics.packetsLost-(f.previousMetrics.packetsLost||0),w=m+_;return w<=0||_<=0?0:100*_/w},this.jitterBufferMs=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.jitterBufferDelay-(f.previousMetrics.jitterBufferDelay||0),_=f.currentMetrics.jitterBufferEmittedCount-(f.previousMetrics.jitterBufferEmittedCount||0);return m<=0||_<=0?0:m/_*1e3},this.countPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:Math.trunc(_/m)},this.bitsPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=(f.currentMetrics[o]-(f.previousMetrics[o]||0))*8;return _<=0?0:Math.trunc(_/m)},this.secondsToMilliseconds=(o,p)=>Number(1e3*(p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.averageTimeSpentPerSecondInMilliseconds=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:1e3*_/m},this.averageCpuQualityLimitationDurationPerSecondInMilliseconds=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.previousObjectMetrics[o]||void 0===f.currentObjectMetrics[o])return NaN;let m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=0,w=0;for(let[p,m]of Object.entries(f.previousObjectMetrics[o]))"cpu"===p&&(_=m);for(let[p,m]of Object.entries(f.currentObjectMetrics[o]))"cpu"===p&&(w=m);let I=w-_;return I<=0?0:1e3*I/m},this.isHardwareImplementation=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.currentStringMetrics[o])return NaN;let m=String(f.currentStringMetrics[o]),_=m.includes("ExternalDecoder")||m.includes("ExternalEncoder")||m.includes("EncodeAccelerator")||m.includes("DecodeAccelerator"),w=m.includes("fallback from");return _&&!w?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:_.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.STUN_RTT_MS},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_MIC_AUDIO_LEVEL,source:"audioLevel"}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_SPK_BITRATE},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_AUDIO_LEVEL},totalAudioPacketsLost:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_LOST},totalAudioPacketsExpected:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_EXPECTED},totalAudioPacketsRecoveredRed:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_RED},totalAudioPacketsRecoveredFec:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_FEC}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_JITTER_MS},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE},qualityLimitationDurations:{transform:this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU},videoCodecDegradationHighEncodeCpu:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU},videoCodecDegradationEncodeFailure:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE},videoInputWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_WIDTH},videoInputHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_HEIGHT}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE},totalFreezesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_FREEZE_DURATION},freezeCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FREEZE_COUNT},totalPausesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_PAUSE_DURATION},pauseCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PAUSE_COUNT},framesDropped:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DROPPED_FPS},videoRenderWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_WIDTH},videoRenderHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_HEIGHT}},this.streamDimensionMap={encoderImplementation:_.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:_.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesInputPerSecond:{source:"framesPerSecond",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamEncoderImplementation:{source:"encoderImplementation",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamTotalEncodeTimePerSecond:{source:"totalEncodeTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamCpuQualityLimitationDurationPerSecond:{source:"qualityLimitationDurations",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:I.default.VIDEO,dir:w.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.AUDIO,dir:w.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:I.default.VIDEO,dir:w.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"},audioDownstreamLevel:{source:"audioLevel",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamLevel:{source:"audioLevel"}}}getMetricMap(o,p){switch(o){case I.default.AUDIO:switch(p){case w.default.UPSTREAM:return this.audioUpstreamMetricMap;case w.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case I.default.VIDEO:switch(p){case w.default.UPSTREAM:return this.videoUpstreamMetricMap;case w.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(o){if(this.overriddenObservableMetrics.has(o))return this.overriddenObservableMetrics.get(o);let p=this.observableMetricSpec[o],{transform:f,source:m}=this.getMetricMap(p.media,p.dir)[p.source];if(!p.hasOwnProperty("media"))return f(m||p.source);for(let o in this.streamMetricReports){let _=this.streamMetricReports[o];if(_.direction===p.dir&&_.mediaType===p.media)return f(m||p.source,Number(o))}return 0}getObservableVideoMetricValue(o,p){let f=this.observableVideoMetricSpec[o],{transform:m,source:_}=this.getMetricMap(f.media,f.dir)[f.source];return m(_||f.source,p)}getVideoUpstreamSsrcs(){let o=[];for(let p in this.streamMetricReports)this.streamMetricReports[p].mediaType===I.default.VIDEO&&this.streamMetricReports[p].direction===w.default.UPSTREAM&&o.push(Number(p));return o}getObservableMetrics(){let o={};for(let p in this.observableMetricSpec)o[p]=this.getObservableMetricValue(p);return o}getObservableVideoMetrics(){let o={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),o;for(let p in this.streamMetricReports)if(this.streamMetricReports[p].mediaType===I.default.VIDEO){let f={};for(let o in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[o].dir===this.streamMetricReports[p].direction){let m=this.getObservableVideoMetricValue(o,Number(p));isNaN(m)||(f[o]=m)}let m=this.streamMetricReports[p].groupId,_=this.streamMetricReports[p].streamId,w="";o[w=void 0!==this.videoStreamIndex.attendeeIdForGroupId?m?this.videoStreamIndex.attendeeIdForGroupId(m):this.selfAttendeeId:_?this.videoStreamIndex.attendeeIdForStreamId(_):this.selfAttendeeId]=o[w]?o[w]:{},o[w][p]=f}return o}getRTCStatsReport(){return this.rtcStatsReport}clone(){let o=new ClientMetricReport(this.logger,this.videoStreamIndex,this.selfAttendeeId);return o.globalMetricReport=this.globalMetricReport,o.streamMetricReports=this.streamMetricReports,o.rtcStatsReport=this.rtcStatsReport,o.customStatsReports=this.customStatsReports,o.currentTimestampMs=this.currentTimestampMs,o.previousTimestampMs=this.previousTimestampMs,o.overriddenObservableMetrics=this.overriddenObservableMetrics,o}print(){let o={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug(()=>`Client Metric Report: ${JSON.stringify(o)}`)}removeDestroyedSsrcs(){for(let o in this.streamMetricReports)this.currentSsrcs[o]||delete this.streamMetricReports[o]}overrideObservableMetric(o,p){this.overriddenObservableMetrics.set(o,p)}}},0x243b8874c:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportDirection=void 0,(m=f=p.ClientMetricReportDirection||(p.ClientMetricReportDirection={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM",p.default=f},0xebe235e1:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportMediaType=void 0,(m=f=p.ClientMetricReportMediaType||(p.ClientMetricReportMediaType={}))[m.AUDIO=0]="AUDIO",m[m.VIDEO=1]="VIDEO",p.default=f},0x1ef8cd3d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1bb68f383:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x15a1c7c16:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.currentTimestampMs=0,this.ssrc=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsExpected=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}}},0x49c5e00:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x21ae4c990:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.minHealth=o.minHealth,this.maxHealth=o.maxHealth,this.currentHealth=o.initialHealth,this.currentData=p.clone(),this.name=f}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(o){this.currentData=o}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){let o=this.health();return o!==this.currentHealth?(this.currentHealth=o,o):null}}},0x18c985af:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ConnectionHealthData{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(o,p){return Date.now()=ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD,p=this.currentData.consecutiveMissedPongs>=ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;let f=this.audioDelayPointsOverMaximum>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return(f&&(this.audioDelayPointsOverMaximum=0),o||p||f)?(this.logger.warn(`reconnection recommended due to: no packets received: ${o}, missed pongs: ${p}, bad audio delay: ${f}`),0):1}}},0x20ae9efa5:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990));p.default=class extends _.default{constructor(o,p,f){super(p,f,"Sending Audio Health"),this.logger=o,this.sendingAudioFailureSamplesToConsider=p.sendingAudioFailureSamplesToConsider>0?p.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=p.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=p.maximumTimesToWarn,this.coolDownTimeMs=p.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){let o=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),p=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return o&&p}health(){if(this.isSendingAudioUnhealthy()){let o=Date.now()-this.lastWarnTimestampMsthis.minimumHealth())||o?this.currentHealth:(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())}return this.maximumHealth()}}},0x1c6788b50:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990));p.default=class extends _.default{constructor(o,p){super(o,p,"Unusable Audio Warning"),this.coolDownTimeMs=o.cooldownTimeMs,this.pastSamplesToConsider=o.pastSamplesToConsider,this.fractionalLoss=o.fractionalLoss,this.packetsExpected=o.packetsExpected,this.maximumTimesToWarn=o.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length=this.fractionalLoss)return 1*(0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,!!(this.warnCount>this.maximumTimesToWarn)));return 1}}},0x201f8c5d2:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoConcurrentSendersHealth),this.concurrentVideoSendersThreshold=o.concurrentVideoSendersThreshold}health(){return this.currentData.isContentShare?this.maximumHealth():this.currentData.numberOfPublishedVideoSources>this.concurrentVideoSendersThreshold?this.minimumHealth():this.maximumHealth()}}},0x17469a88e:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoEncodingConnectionHealthPolicyName=void 0,(m=f=p.VideoEncodingConnectionHealthPolicyName||(p.VideoEncodingConnectionHealthPolicyName={})).VideoEncodingCpuHealth="Video Encoding CPU Health",m.VideoEncodingFramerateHealth="Video Encoding framerate Health",m.VideoConcurrentSendersHealth="Video Concurrent Senders Health",p.default=f},0x1819749c9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingCpuHealth),this.consecutiveHighEncodeCpuCnt=0,this.consecutiveHighEncodeCpuThreshold=o.consecutiveHighEncodeCpuThreshold,this.highEncodeCpuMsThreshold=o.highEncodeCpuMsThreshold,this.highEncodeCpuMsPerFrameThreshold=o.highEncodeCpuMsPerFrameThreshold}health(){let o=this.currentData.videoEncodingTimeInMs>=this.highEncodeCpuMsThreshold&&this.currentData.videoEncodingTimePerFrameInMs>=this.highEncodeCpuMsPerFrameThreshold;if(!this.currentData.isVideoEncoderHardware&&(o||this.currentData.cpuLimitationDuration>0)){if(this.consecutiveHighEncodeCpuCnt++,this.consecutiveHighEncodeCpuCnt>this.consecutiveHighEncodeCpuThreshold)return this.consecutiveHighEncodeCpuCnt=0,this.minimumHealth()}else this.consecutiveHighEncodeCpuCnt=0;return this.maximumHealth()}}},0x2e16c318:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x21ae4c990)),w=m(f(0x17469a88e));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingFramerateHealth),this.consecutiveEncodeFailureCnt=0,this.consecutiveVideoEncodingFailureThreshold=o.consecutiveVideoEncodingFailureThreshold}health(){if(0===this.currentData.videoEncodeFps&&this.currentData.videoInputFps>0){if(this.consecutiveEncodeFailureCnt++,this.consecutiveEncodeFailureCnt>this.consecutiveVideoEncodingFailureThreshold)return this.consecutiveEncodeFailureCnt=0,this.minimumHealth()}else this.consecutiveEncodeFailureCnt=0;return this.maximumHealth()}}},0x202eb6fd7:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xab1ef933);p.default=class{constructor(o,p,f,m,_){this.audioVideoController=o,this.realtimeController=p,this.connectionHealthData=f,this.pingPong=m,this.statsCollector=_,this.isActive=!1,this.hasSeenValidCandidatePairMetricsBefore=!1,this.lastTotalBytesReceived=0,this.lastTotalStunMessagesReceived=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o=>{this.isActive&&this.receiveSignalStrengthChange(o)})}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(o){0===o?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):o<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(o,p,f){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",p),this.statsCollector.logLatency("ping_pong_clock_skew",f),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(o){let p=0,f=0,m=o.getObservableMetrics(),_=m.audioPacketsReceived,w=m.audioPacketsReceivedFractionLoss,I=m.audioSpeakerDelayMs;"number"!=typeof I||isNaN(I)||this.connectionHealthData.setAudioSpeakerDelayMs(I);let k=o.getRTCStatsReport(),M=0,x=0;k.forEach(o=>{"candidate-pair"===o.type&&(o.bytesReceived&&(M+=o.bytesReceived),o.requestsReceived&&(x+=o.requestsReceived),o.responsesReceived&&(x+=o.responsesReceived))});let O=M-this.lastTotalBytesReceived;this.lastTotalBytesReceived=M;let L=x-this.lastTotalStunMessagesReceived;this.lastTotalStunMessagesReceived=x,"number"!=typeof _||"number"!=typeof w||(p=_,f=w,p<0||f<0||O<0||L<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,p),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,f),O>0||L>0?(this.hasSeenValidCandidatePairMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidCandidatePairMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===p||f>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),"number"==typeof m.audioPacketsSent&&this.updateAudioPacketsSentInConnectionHealth(m.audioPacketsSent),this.updateVideoEncodingHealth(o),this.updateConnectionHealth()))}updateAudioPacketsSentInConnectionHealth(o){o>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}updateVideoEncodingHealth(o){let p=this.audioVideoController.videoTileController.hasStartedLocalVideoTile(),f=o.getVideoUpstreamSsrcs();if(!p||0===f.length){this.connectionHealthData.setIsVideoEncoderHardware(!1),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(0),this.connectionHealthData.setCpuLimitationDuration(0),this.connectionHealthData.setVideoInputFps(0),this.connectionHealthData.setVideoEncodeFps(0);return}let m=!1,_=0,w=0,I=0,k=0;for(let p of f)m||(m=!!o.getObservableVideoMetricValue("videoUpstreamEncoderImplementation",p)),_+=o.getObservableVideoMetricValue("videoUpstreamTotalEncodeTimePerSecond",p),w+=o.getObservableVideoMetricValue("videoUpstreamCpuQualityLimitationDurationPerSecond",p),I+=o.getObservableVideoMetricValue("videoUpstreamFramesInputPerSecond",p),k+=o.getObservableVideoMetricValue("videoUpstreamFramesEncodedPerSecond",p);let M=k>0?_/k:0;this.connectionHealthData.setIsVideoEncoderHardware(!!m),this.connectionHealthData.setVideoEncodingTimeInMs(_),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(M),this.connectionHealthData.setCpuLimitationDuration(w),this.connectionHealthData.setVideoInputFps(I),this.connectionHealthData.setVideoEncodeFps(k)}addToMinuteWindow(o,p){o.unshift(p),o.length>60&&o.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver(o=>{m.Maybe.of(o.connectionHealthDidChange).map(p=>p.bind(o)(this.connectionHealthData.clone()))})}}},0x86facdd2:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Modality="#content",p.default=f},0x748652da:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1db5b830a)),k=class ContentShareMediaStreamBroker{constructor(o){this.logger=o}get mediaStream(){return this._mediaStream}set mediaStream(o){this._mediaStream=o}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return 0===this._mediaStream.getAudioTracks().length?(this.logger.info("No audio stream available. Synthesizing an audio stream."),I.default.synthesizeAudioDevice(0)):this._mediaStream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){return this._mediaStream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){return o&&o.video&&o.video.mandatory&&o.video.mandatory.chromeMediaSource&&o.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(o):navigator.mediaDevices.getDisplayMedia(o)})}acquireScreenCaptureDisplayInputStream(o,p){return m(this,void 0,void 0,function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(o,p))})}screenCaptureDisplayMediaConstraints(o,p){return{audio:!!(!o&&new w.default().getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!o&&{frameRate:{max:p||ContentShareMediaStreamBroker.defaultFrameRate}}),o&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:o,maxFrameRate:p||ContentShareMediaStreamBroker.defaultFrameRate}})}}toggleMediaStream(o){let p=!1;if(this.mediaStream)for(let f=0;f{this.stopContentShare()});this.contentAudioVideo.start()}})}startContentShareFromScreenCapture(o,p){return m(this,void 0,void 0,function*(){let f=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(o,p);return yield this.startContentShare(f),f})}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidPause).map(p=>p.call(o))})}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidUnpause).map(p=>p.call(o))})}setContentShareVideoCodecPreferences(o){this.contentAudioVideo.setVideoCodecSendPreferences(o)}destroy(){return m(this,void 0,void 0,function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)})}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(o){this.observerQueue.add(o)}removeContentShareObserver(o){this.observerQueue.delete(o)}forEachContentShareObserver(o){for(let p of this.observerQueue)x.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}audioVideoDidStart(){var o;(null==(o=this.mediaStreamBroker.mediaStream)?void 0:o.getVideoTracks().length)>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(o){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStop).map(p=>p.call(o))})}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence((o,p,f,m)=>{let _=new M.default(o).hasModality(M.default.MODALITY_CONTENT),w=new M.default(o).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!_||!w||!p||this.contentShareTile)return;let I=this.mediaStreamBroker.mediaStream;if(null==I?void 0:I.getVideoTracks().length){let o,p;this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();let f=I.getVideoTracks()[0];if(f.getSettings){let m=f.getSettings();o=m.width,p=m.height}else{let m=f.getCapabilities();o=m.width,p=m.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,I,o,p,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStart).map(p=>p.call(o))})})}}},0x13dedab0d:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=class CSPMonitor{static register(){"document"in f.g&&document.addEventListener&&CSPMonitor.shouldRegisterCSPMonitor&&!CSPMonitor.added&&(document.addEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.added=!0)}static unregister(){"document"in f.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.loggers=new Set,CSPMonitor.added=!1)}static disable(){CSPMonitor.shouldRegisterCSPMonitor=!1,CSPMonitor.unregister()}static addLogger(o){o&&CSPMonitor.loggers.add(o)}static removeLogger(o){o&&CSPMonitor.loggers.delete(o)}};p.default=m,m.loggers=new Set,m.shouldRegisterCSPMonitor=!0,m.added=!1,m.listener=o=>{let p=`Security Policy Violation
Blocked URI: ${o.blockedURI}
Violated Directive: ${o.violatedDirective}
Original Policy: ${o.originalPolicy}
Document URI: ${o.documentURI}
Source File: ${o.sourceFile}
Line No.: ${o.lineNumber}
`;for(let o of m.loggers)o.error(p);0===m.loggers.size&&console.error(p)}},0x200be574b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w){this.timestampMs=o,this.topic=p,this.data=f,this.senderAttendeeId=m,this.senderExternalUserId=_,this.throttled=!!w}text(){return new TextDecoder().decode(this.data)}json(){return JSON.parse(new TextDecoder().decode(this.data))}}},0x24b1dc2b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isDestroyable=void 0,p.isDestroyable=function(o){return o&&"destroy"in o}},0x25cf5513:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isAudioTransformDevice=void 0,p.isAudioTransformDevice=function(o){return!!o&&"object"==typeof o&&"mute"in o&&"stop"in o&&"intrinsicDevice"in o}},0x1db5b830a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0xe13d341e)),k=_(f(0x1158c4d3)),M=_(f(0x172e1bd2a)),x=f(0xab1ef933),O=_(f(0xd9718ba1)),L=_(f(0xb747ec80)),B=f(0x25cf5513),U=_(f(0x105f3de65)),$=_(f(0x19b2d97e8)),q=_(f(0x4d06f54a)),Z=_(f(0x15ea31aea)),ee=_(f(0x747ce3f3)),et=_(f(0x1d643307b)),ei=_(f(0xdb2548f7)),er=_(f(0x170a3ef32)),en=f(0x1a86248d4),eo=class DefaultDeviceController{constructor(o,p,f=new w.default,m){this.logger=o,this.browserBehavior=f,this.eventController=m,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new M.default,this.videoInputTaskQueue=new M.default,this.muted=!1,this.mediaStreamMuteObserver=(o,p)=>{for(let f of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(f)&&f.audioInputMuteStateChanged&&f.audioInputMuteStateChanged(o,p)})},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:_=!1,useMediaConstraintsFallback:x=!0}=p||{};this.useWebAudio=_,this.useMediaConstraintsFallback=x,this.videoInputQualitySettings=new er.default(DefaultDeviceController.defaultVideoWidth,DefaultDeviceController.defaultVideoHeight,DefaultDeviceController.defaultVideoFrameRate);const O=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=O[0],this.videoInputQualitySettings.videoHeight=O[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=new I.default().create();const o=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(o)}`)}catch(p){o.error(p.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},null==(o=this.mediaDeviceWrapper)||o.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),null==(o=this.mediaDeviceWrapper)||o.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return!!this.deviceChangeObservers.size||this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return m(this,void 0,void 0,function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()})}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audioinput",o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("videoinput",o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audiooutput",o);return this.trace("listAudioOutputDevices",o,p),p})}pushAudioMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"videoInputUnselected":"videoInputSelected")}startAudioInput(o){return m(this,void 0,void 0,function*(){return yield this.audioInputTaskQueue.add(()=>this.startAudioInputTask(o))})}startAudioInputTask(o){var p;return m(this,void 0,void 0,function*(){if(void 0===o)return void this.logger.error("Audio input device cannot be undefined");try{if(B.isAudioTransformDevice(o)?(this.logger.info(`Choosing transform input device ${o}`),yield this.chooseAudioTransformInputDevice(o)):(this.logger.info(`Choosing intrinsic audio input device ${o}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",o)),this.trace("startAudioInputDevice",o,"success"),this.useWebAudio)return this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null==(p=this.transform)?void 0:p.device.mute(this.muted),this.getMediaStreamDestinationNode().stream;return this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream}catch(o){throw o}})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.audioInputTaskQueue.add(()=>this.stopAudioInputTask())})}stopAudioInputTask(){return m(this,void 0,void 0,function*(){try{if(this.useWebAudio)return void this.releaseAudioTransformStream();this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}})}chooseAudioTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){let f;if((null==(p=this.transform)?void 0:p.device)===o)return;if(!this.useWebAudio)throw Error("Cannot apply transform device without enabling Web Audio.");let m=DefaultDeviceController.getAudioContext();if(m instanceof OfflineAudioContext);else switch(m.state){case"running":break;case"closed":throw Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield m.resume()}try{f=yield o.createAudioNode(m)}catch(o){throw this.logger.error(`Unable to create transform device node: ${o}.`),o}let _=yield o.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",_),this.logger.debug(`Got inner stream: ${_}.`),this.setTransform(o,f)})}chooseVideoTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){if(this.eventController&&o instanceof O.default&&o.passEventControllerToProcessors(this.eventController),o===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");let f=this.chosenVideoTransformDevice;f&&this.logger.info("Switched from previous VideoTransformDevice");let m=!!f,_=yield o.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null==(p=this.activeDevices.video)?void 0:p.stream,_)){this.logger.info("video transform device needs new intrinsic device"),m&&f.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=o,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",_),this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream);return}this.chosenVideoTransformDevice=o,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield o.transformStream(this.activeDevices.video.stream)})}startVideoInput(o){return m(this,void 0,void 0,function*(){return yield this.videoInputTaskQueue.add(()=>this.startVideoInputTask(o))})}startVideoInputTask(o){return m(this,void 0,void 0,function*(){if(!o)return void this.logger.error("Invalid video input device");try{if(en.isVideoTransformDevice(o))return this.logger.info(`Choosing video transform device ${o}`),yield this.chooseVideoTransformInputDevice(o),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream;return this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",o),this.trace("startVideoInputDevice",o),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream}catch(o){throw o}})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.videoInputTaskQueue.add(()=>this.stopVideoInputTask())})}stopVideoInputTask(){return m(this,void 0,void 0,function*(){try{if(this.chosenVideoInputIsTransformDevice())return void this.releaseVideoTransformStream();this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}})}chooseAudioOutput(o){return m(this,void 0,void 0,function*(){this.audioOutputDeviceId=o,this.watchForDeviceChangesIfNecessary();let p=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(p),this.trace("chooseAudioOutput",o,null)})}addDeviceChangeObserver(o){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(o),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(o),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var o,p;if(!this.activeDevices.audio)return null;let f=null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.end;if(f){let o=f.context.createAnalyser();return o.removeOriginalInputs=()=>{try{f.disconnect(o)}catch(o){}},f.connect(o),o}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(o){let p=DefaultDeviceController.getAudioContext(),f=p.createAnalyser(),m=p.createMediaStreamSource(o);return m.connect(f),this.trace("createAnalyserNodeForAudioInput"),f.removeOriginalInputs=()=>{try{m.disconnect(f)}catch{}},f}startVideoPreviewForVideoInput(o){if(!this.activeDevices.video){this.logger.warn("cannot bind video preview since video input device has not been chosen"),this.trace("startVideoPreviewForVideoInput",o.id);return}L.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,o,!0),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){L.default.disconnectVideoStreamFromVideoElement(o,!1),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){if(this.deviceInfoCache){for(let o of this.deviceInfoCache)if(!o.label){this.deviceInfoCache=null;break}}this.deviceLabelTrigger=o,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=null;return this.useWebAudio?(p=DefaultDeviceController.getAudioContext().createMediaStreamSource(o)).connect(this.getMediaStreamOutputNode()):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(o,p);this.videoInputQualitySettings=new er.default(m[0],m[1],f)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return(this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio)?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){if(!this.activeDevices.video)throw Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){throw Error("unsupported")})}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(o){let p=this.activeDevices[o];if(!p)return;let f=p.endedCallback,m=p.trackMuteCallback,_=p.trackUnmuteCallback;for(let w of p.stream.getTracks())w.stop(),f&&w.removeEventListener("ended",f),m&&w.removeEventListener("mute",m),_&&w.removeEventListener("unmute",_),delete p.endedCallback,delete p.trackMuteCallback,delete p.trackUnmuteCallback,delete this.activeDevices[o]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(o){var p;let f=this.activeDevices.audio;if(this.useWebAudio&&(f=this.getMediaStreamDestinationNode()),f){for(let p of f.stream.getTracks())p.enabled!==o&&(p.enabled=o);!o!==this.muted&&(this.muted=!o,null==(p=this.transform)||p.device.mute(this.muted))}}static getIntrinsicDeviceId(o){if(!o)return;if("string"==typeof o)return o;if(o.id)return o.id;let p=o.deviceId;return p?"string"==typeof p||Array.isArray(p)?p:"string"==typeof p.exact||Array.isArray(p.exact)?p.exact:void 0:void 0}static createEmptyAudioDevice(){return DefaultDeviceController.synthesizeAudioDevice(0)}static synthesizeAudioDevice(o){let p=DefaultDeviceController.getAudioContext(),f=p.createMediaStreamDestination();if(o){let m=p.createGain();m.gain.value=.1,m.connect(f);let _=p.createOscillator();_.frequency.value=o,_.connect(m),_.start()}else{let o=p.createBufferSource();try{o.buffer=p.createBuffer(1,5*p.sampleRate,p.sampleRate)}catch(f){if(f&&"NotSupportedError"===f.name)o.buffer=p.createBuffer(1,5*DefaultDeviceController.defaultSampleRate,DefaultDeviceController.defaultSampleRate);else throw f}o.buffer.getChannelData(0)[0]=3e-4,o.loop=!0,o.connect(f),o.start()}return f.stream}listDevicesOfKind(o,p){return m(this,void 0,void 0,function*(){return(p||null===this.deviceInfoCache||!this.isWatchingForDeviceChanges())&&(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(o)})}updateDeviceInfoCacheFromBrowser(){var o;return m(this,void 0,void 0,function*(){if("u"{this.handleDeviceChange()});this.alreadyHandlingDeviceChange=!0;let o=this.listCachedDevicesOfKind("audioinput"),p=this.listCachedDevicesOfKind("videoinput"),f=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();let m=this.listCachedDevicesOfKind("audioinput"),_=this.listCachedDevicesOfKind("videoinput"),w=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver(I=>{this.areDeviceListsEqual(o,m)||x.Maybe.of(I.audioInputsChanged).map(o=>o.bind(I)(m)),this.areDeviceListsEqual(p,_)||x.Maybe.of(I.videoInputsChanged).map(o=>o.bind(I)(_)),this.areDeviceListsEqual(f,w)||x.Maybe.of(I.audioOutputsChanged).map(o=>o.bind(I)(w))}),this.alreadyHandlingDeviceChange=!1})}handleDeviceStreamEnded(o,p){return m(this,void 0,void 0,function*(){try{"audio"===o?(this.useWebAudio&&this.browserBehavior.requiresAudioContextResetOnDeviceFailureForWebAudio()?(this.logger.warn("Audio input device which was active is no longer available, suspending and resuming audio context before resetting to empty device to ensure packets are sent"),yield this.stopAudioInput(),DefaultDeviceController.suspendAudioContext(),DefaultDeviceController.resumeAudioContext()):this.logger.warn("Audio input device which was active is no longer available, resetting to empty device to ensure packets are sent"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch(o){this.logger.error("Failed to choose null device after stream ended.")}"audio"===o?this.forEachObserver(o=>{x.Maybe.of(o.audioInputStreamEnded).map(f=>f.bind(o)(p))}):this.forEachObserver(o=>{x.Maybe.of(o.videoInputStreamEnded).map(f=>f.bind(o)(p))})})}forEachObserver(o){for(let p of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(p)&&o(p)})}forEachMediaStreamBrokerObserver(o){for(let p of this.mediaStreamBrokerObservers)k.default.nextTick(()=>{this.mediaStreamBrokerObservers.has(p)&&o(p)})}areDeviceListsEqual(o,p){return JSON.stringify(o.map(o=>JSON.stringify(o)).sort())===JSON.stringify(p.map(o=>JSON.stringify(o)).sort())}intrinsicDeviceAsMediaStream(o){return o&&o.id?o:null}hasSameMediaStreamId(o,p,f){var m,_,w,I;let k;return"audio"===o?!!(k=null==f?void 0:f.audio.streamId)&&k===(null==(_=null==(m=p.constraints)?void 0:m.audio)?void 0:_.streamId):!!(k=null==f?void 0:f.video.streamId)&&k===(null==(I=null==(w=null==p?void 0:p.constraints)?void 0:w.video)?void 0:I.streamId)}hasSameGroupId(o,p,f){if(""===o)return!0;let m=DefaultDeviceController.getIntrinsicDeviceId(f);return this.logger.debug(`Checking deviceIds ${m} of type ${typeof m} with groupId ${o}`),"string"==typeof m&&o===this.getGroupIdFromDeviceId(p,m)}getGroupIdFromDeviceId(o,p){if(null!==this.deviceInfoCache){let f=this.listCachedDevicesOfKind(`${o}input`).find(o=>o.deviceId===p);if(f&&f.groupId)return this.logger.debug(`GroupId of deviceId ${p} found in cache is ${f.groupId}`),f.groupId}return this.logger.debug(`GroupId of deviceId ${p} found in cache is empty`),""}handleGetUserMediaError(o,p){if(!o)throw new $.default(o);switch(o.name){case"NotReadableError":case"TrackStartError":throw new Z.default(o);case"NotFoundError":case"DevicesNotFoundError":throw new q.default(o);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":if(p&&p{this.activeDevices[o]&&this.activeDevices[o].stream===p.stream&&(this.handleDeviceStreamEnded(o,m),delete p.endedCallback)},_.addEventListener("ended",p.endedCallback,{once:!0})),"audio"===o){let o=p.stream.getAudioTracks()[0];if(o){let f=o.getSettings().deviceId||p.stream;p.trackMuteCallback=()=>{this.mediaStreamMuteObserver(f,!0)},p.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(f,!1)},o.addEventListener("mute",p.trackMuteCallback,{once:!1}),o.addEventListener("unmute",p.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),o.muted?p.trackMuteCallback():p.trackUnmuteCallback()}}})}calculateMediaStreamConstraints(o,p,f,m){if(m&&1===this.listCachedDevicesOfKind(`${o}input`).length)return!0;let _={};return(this.browserBehavior.requiresNoExactMediaStreamConstraints()?_.deviceId=p:_.deviceId={exact:p},f&&(_.groupId=f),m)?_:"video"===o?(_.width={ideal:this.videoInputQualitySettings.videoWidth},_.height={ideal:this.videoInputQualitySettings.videoHeight},_.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},_):(this.supportSampleRateConstraint()&&(_.sampleRate={ideal:DefaultDeviceController.defaultSampleRate}),this.supportSampleSizeConstraint()&&(_.sampleSize={ideal:DefaultDeviceController.defaultSampleSize}),this.supportChannelCountConstraint()&&(_.channelCount={ideal:DefaultDeviceController.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},_))}getMediaStreamConstraintsFromTrackConstraints(o,p){return"audio"===o?{audio:p}:{video:p}}getMediaStreamConstraints(o,p,f=!1){let m={};if(!p)return null;let _=this.intrinsicDeviceAsMediaStream(p);if(_)return m.streamId=_.id,this.getMediaStreamConstraintsFromTrackConstraints(o,m);if("string"==typeof p){let _="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(null!==this.deviceInfoCache?_=this.getGroupIdFromDeviceId(o,p):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),m=this.calculateMediaStreamConstraints(o,p,_,f),this.getMediaStreamConstraintsFromTrackConstraints(o,m)}return isMediaDeviceInfo(p)?m=this.calculateMediaStreamConstraints(o,p.deviceId,p.groupId,f):m=p,this.getMediaStreamConstraintsFromTrackConstraints(o,m)}deviceInfoFromDeviceId(o,p){if(null===this.deviceInfoCache)return null;for(let f of this.deviceInfoCache)if(f.kind===o&&f.deviceId===p)return f;return null}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(o,p){if(!o||!o.active||!p)return!1;if(p.id)return o.id===p.id;let f=this.getMediaTrackSettings(o);if(!f.deviceId)return!1;let m=DefaultDeviceController.getIntrinsicDeviceId(p);return"string"==typeof m&&f.deviceId===m}getMediaTrackSettings(o){var p;return null==(p=o.getTracks()[0])?void 0:p.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();let o=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(o)}setTransform(o,p){var f,m;null==(m=null==(f=this.transform)?void 0:f.nodes)||m.end.disconnect(),this.transform={nodes:p,device:o};let _=null==p?void 0:p.end,w=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${_} to destination ${w}.`),null==_||_.connect(w),this.reconnectAudioInputs()}removeTransform(){var o;let p=this.transform;if(p)return null==(o=this.transform.nodes)||o.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),p}attachAudioInputStreamToAudioContext(o){var p;null==(p=this.audioInputSourceNode)||p.disconnect(),this.audioInputSourceNode=DefaultDeviceController.getAudioContext().createMediaStreamSource(o);let f=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(f)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=DefaultDeviceController.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var o,p;return(null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.start)||this.getMediaStreamDestinationNode()}static setDefaultLatencyHint(o){DefaultDeviceController.defaultLatencyHint=o}static getAudioContext(){if(!DefaultDeviceController.audioContext){let o={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(o.sampleRate=DefaultDeviceController.defaultSampleRate),new w.default().requiresPlaybackLatencyHintForAudioContext()&&(o.latencyHint="playback"),DefaultDeviceController.defaultLatencyHint&&(o.latencyHint=DefaultDeviceController.defaultLatencyHint),DefaultDeviceController.audioContext=new(window.AudioContext||window.webkitAudioContext)(o)}return DefaultDeviceController.audioContext}static suspendAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.suspend():Promise.resolve()})}static resumeAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.resume():Promise.resolve()})}static closeAudioContext(){if(DefaultDeviceController.audioContext)try{DefaultDeviceController.audioContext.close()}catch(o){}DefaultDeviceController.audioContext=null}addMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.add(o)}removeMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.delete(o)}publishVideoInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.videoInputDidChange&&p.videoInputDidChange(o)}),this.pushVideoMeetingStateForPermissions(o)}publishAudioInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioInputDidChange&&p.audioInputDidChange(o)}),this.pushAudioMeetingStateForPermissions(o)}publishAudioOutputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioOutputDidChange&&p.audioOutputDidChange(o)})}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(o,p,f){let m=`API/DefaultDeviceController/${o}`;void 0!==p&&(m+=` ${JSON.stringify(p)}`),void 0!==f&&(m+=` -> ${JSON.stringify(f)}`),this.logger.info(m)}};function isMediaDeviceInfo(o){return"object"==typeof o&&"deviceId"in o&&"groupId"in o&&"kind"in o&&"label"in o}p.default=eo,eo.permissionDeniedOriginDetectionThresholdMs=500,eo.defaultVideoWidth=960,eo.defaultVideoHeight=540,eo.defaultVideoFrameRate=15,eo.defaultSampleRate=48e3,eo.defaultSampleSize=16,eo.defaultChannelCount=1,eo.audioContext=null},0x105f3de65:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.groupId=""}matchesConstraints(o){return JSON.stringify(this.constraints)===JSON.stringify(o)}}},0x19b2d97e8:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class extends Error{constructor(o,p){super(p||"Error fetching device."),this.cause=o,this.name="GetUserMediaError"}}},0xf371a16d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.NoOpDeviceControllerWithEventController=void 0;let w=_(f(0x203f02bb7)),I=_(f(0x170a3ef32)),k=class extends w.default{constructor(o){super(),this.destroyed=!1}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0})}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(o){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(o){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(o){return Promise.reject()}addDeviceChangeObserver(o){}removeDeviceChangeObserver(o){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(o){}stopVideoPreviewForVideoInput(o){}setDeviceLabelTrigger(o){}mixIntoAudioInput(o){return null}chooseVideoInputQuality(o,p,f){}getVideoInputQualitySettings(){return I.default.VideoDisabled}};p.default=k,p.NoOpDeviceControllerWithEventController=class extends k{constructor(o){super(),this.eventController=o}}},0x4d06f54a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="NotFoundError"}}},0x15ea31aea:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="NotReadableError"}}},0x747ce3f3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o,p){super(o),this.constraint=p,this.name="OverconstrainedError"}}},0x1d643307b:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o,p){super(o,p),this.name="PermissionDeniedError"}}},0xdeed8ee7:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.inner=o}mute(o){return f(this,void 0,void 0,function*(){})}stop(){var o;return f(this,void 0,void 0,function*(){null==(o=this.node)||o.disconnect()})}intrinsicDevice(){return f(this,void 0,void 0,function*(){return this.inner})}createAudioNode(o){var p;return f(this,void 0,void 0,function*(){return null==(p=this.node)||p.disconnect(),this.node=yield this.createSingleAudioNode(o),{start:this.node,end:this.node}})}}},0xdb2548f7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19b2d97e8));p.default=class extends _.default{constructor(o){super(o),this.name="TypeError"}}},0x170a3ef32:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class{constructor(o,p,f){this.videoWidth=o,this.videoHeight=p,this.videoFrameRate=f}equals(o){return this.videoWidth===o.videoWidth&&this.videoHeight===o.videoHeight&&this.videoFrameRate===o.videoFrameRate}};p.default=f,f.VideoDisabled=new f(0,0,0),f.VideoResolutionHD=new f(1280,720,30),f.VideoResolutionFHD=new f(1920,1080,30),f.VideoResolutionUHD=new f(3840,2160,30)},0x1a86248d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isVideoTransformDevice=void 0,p.isVideoTransformDevice=function(o){return!!o&&"object"==typeof o&&"transformStream"in o&&"stop"in o&&"intrinsicDevice"in o}},0x167bde784:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){if(this.devicePixelRatioSource=o,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach(o=>{o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())})},"u"{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{devicePixelRatio(){return!("u"p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f},w=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let I=w(f(0x14915840a)),k=w(f(0xd475f02c)),M=w(f(0x19f971fd8)),x=f(0xb79a45b7),O=class InMemoryJSONEventBuffer{constructor(o,p,f,w,I){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=o=>({type:o.type,v:o.v,payloads:[...o.payloads]}),this.sendEvents=()=>m(this,void 0,void 0,function*(){if(this.lock)return;let o=this.getItems(this.flushSize);if(0===o.length)return;this.lock=!0;let p=this.makeRequestBody(o),f=!1,m=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(m,o);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${p}`);let o=yield this.send(p);if(this.cancellableEvents.delete(m),o.ok)try{let f=yield o.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${p} message: ${JSON.stringify(f)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${o} for events ${p}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${p} with response status ${o.status}`),f=!0}catch(o){f=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${p} to the ingestion endpoint ${o}`)}finally{this.lock=!1}f&&(this.cancellableEvents.delete(m),this.failedIngestionEvents.push(...o))});const k=new M.default(I).getParserResult(),{browserMajorVersion:x}=k,O=_(k,["browserMajorVersion"]),L=p.toJSON(),{type:B,v:U}=L,$=_(L,["type","v"]);this.authenticationToken=p.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},O),$),Object.keys(this.metadata).forEach(o=>this.attributesToFilter.push(o)),this.type=B,this.v=U,this.ingestionURL=f,this.logger=I,this.importantEvents=new Set(w);const{maxBufferCapacityKb:q,totalBufferItems:Z,flushSize:ee,flushIntervalMs:et,retryCountLimit:ei}=o;this.maxBufferCapacityBytes=1024*q,this.totalBufferItems=Z,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/Z),this.flushIntervalMs=et,this.flushSize=ee,this.retryCountLimit=ei,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=o=>this.beaconEventHandler(o),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in f.g&&window.addEventListener&&"document"in f.g&&document.addEventListener&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(o){("visibilitychange"===o.type&&"hidden"===document.visibilityState||"pagehide"===o.type)&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){this.beaconEventListener&&"window"in f.g&&window.removeEventListener&&"document"in f.g&&document.removeEventListener&&(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var o;this.removeEventListeners(),this.addEventListeners(),null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=new k.default(this.flushIntervalMs),this.intervalScheduler.start(()=>this.sendEvents())}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_=m&&this.filterAttributes(m,this.attributesToFilter),w=Object.assign({name:p,ts:f},_);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(w)}`);let I=this.getSize(w);if(I>InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED)throw Error(`Event Reporting - Item to be added has size ${I} bytes. Item cannot exceed max item size allowed of ${InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(p)){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(w)}`),this.sendEventImmediately({name:p,ts:f,attributes:_});return}if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),Error("Buffer full");if(this.currentIngestionEvent.payloads.push(w),this.ingestionEventSize+=I,this.bufferItemThresholdReached(I)){let o=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(o),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}})}filterAttributes(o,p){let f=new Set(p);return Object.keys(o).filter(o=>f.has(o)).forEach(p=>delete o[p]),o}initializeAndGetCurrentIngestionEvent(){let o={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(o),o}bufferItemThresholdReached(o){return o+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===InMemoryJSONEventBuffer.MAX_PAYLOAD_ITEMS}getSize(o){let p=0;if("object"==typeof o)for(let[f,m]of Object.entries(o))p+=this.getPrimitiveSize(f),p+=this.getSize(m);else p+=this.getPrimitiveSize(o);return p}getPrimitiveSize(o){let p=0;return"string"==typeof o?p+=2*o.length:"number"==typeof o&&(p+=8),p}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return 0===this.buffer.length||0===this.bufferSize}getItems(o,p=0){return this.isEmpty()?[]:(o=Math.min(this.buffer.length,o+1),this.buffer.splice(p,o))}makeBeaconRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o,authorization:this.authenticationToken})}makeRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o})}sendEventImmediately(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_={type:this.type,v:this.v,payloads:[Object.assign({name:p,ts:f},m)]},w=!1,I=null,k=this.makeRequestBody([_]);try{if((I=yield this.send(k)).ok){try{let o=yield I.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${k}, message: ${JSON.stringify(o)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${o} for event ${k}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${k} with response status ${I.status}`),w=!0}catch(o){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${k} to the ingestion endpoint ${o}.`),w=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){let o=this.makeBeaconRequestBody([_]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${o}`),w=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,o)}}catch(o){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${k}`),w=!0}}w&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${k}`),this.failedIngestionEvents.push(_))})}send(o){return m(this,void 0,void 0,function*(){let p=new I.default(InMemoryJSONEventBuffer.RETRY_FIXED_BACKOFF_WAIT_MS,InMemoryJSONEventBuffer.RETRY_SHORT_BACKOFF_MS,InMemoryJSONEventBuffer.RETRY_LONG_BACKOFF_MS);try{let f=0;for(;f0){let p=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);o.push(p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(p)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){let p=this.failedIngestionEvents.map(o=>this.deepCopyCurrentIngestionEvent(o));o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(p)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>0&&(this.cancellableEvents.forEach(p=>{o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(p)}`)}),this.cancellableEvents.clear()),0===o.length)return;let p=this.makeBeaconRequestBody(o);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${p}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,p)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${p}`)}catch(o){this.logger.warn(`Event Reporting - Sending beacon data ${p} failed with error ${o}`)}})}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.reset()})}};p.default=O,O.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),O.RETRY_FIXED_BACKOFF_WAIT_MS=0,O.RETRY_SHORT_BACKOFF_MS=1e3,O.RETRY_LONG_BACKOFF_MS=15e3,O.MAX_PAYLOAD_ITEMS=2,O.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},0x159d41205:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=5e3,p=2,f=64,m=100,_=15){this.flushIntervalMs=o,this.flushSize=p,this.maxBufferCapacityKb=f,this.totalBufferItems=m,this.retryCountLimit=_}}},0x8fff55e5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.audioVideoEventAttributesFromState=void 0,p.audioVideoEventAttributesFromState=function(o){let p={};return null!==o.startTimeMs&&(p.meetingDurationMs=Math.round(Date.now()-o.startTimeMs)),null!==o.signalingOpenDurationMs&&(p.signalingOpenDurationMs=o.signalingOpenDurationMs),null!==o.iceGatheringDurationMs&&(p.iceGatheringDurationMs=o.iceGatheringDurationMs),null!==o.attendeePresenceDurationMs&&(p.attendeePresenceDurationMs=o.attendeePresenceDurationMs),null!==o.meetingStartDurationMs&&(p.meetingStartDurationMs=o.meetingStartDurationMs),void 0!==o.maxVideoTileCount&&(p.maxVideoTileCount=o.maxVideoTileCount),void 0!==o.poorConnectionCount&&(p.poorConnectionCount=o.poorConnectionCount),void 0!==o.retryCount&&(p.retryCount=o.retryCount),p}},0x18e4b58c2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2056040c6),I=f(0x24b1dc2b),k=_(f(0x1077291f7)),M=_(f(0x164a41979)),x=_(f(0x22e52699e)),O=_(f(0x1158c4d3)),L=_(f(0x22a0f7c69)),B=_(f(0x1ad1fbfa6)),U=class DefaultEventController{constructor(o,p,f){var m,_,I,k,M,x,O;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=p,this.configuration=o,this.setupEventReporter(o,p,f);try{this.parserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null}catch(o){this.logger.error(o.message)}this.browserMajorVersion=(null==(I=null==(_=null==(m=this.parserResult)?void 0:m.browser)?void 0:_.version)?void 0:I.split(".")[0])||DefaultEventController.UNAVAILABLE,this.browserName=(null==(k=this.parserResult)?void 0:k.browser.name)||DefaultEventController.UNAVAILABLE,this.browserVersion=(null==(M=this.parserResult)?void 0:M.browser.version)||DefaultEventController.UNAVAILABLE,this.deviceName=[(null==(x=this.parserResult)?void 0:x.device.vendor)||"",(null==(O=this.parserResult)?void 0:O.device.model)||""].join(" ").trim()||DefaultEventController.UNAVAILABLE}addObserver(o){this.observerSet.add(o)}removeObserver(o){this.observerSet.delete(o)}forEachObserver(o){for(let p of this.observerSet)O.default.nextTick(()=>{this.observerSet.has(p)&&o(p)})}publishEvent(o,p){return m(this,void 0,void 0,function*(){let f=Date.now();this.meetingHistoryStates.push({name:o,timestampMs:f});let m=Object.freeze(Object.assign(this.getAttributes(f),p));this.forEachObserver(p=>{p.eventDidReceive(o,m)}),this.reportEvent(o,f,p)})}reportEvent(o,p,f){var _;return m(this,void 0,void 0,function*(){let m;try{f&&(m=B.default(f)),yield null==(_=this.eventReporter)?void 0:_.reportEvent(p,o,m)}catch(o){this.logger.error(`Error reporting event ${o}`)}})}setupEventReporter(o,p,f){if(f)this._eventReporter=f;else if(o.urls){let f=o.urls.eventIngestionURL;if(f){this.logger.info("Event ingestion URL is present in the configuration");let{meetingId:m,credentials:{attendeeId:_,joinToken:w}}=o,I=new x.default(m,_,w),O=new k.default(I,f);this._eventReporter=new M.default(O,p)}}}getAttributes(o){var p,f;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.configuration.externalMeetingId?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:(null==(p=this.parserResult)?void 0:p.os.name)||DefaultEventController.UNAVAILABLE,osVersion:(null==(f=this.parserResult)?void 0:f.os.version)||DefaultEventController.UNAVAILABLE,sdkVersion:L.default.sdkVersion,sdkName:L.default.sdkName,timestampMs:o}}get eventReporter(){return this._eventReporter}destroy(){return m(this,void 0,void 0,function*(){I.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0})}};p.default=U,U.UNAVAILABLE="Unavailable"},0x1ad1fbfa6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=o=>{let p={};for(let[f,m]of Object.entries(o))if(null==m||""===m)continue;else if("number"==typeof m||"string"==typeof m)p[f]=m;else throw TypeError("Unhandled type received while flattening attributes.");return p}},0x1077291f7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x159d41205));p.default=class{constructor(o,p,f=new _.default){this.eventsClientConfiguration=o,this.ingestionURL=p,this.eventBufferConfiguration=f}}},0x164a41979:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x24b1dc2b),I=_(f(0xfb871915));p.default=class{constructor(o,p){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded","deviceLabelTriggerFailed"],this.destroyed=!1;const{eventsClientConfiguration:f,ingestionURL:m,eventBufferConfiguration:_}=o,{eventsToIgnore:w}=f;this.eventBuffer=new I.default(_,f,m,this.importantEvents,p),this.logger=p,this.eventsToIgnore=w,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(o){this.logger.error(`Event Reporting - Error starting the event buffer ${o}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(o){this.logger.error(`Event Reporting - Error stopping the event buffer ${o}`)}}reportEvent(o,p,f){return m(this,void 0,void 0,function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${o}, ${p}, ${JSON.stringify(f)}`),this.eventsToIgnore.includes(p))return void this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${p} event will be ignored as it is in events to ignore`);try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:o,name:p,attributes:f})}catch(o){this.logger.error(`Event Reporting - Error adding event to buffer ${o}`)}})}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0,this.stop(),w.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0})}}},0x91d5148b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{reportEvent(o,p,f){}start(){}stop(){}}},0x22e52699e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m=[]){this.type="Meet",this.v=1,this.meetingId=o,this.attendeeId=p,this.eventsToIgnore=m,this.authenticationToken=f}getAuthenticationToken(){return this.authenticationToken}toJSON(){let o={};return o.type=this.type,o.v=this.v,o.meetingId=this.meetingId,o.attendeeId=this.attendeeId,o}}},0x1ec8c7574:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DefaultEventController=p.DefaultDevicePixelRatioMonitor=p.DefaultDeviceController=p.DefaultContentShareController=p.DefaultBrowserBehavior=p.DefaultAudioVideoFacade=p.DefaultAudioVideoController=p.DefaultAudioMixController=p.DefaultActiveSpeakerPolicy=p.DefaultActiveSpeakerDetector=p.DataMessage=p.CreateSDPTask=p.CreatePeerConnectionTask=p.ContentShareMediaStreamBroker=p.ContentShareConstants=p.ConsoleLogger=p.ConnectionHealthPolicyConfiguration=p.ConnectionHealthData=p.ClientVideoStreamReceivingReport=p.ClientMetricReportMediaType=p.ClientMetricReportDirection=p.ClientMetricReport=p.CleanStoppedSessionTask=p.CleanRestartedSessionTask=p.CheckVideoInputFeedback=p.CheckVideoConnectivityFeedback=p.CheckNetworkUDPConnectivityFeedback=p.CheckNetworkTCPConnectivityFeedback=p.CheckContentShareConnectivityFeedback=p.CheckCameraResolutionFeedback=p.CheckAudioOutputFeedback=p.CheckAudioInputFeedback=p.CheckAudioConnectivityFeedback=p.CanvasVideoFrameBuffer=p.CSPMonitor=p.BitrateParameters=p.BaseTask=p.BaseConnectionHealthPolicy=p.BackgroundReplacementVideoFrameProcessor=p.BackgroundFilterVideoFrameProcessor=p.BackgroundBlurVideoFrameProcessor=p.BackgroundBlurStrength=p.AudioVideoControllerState=p.AudioProfile=p.AudioLogEvent=p.Attendee=p.AttachMediaInputTask=p.AsyncScheduler=p.ApplicationMetadata=p.AllHighestVideoBandwidthPolicy=void 0,p.MeetingFeatures=p.MeetingEventsClientConfiguration=p.MediaDeviceProxyHandler=p.Maybe=p.LogLevel=p.Log=p.ListenForVolumeIndicatorsTask=p.LeaveAndReceiveLeaveAckTask=p.JoinAndReceiveIndexTask=p.IntervalScheduler=p.InMemoryJSONEventBuffer=p.GlobalMetricReport=p.GetUserMediaError=p.FullJitterLimitedBackoff=p.FullJitterBackoffFactory=p.FullJitterBackoff=p.FinishGatheringICECandidatesTask=p.EventIngestionConfiguration=p.EventBufferConfiguration=p.DeviceSelection=p.DevicePixelRatioWindowSource=p.DefaultWebSocketAdapter=p.DefaultVolumeIndicatorAdapter=p.DefaultVideoTransformDevice=p.DefaultVideoTileFactory=p.DefaultVideoTileController=p.DefaultVideoTile=p.DefaultVideoStreamIndex=p.DefaultVideoStreamIdSet=p.DefaultVideoFrameProcessorTimer=p.DefaultVideoFrameProcessorPipeline=p.DefaultVideoElementResolutionMonitor=p.DefaultVideoCaptureAndEncodeParameter=p.DefaultUserAgentParser=p.DefaultTranscriptionController=p.DefaultTransceiverController=p.DefaultSimulcastUplinkPolicyForContentShare=p.DefaultSimulcastUplinkPolicy=p.DefaultSignalingClient=p.DefaultSigV4=p.DefaultSessionStateController=p.DefaultReconnectController=p.DefaultRealtimeController=p.DefaultPingPong=p.DefaultModality=p.DefaultMessagingSession=p.DefaultMeetingSession=p.DefaultMeetingReadinessChecker=p.DefaultMeetingEventReporter=p.DefaultMediaDeviceFactory=void 0,p.RedundantAudioEncoder=p.ReconnectionHealthPolicy=p.ReceiveVideoStreamIndexTask=p.ReceiveVideoInputTask=p.ReceiveRemoteVideoPauseResumeTask=p.ReceiveAudioInputTask=p.RealtimeVolumeIndicator=p.RealtimeState=p.RealtimeAttendeePositionInFrame=p.PromoteToPrimaryMeetingTask=p.PromiseQueue=p.PrefetchSortBy=p.PrefetchOn=p.PermissionDeniedError=p.ParallelGroupTask=p.POSTLogger=p.OverconstrainedError=p.OpenSignalingConnectionTask=p.OnceTask=p.NotReadableError=p.NotFoundError=p.None=p.NoVideoUplinkBandwidthPolicy=p.NoVideoDownlinkBandwidthPolicy=p.NoOpVideoFrameProcessor=p.NoOpVideoElementFactory=p.NoOpTask=p.NoOpMediaStreamBroker=p.NoOpLogger=p.NoOpEventReporter=p.NoOpDeviceController=p.NoOpDebugLogger=p.NoOpAudioVideoController=p.NScaleVideoUplinkBandwidthPolicy=p.MutableVideoPreferences=p.MultiLogger=p.MonitorTask=p.ModelSpecBuilder=p.MessagingSessionConfiguration=p.Message=p.MeetingSessionVideoAvailability=p.MeetingSessionURLs=p.MeetingSessionTURNCredentials=p.MeetingSessionStatusCode=p.MeetingSessionStatus=p.MeetingSessionLifecycleEventCondition=p.MeetingSessionLifecycleEvent=p.MeetingSessionCredentials=p.MeetingSessionConfiguration=p.MeetingReadinessCheckerConfiguration=void 0,p.VideoEncodingConcurrentSendersHealthPolicy=p.VideoCodecCapability=p.VideoAdaptiveProbePolicy=p.Versioning=p.UnusableAudioWarningConnectionHealthPolicy=p.TypeError=p.TranscriptionStatusType=p.TranscriptionStatus=p.TranscriptResult=p.TranscriptLanguageWithScore=p.TranscriptItemType=p.TranscriptItem=p.TranscriptEntity=p.TranscriptAlternative=p.Transcript=p.TimeoutTask=p.TimeoutScheduler=p.TaskStatus=p.TargetDisplaySize=p.SubscribeAndReceiveSubscribeAckTask=p.StreamMetricReport=p.Some=p.SingleNodeAudioTransformDevice=p.SimulcastVideoStreamIndex=p.SimulcastTransceiverController=p.SimulcastLayers=p.SimulcastContentShareTransceiverController=p.SignalingClientVideoSubscriptionConfiguration=p.SignalingClientSubscribe=p.SignalingClientJoin=p.SignalingClientEventType=p.SignalingClientEvent=p.SignalingClientConnectionRequest=p.SignalingAndMetricsConnectionMonitor=p.SetRemoteDescriptionTask=p.SetLocalDescriptionTask=p.SessionStateControllerTransitionResult=p.SessionStateControllerState=p.SessionStateControllerDeferPriority=p.SessionStateControllerAction=p.ServerSideNetworkAdaption=p.SerialGroupTask=p.SendingAudioFailureConnectionHealthPolicy=p.SendAndReceiveDataMessagesTask=p.SDPMediaSection=p.SDPCandidateType=p.SDP=p.RunnableTask=p.RedundantAudioRecoveryMetricReport=p.RedundantAudioEncoderWorkerCode=void 0,p.isVideoTransformDevice=p.isDestroyable=p.isAudioTransformDevice=p.ZLIBTextCompressor=p.WebSocketReadyState=p.WaitForAttendeePresenceTask=p.VoiceFocusTransformDevice=p.VoiceFocusDeviceTransformer=p.VideoTileState=p.VideoStreamDescription=p.VideoSource=p.VideoQualitySettings=p.VideoQualityAdaptationPreference=p.VideoPriorityBasedPolicyConfig=p.VideoPriorityBasedPolicy=p.VideoPreferences=p.VideoPreference=p.VideoOnlyTransceiverController=p.VideoLogEvent=p.VideoFxProcessor=p.VideoEncodingFramerateConnectionHealthPolicy=p.VideoEncodingCpuConnectionHealthPolicy=p.VideoEncodingConnectionHealthPolicyName=void 0,p.AllHighestVideoBandwidthPolicy=m(f(0x38bf5f74)).default,p.ApplicationMetadata=m(f(0x173a687a3)).default,p.AsyncScheduler=m(f(0x1158c4d3)).default,p.AttachMediaInputTask=m(f(0x1c7d226ae)).default,p.Attendee=m(f(0x977823e1)).default,p.AudioLogEvent=m(f(0x1e4aafe7d)).default,p.AudioProfile=m(f(0x1be31fc8b)).default,p.AudioVideoControllerState=m(f(0xb1f38e48)).default,p.BackgroundBlurStrength=m(f(0x11bb8da88)).default,p.BackgroundBlurVideoFrameProcessor=m(f(0x93cc4db7)).default,p.BackgroundFilterVideoFrameProcessor=m(f(0x217eb324b)).default,p.BackgroundReplacementVideoFrameProcessor=m(f(0x36f3f7d)).default,p.BaseConnectionHealthPolicy=m(f(0x21ae4c990)).default,p.BaseTask=m(f(0x113227692)).default,p.BitrateParameters=m(f(0x12d110f57)).default,p.CSPMonitor=m(f(0x13dedab0d)).default,p.CanvasVideoFrameBuffer=m(f(0x8cc00a0b)).default,p.CheckAudioConnectivityFeedback=m(f(0x4958dee5)).default,p.CheckAudioInputFeedback=m(f(0x3de98110)).default,p.CheckAudioOutputFeedback=m(f(0xdd5e551b)).default,p.CheckCameraResolutionFeedback=m(f(0x1dee20bef)).default,p.CheckContentShareConnectivityFeedback=m(f(0x23e9ed3f5)).default,p.CheckNetworkTCPConnectivityFeedback=m(f(0x21730e4e0)).default,p.CheckNetworkUDPConnectivityFeedback=m(f(0x11b30b010)).default,p.CheckVideoConnectivityFeedback=m(f(0x12ddfa430)).default,p.CheckVideoInputFeedback=m(f(0x15092d0fb)).default,p.CleanRestartedSessionTask=m(f(0x435994a8)).default,p.CleanStoppedSessionTask=m(f(0xbf52f99d)).default,p.ClientMetricReport=m(f(0x176b792fb)).default,p.ClientMetricReportDirection=m(f(0x243b8874c)).default,p.ClientMetricReportMediaType=m(f(0xebe235e1)).default,p.ClientVideoStreamReceivingReport=m(f(0x1ef8cd3d4)).default,p.ConnectionHealthData=m(f(0x18c985af)).default,p.ConnectionHealthPolicyConfiguration=m(f(0x1c17b91f1)).default,p.ConsoleLogger=m(f(0x12346a842)).default,p.ContentShareConstants=m(f(0x86facdd2)).default,p.ContentShareMediaStreamBroker=m(f(0x748652da)).default,p.CreatePeerConnectionTask=m(f(0x73c142bf)).default,p.CreateSDPTask=m(f(0x44174156)).default,p.DataMessage=m(f(0x200be574b)).default,p.DefaultActiveSpeakerDetector=m(f(0x1d159ee8)).default,p.DefaultActiveSpeakerPolicy=m(f(0x1055669a4)).default,p.DefaultAudioMixController=m(f(0x197b329a2)).default,p.DefaultAudioVideoController=m(f(0x11418f4a2)).default,p.DefaultAudioVideoFacade=m(f(0xf2ec2ef2)).default,p.DefaultBrowserBehavior=m(f(0x9a4430b2)).default,p.DefaultContentShareController=m(f(0x1d8dd5b36)).default,p.DefaultDeviceController=m(f(0x1db5b830a)).default,p.DefaultDevicePixelRatioMonitor=m(f(0x167bde784)).default,p.DefaultEventController=m(f(0x18e4b58c2)).default,p.DefaultMediaDeviceFactory=m(f(0xe13d341e)).default,p.DefaultMeetingEventReporter=m(f(0x164a41979)).default,p.DefaultMeetingReadinessChecker=m(f(0xcd9dd4aa)).default,p.DefaultMeetingSession=m(f(0x20de28c52)).default,p.DefaultMessagingSession=m(f(0xb40e079e)).default,p.DefaultModality=m(f(0x230534cc6)).default,p.DefaultPingPong=m(f(0x138580412)).default,p.DefaultRealtimeController=m(f(0x24bb989ba)).default,p.DefaultReconnectController=m(f(0x100e5c30c)).default,p.DefaultSessionStateController=m(f(0x1f3b38cfe)).default,p.DefaultSigV4=m(f(0x189468218)).default,p.DefaultSignalingClient=m(f(0x1bd55d3c4)).default,p.DefaultSimulcastUplinkPolicy=m(f(0x11b1e3853)).default,p.DefaultSimulcastUplinkPolicyForContentShare=m(f(0x13892dc9a)).default,p.DefaultTransceiverController=m(f(0x238ca30a)).default,p.DefaultTranscriptionController=m(f(0xf16d9918)).default,p.DefaultUserAgentParser=m(f(0x19f971fd8)).default,p.DefaultVideoCaptureAndEncodeParameter=m(f(0x17f8c39ba)).default,p.DefaultVideoElementResolutionMonitor=m(f(9224556e3)).default,p.DefaultVideoFrameProcessorPipeline=m(f(0x20f5ac25c)).default,p.DefaultVideoFrameProcessorTimer=m(f(0x86cb8dc3)).default,p.DefaultVideoStreamIdSet=m(f(0x5b4a3d7a)).default,p.DefaultVideoStreamIndex=m(f(0x151b9e5ee)).default,p.DefaultVideoTile=m(f(0xb747ec80)).default,p.DefaultVideoTileController=m(f(0x129e504bc)).default,p.DefaultVideoTileFactory=m(f(0x86c4609a)).default,p.DefaultVideoTransformDevice=m(f(0xd9718ba1)).default,p.DefaultVolumeIndicatorAdapter=m(f(0x20da5c30a)).default,p.DefaultWebSocketAdapter=m(f(0x947abb4a)).default,p.DevicePixelRatioWindowSource=m(f(0x2074869bd)).default,p.DeviceSelection=m(f(0x105f3de65)).default,p.EventBufferConfiguration=m(f(0x159d41205)).default,p.EventIngestionConfiguration=m(f(0x1077291f7)).default,p.FinishGatheringICECandidatesTask=m(f(0xa567a7ba)).default,p.FullJitterBackoff=m(f(0x14915840a)).default,p.FullJitterBackoffFactory=m(f(0x6e5ae8b8)).default,p.FullJitterLimitedBackoff=m(f(0x1e2c96978)).default,p.GetUserMediaError=m(f(0x19b2d97e8)).default,p.GlobalMetricReport=m(f(0x1bb68f383)).default,p.InMemoryJSONEventBuffer=m(f(0xfb871915)).default,p.IntervalScheduler=m(f(0xd475f02c)).default,p.JoinAndReceiveIndexTask=m(f(0x1b7bc4701)).default,p.LeaveAndReceiveLeaveAckTask=m(f(0x10a1c2ebe)).default,p.ListenForVolumeIndicatorsTask=m(f(0x8c94ea05)).default,p.Log=m(f(0x1b4d5ff2d)).default,p.LogLevel=m(f(0x19a5566fd)).default,p.MediaDeviceProxyHandler=m(f(0xf983d919)).default,p.MeetingEventsClientConfiguration=m(f(0x22e52699e)).default,p.MeetingFeatures=m(f(0xdbd73f5e)).default,p.MeetingReadinessCheckerConfiguration=m(f(0x24196756b)).default,p.MeetingSessionConfiguration=m(f(0x18e1c570f)).default,p.MeetingSessionCredentials=m(f(0x614ebca7)).default,p.MeetingSessionLifecycleEvent=m(f(0x15d56a943)).default,p.MeetingSessionLifecycleEventCondition=m(f(0xc7dc71d8)).default,p.MeetingSessionStatus=m(f(0x194415c85)).default,p.MeetingSessionStatusCode=m(f(0x11a9e868)).default,p.MeetingSessionTURNCredentials=m(f(0x15054ca8e)).default,p.MeetingSessionURLs=m(f(0xfce8eb05)).default,p.MeetingSessionVideoAvailability=m(f(0x1d61c1795)).default,p.Message=m(f(0xbb06a4cb)).default,p.MessagingSessionConfiguration=m(f(0x17056581)).default,p.ModelSpecBuilder=m(f(0x18769c7b5)).default,p.MonitorTask=m(f(0x1f9f2eb05)).default,p.MultiLogger=m(f(0x15964723e)).default,p.NScaleVideoUplinkBandwidthPolicy=m(f(0xf9210d7b)).default,p.NoOpAudioVideoController=m(f(0x191a3194b)).default,p.NoOpDebugLogger=m(f(0x1e9fbf678)).default,p.NoOpDeviceController=m(f(0xf371a16d)).default,p.NoOpEventReporter=m(f(0x91d5148b)).default,p.NoOpLogger=m(f(0xf05a6831)).default,p.NoOpMediaStreamBroker=m(f(0x203f02bb7)).default,p.NoOpTask=m(f(0x253700aaf)).default,p.NoOpVideoElementFactory=m(f(0x22bbb4e3f)).default,p.NoOpVideoFrameProcessor=m(f(0x84671e3f)).default,p.NoVideoDownlinkBandwidthPolicy=m(f(0x2c8ecde)).default,p.NoVideoUplinkBandwidthPolicy=m(f(0x143cfada8)).default,p.NotFoundError=m(f(0x4d06f54a)).default,p.NotReadableError=m(f(0x15ea31aea)).default,p.OnceTask=m(f(0x158630dfe)).default,p.OpenSignalingConnectionTask=m(f(0xc8b2a6fb)).default,p.OverconstrainedError=m(f(0x747ce3f3)).default,p.POSTLogger=m(f(0xd4e7af5f)).default,p.ParallelGroupTask=m(f(0x1a50cfb5)).default,p.PermissionDeniedError=m(f(0x1d643307b)).default,p.PrefetchOn=m(f(0xf0556527)).default,p.PrefetchSortBy=m(f(0x8b00d2e7)).default,p.PromiseQueue=m(f(0x172e1bd2a)).default,p.PromoteToPrimaryMeetingTask=m(f(0x8ef9a2fd)).default,p.RealtimeAttendeePositionInFrame=m(f(0x221e62772)).default,p.RealtimeState=m(f(0x1d68ccd4c)).default,p.RealtimeVolumeIndicator=m(f(0x69744cea)).default,p.ReceiveAudioInputTask=m(f(0x26b16a9c)).default,p.ReceiveRemoteVideoPauseResumeTask=m(f(0x141765a48)).default,p.ReceiveVideoInputTask=m(f(0x117aaca57)).default,p.ReceiveVideoStreamIndexTask=m(f(0x13a00d587)).default,p.ReconnectionHealthPolicy=m(f(0x61021f0c)).default,p.RedundantAudioEncoder=m(f(0x12d2b358b)).default,p.RedundantAudioEncoderWorkerCode=m(f(0x118a80d5b)).default,p.RedundantAudioRecoveryMetricReport=m(f(0x15a1c7c16)).default,p.RunnableTask=m(f(0x13eb8065e)).default,p.SDP=m(f(0x1a20e50ff)).default,p.SDPCandidateType=m(f(0x14f38fc30)).default,p.SDPMediaSection=m(f(0xed7d9b54)).default,p.SendAndReceiveDataMessagesTask=m(f(0x164fd248f)).default,p.SendingAudioFailureConnectionHealthPolicy=m(f(0x20ae9efa5)).default,p.SerialGroupTask=m(f(0x11bbef2ec)).default,p.ServerSideNetworkAdaption=m(f(0xf8b13aac)).default,p.SessionStateControllerAction=m(f(0x247795129)).default,p.SessionStateControllerDeferPriority=m(f(0x17ecda005)).default,p.SessionStateControllerState=m(f(0x1ac272bbc)).default,p.SessionStateControllerTransitionResult=m(f(0x15a2e95ed)).default,p.SetLocalDescriptionTask=m(f(0x23693b9e4)).default,p.SetRemoteDescriptionTask=m(f(0x1c9808277)).default,p.SignalingAndMetricsConnectionMonitor=m(f(0x202eb6fd7)).default,p.SignalingClientConnectionRequest=m(f(0x296cfbc0)).default,p.SignalingClientEvent=m(f(0x1e2f95c25)).default,p.SignalingClientEventType=m(f(0x216f98b8d)).default,p.SignalingClientJoin=m(f(0x1b32ed0f)).default,p.SignalingClientSubscribe=m(f(0x49608f19)).default,p.SignalingClientVideoSubscriptionConfiguration=m(f(0x1217c7f3f)).default,p.SimulcastContentShareTransceiverController=m(f(0xf1a8ac2)).default,p.SimulcastLayers=m(f(0x8f26277b)).default,p.SimulcastTransceiverController=m(f(0x4287252)).default,p.SimulcastVideoStreamIndex=m(f(0x25113bad6)).default,p.SingleNodeAudioTransformDevice=m(f(0xdeed8ee7)).default,p.StreamMetricReport=m(f(0x49c5e00)).default,p.SubscribeAndReceiveSubscribeAckTask=m(f(0x22ef5bfc)).default,p.TargetDisplaySize=m(f(0x195076b25)).default,p.TaskStatus=m(f(0xe2814d21)).default,p.TimeoutScheduler=m(f(0xa9a27686)).default,p.TimeoutTask=m(f(0xe6d64708)).default,p.Transcript=m(f(0x6bcf7aed)).default,p.TranscriptAlternative=m(f(0x235b3b0dc)).default,p.TranscriptEntity=m(f(0x10dd4ac72)).default,p.TranscriptItem=m(f(0x1b6467fba)).default,p.TranscriptItemType=m(f(0x22ea8d802)).default,p.TranscriptLanguageWithScore=m(f(0x176167e03)).default,p.TranscriptResult=m(f(0x147bf1250)).default,p.TranscriptionStatus=m(f(0x1b8f962c3)).default,p.TranscriptionStatusType=m(f(0x251900acb)).default,p.TypeError=m(f(0xdb2548f7)).default,p.UnusableAudioWarningConnectionHealthPolicy=m(f(0x1c6788b50)).default,p.Versioning=m(f(0x22a0f7c69)).default,p.VideoAdaptiveProbePolicy=m(f(0x171bbd0a0)).default,p.VideoCodecCapability=m(f(0x178bce6ff)).default,p.VideoEncodingConcurrentSendersHealthPolicy=m(f(0x201f8c5d2)).default,p.VideoEncodingConnectionHealthPolicyName=m(f(0x17469a88e)).default,p.VideoEncodingCpuConnectionHealthPolicy=m(f(0x1819749c9)).default,p.VideoEncodingFramerateConnectionHealthPolicy=m(f(0x2e16c318)).default,p.VideoFxProcessor=m(f(0x14b0f3819)).default,p.VideoLogEvent=m(f(0x15a7c8b4)).default,p.VideoOnlyTransceiverController=m(f(0x72848aa)).default,p.VideoPreference=m(f(0xdcca4e0f)).default,p.VideoPreferences=m(f(0xb8e111a8)).default,p.VideoPriorityBasedPolicy=m(f(0x1ea22295f)).default,p.VideoPriorityBasedPolicyConfig=m(f(0x206997fe9)).default,p.VideoQualityAdaptationPreference=m(f(0x5b9f0577)).default,p.VideoQualitySettings=m(f(0x170a3ef32)).default,p.VideoSource=m(f(0xe5d2d75f)).default,p.VideoStreamDescription=m(f(0x251ff39d9)).default,p.VideoTileState=m(f(0x1a64b5418)).default,p.VoiceFocusDeviceTransformer=m(f(0xbb137ed2)).default,p.VoiceFocusTransformDevice=m(f(0xa8bfd6e5)).default,p.WaitForAttendeePresenceTask=m(f(0x112462f64)).default,p.WebSocketReadyState=m(f(0x1a3216942)).default,p.ZLIBTextCompressor=m(f(0x1728c2fdd)).default;let _=f(0xb8e111a8);Object.defineProperty(p,"MutableVideoPreferences",{enumerable:!0,get:function(){return _.MutableVideoPreferences}});let w=f(0xab1ef933);Object.defineProperty(p,"Some",{enumerable:!0,get:function(){return w.Some}}),Object.defineProperty(p,"None",{enumerable:!0,get:function(){return w.None}}),Object.defineProperty(p,"Maybe",{enumerable:!0,get:function(){return w.Maybe}});let I=f(0x25cf5513);Object.defineProperty(p,"isAudioTransformDevice",{enumerable:!0,get:function(){return I.isAudioTransformDevice}});let k=f(0x24b1dc2b);Object.defineProperty(p,"isDestroyable",{enumerable:!0,get:function(){return k.isDestroyable}});let M=f(0x1a86248d4);Object.defineProperty(p,"isVideoTransformDevice",{enumerable:!0,get:function(){return M.isVideoTransformDevice}})},0x12346a842:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(o,p=_.default.WARN){this.name=o,this.level=p}info(o){this.log(_.default.INFO,o)}warn(o){this.log(_.default.WARN,o)}error(o){this.log(_.default.ERROR,o)}debug(o){_.default.DEBUG{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.sequenceNumber=o,this.message=p,this.timestampMs=f,this.logLevel=m}}},0x19a5566fd:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.LogLevel=void 0,(m=f=p.LogLevel||(p.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR",m[m.OFF=4]="OFF",p.default=f},0x15964723e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(...o){this._loggers=o}info(o){for(let p of this._loggers)p.info(o)}warn(o){for(let p of this._loggers)p.warn(o)}error(o){for(let p of this._loggers)p.error(o)}debug(o){let p,f;for(let m of(f="string"==typeof o?o:o?()=>(p||(p=o()),p):""+o,this._loggers))m.debug(f)}setLogLevel(o){for(let p of this._loggers)p.setLogLevel(o)}getLogLevel(){for(let o of this._loggers)return o.getLogLevel();return _.default.OFF}}},0x1e9fbf678:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd)),w=m(f(0xf05a6831));p.default=class extends w.default{constructor(){super(_.default.DEBUG)}}},0xf05a6831:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd));p.default=class{constructor(o=_.default.OFF){this.level=o}info(o){}warn(o){}error(o){}debug(o){_.default.DEBUG{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in f.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in f.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(o){k.default.DEBUGm(this,void 0,void 0,function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;let o=this.logCapture.slice(0,this.batchSize),p=this.makeRequestBody(o);try{let f=yield fetch(this.url,Object.assign({method:"POST",body:p},this.headers?{headers:this.headers}:{}));200===f.status&&(this.logCapture=this.logCapture.slice(o.length))}catch(o){console.warn("[POSTLogger] "+o.message)}finally{this.lock=!1}}))}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.removeEventListener();let p=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,p)}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0})}makeRequestBody(o){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:o}))}log(o,p){if(otypeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new _.default);throw Error("navigator.mediaDevices is not supported")}}},0xf983d919:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1158c4d3)),I=_(f(0xd475f02c)),k=class MediaDeviceProxyHandler{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(o,p,f)=>{if(!Reflect.has(o,p))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===p)return this.patchAddEventListener(o,p,f);else if("removeEventListener"===p)return this.patchRemoveEventListener(o,p,f)}let m=Reflect.get(o,p,f);return"function"==typeof m?m.bind(o):m},this.patchAddEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.add(f),this.scheduler||(this.scheduler=new I.default(MediaDeviceProxyHandler.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.delete(f),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>m(this,void 0,void 0,function*(){let o=yield this.sortedDeviceList();this.devices&&(o.length!==this.devices.length||o.some((o,p)=>o.deviceId!==this.devices[p].deviceId))&&this.handleDeviceChangeEvent(),this.devices=o})}sortedDeviceList(){return m(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort((o,p)=>o.deviceIdp.deviceId?-1:0)})}handleDeviceChangeEvent(){for(let o of this.deviceChangeListeners)w.default.nextTick(()=>{if(this.deviceChangeListeners.has(o)){let p=new Event("devicechange");"function"==typeof o?o(p):o.handleEvent(p)}})}};p.default=k,k.INTERVAL_MS=1e3},0x203f02bb7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(o){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}}},0x4958dee5:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioConnectivityFeedback=void 0,(m=f=p.CheckAudioConnectivityFeedback||(p.CheckAudioConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.AudioInputRequestFailed=1]="AudioInputRequestFailed",m[m.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.AudioNotReceived=4]="AudioNotReceived",p.default=f},0x3de98110:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioInputFeedback=void 0,(m=f=p.CheckAudioInputFeedback||(p.CheckAudioInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0xdd5e551b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioOutputFeedback=void 0,(m=f=p.CheckAudioOutputFeedback||(p.CheckAudioOutputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",p.default=f},0x1dee20bef:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckCameraResolutionFeedback=void 0,(m=f=p.CheckCameraResolutionFeedback||(p.CheckCameraResolutionFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.ResolutionNotSupported=2]="ResolutionNotSupported",m[m.PermissionDenied=3]="PermissionDenied",p.default=f},0x23e9ed3f5:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckContentShareConnectivityFeedback=void 0,(m=f=p.CheckContentShareConnectivityFeedback||(p.CheckContentShareConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",m[m.TimedOut=3]="TimedOut",m[m.ConnectionFailed=4]="ConnectionFailed",p.default=f},0x21730e4e0:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkTCPConnectivityFeedback=void 0,(m=f=p.CheckNetworkTCPConnectivityFeedback||(p.CheckNetworkTCPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x11b30b010:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkUDPConnectivityFeedback=void 0,(m=f=p.CheckNetworkUDPConnectivityFeedback||(p.CheckNetworkUDPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x12ddfa430:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoConnectivityFeedback=void 0,(m=f=p.CheckVideoConnectivityFeedback||(p.CheckVideoConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.VideoInputRequestFailed=1]="VideoInputRequestFailed",m[m.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.VideoNotSent=4]="VideoNotSent",p.default=f},0x15092d0fb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoInputFeedback=void 0,(m=f=p.CheckVideoInputFeedback||(p.CheckVideoInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0xcd9dd4aa:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x197b329a2)),I=_(f(0x9a4430b2)),k=_(f(0x1db5b830a)),M=_(f(0x1d643307b)),x=_(f(0x113227692)),O=_(f(0xe6d64708)),L=_(f(0x4958dee5)),B=_(f(0x3de98110)),U=_(f(0xdd5e551b)),$=_(f(0x1dee20bef)),q=_(f(0x23e9ed3f5)),Z=_(f(0x21730e4e0)),ee=_(f(0x11b30b010)),et=_(f(0x12ddfa430)),ei=_(f(0x15092d0fb)),er=_(f(0x24196756b));p.default=class DefaultMeetingReadinessChecker{constructor(o,p,f=new er.default){this.logger=o,this.meetingSession=p,this.configuration=f,this.browserBehavior=new I.default}static delay(o){return m(this,void 0,void 0,function*(){return new Promise(p=>setTimeout(p,o))})}checkAudioInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(o),yield this.meetingSession.audioVideo.stopAudioInput(),B.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${o}`),o instanceof M.default)return B.default.PermissionDenied;return B.default.Failed}})}checkAudioOutput(o,p,f=null){return m(this,void 0,void 0,function*(){try{let m=o?k.default.getIntrinsicDeviceId(o):"";if(yield this.playTone(m,this.configuration.audioOutputFrequency,f),yield p())return U.default.Succeeded;return U.default.Failed}catch(o){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${o}`),U.default.Failed}finally{yield this.stopTone()}})}playTone(o,p,f){return m(this,void 0,void 0,function*(){let m=this.configuration.audioOutputGain;this.oscillatorNode&&(yield this.stopTone()),this.audioContext=k.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=p,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);let _=this.audioContext.currentTime+.1;this.gainNode.gain.setValueAtTime(0,_),this.gainNode.gain.linearRampToValueAtTime(m,_+.1),this.oscillatorNode.start();let I=new w.default(this.logger),M=f||new Audio,x=this.destinationStream.stream;this.audioElement=M;try{this.browserBehavior.supportsSetSinkId()&&(yield I.bindAudioDevice({deviceId:o}))}catch(o){this.logger.error(`Failed to bind audio device: ${o}`)}try{yield I.bindAudioElement(M)}catch(o){this.logger.error(`Failed to bind audio element: ${o}`)}yield I.bindAudioStream(x)})}stopTone(){return m(this,void 0,void 0,function*(){if(!this.audioContext||!this.gainNode||!this.oscillatorNode||!this.destinationStream)return;let cleanup=()=>{this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null),this.oscillatorNode&&this.gainNode&&this.oscillatorNode.disconnect(this.gainNode),this.gainNode&&this.destinationStream&&this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null,this.audioElement=null},o=new Promise(o=>{this.oscillatorNode.addEventListener("ended",()=>{cleanup(),o()},{once:!0})}),p=this.configuration.audioOutputGain,f=this.audioContext.currentTime;this.gainNode.gain.setValueAtTime(p,f),this.gainNode.gain.linearRampToValueAtTime(0,f+.1),this.oscillatorNode.stop(f+.1+.1),yield o})}checkVideoInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(o),yield this.meetingSession.audioVideo.stopVideoInput(),ei.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Video check failed with error ${o}`),o instanceof M.default)return ei.default.PermissionDenied;return ei.default.Failed}})}checkCameraResolution(o,p,f){return m(this,void 0,void 0,function*(){let m;try{let _=k.default.getIntrinsicDeviceId(o),w={video:this.calculateVideoConstraint(_,p,f)};m=yield navigator.mediaDevices.getUserMedia(w)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${p} height ${f} failed with error ${o}`),o&&"OverconstrainedError"===o.name)return $.default.ResolutionNotSupported;if(o&&"NotAllowedError"===o.name)return $.default.PermissionDenied;return $.default.Failed}finally{m&&m.getTracks().forEach(function(o){o.stop()})}return $.default.Succeeded})}calculateVideoConstraint(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(p,f),_={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(_.deviceId=o,_.width=p,_.height=f):(_.deviceId={exact:o},_.width={exact:m[0]},_.height={exact:m[1]}),_}checkContentShareConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f=!1,_={contentShareDidStart:()=>{p=!0}},w={audioVideoDidStart:()=>{f=!0}};try{if(this.meetingSession.audioVideo.addObserver(w),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(_),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(o),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f&&p})),!f)return q.default.ConnectionFailed;return yield this.stopMeeting(),p?q.default.Succeeded:q.default.TimedOut}catch(o){if(this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${o}`),"NotAllowedError"===o.name)return q.default.PermissionDenied;return q.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(w),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(_)}})}checkAudioConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f={packetsReceived:0},_=this.meetingSession.audioVideo,w={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"inbound-rtp"===o.type&&("audio"===o.mediaType||"audio"===o.kind)&&(f.packetsReceived=o.packetsReceived)})}},attendeePresenceHandler=(o,f,m,_)=>{o===this.meetingSession.configuration.credentials.attendeeId&&f&&(p=!0)};try{yield _.startAudioInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${o}`),o instanceof M.default)return L.default.AudioInputPermissionDenied;return L.default.AudioInputRequestFailed}return(_.realtimeSubscribeToAttendeeIdPresence(attendeePresenceHandler),_.addObserver(w),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return this.isAudioConnectionSuccessful(p,f)})),_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),this.isAudioConnectionSuccessful(p,f)?L.default.Succeeded:L.default.AudioNotReceived):(_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.meetingSession.audioVideo.stopAudioInput(),L.default.ConnectionFailed)})}checkVideoConnectivity(o){return m(this,void 0,void 0,function*(){let p=this.meetingSession.audioVideo,f=0,_={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"outbound-rtp"===o.type&&("video"===o.mediaType||"video"===o.kind)&&(f=o.packetsSent)})}};try{yield p.startVideoInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${o}`),o instanceof M.default)return et.default.VideoInputPermissionDenied;return et.default.VideoInputRequestFailed}return(p.addObserver(_),yield this.startMeeting())?(p.startLocalVideoTile(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f>0})),yield p.stopVideoInput(),yield this.stopMeeting(),p.removeObserver(_),f<=0)?et.default.VideoNotSent:et.default.Succeeded:et.default.ConnectionFailed})}checkNetworkUDPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),ee.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=tcp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?ee.default.Succeeded:ee.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ee.default.ConnectionFailed)})}checkNetworkTCPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),Z.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=udp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?Z.default.Succeeded:Z.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,Z.default.ConnectionFailed)})}startMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStart:()=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}stopMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStop:p=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}executeTimeoutTask(o){return m(this,void 0,void 0,function*(){let p=!1,f=class extends x.default{constructor(o,p){super(o),this.waitDurationMs=p,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return m(this,void 0,void 0,function*(){for(;!this.isCancelled;){if(yield o()){p=!0;break}yield DefaultMeetingReadinessChecker.delay(this.waitDurationMs)}})}},_=new O.default(this.logger,new f(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield _.run(),p})}isAudioConnectionSuccessful(o,p){return o&&p.packetsReceived>0}}},0x24196756b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}}},0x20de28c52:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11418f4a2)),I=_(f(0xf2ec2ef2)),k=_(f(0x14915840a)),M=_(f(0x9a4430b2)),x=_(f(0x748652da)),O=_(f(0x1d8dd5b36)),L=_(f(0x13dedab0d)),B=f(0x24b1dc2b),U=_(f(0x18e4b58c2)),$=_(f(0x100e5c30c)),q=_(f(0x947abb4a));p.default=class{constructor(o,p,f,m){this._eventController=m,this._configuration=o,this._logger=p,this.checkBrowserSupportAndFeatureConfiguration(),L.default.addLogger(this._logger),L.default.register(),this._eventController||(this._eventController=new U.default(o,p)),f.eventController||(f.eventController=this.eventController),this.audioVideoController=new w.default(this._configuration,this._logger,new q.default(this._logger),f,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=f,this.logger.info(`MeetingFeatures: ${JSON.stringify(o.meetingFeatures)}`);const _=new x.default(this._logger);this.contentShareController=new O.default(_,new w.default(O.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new q.default(this._logger),_,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new I.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return m(this,void 0,void 0,function*(){B.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),B.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),B.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),L.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0})}checkBrowserSupportAndFeatureConfiguration(){let o=new M.default,p=`${o.name()} ${o.majorVersion()} (${o.version()})`;if(this.logger.info(`browser is ${p}`),o.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${o.supportString()}.`),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!o.hasChromiumWebRTC())throw Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(o.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${o.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")),this._configuration.enableSVC&&(this._configuration.enableSVC=!1,this.logger.info("SVC is not successfully enabled since simulcast is enabled"))),this._configuration.enableSVC&&!o.supportsScalableVideoCoding()&&(this._configuration.enableSVC=!1,this.logger.info("SVC is only supported on Chromium-based browsers with version 111 or above"))}isSimulcastUplinkPolicy(o){return!!(o&&o.addObserver)}}},0xdbd73f5e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x170a3ef32));p.default=class MeetingFeatures{constructor(o=_.default.VideoResolutionHD,p=_.default.VideoResolutionFHD){this.videoMaxResolution=o,this.contentMaxResolution=p}clone(){return new MeetingFeatures(this.videoMaxResolution,this.contentMaxResolution)}}},0x18e1c570f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1c17b91f1)),w=m(f(0x170a3ef32)),I=f(0xb79a45b7),k=m(f(0xdbd73f5e)),M=m(f(0x614ebca7)),x=m(f(0xfce8eb05));p.default=class{constructor(o,p){var f,m;if(this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new _.default,this.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.enableSVC=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1,this.meetingFeatures=new k.default,o){(o=I.toLowerCasePropertyNames(o)).meeting&&(o=o.meeting),this.meetingId=o.meetingid,this.externalMeetingId=o.externalmeetingid,this.urls=new x.default,this.urls.audioHostURL=o.mediaplacement.audiohosturl,this.urls.signalingURL=o.mediaplacement.signalingurl,this.urls.turnControlURL=o.mediaplacement.turncontrolurl,o.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=o.mediaplacement.eventingestionurl);const parseVideoResolution=(o,p)=>{switch(o){case"None":return w.default.VideoDisabled;case"HD":return w.default.VideoResolutionHD;case"FHD":return w.default.VideoResolutionFHD;case"UHD":return w.default.VideoResolutionUHD;default:return p}};if((null==(f=o.meetingfeatures)?void 0:f.video)!==void 0||(null==(m=o.meetingfeatures)?void 0:m.content)!==void 0){const p=void 0===o.meetingfeatures.video?"HD":o.meetingfeatures.video.maxresolution,f=void 0===o.meetingfeatures.content?"FHD":o.meetingfeatures.content.maxresolution;this.meetingFeatures=new k.default(parseVideoResolution(p,w.default.VideoResolutionHD),parseVideoResolution(f,w.default.VideoResolutionFHD))}}p&&((p=I.toLowerCasePropertyNames(p)).attendee&&(p=p.attendee),this.credentials=new M.default,this.credentials.attendeeId=p.attendeeid,this.credentials.externalUserId=p.externaluserid,this.credentials.joinToken=p.jointoken)}}},0x614ebca7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:""}}}},0x15d56a943:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEvent=void 0,(m=f=p.MeetingSessionLifecycleEvent||(p.MeetingSessionLifecycleEvent={}))[m.Connecting=0]="Connecting",m[m.Started=1]="Started",m[m.Stopped=2]="Stopped",p.default=f},0xc7dc71d8:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEventCondition=void 0,(m=f=p.MeetingSessionLifecycleEventCondition||(p.MeetingSessionLifecycleEventCondition={}))[m.ConnectingNew=0]="ConnectingNew",m[m.ReconnectingExisting=1]="ReconnectingExisting",m[m.StartedNew=2]="StartedNew",m[m.StartedExisting=3]="StartedExisting",m[m.StartedAfterReconnect=4]="StartedAfterReconnect",m[m.StoppedCleanly=5]="StoppedCleanly",m[m.StoppedWithFailure=6]="StoppedWithFailure",p.default=f},0x194415c85:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x252035ee7),w=m(f(0x11a9e868));p.default=class MeetingSessionStatus{constructor(o){this._statusCode=o}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:case w.default.VideoCallAtSourceCapacity:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.ICEGatheringTimeoutWorkaround:case w.default.ConnectionHealthReconnect:case w.default.RealtimeApiFailed:case w.default.TaskFailed:case w.default.NoAttendeePresent:case w.default.SignalingChannelClosedUnexpectedly:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case w.default.Left:case w.default.AudioJoinedFromAnotherDevice:case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.MeetingEnded:case w.default.AudioDisconnected:case w.default.TURNCredentialsForbidden:case w.default.SignalingBadRequest:case w.default.SignalingRequestFailed:case w.default.VideoCallAtSourceCapacity:case w.default.RealtimeApiFailed:case w.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.ICEGatheringTimeoutWorkaround:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.RealtimeApiFailed:case w.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case w.default.OK:return"Everything is OK so far.";case w.default.Left:return"The attendee left the meeting.";case w.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case w.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case w.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case w.default.MeetingEnded:return"The meeting ended.";case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:return"The audio connection failed.";case w.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case w.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:return"The signaling connection failed.";case w.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case w.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case w.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case w.default.TaskFailed:return"The connection failed. See the error message for more details.";case w.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case w.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case w.default.NoAttendeePresent:return"The attendee was not present.";case w.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case w.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case w.default.AudioVideoDisconnectedWhilePromoted:return"The client disconnected while promoted, which will automatically demote. The attendee must promote again to participate.";case w.default.AudioDisconnectAudio:return"The audio connection failed.";case w.default.SignalingChannelClosedUnexpectedly:return"The signaling channel was closed unexpectedly. This may be due to a network change or backend detected failure.";default:{let o=this._statusCode;throw Error(`Unhandled case: ${o}`)}}}static fromSignalFrame(o){return o.error&&o.error.status?this.fromSignalingStatus(o.error.status):o.type===_.SdkSignalFrame.Type.AUDIO_STATUS?o.audioStatus?this.fromAudioStatus(o.audioStatus.audioStatus):new MeetingSessionStatus(w.default.SignalingRequestFailed):o.type===_.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new MeetingSessionStatus(w.default.AudioVideoWasRemovedFromPrimaryMeeting):new MeetingSessionStatus(w.default.OK)}static fromAudioStatus(o){switch(o){case 200:return new MeetingSessionStatus(w.default.OK);case 301:return new MeetingSessionStatus(w.default.AudioJoinedFromAnotherDevice);case 302:return new MeetingSessionStatus(w.default.AudioDisconnectAudio);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);case 410:return new MeetingSessionStatus(w.default.MeetingEnded);case 411:return new MeetingSessionStatus(w.default.AudioAttendeeRemoved);case 500:return new MeetingSessionStatus(w.default.AudioInternalServerError);case 503:return new MeetingSessionStatus(w.default.AudioServiceUnavailable);default:if(2===Math.floor(o/100))return new MeetingSessionStatus(w.default.OK);return new MeetingSessionStatus(w.default.AudioDisconnected)}}static fromSignalingStatus(o){switch(o){case 206:return new MeetingSessionStatus(w.default.VideoCallSwitchToViewOnly);case 509:return new MeetingSessionStatus(w.default.VideoCallAtSourceCapacity);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);default:switch(Math.floor(o/100)){case 2:return new MeetingSessionStatus(w.default.OK);case 4:return new MeetingSessionStatus(w.default.SignalingBadRequest);case 5:return new MeetingSessionStatus(w.default.SignalingInternalServerError);default:return new MeetingSessionStatus(w.default.SignalingRequestFailed)}}}}},0x11a9e868:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionStatusCode=void 0,(m=f=p.MeetingSessionStatusCode||(p.MeetingSessionStatusCode={}))[m.OK=0]="OK",m[m.Left=1]="Left",m[m.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",m[m.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",m[m.AudioCallAtCapacity=4]="AudioCallAtCapacity",m[m.MeetingEnded=5]="MeetingEnded",m[m.AudioInternalServerError=6]="AudioInternalServerError",m[m.AudioServiceUnavailable=7]="AudioServiceUnavailable",m[m.AudioDisconnected=8]="AudioDisconnected",m[m.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",m[m.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",m[m.SignalingBadRequest=11]="SignalingBadRequest",m[m.SignalingInternalServerError=12]="SignalingInternalServerError",m[m.SignalingRequestFailed=13]="SignalingRequestFailed",m[m.SignalingChannelClosedUnexpectedly=14]="SignalingChannelClosedUnexpectedly",m[m.ICEGatheringTimeoutWorkaround=15]="ICEGatheringTimeoutWorkaround",m[m.ConnectionHealthReconnect=16]="ConnectionHealthReconnect",m[m.RealtimeApiFailed=17]="RealtimeApiFailed",m[m.TaskFailed=18]="TaskFailed",m[m.IncompatibleSDP=19]="IncompatibleSDP",m[m.TURNCredentialsForbidden=20]="TURNCredentialsForbidden",m[m.NoAttendeePresent=21]="NoAttendeePresent",m[m.AudioAttendeeRemoved=22]="AudioAttendeeRemoved",m[m.AudioVideoWasRemovedFromPrimaryMeeting=23]="AudioVideoWasRemovedFromPrimaryMeeting",m[m.AudioVideoDisconnectedWhilePromoted=24]="AudioVideoDisconnectedWhilePromoted",m[m.AudioDisconnectAudio=25]="AudioDisconnectAudio",p.default=f},0x15054ca8e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},0xfce8eb05:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this._audioHostURL=null,this._signalingURL=null,this._turnControlURL=null,this._eventIngestionURL=null,this.urlRewriter=o=>o,this.urlRewriterMulti=null}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(o){this._audioHostURL=o}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(o){this._signalingURL=o}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(o){this._turnControlURL=o}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(o){this._eventIngestionURL=o}}},0x1d61c1795:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class MeetingSessionVideoAvailability{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(o){return this.remoteVideoAvailable===o.remoteVideoAvailable&&this.canStartLocalVideo===o.canStartLocalVideo}clone(){let o=new MeetingSessionVideoAvailability;return o.remoteVideoAvailable=this.remoteVideoAvailable,o.canStartLocalVideo=this.canStartLocalVideo,o}}},0xbb06a4cb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.type=o,this.headers=p,this.payload=f}}},0xb40e079e:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x510b1d7f),I=_(f(0x14915840a)),k=_(f(0x13dedab0d)),M=_(f(0xbb06a4cb)),x=_(f(0x100e5c30c)),O=_(f(0x1158c4d3)),L=_(f(0x189468218)),B=_(f(0x947abb4a)),U=_(f(0x1a3216942)),$=_(f(0xf0556527));p.default=class{constructor(o,p,f,m,_){this.configuration=o,this.logger=p,this.webSocket=f,this.reconnectController=m,this.sigV4=_,this.observerQueue=new Set,this.webSocket||(this.webSocket=new B.default(this.logger)),this.reconnectController||(this.reconnectController=new x.default(o.reconnectTimeoutMs,new I.default(o.reconnectFixedWaitMs,o.reconnectShortBackoffMs,o.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new L.default(this.configuration.chimeClient)),k.default.addLogger(this.logger),k.default.register(),this.preBootstrapMessages=[]}addObserver(o){this.logger.info("adding messaging observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing messaging observer"),this.observerQueue.delete(o)}start(){return m(this,void 0,void 0,function*(){this.isClosed()?yield this.startConnecting(!1):this.logger.info("messaging session already started")})}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),k.default.removeLogger(this.logger))}forEachObserver(o){for(let p of this.observerQueue)O.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.openEventHandler()}),this.webSocket.addEventListener("message",o=>{this.receiveMessageHandler(o.data)}),this.webSocket.addEventListener("close",o=>{this.closeEventHandler(o)}),this.webSocket.addEventListener("error",()=>{this.logger.error("WebSocket error")})}startConnecting(o){return m(this,void 0,void 0,function*(){return yield this.startConnectingInternal(o),yield new Promise((o,p)=>{this.bootstrapResolved=o,this.bootstrapRejected=p})})}startConnectingInternal(o){var p;return m(this,void 0,void 0,function*(){let f=this.configuration.endpointUrl;if(o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),o||void 0===f)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){let o=yield this.configuration.chimeClient.getMessagingSessionEndpoint();f=(null==(p=o.Endpoint)?void 0:p.Url)?o.Endpoint.Url:(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else f=(yield this.configuration.chimeClient.send(new w.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${f}`)}catch(p){this.logger.error(`Messaging Session failed to resolve endpoint: ${p}`);let o=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});this.closeEventHandler(o);return}let m=yield this.prepareWebSocketUrl(f);this.logger.info(`opening connection to ${m}`),o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(m,[],!0),this.forEachObserver(p=>{p.messagingSessionDidStartConnecting&&p.messagingSessionDidStartConnecting(o)}),this.setUpEventListeners()})}prepareWebSocketUrl(o){return m(this,void 0,void 0,function*(){let p=new Map;return p.set("userArn",[this.configuration.userArn]),p.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===$.default.Connect&&p.set("prefetch-on",[$.default.Connect]),this.configuration.prefetchSortBy&&p.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",o,"/connect","",p)})}isClosed(){return this.webSocket.readyState()===U.default.None||this.webSocket.readyState()===U.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(o){try{let p=JSON.parse(o),f=p.Headers["x-amz-chime-event-type"],m=new M.default(f,p.Headers,p.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==f){if(!this.isSessionEstablished)return void this.preBootstrapMessages.push(m)}else{this.forEachObserver(o=>{o.messagingSessionDidStart&&o.messagingSessionDidStart()}),this.bootstrapResolved(),this.isSessionEstablished=!0;let o=this.preBootstrapMessages.length;for(let p=0;p{this.sendMessageToObserver(p,o)})}}this.forEachObserver(o=>{this.sendMessageToObserver(o,m)})}catch(o){this.logger.error(`Messaging parsing failed: ${o}`)}}sendMessageToObserver(o,p){o.messagingSessionDidReceiveMessage&&o.messagingSessionDidReceiveMessage(p)}retryConnection(){return this.reconnectController.retryWithBackoff(()=>m(this,void 0,void 0,function*(){yield this.startConnecting(!0)}),null)}closeEventHandler(o){this.logger.info(`WebSocket close: ${o.code} ${o.reason}`),4999!==o.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(o.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver(p=>{p.messagingSessionDidStop&&p.messagingSessionDidStop(o)}):this.bootstrapRejected(o))}canReconnect(o){return 1001===o||1006===o||o>=1011&&o<=1014||o>4e3&&4002!==o&&4003!==o&&4401!==o}}},0x17056581:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xb79a45b7);p.default=class{constructor(o,p,f,m){this.userArn=o,this.messagingSessionId=p,this.endpointUrl=f,this.chimeClient=m,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.prefetchSortBy=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){let o=new Uint32Array(1);return m.getRandomValues(o),o[0].toString()}}},0xf0556527:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Connect="connect",p.default=f},0x8b00d2e7:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).Unread="unread",m.LastMessageTimestamp="last-message-timestamp",p.default=f},0x230534cc6:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x86facdd2)),w=class DefaultModality{constructor(o){this._id=o}id(){return this._id}base(){return this._id?this._id.split(DefaultModality.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";let o=this._id.split(DefaultModality.MODALITY_SEPARATOR);return 2===o.length?o[1]:""}hasModality(o){return""!==o&&this.modality()===o}withModality(o){let p=new DefaultModality(this.base()+DefaultModality.MODALITY_SEPARATOR+o);return""===o||""===this.base()||new DefaultModality(p._id).modality()!==o?new DefaultModality(this.base()):p}};p.default=w,w.MODALITY_SEPARATOR=_.default.Modality[0],w.MODALITY_CONTENT=_.default.Modality.substring(1)},0x138580412:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1158c4d3)),w=m(f(0xd475f02c)),I=m(f(0x216f98b8d)),k=f(0x252035ee7),M=f(0xab1ef933);p.default=class{constructor(o,p,f){this.signalingClient=o,this.intervalMs=p,this.logger=f,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new w.default(this.intervalMs),this.pingId=0}addObserver(o){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)_.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start(()=>{this.ping()}),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver(o=>{M.Maybe.of(o.didMissPongs).map(p=>p.bind(o)(this.consecutivePongsUnaccountedFor))})),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1|0;let o=k.SdkPingPongFrame.create();o.pingId=this.pingId,o.type=k.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(o),this.logger.debug(()=>`sent ping ${this.pingId}`)}pong(o){let p=k.SdkPingPongFrame.create();p.pingId=o,p.type=k.SdkPingPongType.PONG,this.signalingClient.pingPong(p)}handleSignalingClientEvent(o){switch(o.type){case I.default.WebSocketOpen:this.startPingInterval();break;case I.default.WebSocketFailed:case I.default.WebSocketError:this.logger.warn(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.WebSocketClosing:case I.default.WebSocketClosed:this.logger.info(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.ReceivedSignalFrame:if(o.message.type!==k.SdkSignalFrame.Type.PING_PONG)break;if(o.message.pingPong.type===k.SdkPingPongType.PONG){let p,f=o.message.pingPong.pingId;if(f!==this.pingId){this.logger.warn(`unexpected ping id ${f} (expected ${this.pingId})`);break}if(this.consecutivePongsUnaccountedFor=0,"number"==typeof o.message.timestampMs)p=o.message.timestampMs;else break;this.logger.debug(()=>`received pong ${f} with timestamp ${p}`);let m=o.timestampMs-this.pingTimestampLocalMs,_=Math.round(p-m/2),w=this.pingTimestampLocalMs-_;this.logger.info(`local clock skew estimate=${w}ms from ping-pong time=${m}ms`),this.forEachObserver(o=>{M.Maybe.of(o.didReceivePong).map(p=>p.bind(o)(f,w,m))})}else this.pong(o.message.pingPong.pingId)}}}},0x24bb989ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf16d9918)),w=f(0xb79a45b7),I=m(f(0x1d68ccd4c)),k=m(f(0x69744cea));p.default=class{constructor(o,p){this.mediaStreamBroker=o,this.state=new I.default,this._transcriptionController=p||new _.default(this)}realtimeSetLocalAttendeeId(o,p){this.state.localAttendeeId=o,this.state.localExternalUserId=p}realtimeSetAttendeeIdPresence(o,p,f,m,_){try{for(let w of(p&&(this.state.attendeeIdToExternalUserId[o]=f),this.state.attendeeIdChangesCallbacks))w(o,p,f,m,_)}catch(o){this.onError(o)}}realtimeSubscribeToAttendeeIdPresence(o){try{this.state.attendeeIdChangesCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToAttendeeIdPresence(o){try{let p=this.state.attendeeIdChangesCallbacks.indexOf(o);-1!==p&&this.state.attendeeIdChangesCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSetCanUnmuteLocalAudio(o){try{if(this.state.canUnmute===o)return;for(let p of(this.state.canUnmute=o,this.state.setCanUnmuteLocalAudioCallbacks))p(o)}catch(o){this.onError(o)}}realtimeSubscribeToSetCanUnmuteLocalAudio(o){try{this.state.setCanUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){try{let p=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.setCanUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{for(let o of(this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!0)}catch(o){this.onError(o)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{for(let o of(this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!1);return!0}catch(o){return this.onError(o),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){try{let p=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(o,p){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(o)||(this.state.volumeIndicatorCallbacks[o]=[]),this.state.volumeIndicatorCallbacks[o].push(p),this.sendVolumeIndicatorChange(o,!0,!0,!0,this.state.attendeeIdToExternalUserId[o])}catch(o){this.onError(o)}}realtimeUnsubscribeFromVolumeIndicator(o,p){if(this.state.volumeIndicatorCallbacks[o])if(p){let f=this.state.volumeIndicatorCallbacks[o].indexOf(p);f>=0&&this.state.volumeIndicatorCallbacks[o].splice(f,1)}else delete this.state.volumeIndicatorCallbacks[o]}realtimeUpdateVolumeIndicator(o,p,f,m,_){try{f=this.applyLocalMuteOverride(o,f);let w=this.getVolumeIndicatorState(o),I=!1,k=!1,M=!1;null!==f&&w.muted!==f&&(w.muted=f,k=!0,w.muted&&0!==w.volume&&(w.volume=0,I=!0)),w.muted||null===p||(w.volume!==p&&(w.volume=p,I=!0),null===w.muted&&(w.muted=!1,k=!0)),null!==m&&w.signalStrength!==m&&(w.signalStrength=m,M=!0),this.sendVolumeIndicatorChange(o,I,k,M,_)}catch(o){this.onError(o)}}realtimeSubscribeToLocalSignalStrengthChange(o){try{if(this.state.localSignalStrengthChangeCallbacks.push(o),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(o){this.onError(o)}}realtimeUnsubscribeToLocalSignalStrengthChange(o){try{let p=this.state.localSignalStrengthChangeCallbacks.indexOf(o);-1!==p&&this.state.localSignalStrengthChangeCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSubscribeToSendDataMessage(o){try{this.state.sendDataMessageCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeFromSendDataMessage(o){try{let p=this.state.sendDataMessageCallbacks.indexOf(o);-1!==p&&this.state.sendDataMessageCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSendDataMessage(o,p,f){try{for(let m of this.state.sendDataMessageCallbacks)m(o,p,f)}catch(o){this.onError(o)}}realtimeSubscribeToReceiveDataMessage(o,p){try{this.state.receiveDataMessageCallbacks.has(o)?this.state.receiveDataMessageCallbacks.get(o).push(p):this.state.receiveDataMessageCallbacks.set(o,[p])}catch(o){this.onError(o)}}realtimeUnsubscribeFromReceiveDataMessage(o){try{this.state.receiveDataMessageCallbacks.delete(o)}catch(o){this.onError(o)}}realtimeReceiveDataMessage(o){try{w.iterateEvery(this.state.receiveDataMessageCallbacks.get(o.topic),p=>{p(o)})}catch(o){Promise.reject(o)}}realtimeSubscribeToFatalError(o){try{this.state.fatalErrorCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToFatalError(o){try{let p=this.state.fatalErrorCallbacks.indexOf(o);-1!==p&&this.state.fatalErrorCallbacks.splice(p,1)}catch(o){this.onError(o)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(o){o?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(o,p){let f=this.state.localAttendeeId,m=this.state.muted;return o===f&&"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?m:p}sendVolumeIndicatorChange(o,p,f,m,_){if(this.sendLocalSignalStrengthChange(o,m),!this.state.volumeIndicatorCallbacks.hasOwnProperty(o))return;let w=this.getVolumeIndicatorState(o),I=new k.default;if(p&&(I.volume=w.volume),f&&(I.muted=w.muted),m&&(I.signalStrength=w.signalStrength),!this.stateIsEmpty(I))for(let p of this.state.volumeIndicatorCallbacks[o])p(o,I.volume,I.muted,I.signalStrength,_)}sendLocalSignalStrengthChange(o,p){if(!p||o!==this.state.localAttendeeId)return;let f=this.getVolumeIndicatorState(o).signalStrength;if(null!==f)for(let o of this.state.localSignalStrengthChangeCallbacks)o(f)}getVolumeIndicatorState(o){return this.state.volumeIndicatorState.hasOwnProperty(o)||(this.state.volumeIndicatorState[o]=new k.default),this.state.volumeIndicatorState[o]}stateIsEmpty(o){return null===o.volume&&null===o.muted&&null===o.signalStrength}onError(o){try{for(let p of this.state.fatalErrorCallbacks)p(o)}catch(p){try{console.error(o),console.error(p)}catch{}}}}},0x221e62772:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},0x1d68ccd4c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},0x69744cea:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},0x100e5c30c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xa9a27686));p.default=class DefaultReconnectController{constructor(o,p){this.reconnectTimeoutMs=o,this.backoffPolicy=p,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs||this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(o){this._isFirstConnection=o,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(o,p){let f=this.shouldReconnect&&!this.hasPastReconnectDeadline();return f&&(this.backoffCancel=p,this.backoffTimer=new _.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start(()=>{this.backoffCancel=null,o()})),f}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new DefaultReconnectController(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(o){this.lastActiveTimestampMs=o}}},0x12d2b358b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class RedundantAudioEncoder{constructor(){this.maxRedPacketSizeBytes=1024,this.maxAudioPayloadSizeBytes=1e3,this.maxRedTimestampOffset=16384,this.redHeaderSizeBytes=4,this.redLastHeaderSizeBytes=1,this.redPacketizationTime=960,this.redPacketDistance=2,this.maxRedEncodings=2,this.redMaxRecoveryDistance=this.redPacketDistance*this.maxRedEncodings+1,this.maxEncodingHistorySize=10,this.numRedundantEncodings=0,this.redundancyEnabled=!0,this.lossReportInterval=24e4,this.maxOutOfOrderPacketDistance=16,this.OPUS_BAD_ARG=-1,this.OPUS_INVALID_PACKET=-4,this.OPUS_MAX_OPUS_FRAMES=48,this.OPUS_MAX_FRAME_SIZE_BYTES=1275,this.encodingHistory=[],this.opusPayloadType=0,this.redPayloadType=0,this.initializePacketLogs()}static initializeWorker(){RedundantAudioEncoder.log("Initializing RedundantAudioEncoder");let o=new RedundantAudioEncoder;self.RTCRtpScriptTransformer&&(self.onrtctransform=p=>{"SenderTransform"===p.transformer.options.type?o.setupSenderTransform(p.transformer.readable,p.transformer.writable):"ReceiverTransform"===p.transformer.options.type?o.setupReceiverTransform(p.transformer.readable,p.transformer.writable):"PassthroughTransform"===p.transformer.options.type&&o.setupPassthroughTransform(p.transformer.readable,p.transformer.writable)}),self.onmessage=p=>{"StartRedWorker"===p.data.msgType?(o.setupSenderTransform(p.data.send.readable,p.data.send.writable),o.setupReceiverTransform(p.data.receive.readable,p.data.receive.writable)):"PassthroughTransform"===p.data.msgType?(o.setupPassthroughTransform(p.data.send.readable,p.data.send.writable),o.setupPassthroughTransform(p.data.receive.readable,p.data.receive.writable)):"RedPayloadType"===p.data.msgType?o.setRedPayloadType(p.data.payloadType):"OpusPayloadType"===p.data.msgType?o.setOpusPayloadType(p.data.payloadType):"UpdateNumRedundantEncodings"===p.data.msgType?o.setNumRedundantEncodings(p.data.numRedundantEncodings):"Enable"===p.data.msgType?o.setRedundancyEnabled(!0):"Disable"===p.data.msgType&&o.setRedundancyEnabled(!1)}}static log(o){RedundantAudioEncoder.shouldLog&&self.postMessage({type:"REDWorkerLog",log:`[AudioRed] ${o}`})}static getNumRedundantEncodingsForPacketLoss(o){let p=0,f=!1;return o<=8?p=0:o<=18?p=1:o<=75?p=2:(p=0,f=!0),[p,f]}setupPassthroughTransform(o,p){RedundantAudioEncoder.log("Setting up passthrough transform"),o.pipeTo(p)}setupSenderTransform(o,p){RedundantAudioEncoder.log("Setting up sender RED transform");let f=new TransformStream({transform:this.senderTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setupReceiverTransform(o,p){RedundantAudioEncoder.log("Setting up receiver RED transform");let f=new TransformStream({transform:this.receivePacketLogTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setRedPayloadType(o){this.redPayloadType=o,RedundantAudioEncoder.log(`red payload type set to ${this.redPayloadType}`)}setOpusPayloadType(o){this.opusPayloadType=o,RedundantAudioEncoder.log(`opus payload type set to ${this.opusPayloadType}`)}setNumRedundantEncodings(o){this.numRedundantEncodings=o,this.numRedundantEncodings>this.maxRedEncodings&&(this.numRedundantEncodings=this.maxRedEncodings),RedundantAudioEncoder.log(`Updated numRedundantEncodings to ${this.numRedundantEncodings}`)}setRedundancyEnabled(o){this.redundancyEnabled=o,RedundantAudioEncoder.log(`redundancy ${this.redundancyEnabled?"enabled":"disabled"}`)}enqueueAudioFrameIfPayloadSizeIsValid(o,p){o.data.byteLength>this.maxAudioPayloadSizeBytes||p.enqueue(o)}senderTransform(o,p){if(o.getMetadata().payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let f=this.getPrimaryPayload(o.timestamp,o.data);if(!f)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.encode(o.timestamp,f);m&&(o.data=m),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}getPrimaryPayload(o,p){let f=this.splitEncodings(o,p);return!f||f.length<1?null:f[f.length-1].payload}splitEncodings(o,p,f=!1,m){let _=new DataView(p),w=_.byteLength,I=0,k=0,M=0,x=0,O=!1,L=[],B=[],U=[];for(;w>0;){if(O=(128&_.getUint8(x))==0){if((127&_.getUint8(x))!==this.opusPayloadType||(I+=this.redLastHeaderSizeBytes,k+=this.redLastHeaderSizeBytes,I>=_.byteLength))return null;M=_.byteLength-I;break}{if(w>2);U.push(f),I+=p+this.redHeaderSizeBytes,k+=this.redHeaderSizeBytes,x+=this.redHeaderSizeBytes,w-=this.redHeaderSizeBytes}}if(!O)return void 0!==m?(L.push({payload:p,isRedundant:!1,seq:m}),L):null;let $=k;for(let o=0;o=this.maxRedPacketSizeBytes||f>=this.maxAudioPayloadSizeBytes)return null;let m=this.numRedundantEncodings,_=this.redLastHeaderSizeBytes,w=f,I=this.maxAudioPayloadSizeBytes-f-_,k=[],M=[];if(this.redundancyEnabled){let p=this.uint32WrapAround(o-this.redPacketizationTime*this.redPacketDistance);for(let f=0;f=this.maxRedTimestampOffset);f++){let o=p,f=this.encodingHistory.find(p=>p.timestamp===o);if(f||(o=this.uint32WrapAround(p-this.redPacketizationTime),f=this.encodingHistory.find(p=>p.timestamp===o)),f){let o=f.payload.byteLength;if(I>8),O.setUint8(L+3,255&M[p].byteLength),L+=this.redHeaderSizeBytes}O.setUint8(L,this.opusPayloadType),L+=this.redLastHeaderSizeBytes;let B=new Uint8Array(x);for(let o=0;o=f)this.encodingHistory.shift();else break}let f=new DataView(p);(this.opusPacketIsCeltOnly(f)||this.opusPacketHasVoiceActivity(f,f.byteLength)>0)&&(this.encodingHistory.length+1>this.maxEncodingHistorySize&&(this.encodingHistory.length=0),this.encodingHistory.push({timestamp:o,payload:p}))}initializePacketLogs(){let o=this.maxOutOfOrderPacketDistance+this.redMaxRecoveryDistance;this.primaryPacketLog={window:Array(o),index:0,windowSize:o},this.redRecoveryLog={window:Array(o),index:0,windowSize:o},this.fecRecoveryLog={window:Array(o),index:0,windowSize:o},this.totalAudioPacketsExpected=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}receivePacketLogTransform(o,p){let f=o.getMetadata();if(f.payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.splitEncodings(o.timestamp,o.data,!0,f.sequenceNumber);if(!m)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);for(let o=m.length-1;o>=0;o--)this.updateLossStats(m[o])&&(this.updateRedStats(m[o]),this.updateFecStats(m[o]));this.maybeReportLossStats(f.synchronizationSource,m[m.length-1].timestamp),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}updateLossStats(o){if(o.isRedundant)return!0;let p=o.timestamp,f=o.seq;if(0===this.totalAudioPacketsExpected)return this.totalAudioPacketsExpected=1,this.newestSequenceNumber=f,this.addTimestamp(this.primaryPacketLog,p),!0;let m=this.int16(f-this.newestSequenceNumber);return!(m<-this.maxOutOfOrderPacketDistance)&&(m<0?this.hasTimestamp(this.primaryPacketLog,p)||(this.totalAudioPacketsLost>0&&this.totalAudioPacketsLost--,this.addTimestamp(this.primaryPacketLog,p),this.removeFromRecoveryWindows(p)):m>1&&(this.totalAudioPacketsLost+=m-1),m>0&&(this.totalAudioPacketsExpected+=m,this.newestSequenceNumber=o.seq,this.addTimestamp(this.primaryPacketLog,p)),!0)}updateRedStats(o){if(!o.isRedundant||0===this.totalAudioPacketsLost)return;let p=o.timestamp;!this.hasTimestamp(this.primaryPacketLog,p)&&(this.hasTimestamp(this.redRecoveryLog,p)||(this.totalAudioPacketsRecoveredRed++,this.addTimestamp(this.redRecoveryLog,p)),this.removeTimestamp(this.fecRecoveryLog,p)&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--)}updateFecStats(o){if(!o.hasFec||0===this.totalAudioPacketsLost)return;let p=o.timestamp-this.redPacketizationTime;this.hasTimestamp(this.primaryPacketLog,p)||this.hasTimestamp(this.redRecoveryLog,p)||this.hasTimestamp(this.fecRecoveryLog,p)||(this.totalAudioPacketsRecoveredFec++,this.addTimestamp(this.fecRecoveryLog,p))}maybeReportLossStats(o,p){void 0===p||p-this.lastLossReportTimestampo===p)}removeTimestamp(o,p){let f=o.window.indexOf(p);return f>=0&&(o.window[f]=void 0,!0)}removeFromRecoveryWindows(o){let p=this.removeTimestamp(this.redRecoveryLog,o);p&&this.totalAudioPacketsRecoveredRed>0&&this.totalAudioPacketsRecoveredRed--,(p=this.removeTimestamp(this.fecRecoveryLog,o))&&this.totalAudioPacketsRecoveredFec>0&&this.totalAudioPacketsRecoveredFec--}uint32WrapAround(o){let p=o;return o>=0x100000000?p=o-0x100000000:o<0&&(p=0x100000000+o),p}int16(o){return o<<16>>16}opusPacketIsCeltOnly(o){return!!(128&o.getUint8(0))}opusPacketGetSamplesPerFrame(o,p){let f,m;return p=Math.min(Math.max(p=Math.round(p),-0x100000000),0xffffffff),this.opusPacketIsCeltOnly(o)?(m=o.getUint8(0)>>3&3,f=(p<>3&3)?60*p/1e3:(p<o.getUint8(p)?(m[0]=o.getUint8(p),1):f<2?(m[0]=-1,-1):(m[0]=4*o.getUint8(p+1)+o.getUint8(p),2)}opusPacketParseImpl(o,p,f,m,_,w,I,k){let M,x;if(!w||p<0)return this.OPUS_BAD_ARG;if(0===p)return this.OPUS_INVALID_PACKET;let O=0,L=!1,B=o.getUint8(0);m&&(m[0]=B);let U=p-1,$=1,q=U;switch(3&B){case 0:M=1;break;case 1:if(M=2,L=!0,!f){if(1&U)return this.OPUS_INVALID_PACKET;q=U/2,w[0][0]=q}break;case 2:if(M=2,x=this.opusParseSize(o,$,U,w[0]),U-=x,w[0][0]<0||w[0][0]>U)return this.OPUS_INVALID_PACKET;$+=x,q=U-w[0][0];break;default:if(U<1)return this.OPUS_INVALID_PACKET;let Z=o.getUint8($++);if(--U,(M=63&Z)<=0||this.opusPacketGetSamplesPerFrame(o,48e3)*M>5760)return this.OPUS_INVALID_PACKET;if(64&Z){let p,f;do{if(U<=0)return this.OPUS_INVALID_PACKET;p=o.getUint8($++),--U,U-=f=255===p?254:p,O+=f}while(255===p)}if(U<0)return this.OPUS_INVALID_PACKET;if(L=!(128&Z)){if(!f){if((q=Math.trunc(U/M))*M!==U)return this.OPUS_INVALID_PACKET;for(let o=0;oU)return this.OPUS_INVALID_PACKET;$+=x,q-=x+w[p][0]}if(q<0)return this.OPUS_INVALID_PACKET}}if(f){if(x=this.opusParseSize(o,$,U,w[M-1]),U-=x,w[M-1][0]<0||w[M-1][0]>U)return this.OPUS_INVALID_PACKET;if($+=x,L){if(w[M-1][0]*M>U)return this.OPUS_INVALID_PACKET;for(let o=0;othis.OPUS_MAX_FRAME_SIZE_BYTES)return this.OPUS_INVALID_PACKET;w[M-1][0]=q}I&&(I[0]=$);for(let o=0;o>8-f||2===this.opusPacketGetNumChannels(o)&&o.getUint8(m[p][0])<>8-f))return 1;return 0}opusPacketHasFec(o,p){if(!o||p<=0||this.opusPacketIsCeltOnly(o))return!1;let f=Array(this.OPUS_MAX_OPUS_FRAMES),m=Array(this.OPUS_MAX_OPUS_FRAMES);for(let o=0;othis.opusPacketParse(o,p,null,f,m,null)||m[0][0]<=1)return!1;let _=this.opusNumSilkFrames(o);if(0===_)return!1;let w=this.opusPacketGetNumChannels(o);if(1!==w&&2!==w)return!1;for(let p=0;p>(p+1)*(_+1)-1)return!0;return!1}};p.default=f,f.shouldLog=!1,f.shouldReportStats=!1},0x118a80d5b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=`class RedundantAudioEncoder {
constructor() {
// Each payload must be less than 1024 bytes to fit the 10 bit block length
this.maxRedPacketSizeBytes = 1 << 10;
// Limit payload to 1000 bytes to handle small MTU. 1000 is chosen because in Chromium-based browsers, writing audio
// payloads larger than 1000 bytes using the WebRTC Insertable Streams API (which is used to enable dynamic audio
// redundancy) will cause an error to be thrown and cause audio flow to permanently stop. See
// https://crbug.com/1248479.
this.maxAudioPayloadSizeBytes = 1000;
// Each payload can encode a timestamp delta of 14 bits
this.maxRedTimestampOffset = 1 << 14;
// 4 byte RED header
this.redHeaderSizeBytes = 4;
// reduced size for last RED header
this.redLastHeaderSizeBytes = 1;
// P-Time for Opus 20 msec packets
// We do not support other p-times or clock rates
this.redPacketizationTime = 960;
// distance between redundant payloads, Opus FEC handles a distance of 1
// TODO(https://issues.amazon.com/issues/ChimeSDKAudio-55):
// Consider making this dynamic
this.redPacketDistance = 2;
// maximum number of redundant payloads per RTP packet
this.maxRedEncodings = 2;
// Maximum number of encodings that can be recovered with a single RED packet, assuming the primary and redundant
// payloads have FEC.
this.redMaxRecoveryDistance = this.redPacketDistance * this.maxRedEncodings + 1;
// maximum history of prior payloads to keep
// generally we will expire old entries based on timestamp
// this limit is in place just to make sure the history does not
// grow too large in the case of erroneous timestamp inputs
this.maxEncodingHistorySize = 10;
// Current number of encodings we want to send
// to the remote end. This will be dynamically
// updated through the setNumEncodingsFromPacketloss API
this.numRedundantEncodings = 0;
// Used to enable or disable redundancy
// in response to very high packet loss events
this.redundancyEnabled = true;
// Loss stats are reported to the main thread every 5 seconds.
// Since timestamp differences between 2 consecutive packets
// give us the number of samples in each channel, 1 second
// is equivalent to 48000 samples:
// P-time * (1000ms/1s)
// = (960 samples/20ms) * (1000ms/1s)
// = 48000 samples/s
this.lossReportInterval = 48000 * 5;
// Maximum distance of a packet from the most recent packet timestamp
// that we will consider for recovery.
this.maxOutOfOrderPacketDistance = 16;
/**
* Below are Opus helper methods and constants.
*/
this.OPUS_BAD_ARG = -1;
this.OPUS_INVALID_PACKET = -4;
// Max number of Opus frames in an Opus packet is 48 (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5).
this.OPUS_MAX_OPUS_FRAMES = 48;
// Max number of bytes that any individual Opus frame can have.
this.OPUS_MAX_FRAME_SIZE_BYTES = 1275;
this.encodingHistory = new Array();
this.opusPayloadType = 0;
this.redPayloadType = 0;
this.initializePacketLogs();
}
/**
* Creates an instance of RedundantAudioEncoder and sets up callbacks.
*/
static initializeWorker() {
RedundantAudioEncoder.log('Initializing RedundantAudioEncoder');
const encoder = new RedundantAudioEncoder();
// RED encoding is done using WebRTC Encoded Transform
// https://github.com/w3c/webrtc-encoded-transform/blob/main/explainer.md
// Check the DedicatedWorkerGlobalScope for existence of
// RTCRtpScriptTransformer interface. If exists, then
// RTCRtpScriptTransform is supported by this browser.
// @ts-ignore
if (self.RTCRtpScriptTransformer) {
// @ts-ignore
self.onrtctransform = (event) => {
if (event.transformer.options.type === 'SenderTransform') {
encoder.setupSenderTransform(event.transformer.readable, event.transformer.writable);
}
else if (event.transformer.options.type === 'ReceiverTransform') {
encoder.setupReceiverTransform(event.transformer.readable, event.transformer.writable);
}
else if (event.transformer.options.type === 'PassthroughTransform') {
encoder.setupPassthroughTransform(event.transformer.readable, event.transformer.writable);
}
};
}
self.onmessage = (event) => {
if (event.data.msgType === 'StartRedWorker') {
encoder.setupSenderTransform(event.data.send.readable, event.data.send.writable);
encoder.setupReceiverTransform(event.data.receive.readable, event.data.receive.writable);
}
else if (event.data.msgType === 'PassthroughTransform') {
encoder.setupPassthroughTransform(event.data.send.readable, event.data.send.writable);
encoder.setupPassthroughTransform(event.data.receive.readable, event.data.receive.writable);
}
else if (event.data.msgType === 'RedPayloadType') {
encoder.setRedPayloadType(event.data.payloadType);
}
else if (event.data.msgType === 'OpusPayloadType') {
encoder.setOpusPayloadType(event.data.payloadType);
}
else if (event.data.msgType === 'UpdateNumRedundantEncodings') {
encoder.setNumRedundantEncodings(event.data.numRedundantEncodings);
}
else if (event.data.msgType === 'Enable') {
encoder.setRedundancyEnabled(true);
}
else if (event.data.msgType === 'Disable') {
encoder.setRedundancyEnabled(false);
}
};
}
/**
* Post logs to the main thread
*/
static log(msg) {
if (RedundantAudioEncoder.shouldLog) {
// @ts-ignore
self.postMessage({
type: 'REDWorkerLog',
log: \`[AudioRed] \${msg}\`,
});
}
}
/**
* Returns the number of encodings based on packetLoss value. This is used by \`DefaultTransceiverController\` to
* determine when to alert the encoder to update the number of encodings. It also determines if we need to
* turn off red in cases of very high packet loss to avoid congestion collapse.
*/
static getNumRedundantEncodingsForPacketLoss(packetLoss) {
let recommendedRedundantEncodings = 0;
let shouldTurnOffRed = false;
if (packetLoss <= 8) {
recommendedRedundantEncodings = 0;
}
else if (packetLoss <= 18) {
recommendedRedundantEncodings = 1;
}
else if (packetLoss <= 75) {
recommendedRedundantEncodings = 2;
}
else {
recommendedRedundantEncodings = 0;
shouldTurnOffRed = true;
}
return [recommendedRedundantEncodings, shouldTurnOffRed];
}
/**
* Sets up a passthrough (no-op) transform for the given streams.
*/
setupPassthroughTransform(readable, writable) {
RedundantAudioEncoder.log('Setting up passthrough transform');
readable.pipeTo(writable);
}
/**
* Sets up the transform stream and pipes the outgoing encoded audio frames through the transform function.
*/
setupSenderTransform(readable, writable) {
RedundantAudioEncoder.log('Setting up sender RED transform');
const transformStream = new TransformStream({
transform: this.senderTransform.bind(this),
});
readable.pipeThrough(transformStream).pipeTo(writable);
return;
}
/**
* Sets up the transform stream and pipes the received encoded audio frames through the transform function.
*/
setupReceiverTransform(readable, writable) {
RedundantAudioEncoder.log('Setting up receiver RED transform');
const transformStream = new TransformStream({
transform: this.receivePacketLogTransform.bind(this),
});
readable.pipeThrough(transformStream).pipeTo(writable);
return;
}
/**
* Set the RED payload type ideally obtained from local offer.
*/
setRedPayloadType(payloadType) {
this.redPayloadType = payloadType;
RedundantAudioEncoder.log(\`red payload type set to \${this.redPayloadType}\`);
}
/**
* Set the opus payload type ideally obtained from local offer.
*/
setOpusPayloadType(payloadType) {
this.opusPayloadType = payloadType;
RedundantAudioEncoder.log(\`opus payload type set to \${this.opusPayloadType}\`);
}
/**
* Set the number of redundant encodings
*/
setNumRedundantEncodings(numRedundantEncodings) {
this.numRedundantEncodings = numRedundantEncodings;
if (this.numRedundantEncodings > this.maxRedEncodings) {
this.numRedundantEncodings = this.maxRedEncodings;
}
RedundantAudioEncoder.log(\`Updated numRedundantEncodings to \${this.numRedundantEncodings}\`);
}
/**
* Enable or disable redundancy in response to
* high packet loss event.
*/
setRedundancyEnabled(enabled) {
this.redundancyEnabled = enabled;
RedundantAudioEncoder.log(\`redundancy \${this.redundancyEnabled ? 'enabled' : 'disabled'}\`);
}
/**
* Helper function to only enqueue audio frames if they do not exceed the audio payload byte limit imposed by
* Chromium-based browsers. Chromium will throw an error (https://crbug.com/1248479) if an audio payload larger than
* 1000 bytes is enqueued. Any controller that attempts to enqueue an audio payload larger than 1000 bytes will
* encounter this error and will permanently stop sending or receiving audio.
*/
enqueueAudioFrameIfPayloadSizeIsValid(
// @ts-ignore
frame, controller) {
if (frame.data.byteLength > this.maxAudioPayloadSizeBytes)
return;
controller.enqueue(frame);
}
/**
* Receives encoded frames and modifies as needed before sending to transport.
*/
senderTransform(
// @ts-ignore
frame, controller) {
const frameMetadata = frame.getMetadata();
// @ts-ignore
if (frameMetadata.payloadType !== this.redPayloadType) {
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
const primaryPayloadBuffer = this.getPrimaryPayload(frame.timestamp, frame.data);
if (!primaryPayloadBuffer) {
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
const encodedBuffer = this.encode(frame.timestamp, primaryPayloadBuffer);
/* istanbul ignore next */
if (!encodedBuffer) {
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
frame.data = encodedBuffer;
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
/**
* Get the primary payload from encoding
*/
getPrimaryPayload(primaryTimestamp, frame) {
const encodings = this.splitEncodings(primaryTimestamp, frame);
if (!encodings || encodings.length < 1)
return null;
return encodings[encodings.length - 1].payload;
}
/**
* Split up the encoding received into primary and redundant encodings
* These will be ordered oldest to newest which is the same ordering
* in the RTP red payload.
*/
splitEncodings(primaryTimestamp, frame, getFecInfo = false, primarySequenceNumber = undefined) {
// process RED headers (according to RFC 2198)
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |F| block PT | timestamp offset | block length |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// last header
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// |0| Block PT |
// +-+-+-+-+-+-+-+-+
const payload = new DataView(frame);
let payloadSizeBytes = payload.byteLength;
let totalPayloadSizeBytes = 0;
let totalHeaderSizeBytes = 0;
let primaryPayloadSizeBytes = 0;
let payloadOffset = 0;
let gotLastBlock = false;
const encodings = new Array();
const redundantEncodingBlockLengths = new Array();
const redundantEncodingTimestamps = new Array();
while (payloadSizeBytes > 0) {
gotLastBlock = (payload.getUint8(payloadOffset) & 0x80) === 0;
if (gotLastBlock) {
// Bits 1 through 7 are payload type
const payloadType = payload.getUint8(payloadOffset) & 0x7f;
// Unexpected payload type. This is a bad packet.
if (payloadType !== this.opusPayloadType) {
return null;
}
totalPayloadSizeBytes += this.redLastHeaderSizeBytes;
totalHeaderSizeBytes += this.redLastHeaderSizeBytes;
// Accumulated block lengths are equal to or larger than the buffer, which means there is no primary block. This
// is a bad packet.
if (totalPayloadSizeBytes >= payload.byteLength) {
return null;
}
primaryPayloadSizeBytes = payload.byteLength - totalPayloadSizeBytes;
break;
}
else {
if (payloadSizeBytes < this.redHeaderSizeBytes) {
return null;
}
// Bits 22 through 31 are payload length
const blockLength = ((payload.getUint8(payloadOffset + 2) & 0x03) << 8) + payload.getUint8(payloadOffset + 3);
redundantEncodingBlockLengths.push(blockLength);
const timestampOffset = payload.getUint16(payloadOffset + 1) >> 2;
const timestamp = primaryTimestamp - timestampOffset;
redundantEncodingTimestamps.push(timestamp);
totalPayloadSizeBytes += blockLength + this.redHeaderSizeBytes;
totalHeaderSizeBytes += this.redHeaderSizeBytes;
payloadOffset += this.redHeaderSizeBytes;
payloadSizeBytes -= this.redHeaderSizeBytes;
}
}
// The last block was never found. The packet we received
// does not have a good RED payload.
if (!gotLastBlock) {
// Note that sequence numbers only exist for
// incoming audio frames.
if (primarySequenceNumber !== undefined) {
// This could be a possible padding packet used
// for BWE with a good sequence number.
// Create a dummy encoding to make sure loss values
// are calculated correctly by consuming sequence number.
// Note that for the receive side, we process packets only
// for loss/recovery calculations and forward the original
// packet without changing it even in the error case.
encodings.push({
payload: frame,
isRedundant: false,
seq: primarySequenceNumber,
});
return encodings;
}
// This is a bad packet.
return null;
}
let redundantPayloadOffset = totalHeaderSizeBytes;
for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
const redundantPayloadBuffer = new ArrayBuffer(redundantEncodingBlockLengths[i]);
const redundantPayloadArray = new Uint8Array(redundantPayloadBuffer);
redundantPayloadArray.set(new Uint8Array(payload.buffer, redundantPayloadOffset, redundantEncodingBlockLengths[i]), 0);
const encoding = {
timestamp: redundantEncodingTimestamps[i],
payload: redundantPayloadBuffer,
isRedundant: true,
};
if (getFecInfo) {
encoding.hasFec = this.opusPacketHasFec(new DataView(redundantPayloadBuffer), redundantPayloadBuffer.byteLength);
}
encodings.push(encoding);
redundantPayloadOffset += redundantEncodingBlockLengths[i];
}
const primaryPayloadOffset = payload.byteLength - primaryPayloadSizeBytes;
const primaryPayloadBuffer = new ArrayBuffer(primaryPayloadSizeBytes);
const primaryArray = new Uint8Array(primaryPayloadBuffer);
primaryArray.set(new Uint8Array(payload.buffer, primaryPayloadOffset, primaryPayloadSizeBytes), 0);
const encoding = {
timestamp: primaryTimestamp,
payload: primaryPayloadBuffer,
isRedundant: false,
seq: primarySequenceNumber,
};
if (getFecInfo) {
encoding.hasFec = this.opusPacketHasFec(new DataView(primaryPayloadBuffer), primaryPayloadBuffer.byteLength);
}
encodings.push(encoding);
return encodings;
}
/**
* Create a new encoding with current primary payload and the older payloads of choice.
*/
encode(primaryTimestamp, primaryPayload) {
const primaryPayloadSize = primaryPayload.byteLength;
// Payload size needs to be valid.
if (primaryPayloadSize === 0 ||
primaryPayloadSize >= this.maxRedPacketSizeBytes ||
primaryPayloadSize >= this.maxAudioPayloadSizeBytes) {
return null;
}
const numRedundantEncodings = this.numRedundantEncodings;
let headerSizeBytes = this.redLastHeaderSizeBytes;
let payloadSizeBytes = primaryPayloadSize;
let bytesAvailable = this.maxAudioPayloadSizeBytes - primaryPayloadSize - headerSizeBytes;
const redundantEncodingTimestamps = new Array();
const redundantEncodingPayloads = new Array();
// If redundancy is disabled then only send the primary payload
if (this.redundancyEnabled) {
// Determine how much redundancy we can fit into our packet
let redundantTimestamp = this.uint32WrapAround(primaryTimestamp - this.redPacketizationTime * this.redPacketDistance);
for (let i = 0; i < numRedundantEncodings; i++) {
// Do not add redundant encodings that are beyond the maximum timestamp offset.
if (this.uint32WrapAround(primaryTimestamp - redundantTimestamp) >= this.maxRedTimestampOffset) {
break;
}
let findTimestamp = redundantTimestamp;
let encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
if (!encoding) {
// If not found or not important then look for the previous packet.
// The current packet may have included FEC for the previous, so just
// use the previous packet instead provided that it has voice activity.
findTimestamp = this.uint32WrapAround(redundantTimestamp - this.redPacketizationTime);
encoding = this.encodingHistory.find(e => e.timestamp === findTimestamp);
}
if (encoding) {
const redundantEncodingSizeBytes = encoding.payload.byteLength;
// Only add redundancy if there are enough bytes available.
if (bytesAvailable < this.redHeaderSizeBytes + redundantEncodingSizeBytes)
break;
bytesAvailable -= this.redHeaderSizeBytes + redundantEncodingSizeBytes;
headerSizeBytes += this.redHeaderSizeBytes;
payloadSizeBytes += redundantEncodingSizeBytes;
redundantEncodingTimestamps.unshift(encoding.timestamp);
redundantEncodingPayloads.unshift(encoding.payload);
}
redundantTimestamp -= this.redPacketizationTime * this.redPacketDistance;
redundantTimestamp = this.uint32WrapAround(redundantTimestamp);
}
}
const redPayloadBuffer = new ArrayBuffer(headerSizeBytes + payloadSizeBytes);
const redPayloadView = new DataView(redPayloadBuffer);
// Add redundant encoding header(s) to new buffer
let redPayloadOffset = 0;
for (let i = 0; i < redundantEncodingTimestamps.length; i++) {
const timestampDelta = primaryTimestamp - redundantEncodingTimestamps[i];
redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType | 0x80);
redPayloadView.setUint16(redPayloadOffset + 1, (timestampDelta << 2) | (redundantEncodingPayloads[i].byteLength >> 8));
redPayloadView.setUint8(redPayloadOffset + 3, redundantEncodingPayloads[i].byteLength & 0xff);
redPayloadOffset += this.redHeaderSizeBytes;
}
// Add primary encoding header to new buffer
redPayloadView.setUint8(redPayloadOffset, this.opusPayloadType);
redPayloadOffset += this.redLastHeaderSizeBytes;
// Add redundant payload(s) to new buffer
const redPayloadArray = new Uint8Array(redPayloadBuffer);
for (let i = 0; i < redundantEncodingPayloads.length; i++) {
redPayloadArray.set(new Uint8Array(redundantEncodingPayloads[i]), redPayloadOffset);
redPayloadOffset += redundantEncodingPayloads[i].byteLength;
}
// Add primary payload to new buffer
redPayloadArray.set(new Uint8Array(primaryPayload), redPayloadOffset);
redPayloadOffset += primaryPayload.byteLength;
/* istanbul ignore next */
// Sanity check that we got the expected total payload size.
if (redPayloadOffset !== headerSizeBytes + payloadSizeBytes)
return null;
this.updateEncodingHistory(primaryTimestamp, primaryPayload);
return redPayloadBuffer;
}
/**
* Update the encoding history with the latest primary encoding
*/
updateEncodingHistory(primaryTimestamp, primaryPayload) {
// Remove encodings from the history if they are too old.
for (const encoding of this.encodingHistory) {
const maxTimestampDelta = this.redPacketizationTime * this.redMaxRecoveryDistance;
if (primaryTimestamp - encoding.timestamp >= maxTimestampDelta) {
this.encodingHistory.shift();
}
else {
break;
}
}
// Only add an encoding to the history if the encoding is deemed to be important. An encoding is important if it is
// a CELT-only packet or contains voice activity.
const packet = new DataView(primaryPayload);
if (this.opusPacketIsCeltOnly(packet) ||
this.opusPacketHasVoiceActivity(packet, packet.byteLength) > 0) {
// Check if adding an encoding will cause the length of the encoding history to exceed the maximum history size.
// This is not expected to happen but could occur if we get incorrect timestamps. We want to make sure our memory
// usage is bounded. In this case, just clear the history and start over from empty.
if (this.encodingHistory.length + 1 > this.maxEncodingHistorySize)
this.encodingHistory.length = 0;
this.encodingHistory.push({ timestamp: primaryTimestamp, payload: primaryPayload });
}
}
/**
* Initialize packet logs and metric values.
*/
initializePacketLogs() {
// The extra space from the max RED recovery distance is to ensure that we do not incorrectly count recovery for
// packets that have already been received but are outside of the max out-of-order distance.
const packetLogSize = this.maxOutOfOrderPacketDistance + this.redMaxRecoveryDistance;
this.primaryPacketLog = {
window: new Array(packetLogSize),
index: 0,
windowSize: packetLogSize,
};
this.redRecoveryLog = {
window: new Array(packetLogSize),
index: 0,
windowSize: packetLogSize,
};
this.fecRecoveryLog = {
window: new Array(packetLogSize),
index: 0,
windowSize: packetLogSize,
};
this.totalAudioPacketsExpected = 0;
this.totalAudioPacketsLost = 0;
this.totalAudioPacketsRecoveredRed = 0;
this.totalAudioPacketsRecoveredFec = 0;
}
/**
* Receives encoded frames from the server
* and adds the timestamps to a packet log
* to calculate an approximate recovery metric.
*/
receivePacketLogTransform(
// @ts-ignore
frame, controller) {
const frameMetadata = frame.getMetadata();
// @ts-ignore
if (frameMetadata.payloadType !== this.redPayloadType) {
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
// @ts-ignore
const encodings = this.splitEncodings(frame.timestamp, frame.data,
/*getFecInfo*/ true, frameMetadata.sequenceNumber);
if (!encodings) {
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
return;
}
for (let i = encodings.length - 1; i >= 0; i--) {
if (this.updateLossStats(encodings[i])) {
this.updateRedStats(encodings[i]);
this.updateFecStats(encodings[i]);
}
}
this.maybeReportLossStats(frameMetadata.synchronizationSource, encodings[encodings.length - 1].timestamp);
this.enqueueAudioFrameIfPayloadSizeIsValid(frame, controller);
}
/**
* Adds a timestamp to the primary packet log.
* This also updates totalAudioPacketsLost and totalAudioPacketsExpected by looking
* at the difference between timestamps.
*
* @param encoding : The encoding to be analyzed
* @returns false if sequence number was greater than max out of order distance
* true otherwise
*/
updateLossStats(encoding) {
if (encoding.isRedundant)
return true;
const timestamp = encoding.timestamp;
const seq = encoding.seq;
if (this.totalAudioPacketsExpected === 0) {
this.totalAudioPacketsExpected = 1;
this.newestSequenceNumber = seq;
this.addTimestamp(this.primaryPacketLog, timestamp);
return true;
}
const diff = this.int16(seq - this.newestSequenceNumber);
if (diff < -this.maxOutOfOrderPacketDistance)
return false;
if (diff < 0) {
if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
if (this.totalAudioPacketsLost > 0)
this.totalAudioPacketsLost--;
this.addTimestamp(this.primaryPacketLog, timestamp);
this.removeFromRecoveryWindows(timestamp);
}
}
else if (diff > 1) {
this.totalAudioPacketsLost += diff - 1;
}
if (diff > 0) {
this.totalAudioPacketsExpected += diff;
this.newestSequenceNumber = encoding.seq;
this.addTimestamp(this.primaryPacketLog, timestamp);
}
return true;
}
/**
* Adds a timestamp to the red recovery log if it is not present in
* the primary packet log and if it's not too old.
*
* @param encoding : The encoding to be analyzed
*/
updateRedStats(encoding) {
if (!encoding.isRedundant || this.totalAudioPacketsLost === 0)
return;
const timestamp = encoding.timestamp;
if (!this.hasTimestamp(this.primaryPacketLog, timestamp)) {
if (!this.hasTimestamp(this.redRecoveryLog, timestamp)) {
this.totalAudioPacketsRecoveredRed++;
this.addTimestamp(this.redRecoveryLog, timestamp);
}
if (this.removeTimestamp(this.fecRecoveryLog, timestamp)) {
/* istanbul ignore else */
if (this.totalAudioPacketsRecoveredFec > 0)
this.totalAudioPacketsRecoveredFec--;
}
}
}
/**
* Adds a timestamp to the fec recovery log if it is not present in
* the primary packet log and red recovery log and if it is not too old.
*
* @param encoding : The encoding to be analyzed
*/
updateFecStats(encoding) {
if (!encoding.hasFec || this.totalAudioPacketsLost === 0)
return;
const fecTimestamp = encoding.timestamp - this.redPacketizationTime;
if (this.hasTimestamp(this.primaryPacketLog, fecTimestamp) ||
this.hasTimestamp(this.redRecoveryLog, fecTimestamp) ||
this.hasTimestamp(this.fecRecoveryLog, fecTimestamp)) {
return;
}
this.totalAudioPacketsRecoveredFec++;
this.addTimestamp(this.fecRecoveryLog, fecTimestamp);
}
/**
* Reports loss metrics to DefaultTransceiverController
*
* @param timestamp : Timestamp of most recent primary packet
*/
maybeReportLossStats(ssrc, timestamp) {
if (timestamp === undefined ||
timestamp - this.lastLossReportTimestamp < this.lossReportInterval)
return;
/* istanbul ignore next */
if (RedundantAudioEncoder.shouldReportStats) {
// @ts-ignore
self.postMessage({
type: 'RedundantAudioEncoderStats',
ssrc,
totalAudioPacketsLost: this.totalAudioPacketsLost,
totalAudioPacketsExpected: this.totalAudioPacketsExpected,
totalAudioPacketsRecoveredRed: this.totalAudioPacketsRecoveredRed,
totalAudioPacketsRecoveredFec: this.totalAudioPacketsRecoveredFec,
});
}
this.lastLossReportTimestamp = timestamp;
}
/**
* Adds a timestamp to a packet log
*
* @param packetLog : The packetlog to add the timestamp to
* @param timestamp : The timestamp that should be added
*/
addTimestamp(packetLog, timestamp) {
if (timestamp === undefined) {
return;
}
packetLog.window[packetLog.index] = timestamp;
packetLog.index = (packetLog.index + 1) % packetLog.windowSize;
}
/**
* Checks if a timestamp is in a packetlog
*
* @param packetLog : The packetlog to search
* @param timestamp : The timestamp to search for
* @returns true if timestamp is present, false otherwise
*/
hasTimestamp(packetLog, timestamp) {
const element = packetLog.window.find(t => t === timestamp);
return !!element;
}
/**
* Removes a timestamp from a packet log
*
* @param packetLog : The packetlog from which the timestamp should be removed
* @param timestamp : The timestamp to be removed
* @returns true if timestamp was present in the log and removed, false otherwise
*/
removeTimestamp(packetLog, timestamp) {
const index = packetLog.window.indexOf(timestamp);
if (index >= 0) {
packetLog.window[index] = undefined;
return true;
}
return false;
}
/**
* Removes a timestamp from red and fec recovery windows.
*
* @param timestamp : The timestamp to be removed
*/
removeFromRecoveryWindows(timestamp) {
let removed = this.removeTimestamp(this.redRecoveryLog, timestamp);
if (removed) {
if (this.totalAudioPacketsRecoveredRed > 0)
this.totalAudioPacketsRecoveredRed--;
}
removed = this.removeTimestamp(this.fecRecoveryLog, timestamp);
if (removed) {
if (this.totalAudioPacketsRecoveredFec > 0)
this.totalAudioPacketsRecoveredFec--;
}
}
/**
* Converts the supplied argument to 32-bit unsigned integer
*/
uint32WrapAround(num) {
const mod = 4294967296; // 2^32
let res = num;
if (num >= mod) {
res = num - mod;
}
else if (num < 0) {
res = mod + num;
}
return res;
}
/**
* Converts the supplied argument to 16-bit signed integer
*/
int16(num) {
return (num << 16) >> 16;
}
/**
* Determines if an Opus packet is in CELT-only mode.
*
* @param packet Opus packet.
* @returns \`true\` if the packet is in CELT-only mode.
*/
opusPacketIsCeltOnly(packet) {
// TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
// 0
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// | config |s| c |
// +-+-+-+-+-+-+-+-+
// Since CELT-only packets are represented using configurations 16 to 31, the highest 'config' bit will always be 1
// for CELT-only packets.
return !!(packet.getUint8(0) & 0x80);
}
/**
* Gets the number of samples per frame from an Opus packet.
*
* @param packet Opus packet. This must contain at least one byte of data.
* @param sampleRateHz 32-bit integer sampling rate in Hz. This must be a multiple of 400 or inaccurate results will
* be returned.
* @returns Number of samples per frame.
*/
opusPacketGetSamplesPerFrame(packet, sampleRateHz) {
// Sample rate must be a 32-bit integer.
sampleRateHz = Math.round(sampleRateHz);
sampleRateHz = Math.min(Math.max(sampleRateHz, -(Math.pow(2, 32))), Math.pow(2, 32) - 1);
// TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
// 0
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// | config |s| c |
// +-+-+-+-+-+-+-+-+
let numSamples;
let frameSizeOption;
// Case for CELT-only packet.
if (this.opusPacketIsCeltOnly(packet)) {
// The lower 3 'config' bits indicate the frame size option.
frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
// The frame size options 0, 1, 2, 3 correspond to frame sizes of 2.5, 5, 10, 20 ms. Notice that the frame sizes
// can be represented as (2.5 * 2^0), (2.5 * 2^1), (2.5 * 2^2), (2.5 * 2^3) ms. So, the number of samples can be
// calculated as follows:
// (sample/s) * (1s/1000ms) * (2.5ms) * 2^(frameSizeOption)
// = (sample/s) * (1s/400) * 2^(frameSizeOption)
// = (sample/s) * 2^(frameSizeOption) * (1s/400)
numSamples = (sampleRateHz << frameSizeOption) / 400;
}
// Case for Hybrid packet. Since Hybrid packets are represented using configurations 12 to 15, bits 1 and 2 in the
// above TOC byte diagram will both be 1.
else if ((packet.getUint8(0) & 0x60) === 0x60) {
// In the case of configuration 13 or 15, bit 4 in the above TOC byte diagram will be 1. Configurations 13 and 15
// correspond to a 20ms frame size, so the number of samples is calculated as follows:
// (sample/s) * (1s/1000ms) * (20ms)
// = (sample/s) * (1s/50)
//
// In the case of configuration 12 or 14, bit 4 in the above TOC byte diagram will be 0. Configurations 12 and 14
// correspond to a 10ms frame size, so the number of samples is calculated as follows:
// (sample/s) * (1s/1000ms) * (10ms)
// = (sample/s) * (1s/100)
numSamples = packet.getUint8(0) & 0x08 ? sampleRateHz / 50 : sampleRateHz / 100;
}
// Case for SILK-only packet.
else {
// The lower 3 'config' bits indicate the frame size option for SILK-only packets.
frameSizeOption = (packet.getUint8(0) >> 3) & 0x3;
if (frameSizeOption === 3) {
// Frame size option 3 corresponds to a frame size of 60ms, so the number of samples is calculated as follows:
// (sample/s) * (1s/1000ms) * (60ms)
// = (sample/s) * (60ms) * (1s/1000ms)
numSamples = (sampleRateHz * 60) / 1000;
}
else {
// The frame size options 0, 1, 2 correspond to frame sizes of 10, 20, 40 ms. Notice that the frame sizes can be
// represented as (10 * 2^0), (10 * 2^1), (10 * 2^2) ms. So, the number of samples can be calculated as follows:
// (sample/s) * (1s/1000ms) * (10ms) * 2^(frameSizeOption)
// = (sample/s) * (1s/100) * 2^(frameSizeOption)
// = (sample/s) * 2^(frameSizeOption) * (1s/100)
numSamples = (sampleRateHz << frameSizeOption) / 100;
}
}
return numSamples;
}
/**
* Gets the number of SILK frames per Opus frame.
*
* @param packet Opus packet.
* @returns Number of SILK frames per Opus frame.
*/
opusNumSilkFrames(packet) {
// For computing the frame length in ms, the sample rate is not important since it cancels out. We use 48 kHz, but
// any valid sample rate would work.
//
// To calculate the length of a frame (with a 48kHz sample rate) in ms:
// (samples/frame) * (1s/48000 samples) * (1000ms/s)
// = (samples/frame) * (1000ms/48000 samples)
// = (samples/frame) * (1ms/48 samples)
let frameLengthMs = this.opusPacketGetSamplesPerFrame(packet, 48000) / 48;
if (frameLengthMs < 10)
frameLengthMs = 10;
// The number of SILK frames per Opus frame is described in https://www.rfc-editor.org/rfc/rfc6716#section-4.2.2.
switch (frameLengthMs) {
case 10:
case 20:
return 1;
case 40:
return 2;
case 60:
return 3;
// It is not possible to reach the default case since an Opus packet can only encode sizes of 2.5, 5, 10, 20, 40,
// or 60 ms, so we ignore the default case for test coverage.
/* istanbul ignore next */
default:
return 0;
}
}
/**
* Gets the number of channels from an Opus packet.
*
* @param packet Opus packet.
* @returns Number of channels.
*/
opusPacketGetNumChannels(packet) {
// TOC byte format (https://www.rfc-editor.org/rfc/rfc6716#section-3.1):
// 0
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// | config |s| c |
// +-+-+-+-+-+-+-+-+
// The 's' bit indicates mono or stereo audio, with 0 indicating mono and 1 indicating stereo.
return packet.getUint8(0) & 0x4 ? 2 : 1;
}
/**
* Determine the size (in bytes) of an Opus frame.
*
* @param packet Opus packet.
* @param byteOffset Offset (from the start of the packet) to the byte containing the size information.
* @param remainingBytes Remaining number of bytes to parse from the Opus packet.
* @param sizeBytes Variable to store the parsed frame size (in bytes).
* @returns Number of bytes that were parsed to determine the frame size.
*/
opusParseSize(packet, byteOffset, remainingBytes, sizeBytes) {
// See https://www.rfc-editor.org/rfc/rfc6716#section-3.2.1 for an explanation of how frame size is represented.
// If there are no remaining bytes to parse the size from, then the size cannot be determined.
if (remainingBytes < 1) {
sizeBytes[0] = -1;
return -1;
}
// If the first byte is in the range 0...251, then this value is the size of the frame.
else if (packet.getUint8(byteOffset) < 252) {
sizeBytes[0] = packet.getUint8(byteOffset);
return 1;
}
// If the first byte is in the range 252...255, a second byte is needed. If there is no second byte, then the size
// cannot be determined.
else if (remainingBytes < 2) {
sizeBytes[0] = -1;
return -1;
}
// The total size of the frame given two size bytes is:
// (4 * secondSizeByte) + firstSizeByte
else {
sizeBytes[0] = 4 * packet.getUint8(byteOffset + 1) + packet.getUint8(byteOffset);
return 2;
}
}
/**
* Parse binary data containing an Opus packet into one or more Opus frames.
*
* @param data Binary data containing an Opus packet to be parsed. The data should begin with the first byte (i.e the
* TOC byte) of an Opus packet. Note that the size of the data does not have to equal the size of the
* contained Opus packet.
* @param lenBytes Size of the data (in bytes).
* @param selfDelimited Indicates if the Opus packet is self-delimiting
* (https://www.rfc-editor.org/rfc/rfc6716#appendix-B).
* @param tocByte Optional variable to store the TOC (table of contents) byte.
* @param frameOffsets Optional variable to store the offsets (from the start of the data) to the first bytes of each
* Opus frame.
* @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
* @param payloadOffset Optional variable to store the offset (from the start of the data) to the first byte of the
* payload.
* @param packetLenBytes Optional variable to store the length of the Opus packet (in bytes).
* @returns Number of Opus frames.
*/
opusPacketParseImpl(data, lenBytes, selfDelimited, tocByte, frameOffsets, frameSizes, payloadOffset, packetLenBytes) {
if (!frameSizes || lenBytes < 0)
return this.OPUS_BAD_ARG;
if (lenBytes === 0)
return this.OPUS_INVALID_PACKET;
// The number of Opus frames in the packet.
let numFrames;
// Intermediate storage for the number of bytes parsed to determine the size of a frame.
let numBytesParsed;
// The number of the padding bytes (excluding the padding count bytes) in the packet.
let paddingBytes = 0;
// Indicates whether CBR (constant bitrate) framing is used.
let cbr = false;
// The TOC (table of contents) byte (https://www.rfc-editor.org/rfc/rfc6716#section-3.1).
const toc = data.getUint8(0);
// Store the TOC byte.
if (tocByte)
tocByte[0] = toc;
// The remaining number of bytes to parse from the packet. Note that the TOC byte has already been parsed, hence the
// minus 1.
let remainingBytes = lenBytes - 1;
// This keeps track of where we are in the packet. This starts at 1 since the TOC byte has already been read.
let byteOffset = 1;
// The size of the last Opus frame in bytes.
let lastSizeBytes = remainingBytes;
// Read the \`c\` bits (i.e. code bits) from the TOC byte.
switch (toc & 0x3) {
// A code 0 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.2) has one frame.
case 0:
numFrames = 1;
break;
// A code 1 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.3) has two CBR (constant bitrate) frames.
case 1:
numFrames = 2;
cbr = true;
if (!selfDelimited) {
// Undelimited code 1 packets must be an even number of data bytes, otherwise the packet is invalid.
if (remainingBytes & 0x1)
return this.OPUS_INVALID_PACKET;
// The sizes of both frames are equal (i.e. half of the number of data bytes).
lastSizeBytes = remainingBytes / 2;
// If \`lastSizeBytes\` is too large, we will catch it later.
frameSizes[0][0] = lastSizeBytes;
}
break;
// A code 2 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.4) has two VBR (variable bitrate) frames.
case 2:
numFrames = 2;
numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[0]);
remainingBytes -= numBytesParsed;
// The parsed size of the first frame cannot be larger than the number of remaining bytes in the packet.
if (frameSizes[0][0] < 0 || frameSizes[0][0] > remainingBytes) {
return this.OPUS_INVALID_PACKET;
}
byteOffset += numBytesParsed;
// The size of the second frame is the remaining number of bytes after the first frame.
lastSizeBytes = remainingBytes - frameSizes[0][0];
break;
// A code 3 packet (https://www.rfc-editor.org/rfc/rfc6716#section-3.2.5) has multiple CBR/VBR frames (from 0 to
// 120 ms).
default:
// Code 3 packets must have at least 2 bytes (i.e. at least 1 byte after the TOC byte).
if (remainingBytes < 1)
return this.OPUS_INVALID_PACKET;
// Frame count byte format:
// 0
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// |v|p| M |
// +-+-+-+-+-+-+-+-+
//
// Read the frame count byte, which immediately follows the TOC byte.
const frameCountByte = data.getUint8(byteOffset++);
--remainingBytes;
// Read the 'M' bits of the frame count byte, which encode the number of frames.
numFrames = frameCountByte & 0x3f;
// The number of frames in a code 3 packet must not be 0.
if (numFrames <= 0)
return this.OPUS_INVALID_PACKET;
const samplesPerFrame = this.opusPacketGetSamplesPerFrame(data, 48000);
// A single frame can have at most 2880 samples, which happens in the case where 60ms of 48kHz audio is encoded
// per frame. A code 3 packet cannot contain more than 120ms of audio, so the total number of samples cannot
// exceed 2880 * 2 = 5760.
if (samplesPerFrame * numFrames > 5760)
return this.OPUS_INVALID_PACKET;
// Parse padding bytes if the 'p' bit is 1.
if (frameCountByte & 0x40) {
let paddingCountByte;
let numPaddingBytes;
// Remove padding bytes (including padding count bytes) from the remaining byte count.
do {
// Sanity check that there are enough bytes to parse and remove the padding.
if (remainingBytes <= 0)
return this.OPUS_INVALID_PACKET;
// Get the next padding count byte.
paddingCountByte = data.getUint8(byteOffset++);
--remainingBytes;
// If the padding count byte has a value in the range 0...254, then the total size of the padding is the
// value in the padding count byte.
//
// If the padding count byte has value 255, then the total size of the padding is 254 plus the value in the
// next padding count byte. Therefore, keep reading padding count bytes while the value is 255.
numPaddingBytes = paddingCountByte === 255 ? 254 : paddingCountByte;
remainingBytes -= numPaddingBytes;
paddingBytes += numPaddingBytes;
} while (paddingCountByte === 255);
}
// Sanity check that the remaining number of bytes is not negative after removing the padding.
if (remainingBytes < 0)
return this.OPUS_INVALID_PACKET;
// Read the 'v' bit (i.e. VBR bit).
cbr = !(frameCountByte & 0x80);
// VBR case
if (!cbr) {
lastSizeBytes = remainingBytes;
// Let M be the number of frames. There will be M - 1 frame length indicators (which can be 1 or 2 bytes)
// corresponding to the lengths of frames 0 to M - 2. The size of the last frame (i.e. frame M - 1) is the
// number of data bytes after the end of frame M - 2 and before the start of the padding bytes.
for (let i = 0; i < numFrames - 1; ++i) {
numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[i]);
remainingBytes -= numBytesParsed;
// The remaining number of data bytes must be enough to contain each frame.
if (frameSizes[i][0] < 0 || frameSizes[i][0] > remainingBytes) {
return this.OPUS_INVALID_PACKET;
}
byteOffset += numBytesParsed;
lastSizeBytes -= numBytesParsed + frameSizes[i][0];
}
// Sanity check that the size of the last frame is not negative.
if (lastSizeBytes < 0)
return this.OPUS_INVALID_PACKET;
}
// CBR case
else if (!selfDelimited) {
// The size of each frame is the number of data bytes divided by the number of frames.
lastSizeBytes = Math.trunc(remainingBytes / numFrames);
// The number of data bytes must be a non-negative integer multiple of the number of frames.
if (lastSizeBytes * numFrames !== remainingBytes)
return this.OPUS_INVALID_PACKET;
// All frames have equal size in the undelimited CBR case.
for (let i = 0; i < numFrames - 1; ++i) {
frameSizes[i][0] = lastSizeBytes;
}
}
}
// Self-delimited framing uses an extra 1 or 2 bytes, immediately preceding the data bytes, to indicate either the
// size of the last frame (for code 0, code 2, and VBR code 3 packets) or the size of all the frames (for code 1 and
// CBR code 3 packets). See https://www.rfc-editor.org/rfc/rfc6716#appendix-B.
if (selfDelimited) {
// The extra frame size byte(s) will always indicate the size of the last frame.
numBytesParsed = this.opusParseSize(data, byteOffset, remainingBytes, frameSizes[numFrames - 1]);
remainingBytes -= numBytesParsed;
// There must be enough data bytes for the last frame.
if (frameSizes[numFrames - 1][0] < 0 || frameSizes[numFrames - 1][0] > remainingBytes) {
return this.OPUS_INVALID_PACKET;
}
byteOffset += numBytesParsed;
// For CBR packets, the sizes of all the frames are equal.
if (cbr) {
// There must be enough data bytes for all the frames.
if (frameSizes[numFrames - 1][0] * numFrames > remainingBytes) {
return this.OPUS_INVALID_PACKET;
}
for (let i = 0; i < numFrames - 1; ++i) {
frameSizes[i][0] = frameSizes[numFrames - 1][0];
}
}
// At this point, \`lastSizeBytes\` contains the size of the last frame plus the size of the extra frame size
// byte(s), so sanity check that \`lastSizeBytes\` is the upper bound for the size of the last frame.
else if (!(numBytesParsed + frameSizes[numFrames - 1][0] <= lastSizeBytes)) {
return this.OPUS_INVALID_PACKET;
}
}
// Undelimited case
else {
// Because the size of the last packet is not encoded explicitly, it is possible that the size of the last packet
// (or of all the packets, for the CBR case) is larger than maximum frame size.
if (lastSizeBytes > this.OPUS_MAX_FRAME_SIZE_BYTES)
return this.OPUS_INVALID_PACKET;
frameSizes[numFrames - 1][0] = lastSizeBytes;
}
// Store the offset to the start of the payload.
if (payloadOffset)
payloadOffset[0] = byteOffset;
// Store the offsets to the start of each frame.
for (let i = 0; i < numFrames; ++i) {
if (frameOffsets)
frameOffsets[i][0] = byteOffset;
byteOffset += frameSizes[i][0];
}
// Store the length of the Opus packet.
if (packetLenBytes)
packetLenBytes[0] = byteOffset + paddingBytes;
return numFrames;
}
/**
* Parse a single undelimited Opus packet into one or more Opus frames.
*
* @param packet Opus packet to be parsed.
* @param lenBytes Size of the packet (in bytes).
* @param tocByte Optional variable to store the TOC (table of contents) byte.
* @param frameOffsets Optional variable to store the offsets (from the start of the packet) to the first bytes of
* each Opus frame.
* @param frameSizes Required variable to store the sizes (in bytes) of each Opus frame.
* @param payloadOffset Optional variable to store the offset (from the start of the packet) to the first byte of the
* payload.
* @returns Number of Opus frames.
*/
opusPacketParse(packet, lenBytes, tocByte, frameOffsets, frameSizes, payloadOffset) {
return this.opusPacketParseImpl(packet, lenBytes,
/* selfDelimited */ false, tocByte, frameOffsets, frameSizes, payloadOffset, null);
}
/**
* This function returns the SILK VAD (voice activity detection) information encoded in the Opus packet. For CELT-only
* packets that do not have VAD information, it returns -1.
*
* @param packet Opus packet.
* @param lenBytes Size of the packet (in bytes).
* @returns 0: no frame had the VAD flag set.
* 1: at least one frame had the VAD flag set.
* -1: VAD status could not be determined.
*/
opusPacketHasVoiceActivity(packet, lenBytes) {
if (!packet || lenBytes <= 0)
return 0;
// In CELT-only mode, we can not determine whether there is VAD.
if (this.opusPacketIsCeltOnly(packet))
return -1;
const numSilkFrames = this.opusNumSilkFrames(packet);
// It is not possible for \`opusNumSilkFrames()\` to return 0, so we ignore the next sanity check for test coverage.
/* istanbul ignore next */
if (numSilkFrames === 0)
return -1;
const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
opusFrameOffsets[i] = [undefined];
opusFrameSizes[i] = [undefined];
}
// Parse packet to get the Opus frames.
const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
// VAD status cannot be determined for invalid packets.
if (numOpusFrames < 0)
return -1;
// Iterate over all Opus frames, which may contain multiple SILK frames, to determine the VAD status.
for (let i = 0; i < numOpusFrames; ++i) {
if (opusFrameSizes[i][0] < 1)
continue;
// LP layer header bits format (https://www.rfc-editor.org/rfc/rfc6716#section-4.2.3):
//
// Mono case:
// +-----------------+----------+
// | 1 to 3 VAD bits | LBRR bit |
// +-----------------+----------+
//
// Stereo case:
// +---------------------+--------------+----------------------+---------------+
// | 1 to 3 mid VAD bits | mid LBRR bit | 1 to 3 side VAD bits | side LBRR bit |
// +---------------------+--------------+----------------------+---------------+
// The upper 1 to 3 bits (dependent on the number of SILK frames) of the LP layer contain VAD bits. If any of
// these VAD bits are 1, then voice activity is present.
if (packet.getUint8(opusFrameOffsets[i][0]) >> (8 - numSilkFrames))
return 1;
// In the stereo case, there is a second set of 1 to 3 VAD bits, so also check these VAD bits.
const channels = this.opusPacketGetNumChannels(packet);
if (channels === 2 &&
(packet.getUint8(opusFrameOffsets[i][0]) << (numSilkFrames + 1)) >> (8 - numSilkFrames)) {
return 1;
}
}
// No voice activity was detected.
return 0;
}
/**
* This method is based on Definition of the Opus Audio Codec
* (https://tools.ietf.org/html/rfc6716). Basically, this method is based on
* parsing the LP layer of an Opus packet, particularly the LBRR flag.
*
* @param packet Opus packet.
* @param lenBytes Size of the packet (in bytes).
* @returns true: packet has fec encoding about previous packet.
* false: no fec encoding present.
*/
opusPacketHasFec(packet, lenBytes) {
if (!packet || lenBytes <= 0)
return false;
// In CELT-only mode, packets should not have FEC.
if (this.opusPacketIsCeltOnly(packet))
return false;
const opusFrameOffsets = new Array(this.OPUS_MAX_OPUS_FRAMES);
const opusFrameSizes = new Array(this.OPUS_MAX_OPUS_FRAMES);
for (let i = 0; i < this.OPUS_MAX_OPUS_FRAMES; ++i) {
opusFrameOffsets[i] = [undefined];
opusFrameSizes[i] = [undefined];
}
// Parse packet to get the Opus frames.
const numOpusFrames = this.opusPacketParse(packet, lenBytes, null, opusFrameOffsets, opusFrameSizes, null);
if (numOpusFrames < 0)
return false;
/* istanbul ignore next */
if (opusFrameSizes[0][0] <= 1)
return false;
const numSilkFrames = this.opusNumSilkFrames(packet);
/* istanbul ignore next */
if (numSilkFrames === 0)
return false;
const channels = this.opusPacketGetNumChannels(packet);
/* istanbul ignore next */
if (channels !== 1 && channels !== 2)
return false;
// A frame starts with the LP layer. The LP layer begins with two to eight
// header bits.These consist of one VAD bit per SILK frame (up to 3),
// followed by a single flag indicating the presence of LBRR frames.
// For a stereo packet, these first flags correspond to the mid channel, and
// a second set of flags is included for the side channel. Because these are
// the first symbols decoded by the range coder and because they are coded
// as binary values with uniform probability, they can be extracted directly
// from the most significant bits of the first byte of compressed data.
for (let i = 0; i < channels; i++) {
if (packet.getUint8(opusFrameOffsets[0][0]) & (0x80 >> ((i + 1) * (numSilkFrames + 1) - 1)))
return true;
}
return false;
}
}
RedundantAudioEncoder.shouldLog = true;
RedundantAudioEncoder.shouldReportStats = true;
RedundantAudioEncoder.initializeWorker();
`},0x1158c4d3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xa9a27686));p.default=class extends _.default{constructor(){super(0)}static nextTick(o){setTimeout(o,0)}}},0xd475f02c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.intervalMs=o}start(o){this.stop(),this.timer=setInterval(o,this.intervalMs)}stop(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}running(){return void 0!==this.timer}}},0xa9a27686:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.timeoutMs=o,this.timer=null}start(o){this.stop(),this.timer=setTimeout(()=>{clearTimeout(this.timer),o()},this.timeoutMs)}stop(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}}},0x1a20e50ff:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x14f38fc30)),w=m(f(0xed7d9b54)),I=m(f(0x178bce6ff)),k=class SDP{constructor(o){this.sdp=o}clone(){return new SDP(this.sdp)}static isRTPCandidate(o){let p=/candidate[:](\S+) (\d+)/g.exec(o);return null!==p&&"1"===p[2]}static linesToSDP(o){return new SDP(o.join(SDP.CRLF))}static candidateTypeFromString(o){switch(o){case _.default.Host:return _.default.Host;case _.default.ServerReflexive:return _.default.ServerReflexive;case _.default.PeerReflexive:return _.default.PeerReflexive;case _.default.Relay:return _.default.Relay}return null}static candidateType(o){let p=/a[=]candidate[:].* typ ([a-z]+) /g.exec(o);return null===p?null:SDP.candidateTypeFromString(p[1])}static mediaType(o){let p=/m=(audio|video)/g.exec(o);if(null!==p)return p[1]}static mid(o){if(o.includes("a=mid:"))return o.replace(/^(a=mid:)/,"")}static direction(o){let p=/a=(sendrecv|sendonly|recvonly|inactive)/g.exec(o);if(null!==p)return p[1]}static splitLines(o){return o.trim().split(`
`).map(o=>o.trim())}static splitSections(o){return o.split(`
m=`).map((o,p)=>(p>0?"m="+o:o).trim()+SDP.CRLF)}static findActiveCameraSection(o){let p=0,f=!1;for(let m of o){if(/^m=video/.test(m)&&(m.indexOf("sendrecv")>-1||-1===m.indexOf("sendonly")&&-1===m.indexOf("recvonly")&&-1===m.indexOf("inactive"))){f=!0;break}p++}return!1===f&&(p=-1),p}static extractSSRCsFromFIDGroupLine(o){return/^a=ssrc-group:FID\s(.+)/.exec(o)[1]}static matchPrefix(o,p){return SDP.splitLines(o).filter(o=>0===o.indexOf(p))}lines(){return this.sdp.split(SDP.CRLF)}hasVideo(){return null!==/^m=video/gm.exec(this.sdp)}hasCandidates(){return null!==/a[=]candidate[:]/g.exec(this.sdp)}hasCandidatesForAllMLines(){return!(this.sdp.indexOf("c=IN IP4 0.0.0.0")>-1)}withoutCandidateType(o){return SDP.linesToSDP(this.lines().filter(p=>SDP.candidateType(p)!==o))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(_.default.ServerReflexive)}withAudioMaxAverageBitrate(o){if(!o)return this.clone();o=Math.trunc(Math.min(Math.max(o,SDP.rfc7587LowestBitrate),SDP.rfc7587HighestBitrate));let p=this.lines(),f=SDP.findOpusFmtpAttributes(p),m=SDP.updateOpusFmtpAttributes(p,f,[`maxaveragebitrate=${o}`]);return SDP.linesToSDP(m)}withStereoAudio(){let o=this.lines(),p=SDP.findOpusFmtpAttributes(o),f=SDP.updateOpusFmtpAttributes(o,p,["stereo=1","sprop-stereo=1"]);return SDP.linesToSDP(f)}static findOpusFmtpAttributes(o){let p=/^a=rtpmap:\s*(\d+)\s+opus\/48000/,f=!1,m=[];for(let _ of o)if(_.startsWith("m=audio")&&(m.push(null),f=!0),_.startsWith("m=video")&&(f=!1),f){let o=p.exec(_);null!==o&&(m[m.length-1]=`a=fmtp:${o[1]} `)}return m}static updateOpusFmtpAttributes(o,p,f){let m=[],_=0,w=null;for(let I of o)if(I.startsWith("m=audio")&&(w=p[_],_++),I.startsWith("m=video")&&(w=null),w&&I.startsWith(w)){let o=I.slice(w.length).split(";"),p=[];for(let m of o)0>f.findIndex(o=>o.startsWith(m.split("=")[0]))&&p.push(m);for(let o of f)p.push(o);m.push(w+p.join(";"))}else m.push(I);return m}withUnifiedPlanFormat(){let o=this.sdp;return o.includes("mozilla")?this.clone():new SDP(o=o.replace("o=-","o=mozilla-chrome"))}getUniqueRtpHeaderExtensionId(o){let p=[];for(let f of o)if(/^a=extmap:/.test(f.trim())){let o=+f.split("a=extmap:")[1].split(" ")[0];p.includes(o)||p.push(o)}p.sort((o,p)=>o-p);let f=0;for(let o of p){if(o-f>1)return f+1;f=o}return 14===f?-1:f+1}withVideoLayersAllocationRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.videoLayersAllocationRtpHeaderExtensionUrl)}withDependencyDescriptorRtpHeaderExtension(o){return this.withRtpHeaderExtension(o,SDP.dependencyDescriptorRtpHeaderExtensionUrl)}withoutDependencyDescriptorRtpHeaderExtension(){let o=SDP.splitLines(this.sdp).filter(o=>!o.includes(SDP.dependencyDescriptorRtpHeaderExtensionUrl));return new SDP(o.join(SDP.CRLF)+SDP.CRLF)}withRtpHeaderExtension(o,p){let f=o?o.getRtpHeaderExtensionId(p):-1,m=-1===f?this.getUniqueRtpHeaderExtensionId(SDP.splitLines(this.sdp)):f,_=SDP.splitSections(this.sdp),w=[];for(let o of _){if(/^m=video/.test(o)&&-1===SDP.getRtpHeaderExtensionIdInSection(o,p)){let f=SDP.splitLines(o),_=[];if(-1===m||this.hasRtpHeaderExtensionId(m)){w.push(o);continue}for(let o of f)if(_.push(o),/^a=sendrecv/.test(o.trim())){let o="a=extmap:"+m+" "+p;_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}else if(-1!==f&&/^m=video/.test(o)&&SDP.getRtpHeaderExtensionIdInSection(o,p)!==f){let m=SDP.splitLines(o),_=[];for(let o of m){if(/^a=extmap:/.test(o.trim())&&o.split("a=extmap:")[1].split(" ")[1]===p){if(!this.hasRtpHeaderExtensionId(f)){let o="a=extmap:"+f+" "+p;_.push(o)}continue}_.push(o)}o=_.join(SDP.CRLF)+SDP.CRLF}w.push(o)}return new SDP(w.join(""))}ssrcForVideoSendingSection(){let o=this.sdp,p=SDP.splitSections(o);if(p.length<2)return"";let f=SDP.findActiveCameraSection(p);if(-1===f)return"";let m=SDP.matchPrefix(p[f],"a=ssrc-group:FID ");if(m.length<1)return"";let[_]=SDP.extractSSRCsFromFIDGroupLine(m[0]).split(" ").map(o=>parseInt(o,10));return _.toString()}videoSendSectionHasDifferentSSRC(o){let p=this.ssrcForVideoSendingSection(),f=o.ssrcForVideoSendingSection();return""!==p&&""!==f&&parseInt(p,10)!==parseInt(f,10)}removeH264SupportFromSendSection(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return new SDP(this.sdp);let m=p[f],_=SDP.splitLines(m),w=[],I=new Map;_.forEach(o=>{if(/^a=rtpmap:/.test(o)){let p=/^a=rtpmap:([0-9]+)\s/.exec(o);p&&o.toLowerCase().includes("h264")&&w.push(parseInt(p[1],10))}if(/^a=fmtp:/.test(o)){let p=/^a=fmtp:([0-9]+) apt=([0-9]+)/.exec(o);if(p&&3===p.length){let o=parseInt(p[1],10),f=parseInt(p[2],10);I.has(f)?I.get(f).push(o):I.set(f,[o])}}});let k=new Set;for(let o of w){k.add(o);let p=I.get(o);if(p)for(let o of p)k.add(o)}if(w.length>0){let o=_[0].split(" ");_[0]=o.filter(o=>!k.has(parseInt(o))).join(" ")}let M=_.filter(o=>{if(!o.includes("rtpmap")&&!o.includes("rtcp-fb")&&!o.includes("fmtp"))return!0;for(let p of k)if(o.includes(p.toString()))return!1;return!0});return p[f]=M.join(SDP.CRLF)+SDP.CRLF,new SDP(p.join(""))}mediaSections(){let o=SDP.splitSections(this.sdp);if(o.length<2)return[];let p=[];for(let f=1;f{if(!o.startsWith("a=rtpmap:"))return;let _=/^a=rtpmap:(\d+)\s/.exec(o);if(!_)return;let w=_[1];for(let _ of p){if(!o.includes(`${_.codecName}/${_.codecCapability.clockRate}`))continue;let p=!1;if(void 0!==_.codecCapability.sdpFmtpLine){let o=!1;for(let f of m){if(_.fmtpLineMatches(f,parseInt(w))){p=!0;break}o||(o=f.startsWith(`a=fmtp:${w} profile-id=`))}_.equals(I.default.vp9Profile0())&&!o&&(p=!0)}else p=!0;if(p){f.set(w,_);break}}});let _=new Set(f.keys()),w=m[0].split(" ").filter(o=>!_.has(o)),k=Array.from(f.entries()).sort(([o,f],[m,_])=>p.indexOf(f)-p.indexOf(_)).map(([o,p])=>o);return w.splice(3,0,...k),m[0]=w.join(" "),m.join(SDP.CRLF)+SDP.CRLF}highestPriorityVideoSendCodec(){let o=this.prioritizedSendVideoCodecCapabilities();return o.length>0?o[0]:void 0}prioritizedSendVideoCodecCapabilities(){let o=this.sdp,p=SDP.splitSections(o),f=SDP.findActiveCameraSection(p);if(-1===f)return[];let m=SDP.splitLines(p[f]),_=m[0].split(" ");return _.length<4?[]:_.slice(3).map(o=>this.videoCodecCapabilityForPayloadType(m,o)).filter(o=>void 0!==o&&["VP8","H264","VP9","AV1"].includes(o.codecName))}videoCodecCapabilityForPayloadType(o,p){let f,m,_;for(let w of o){let o=/^a=rtpmap:([0-9]+)\s/.exec(w);if(o&&o[1]===p){let o=w.split(" ")[1].split("/");o.length>=2&&(f=o[0],m=o[1])}w.startsWith(`a=fmtp:${p} `)&&(_=w.split(" ")[1])}if(void 0!==f)return new I.default(f,{clockRate:parseInt(m),mimeType:`video/${f}`,sdpFmtpLine:_})}getAudioPayloadTypes(){let o=new Map,p=this.sdp,f=SDP.splitSections(p);return o.set("opus",SDP.findAudioPayloadType("opus",f)),o.set("red",SDP.findAudioPayloadType("red",f)),o}static findAudioPayloadType(o,p){let f=RegExp(`a=rtpmap:\\s*(\\d+)\\s+${o}\\/48000`);for(let o of p)if(/^m=audio/.test(o)){let p=f.exec(o);if(null!==p)return Number(p[1])}return 0}withStartingVideoSendBitrate(o){let p=SDP.splitSections(this.sdp);for(let f=0;fo.match(/^a=rtpmap:\d+/));-1!==p&&w.splice(p+1,0,`a=fmtp:${m} x-google-start-bitrate=${o}`)}p[f]=w.join(SDP.CRLF)+SDP.CRLF}return new SDP(p.join(""))}};p.default=k,k.CRLF=`\r
`,k.rfc7587LowestBitrate=6e3,k.rfc7587HighestBitrate=51e4,k.dependencyDescriptorRtpHeaderExtensionUrl="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension",k.videoLayersAllocationRtpHeaderExtensionUrl="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"},0x14f38fc30:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SDPCandidateType=void 0,(m=f=p.SDPCandidateType||(p.SDPCandidateType={})).Host="host",m.ServerReflexive="srflx",m.PeerReflexive="prflx",m.Relay="relay",p.default=f},0xed7d9b54:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x178bce6ff:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x252035ee7);p.default=class VideoCodecCapability{constructor(o,p){this.codecName=o,this.codecCapability=p}equals(o){return void 0!==o&&this.codecName===o.codecName&&this.codecCapability.mimeType===o.codecCapability.mimeType&&this.codecCapability.clockRate===o.codecCapability.clockRate&&(this.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(this.codecCapability.sdpFmtpLine,this.codecName):"")===(o.codecCapability.sdpFmtpLine?this.cleanupFmtpLine(o.codecCapability.sdpFmtpLine,o.codecName):"")}fmtpLineMatches(o,p){let f=this.codecCapability.sdpFmtpLine;if(!f)return!1;let m=`a=fmtp:${p} `;if(!o.startsWith(m))return!1;let _=o.substring(m.length);return this.cleanupFmtpLine(_,this.codecName)===this.cleanupFmtpLine(f,this.codecName)}cleanupFmtpLine(o,p){let f=o.replace(/;x-google-start-bitrate=\d+/g,"");return"H264"===p&&(f=f.replace(/profile-level-id=([0-9a-f]{4})[0-9a-f]{2}/i,"profile-level-id=$1")),f}static vp8(){return new VideoCodecCapability("VP8",{clockRate:9e4,mimeType:"video/VP8"})}static h264BaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"})}static h264ConstrainedBaselineProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"})}static h264MainProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f"})}static h264HighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f"})}static h264ConstrainedHighProfile(){return new VideoCodecCapability("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f"})}static h264(){return VideoCodecCapability.h264ConstrainedBaselineProfile()}static vp9Profile0(){return new VideoCodecCapability("VP9",{clockRate:9e4,mimeType:"video/VP9",sdpFmtpLine:"profile-id=0"})}static vp9(){return VideoCodecCapability.vp9Profile0()}static av1Main(){return new VideoCodecCapability("AV1",{clockRate:9e4,mimeType:"video/AV1"})}static av1(){return VideoCodecCapability.av1Main()}static fromSignaled(o){switch(o){case m.SdkVideoCodecCapability.VP8:return VideoCodecCapability.vp8();case m.SdkVideoCodecCapability.H264_BASELINE_PROFILE:return VideoCodecCapability.h264BaselineProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return VideoCodecCapability.h264ConstrainedBaselineProfile();case m.SdkVideoCodecCapability.H264_MAIN_PROFILE:return VideoCodecCapability.h264MainProfile();case m.SdkVideoCodecCapability.H264_HIGH_PROFILE:return VideoCodecCapability.h264HighProfile();case m.SdkVideoCodecCapability.H264_CONSTRAINED_HIGH_PROFILE:return VideoCodecCapability.h264ConstrainedHighProfile();case m.SdkVideoCodecCapability.VP9_PROFILE_0:return VideoCodecCapability.vp9Profile0();case m.SdkVideoCodecCapability.AV1_MAIN_PROFILE:return VideoCodecCapability.av1Main();default:return}}}},0x1728c2fdd:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x10e0ee2b6),_=class ZLIBTextCompressor{constructor(o){this.logger=o}compress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={memLevel:ZLIBTextCompressor.Z_MEM_LEVEL,dictionary:p};return m.deflateRaw(o,f)}decompress(o,p){if(p.length>0){let o=Math.min(p.length,ZLIBTextCompressor.MAX_DICTIONARY_SIZE);p=p.slice(0,o)}let f={to:"string",dictionary:p,chunkSize:4096},_="";try{_=m.inflateRaw(o,f)}catch(o){this.logger.error(`failed to decompress the string with error: [${o}]`)}return _}};p.default=_,_.Z_MEM_LEVEL=9,_.MAX_DICTIONARY_SIZE=31744},0x1f3b38cfe:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x247795129),_=f(0x17ecda005),w=f(0x1ac272bbc),I=f(0x15a2e95ed);p.default=class{constructor(o){this.logger=o,this.currentState=w.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(o,p){let f=this.currentState;if(f===w.SessionStateControllerState.NotConnected&&o===m.SessionStateControllerAction.Connect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connecting&&o===m.SessionStateControllerAction.FinishConnecting)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Disconnect)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Reconnect)this.transition(w.SessionStateControllerState.Connecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Connected&&o===m.SessionStateControllerAction.Update)this.transition(w.SessionStateControllerState.Updating,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.Fail)this.transition(w.SessionStateControllerState.Disconnecting,o);else if(f===w.SessionStateControllerState.Updating&&o===m.SessionStateControllerAction.FinishUpdating)this.transition(w.SessionStateControllerState.Connected,o);else if(f===w.SessionStateControllerState.Disconnecting&&o===m.SessionStateControllerAction.FinishDisconnecting)this.transition(w.SessionStateControllerState.NotConnected,o);else if(this.canDefer(o))return this.logger.info(`deferring transition from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),this.deferAction(o,p),I.SessionStateControllerTransitionResult.DeferredTransition;else return this.logger.warn(`no transition found from ${w.SessionStateControllerState[this.currentState]} with ${m.SessionStateControllerAction[o]}`),I.SessionStateControllerTransitionResult.NoTransitionAvailable;try{p()}catch(p){return this.logger.error(`error during state ${w.SessionStateControllerState[this.currentState]} with action ${m.SessionStateControllerAction[o]}: ${p}`),this.logger.info(`rolling back transition to ${w.SessionStateControllerState[f]}`),this.currentState=f,I.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),I.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(o,p){this.logger.info(`transitioning from ${w.SessionStateControllerState[this.currentState]} to ${w.SessionStateControllerState[o]} with ${m.SessionStateControllerAction[p]}`),this.currentState=o}deferPriority(o){switch(o){case m.SessionStateControllerAction.Disconnect:return _.SessionStateControllerDeferPriority.VeryHigh;case m.SessionStateControllerAction.Fail:return _.SessionStateControllerDeferPriority.High;case m.SessionStateControllerAction.Reconnect:return _.SessionStateControllerDeferPriority.Medium;case m.SessionStateControllerAction.Update:return _.SessionStateControllerDeferPriority.Low;default:return _.SessionStateControllerDeferPriority.DoNotDefer}}deferAction(o,p){null!==this.deferredAction&&this.deferPriority(this.deferredAction)>this.deferPriority(o)||(this.deferredAction=o,this.deferredWork=p)}canDefer(o){return this.deferPriority(o)!==_.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===w.SessionStateControllerState.Connecting||this.currentState===w.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;let o=this.deferredAction,p=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${m.SessionStateControllerAction[o]}`),this.perform(o,p)!==I.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${m.SessionStateControllerAction[o]} in state ${w.SessionStateControllerState[this.currentState]}`)}}},0x247795129:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerAction=void 0,(m=f=p.SessionStateControllerAction||(p.SessionStateControllerAction={}))[m.Connect=0]="Connect",m[m.FinishConnecting=1]="FinishConnecting",m[m.Update=2]="Update",m[m.FinishUpdating=3]="FinishUpdating",m[m.Reconnect=4]="Reconnect",m[m.Disconnect=5]="Disconnect",m[m.Fail=6]="Fail",m[m.FinishDisconnecting=7]="FinishDisconnecting",p.default=f},0x17ecda005:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerDeferPriority=void 0,(m=f=p.SessionStateControllerDeferPriority||(p.SessionStateControllerDeferPriority={}))[m.DoNotDefer=0]="DoNotDefer",m[m.Low=1]="Low",m[m.Medium=2]="Medium",m[m.High=3]="High",m[m.VeryHigh=4]="VeryHigh",p.default=f},0x1ac272bbc:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerState=void 0,(m=f=p.SessionStateControllerState||(p.SessionStateControllerState={}))[m.NotConnected=0]="NotConnected",m[m.Connecting=1]="Connecting",m[m.Connected=2]="Connected",m[m.Updating=3]="Updating",m[m.Disconnecting=4]="Disconnecting",p.default=f},0x15a2e95ed:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SessionStateControllerTransitionResult=void 0,(m=f=p.SessionStateControllerTransitionResult||(p.SessionStateControllerTransitionResult={}))[m.Transitioned=0]="Transitioned",m[m.NoTransitionAvailable=1]="NoTransitionAvailable",m[m.DeferredTransition=2]="DeferredTransition",m[m.TransitionFailed=3]="TransitionFailed",p.default=f},0x1bd55d3c4:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0xa9a27686)),I=f(0x252035ee7),k=f(0xb79a45b7),M=m(f(0x22a0f7c69)),x=m(f(0x5b9f0577)),O=m(f(0x1a3216942)),L=f(0xf8b13aac),B=m(f(0x1e2f95c25)),U=m(f(0x216f98b8d)),$=class DefaultSignalingClient{constructor(o,p){this.webSocket=o,this.logger=p,this.closeEventHandler=o=>{this.resetConnection(),this.sendEvent(new B.default(this,U.default.WebSocketClosed,null,o.code,o.reason,o.wasClean)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug(()=>"signaling client init"),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(o){this.logger.debug(()=>"registering signaling client observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.debug(()=>"removing signaling client observer"),this.observerQueue.delete(o)}openConnection(o){this.logger.info("adding connection request to queue: "+o.url()),this.connectionRequestQueue.push(o),this.closeConnection()}pingPong(o){this.logger.debug(()=>"sending ping");let p=I.SdkSignalFrame.create();return p.type=I.SdkSignalFrame.Type.PING_PONG,p.pingPong=o,this.sendMessage(p),p.timestampMs}join(o){this.logger.info("sending join");let p=I.SdkJoinFrame.create();p.protocolVersion=2,p.flags=I.SdkJoinFlags.HAS_STREAM_UPDATE;let f=new _.default,m={platformName:f.name(),platformVersion:f.version(),clientSource:M.default.sdkName,chimeSdkVersion:M.default.sdkVersion,clientUtcOffset:k.getFormattedOffset(new Date().getTimezoneOffset())};if(o.applicationMetadata){let{appName:p,appVersion:f}=o.applicationMetadata;m.appName=p,m.appVersion=f}p.clientDetails=I.SdkClientDetails.create(m),p.audioSessionId=this.audioSessionId,p.wantsCompressedSdp=DefaultSignalingClient.CLIENT_SUPPORTS_COMPRESSION,p.disablePeriodicKeyframeRequestOnContentSender=o.disablePeriodicKeyframeRequestOnContentSender,p.serverSideNetworkAdaption=L.convertServerSideNetworkAdaptionEnumToSignaled(o.serverSideNetworkAdaption),p.supportedServerSideNetworkAdaptions=o.supportedServerSideNetworkAdaptions.map(L.convertServerSideNetworkAdaptionEnumToSignaled),p.wantsAllTemporalLayersInIndex=o.wantsAllTemporalLayersInIndex;let w=I.SdkSignalFrame.create();w.type=I.SdkSignalFrame.Type.JOIN,w.join=p,this.sendMessage(w)}subscribe(o){let p=I.SdkSubscribeFrame.create();if(p.sendStreams=[],p.sdpOffer=o.sdpOffer,o.connectionTypeHasVideo&&(p.receiveStreamIds=o.receiveStreamIds),o.audioHost&&(p.audioCheckin=o.audioCheckin,p.audioHost=o.audioHost,p.audioMuted=o.audioMuted,!o.audioCheckin)){let f=I.SdkStreamDescriptor.create();f.mediaType=I.SdkStreamMediaType.AUDIO,f.trackLabel="AmazonChimeExpressAudio",f.attendeeId=o.attendeeId,f.streamId=1,f.groupId=1,f.framerate=15,f.maxBitrateKbps=600,f.avgBitrateBps=4e5,p.sendStreams.push(f)}if(p.compressedSdpOffer=o.compressedSdpOffer,p.duplex=I.SdkStreamServiceType.RX,o.localVideoEnabled){p.duplex=I.SdkStreamServiceType.DUPLEX;for(let f=0;f0&&(p.videoSubscriptionConfiguration=o.videoSubscriptionConfiguration.map(this.convertSignalingClientVideoSubscriptionConfiguration));let f=I.SdkSignalFrame.create();f.type=I.SdkSignalFrame.Type.SUBSCRIBE,f.sub=p,this.sendMessage(f)}remoteVideoUpdate(o,p){let f=I.SdkRemoteVideoUpdateFrame.create();f.addedOrUpdatedVideoSubscriptions=o.map(this.convertSignalingClientVideoSubscriptionConfiguration),f.removedVideoSubscriptionMids=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,m.remoteVideoUpdate=f,this.sendMessage(m)}convertSignalingClientVideoSubscriptionConfiguration(o){let p=new I.SdkVideoSubscriptionConfiguration;switch(p.mid=o.mid,p.attendeeId=o.attendeeId,p.streamId=o.streamId,p.groupId=o.groupId,p.priority=o.priority,p.targetBitrateKbps=o.targetBitrateKbps,o.qualityAdaptationPreference){case x.default.Balanced:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED;break;case x.default.MaintainFramerate:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_FRAMERATE;break;case x.default.MaintainResolution:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.MAINTAIN_RESOLUTION;break;default:p.qualityAdaptationPreference=I.SdkVideoQualityAdaptationPreference.BALANCED}return p}leave(){let o=I.SdkSignalFrame.create();o.type=I.SdkSignalFrame.Type.LEAVE,o.leave=I.SdkLeaveFrame.create(),this.sendMessage(o),this.logger.debug(()=>"sent leave")}sendClientMetrics(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.CLIENT_METRIC,p.clientMetric=o,this.sendMessage(p)}sendDataMessage(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.DATA_MESSAGE,p.dataMessage=o,this.sendMessage(p)}closeConnection(){var o,p;if(this.webSocket.readyState()!==O.default.None&&this.webSocket.readyState()!==O.default.Closed){this.isClosing=!0,this.sendEvent(new B.default(this,U.default.WebSocketClosing,null));let f=new w.default(DefaultSignalingClient.CLOSE_EVENT_TIMEOUT_MS),handler=o=>{var p,m;null==(m=(p=this.webSocket).removeEventListener)||m.call(p,"close",handler),f.stop(),this.closeEventHandler(o)};null==(p=(o=this.webSocket).removeEventListener)||p.call(o,"close",this.closeEventHandler),this.webSocket.addEventListener("close",handler),f.start(()=>{handler(new CloseEvent("close",{wasClean:!1,code:1005,reason:"",bubbles:!1}))}),this.webSocket.close()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===O.default.Open&&!this.isClosing&&this.wasOpened}mute(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.AUDIO_CONTROL;let f=I.SdkAudioControlFrame.create();f.muted=o,p.audioControl=f,this.sendMessage(p)}pause(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PAUSE,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resume(o){let p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.RESUME,p.pause=I.SdkPauseResumeFrame.create(),p.pause.streamIds=o,this.sendMessage(p)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(o){o.timestampMs=Date.now(),this.logger.debug(()=>`sending: ${JSON.stringify(o)}`);let p=this.prependWithFrameTypeRTC(I.SdkSignalFrame.encode(o).finish());if(this.ready()){if(!this.webSocket.send(p))return void this.sendEvent(new B.default(this,U.default.WebSocketSendMessageFailure,null));this.sendEvent(new B.default(this,U.default.WebSocketSentMessage,null))}else this.sendEvent(new B.default(this,U.default.WebSocketSkippedMessage,null))}receiveMessage(o){let p;try{p=I.SdkSignalFrame.decode(o)}catch(p){this.logger.info(`failed to decode: ${o}`),this.sendEvent(new B.default(this,U.default.ProtocolDecodeFailure,null));return}this.logger.debug(()=>`received: ${JSON.stringify(p)}`),this.webSocket.readyState()===O.default.Open?this.sendEvent(new B.default(this,U.default.ReceivedSignalFrame,p)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(p)}`)}stripFrameTypeRTC(o){let p=o[0];return p!==DefaultSignalingClient.FRAME_TYPE_RTC&&2!==p&&this.logger.warn(`expected FrameTypeRTC for message but got ${p}`),o.slice(1)}prependWithFrameTypeRTC(o){let p=new Uint8Array(o.length+1);return p[0]=DefaultSignalingClient.FRAME_TYPE_RTC,p.set(o,1),p}serviceConnectionRequestQueue(){if(0===this.connectionRequestQueue.length)return void this.logger.info("no connection requests to service");let o=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${o.url()}`),this.isClosing=!1,this.webSocket.create(o.url(),o.protocols()),this.setUpEventListeners(),this.sendEvent(new B.default(this,U.default.WebSocketConnecting,null))}sendEvent(o){switch(o.type){case U.default.WebSocketMessage:case U.default.ReceivedSignalFrame:case U.default.WebSocketSentMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}`);break;case U.default.WebSocketSkippedMessage:this.logger.debug(()=>`notifying event: ${U.default[o.type]}, websocket state=${O.default[this.webSocket.readyState()]}`);break;case U.default.WebSocketClosed:this.logger.info(`Notifying event: ${U.default[o.type]},
code: ${o.closeCode} reason: "${o.closeReason}" wasClean ${o.wasClean}`);break;default:this.logger.info(`notifying event: ${U.default[o.type]}`)}for(let p of this.observerQueue)p.handleSignalingClientEvent(o)}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.wasOpened=!0,this.sendEvent(new B.default(this,U.default.WebSocketOpen,null))}),this.webSocket.addEventListener("message",o=>{this.sendEvent(new B.default(this,U.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(o.data)))}),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",()=>{this.isClosing&&!this.wasOpened?this.logger.info("Signaling WebSocket ignoring error closing while connecting"):this.wasOpened?(this.logger.error("Signaling WebSocket received error while connected"),this.sendEvent(new B.default(this,U.default.WebSocketError,null))):(this.logger.error("Signaling WebSocket received error while connecting"),this.sendEvent(new B.default(this,U.default.WebSocketFailed,null)))})}generateNewAudioSessionId(){let o=new Uint32Array(1);return k.getRandomValues(o),o[0]}promoteToPrimaryMeeting(o){let p=I.SdkMeetingSessionCredentials.create();p.attendeeId=o.attendeeId,p.externalUserId=o.externalUserId,p.joinToken=o.joinToken;let f=I.SdkPrimaryMeetingJoinFrame.create();f.credentials=p;let m=I.SdkSignalFrame.create();m.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,m.primaryMeetingJoin=f,this.sendMessage(m)}demoteFromPrimaryMeeting(){let o=I.SdkPrimaryMeetingLeaveFrame.create(),p=I.SdkSignalFrame.create();p.type=I.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,p.primaryMeetingLeave=o,this.sendMessage(p)}};p.default=$,$.FRAME_TYPE_RTC=5,$.CLOSE_EVENT_TIMEOUT_MS=2e3,$.CLIENT_SUPPORTS_COMPRESSION=!0},0xf8b13aac:(o,p,f)=>{"use strict";var m,_;Object.defineProperty(p,"__esModule",{value:!0}),p.convertServerSideNetworkAdaptionEnumToSignaled=p.convertServerSideNetworkAdaptionEnumFromSignaled=p.serverSideNetworkAdaptionIsNoneOrDefault=p.ServerSideNetworkAdaption=void 0;let w=f(0x252035ee7);(_=m=p.ServerSideNetworkAdaption||(p.ServerSideNetworkAdaption={}))[_.Default=0]="Default",_[_.None=1]="None",_[_.BandwidthProbing=2]="BandwidthProbing",_[_.BandwidthProbingAndRemoteVideoQualityAdaption=3]="BandwidthProbingAndRemoteVideoQualityAdaption",p.default=m,p.serverSideNetworkAdaptionIsNoneOrDefault=function(o){return o===m.None||o===m.Default},p.convertServerSideNetworkAdaptionEnumFromSignaled=function(o){switch(o){case w.SdkServerSideNetworkAdaption.DEFAULT:return m.Default;case w.SdkServerSideNetworkAdaption.NONE:return m.None;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return m.BandwidthProbing;case w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION:return m.BandwidthProbingAndRemoteVideoQualityAdaption}},p.convertServerSideNetworkAdaptionEnumToSignaled=function(o){switch(o){case m.Default:return w.SdkServerSideNetworkAdaption.DEFAULT;case m.None:return w.SdkServerSideNetworkAdaption.NONE;case m.BandwidthProbing:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING;case m.BandwidthProbingAndRemoteVideoQualityAdaption:return w.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION}}},0x296cfbc0:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){this.signalingURL=o,this.joinToken=p}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}}},0x1e2f95c25:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x216f98b8d));p.default=class{constructor(o,p,f,m,_,w){this.client=o,this.type=p,this.message=f,this.closeCode=m,this.closeReason=_,this.wasClean=w,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case _.default.WebSocketFailed:case _.default.WebSocketError:case _.default.WebSocketClosing:case _.default.WebSocketClosed:return!0;default:return!1}}}},0x216f98b8d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SignalingClientEventType=void 0,(m=f=p.SignalingClientEventType||(p.SignalingClientEventType={}))[m.WebSocketConnecting=0]="WebSocketConnecting",m[m.WebSocketOpen=1]="WebSocketOpen",m[m.WebSocketError=2]="WebSocketError",m[m.WebSocketClosing=3]="WebSocketClosing",m[m.WebSocketClosed=4]="WebSocketClosed",m[m.WebSocketFailed=5]="WebSocketFailed",m[m.WebSocketMessage=6]="WebSocketMessage",m[m.WebSocketSendMessageFailure=7]="WebSocketSendMessageFailure",m[m.WebSocketSentMessage=8]="WebSocketSentMessage",m[m.ProtocolDecodeFailure=9]="ProtocolDecodeFailure",m[m.ReceivedSignalFrame=10]="ReceivedSignalFrame",m[m.WebSocketSkippedMessage=11]="WebSocketSkippedMessage",p.default=f},0x1b32ed0f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf8b13aac));p.default=class{constructor(o){this.applicationMetadata=o,this.serverSideNetworkAdaption=_.default.Default,this.supportedServerSideNetworkAdaptions=[],this.wantsAllTemporalLayersInIndex=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1}}},0x49608f19:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w,I,k,M,x){this.attendeeId=o,this.sdpOffer=p,this.audioHost=f,this.audioMuted=m,this.audioCheckin=_,this.receiveStreamIds=w,this.localVideoEnabled=I,this.videoStreamDescriptions=k,this.connectionTypeHasVideo=M,this.compressedSdpOffer=x,this.videoSubscriptionConfiguration=[]}}},0x1217c7f3f:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{equals(o){return void 0!==o&&this.mid===o.mid&&this.attendeeId===o.attendeeId&&this.streamId===o.streamId&&this.groupId===o.groupId&&this.priority===o.priority&&this.targetBitrateKbps===o.targetBitrateKbps&&this.qualityAdaptationPreference===o.qualityAdaptationPreference}}},0x252035ee7:(o,p,f)=>{"use strict";var m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee=f(0x1204db3cc),et=ee.Reader,ei=ee.Writer,er=ee.util,en=ee.roots.default||(ee.roots.default={});en.SdkSignalFrame=function(){var o,p;function SdkSignalFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.timestampMs=o.uint64();break;case 2:m.type=o.int32();break;case 3:m.error=en.SdkErrorFrame.decode(o,o.uint32());break;case 4:m.join=en.SdkJoinFrame.decode(o,o.uint32());break;case 5:m.joinack=en.SdkJoinAckFrame.decode(o,o.uint32());break;case 6:m.sub=en.SdkSubscribeFrame.decode(o,o.uint32());break;case 7:m.suback=en.SdkSubscribeAckFrame.decode(o,o.uint32());break;case 8:m.index=en.SdkIndexFrame.decode(o,o.uint32());break;case 10:m.pause=en.SdkPauseResumeFrame.decode(o,o.uint32());break;case 11:m.leave=en.SdkLeaveFrame.decode(o,o.uint32());break;case 12:m.leaveAck=en.SdkLeaveAckFrame.decode(o,o.uint32());break;case 14:m.bitrates=en.SdkBitrateFrame.decode(o,o.uint32());break;case 17:m.audioControl=en.SdkAudioControlFrame.decode(o,o.uint32());break;case 18:m.audioMetadata=en.SdkAudioMetadataFrame.decode(o,o.uint32());break;case 19:m.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.decode(o,o.uint32());break;case 20:m.pingPong=en.SdkPingPongFrame.decode(o,o.uint32());break;case 21:m.audioStatus=en.SdkAudioStatusFrame.decode(o,o.uint32());break;case 22:m.clientMetric=en.SdkClientMetricFrame.decode(o,o.uint32());break;case 23:m.dataMessage=en.SdkDataMessageFrame.decode(o,o.uint32());break;case 25:m.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.decode(o,o.uint32());break;case 26:m.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.decode(o,o.uint32());break;case 27:m.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.decode(o,o.uint32());break;case 28:m.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.decode(o,o.uint32());break;case 35:m.notification=en.SdkNotificationFrame.decode(o,o.uint32());break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("timestampMs"))throw er.ProtocolError("missing required 'timestampMs'",{instance:m});if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});return m},SdkSignalFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSignalFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isInteger(o.timestampMs)&&!(o.timestampMs&&er.isInteger(o.timestampMs.low)&&er.isInteger(o.timestampMs.high)))return"timestampMs: integer|Long expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:case 34:}},SdkSignalFrame.fromObject=function(o){if(o instanceof en.SdkSignalFrame)return o;var p=new en.SdkSignalFrame;switch(null!=o.timestampMs&&(er.Long?(p.timestampMs=er.Long.fromValue(o.timestampMs)).unsigned=!0:"string"==typeof o.timestampMs?p.timestampMs=parseInt(o.timestampMs,10):"number"==typeof o.timestampMs?p.timestampMs=o.timestampMs:"object"==typeof o.timestampMs&&(p.timestampMs=new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0))),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"JOIN":case 1:p.type=1;break;case"JOIN_ACK":case 2:p.type=2;break;case"SUBSCRIBE":case 3:p.type=3;break;case"SUBSCRIBE_ACK":case 4:p.type=4;break;case"INDEX":case 5:p.type=5;break;case"PAUSE":case 7:p.type=7;break;case"RESUME":case 8:p.type=8;break;case"LEAVE":case 9:p.type=9;break;case"LEAVE_ACK":case 10:p.type=10;break;case"BITRATES":case 13:p.type=13;break;case"AUDIO_CONTROL":case 16:p.type=16;break;case"AUDIO_METADATA":case 17:p.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:p.type=18;break;case"PING_PONG":case 19:p.type=19;break;case"AUDIO_STATUS":case 20:p.type=20;break;case"CLIENT_METRIC":case 21:p.type=21;break;case"DATA_MESSAGE":case 22:p.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:p.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:p.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:p.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:p.type=27;break;case"NOTIFICATION":case 34:p.type=34}if(null!=o.error){if("object"!=typeof o.error)throw TypeError(".SdkSignalFrame.error: object expected");p.error=en.SdkErrorFrame.fromObject(o.error)}if(null!=o.join){if("object"!=typeof o.join)throw TypeError(".SdkSignalFrame.join: object expected");p.join=en.SdkJoinFrame.fromObject(o.join)}if(null!=o.joinack){if("object"!=typeof o.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");p.joinack=en.SdkJoinAckFrame.fromObject(o.joinack)}if(null!=o.sub){if("object"!=typeof o.sub)throw TypeError(".SdkSignalFrame.sub: object expected");p.sub=en.SdkSubscribeFrame.fromObject(o.sub)}if(null!=o.suback){if("object"!=typeof o.suback)throw TypeError(".SdkSignalFrame.suback: object expected");p.suback=en.SdkSubscribeAckFrame.fromObject(o.suback)}if(null!=o.index){if("object"!=typeof o.index)throw TypeError(".SdkSignalFrame.index: object expected");p.index=en.SdkIndexFrame.fromObject(o.index)}if(null!=o.pause){if("object"!=typeof o.pause)throw TypeError(".SdkSignalFrame.pause: object expected");p.pause=en.SdkPauseResumeFrame.fromObject(o.pause)}if(null!=o.leave){if("object"!=typeof o.leave)throw TypeError(".SdkSignalFrame.leave: object expected");p.leave=en.SdkLeaveFrame.fromObject(o.leave)}if(null!=o.leaveAck){if("object"!=typeof o.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");p.leaveAck=en.SdkLeaveAckFrame.fromObject(o.leaveAck)}if(null!=o.bitrates){if("object"!=typeof o.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");p.bitrates=en.SdkBitrateFrame.fromObject(o.bitrates)}if(null!=o.audioControl){if("object"!=typeof o.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");p.audioControl=en.SdkAudioControlFrame.fromObject(o.audioControl)}if(null!=o.audioMetadata){if("object"!=typeof o.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");p.audioMetadata=en.SdkAudioMetadataFrame.fromObject(o.audioMetadata)}if(null!=o.audioStreamIdInfo){if("object"!=typeof o.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");p.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.fromObject(o.audioStreamIdInfo)}if(null!=o.pingPong){if("object"!=typeof o.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");p.pingPong=en.SdkPingPongFrame.fromObject(o.pingPong)}if(null!=o.audioStatus){if("object"!=typeof o.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");p.audioStatus=en.SdkAudioStatusFrame.fromObject(o.audioStatus)}if(null!=o.clientMetric){if("object"!=typeof o.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");p.clientMetric=en.SdkClientMetricFrame.fromObject(o.clientMetric)}if(null!=o.dataMessage){if("object"!=typeof o.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");p.dataMessage=en.SdkDataMessageFrame.fromObject(o.dataMessage)}if(null!=o.remoteVideoUpdate){if("object"!=typeof o.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");p.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.fromObject(o.remoteVideoUpdate)}if(null!=o.primaryMeetingJoin){if("object"!=typeof o.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");p.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.fromObject(o.primaryMeetingJoin)}if(null!=o.primaryMeetingJoinAck){if("object"!=typeof o.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");p.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.fromObject(o.primaryMeetingJoinAck)}if(null!=o.primaryMeetingLeave){if("object"!=typeof o.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");p.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.fromObject(o.primaryMeetingLeave)}if(null!=o.notification){if("object"!=typeof o.notification)throw TypeError(".SdkSignalFrame.notification: object expected");p.notification=en.SdkNotificationFrame.fromObject(o.notification)}return p},SdkSignalFrame.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(er.Long){var m=new er.Long(0,0,!0);f.timestampMs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.timestampMs=p.longs===String?"0":0;f.type=p.enums===String?"JOIN":1,f.error=null,f.join=null,f.joinack=null,f.sub=null,f.suback=null,f.index=null,f.pause=null,f.leave=null,f.leaveAck=null,f.bitrates=null,f.audioControl=null,f.audioMetadata=null,f.audioStreamIdInfo=null,f.pingPong=null,f.audioStatus=null,f.clientMetric=null,f.dataMessage=null,f.remoteVideoUpdate=null,f.primaryMeetingJoin=null,f.primaryMeetingJoinAck=null,f.primaryMeetingLeave=null,f.notification=null}return null!=o.timestampMs&&o.hasOwnProperty("timestampMs")&&("number"==typeof o.timestampMs?f.timestampMs=p.longs===String?String(o.timestampMs):o.timestampMs:f.timestampMs=p.longs===String?er.Long.prototype.toString.call(o.timestampMs):p.longs===Number?new er.LongBits(o.timestampMs.low>>>0,o.timestampMs.high>>>0).toNumber(!0):o.timestampMs),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkSignalFrame.Type[o.type]?o.type:en.SdkSignalFrame.Type[o.type]:o.type),null!=o.error&&o.hasOwnProperty("error")&&(f.error=en.SdkErrorFrame.toObject(o.error,p)),null!=o.join&&o.hasOwnProperty("join")&&(f.join=en.SdkJoinFrame.toObject(o.join,p)),null!=o.joinack&&o.hasOwnProperty("joinack")&&(f.joinack=en.SdkJoinAckFrame.toObject(o.joinack,p)),null!=o.sub&&o.hasOwnProperty("sub")&&(f.sub=en.SdkSubscribeFrame.toObject(o.sub,p)),null!=o.suback&&o.hasOwnProperty("suback")&&(f.suback=en.SdkSubscribeAckFrame.toObject(o.suback,p)),null!=o.index&&o.hasOwnProperty("index")&&(f.index=en.SdkIndexFrame.toObject(o.index,p)),null!=o.pause&&o.hasOwnProperty("pause")&&(f.pause=en.SdkPauseResumeFrame.toObject(o.pause,p)),null!=o.leave&&o.hasOwnProperty("leave")&&(f.leave=en.SdkLeaveFrame.toObject(o.leave,p)),null!=o.leaveAck&&o.hasOwnProperty("leaveAck")&&(f.leaveAck=en.SdkLeaveAckFrame.toObject(o.leaveAck,p)),null!=o.bitrates&&o.hasOwnProperty("bitrates")&&(f.bitrates=en.SdkBitrateFrame.toObject(o.bitrates,p)),null!=o.audioControl&&o.hasOwnProperty("audioControl")&&(f.audioControl=en.SdkAudioControlFrame.toObject(o.audioControl,p)),null!=o.audioMetadata&&o.hasOwnProperty("audioMetadata")&&(f.audioMetadata=en.SdkAudioMetadataFrame.toObject(o.audioMetadata,p)),null!=o.audioStreamIdInfo&&o.hasOwnProperty("audioStreamIdInfo")&&(f.audioStreamIdInfo=en.SdkAudioStreamIdInfoFrame.toObject(o.audioStreamIdInfo,p)),null!=o.pingPong&&o.hasOwnProperty("pingPong")&&(f.pingPong=en.SdkPingPongFrame.toObject(o.pingPong,p)),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=en.SdkAudioStatusFrame.toObject(o.audioStatus,p)),null!=o.clientMetric&&o.hasOwnProperty("clientMetric")&&(f.clientMetric=en.SdkClientMetricFrame.toObject(o.clientMetric,p)),null!=o.dataMessage&&o.hasOwnProperty("dataMessage")&&(f.dataMessage=en.SdkDataMessageFrame.toObject(o.dataMessage,p)),null!=o.remoteVideoUpdate&&o.hasOwnProperty("remoteVideoUpdate")&&(f.remoteVideoUpdate=en.SdkRemoteVideoUpdateFrame.toObject(o.remoteVideoUpdate,p)),null!=o.primaryMeetingJoin&&o.hasOwnProperty("primaryMeetingJoin")&&(f.primaryMeetingJoin=en.SdkPrimaryMeetingJoinFrame.toObject(o.primaryMeetingJoin,p)),null!=o.primaryMeetingJoinAck&&o.hasOwnProperty("primaryMeetingJoinAck")&&(f.primaryMeetingJoinAck=en.SdkPrimaryMeetingJoinAckFrame.toObject(o.primaryMeetingJoinAck,p)),null!=o.primaryMeetingLeave&&o.hasOwnProperty("primaryMeetingLeave")&&(f.primaryMeetingLeave=en.SdkPrimaryMeetingLeaveFrame.toObject(o.primaryMeetingLeave,p)),null!=o.notification&&o.hasOwnProperty("notification")&&(f.notification=en.SdkNotificationFrame.toObject(o.notification,p)),f},SdkSignalFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkSignalFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkSignalFrame"},(p=Object.create(o={}))[o[1]="JOIN"]=1,p[o[2]="JOIN_ACK"]=2,p[o[3]="SUBSCRIBE"]=3,p[o[4]="SUBSCRIBE_ACK"]=4,p[o[5]="INDEX"]=5,p[o[7]="PAUSE"]=7,p[o[8]="RESUME"]=8,p[o[9]="LEAVE"]=9,p[o[10]="LEAVE_ACK"]=10,p[o[13]="BITRATES"]=13,p[o[16]="AUDIO_CONTROL"]=16,p[o[17]="AUDIO_METADATA"]=17,p[o[18]="AUDIO_STREAM_ID_INFO"]=18,p[o[19]="PING_PONG"]=19,p[o[20]="AUDIO_STATUS"]=20,p[o[21]="CLIENT_METRIC"]=21,p[o[22]="DATA_MESSAGE"]=22,p[o[24]="REMOTE_VIDEO_UPDATE"]=24,p[o[25]="PRIMARY_MEETING_JOIN"]=25,p[o[26]="PRIMARY_MEETING_JOIN_ACK"]=26,p[o[27]="PRIMARY_MEETING_LEAVE"]=27,p[o[34]="NOTIFICATION"]=34,SdkSignalFrame.Type=p,SdkSignalFrame}(),en.SdkErrorFrame=function(){function SdkErrorFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.status=o.uint32();break;case 2:m.description=o.string();break;default:o.skipType(7&_)}}return m},SdkErrorFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkErrorFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.status&&o.hasOwnProperty("status")&&!er.isInteger(o.status)?"status: integer expected":null!=o.description&&o.hasOwnProperty("description")&&!er.isString(o.description)?"description: string expected":null},SdkErrorFrame.fromObject=function(o){if(o instanceof en.SdkErrorFrame)return o;var p=new en.SdkErrorFrame;return null!=o.status&&(p.status=o.status>>>0),null!=o.description&&(p.description=String(o.description)),p},SdkErrorFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.status=0,f.description=""),null!=o.status&&o.hasOwnProperty("status")&&(f.status=o.status),null!=o.description&&o.hasOwnProperty("description")&&(f.description=o.description),f},SdkErrorFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkErrorFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkErrorFrame"},SdkErrorFrame}(),(_=Object.create(m={}))[m[2]="HAS_STREAM_UPDATE"]=2,_[m[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,_[m[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,en.SdkJoinFlags=_,en.SdkClientDetails=function(){function SdkClientDetails(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.appName=o.string();break;case 2:m.appVersion=o.string();break;case 3:m.deviceModel=o.string();break;case 4:m.deviceMake=o.string();break;case 5:m.platformName=o.string();break;case 6:m.platformVersion=o.string();break;case 7:m.clientSource=o.string();break;case 8:m.chimeSdkVersion=o.string();break;case 9:m.clientUtcOffset=o.string();break;default:o.skipType(7&_)}}return m},SdkClientDetails.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientDetails.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.appName&&o.hasOwnProperty("appName")&&!er.isString(o.appName)?"appName: string expected":null!=o.appVersion&&o.hasOwnProperty("appVersion")&&!er.isString(o.appVersion)?"appVersion: string expected":null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&!er.isString(o.deviceModel)?"deviceModel: string expected":null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&!er.isString(o.deviceMake)?"deviceMake: string expected":null!=o.platformName&&o.hasOwnProperty("platformName")&&!er.isString(o.platformName)?"platformName: string expected":null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&!er.isString(o.platformVersion)?"platformVersion: string expected":null!=o.clientSource&&o.hasOwnProperty("clientSource")&&!er.isString(o.clientSource)?"clientSource: string expected":null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&!er.isString(o.chimeSdkVersion)?"chimeSdkVersion: string expected":null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&!er.isString(o.clientUtcOffset)?"clientUtcOffset: string expected":null},SdkClientDetails.fromObject=function(o){if(o instanceof en.SdkClientDetails)return o;var p=new en.SdkClientDetails;return null!=o.appName&&(p.appName=String(o.appName)),null!=o.appVersion&&(p.appVersion=String(o.appVersion)),null!=o.deviceModel&&(p.deviceModel=String(o.deviceModel)),null!=o.deviceMake&&(p.deviceMake=String(o.deviceMake)),null!=o.platformName&&(p.platformName=String(o.platformName)),null!=o.platformVersion&&(p.platformVersion=String(o.platformVersion)),null!=o.clientSource&&(p.clientSource=String(o.clientSource)),null!=o.chimeSdkVersion&&(p.chimeSdkVersion=String(o.chimeSdkVersion)),null!=o.clientUtcOffset&&(p.clientUtcOffset=String(o.clientUtcOffset)),p},SdkClientDetails.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.appName="",f.appVersion="",f.deviceModel="",f.deviceMake="",f.platformName="",f.platformVersion="",f.clientSource="",f.chimeSdkVersion="",f.clientUtcOffset=""),null!=o.appName&&o.hasOwnProperty("appName")&&(f.appName=o.appName),null!=o.appVersion&&o.hasOwnProperty("appVersion")&&(f.appVersion=o.appVersion),null!=o.deviceModel&&o.hasOwnProperty("deviceModel")&&(f.deviceModel=o.deviceModel),null!=o.deviceMake&&o.hasOwnProperty("deviceMake")&&(f.deviceMake=o.deviceMake),null!=o.platformName&&o.hasOwnProperty("platformName")&&(f.platformName=o.platformName),null!=o.platformVersion&&o.hasOwnProperty("platformVersion")&&(f.platformVersion=o.platformVersion),null!=o.clientSource&&o.hasOwnProperty("clientSource")&&(f.clientSource=o.clientSource),null!=o.chimeSdkVersion&&o.hasOwnProperty("chimeSdkVersion")&&(f.chimeSdkVersion=o.chimeSdkVersion),null!=o.clientUtcOffset&&o.hasOwnProperty("clientUtcOffset")&&(f.clientUtcOffset=o.clientUtcOffset),f},SdkClientDetails.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkClientDetails.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkClientDetails"},SdkClientDetails}(),(I=Object.create(w={}))[w[1]="DEFAULT"]=1,I[w[2]="NONE"]=2,I[w[3]="BANDWIDTH_PROBING"]=3,I[w[4]="BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION"]=4,en.SdkServerSideNetworkAdaption=I,en.SdkJoinFrame=function(){function SdkJoinFrame(o){if(this.supportedServerSideNetworkAdaptions=[],o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.protocolVersion=o.uint32();break;case 2:m.maxNumOfVideos=o.uint32();break;case 3:m.flags=o.uint32();break;case 4:m.clientDetails=en.SdkClientDetails.decode(o,o.uint32());break;case 6:m.audioSessionId=o.uint64();break;case 7:m.wantsCompressedSdp=o.bool();break;case 10:m.serverSideNetworkAdaption=o.int32();break;case 11:if(m.supportedServerSideNetworkAdaptions&&m.supportedServerSideNetworkAdaptions.length||(m.supportedServerSideNetworkAdaptions=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos>>0),null!=o.maxNumOfVideos&&(p.maxNumOfVideos=o.maxNumOfVideos>>>0),null!=o.flags&&(p.flags=o.flags>>>0),null!=o.clientDetails){if("object"!=typeof o.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");p.clientDetails=en.SdkClientDetails.fromObject(o.clientDetails)}switch(null!=o.audioSessionId&&(er.Long?(p.audioSessionId=er.Long.fromValue(o.audioSessionId)).unsigned=!0:"string"==typeof o.audioSessionId?p.audioSessionId=parseInt(o.audioSessionId,10):"number"==typeof o.audioSessionId?p.audioSessionId=o.audioSessionId:"object"==typeof o.audioSessionId&&(p.audioSessionId=new er.LongBits(o.audioSessionId.low>>>0,o.audioSessionId.high>>>0).toNumber(!0))),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.serverSideNetworkAdaption){default:"number"==typeof o.serverSideNetworkAdaption&&(p.serverSideNetworkAdaption=o.serverSideNetworkAdaption);break;case"DEFAULT":case 1:p.serverSideNetworkAdaption=1;break;case"NONE":case 2:p.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.serverSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.serverSideNetworkAdaption=4}if(o.supportedServerSideNetworkAdaptions){if(!Array.isArray(o.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");p.supportedServerSideNetworkAdaptions=[];for(var f=0;f>>0,o.audioSessionId.high>>>0).toNumber(!0):o.audioSessionId),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.serverSideNetworkAdaption&&o.hasOwnProperty("serverSideNetworkAdaption")&&(f.serverSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]?o.serverSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.serverSideNetworkAdaption]:o.serverSideNetworkAdaption),o.supportedServerSideNetworkAdaptions&&o.supportedServerSideNetworkAdaptions.length){f.supportedServerSideNetworkAdaptions=[];for(var _=0;_>>3){case 1:m.turnCredentials=en.SdkTurnCredentials.decode(o,o.uint32());break;case 2:m.videoSubscriptionLimit=o.uint32();break;case 3:m.wantsCompressedSdp=o.bool();break;case 4:m.defaultServerSideNetworkAdaption=o.int32();break;default:o.skipType(7&_)}}return m},SdkJoinAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkJoinAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")){var p=en.SdkTurnCredentials.verify(o.turnCredentials);if(p)return"turnCredentials."+p}if(null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&!er.isInteger(o.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof o.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(o.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:case 4:}return null},SdkJoinAckFrame.fromObject=function(o){if(o instanceof en.SdkJoinAckFrame)return o;var p=new en.SdkJoinAckFrame;if(null!=o.turnCredentials){if("object"!=typeof o.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");p.turnCredentials=en.SdkTurnCredentials.fromObject(o.turnCredentials)}switch(null!=o.videoSubscriptionLimit&&(p.videoSubscriptionLimit=o.videoSubscriptionLimit>>>0),null!=o.wantsCompressedSdp&&(p.wantsCompressedSdp=!!o.wantsCompressedSdp),o.defaultServerSideNetworkAdaption){default:"number"==typeof o.defaultServerSideNetworkAdaption&&(p.defaultServerSideNetworkAdaption=o.defaultServerSideNetworkAdaption);break;case"DEFAULT":case 1:p.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:p.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:p.defaultServerSideNetworkAdaption=3;break;case"BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION":case 4:p.defaultServerSideNetworkAdaption=4}return p},SdkJoinAckFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.turnCredentials=null,f.videoSubscriptionLimit=0,f.wantsCompressedSdp=!1,f.defaultServerSideNetworkAdaption=p.enums===String?"DEFAULT":1),null!=o.turnCredentials&&o.hasOwnProperty("turnCredentials")&&(f.turnCredentials=en.SdkTurnCredentials.toObject(o.turnCredentials,p)),null!=o.videoSubscriptionLimit&&o.hasOwnProperty("videoSubscriptionLimit")&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),null!=o.wantsCompressedSdp&&o.hasOwnProperty("wantsCompressedSdp")&&(f.wantsCompressedSdp=o.wantsCompressedSdp),null!=o.defaultServerSideNetworkAdaption&&o.hasOwnProperty("defaultServerSideNetworkAdaption")&&(f.defaultServerSideNetworkAdaption=p.enums===String?void 0===en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]?o.defaultServerSideNetworkAdaption:en.SdkServerSideNetworkAdaption[o.defaultServerSideNetworkAdaption]:o.defaultServerSideNetworkAdaption),f},SdkJoinAckFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkJoinAckFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkJoinAckFrame"},SdkJoinAckFrame}(),en.SdkLeaveFrame=function(){function SdkLeaveFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.duplex=o.int32();break;case 2:m.sendStreams&&m.sendStreams.length||(m.sendStreams=[]),m.sendStreams.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.receiveStreamIds&&m.receiveStreamIds.length||(m.receiveStreamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos>>0}if(null!=o.sdpOffer&&(p.sdpOffer=String(o.sdpOffer)),null!=o.audioHost&&(p.audioHost=String(o.audioHost)),null!=o.audioCheckin&&(p.audioCheckin=!!o.audioCheckin),null!=o.audioMuted&&(p.audioMuted=!!o.audioMuted),null!=o.compressedSdpOffer&&("string"==typeof o.compressedSdpOffer?er.base64.decode(o.compressedSdpOffer,p.compressedSdpOffer=er.newBuffer(er.base64.length(o.compressedSdpOffer)),0):o.compressedSdpOffer.length>=0&&(p.compressedSdpOffer=o.compressedSdpOffer)),o.videoSubscriptionConfiguration){if(!Array.isArray(o.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");p.videoSubscriptionConfiguration=[];for(var f=0;f>>3){case 1:m.duplex=o.int32();break;case 2:m.allocations&&m.allocations.length||(m.allocations=[]),m.allocations.push(en.SdkStreamAllocation.decode(o,o.uint32()));break;case 3:m.sdpAnswer=o.string();break;case 4:m.tracks&&m.tracks.length||(m.tracks=[]),m.tracks.push(en.SdkTrackMapping.decode(o,o.uint32()));break;case 5:m.compressedSdpAnswer=o.bytes();break;default:o.skipType(7&_)}}return m},SdkSubscribeAckFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkSubscribeAckFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.duplex&&o.hasOwnProperty("duplex"))switch(o.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=o.allocations&&o.hasOwnProperty("allocations")){if(!Array.isArray(o.allocations))return"allocations: array expected";for(var p=0;p=0&&(p.compressedSdpAnswer=o.compressedSdpAnswer)),p},SdkSubscribeAckFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.allocations=[],f.tracks=[]),p.defaults&&(f.duplex=p.enums===String?"RX":1,f.sdpAnswer="",p.bytes===String?f.compressedSdpAnswer="":(f.compressedSdpAnswer=[],p.bytes!==Array&&(f.compressedSdpAnswer=er.newBuffer(f.compressedSdpAnswer)))),null!=o.duplex&&o.hasOwnProperty("duplex")&&(f.duplex=p.enums===String?void 0===en.SdkStreamServiceType[o.duplex]?o.duplex:en.SdkStreamServiceType[o.duplex]:o.duplex),o.allocations&&o.allocations.length){f.allocations=[];for(var m=0;m>>3){case 1:m.atCapacity=o.bool();break;case 2:m.sources&&m.sources.length||(m.sources=[]),m.sources.push(en.SdkStreamDescriptor.decode(o,o.uint32()));break;case 3:if(m.pausedAtSourceIds&&m.pausedAtSourceIds.length||(m.pausedAtSourceIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos>>0}if(null!=o.numParticipants&&(p.numParticipants=o.numParticipants>>>0),o.supportedReceiveCodecIntersection){if(!Array.isArray(o.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");p.supportedReceiveCodecIntersection=[];for(var f=0;f>>3){case 1:if(m.streamIds&&m.streamIds.length||(m.streamIds=[]),(7&_)==2)for(var w=o.uint32()+o.pos;o.pos>>0}if(o.groupIds){if(!Array.isArray(o.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");p.groupIds=[];for(var f=0;f>>0}return p},SdkPauseResumeFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.streamIds=[],f.groupIds=[]),o.streamIds&&o.streamIds.length){f.streamIds=[];for(var m=0;m>>3){case 1:m.bitrates&&m.bitrates.length||(m.bitrates=[]),m.bitrates.push(en.SdkBitrate.decode(o,o.uint32()));break;case 2:m.serverAvailableOutgoingBitrate=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.bitrates&&o.hasOwnProperty("bitrates")){if(!Array.isArray(o.bitrates))return"bitrates: array expected";for(var p=0;p>>0),p},SdkBitrateFrame.toObject=function(o,p){p||(p={});var f={};if((p.arrays||p.defaults)&&(f.bitrates=[]),p.defaults&&(f.serverAvailableOutgoingBitrate=0),o.bitrates&&o.bitrates.length){f.bitrates=[];for(var m=0;m>>3){case 1:m.streamId=o.uint32();break;case 2:m.framerate=o.uint32();break;case 3:m.maxBitrateKbps=o.uint32();break;case 4:m.trackLabel=o.string();break;case 6:m.groupId=o.uint32();break;case 7:m.avgBitrateBps=o.uint32();break;case 8:m.attendeeId=o.string();break;case 9:m.mediaType=o.int32();break;case 10:m.externalUserId=o.string();break;case 11:m.width=o.uint32();break;case 12:m.height=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamDescriptor.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDescriptor.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.framerate&&o.hasOwnProperty("framerate")&&!er.isInteger(o.framerate))return"framerate: integer expected";if(null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&!er.isInteger(o.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel))return"trackLabel: string expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.mediaType&&o.hasOwnProperty("mediaType"))switch(o.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.width&&o.hasOwnProperty("width")&&!er.isInteger(o.width)?"width: integer expected":null!=o.height&&o.hasOwnProperty("height")&&!er.isInteger(o.height)?"height: integer expected":null},SdkStreamDescriptor.fromObject=function(o){if(o instanceof en.SdkStreamDescriptor)return o;var p=new en.SdkStreamDescriptor;switch(null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.framerate&&(p.framerate=o.framerate>>>0),null!=o.maxBitrateKbps&&(p.maxBitrateKbps=o.maxBitrateKbps>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.groupId&&(p.groupId=o.groupId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),o.mediaType){default:"number"==typeof o.mediaType&&(p.mediaType=o.mediaType);break;case"AUDIO":case 1:p.mediaType=1;break;case"VIDEO":case 2:p.mediaType=2}return null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.width&&(p.width=o.width>>>0),null!=o.height&&(p.height=o.height>>>0),p},SdkStreamDescriptor.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.framerate=0,f.maxBitrateKbps=0,f.trackLabel="",f.groupId=0,f.avgBitrateBps=0,f.attendeeId="",f.mediaType=p.enums===String?"AUDIO":1,f.externalUserId="",f.width=0,f.height=0),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.framerate&&o.hasOwnProperty("framerate")&&(f.framerate=o.framerate),null!=o.maxBitrateKbps&&o.hasOwnProperty("maxBitrateKbps")&&(f.maxBitrateKbps=o.maxBitrateKbps),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.mediaType&&o.hasOwnProperty("mediaType")&&(f.mediaType=p.enums===String?void 0===en.SdkStreamMediaType[o.mediaType]?o.mediaType:en.SdkStreamMediaType[o.mediaType]:o.mediaType),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.width&&o.hasOwnProperty("width")&&(f.width=o.width),null!=o.height&&o.hasOwnProperty("height")&&(f.height=o.height),f},SdkStreamDescriptor.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDescriptor.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDescriptor"},SdkStreamDescriptor}(),en.SdkStreamAllocation=function(){function SdkStreamAllocation(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.trackLabel=o.string();break;case 2:m.streamId=o.uint32();break;case 3:m.groupId=o.uint32();break;default:o.skipType(7&_)}}return m},SdkStreamAllocation.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamAllocation.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId)?"groupId: integer expected":null},SdkStreamAllocation.fromObject=function(o){if(o instanceof en.SdkStreamAllocation)return o;var p=new en.SdkStreamAllocation;return null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),p},SdkStreamAllocation.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.trackLabel="",f.streamId=0,f.groupId=0),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),f},SdkStreamAllocation.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamAllocation.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamAllocation"},SdkStreamAllocation}(),en.SdkTrackMapping=function(){function SdkTrackMapping(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.streamId=o.uint32();break;case 2:m.ssrc=o.uint32();break;case 3:m.trackLabel=o.string();break;default:o.skipType(7&_)}}return m},SdkTrackMapping.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTrackMapping.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId)?"streamId: integer expected":null!=o.ssrc&&o.hasOwnProperty("ssrc")&&!er.isInteger(o.ssrc)?"ssrc: integer expected":null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&!er.isString(o.trackLabel)?"trackLabel: string expected":null},SdkTrackMapping.fromObject=function(o){if(o instanceof en.SdkTrackMapping)return o;var p=new en.SdkTrackMapping;return null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.ssrc&&(p.ssrc=o.ssrc>>>0),null!=o.trackLabel&&(p.trackLabel=String(o.trackLabel)),p},SdkTrackMapping.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.streamId=0,f.ssrc=0,f.trackLabel=""),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.ssrc&&o.hasOwnProperty("ssrc")&&(f.ssrc=o.ssrc),null!=o.trackLabel&&o.hasOwnProperty("trackLabel")&&(f.trackLabel=o.trackLabel),f},SdkTrackMapping.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTrackMapping.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTrackMapping"},SdkTrackMapping}(),en.SdkBitrate=function(){function SdkBitrate(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.sourceStreamId=o.uint32();break;case 2:m.avgBitrateBps=o.uint32();break;default:o.skipType(7&_)}}return m},SdkBitrate.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkBitrate.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&!er.isInteger(o.sourceStreamId)?"sourceStreamId: integer expected":null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&!er.isInteger(o.avgBitrateBps)?"avgBitrateBps: integer expected":null},SdkBitrate.fromObject=function(o){if(o instanceof en.SdkBitrate)return o;var p=new en.SdkBitrate;return null!=o.sourceStreamId&&(p.sourceStreamId=o.sourceStreamId>>>0),null!=o.avgBitrateBps&&(p.avgBitrateBps=o.avgBitrateBps>>>0),p},SdkBitrate.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.sourceStreamId=0,f.avgBitrateBps=0),null!=o.sourceStreamId&&o.hasOwnProperty("sourceStreamId")&&(f.sourceStreamId=o.sourceStreamId),null!=o.avgBitrateBps&&o.hasOwnProperty("avgBitrateBps")&&(f.avgBitrateBps=o.avgBitrateBps),f},SdkBitrate.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkBitrate.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkBitrate"},SdkBitrate}(),en.SdkAudioControlFrame=function(){function SdkAudioControlFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3==1?m.muted=o.bool():o.skipType(7&_)}return m},SdkAudioControlFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioControlFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null},SdkAudioControlFrame.fromObject=function(o){if(o instanceof en.SdkAudioControlFrame)return o;var p=new en.SdkAudioControlFrame;return null!=o.muted&&(p.muted=!!o.muted),p},SdkAudioControlFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.muted=!1),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),f},SdkAudioControlFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioControlFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioControlFrame"},SdkAudioControlFrame}(),en.SdkAudioMetadataFrame=function(){function SdkAudioMetadataFrame(o){if(this.attendeeStates=[],o)for(var p=Object.keys(o),f=0;f>>3==1?(m.attendeeStates&&m.attendeeStates.length||(m.attendeeStates=[]),m.attendeeStates.push(en.SdkAudioAttendeeState.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioMetadataFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioMetadataFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.attendeeStates&&o.hasOwnProperty("attendeeStates")){if(!Array.isArray(o.attendeeStates))return"attendeeStates: array expected";for(var p=0;p>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.volume=o.uint32();break;case 3:m.muted=o.bool();break;case 4:m.signalStrength=o.uint32();break;default:o.skipType(7&_)}}return m},SdkAudioAttendeeState.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioAttendeeState.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.volume&&o.hasOwnProperty("volume")&&!er.isInteger(o.volume)?"volume: integer expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&!er.isInteger(o.signalStrength)?"signalStrength: integer expected":null},SdkAudioAttendeeState.fromObject=function(o){if(o instanceof en.SdkAudioAttendeeState)return o;var p=new en.SdkAudioAttendeeState;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.volume&&(p.volume=o.volume>>>0),null!=o.muted&&(p.muted=!!o.muted),null!=o.signalStrength&&(p.signalStrength=o.signalStrength>>>0),p},SdkAudioAttendeeState.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.volume=0,f.muted=!1,f.signalStrength=0),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.volume&&o.hasOwnProperty("volume")&&(f.volume=o.volume),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.signalStrength&&o.hasOwnProperty("signalStrength")&&(f.signalStrength=o.signalStrength),f},SdkAudioAttendeeState.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioAttendeeState.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioAttendeeState"},SdkAudioAttendeeState}(),en.SdkAudioStreamIdInfoFrame=function(){function SdkAudioStreamIdInfoFrame(o){if(this.streams=[],o)for(var p=Object.keys(o),f=0;f>>3==1?(m.streams&&m.streams.length||(m.streams=[]),m.streams.push(en.SdkAudioStreamIdInfo.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkAudioStreamIdInfoFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfoFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streams&&o.hasOwnProperty("streams")){if(!Array.isArray(o.streams))return"streams: array expected";for(var p=0;p>>3){case 1:m.audioStreamId=o.uint32();break;case 2:m.attendeeId=o.string();break;case 3:m.muted=o.bool();break;case 4:m.externalUserId=o.string();break;case 5:m.dropped=o.bool();break;default:o.skipType(7&_)}}return m},SdkAudioStreamIdInfo.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStreamIdInfo.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&!er.isInteger(o.audioStreamId)?"audioStreamId: integer expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.muted&&o.hasOwnProperty("muted")&&"boolean"!=typeof o.muted?"muted: boolean expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.dropped&&o.hasOwnProperty("dropped")&&"boolean"!=typeof o.dropped?"dropped: boolean expected":null},SdkAudioStreamIdInfo.fromObject=function(o){if(o instanceof en.SdkAudioStreamIdInfo)return o;var p=new en.SdkAudioStreamIdInfo;return null!=o.audioStreamId&&(p.audioStreamId=o.audioStreamId>>>0),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.muted&&(p.muted=!!o.muted),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.dropped&&(p.dropped=!!o.dropped),p},SdkAudioStreamIdInfo.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStreamId=0,f.attendeeId="",f.muted=!1,f.externalUserId="",f.dropped=!1),null!=o.audioStreamId&&o.hasOwnProperty("audioStreamId")&&(f.audioStreamId=o.audioStreamId),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.muted&&o.hasOwnProperty("muted")&&(f.muted=o.muted),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.dropped&&o.hasOwnProperty("dropped")&&(f.dropped=o.dropped),f},SdkAudioStreamIdInfo.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStreamIdInfo.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStreamIdInfo"},SdkAudioStreamIdInfo}(),(B=Object.create(L={}))[L[1]="PING"]=1,B[L[2]="PONG"]=2,en.SdkPingPongType=B,en.SdkPingPongFrame=function(){function SdkPingPongFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.type=o.int32();break;case 2:m.pingId=o.uint32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("type"))throw er.ProtocolError("missing required 'type'",{instance:m});if(!m.hasOwnProperty("pingId"))throw er.ProtocolError("missing required 'pingId'",{instance:m});return m},SdkPingPongFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPingPongFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";switch(o.type){default:return"type: enum value expected";case 1:case 2:}},SdkPingPongFrame.fromObject=function(o){if(o instanceof en.SdkPingPongFrame)return o;var p=new en.SdkPingPongFrame;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PING":case 1:p.type=1;break;case"PONG":case 2:p.type=2}return null!=o.pingId&&(p.pingId=o.pingId>>>0),p},SdkPingPongFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"PING":1,f.pingId=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkPingPongType[o.type]?o.type:en.SdkPingPongType[o.type]:o.type),null!=o.pingId&&o.hasOwnProperty("pingId")&&(f.pingId=o.pingId),f},SdkPingPongFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPingPongFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPingPongFrame"},SdkPingPongFrame}(),en.SdkAudioStatusFrame=function(){function SdkAudioStatusFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3==1?m.audioStatus=o.uint32():o.skipType(7&_)}return m},SdkAudioStatusFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkAudioStatusFrame.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&!er.isInteger(o.audioStatus)?"audioStatus: integer expected":null},SdkAudioStatusFrame.fromObject=function(o){if(o instanceof en.SdkAudioStatusFrame)return o;var p=new en.SdkAudioStatusFrame;return null!=o.audioStatus&&(p.audioStatus=o.audioStatus>>>0),p},SdkAudioStatusFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.audioStatus=0),null!=o.audioStatus&&o.hasOwnProperty("audioStatus")&&(f.audioStatus=o.audioStatus),f},SdkAudioStatusFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkAudioStatusFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkAudioStatusFrame"},SdkAudioStatusFrame}(),en.SdkMetric=function(){var o,p;function SdkMetric(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.type=o.int32();break;case 2:m.value=o.double();break;default:o.skipType(7&_)}}return m},SdkMetric.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMetric.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 60:case 64:case 66:case 69:case 72:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:}return null!=o.value&&o.hasOwnProperty("value")&&"number"!=typeof o.value?"value: number expected":null},SdkMetric.fromObject=function(o){if(o instanceof en.SdkMetric)return o;var p=new en.SdkMetric;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:p.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:p.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:p.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:p.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:p.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:p.type=6;break;case"STUN_RTT_MS":case 7:p.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:p.type=8;break;case"RTC_MIC_JITTER_MS":case 9:p.type=9;break;case"RTC_MIC_PPS":case 10:p.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:p.type=11;break;case"RTC_MIC_BITRATE":case 12:p.type=12;break;case"RTC_MIC_RTT_MS":case 13:p.type=13;break;case"RTC_SPK_PPS":case 14:p.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:p.type=15;break;case"RTC_SPK_JITTER_MS":case 16:p.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:p.type=17;break;case"RTC_SPK_BITRATE":case 18:p.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:p.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:p.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:p.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:p.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:p.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:p.type=24;break;case"VIDEO_ENCODE_MS":case 25:p.type=25;break;case"VIDEO_INPUT_FPS":case 26:p.type=26;break;case"VIDEO_ENCODE_FPS":case 27:p.type=27;break;case"VIDEO_SENT_FPS":case 28:p.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:p.type=29;break;case"VIDEO_SENT_PPS":case 30:p.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:p.type=31;break;case"VIDEO_SENT_BITRATE":case 32:p.type=32;break;case"VIDEO_DROPPED_FPS":case 33:p.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:p.type=34;break;case"VIDEO_DECODE_MS":case 35:p.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:p.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:p.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:p.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:p.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:p.type=40;break;case"VIDEO_DECODE_FPS":case 41:p.type=41;break;case"VIDEO_NACKS_SENT":case 42:p.type=42;break;case"VIDEO_FIRS_SENT":case 43:p.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:p.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:p.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:p.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:p.type=47;break;case"VIDEO_PLIS_SENT":case 48:p.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:p.type=49;break;case"VIDEO_INPUT_HEIGHT":case 60:p.type=60;break;case"VIDEO_ENCODE_HEIGHT":case 64:p.type=64;break;case"VIDEO_SENT_QP_SUM":case 66:p.type=66;break;case"VIDEO_DECODE_HEIGHT":case 69:p.type=69;break;case"VIDEO_RECEIVED_QP_SUM":case 72:p.type=72;break;case"VIDEO_ENCODE_WIDTH":case 86:p.type=86;break;case"VIDEO_DECODE_WIDTH":case 87:p.type=87;break;case"VIDEO_ENCODER_IS_HARDWARE":case 88:p.type=88;break;case"VIDEO_DECODER_IS_HARDWARE":case 89:p.type=89;break;case"VIDEO_FREEZE_COUNT":case 90:p.type=90;break;case"VIDEO_FREEZE_DURATION":case 91:p.type=91;break;case"VIDEO_PAUSE_COUNT":case 92:p.type=92;break;case"VIDEO_PAUSE_DURATION":case 93:p.type=93;break;case"VIDEO_QUALITY_REASON":case 94:p.type=94;break;case"VIDEO_PROCESSING_TIME":case 95:p.type=95;break;case"RTC_SPK_AUDIO_LEVEL":case 96:p.type=96;break;case"RTC_MIC_AUDIO_LEVEL":case 97:p.type=97;break;case"RTC_SPK_TOTAL_LOST":case 98:p.type=98;break;case"RTC_SPK_TOTAL_EXPECTED":case 99:p.type=99;break;case"RTC_SPK_TOTAL_RECOVERED_RED":case 100:p.type=100;break;case"RTC_SPK_TOTAL_RECOVERED_FEC":case 101:p.type=101;break;case"VIDEO_QUALITY_LIMITATION_DURATION_CPU":case 102:p.type=102;break;case"VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU":case 103:p.type=103;break;case"VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE":case 104:p.type=104;break;case"VIDEO_RENDER_HEIGHT":case 105:p.type=105;break;case"VIDEO_RENDER_WIDTH":case 106:p.type=106;break;case"VIDEO_INPUT_WIDTH":case 107:p.type=107;break;case"VIDEO_SENT_JITTER_MS":case 108:p.type=108}return null!=o.value&&(p.value=Number(o.value)),p},SdkMetric.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,f.value=0),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkMetric.Type[o.type]?o.type:en.SdkMetric.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=p.json&&!isFinite(o.value)?String(o.value):o.value),f},SdkMetric.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMetric.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMetric"},(p=Object.create(o={}))[o[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,p[o[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,p[o[3]="VIDEO_RETRANSMIT_BITRATE"]=3,p[o[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,p[o[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,p[o[6]="VIDEO_BUCKET_DELAY_MS"]=6,p[o[7]="STUN_RTT_MS"]=7,p[o[8]="SOCKET_DISCARDED_PPS"]=8,p[o[9]="RTC_MIC_JITTER_MS"]=9,p[o[10]="RTC_MIC_PPS"]=10,p[o[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,p[o[12]="RTC_MIC_BITRATE"]=12,p[o[13]="RTC_MIC_RTT_MS"]=13,p[o[14]="RTC_SPK_PPS"]=14,p[o[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,p[o[16]="RTC_SPK_JITTER_MS"]=16,p[o[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,p[o[18]="RTC_SPK_BITRATE"]=18,p[o[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,p[o[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,p[o[21]="VIDEO_SENT_RTT_MS"]=21,p[o[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,p[o[23]="VIDEO_NACKS_RECEIVED"]=23,p[o[24]="VIDEO_PLIS_RECEIVED"]=24,p[o[25]="VIDEO_ENCODE_MS"]=25,p[o[26]="VIDEO_INPUT_FPS"]=26,p[o[27]="VIDEO_ENCODE_FPS"]=27,p[o[28]="VIDEO_SENT_FPS"]=28,p[o[29]="VIDEO_FIRS_RECEIVED"]=29,p[o[30]="VIDEO_SENT_PPS"]=30,p[o[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,p[o[32]="VIDEO_SENT_BITRATE"]=32,p[o[33]="VIDEO_DROPPED_FPS"]=33,p[o[34]="VIDEO_TARGET_DELAY_MS"]=34,p[o[35]="VIDEO_DECODE_MS"]=35,p[o[36]="VIDEO_OUTPUT_FPS"]=36,p[o[37]="VIDEO_RECEIVED_PPS"]=37,p[o[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,p[o[39]="VIDEO_RENDER_DELAY_MS"]=39,p[o[40]="VIDEO_RECEIVED_FPS"]=40,p[o[41]="VIDEO_DECODE_FPS"]=41,p[o[42]="VIDEO_NACKS_SENT"]=42,p[o[43]="VIDEO_FIRS_SENT"]=43,p[o[44]="VIDEO_RECEIVED_BITRATE"]=44,p[o[45]="VIDEO_CURRENT_DELAY_MS"]=45,p[o[46]="VIDEO_JITTER_BUFFER_MS"]=46,p[o[47]="VIDEO_DISCARDED_PPS"]=47,p[o[48]="VIDEO_PLIS_SENT"]=48,p[o[49]="VIDEO_RECEIVED_JITTER_MS"]=49,p[o[60]="VIDEO_INPUT_HEIGHT"]=60,p[o[64]="VIDEO_ENCODE_HEIGHT"]=64,p[o[66]="VIDEO_SENT_QP_SUM"]=66,p[o[69]="VIDEO_DECODE_HEIGHT"]=69,p[o[72]="VIDEO_RECEIVED_QP_SUM"]=72,p[o[86]="VIDEO_ENCODE_WIDTH"]=86,p[o[87]="VIDEO_DECODE_WIDTH"]=87,p[o[88]="VIDEO_ENCODER_IS_HARDWARE"]=88,p[o[89]="VIDEO_DECODER_IS_HARDWARE"]=89,p[o[90]="VIDEO_FREEZE_COUNT"]=90,p[o[91]="VIDEO_FREEZE_DURATION"]=91,p[o[92]="VIDEO_PAUSE_COUNT"]=92,p[o[93]="VIDEO_PAUSE_DURATION"]=93,p[o[94]="VIDEO_QUALITY_REASON"]=94,p[o[95]="VIDEO_PROCESSING_TIME"]=95,p[o[96]="RTC_SPK_AUDIO_LEVEL"]=96,p[o[97]="RTC_MIC_AUDIO_LEVEL"]=97,p[o[98]="RTC_SPK_TOTAL_LOST"]=98,p[o[99]="RTC_SPK_TOTAL_EXPECTED"]=99,p[o[100]="RTC_SPK_TOTAL_RECOVERED_RED"]=100,p[o[101]="RTC_SPK_TOTAL_RECOVERED_FEC"]=101,p[o[102]="VIDEO_QUALITY_LIMITATION_DURATION_CPU"]=102,p[o[103]="VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU"]=103,p[o[104]="VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE"]=104,p[o[105]="VIDEO_RENDER_HEIGHT"]=105,p[o[106]="VIDEO_RENDER_WIDTH"]=106,p[o[107]="VIDEO_INPUT_WIDTH"]=107,p[o[108]="VIDEO_SENT_JITTER_MS"]=108,SdkMetric.Type=p,SdkMetric}(),en.SdkStreamMetricFrame=function(){function SdkStreamMetricFrame(o){if(this.metrics=[],this.dimensions=[],o)for(var p=Object.keys(o),f=0;f>>3){case 3:m.streamId=o.uint32();break;case 4:m.groupId=o.uint32();break;case 5:m.metrics&&m.metrics.length||(m.metrics=[]),m.metrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 6:m.dimensions&&m.dimensions.length||(m.dimensions=[]),m.dimensions.push(en.SdkStreamDimension.decode(o,o.uint32()));break;case 7:m.mediaType=o.int32();break;default:o.skipType(7&_)}}return m},SdkStreamMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.metrics&&o.hasOwnProperty("metrics")){if(!Array.isArray(o.metrics))return"metrics: array expected";for(var p=0;p>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.metrics){if(!Array.isArray(o.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");p.metrics=[];for(var f=0;f>>3){case 1:m.globalMetrics&&m.globalMetrics.length||(m.globalMetrics=[]),m.globalMetrics.push(en.SdkMetric.decode(o,o.uint32()));break;case 2:m.streamMetricFrames&&m.streamMetricFrames.length||(m.streamMetricFrames=[]),m.streamMetricFrames.push(en.SdkStreamMetricFrame.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkClientMetricFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkClientMetricFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.globalMetrics&&o.hasOwnProperty("globalMetrics")){if(!Array.isArray(o.globalMetrics))return"globalMetrics: array expected";for(var p=0;p>>3){case 1:m.type=o.int32();break;case 2:m.value=en.SdkDimensionValue.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkStreamDimension.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkStreamDimension.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}if(null!=o.value&&o.hasOwnProperty("value")){var p=en.SdkDimensionValue.verify(o.value);if(p)return"value."+p}return null},SdkStreamDimension.fromObject=function(o){if(o instanceof en.SdkStreamDimension)return o;var p=new en.SdkStreamDimension;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"VIDEO_ENCODER_NAME":case 1:p.type=1;break;case"VIDEO_DECODER_NAME":case 2:p.type=2}if(null!=o.value){if("object"!=typeof o.value)throw TypeError(".SdkStreamDimension.value: object expected");p.value=en.SdkDimensionValue.fromObject(o.value)}return p},SdkStreamDimension.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.type=p.enums===String?"VIDEO_ENCODER_NAME":1,f.value=null),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkStreamDimension.Type[o.type]?o.type:en.SdkStreamDimension.Type[o.type]:o.type),null!=o.value&&o.hasOwnProperty("value")&&(f.value=en.SdkDimensionValue.toObject(o.value,p)),f},SdkStreamDimension.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkStreamDimension.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkStreamDimension"},(p=Object.create(o={}))[o[1]="VIDEO_ENCODER_NAME"]=1,p[o[2]="VIDEO_DECODER_NAME"]=2,SdkStreamDimension.Type=p,SdkStreamDimension}(),en.SdkDimensionValue=function(){function SdkDimensionValue(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.stringValue=o.string();break;case 2:m.boolValue=o.bool();break;case 3:m.uintValue=o.uint64();break;default:o.skipType(7&_)}}return m},SdkDimensionValue.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDimensionValue.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.stringValue&&o.hasOwnProperty("stringValue")&&!er.isString(o.stringValue)?"stringValue: string expected":null!=o.boolValue&&o.hasOwnProperty("boolValue")&&"boolean"!=typeof o.boolValue?"boolValue: boolean expected":null!=o.uintValue&&o.hasOwnProperty("uintValue")&&!er.isInteger(o.uintValue)&&!(o.uintValue&&er.isInteger(o.uintValue.low)&&er.isInteger(o.uintValue.high))?"uintValue: integer|Long expected":null},SdkDimensionValue.fromObject=function(o){if(o instanceof en.SdkDimensionValue)return o;var p=new en.SdkDimensionValue;return null!=o.stringValue&&(p.stringValue=String(o.stringValue)),null!=o.boolValue&&(p.boolValue=!!o.boolValue),null!=o.uintValue&&(er.Long?(p.uintValue=er.Long.fromValue(o.uintValue)).unsigned=!0:"string"==typeof o.uintValue?p.uintValue=parseInt(o.uintValue,10):"number"==typeof o.uintValue?p.uintValue=o.uintValue:"object"==typeof o.uintValue&&(p.uintValue=new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0))),p},SdkDimensionValue.toObject=function(o,p){p||(p={});var f={};if(p.defaults)if(f.stringValue="",f.boolValue=!1,er.Long){var m=new er.Long(0,0,!0);f.uintValue=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.uintValue=p.longs===String?"0":0;return null!=o.stringValue&&o.hasOwnProperty("stringValue")&&(f.stringValue=o.stringValue),null!=o.boolValue&&o.hasOwnProperty("boolValue")&&(f.boolValue=o.boolValue),null!=o.uintValue&&o.hasOwnProperty("uintValue")&&("number"==typeof o.uintValue?f.uintValue=p.longs===String?String(o.uintValue):o.uintValue:f.uintValue=p.longs===String?er.Long.prototype.toString.call(o.uintValue):p.longs===Number?new er.LongBits(o.uintValue.low>>>0,o.uintValue.high>>>0).toNumber(!0):o.uintValue),f},SdkDimensionValue.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDimensionValue.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDimensionValue"},SdkDimensionValue}(),en.SdkDataMessageFrame=function(){function SdkDataMessageFrame(o){if(this.messages=[],o)for(var p=Object.keys(o),f=0;f>>3==1?(m.messages&&m.messages.length||(m.messages=[]),m.messages.push(en.SdkDataMessagePayload.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkDataMessageFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessageFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.messages&&o.hasOwnProperty("messages")){if(!Array.isArray(o.messages))return"messages: array expected";for(var p=0;p>>3){case 1:m.topic=o.string();break;case 2:m.data=o.bytes();break;case 3:m.lifetimeMs=o.uint32();break;case 4:m.senderAttendeeId=o.string();break;case 5:m.ingestTimeNs=o.int64();break;case 6:m.senderExternalUserId=o.string();break;default:o.skipType(7&_)}}return m},SdkDataMessagePayload.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkDataMessagePayload.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.topic&&o.hasOwnProperty("topic")&&!er.isString(o.topic)?"topic: string expected":null!=o.data&&o.hasOwnProperty("data")&&!(o.data&&"number"==typeof o.data.length||er.isString(o.data))?"data: buffer expected":null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&!er.isInteger(o.lifetimeMs)?"lifetimeMs: integer expected":null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&!er.isString(o.senderAttendeeId)?"senderAttendeeId: string expected":null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&!er.isInteger(o.ingestTimeNs)&&!(o.ingestTimeNs&&er.isInteger(o.ingestTimeNs.low)&&er.isInteger(o.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&!er.isString(o.senderExternalUserId)?"senderExternalUserId: string expected":null},SdkDataMessagePayload.fromObject=function(o){if(o instanceof en.SdkDataMessagePayload)return o;var p=new en.SdkDataMessagePayload;return null!=o.topic&&(p.topic=String(o.topic)),null!=o.data&&("string"==typeof o.data?er.base64.decode(o.data,p.data=er.newBuffer(er.base64.length(o.data)),0):o.data.length>=0&&(p.data=o.data)),null!=o.lifetimeMs&&(p.lifetimeMs=o.lifetimeMs>>>0),null!=o.senderAttendeeId&&(p.senderAttendeeId=String(o.senderAttendeeId)),null!=o.ingestTimeNs&&(er.Long?(p.ingestTimeNs=er.Long.fromValue(o.ingestTimeNs)).unsigned=!1:"string"==typeof o.ingestTimeNs?p.ingestTimeNs=parseInt(o.ingestTimeNs,10):"number"==typeof o.ingestTimeNs?p.ingestTimeNs=o.ingestTimeNs:"object"==typeof o.ingestTimeNs&&(p.ingestTimeNs=new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber())),null!=o.senderExternalUserId&&(p.senderExternalUserId=String(o.senderExternalUserId)),p},SdkDataMessagePayload.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.topic="",p.bytes===String?f.data="":(f.data=[],p.bytes!==Array&&(f.data=er.newBuffer(f.data))),f.lifetimeMs=0,f.senderAttendeeId="",er.Long){var m=new er.Long(0,0,!1);f.ingestTimeNs=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.ingestTimeNs=p.longs===String?"0":0;f.senderExternalUserId=""}return null!=o.topic&&o.hasOwnProperty("topic")&&(f.topic=o.topic),null!=o.data&&o.hasOwnProperty("data")&&(f.data=p.bytes===String?er.base64.encode(o.data,0,o.data.length):p.bytes===Array?Array.prototype.slice.call(o.data):o.data),null!=o.lifetimeMs&&o.hasOwnProperty("lifetimeMs")&&(f.lifetimeMs=o.lifetimeMs),null!=o.senderAttendeeId&&o.hasOwnProperty("senderAttendeeId")&&(f.senderAttendeeId=o.senderAttendeeId),null!=o.ingestTimeNs&&o.hasOwnProperty("ingestTimeNs")&&("number"==typeof o.ingestTimeNs?f.ingestTimeNs=p.longs===String?String(o.ingestTimeNs):o.ingestTimeNs:f.ingestTimeNs=p.longs===String?er.Long.prototype.toString.call(o.ingestTimeNs):p.longs===Number?new er.LongBits(o.ingestTimeNs.low>>>0,o.ingestTimeNs.high>>>0).toNumber():o.ingestTimeNs),null!=o.senderExternalUserId&&o.hasOwnProperty("senderExternalUserId")&&(f.senderExternalUserId=o.senderExternalUserId),f},SdkDataMessagePayload.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkDataMessagePayload.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkDataMessagePayload"},SdkDataMessagePayload}(),en.SdkTurnCredentials=function(){function SdkTurnCredentials(o){if(this.uris=[],o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.username=o.string();break;case 2:m.password=o.string();break;case 3:m.ttl=o.uint32();break;case 4:m.uris&&m.uris.length||(m.uris=[]),m.uris.push(o.string());break;default:o.skipType(7&_)}}return m},SdkTurnCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTurnCredentials.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.username&&o.hasOwnProperty("username")&&!er.isString(o.username))return"username: string expected";if(null!=o.password&&o.hasOwnProperty("password")&&!er.isString(o.password))return"password: string expected";if(null!=o.ttl&&o.hasOwnProperty("ttl")&&!er.isInteger(o.ttl))return"ttl: integer expected";if(null!=o.uris&&o.hasOwnProperty("uris")){if(!Array.isArray(o.uris))return"uris: array expected";for(var p=0;p>>0),o.uris){if(!Array.isArray(o.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");p.uris=[];for(var f=0;f>>3){case 1:m.content=o.string();break;case 2:m.endTime=o.int64();break;case 3:m.speakerAttendeeId=o.string();break;case 4:m.speakerExternalUserId=o.string();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.int32();break;case 7:m.vocabularyFilterMatch=o.bool();break;case 8:m.confidence=o.double();break;case 9:m.stable=o.bool();break;default:o.skipType(7&_)}}return m},SdkTranscriptItem.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptItem.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content))return"content: string expected";if(null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high)))return"endTime: integer|Long expected";if(null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&!er.isString(o.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&!er.isString(o.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high)))return"startTime: integer|Long expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:}return null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&"boolean"!=typeof o.vocabularyFilterMatch?"vocabularyFilterMatch: boolean expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.stable&&o.hasOwnProperty("stable")&&"boolean"!=typeof o.stable?"stable: boolean expected":null},SdkTranscriptItem.fromObject=function(o){if(o instanceof en.SdkTranscriptItem)return o;var p=new en.SdkTranscriptItem;switch(null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.speakerAttendeeId&&(p.speakerAttendeeId=String(o.speakerAttendeeId)),null!=o.speakerExternalUserId&&(p.speakerExternalUserId=String(o.speakerExternalUserId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"PRONUNCIATION":case 1:p.type=1;break;case"PUNCTUATION":case 2:p.type=2}return null!=o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=!!o.vocabularyFilterMatch),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.stable&&(p.stable=!!o.stable),p},SdkTranscriptItem.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(f.speakerAttendeeId="",f.speakerExternalUserId="",er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=p.enums===String?"PRONUNCIATION":1,f.vocabularyFilterMatch=!1,f.confidence=0,f.stable=!1}return null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.speakerAttendeeId&&o.hasOwnProperty("speakerAttendeeId")&&(f.speakerAttendeeId=o.speakerAttendeeId),null!=o.speakerExternalUserId&&o.hasOwnProperty("speakerExternalUserId")&&(f.speakerExternalUserId=o.speakerExternalUserId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptItem.Type[o.type]?o.type:en.SdkTranscriptItem.Type[o.type]:o.type),null!=o.vocabularyFilterMatch&&o.hasOwnProperty("vocabularyFilterMatch")&&(f.vocabularyFilterMatch=o.vocabularyFilterMatch),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.stable&&o.hasOwnProperty("stable")&&(f.stable=o.stable),f},SdkTranscriptItem.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptItem.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptItem"},(p=Object.create(o={}))[o[1]="PRONUNCIATION"]=1,p[o[2]="PUNCTUATION"]=2,SdkTranscriptItem.Type=p,SdkTranscriptItem}(),en.SdkTranscriptEntity=function(){function SdkTranscriptEntity(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.category=o.string();break;case 2:m.confidence=o.double();break;case 3:m.content=o.string();break;case 4:m.endTime=o.int64();break;case 5:m.startTime=o.int64();break;case 6:m.type=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptEntity.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEntity.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.category&&o.hasOwnProperty("category")&&!er.isString(o.category)?"category: string expected":null!=o.confidence&&o.hasOwnProperty("confidence")&&"number"!=typeof o.confidence?"confidence: number expected":null!=o.content&&o.hasOwnProperty("content")&&!er.isString(o.content)?"content: string expected":null!=o.endTime&&o.hasOwnProperty("endTime")&&!er.isInteger(o.endTime)&&!(o.endTime&&er.isInteger(o.endTime.low)&&er.isInteger(o.endTime.high))?"endTime: integer|Long expected":null!=o.startTime&&o.hasOwnProperty("startTime")&&!er.isInteger(o.startTime)&&!(o.startTime&&er.isInteger(o.startTime.low)&&er.isInteger(o.startTime.high))?"startTime: integer|Long expected":null!=o.type&&o.hasOwnProperty("type")&&!er.isString(o.type)?"type: string expected":null},SdkTranscriptEntity.fromObject=function(o){if(o instanceof en.SdkTranscriptEntity)return o;var p=new en.SdkTranscriptEntity;return null!=o.category&&(p.category=String(o.category)),null!=o.confidence&&(p.confidence=Number(o.confidence)),null!=o.content&&(p.content=String(o.content)),null!=o.endTime&&(er.Long?(p.endTime=er.Long.fromValue(o.endTime)).unsigned=!1:"string"==typeof o.endTime?p.endTime=parseInt(o.endTime,10):"number"==typeof o.endTime?p.endTime=o.endTime:"object"==typeof o.endTime&&(p.endTime=new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber())),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.type&&(p.type=String(o.type)),p},SdkTranscriptEntity.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.category="",f.confidence=0,f.content="",er.Long){var m=new er.Long(0,0,!1);f.endTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.endTime=p.longs===String?"0":0;if(er.Long){var m=new er.Long(0,0,!1);f.startTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.startTime=p.longs===String?"0":0;f.type=""}return null!=o.category&&o.hasOwnProperty("category")&&(f.category=o.category),null!=o.confidence&&o.hasOwnProperty("confidence")&&(f.confidence=p.json&&!isFinite(o.confidence)?String(o.confidence):o.confidence),null!=o.content&&o.hasOwnProperty("content")&&(f.content=o.content),null!=o.endTime&&o.hasOwnProperty("endTime")&&("number"==typeof o.endTime?f.endTime=p.longs===String?String(o.endTime):o.endTime:f.endTime=p.longs===String?er.Long.prototype.toString.call(o.endTime):p.longs===Number?new er.LongBits(o.endTime.low>>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.type&&o.hasOwnProperty("type")&&(f.type=o.type),f},SdkTranscriptEntity.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEntity.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEntity"},SdkTranscriptEntity}(),en.SdkTranscriptAlternative=function(){function SdkTranscriptAlternative(o){if(this.items=[],this.entities=[],o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.items&&m.items.length||(m.items=[]),m.items.push(en.SdkTranscriptItem.decode(o,o.uint32()));break;case 2:m.transcript=o.string();break;case 3:m.entities&&m.entities.length||(m.entities=[]),m.entities.push(en.SdkTranscriptEntity.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptAlternative.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptAlternative.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.items&&o.hasOwnProperty("items")){if(!Array.isArray(o.items))return"items: array expected";for(var p=0;p>>3){case 1:m.languageCode=o.string();break;case 2:m.score=o.double();break;default:o.skipType(7&_)}}return m},SdkTranscriptLanguageWithScore.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptLanguageWithScore.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.languageCode&&o.hasOwnProperty("languageCode")&&!er.isString(o.languageCode)?"languageCode: string expected":null!=o.score&&o.hasOwnProperty("score")&&"number"!=typeof o.score?"score: number expected":null},SdkTranscriptLanguageWithScore.fromObject=function(o){if(o instanceof en.SdkTranscriptLanguageWithScore)return o;var p=new en.SdkTranscriptLanguageWithScore;return null!=o.languageCode&&(p.languageCode=String(o.languageCode)),null!=o.score&&(p.score=Number(o.score)),p},SdkTranscriptLanguageWithScore.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.languageCode="",f.score=0),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),null!=o.score&&o.hasOwnProperty("score")&&(f.score=p.json&&!isFinite(o.score)?String(o.score):o.score),f},SdkTranscriptLanguageWithScore.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptLanguageWithScore.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptLanguageWithScore"},SdkTranscriptLanguageWithScore}(),en.SdkTranscriptResult=function(){function SdkTranscriptResult(o){if(this.alternatives=[],this.languageIdentification=[],o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.alternatives&&m.alternatives.length||(m.alternatives=[]),m.alternatives.push(en.SdkTranscriptAlternative.decode(o,o.uint32()));break;case 2:m.channelId=o.string();break;case 3:m.endTime=o.int64();break;case 4:m.isPartial=o.bool();break;case 5:m.resultId=o.string();break;case 6:m.startTime=o.int64();break;case 7:m.languageCode=o.string();break;case 8:m.languageIdentification&&m.languageIdentification.length||(m.languageIdentification=[]),m.languageIdentification.push(en.SdkTranscriptLanguageWithScore.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return m},SdkTranscriptResult.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptResult.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.alternatives&&o.hasOwnProperty("alternatives")){if(!Array.isArray(o.alternatives))return"alternatives: array expected";for(var p=0;p>>0,o.endTime.high>>>0).toNumber())),null!=o.isPartial&&(p.isPartial=!!o.isPartial),null!=o.resultId&&(p.resultId=String(o.resultId)),null!=o.startTime&&(er.Long?(p.startTime=er.Long.fromValue(o.startTime)).unsigned=!1:"string"==typeof o.startTime?p.startTime=parseInt(o.startTime,10):"number"==typeof o.startTime?p.startTime=o.startTime:"object"==typeof o.startTime&&(p.startTime=new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber())),null!=o.languageCode&&(p.languageCode=String(o.languageCode)),o.languageIdentification){if(!Array.isArray(o.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");p.languageIdentification=[];for(var f=0;f>>0,o.endTime.high>>>0).toNumber():o.endTime),null!=o.isPartial&&o.hasOwnProperty("isPartial")&&(f.isPartial=o.isPartial),null!=o.resultId&&o.hasOwnProperty("resultId")&&(f.resultId=o.resultId),null!=o.startTime&&o.hasOwnProperty("startTime")&&("number"==typeof o.startTime?f.startTime=p.longs===String?String(o.startTime):o.startTime:f.startTime=p.longs===String?er.Long.prototype.toString.call(o.startTime):p.longs===Number?new er.LongBits(o.startTime.low>>>0,o.startTime.high>>>0).toNumber():o.startTime),null!=o.languageCode&&o.hasOwnProperty("languageCode")&&(f.languageCode=o.languageCode),o.languageIdentification&&o.languageIdentification.length){f.languageIdentification=[];for(var _=0;_>>3==1?(m.results&&m.results.length||(m.results=[]),m.results.push(en.SdkTranscriptResult.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscript.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscript.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.results&&o.hasOwnProperty("results")){if(!Array.isArray(o.results))return"results: array expected";for(var p=0;p>>3){case 1:m.type=o.int32();break;case 2:m.eventTime=o.int64();break;case 3:m.transcriptionRegion=o.string();break;case 4:m.transcriptionConfiguration=o.string();break;case 5:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkTranscriptionStatus.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptionStatus.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.type&&o.hasOwnProperty("type"))switch(o.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:}return null!=o.eventTime&&o.hasOwnProperty("eventTime")&&!er.isInteger(o.eventTime)&&!(o.eventTime&&er.isInteger(o.eventTime.low)&&er.isInteger(o.eventTime.high))?"eventTime: integer|Long expected":null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&!er.isString(o.transcriptionRegion)?"transcriptionRegion: string expected":null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&!er.isString(o.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkTranscriptionStatus.fromObject=function(o){if(o instanceof en.SdkTranscriptionStatus)return o;var p=new en.SdkTranscriptionStatus;switch(o.type){default:"number"==typeof o.type&&(p.type=o.type);break;case"STARTED":case 1:p.type=1;break;case"INTERRUPTED":case 2:p.type=2;break;case"RESUMED":case 3:p.type=3;break;case"STOPPED":case 4:p.type=4;break;case"FAILED":case 5:p.type=5}return null!=o.eventTime&&(er.Long?(p.eventTime=er.Long.fromValue(o.eventTime)).unsigned=!1:"string"==typeof o.eventTime?p.eventTime=parseInt(o.eventTime,10):"number"==typeof o.eventTime?p.eventTime=o.eventTime:"object"==typeof o.eventTime&&(p.eventTime=new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber())),null!=o.transcriptionRegion&&(p.transcriptionRegion=String(o.transcriptionRegion)),null!=o.transcriptionConfiguration&&(p.transcriptionConfiguration=String(o.transcriptionConfiguration)),null!=o.message&&(p.message=String(o.message)),p},SdkTranscriptionStatus.toObject=function(o,p){p||(p={});var f={};if(p.defaults){if(f.type=p.enums===String?"STARTED":1,er.Long){var m=new er.Long(0,0,!1);f.eventTime=p.longs===String?m.toString():p.longs===Number?m.toNumber():m}else f.eventTime=p.longs===String?"0":0;f.transcriptionRegion="",f.transcriptionConfiguration="",f.message=""}return null!=o.type&&o.hasOwnProperty("type")&&(f.type=p.enums===String?void 0===en.SdkTranscriptionStatus.Type[o.type]?o.type:en.SdkTranscriptionStatus.Type[o.type]:o.type),null!=o.eventTime&&o.hasOwnProperty("eventTime")&&("number"==typeof o.eventTime?f.eventTime=p.longs===String?String(o.eventTime):o.eventTime:f.eventTime=p.longs===String?er.Long.prototype.toString.call(o.eventTime):p.longs===Number?new er.LongBits(o.eventTime.low>>>0,o.eventTime.high>>>0).toNumber():o.eventTime),null!=o.transcriptionRegion&&o.hasOwnProperty("transcriptionRegion")&&(f.transcriptionRegion=o.transcriptionRegion),null!=o.transcriptionConfiguration&&o.hasOwnProperty("transcriptionConfiguration")&&(f.transcriptionConfiguration=o.transcriptionConfiguration),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkTranscriptionStatus.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptionStatus.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptionStatus"},(p=Object.create(o={}))[o[1]="STARTED"]=1,p[o[2]="INTERRUPTED"]=2,p[o[3]="RESUMED"]=3,p[o[4]="STOPPED"]=4,p[o[5]="FAILED"]=5,SdkTranscriptionStatus.Type=p,SdkTranscriptionStatus}(),en.SdkTranscriptEvent=function(){var o;function SdkTranscriptEvent(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.status=en.SdkTranscriptionStatus.decode(o,o.uint32());break;case 2:m.transcript=en.SdkTranscript.decode(o,o.uint32());break;default:o.skipType(7&_)}}return m},SdkTranscriptEvent.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptEvent.verify=function(o){if("object"!=typeof o||null===o)return"object expected";var p={};if(null!=o.status&&o.hasOwnProperty("status")){p.Event=1;var f=en.SdkTranscriptionStatus.verify(o.status);if(f)return"status."+f}if(null!=o.transcript&&o.hasOwnProperty("transcript")){if(1===p.Event)return"Event: multiple values";p.Event=1;var f=en.SdkTranscript.verify(o.transcript);if(f)return"transcript."+f}return null},SdkTranscriptEvent.fromObject=function(o){if(o instanceof en.SdkTranscriptEvent)return o;var p=new en.SdkTranscriptEvent;if(null!=o.status){if("object"!=typeof o.status)throw TypeError(".SdkTranscriptEvent.status: object expected");p.status=en.SdkTranscriptionStatus.fromObject(o.status)}if(null!=o.transcript){if("object"!=typeof o.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");p.transcript=en.SdkTranscript.fromObject(o.transcript)}return p},SdkTranscriptEvent.toObject=function(o,p){p||(p={});var f={};return null!=o.status&&o.hasOwnProperty("status")&&(f.status=en.SdkTranscriptionStatus.toObject(o.status,p),p.oneofs&&(f.Event="status")),null!=o.transcript&&o.hasOwnProperty("transcript")&&(f.transcript=en.SdkTranscript.toObject(o.transcript,p),p.oneofs&&(f.Event="transcript")),f},SdkTranscriptEvent.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkTranscriptEvent.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkTranscriptEvent"},SdkTranscriptEvent}(),en.SdkTranscriptFrame=function(){function SdkTranscriptFrame(o){if(this.events=[],o)for(var p=Object.keys(o),f=0;f>>3==1?(m.events&&m.events.length||(m.events=[]),m.events.push(en.SdkTranscriptEvent.decode(o,o.uint32()))):o.skipType(7&_)}return m},SdkTranscriptFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkTranscriptFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.events&&o.hasOwnProperty("events")){if(!Array.isArray(o.events))return"events: array expected";for(var p=0;p>>3){case 1:m.addedOrUpdatedVideoSubscriptions&&m.addedOrUpdatedVideoSubscriptions.length||(m.addedOrUpdatedVideoSubscriptions=[]),m.addedOrUpdatedVideoSubscriptions.push(en.SdkVideoSubscriptionConfiguration.decode(o,o.uint32()));break;case 2:m.removedVideoSubscriptionMids&&m.removedVideoSubscriptionMids.length||(m.removedVideoSubscriptionMids=[]),m.removedVideoSubscriptionMids.push(o.string());break;default:o.skipType(7&_)}}return m},SdkRemoteVideoUpdateFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkRemoteVideoUpdateFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.addedOrUpdatedVideoSubscriptions&&o.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(o.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var p=0;p>>3){case 1:m.mid=o.string();break;case 2:m.attendeeId=o.string();break;case 3:m.streamId=o.uint32();break;case 4:m.priority=o.uint32();break;case 5:m.targetBitrateKbps=o.uint32();break;case 6:m.groupId=o.uint32();break;case 7:m.qualityAdaptationPreference=o.int32();break;default:o.skipType(7&_)}}if(!m.hasOwnProperty("mid"))throw er.ProtocolError("missing required 'mid'",{instance:m});return m},SdkVideoSubscriptionConfiguration.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkVideoSubscriptionConfiguration.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(!er.isString(o.mid))return"mid: string expected";if(null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId))return"attendeeId: string expected";if(null!=o.streamId&&o.hasOwnProperty("streamId")&&!er.isInteger(o.streamId))return"streamId: integer expected";if(null!=o.priority&&o.hasOwnProperty("priority")&&!er.isInteger(o.priority))return"priority: integer expected";if(null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&!er.isInteger(o.targetBitrateKbps))return"targetBitrateKbps: integer expected";if(null!=o.groupId&&o.hasOwnProperty("groupId")&&!er.isInteger(o.groupId))return"groupId: integer expected";if(null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference"))switch(o.qualityAdaptationPreference){default:return"qualityAdaptationPreference: enum value expected";case 1:case 2:case 3:}return null},SdkVideoSubscriptionConfiguration.fromObject=function(o){if(o instanceof en.SdkVideoSubscriptionConfiguration)return o;var p=new en.SdkVideoSubscriptionConfiguration;switch(null!=o.mid&&(p.mid=String(o.mid)),null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.streamId&&(p.streamId=o.streamId>>>0),null!=o.priority&&(p.priority=o.priority>>>0),null!=o.targetBitrateKbps&&(p.targetBitrateKbps=o.targetBitrateKbps>>>0),null!=o.groupId&&(p.groupId=o.groupId>>>0),o.qualityAdaptationPreference){default:"number"==typeof o.qualityAdaptationPreference&&(p.qualityAdaptationPreference=o.qualityAdaptationPreference);break;case"BALANCED":case 1:p.qualityAdaptationPreference=1;break;case"MAINTAIN_FRAMERATE":case 2:p.qualityAdaptationPreference=2;break;case"MAINTAIN_RESOLUTION":case 3:p.qualityAdaptationPreference=3}return p},SdkVideoSubscriptionConfiguration.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.mid="",f.attendeeId="",f.streamId=0,f.priority=0,f.targetBitrateKbps=0,f.groupId=0,f.qualityAdaptationPreference=p.enums===String?"BALANCED":1),null!=o.mid&&o.hasOwnProperty("mid")&&(f.mid=o.mid),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.streamId&&o.hasOwnProperty("streamId")&&(f.streamId=o.streamId),null!=o.priority&&o.hasOwnProperty("priority")&&(f.priority=o.priority),null!=o.targetBitrateKbps&&o.hasOwnProperty("targetBitrateKbps")&&(f.targetBitrateKbps=o.targetBitrateKbps),null!=o.groupId&&o.hasOwnProperty("groupId")&&(f.groupId=o.groupId),null!=o.qualityAdaptationPreference&&o.hasOwnProperty("qualityAdaptationPreference")&&(f.qualityAdaptationPreference=p.enums===String?void 0===en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]?o.qualityAdaptationPreference:en.SdkVideoQualityAdaptationPreference[o.qualityAdaptationPreference]:o.qualityAdaptationPreference),f},SdkVideoSubscriptionConfiguration.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkVideoSubscriptionConfiguration.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkVideoSubscriptionConfiguration"},SdkVideoSubscriptionConfiguration}(),en.SdkNotificationFrame=function(){var o,p;function SdkNotificationFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.level=o.int32();break;case 2:m.message=o.string();break;default:o.skipType(7&_)}}return m},SdkNotificationFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkNotificationFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.level&&o.hasOwnProperty("level"))switch(o.level){default:return"level: enum value expected";case 1:case 2:case 3:}return null!=o.message&&o.hasOwnProperty("message")&&!er.isString(o.message)?"message: string expected":null},SdkNotificationFrame.fromObject=function(o){if(o instanceof en.SdkNotificationFrame)return o;var p=new en.SdkNotificationFrame;switch(o.level){case"INFO":case 1:p.level=1;break;case"WARNING":case 2:p.level=2;break;default:"number"==typeof o.level&&(p.level=o.level);break;case"ERROR":case 3:p.level=3}return null!=o.message&&(p.message=String(o.message)),p},SdkNotificationFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.level=p.enums===String?"ERROR":3,f.message=""),null!=o.level&&o.hasOwnProperty("level")&&(f.level=p.enums===String?void 0===en.SdkNotificationFrame.NotificationLevel[o.level]?o.level:en.SdkNotificationFrame.NotificationLevel[o.level]:o.level),null!=o.message&&o.hasOwnProperty("message")&&(f.message=o.message),f},SdkNotificationFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkNotificationFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkNotificationFrame"},(p=Object.create(o={}))[o[1]="INFO"]=1,p[o[2]="WARNING"]=2,p[o[3]="ERROR"]=3,SdkNotificationFrame.NotificationLevel=p,SdkNotificationFrame}(),en.SdkPrimaryMeetingJoinFrame=function(){function SdkPrimaryMeetingJoinFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3==1?m.credentials=en.SdkMeetingSessionCredentials.decode(o,o.uint32()):o.skipType(7&_)}return m},SdkPrimaryMeetingJoinFrame.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkPrimaryMeetingJoinFrame.verify=function(o){if("object"!=typeof o||null===o)return"object expected";if(null!=o.credentials&&o.hasOwnProperty("credentials")){var p=en.SdkMeetingSessionCredentials.verify(o.credentials);if(p)return"credentials."+p}return null},SdkPrimaryMeetingJoinFrame.fromObject=function(o){if(o instanceof en.SdkPrimaryMeetingJoinFrame)return o;var p=new en.SdkPrimaryMeetingJoinFrame;if(null!=o.credentials){if("object"!=typeof o.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");p.credentials=en.SdkMeetingSessionCredentials.fromObject(o.credentials)}return p},SdkPrimaryMeetingJoinFrame.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.credentials=null),null!=o.credentials&&o.hasOwnProperty("credentials")&&(f.credentials=en.SdkMeetingSessionCredentials.toObject(o.credentials,p)),f},SdkPrimaryMeetingJoinFrame.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkPrimaryMeetingJoinFrame.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkPrimaryMeetingJoinFrame"},SdkPrimaryMeetingJoinFrame}(),en.SdkPrimaryMeetingJoinAckFrame=function(){function SdkPrimaryMeetingJoinAckFrame(o){if(o)for(var p=Object.keys(o),f=0;f>>3){case 1:m.attendeeId=o.string();break;case 2:m.externalUserId=o.string();break;case 3:m.joinToken=o.string();break;default:o.skipType(7&_)}}return m},SdkMeetingSessionCredentials.decodeDelimited=function(o){return o instanceof et||(o=new et(o)),this.decode(o,o.uint32())},SdkMeetingSessionCredentials.verify=function(o){return"object"!=typeof o||null===o?"object expected":null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&!er.isString(o.attendeeId)?"attendeeId: string expected":null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&!er.isString(o.externalUserId)?"externalUserId: string expected":null!=o.joinToken&&o.hasOwnProperty("joinToken")&&!er.isString(o.joinToken)?"joinToken: string expected":null},SdkMeetingSessionCredentials.fromObject=function(o){if(o instanceof en.SdkMeetingSessionCredentials)return o;var p=new en.SdkMeetingSessionCredentials;return null!=o.attendeeId&&(p.attendeeId=String(o.attendeeId)),null!=o.externalUserId&&(p.externalUserId=String(o.externalUserId)),null!=o.joinToken&&(p.joinToken=String(o.joinToken)),p},SdkMeetingSessionCredentials.toObject=function(o,p){p||(p={});var f={};return p.defaults&&(f.attendeeId="",f.externalUserId="",f.joinToken=""),null!=o.attendeeId&&o.hasOwnProperty("attendeeId")&&(f.attendeeId=o.attendeeId),null!=o.externalUserId&&o.hasOwnProperty("externalUserId")&&(f.externalUserId=o.externalUserId),null!=o.joinToken&&o.hasOwnProperty("joinToken")&&(f.joinToken=o.joinToken),f},SdkMeetingSessionCredentials.prototype.toJSON=function(){return this.constructor.toObject(this,ee.util.toJSONOptions)},SdkMeetingSessionCredentials.getTypeUrl=function(o){return void 0===o&&(o="type.googleapis.com"),o+"/SdkMeetingSessionCredentials"},SdkMeetingSessionCredentials}(),(Z=Object.create(q={}))[q[1]="VP8"]=1,Z[q[2]="H264_BASELINE_PROFILE"]=2,Z[q[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,Z[q[4]="H264_MAIN_PROFILE"]=4,Z[q[5]="H264_HIGH_PROFILE"]=5,Z[q[6]="H264_CONSTRAINED_HIGH_PROFILE"]=6,Z[q[8]="VP9_PROFILE_0"]=8,Z[q[11]="AV1_MAIN_PROFILE"]=11,en.SdkVideoCodecCapability=Z,o.exports=en,er.Long=void 0,ee.configure()},0x189468218:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2869cb2b),I=f(0x249059e84),k=_(f(0x22a0f7c69));p.default=class{constructor(o){this.chimeClient=o}makeTwoDigits(o){return o>9?o.toString():"0"+o.toString()}hmac(o,p){let f=new w.Sha256(p);return f.update(o),f.digest()}getDateTimeString(){let o=new Date;return o.getUTCFullYear()+this.makeTwoDigits(o.getUTCMonth()+1)+this.makeTwoDigits(o.getUTCDate())+"T"+this.makeTwoDigits(o.getUTCHours())+this.makeTwoDigits(o.getUTCMinutes())+this.makeTwoDigits(o.getUTCSeconds())+"Z"}getDateString(o){return o.substring(0,o.indexOf("T"))}getSignatureKey(o,p,f,_){return m(this,void 0,void 0,function*(){let m=yield this.hmac(p,"AWS4"+o),w=yield this.hmac(f,m),I=yield this.hmac(_,w);return yield this.hmac("aws4_request",I)})}signURL(o,p,f,_,w,M,x){return m(this,void 0,void 0,function*(){let m,O=this.getDateTimeString(),L=this.getDateString(O),B="";B=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;let U="host:"+_.toLowerCase()+`
`,$=L+"/"+B+"/"+f+"/aws4_request";m=this.chimeClient.config.credentials instanceof Function?yield this.chimeClient.config.credentials():this.chimeClient.config.credentials;let q=new Map;q.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),q.set("X-Amz-Credential",[encodeURIComponent(m.accessKeyId+"/"+$)]),q.set("X-Amz-Date",[O]),q.set("X-Amz-Expires",["10"]),q.set("X-Amz-SignedHeaders",["host"]),m.sessionToken&&q.set("X-Amz-Security-Token",[encodeURIComponent(m.sessionToken)]),q.set(k.default.X_AMZN_VERSION,[encodeURIComponent(k.default.sdkVersion)]),q.set(k.default.X_AMZN_USER_AGENT,[encodeURIComponent(k.default.sdkUserAgentLowResolution)]),null==x||x.forEach((o,p)=>{let f=encodeURIComponent(p);o.sort().forEach(o=>{q.has(f)||q.set(f,[]),q.get(f).push(encodeURIComponent(o))})});let Z="";(q=new Map([...q.entries()].sort())).forEach((o,p)=>{o.forEach(o=>{Z.length&&(Z+="&"),Z+=p+"="+o})});let ee=o+`
`+w+`
`+Z+`
`+U+`
`+"host"+`
`+I.toHex((yield this.hmac(M))),et=`AWS4-HMAC-SHA256
`+O+`
`+L+"/"+B+"/"+f+`/aws4_request
`+I.toHex((yield this.hmac(ee))),ei=yield this.getSignatureKey(m.secretAccessKey,L,B,f),er=I.toHex((yield this.hmac(et,ei)));return p+"://"+_+w+"?"+(Z+"&X-Amz-Signature=")+er})}}},0x8f26277b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.SimulcastLayers=void 0,(m=f=p.SimulcastLayers||(p.SimulcastLayers={}))[m.Low=0]="Low",m[m.LowAndMedium=1]="LowAndMedium",m[m.LowAndHigh=2]="LowAndHigh",m[m.Medium=3]="Medium",m[m.MediumAndHigh=4]="MediumAndHigh",m[m.High=5]="High",p.default=f},0x1e4aafe7d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.AudioLogEvent=void 0,(m=f=p.AudioLogEvent||(p.AudioLogEvent={}))[m.DeviceChanged=0]="DeviceChanged",m[m.MutedLocal=1]="MutedLocal",m[m.UnmutedLocal=2]="UnmutedLocal",m[m.Connected=3]="Connected",m[m.ConnectFailed=4]="ConnectFailed",m[m.RedmicStartLoss=5]="RedmicStartLoss",m[m.RedmicEndLoss=6]="RedmicEndLoss",p.default=f},0x69c93909:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x176b792fb)),I=_(f(0x243b8874c)),k=_(f(0xebe235e1)),M=_(f(0x15a1c7c16)),x=_(f(0x49c5e00)),O=_(f(0x15d56a943)),L=_(f(0xc7dc71d8)),B=_(f(0xd475f02c)),U=f(0x252035ee7),$=f(0xab1ef933),q=_(f(0x1e4aafe7d)),Z=_(f(0x15a7c8b4)),ee=class StatsCollector{constructor(o,p,f=StatsCollector.INTERVAL_MS){this.audioVideoController=o,this.logger=p,this.interval=f,this.intervalScheduler=null,this.redRecoveryMetricReport=new M.default,this.lastRedRecoveryMetricReportConsumedTimestampMs=0,this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0,this.resolutionMap=new Map,this.metricsAddTime=(o,p,f)=>{},this.metricsLogEvent=(o,p)=>{}}toAttribute(o){return this.toSuffix(o).substring(1)}toSuffix(o){return o.toLowerCase()===o?`_${o}`:o.toUpperCase()===o?`_${o.toLowerCase()}`:o.replace(/([A-Z][a-z]+)/g,function(o){return`_${o}`}).replace(/([A-Z][A-Z]+)/g,function(o){return`_${o}`}).toLowerCase()}logLatency(o,p,f){let m=this.toSuffix(o);this.logEventTime("meeting"+m,p,f)}logStateTimeout(o,p){let f=this.toSuffix(o);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},p),{state:`state${f}`}))}logAudioEvent(o,p){let f="audio"+this.toSuffix(q.default[o]);this.logEvent(f,p)}logVideoEvent(o,p){let f="video"+this.toSuffix(Z.default[o]);this.logEvent(f,p)}logEventTime(o,p,f={}){let m=Object.assign(Object.assign({},f),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE,metric_type:"latency"});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(m)}`),this.metricsAddTime(o,p,m)}logMeetingSessionStatus(o){let p=`${o.statusCode()}`;this.logEvent(p);let f={status:p,status_code:`${o.statusCode()}`};this.logEvent("meeting_session_status",f),o.isTerminal()&&this.logEvent("meeting_session_stopped",f),o.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",f),o.isFailure()&&this.logEvent("meeting_session_failed",f)}logLifecycleEvent(o,p){let f={lifecycle_event:`lifecycle${this.toSuffix(O.default[o])}`,lifecycle_event_code:`${o}`,lifecycle_event_condition:`condition${this.toSuffix(L.default[p])}`,lifecycle_event_condition_code:`${p}`};this.logEvent("meeting_session_lifecycle",f)}logEvent(o,p={}){let f=Object.assign(Object.assign({},p),{call_id:this.audioVideoController.configuration.meetingId,client_type:StatsCollector.CLIENT_TYPE});this.logger.debug(()=>`[StatsCollector] ${o}: ${JSON.stringify(f)}`),this.metricsLogEvent(o,f)}start(o,p){return!this.intervalScheduler&&(this.logger.info("Starting StatsCollector"),this.signalingClient=o,this.videoStreamIndex=p,this.clientMetricReport=new w.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new B.default(this.interval),this.intervalScheduler.start(()=>m(this,void 0,void 0,function*(){yield this.getStatsWrapper()})),!0)}stop(){this.logger.info("Stopping StatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}videoTileResolutionDidChange(o,p,f){this.resolutionMap.set(o,{width:p,height:f})}videoTileUnbound(o){this.resolutionMap.delete(o)}updateMetricValues(o,p){let f,m=p?this.clientMetricReport.streamMetricReports[Number(o.ssrc)]:this.clientMetricReport.globalMetricReport;if(p){let p=m.mediaType,_=m.direction;f=this.clientMetricReport.getMetricMap(p,_),p===k.default.VIDEO&&_===I.default.DOWNSTREAM&&this.addRenderResolutionToVideoDownstreamMetrics(m,o.ssrc)}else f=this.clientMetricReport.getMetricMap();for(let p in o)p in f&&("number"==typeof o[p]?(m.previousMetrics[p]=m.currentMetrics[p],m.currentMetrics[p]=o[p]):"string"==typeof o[p]?m.currentStringMetrics[p]=o[p]:"object"==typeof o[p]?(m.previousObjectMetrics[p]=void 0===m.currentObjectMetrics[p]?o[p]:m.currentObjectMetrics[p],m.currentObjectMetrics[p]=o[p]):this.logger.error(`Unknown metric value type ${typeof o[p]} for metric ${p}`))}processRawMetricReports(o){this.clientMetricReport.currentSsrcs={};let p=Date.now();for(let p of o){if(this.isVideoSourceMetricReport(p))continue;let o=this.isStreamRawMetricReport(p);if(o){let o=this.clientMetricReport.streamMetricReports[Number(p.ssrc)];if(o)o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc));else{let o=new x.default;o.mediaType=this.getMediaType(p),o.direction=this.getDirectionType(p),o.mediaType===k.default.VIDEO&&o.direction===I.default.UPSTREAM?o.streamId=this.videoStreamIndex.sendVideoStreamIdFromRid(p.rid):this.videoStreamIndex.allStreams().empty()||(o.streamId=this.videoStreamIndex.streamIdForSSRC(Number(p.ssrc)),void 0!==this.videoStreamIndex.groupIdForSSRC&&(o.groupId=this.videoStreamIndex.groupIdForSSRC(Number(p.ssrc)))),this.clientMetricReport.streamMetricReports[Number(p.ssrc)]=o}this.clientMetricReport.currentSsrcs[Number(p.ssrc)]=1}this.updateMetricValues(p,o)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=p,this.clientMetricReport.print()}addStreamMetricDimensionFrames(o,p){let f=this.clientMetricReport.getStreamDimensionMap();for(let m in p.currentStringMetrics)if(m in f){let _=U.SdkStreamDimension.create();_.type=f[m];let w=U.SdkDimensionValue.create();w.stringValue=p.currentStringMetrics[m],_.value=w,o.dimensions.push(_)}}addMetricFrame(o,p,f,m){let _=f.type,w=f.transform,I=f.source,k=p.streamMetricFrames.length,M=p.streamMetricFrames[k-1];if(_){let f=U.SdkMetric.create();f.type=_,f.value=w(I||o,m),m?M.metrics.push(f):p.globalMetrics.push(f)}}addGlobalMetricsToProtobuf(o){let p=this.clientMetricReport.getMetricMap();for(let f in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(f,o,p[f])}addStreamMetricsToProtobuf(o){for(let p in this.clientMetricReport.streamMetricReports){let f=this.clientMetricReport.streamMetricReports[p],m=U.SdkStreamMetricFrame.create();m.streamId=f.streamId,m.mediaType=f.mediaType===k.default.AUDIO?U.SdkStreamMediaType.AUDIO:U.SdkStreamMediaType.VIDEO,m.metrics=[],this.addStreamMetricDimensionFrames(m,f),o.streamMetricFrames.push(m);let _=this.clientMetricReport.getMetricMap(f.mediaType,f.direction);for(let m in _)this.hasMetricDependenciesInReport(m,f)&&this.addMetricFrame(m,o,_[m],Number(p))}}hasMetricDependenciesInReport(o,p){return"decoderLoss"===o&&void 0!==p.currentMetrics.concealedSamples&&void 0!==p.currentMetrics.totalSamplesReceived||"jitterBufferMs"===o&&void 0!==p.currentMetrics.jitterBufferDelay&&void 0!==p.currentMetrics.jitterBufferEmittedCount||o in p.currentMetrics||o in p.currentStringMetrics||o in p.currentObjectMetrics}makeClientMetricProtobuf(){let o=U.SdkClientMetricFrame.create();return o.globalMetrics=[],o.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(o),this.addStreamMetricsToProtobuf(o),o}sendClientMetricProtobuf(o){this.signalingClient.sendClientMetrics(o)}isStreamRawMetricReport(o){return["inbound-rtp","inbound-rtp-red","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(o.type)||this.isVideoSourceMetricReport(o)}getMediaType(o){return"audio"===o.kind?k.default.AUDIO:k.default.VIDEO}getDirectionType(o){let{type:p}=o;return"inbound-rtp"===p||"remote-outbound-rtp"===p||"inbound-rtp-red"===p?I.default.DOWNSTREAM:I.default.UPSTREAM}isValidStandardRawMetric(o){return"inbound-rtp"===o.type||"inbound-rtp-red"===o.type||"outbound-rtp"===o.type||"remote-inbound-rtp"===o.type||"remote-outbound-rtp"===o.type||"candidate-pair"===o.type&&"succeeded"===o.state||"media-source"===o.type}isValidSsrc(o){let p=!0;return this.isStreamRawMetricReport(o)&&this.getDirectionType(o)===I.default.DOWNSTREAM&&this.getMediaType(o)===k.default.VIDEO&&(p=this.videoStreamIndex.streamIdForSSRC(Number(o.ssrc))>0),p}isValidRawMetricReport(o){return this.isValidStandardRawMetric(o)&&this.isValidSsrc(o)}filterRawMetricReports(o){let p=[];for(let f of o)this.isValidRawMetricReport(f)&&p.push(f);return p}handleRawMetricReports(o){let p=this.filterRawMetricReports(o);this.logger.debug(()=>`Filtered raw metrics : ${JSON.stringify(p)}`);let f=[];this.maybeAddRedRecoveryMetrics(f);let m=this.getVideoUpstreamSsrcFromRawMetricReports(p);null!==m&&this.addVideoCodecDegradationMetrics(f,m),this.clientMetricReport.customStatsReports=f,p.push(...f),this.processRawMetricReports(p),this.updateVideoSourceMetrics(p);let _=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(_),this.audioVideoController.forEachObserver(o=>{$.Maybe.of(o.metricsDidReceive).map(p=>p.bind(o)(this.clientMetricReport.clone()))})}getStatsWrapper(){return m(this,void 0,void 0,function*(){if(!this.audioVideoController.rtcPeerConnection)return;let o=[];try{let p=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=p,p.forEach(p=>{o.push(p)}),this.handleRawMetricReports(o)}catch(o){this.logger.error(o.message)}})}overrideObservableMetric(o,p){this.clientMetricReport.overrideObservableMetric(o,p)}recoveryMetricsDidReceive(o){this.redRecoveryMetricReport=o}maybeAddRedRecoveryMetrics(o){this.redRecoveryMetricReport.currentTimestampMs!==this.lastRedRecoveryMetricReportConsumedTimestampMs&&(o.push({kind:"audio",type:"inbound-rtp-red",ssrc:this.redRecoveryMetricReport.ssrc,timestamp:this.redRecoveryMetricReport.currentTimestampMs,totalAudioPacketsLost:this.redRecoveryMetricReport.totalAudioPacketsLost,totalAudioPacketsExpected:this.redRecoveryMetricReport.totalAudioPacketsExpected,totalAudioPacketsRecoveredRed:this.redRecoveryMetricReport.totalAudioPacketsRecoveredRed,totalAudioPacketsRecoveredFec:this.redRecoveryMetricReport.totalAudioPacketsRecoveredFec}),this.lastRedRecoveryMetricReportConsumedTimestampMs=this.redRecoveryMetricReport.currentTimestampMs)}videoCodecDegradationHighEncodeCpuDidReceive(){this.videoCodecDegradationHighEncodeCpuCount+=1}videoCodecDegradationEncodeFailureDidReceive(){this.videoCodecDegradationEncodeFailureCount+=1}videoCodecDegradationConcurrentSendersDidReceive(){this.videoCodecDegradationConcurrentSendersCount+=1}addVideoCodecDegradationMetrics(o,p){o.push({kind:"video",type:"outbound-rtp",ssrc:p,timestamp:Date.now(),videoCodecDegradationHighEncodeCpu:this.videoCodecDegradationHighEncodeCpuCount,videoCodecDegradationEncodeFailure:this.videoCodecDegradationEncodeFailureCount,videoCodecDegradationConcurrentSenders:this.videoCodecDegradationConcurrentSendersCount}),this.videoCodecDegradationHighEncodeCpuCount=0,this.videoCodecDegradationEncodeFailureCount=0,this.videoCodecDegradationConcurrentSendersCount=0}getVideoUpstreamSsrcFromRawMetricReports(o){for(let p of o)if(this.isStreamRawMetricReport(p)&&this.getMediaType(p)===k.default.VIDEO&&this.getDirectionType(p)===I.default.UPSTREAM)return p.ssrc;return null}isVideoSourceMetricReport(o){return"media-source"===o.type&&"video"===o.kind}addRenderResolutionToVideoDownstreamMetrics(o,p){let f=this.videoStreamIndex.streamIdForSSRC(Number(p)),m=this.videoStreamIndex.attendeeIdForStreamId(f);void 0===f||""===m?this.logger.warn(`No attendee found for ssrc ${p}`):this.resolutionMap.has(m)&&(o.currentMetrics.videoRenderWidth=this.resolutionMap.get(m).width,o.currentMetrics.videoRenderHeight=this.resolutionMap.get(m).height)}updateVideoSourceMetrics(o){for(let p of o)if(this.isVideoSourceMetricReport(p)){let o=this.clientMetricReport.getVideoUpstreamSsrcs();if(0===o.length)return void this.logger.warn("No video upstream ssrcs found");for(let f of o)this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputWidth=p.width,this.clientMetricReport.streamMetricReports[f].currentMetrics.videoInputHeight=p.height}}};p.default=ee,ee.INTERVAL_MS=1e3,ee.CLIENT_TYPE="amazon-chime-sdk-js"},0x15a7c8b4:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoLogEvent=void 0,(m=f=p.VideoLogEvent||(p.VideoLogEvent={}))[m.InputAttached=0]="InputAttached",m[m.SendingFailed=1]="SendingFailed",m[m.SendingSuccess=2]="SendingSuccess",p.default=f},0x1c7d226ae:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x15a7c8b4)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="AttachMediaInputTask"}run(){return m(this,void 0,void 0,function*(){let o=this.context.transceiverController;o.setPeer(this.context.peer),o.setupLocalTransceivers();let p=this.context.activeAudioInput;if(p){let f=p.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield o.setAudioInput(f.length?f[0]:null)}else yield o.setAudioInput(null),this.context.logger.info("no audio track");this.setAudioCodecPreferences();let f=this.context.activeVideoInput;if(f){let p=f.getVideoTracks(),m=p.length?p[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield o.setVideoInput(m),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){let p=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();o.setEncodingParameters(p)}m&&this.context.statsCollector.logVideoEvent(w.default.InputAttached,this.context.videoDeviceInformation)}else yield o.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=o.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive),this.context.videoStreamIndex.subscribeFrameSent()})}setAudioCodecPreferences(){let o=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype,p=this.context.audioProfile.hasRedundancyEnabled();if(!o)return void this.context.logger.warn("Setting codec preferences not supported");let f=this.context.transceiverController.localAudioTransceiver(),{codecs:m}=RTCRtpSender.getCapabilities("audio");this.context.logger.debug(`Available audio codecs ${JSON.stringify(m,null,4)}`);let _=m.findIndex(o=>"audio/red"===o.mimeType);if(!f)return void this.context.logger.error("audio transceiver is null");if(_>=0){let o=m[_];m.splice(_,1),p?(m.unshift(o),this.context.logger.info("audio/red set as preferred codec")):this.context.logger.info("audio/red removed from preferred codec"),f.setCodecPreferences(m);return}this.context.logger.info("audio/red codec not supported")}}},0x113227692:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x158630dfe)),I=_(f(0xe2814d21));p.default=class{constructor(o){this.logger=o,this.taskName="BaseTask",this.parentTask=null,this.status=I.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...o){return new w.default(this.logger,this,o)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(o){this.parentTask=o}getStatus(){return this.status}logAndThrow(o){throw this.logger.info(o),Error(o)}baseRun(o){return m(this,void 0,void 0,function*(){try{let p=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case I.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case I.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case I.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=I.default.RUNNING,yield o.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-p)} ms`)}catch(o){throw o}finally{this.status!==I.default.CANCELED&&(this.status=I.default.FINISHED)}})}baseCancel(o){this.status===I.default.CANCELED||this.status===I.default.FINISHED?this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`):(this.logger.info(`canceling task ${this.name()}`),this.status=I.default.CANCELED,o.call(this))}}},0x435994a8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanRestartedSessionTask"}run(){return m(this,void 0,void 0,function*(){this.context.resetConnectionSpecificState()})}}},0xbf52f99d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(o){throw o}finally{for(let o of this.context.removableObservers)o.removeObserver();this.context.resetConnectionSpecificState(),this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);let o=this.context.videoTileController.getLocalVideoTile();o&&o.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}})}receiveWebSocketClosedEvent(){return new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(p){p.type===w.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),o())}}(this.context.signalingClient);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x73c142bf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692)),I=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=o=>{let p=o.track;if(this.context.logger.info(`received track event: kind=${p.kind} id=${p.id} label=${p.label}`),o.transceiver&&"inactive"===o.transceiver.currentDirection)return;if(0===o.streams.length)return void this.context.logger.warn("Track event but no stream");let f=o.streams[0];"audio"===p.kind?this.context.audioMixController.bindAudioStream(f):"video"!==p.kind||this.trackIsVideoInput(p)||this.addRemoteVideoTrack(p,f)}}removeObserver(){for(let o in this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener(),this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[o]()}addPeerConnectionEventLogger(){let o=this.context.peer;o.addEventListener("connectionstatechange",()=>{this.context.logger.info(`peer connection state changed: ${o.connectionState}`)}),o.addEventListener("negotiationneeded",()=>{this.context.logger.info("peer connection negotiation is needed")}),o.addEventListener("icegatheringstatechange",()=>{this.context.logger.info(`peer connection ice gathering state changed: ${o.iceGatheringState}`)}),o.addEventListener("icecandidate",o=>{this.context.logger.info(`peer connection ice candidate: ${o.candidate?o.candidate.candidate:"(null)"}`)}),o.addEventListener("iceconnectionstatechange",()=>{this.context.logger.info(`peer connection ice connection state changed: ${o.iceConnectionState}`)})}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this);let o=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};o.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),o.sdpSemantics="unified-plan",window.RTCRtpScriptTransform||(o.encodedInsertableStreams=this.context.audioProfile.hasRedundancyEnabled()),this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(o),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)})}trackIsVideoInput(o){return!!this.context.transceiverController.useTransceivers()&&(this.logger.debug(()=>"getting video track type"),this.context.transceiverController.trackIsVideoInput(o))}addRemoteVideoTrack(o,p){var f;let m,_,w,I=p.id,k=this.context.videoStreamIndex.attendeeIdForTrack(I);if(this.context.videoTileController.getVideoTileForAttendeeId?!!(null==(f=null==(m=this.context.videoTileController.getVideoTileForAttendeeId(k))?void 0:m.state())?void 0:f.boundVideoStream):this.context.videoTileController.haveVideoTileForAttendeeId(k))return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${k}`);m||(m=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${m.id()}`));let M=this.context.videoStreamIndex.streamIdForTrack(I);void 0===M&&(this.logger.warn(`stream not found for tile=${m.id()} track=${I}`),M=null);let x=this.context.videoStreamIndex.groupIdForStreamId(M);void 0===x&&(x=null);for(let f=0;f{this.context.logger.info(`received the ${_} event for tile=${m.id()} id=${o.id} streamId=${M}`),"ended"===_&&this.removeRemoteVideoTrack(o,m.state())};p.addEventListener(_,callback),this.removeVideoTrackEventListeners[o.id]||(this.removeVideoTrackEventListeners[o.id]=[]),this.removeVideoTrackEventListeners[o.id].push(()=>{p.removeEventListener(_,callback)})}}if(o.getSettings){let p=o.getSettings();_=p.width,w=p.height}else{let p=o.getCapabilities();_=p.width,w=p.height}let O=this.context.videoStreamIndex.externalUserIdForTrack(I);m.bindVideoStream(k,!1,p,_,w,M,O,x),this.logger.info(`video track added, use tile=${m.id()} track=${I} streamId=${M} groupId=${x}`);let L="removetrack",trackRemovedHandler=()=>this.removeRemoteVideoTrack(o,m.state());this.removeTrackRemovedEventListeners[o.id]=()=>{p.removeEventListener(L,trackRemovedHandler),delete this.removeTrackRemovedEventListeners[o.id]},p.addEventListener(L,trackRemovedHandler)}removeRemoteVideoTrack(o,p){if(this.removeTrackRemovedEventListeners.hasOwnProperty(o.id)){for(let p of(this.removeTrackRemovedEventListeners[o.id](),this.removeVideoTrackEventListeners[o.id]))p();delete this.removeVideoTrackEventListeners[o.id]}this.logger.info(`video track ended, removing tile=${p.tileId} id=${o.id} stream=${p.streamId}`),p.streamId?this.context.videosPaused.remove(p.streamId):this.logger.warn(`no stream found for tile=${p.tileId}`),this.context.videoTileController.removeVideoTile(p.tileId)}};p.default=I,I.REMOVE_HANDLER_INTERVAL_MS=1e4},0x44174156:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}sessionUsesAudio(){var o,p;return!!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL)}sessionUsesVideo(){let o;o=this.context.transceiverController.useTransceivers()?this.context.transceiverController.hasVideoInput():this.context.videoTileController.hasStartedLocalVideoTile();let p=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),f=o||p;return this.context.logger.info(`uses video: ${f} (enabled: true, sending: ${o}, receiving: ${p})`),f}run(){return m(this,void 0,void 0,function*(){let o={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(o)}`),yield new Promise((p,f)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{f(o)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(o),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new I.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.IncompatibleSDP}`);this.context.previousSdpOffer=null,f(o);return}p()}catch(o){f(o)}finally{delete this.cancelPromise}}))})}}},0xa567a7ba:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692)),M=class FinishGatheringICECandidatesTask extends k.default{constructor(o,p=FinishGatheringICECandidatesTask.CHROME_VPN_TIMEOUT_MS){super(o.logger),this.context=o,this.chromeVpnTimeoutMs=p,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let o;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMsthis.chromeVpnTimeoutMs&&(o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(o=o||Error(`canceling ${this.name()}`),this.cancelPromise(o),delete this.cancelPromise)}run(){return m(this,void 0,void 0,function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new I.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if((this.context.browserBehavior.hasFirefoxWebRTC()||"complete"===this.context.peer.iceGatheringState)&&new I.default(this.context.peer.localDescription.sdp).hasCandidates())return void this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering");try{yield new Promise((o,p)=>{this.cancelPromise=o=>{this.removeEventListener(),p(o)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState){this.removeEventListener(),o(),delete this.cancelPromise;return}},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=f=>{if(this.context.logger.info(`ice candidate: ${f.candidate?f.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),f.candidate&&(I.default.isRTPCandidate(f.candidate.candidate)&&this.context.iceCandidates.push(f.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1)){this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),o(),delete this.cancelPromise;return}"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new I.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?o():p(Error("no ice candidates were gathered")),delete this.cancelPromise)},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()})}catch(o){throw o}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}})}};p.default=M,M.CHROME_VPN_TIMEOUT_MS=5e3},0x1b7bc4701:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x194415c85)),x=k(f(0x11a9e868)),O=k(f(0x15054ca8e)),L=w(f(0xf8b13aac)),B=k(f(0x216f98b8d)),U=k(f(0x1b32ed0f)),$=f(0x252035ee7),q=k(f(0x113227692));function rewriteTurnUris(o,p){let{urlRewriterMulti:f,urlRewriter:m}=p;return o.flatMap(o=>{if(f)return f(o)||[];let p=m(o);return p?[p]:[]}).filter(o=>!!o)}p.default=class extends q.default{constructor(o){super(o.logger),this.context=o,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return I(this,void 0,void 0,function*(){let o=yield new Promise((o,p)=>{let f=this.context;f.turnCredentials=null;let m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(p){if(p.type===B.default.WebSocketClosed){let o=`The signaling connection was closed with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=x.default.SignalingBadRequest;4410===p.closeCode?(o="The meeting already ended.",f.logger.warn(o),m=x.default.MeetingEnded):p.closeCode>=4500&&p.closeCode<4600&&(m=x.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new M.default(m),Error(o));return}if(p.type===B.default.ReceivedSignalFrame){if(p.message.type===$.SdkSignalFrame.Type.JOIN_ACK){let o=p.message.joinack;if(!o)return void f.audioVideoController.handleMeetingSessionStatus(new M.default(x.default.SignalingRequestFailed),Error("Join ACK message did not include expected frame"));if(o.videoSubscriptionLimit&&(f.videoSubscriptionLimit=o.videoSubscriptionLimit),f.serverSupportsCompression=o.wantsCompressedSdp,void 0!==o.defaultServerSideNetworkAdaption&&o.defaultServerSideNetworkAdaption!==L.default.Default&&void 0!==f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){let p=o.defaultServerSideNetworkAdaption;f.logger.info(`Overriding server side network adaption value to ${p}`),f.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(L.convertServerSideNetworkAdaptionEnumFromSignaled(p))}return void(o&&o.turnCredentials?(f.turnCredentials=new O.default,f.turnCredentials.username=o.turnCredentials.username,f.turnCredentials.password=o.turnCredentials.password,f.turnCredentials.ttl=o.turnCredentials.ttl,f.turnCredentials.uris=rewriteTurnUris(o.turnCredentials.uris,f.meetingSessionConfiguration.urls)):f.logger.error("missing TURN credentials in JoinAckFrame"))}p.message.type!==$.SdkSignalFrame.Type.INDEX||(this.signalingClient.removeObserver(this),o(p.message.index))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;let _=new U.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(_.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),_.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),void 0!==this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex&&(_.wantsAllTemporalLayersInIndex=this.context.videoDownlinkBandwidthPolicy.wantsAllTemporalLayersInIndex()),_.disablePeriodicKeyframeRequestOnContentSender=this.context.meetingSessionConfiguration.disablePeriodicKeyframeRequestOnContentSender,this.context.signalingClient.join(_)});this.context.logger.info(`received first index ${JSON.stringify(o)}`),this.context.indexFrame=o})}}},0x10a1c2ebe:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())})}receiveLeaveAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p){this.signalingClient=o,this.logger=p}cancel(){this.signalingClient.removeObserver(this),p(Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),o();return}p.type===w.default.ReceivedSignalFrame&&p.message.type===I.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),o())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x8c94ea05:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=o=>{this.context.signalingClient.mute(o)}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===w.default.ReceivedSignalFrame){if(o.message.type===I.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){let p=o.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(p)}else if(o.message.type===I.SdkSignalFrame.Type.AUDIO_METADATA){let p=o.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(p)}}}}},0x1f9f2eb05:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x243b8874c)),I=_(f(0xebe235e1)),k=_(f(0x61021f0c)),M=_(f(0x20ae9efa5)),x=_(f(0x1c6788b50)),O=_(f(0x17469a88e)),L=f(0x8fff55e5),B=_(f(0x194415c85)),U=_(f(0x11a9e868)),$=_(f(0x178bce6ff)),q=_(f(0x216f98b8d)),Z=f(0x252035ee7),ee=_(f(0x1e4aafe7d)),et=f(0xab1ef933),ei=_(f(0x113227692));p.default=class extends ei.default{constructor(o,p,f){for(const m of(super(o.logger),this.context=o,this.initialConnectionHealthData=f,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.videoEncodingHealthPolicies=[],this.checkAndSendWeakSignalEvent=o=>{let p=this.prevSignalStrength<1,f=o<1?p?null:ee.default.RedmicStartLoss:p?ee.default.RedmicEndLoss:null;f&&this.context.statsCollector.logAudioEvent(f),this.prevSignalStrength=o},this.realtimeFatalErrorCallback=o=>{this.logger.error(`realtime error: ${o}: ${o.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.RealtimeApiFailed),o)},this.realtimeAttendeeIdPresenceHandler=(o,p)=>{var f;let m=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${m}`),m===o&&p&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null==(f=this.context.eventController)||f.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs,retryCount:this.context.retryCount}))},this.reconnectionHealthPolicy=new k.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new x.default(Object.assign({},p),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new M.default(o.logger,Object.assign({},p),this.initialConnectionHealthData.clone()),p.videoEncodingHealthPolicies))this.videoEncodingHealthPolicies.push(new m(Object.assign({},p),this.initialConnectionHealthData.clone()))}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)})}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}videoTileDidUpdate(o){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}checkResubscribe(o){if(this.isResubscribeCheckPaused){this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),this.pendingMetricsReport=o;return}this.pendingMetricsReport=void 0;let p=o.getObservableMetrics(),f=p.availableOutgoingBitrate,m=p.nackCountReceivedPerSecond,_=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(o);let w=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(_=_||w,w){let o=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=o.truncate(this.context.videoSubscriptionLimit),o.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.logger.info(`trigger resubscribe for down=${w}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:f/1e3,nackCountPerSecond:m});let o=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();_=_||o,o&&(this.logger.info(`trigger resubscribe for up=${o}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters())}return _}metricsDidReceive(o){if(this.checkResubscribe(o)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;let p=o.streamMetricReports,f=new Map;for(let o in p)p[o].mediaType===I.default.VIDEO&&p[o].direction===w.default.DOWNSTREAM&&f.set(p[o].streamId,p[o])}connectionHealthDidChange(o){for(let p of(0===o.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,o,()=>{this.context.audioVideoController.handleMeetingSessionStatus(new B.default(U.default.ConnectionHealthReconnect),null)}),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,o,()=>{var o;this.context.poorConnectionCount+=1,null==(o=this.context.eventController)||o.publishEvent("receivingAudioDropped",L.audioVideoEventAttributesFromState(this.context)),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidSuggestStopVideo).map(p=>p.bind(o)())}):this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomePoor).map(p=>p.bind(o)())})},()=>{this.context.audioVideoController.forEachObserver(o=>{et.Maybe.of(o.connectionDidBecomeGood).map(p=>p.bind(o)())})}),this.videoEncodingHealthPolicies))this.applyHealthPolicy(p,o,()=>{switch(this.degradeVideoCodec(p.name),p.name){case O.default.VideoEncodingCpuHealth:this.context.statsCollector.videoCodecDegradationHighEncodeCpuDidReceive();break;case O.default.VideoEncodingFramerateHealth:this.context.statsCollector.videoCodecDegradationEncodeFailureDidReceive();break;case O.default.VideoConcurrentSendersHealth:this.context.statsCollector.videoCodecDegradationConcurrentSendersDidReceive()}});if(this.context.isSessionConnected){let publishFilteredEvent=o=>{var p;let f=L.audioVideoEventAttributesFromState(this.context);null==(p=this.context.eventController)||p.publishEvent(o,f)};this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,o,()=>publishFilteredEvent("sendingAudioFailed"),()=>publishFilteredEvent("sendingAudioRecovered"))}}applyHealthPolicy(o,p,f,m){o.update(p);let _=o.healthIfChanged();null!==_&&(this.logger.info(`${o.name} value is now ${_}`),_<=o.minimumHealth()?et.Maybe.of(f).map(o=>o.bind(this)()):et.Maybe.of(m).map(o=>o.bind(this)()))}handleBitrateFrame(o){this.currentAvailableStreamAvgBitrates=o,o.serverAvailableOutgoingBitrate>0&&(this.logger.info(`Received server side estimation of available incoming bitrate ${o.serverAvailableOutgoingBitrate}kbps`),this.context.statsCollector.overrideObservableMetric("availableIncomingBitrate",1e3*o.serverAvailableOutgoingBitrate))}handleSignalingClientEvent(o){var p;if(o.type===q.default.WebSocketClosed&&this.isUnexpectedsignalingCloseCode(o.closeCode)||o.type===q.default.WebSocketError||o.type===q.default.WebSocketFailed?(this.hasSignalingError||(null==(p=this.context.eventController)||p.publishEvent("signalingDropped",Object.assign(Object.assign(Object.assign(Object.assign({},L.audioVideoEventAttributesFromState(this.context)),void 0!==o.closeCode&&{signalingCloseCode:o.closeCode}),void 0!==o.closeReason&&{signalingCloseReason:o.closeReason}),void 0!==o.wasClean&&{signalingCloseWasClean:o.wasClean})),this.hasSignalingError=!0),this.context.isSessionConnected&&this.context.audioVideoController.handleMeetingSessionStatus(new B.default(this.isInternalServerFailureCloseCode(o.closeCode)?U.default.SignalingInternalServerError:U.default.SignalingChannelClosedUnexpectedly),null)):o.type===q.default.WebSocketOpen&&(this.hasSignalingError=!1),o.type===q.default.ReceivedSignalFrame){if(o.message.type===Z.SdkSignalFrame.Type.NOTIFICATION){switch(o.message.notification.level){case Z.SdkNotificationFrame.NotificationLevel.INFO:this.logger.info(`Received notification from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.WARNING:this.logger.warn(`Received warning from server: ${o.message.notification.message}`);break;case Z.SdkNotificationFrame.NotificationLevel.ERROR:this.logger.error(`Received error from server: ${o.message.notification.message}`);break;default:this.logger.error(`Received notification from server with unknown level ${o.message.notification.level}: ${o.message.notification.message}`)}return}if(o.message.bitrates){let p=o.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(p),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(o.message.bitrates)}let p=B.default.fromSignalFrame(o.message);o.message.type!==Z.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&p.statusCode()!==U.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(p,null)}}isUnexpectedsignalingCloseCode(o){return 1006===o||this.isInternalServerFailureCloseCode(o)}isInternalServerFailureCloseCode(o){return o>=4500&&o<4600}degradeVideoCodec(o){if(void 0!==this.context.meetingSupportedVideoSendCodecPreferences&&this.context.meetingSupportedVideoSendCodecPreferences.length>1&&!(this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.h264ConstrainedBaselineProfile())||this.context.meetingSupportedVideoSendCodecPreferences[0].equals($.default.vp8()))){let p=[];for(let o of this.context.videoSendCodecPreferences)o.equals(this.context.meetingSupportedVideoSendCodecPreferences[0])||p.push(o);p.length>0?(this.context.logger.info(`Downgrading codec from ${this.context.meetingSupportedVideoSendCodecPreferences[0].codecName} to ${p[0].codecName} due to ${o}`),this.context.degradedVideoSendCodecs.push(this.context.meetingSupportedVideoSendCodecPreferences[0]),this.context.meetingSupportedVideoSendCodecPreferences=p,this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),this.context.audioVideoController.update({needsRenegotiation:!0})):this.context.logger.warn(`Degrading video codec failed since there is no alternative codec to select. Currently degraded codecs: ${this.context.degradedVideoSendCodecs.map(o=>o.codecName).join(",")}`)}}}},0x253700aaf:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(o){}}},0x158630dfe:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x19a5566fd)),w=m(f(0x1158c4d3));p.default=class{constructor(o,p,f){this.logger=o,this.task=p,this.dependencies=f,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(let o of this.dependencies)o.cancel();this.logger.info(`Canceling ${this.name()}`),w.default.nextTick(()=>this.task.cancel()),this.canceled=!0,this.cancelPromise&&w.default.nextTick(()=>this.cancelPromise(Error(`canceling ${this.name()}`)))}}logDependencies(){if(this.logger.getLogLevel()>_.default.INFO||!this.dependencies)return;let o=this.dependencies.filter(o=>o).map(o=>o.name()).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${o}`)}run(){if(this.promise)return this.promise;let o=this.dependencies?Promise.all(this.dependencies.map(o=>null==o?void 0:o.run())):Promise.resolve();return this.logDependencies(),this.ongoing=o.then(()=>this.task.run()),this.promise=new Promise((o,p)=>{this.cancelPromise=p,this.ongoing.then(o).catch(p)})}setParent(o){this.task.setParent(o)}}},0xc8b2a6fb:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x296cfbc0)),I=_(f(0x216f98b8d)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new w.default(o.urls.signalingURL,o.credentials.joinToken));let p=Date.now();try{yield new Promise((o,p)=>{let f=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(f){switch(f.type){case I.default.WebSocketOpen:this.signalingClient.removeObserver(this),o();break;case I.default.WebSocketFailed:this.signalingClient.removeObserver(this),p(Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(f),this.taskCanceler=f})}catch(o){throw o}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-p),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}})}}},0x1a50cfb5:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunParallel=f,f))m.setParent(this)}cancel(){for(let o of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${o.name()}`),o.cancel()}run(){return m(this,void 0,void 0,function*(){let o=[];for(let p of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${p.name()}`),o.push(p.run());let p=[];for(let f=0;f0){let o=p.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${o}`)}this.logger.info(`parallel group task ${this.name()} completed`)})}}},0x8ef9a2fd:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1ec8c7574),I=_(f(0x216f98b8d)),k=f(0x252035ee7),M=_(f(0x113227692));p.default=class extends M.default{constructor(o,p,f){super(o.logger),this.context=o,this.credentials=p,this.completionCallback=f,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.ready()?(this.context.signalingClient.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed))})}receivePrimaryMeetingJoinAck(){return new Promise((o,p)=>{let f=new class{constructor(o,p,f){this.signalingClient=o,this.completionCallback=p,this.logger=f}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()}handleSignalingClientEvent(p){p.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new w.MeetingSessionStatus(w.MeetingSessionStatusCode.SignalingRequestFailed)),o()),p.type===I.default.ReceivedSignalFrame&&p.message.type===k.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(w.MeetingSessionStatus.fromSignalFrame(p.message)),o())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=f,this.context.signalingClient.registerObserver(f)})}}},0x26b16a9c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692));p.default=class extends w.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveAudioInputTask"}run(){var o,p;return m(this,void 0,void 0,function*(){let f;if(!(null==(p=null==(o=this.context.meetingSessionConfiguration)?void 0:o.urls)?void 0:p.audioHostURL))return void this.context.logger.info("No audio connection: not acquiring audio input");if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");try{f=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch{this.context.logger.warn("could not acquire audio input from current device")}f?this.context.activeAudioInput=f:this.context.logger.warn("an audio input is not available")})}}},0x141765a48:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x216f98b8d)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveRemoteVideoPauseResume",this.serverPausedVideoTileIds=new Set}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}updateSubscribedGroupdIds(o){let p=new Set;for(let f of o){let o=this.context.videoStreamIndex.attendeeIdForGroupId(f);if(0===o.length){this.logger.warn(`Could not find attendee ID for newly subscribed group ID ${f}`);continue}let m=this.context.videoTileController.getVideoTileForAttendeeId(o);void 0===m&&(this.logger.info(`No existing video tile for attendee ID ${o} with new group ID ${f}. Creating new one.`),(m=this.context.videoTileController.addVideoTile()).bindVideoStream(o,!1,null,0,0,0,null)),p.add(m.id())}this.serverPausedVideoTileIds.forEach(o=>{p.has(o)||this.serverPausedVideoTileIds.delete(o)})}handleSignalingClientEvent(o){if(o.type!==w.default.ReceivedSignalFrame||o.message.type!==I.SdkSignalFrame.Type.PAUSE&&o.message.type!==I.SdkSignalFrame.Type.RESUME)return;let p=o.message.pause,f=o.message.type;if(this.logger.info(`Received new ${f===I.SdkSignalFrame.Type.PAUSE?"pause":"resume"} frame: ${JSON.stringify(p)}`),p&&void 0!==this.context.videoTileController.getVideoTileForAttendeeId&&void 0!==this.context.videoDownlinkBandwidthPolicy.forEachObserver&&void 0!==this.context.videoStreamIndex.attendeeIdForGroupId)for(let o of p.groupIds.map(o=>{let p=this.context.videoStreamIndex.attendeeIdForGroupId(o);return 0===p.length?void this.logger.warn(`Could not find attendee ID for paused group ID ${o}`):this.context.videoTileController.getVideoTileForAttendeeId(p)}))void 0!==o&&(f===I.SdkSignalFrame.Type.PAUSE?o.state().paused||(this.serverPausedVideoTileIds.add(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause()):o.state().paused&&this.serverPausedVideoTileIds.has(o.id())&&(this.serverPausedVideoTileIds.delete(o.id()),this.context.videoDownlinkBandwidthPolicy.forEachObserver(p=>{p.tileWillBeUnpausedByDownlinkPolicy(o.id())}),o.unpause()))}}},0x117aaca57:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x230534cc6)),I=f(0x252035ee7),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoInputTask"}checkAndApplyVideoConstraint(o,p,f,_,w){return m(this,void 0,void 0,function*(){let m=o?this.context.meetingSessionConfiguration.meetingFeatures.contentMaxResolution:this.context.meetingSessionConfiguration.meetingFeatures.videoMaxResolution;if(!o&&f<=m.videoWidth&&_<=m.videoHeight&&w<=m.videoFrameRate)return;let I={resizeMode:{ideal:"none"},width:{max:m.videoWidth},height:{max:m.videoHeight},frameRate:{ideal:w,max:m.videoFrameRate}};try{yield p.applyConstraints(I)}catch{this.context.logger.info(`Could not apply constraint for video track (content = ${o})`)}})}run(){return m(this,void 0,void 0,function*(){let o,p=this.context.videoDuplexMode===I.SdkStreamServiceType.RX||this.context.videoDuplexMode===I.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=p?I.SdkStreamServiceType.DUPLEX:I.SdkStreamServiceType.TX:this.context.videoDuplexMode=p?I.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile()){this.context.logger.info("has not started local video tile"),this.context.activeVideoInput&&(this.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([]));return}let f=this.context.videoTileController.getLocalVideoTile();try{o=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch{this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){let o=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(o.values()))}if(this.context.activeVideoInput=o,o){let p=o.getVideoTracks();if(!p||0===p.length)return;let m=this.context.meetingSessionConfiguration.credentials.attendeeId,_=new w.default(m).hasModality(w.default.MODALITY_CONTENT),I=p[0].getSettings();this.checkAndApplyVideoConstraint(_,p[0],I.width,I.height,I.frameRate);let k=this.context.audioVideoController.configuration.credentials.externalUserId;for(let _ of(f.bindVideoStream(m,!0,o,I.width,I.height,null,k),p))this.logger.info(`Using video device label=${_.label} id=${_.id}`),this.context.videoDeviceInformation.current_camera_name=_.label,this.context.videoDeviceInformation.current_camera_id=_.id}})}}},0x13a00d587:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1d61c1795)),I=_(f(0x230534cc6)),k=_(f(0x178bce6ff)),M=_(f(0x216f98b8d)),x=f(0x252035ee7),O=f(0xab1ef933),L=_(f(0x113227692));p.default=class extends L.default{constructor(o){super(o.logger),this.context=o,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return m(this,void 0,void 0,function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)})}handleSignalingClientEvent(o){if(o.type!==M.default.ReceivedSignalFrame||o.message.type!==x.SdkSignalFrame.Type.INDEX)return;let p=o.message.index;this.context.logger.info(`received new index ${JSON.stringify(p)}`),this.handleIndexFrame(p)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(o){if(!o)return;if(this.isIngestionPaused){this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),this.pendingIndex=o;return}this.pendingIndex=null;let p=this.context.audioVideoController.configuration.credentials.attendeeId;o.sources=o.sources.filter(o=>{let f=new I.default(o.attendeeId);return!(f.base()===p&&f.hasModality(I.default.MODALITY_CONTENT))});let{videoStreamIndex:f,videoDownlinkBandwidthPolicy:m,videoUplinkBandwidthPolicy:_}=this.context,w=f.allVideoSendingSourcesExcludingSelf(p);f.integrateIndexFrame(o),m.updateIndex(f),_.updateIndex(f),this.resubscribe(m,_),this.updateVideoAvailability(o),this.handleIndexVideosPausedAtSource(),o.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(o);let k=f.allVideoSendingSourcesExcludingSelf(p);this.areVideoSourcesEqual(w,k)||this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.remoteVideoSourcesDidChange).map(p=>p.bind(o)(k))})}areVideoSourcesEqual(o,p){if(o.length!==p.length)return!1;let compare=(o,p)=>o.attendee.attendeeId.localeCompare(p.attendee.attendeeId),f=[...o].sort(compare),m=[...p].sort(compare);for(let o=0;othis.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=p.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${m} down=${f}; videosToReceive=[${this.context.videosToReceive.array()}] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(o){if(!this.context.videosToReceive)return void this.logger.error("videosToReceive must be set in the meeting context.");let p=new w.default;p.remoteVideoAvailable=!this.context.videosToReceive.empty(),p.canStartLocalVideo=!o.atCapacity,this.context.lastKnownVideoAvailability&&this.context.lastKnownVideoAvailability.equal(p)||(this.context.lastKnownVideoAvailability=p.clone(),this.context.audioVideoController.forEachObserver(o=>{O.Maybe.of(o.videoAvailabilityDidChange).map(f=>f.bind(o)(p.clone()))}))}handleSupportedVideoReceiveCodecIntersection(o){if(void 0===this.context.videoSendCodecPreferences)return;let p=[],f=!1;for(let f of this.context.videoSendCodecPreferences){if(this.context.degradedVideoSendCodecs.some(o=>f.equals(o))){this.logger.info(`Skipping ${f.codecName} since the codec has been identfied as degraded`);continue}for(let m of o.supportedReceiveCodecIntersection)if(f.equals(k.default.fromSignaled(m))){p.push(f);break}}if(p.length>0){let o=p.find(o=>this.context.prioritizedSendVideoCodecCapabilities.some(p=>o.equals(p)));void 0===this.context.currentVideoSendCodec||void 0!==o&&this.context.currentVideoSendCodec.equals(o)||(f=!0),this.context.meetingSupportedVideoSendCodecPreferences=p}else this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0;this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs&&this.context.videoUplinkBandwidthPolicy.setMeetingSupportedVideoSendCodecs(this.context.meetingSupportedVideoSendCodecPreferences,this.context.videoSendCodecPreferences),f&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){let o=this.context.videoStreamIndex.streamsPausedAtSource();for(let p of this.context.videoTileController.getAllVideoTiles()){let f=p.state();o.contain(f.streamId)?p.markPoorConnection()&&this.logger.info(`marks the tile ${f.tileId} as having a poor connection`):p.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${f.tileId} as having a poor connection`)}}}},0x13eb8065e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x113227692));p.default=class extends _.default{constructor(o,p,f="RunnableTask"){super(o),this.fn=p,this.taskName=f}run(){return this.fn().then(()=>{})}}},0x164fd248f:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x200be574b)),I=_(f(0x216f98b8d)),k=f(0x252035ee7),M=_(f(0x113227692)),x=class SendAndReceiveDataMessagesTask extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(o,p,f)=>{if(this.context.signalingClient.ready()){let m;m=p instanceof Uint8Array?p:"string"==typeof p?new TextEncoder().encode(p):new TextEncoder().encode(JSON.stringify(p)),this.validateDataMessage(o,m,f);let _=k.SdkDataMessagePayload.create();_.topic=o,_.lifetimeMs=f,_.data=m;let w=k.SdkDataMessageFrame.create();w.messages=[_],this.context.signalingClient.sendDataMessage(w)}else this.context.logger.error("Cannot send data message because signaling client is not ready")}}run(){return m(this,void 0,void 0,function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)})}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(o){if(o.type===I.default.ReceivedSignalFrame&&o.message.type===k.SdkSignalFrame.Type.DATA_MESSAGE)for(let p of o.message.dataMessage.messages){let o=new w.default(p.ingestTimeNs/1e6,p.topic,p.data,p.senderAttendeeId,p.senderExternalUserId,0===p.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(o)}}validateDataMessage(o,p,f){if(!SendAndReceiveDataMessagesTask.TOPIC_REGEX.test(o))throw Error("Invalid topic");if(p.length>SendAndReceiveDataMessagesTask.DATA_SIZE)throw Error("Data size has to be less than 2048 bytes");if(f&&f<0)throw Error("The life time of the message has to be non negative")}};p.default=x,x.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),x.DATA_SIZE=2048},0x11bbef2ec:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x113227692)),I=_(f(0xe2814d21));p.default=class extends w.default{constructor(o,p,f){for(const m of(super(o),this.taskName=p,this.tasksToRunSerially=f,this.currentTask=null,f))m.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return m(this,void 0,void 0,function*(){for(let o of this.tasksToRunSerially){this.getStatus()===I.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${o.name()}`),this.currentTask=o,yield o.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${o.name()}`)}catch(o){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${o.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)})}}},0x23693b9e4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x1a20e50ff)),k=_(f(0x113227692));p.default=class extends k.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.peer,p=this.context.sdpOfferInit.sdp;if(this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(p=new I.default(p).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),this.context.browserBehavior.supportsDependencyDescriptorRtpHeaderExtension()&&void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()&&(p=new I.default(p).withDependencyDescriptorRtpHeaderExtension(this.context.previousSdpOffer).sdp),new w.default().requiresDisablingH264Encoding()&&(p=new I.default(p).removeH264SupportFromSendSection().sdp),p=new I.default(p).withStartingVideoSendBitrate(1e3).sdp,void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp),this.context.audioProfile.hasRedundancyEnabled())){let o=new I.default(p).getAudioPayloadTypes();this.context.transceiverController&&this.context.transceiverController.setAudioPayloadTypes&&this.context.transceiverController.setAudioPayloadTypes(o)}this.logger.debug(()=>`local description is >>>${p}<<<`);let f={type:"offer",sdp:p,toJSON:null};yield new Promise((p,_)=>m(this,void 0,void 0,function*(){this.cancelPromise=o=>{_(o)};try{yield o.setLocalDescription(f),p()}catch(o){_(o)}finally{delete this.cancelPromise}})),this.context.logger.info("set local description")})}}},0x1c9808277:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x230534cc6)),I=_(f(0x1a20e50ff)),k=_(f(0x178bce6ff)),M=_(f(0x113227692));p.default=class extends M.default{constructor(o){super(o.logger),this.context=o,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){var o;return m(this,void 0,void 0,function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let p=this.context.sdpAnswer;p=new I.default(p).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(p=new I.default(p).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(p=new I.default(p).withStereoAudio().sdp)),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(p=new I.default(p).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.prioritizedSendVideoCodecCapabilities=new I.default(p).prioritizedSendVideoCodecCapabilities(),this.context.currentVideoSendCodec=this.context.prioritizedSendVideoCodecCapabilities.length>0?this.context.prioritizedSendVideoCodecCapabilities[0]:void 0;let f=this.context.activeVideoInput;if(void 0!==f){let p=this.context.audioVideoController.configuration.credentials.attendeeId,m=new w.default(p).hasModality(w.default.MODALITY_CONTENT),_=f.getVideoTracks()[0];m&&((null==(o=this.context.currentVideoSendCodec)?void 0:o.codecName)===k.default.av1Main().codecName?(_.contentHint="text",this.logger.info(`Setting content hint to text for AV1, attendee: ${p}`)):this.context.audioVideoController.configuration.enableSVC&&(_.contentHint="motion",this.logger.info(`Setting content hint to motion to enable SVC, attendee: ${p}`)))}this.logger.info(`processed remote description is >>>${p}<<<`);let m={type:"answer",sdp:p,toJSON:null};try{yield this.createICEConnectionCompletedPromise(m)}catch(o){throw o}})}createICEConnectionCompletedPromise(o){return new Promise((p,f)=>m(this,void 0,void 0,function*(){let checkConnectionCompleted=()=>{("connected"===this.context.peer.iceConnectionState||"completed"===this.context.peer.iceConnectionState)&&(this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),p())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",checkConnectionCompleted),f(Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",checkConnectionCompleted);try{yield this.context.peer.setRemoteDescription(o),this.logger.info("set remote description, waiting for ICE connection"),checkConnectionCompleted()}catch(o){f(o)}}))}}},0x22ef5bfc:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x194415c85)),I=_(f(0x11a9e868)),k=_(f(0x1a20e50ff)),M=_(f(0x1728c2fdd)),x=f(0xf8b13aac),O=_(f(0x216f98b8d)),L=_(f(0x49608f19)),B=f(0x252035ee7),U=f(0xb8e111a8),$=_(f(0x113227692));p.default=class extends $.default{constructor(o){super(o.logger),this.context=o,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new M.default(o.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return m(this,void 0,void 0,function*(){let o,p="";if(this.context.peer&&this.context.peer.localDescription&&(p=new k.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp),!this.context.enableSimulcast){let o=0,p=0;this.context.videoCaptureAndEncodeParameter&&(o=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),p=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);let f={rid:"hi",maxBitrate:1e3*p,maxFramerate:o,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([f])}let f=this.fixUpSubscriptionOrder(p,this.context.videoSubscriptions),m=this.context.videoDuplexMode===B.SdkStreamServiceType.TX||this.context.videoDuplexMode===B.SdkStreamServiceType.DUPLEX,_=p;if(void 0!==this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension&&this.context.videoUplinkBandwidthPolicy.wantsVideoDependencyDescriptorRtpHeaderExtension()||(_=new k.default(_).withoutDependencyDescriptorRtpHeaderExtension().sdp),this.context.serverSupportsCompression){let f=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";o=this.textCompressor.compress(_,f),this.context.logger.info(`Compressed the SDP message from ${_.length} to ${o.length} bytes.`),p=""}this.context.previousSdpOffer=new k.default(p);let w=new L.default(this.context.meetingSessionConfiguration.credentials.attendeeId,p,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,f,m,this.context.videoStreamIndex.localStreamDescriptions(),!0,o);void 0===this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption||x.serverSideNetworkAdaptionIsNoneOrDefault(this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())||void 0===this.context.videoDownlinkBandwidthPolicy.getVideoPreferences||(w.videoSubscriptionConfiguration=U.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(this.context,f.map(o=>0===o?0:this.context.videoStreamIndex.groupIdForStreamId(o)),this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(w)}`),this.context.signalingClient.subscribe(w);let I=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(I)}`);let M="";I.compressedSdpAnswer&&I.compressedSdpAnswer.length?(0===(M=this.textCompressor.decompress(I.compressedSdpAnswer,this.context.previousSdpAnswerAsString)).length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${I.compressedSdpAnswer.length} to ${M.length} bytes.`),this.context.sdpAnswer=M):this.context.sdpAnswer=I.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(I)})}fixUpSubscriptionOrder(o,p){if(void 0===this.context.transceiverController.getMidForStreamId)return p;let f=new Map;for(let o of p){let p=this.context.transceiverController.getMidForStreamId(o);if(void 0===p){0!==o&&this.logger.warn(`Could not find MID for stream ID: ${o}`);continue}f.set(p,o)}let m=new k.default(o).mediaSections(),_=[];for(let o of m)if("video"===o.mediaType)if("recvonly"===o.direction){let p=f.get(o.mid);if(void 0===p){this.logger.warn(`Could not find stream ID for MID: ${o.mid}`);continue}_.push(p)}else _.push(0);return this.logger.info(`Fixed up ${JSON.stringify(p)} to ${JSON.stringify(_)} (may be same))}`),_}receiveSubscribeAck(){return new Promise((o,p)=>{let f=this.context,m=new class{constructor(o){this.signalingClient=o}cancel(){this.signalingClient.removeObserver(this),p(Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(p){if(p.isConnectionTerminated()){let o=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${p.closeCode} and reason: ${p.closeReason}`;f.logger.warn(o);let m=I.default.TaskFailed;p.closeCode>=4500&&p.closeCode<4600&&(m=I.default.SignalingInternalServerError),f.audioVideoController.handleMeetingSessionStatus(new w.default(m),Error(o));return}p.type!==O.default.ReceivedSignalFrame||p.message.type!==B.SdkSignalFrame.Type.SUBSCRIBE_ACK||(this.signalingClient.removeObserver(this),o(p.message.suback))}}(this.context.signalingClient);this.context.signalingClient.registerObserver(m),this.taskCanceler=m})}}},0xe2814d21:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).IDLE="IDLE",m.RUNNING="RUNNING",m.CANCELED="CANCELED",m.FINISHED="FINISHED",p.default=f},0xe6d64708:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0xa9a27686)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o,p,f){super(o),this.taskToRunBeforeTimeout=p,this.timeoutMs=f,this.taskName=`Timeout${this.timeoutMs}ms`,p.setParent(this)}cancel(){this.logger.info(`canceling timeout task ${this.name()} subtask ${this.taskToRunBeforeTimeout}`),this.taskToRunBeforeTimeout.cancel()}run(){return m(this,void 0,void 0,function*(){let o=new w.default(this.timeoutMs);o.start(()=>{this.logger.info(`timeout reached for task ${this.name()}`),this.taskToRunBeforeTimeout.cancel()});try{yield this.taskToRunBeforeTimeout.run()}finally{o.stop()}this.logger.info(`timeout task ${this.name()} completed`)})}}},0x112462f64:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x11a9e868)),I=_(f(0x113227692));p.default=class extends I.default{constructor(o){super(o.logger),this.context=o,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){let o=Error(`canceling ${this.name()} due to the meeting status code: ${w.default.NoAttendeePresent}`);this.cancelPromise(o),delete this.cancelPromise}}run(){return m(this,void 0,void 0,function*(){let o=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise((p,f)=>{let handler=(f,m,_,w,I)=>{o===f&&m&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),p(),delete this.cancelPromise)};this.cancelPromise=o=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(handler),f(o)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)})})}}},0x238ca30a:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x1be31fc8b)),I=_(f(0x15a1c7c16)),k=_(f(0x12d2b358b)),M=_(f(0x118a80d5b)),x=_(f(0x1158c4d3));p.default=class{constructor(o,p,f){this.logger=o,this.browserBehavior=p,this.meetingSessionContext=f,this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null,this.streamIdToTransceiver=new Map,this.groupIdToTransceiver=new Map,this.audioRedWorker=null,this.audioRedWorkerURL=null,this.audioMetricsHistory=[],this.redMetricsObservers=new Set,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.maxAudioMetricsHistory=20,this.audioRedPacketLossShortEvalPeriodMs=5e3,this.audioRedPacketLossLongEvalPeriodMs=15e3,this.audioRedHoldDownTimeMs=3e5,this.redRecoveryTimeMs=6e4,this.handleTrack=o=>{let p=!!window.RTCRtpScriptTransform;this.audioRedWorker&&p&&(o.receiver.transform||(this.logger.info(`Applying passthrough transform to receiver track ${o.track.id} not set after addTranceiver`),o.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"})))}}setEncodingParameters(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!o||0===o.size)return;let f=Array.from(o.values()),m=p.getParameters();if(m.encodings&&0!==m.encodings.length)for(let o of m.encodings)for(let p of f){let f;if(!o.rid&&!p.rid||o.rid===p.rid)for(f in p)"rid"!==f&&"codecPayloadType"!==f&&p.hasOwnProperty(f)&&(o[f]=p[f])}else m.encodings=f;yield p.setParameters(m)})}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(o){return m(this,void 0,void 0,function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;let p=this._localCameraTransceiver.sender;if(!p||o<=0)return;let f=p.getParameters();for(let p of(f.encodings||(f.encodings=[{}]),f.encodings))p.maxBitrate=1e3*o;yield p.setParameters(f)})}setPeer(o){this.peer=o,this.peer.addEventListener("track",this.handleTrack)}reset(){this.destroyAudioRedWorkerAndStates(),this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer&&this.peer.removeEventListener("track",this.handleTrack),this.peer=null}useTransceivers(){return!!this.peer&&void 0!==this.peer.getTransceivers}hasVideoInput(){return!!this._localCameraTransceiver&&"sendrecv"===this._localCameraTransceiver.direction}trackIsVideoInput(o){return!!this._localCameraTransceiver&&(o===this._localCameraTransceiver.sender.track||o===this._localCameraTransceiver.receiver.track)}setupLocalTransceivers(){var o,p;this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),this._localCameraTransceiver||(this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(o){return m(this,void 0,void 0,function*(){return this._localAudioTransceiver&&"sendrecv"===this._localAudioTransceiver.direction?(yield this._localAudioTransceiver.sender.replaceTrack(o),!0):(this.logger.info("audio transceiver direction is not set up or not activated"),!1)})}setAudioInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localAudioTransceiver,o)})}setVideoInput(o){return m(this,void 0,void 0,function*(){yield this.setTransceiverInput(this._localCameraTransceiver,o)})}updateVideoTransceivers(o,p){if(!this.useTransceivers())return p.array();let f=this.peer.getTransceivers();return this.videoSubscriptions=[0],p=p.clone(),this.updateTransceivers(f,o,p),this.logger.debug(()=>this.debugDumpTransceivers()),this.videoSubscriptions}updateTransceivers(o,p,f){let m=f.array();for(let f of(0===o.length||o[0].stop?0!==o.length&&this.updateTransceiverWithStop(o,p,m):(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(o,p,m)),m)){let o=this.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(f,o),this.groupIdToTransceiver.set(p.groupIdForStreamId(f),o),this.videoSubscriptions.push(f),this.logger.info(`adding transceiver mid: ${o.mid} subscription: ${f} direction: recvonly`)}}updateTransceiverWithStop(o,p,f){let m=1;for(let _ of(this.videoSubscriptions=[0],o)){if(_===this._localCameraTransceiver||!this.transceiverIsVideo(_)||!_.mid)continue;let o=!1,w=p.streamIdForTrack("v_"+_.mid);if("inactive"!==_.direction&&void 0!==w){for(let[I,k]of f.entries())if(p.StreamIdsInSameGroup(w,k)){_.direction="recvonly",this.videoSubscriptions[m]=k,o=!0,this.streamIdToTransceiver.delete(w),this.streamIdToTransceiver.set(k,_),f.splice(I,1);break}}if(!o)for(let[o,f]of(this.videoSubscriptions[m]=0,this.logger.info(`Stopping MID: ${_.mid}, direction: ${_.direction}, current direction: ${_.currentDirection}`),_.stop(),this.streamIdToTransceiver.entries()))_.mid===f.mid&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}updateTransceiverWithoutStop(o,p,f){let m=1;for(let _ of o)if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if(this.videoSubscriptions[m]=0,"inactive"!==_.direction){let o=p.streamIdForTrack("v_"+_.mid);if(void 0!==o){for(let[w,I]of f.entries())if(p.StreamIdsInSameGroup(o,I)){_.direction="recvonly",this.videoSubscriptions[m]=I,this.streamIdToTransceiver.delete(o),this.streamIdToTransceiver.set(I,_),f.splice(w,1);break}}}m+=1}for(let _ of(m=1,o))if(_!==this._localCameraTransceiver&&this.transceiverIsVideo(_)){if("inactive"===_.direction&&f.length>0){_.direction="recvonly";let o=f.shift();this.videoSubscriptions[m]=o,this.streamIdToTransceiver.set(o,_),this.groupIdToTransceiver.set(p.groupIdForStreamId(o),_)}else if(0===this.videoSubscriptions[m])for(let[o,f]of(_.direction="inactive",this.streamIdToTransceiver.entries()))_===f&&(this.streamIdToTransceiver.delete(o),this.groupIdToTransceiver.delete(p.groupIdForStreamId(o)));m+=1}}getMidForStreamId(o){var p;return null==(p=this.streamIdToTransceiver.get(o))?void 0:p.mid}setStreamIdForMid(o,p){for(let[f,m]of this.streamIdToTransceiver.entries())if(m.mid===o){this.streamIdToTransceiver.delete(f),this.streamIdToTransceiver.set(p,m);return}}getMidForGroupId(o){var p,f;return null!=(f=null==(p=this.groupIdToTransceiver.get(o))?void 0:p.mid)?f:void 0}transceiverIsVideo(o){return o.receiver&&o.receiver.track&&"video"===o.receiver.track.kind||o.sender&&o.sender.track&&"video"===o.sender.track.kind}debugDumpTransceivers(){let o="",p=0;for(let f of this.peer.getTransceivers())this.transceiverIsVideo(f)&&(o+=`transceiver index=${p} mid=${f.mid} subscription=${this.videoSubscriptions[p]} direction=${f.direction}
`,p+=1);return o}setTransceiverInput(o,p){return m(this,void 0,void 0,function*(){o&&(p?o.direction="sendrecv":o.direction="inactive",yield o.sender.replaceTrack(p))})}forEachRedMetricsObserver(o){for(let p of this.redMetricsObservers)x.default.nextTick(()=>{this.redMetricsObservers.has(p)&&p.recoveryMetricsDidReceive(o)})}disableAudioRedundancy(){this.meetingSessionContext.audioProfile=new w.default(this.meetingSessionContext.audioProfile.audioBitrateBps,!1),this.meetingSessionContext.audioVideoController.setAudioProfile(this.meetingSessionContext.audioProfile)}setupAudioRedWorker(){var o,p;let f=!!window.RTCRtpScriptTransform,m=!!RTCRtpSender.prototype.createEncodedStreams;if(f)this.logger.info("[AudioRed] Supports encoded insertable streams using RTCRtpScriptTransform");else if(m)this.logger.info("[AudioRed] Supports encoded insertable streams using TransformStream");else throw this.disableAudioRedundancy(),Error("[AudioRed] Encoded insertable streams not supported. Recreating peer connection with audio redundancy disabled.");try{this.audioRedWorkerURL=URL.createObjectURL(new Blob([M.default],{type:"application/javascript"})),this.logger.info(`[AudioRed] Redundant audio worker URL ${this.audioRedWorkerURL}`),this.audioRedWorker=new Worker(this.audioRedWorkerURL)}catch(o){throw this.logger.error(`[AudioRed] Unable to create audio red worker due to ${o}`),URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker=null,this.disableAudioRedundancy(),this.logger.info("[AudioRed] Recreating peer connection with audio redundancy disabled"),o}if(this.audioRedEnabled=!0,this.audioRedWorker.onmessage=o=>{if("REDWorkerLog"===o.data.type)this.logger.info(o.data.log);else if("RedundantAudioEncoderStats"===o.data.type){let p=new I.default;p.currentTimestampMs=Date.now(),p.ssrc=o.data.ssrc,p.totalAudioPacketsLost=o.data.totalAudioPacketsLost,p.totalAudioPacketsExpected=o.data.totalAudioPacketsExpected,p.totalAudioPacketsRecoveredRed=o.data.totalAudioPacketsRecoveredRed,p.totalAudioPacketsRecoveredFec=o.data.totalAudioPacketsRecoveredFec,this.forEachRedMetricsObserver(p)}},f)this._localAudioTransceiver.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"SenderTransform"}),this._localAudioTransceiver.receiver.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"ReceiverTransform"});else if(m){let o=this._localAudioTransceiver.sender.createEncodedStreams(),p=this._localAudioTransceiver.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"StartRedWorker",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}null==(o=this.meetingSessionContext)||o.audioVideoController.addObserver(this),this.addRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector)}addTransceiver(o,p){var f;let m=this.peer.addTransceiver(o,p);if(!this.audioRedWorker)return m;let _=!!window.RTCRtpScriptTransform,w=!!RTCRtpSender.prototype.createEncodedStreams;if(_)"recvonly"!==p.direction&&(m.sender.transform=new RTCRtpScriptTransform(this.audioRedWorker,{type:"PassthroughTransform"}));else if(w){if(!(null==(f=this.peer.getConfiguration())?void 0:f.encodedInsertableStreams))return m;let o=m.sender.createEncodedStreams(),p=m.receiver.createEncodedStreams();this.audioRedWorker.postMessage({msgType:"PassthroughTransform",send:o,receive:p},[o.readable,o.writable,p.readable,p.writable])}return m}destroyAudioRedWorkerAndStates(){var o,p;this.audioRedWorker&&(URL.revokeObjectURL(this.audioRedWorkerURL),this.audioRedWorkerURL=null,this.audioRedWorker.terminate(),this.audioRedWorker=null,this.currentNumRedundantEncodings=0,this.lastRedHolddownTimerStartTimestampMs=0,this.lastAudioRedTurnOffTimestampMs=0,this.lastHighPacketLossEventTimestampMs=0,this.audioRedEnabled=!0,null==(o=this.meetingSessionContext)||o.audioVideoController.removeObserver(this),this.removeRedundantAudioRecoveryMetricsObserver(null==(p=this.meetingSessionContext)?void 0:p.statsCollector))}setAudioPayloadTypes(o){this.audioRedWorker&&(this.audioRedWorker.postMessage({msgType:"RedPayloadType",payloadType:o.get("red")}),this.audioRedWorker.postMessage({msgType:"OpusPayloadType",payloadType:o.get("opus")}))}metricsDidReceive(o){let{currentTimestampMs:p}=o,f=o.getRTCStatsReport(),m=0,_=0,w=0;f.forEach(o=>{"audio"===o.kind&&("outbound-rtp"===o.type?_=o.packetsSent:"remote-inbound-rtp"===o.type&&(m=o.timestamp,w=o.packetsLost))}),(0===this.audioMetricsHistory.length||m>this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs&&_>this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent)&&this.audioMetricsHistory.push({timestampMs:m,totalPacketsSent:_,totalPacketsLost:w}),this.audioMetricsHistory.length>this.maxAudioMetricsHistory&&this.audioMetricsHistory.shift();let I=Math.max(this.lossPercent(this.audioRedPacketLossShortEvalPeriodMs),this.lossPercent(this.audioRedPacketLossLongEvalPeriodMs)),[M,x]=k.default.getNumRedundantEncodingsForPacketLoss(I);if(x){this.lastHighPacketLossEventTimestampMs=p,this.audioRedEnabled&&(this.audioRedWorker&&this.audioRedWorker.postMessage({msgType:"Disable"}),this.audioRedEnabled=!1,this.lastAudioRedTurnOffTimestampMs=p);return}if(!this.audioRedEnabled){let o=p-this.lastAudioRedTurnOffTimestampMs,f=p-this.lastHighPacketLossEventTimestampMs;if(o>=this.audioRedPacketLossLongEvalPeriodMs&&f0&&(this.lastRedHolddownTimerStartTimestampMs=o)}lossPercent(o){if(this.audioMetricsHistory.length<2)return 0;let p=this.audioMetricsHistory[this.audioMetricsHistory.length-1].timestampMs,f=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsSent,m=this.audioMetricsHistory[this.audioMetricsHistory.length-1].totalPacketsLost;for(let _=this.audioMetricsHistory.length-2;_>=0;_--)if(p-this.audioMetricsHistory[_].timestampMs>=o)return Math.max(0,Math.min((m-this.audioMetricsHistory[_].totalPacketsLost)/(f-this.audioMetricsHistory[_].totalPacketsSent)*100,100));return 0}shouldUpdateAudioRedWorkerEncodings(o,p){return this.currentNumRedundantEncodings===p?(this.maybeResetHoldDownTimer(o),!1):(!(ptypeof MediaStream&&(this.defaultMediaStream=new MediaStream),!this._localAudioTransceiver&&(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]}),(null==(p=null==(o=this.meetingSessionContext)?void 0:o.audioProfile)?void 0:p.hasRedundancyEnabled())&&this.setupAudioRedWorker()),!this._localCameraTransceiver)){let o=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:o})}}logVideoTransceiverParameters(){let o=this._localCameraTransceiver.sender.getParameters().encodings,p=`simulcast: current encoding parameters
`;for(let f of o)p+=`rid=${f.rid} maxBitrate=${f.maxBitrate} active=${f.active} scaleDownBy=${f.scaleResolutionDownBy} maxFrameRate = ${f.maxFramerate}
`;this.logger.info(p)}copyEncodingParams(o,p){p.active=o.active,p.maxBitrate=o.maxBitrate,p.scaleResolutionDownBy=o.scaleResolutionDownBy,p.maxFramerate=o.maxFramerate}};p.default=I,I.LOW_LEVEL_NAME="low",I.MID_LEVEL_NAME="mid",I.HIGH_LEVEL_NAME="hi",I.NAME_ARR_ASCENDING=["low","mid","hi"],I.BITRATE_ARR_ASCENDING=[200,400,1100]},0x72848aa:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x238ca30a));p.default=class extends _.default{constructor(o,p,f){super(o,p,f)}setupLocalTransceivers(){this.useTransceivers()&&(!this.defaultMediaStream&&"u">typeof MediaStream&&(this.defaultMediaStream=new MediaStream),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}}},0xf16d9918:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;let m=f(0x167d8cb53);p.TRANSCRIPTION_DATA_MESSAGE_TOPIC="aws:chime:transcription";let _=class{constructor(o){this.realtimeController=o,this.transcriptEventCallbacks=new Set}subscribeToTranscriptEvent(o){0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeSubscribeToReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC,o=>{for(let p of m.TranscriptEventConverter.from(o))for(let o of this.transcriptEventCallbacks)o(p)}),this.transcriptEventCallbacks.add(o)}unsubscribeFromTranscriptEvent(o){this.transcriptEventCallbacks.delete(o),0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(p.TRANSCRIPTION_DATA_MESSAGE_TOPIC)}};p.default=_},0x6bcf7aed:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x235b3b0dc:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x10dd4ac72:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x167d8cb53:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.TranscriptEventConverter=void 0;let _=f(0x252035ee7),w=m(f(0x6bcf7aed)),I=m(f(0x1b8f962c3)),k=m(f(0x251900acb)),M=m(f(0x22ea8d802)),x={[_.SdkTranscriptionStatus.Type.STARTED]:k.default.STARTED,[_.SdkTranscriptionStatus.Type.INTERRUPTED]:k.default.INTERRUPTED,[_.SdkTranscriptionStatus.Type.RESUMED]:k.default.RESUMED,[_.SdkTranscriptionStatus.Type.STOPPED]:k.default.STOPPED,[_.SdkTranscriptionStatus.Type.FAILED]:k.default.FAILED};p.TranscriptEventConverter=class{static from(o){let p;try{p=_.SdkTranscriptFrame.decode(o.data)}catch(o){throw Error("Cannot decode transcript data message: "+o)}let f=[];for(let o of p.events)if(o.status){let p=x[o.status.type];if(!p)continue;let m=new I.default;m.type=p,m.eventTimeMs=o.status.eventTime,m.transcriptionRegion=o.status.transcriptionRegion,m.transcriptionConfiguration=o.status.transcriptionConfiguration,o.status.message&&(m.message=o.status.message),f.push(m)}else if(o.transcript){let p=new w.default;for(let f of(p.results=[],o.transcript.results)){let o={channelId:f.channelId,isPartial:f.isPartial,resultId:f.resultId,startTimeMs:f.startTime,endTimeMs:f.endTime,alternatives:[]};if(f.languageCode&&(o.languageCode=f.languageCode),f.languageIdentification&&f.languageIdentification.length>0)for(let p of(o.languageIdentification=[],f.languageIdentification)){let f={languageCode:p.languageCode,score:p.score};o.languageIdentification.push(f)}for(let p of f.alternatives){let f={items:[],transcript:p.transcript};for(let o of p.items){let p={content:o.content,attendee:{attendeeId:o.speakerAttendeeId,externalUserId:o.speakerExternalUserId},startTimeMs:o.startTime,endTimeMs:o.endTime,type:null};switch(o.vocabularyFilterMatch&&(p.vocabularyFilterMatch=o.vocabularyFilterMatch),o.hasOwnProperty("stable")&&(p.stable=o.stable),o.hasOwnProperty("confidence")&&(p.confidence=o.confidence),o.type){case _.SdkTranscriptItem.Type.PRONUNCIATION:p.type=M.default.PRONUNCIATION;break;case _.SdkTranscriptItem.Type.PUNCTUATION:p.type=M.default.PUNCTUATION}f.items.push(p)}for(let o of p.entities){f.entities||(f.entities=[]);let p={category:o.category,confidence:o.confidence,content:o.content,startTimeMs:o.startTime,endTimeMs:o.endTime};o.type&&(p.type=o.type),f.entities.push(p)}o.alternatives.push(f)}p.results.push(o)}f.push(p)}return f}}},0x1b6467fba:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x22ea8d802:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).PRONUNCIATION="pronunciation",m.PUNCTUATION="punctuation",p.default=f},0x176167e03:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x147bf1250:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x1b8f962c3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x251900acb:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).STARTED="started",m.INTERRUPTED="interrupted",m.RESUMED="resumed",m.STOPPED="stopped",m.FAILED="failed",p.default=f},0x19f971fd8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x2056040c6),w=m(f(0x22a0f7c69)),I=class DefaultUserAgentParser{constructor(o){var p,f,m,w,I,k,M;try{this.parserResult=navigator&&navigator.userAgent?new _.UAParser(navigator.userAgent).getResult():void 0}catch(p){o.error(p.message)}this.browserMajorVersion=(null==(m=null==(f=null==(p=this.parserResult)?void 0:p.browser)?void 0:f.version)?void 0:m.split(".")[0])||DefaultUserAgentParser.UNAVAILABLE,this.browserName=(null==(w=this.parserResult)?void 0:w.browser.name)||DefaultUserAgentParser.UNAVAILABLE,this.browserVersion=(null==(I=this.parserResult)?void 0:I.browser.version)||DefaultUserAgentParser.UNAVAILABLE,this.deviceName=[(null==(k=this.parserResult)?void 0:k.device.vendor)||"",(null==(M=this.parserResult)?void 0:M.device.model)||""].join(" ").trim()||DefaultUserAgentParser.UNAVAILABLE}getParserResult(){var o,p;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:(null==(o=this.parserResult)?void 0:o.os.name)||DefaultUserAgentParser.UNAVAILABLE,osVersion:(null==(p=this.parserResult)?void 0:p.os.version)||DefaultUserAgentParser.UNAVAILABLE,sdkVersion:w.default.sdkVersion,sdkName:w.default.sdkName}}};p.default=I,I.UNAVAILABLE="Unavailable"},0x172e1bd2a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.queue=Promise.resolve()}add(o){return new Promise((p,f)=>{this.queue=this.queue.then(o).then(p).catch(f)})}}},0xab1ef933:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.None=p.Some=p.Maybe=void 0;let f=class{static of(o){return null==o?_.of():m.of(o)}};p.Maybe=f;let m=class Some{constructor(o){this.value=o,this.isSome=!0,this.isNone=!1}map(o){return f.of(o(this.value))}flatMap(o){return o(this.value)}get(){return this.value}getOrElse(o){return this.value}defaulting(o){return f.of(this.getOrElse(o))}static of(o){if(null==o)throw Error("value is ${value}");return new Some(o)}};p.Some=m;let _=class None{constructor(){this.isSome=!1,this.isNone=!0}get(){throw Error("value is null")}getOrElse(o){return o}map(o){return new None}flatMap(o){return new None}defaulting(o){return f.of(this.getOrElse(o))}static of(){return new None}};p.None=_},0xb79a45b7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.iterateEvery=p.SuppressedError=p.getRandomValues=p.getFormattedOffset=p.getDefaultAssetSpec=p.toLowerCasePropertyNames=p.isIFramed=p.wait=void 0;let _=m(f(0x22a0f7c69));function toLowerCasePropertyNames(o){return null===o?null:"object"!=typeof o?o:Array.isArray(o)?o.map(toLowerCasePropertyNames):Object.keys(o).reduce((p,f)=>{let m=o[f],_="object"==typeof m?toLowerCasePropertyNames(m):m;return p[f.toLowerCase()]=_,p},{})}p.wait=function(o){return new Promise(p=>setTimeout(p,o))},p.isIFramed=function(){var o;try{return(null==(o=window.frameElement)?void 0:o.nodeName)==="IFRAME"||parent!==top}catch{return!0}},p.toLowerCasePropertyNames=toLowerCasePropertyNames,p.getDefaultAssetSpec=function(){let o=_.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}},p.getFormattedOffset=function(o){let p=Math.abs(o),f=Math.floor(p/60).toString().padStart(2,"0"),m=Math.floor(p%60).toString().padStart(2,"0");return`${o<=0?"+":"-"}${f}:${m}`},p.getRandomValues=function(o){try{window.crypto.getRandomValues(o)}catch{new DataView(o.buffer).setUint32(0,Math.trunc(0x100000000*Math.random()),!0)}};let w=class extends Error{constructor(o,p,f){var m;super(null!=f?f:`${null!=(m=null==o?void 0:o.message)?m:o}`),this.error=o,this.suppressed=p}};p.SuppressedError=w,p.iterateEvery=function(o,p){let f;if(o){for(let m of o)try{p(m)}catch(o){f=new w(o,f)}if(f)throw f}}},0x22a0f7c69:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0x14322fbcb)),I=class Versioning{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return w.default.semverString}static get sdkVersionSemVer(){var o,p,f,m;let _=w.default.semverString.match(/^(?[0-9]+)\.(?[0-9]+)((?:\.(?[0-9]+))(?:-(?[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null==(o=null==_?void 0:_.groups)?void 0:o.major,minor:null==(p=null==_?void 0:_.groups)?void 0:p.minor,patch:null==(f=null==_?void 0:_.groups)?void 0:f.patch,preRelease:null==(m=null==_?void 0:_.groups)?void 0:m.preRelease}}static get buildSHA(){return w.default.hash.substring(1)}static get sdkUserAgentLowResolution(){let o=new _.default;return`${o.name()}-${o.majorVersion()}`}static urlWithVersion(o){let p=new URL(o);return p.searchParams.append(Versioning.X_AMZN_VERSION,Versioning.sdkVersion),p.searchParams.append(Versioning.X_AMZN_USER_AGENT,Versioning.sdkUserAgentLowResolution),p.toString()}};p.default=I,I.X_AMZN_VERSION="X-Amzn-Version",I.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},0x14322fbcb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default={hash:"802f244",raw:"v3.30.0",semverString:"3.30.0"}},0x17f8c39ba:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoCaptureAndEncodeParameter{constructor(o,p,f,m,_,w=1,I=!1){this.cameraWidth=o,this.cameraHeight=p,this.cameraFrameRate=f,this.maxEncodeBitrateKbps=m,this.isSimulcast=_,this.scaleResolutionDownBy=w,this.isSVC=I}equal(o){let p=o.captureWidth()===this.cameraWidth&&o.captureHeight()===this.cameraHeight&&o.captureFrameRate()===this.cameraFrameRate&&o.encodeBitrates().length===this.encodeBitrates().length&&o.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&o.encodeWidths().length===this.encodeWidths().length&&o.encodeHeights().length===this.encodeHeights().length&&o.isSVCEncoding()===this.isSVC;if(p){for(let f=0;f{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.TargetDisplaySize=void 0,(m=f=p.TargetDisplaySize||(p.TargetDisplaySize={}))[m.Low=0]="Low",m[m.Medium=1]="Medium",m[m.High=2]="High",m[m.Maximum=3]="Maximum",p.default=f},0x171bbd0a0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x86facdd2)),w=m(f(0xf8b13aac)),I=m(f(0xdcca4e0f)),k=f(0xb8e111a8),M=m(f(0x1ea22295f)),x=m(f(0x206997fe9));p.default=class VideoAdaptiveProbePolicy extends M.default{constructor(o){super(o,VideoAdaptiveProbePolicy.createConfig()),this.logger=o,super.shouldPauseTiles=!1,this.videoPreferences=void 0}static createConfig(){let o=new x.default;return o.serverSideNetworkAdaption=w.default.None,o}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(o){super.updateIndex(o);let p=k.VideoPreferences.prepare(),f=!1;for(let m of o.remoteStreamDescriptions())p.some(o=>o.attendeeId===m.attendeeId)||(m.attendeeId.endsWith(_.default.Modality)?(p.add(new I.default(m.attendeeId,1)),f=!0):p.add(new I.default(m.attendeeId,2)));f?(this.videoPreferences=p.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(o){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}}},0xdcca4e0f:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x195076b25)),w=m(f(0x5b9f0577)),I=class VideoPreference{constructor(o,p,f,m){this.attendeeId=o,this.priority=p,this.targetSize=void 0!==f?f:_.default.Maximum,this.degradationPreference=void 0!==m?m:w.default.Balanced}partialCompare(o){return this.priority-o.priority}equals(o){return this.attendeeId===o.attendeeId&&this.targetSize===o.targetSize&&this.priority===o.priority&&this.degradationPreference===o.degradationPreference}clone(){return new VideoPreference(this.attendeeId,this.priority,this.targetSize,this.degradationPreference)}targetSizeToBitrateKbps(o){switch(o){case _.default.Maximum:return VideoPreference.MAXIMUM_BITRATE_KBPS;case _.default.High:return VideoPreference.HIGH_BITRATE_KBPS;case _.default.Medium:return VideoPreference.MID_BITRATE_KBPS;case _.default.Low:return VideoPreference.LOW_BITRATE_KBPS}}};p.default=I,I.LOW_BITRATE_KBPS=300,I.MID_BITRATE_KBPS=600,I.HIGH_BITRATE_KBPS=1500,I.MAXIMUM_BITRATE_KBPS=1e4},0xb8e111a8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoPreferences=p.MutableVideoPreferences=p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=void 0;let _=m(f(0x1217c7f3f));p.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration=function(o,p,f){if(void 0===o.transceiverController.getMidForGroupId||void 0===o.videoStreamIndex.attendeeIdForGroupId||void 0===f)return[];let m=[],w=new Map,I=new Map;for(let f of p){let p=o.transceiverController.getMidForGroupId(f);if(void 0===p)continue;let m=o.videoStreamIndex.attendeeIdForGroupId(f);w.set(m,p),I.set(m,f)}for(let o of f){let p=new _.default,f=w.get(o.attendeeId);void 0!==f&&(p.mid=f,p.attendeeId=o.attendeeId,p.groupId=I.get(o.attendeeId),void 0!==p.groupId&&(p.priority=Number.MAX_SAFE_INTEGER-o.priority,p.targetBitrateKbps=o.targetSizeToBitrateKbps(o.targetSize),p.qualityAdaptationPreference=o.degradationPreference,m.push(p)))}return m};let w=class ObjectSet{constructor(o=[]){this.items=o}static default(){return new ObjectSet([])}[Symbol.iterator](){let o=0,p=this.items;return{next:()=>o!p.equals(o))}clear(){this.items=[]}isEmpty(){return 0===this.items.length}equals(o){if(o===this)return!0;if(o.items.length!==this.items.length)return!1;for(let p of this.items)if(!o.items.some(o=>o.equals(p)))return!1;return!0}has(o){return this.items.some(p=>p.equals(o))}some(o){return this.items.some(o)}clone(){return new ObjectSet([...this.items])}sort(){this.items.sort((o,p)=>o.partialCompare(p))}modify(){return new I(this)}},I=class{constructor(o=new w){this.items=o,this.copied=!1}cow(){this.copied||(this.items=this.items.clone(),this.copied=!0)}add(o){this.items.has(o)||(this.cow(),this.items.add(o))}replaceFirst(o,p){(!this.items.has(o)||this.items.some(p))&&(this.cow(),this.items.replaceFirst(o,p))}remove(o){this.items.has(o)&&(this.cow(),this.items.remove(o))}some(o){return this.items.some(o)}clear(){this.items.isEmpty()||(this.cow(),this.items.clear())}build(){return this.copied&&this.items.sort(),this.copied=!1,this.items}},k=class{constructor(o){this.builder=o}add(o){this.builder.add(o)}replaceFirst(o,p){this.builder.replaceFirst(o,p)}remove(o){this.builder.remove(o)}some(o){return this.builder.some(o)}clear(){this.builder.clear()}build(){return new M(this.builder.build())}};p.MutableVideoPreferences=k;let M=class VideoPreferences{constructor(o){this.items=o}static prepare(){return new k(new I)}static default(){return new VideoPreferences(w.default())}[Symbol.iterator](){return this.items[Symbol.iterator]()}highestPriority(){var o;return null==(o=this.items.first())?void 0:o.priority}sorted(){return this.items[Symbol.iterator]()}equals(o){return o===this||this.items.equals(o.items)}modify(){return new k(this.items.modify())}some(o){return this.items.some(o)}isEmpty(){return this.items.isEmpty()}clone(){let o=VideoPreferences.prepare();for(let p of this.items)o.add(p.clone());return o.build()}};p.VideoPreferences=M,p.default=M},0x1ea22295f:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let k=I(f(0x977823e1)),M=I(f(0x243b8874c)),x=I(f(0xebe235e1)),O=I(f(0x86facdd2)),L=f(0x19a5566fd),B=w(f(0xf8b13aac)),U=I(f(0xe5d2d75f)),$=I(f(0x5b4a3d7a)),q=I(f(0x38bf5f74)),Z=I(f(0x195076b25)),ee=I(f(0xdcca4e0f)),et=f(0xb8e111a8),ei=I(f(0x206997fe9)),er=I(f(0x5b9f0577)),en=class{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}},eo=class VideoPriorityBasedPolicy{constructor(o,p=ei.default.Default){this.logger=o,this.videoPriorityBasedPolicyConfig=p,this.shouldPauseTiles=!0,this.observerQueue=new Set,this.pausedBwAttendeeIds=new Set,this.wantsResubscribeObserver=void 0,this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption===B.default.Default&&(this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption=B.default.BandwidthProbingAndRemoteVideoQualityAdaption),this.reset()}reset(){this.allHighestPolicy=new q.default(""),this.optimalReceiveSet=new $.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new $.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new $.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new en,this.prevDownlinkStats=new en,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption,this.pendingActionAfterUpdatedPreferences=!1}bindToTileController(o){this.tileController=o,this.logger.info("tileController bound")}setWantsResubscribeObserver(o){this.wantsResubscribeObserver=o}chooseRemoteVideoSources(o){var p;if(null==(p=this.videoPreferences)||!p.equals(o)){if(this.videoPreferences=null==o?void 0:o.clone(),!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)&&(this.pendingActionAfterUpdatedPreferences=!0,void 0!==this.wantsResubscribeObserver&&(this.wantsResubscribeObserver(),this.pendingActionAfterUpdatedPreferences=!1),this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption)){let o=[];for(let p of this.videoPreferences){let f=new U.default;f.attendee=new k.default,f.attendee.attendeeId=p.attendeeId,o.push(f)}this.allHighestPolicy.chooseRemoteVideoSources(o);return}this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(o)}`)}}updateIndex(o){this.videoIndex=o,this.serverSideNetworkAdaption===B.default.BandwidthProbingAndRemoteVideoQualityAdaption&&this.allHighestPolicy.updateIndex(o),this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){let o=new Set;for(let p of this.videoIndex.remoteStreamDescriptions())o.add(p.attendeeId);let p=et.VideoPreferences.prepare(),f=o.size,m=Z.default.Maximum;for(let _ of(f>8?m=Z.default.Low:f>4&&(m=Z.default.Medium),o))p.add(new ee.default(_,1,m));this.defaultVideoPreferences=p.build()}updateMetrics(o){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new en;let p=o.getObservableMetrics();for(let f in this.downlinkStats.bandwidthEstimateKbps=p.availableIncomingBitrate/1e3,o.streamMetricReports){let p=Number.parseInt(f,10),m=o.streamMetricReports[p];m.direction===M.default.DOWNSTREAM&&m.mediaType===x.default.VIDEO&&(m.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=o.countPerSecond("nackCount",p)),m.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=o.countPerSecond("packetsLost",p)),m.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=o.bitsPerSecond("bytesReceived",p)/1e3))}}wantsResubscribe(){let o=!1;return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(o||(o=this.pendingActionAfterUpdatedPreferences),this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.calculateOptimalReceiveSet(),o||(o=!this.subscribedReceiveSet.equal(this.optimalReceiveSet)),o):o||this.allHighestPolicy.wantsResubscribe()}chooseSubscriptions(){return B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption)||(this.pendingActionAfterUpdatedPreferences=!1,this.serverSideNetworkAdaption!==B.default.BandwidthProbingAndRemoteVideoQualityAdaption)?(this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.lastSubscribeTimestamp=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveStreams=this.optimalReceiveStreams.slice(),this.subscribedReceiveSet.clone()):this.allHighestPolicy.chooseSubscriptions()}addObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}setVideoPriorityBasedPolicyConfigs(o){this.videoPriorityBasedPolicyConfig=o}calculateOptimalReceiveStreams(){var o;let p=[],f=this.videoIndex.remoteStreamDescriptions();if(0===f.length||(null==(o=this.videoPreferences)?void 0:o.isEmpty())){this.optimalReceiveStreams=[];return}let m=this.rateProbeState;this.cleanBwPausedTiles(f),this.handleAppPausedStreams(p,f);let _=new Map;for(let o of this.getCurrentVideoPreferences())_.set(o.attendeeId,o);let w=f.filter(o=>_.has(o.attendeeId)),I=!this.streamsWithPreferenceDidChange(w),k=!this.startupPeriod&&I;if(k&&Date.now()-this.lastSubscribeTimestampo.maxBitrateKbps===p.maxBitrateKbps?o.streamId-p.streamId:o.maxBitrateKbps-p.maxBitrateKbps),w))(0===o.avgBitrateKbps||o.avgBitrateKbps>o.maxBitrateKbps)&&(o.attendeeId.endsWith(O.default.Modality)&&o.maxBitrateKbps<100?o.maxBitrateKbps=o.avgBitrateKbps:o.avgBitrateKbps=o.maxBitrateKbps);let M=new Set;for(let o of this.getCurrentVideoPreferences()){let p,f=w.filter(p=>p.attendeeId===o.attendeeId);if(f.length<3)continue;let m=15,_=153600;for(let w of(f.forEach(o=>{m=Math.max(m,o.maxFrameRate),_=Math.max(_,o.totalPixels())}),f.sort((p,f)=>{if(o.degradationPreference===er.default.MaintainResolution)return 2>Math.abs(p.maxFrameRate-f.maxFrameRate)?p.totalPixels()-f.totalPixels():p.maxFrameRate-f.maxFrameRate;if(o.degradationPreference===er.default.MaintainFramerate)return p.totalPixels()===f.totalPixels()?p.maxFrameRate-f.maxFrameRate:p.totalPixels()-f.totalPixels();{let weighByFramerate=o=>o.avgBitrateKbps*Math.pow(2,5*o.maxFrameRate/m*Math.pow(4,o.totalPixels()/_));return weighByFramerate(p)-weighByFramerate(f)}}),f)){if(void 0!==p&&(w.maxFrameRate2||w.totalPixels()!M.has(o.streamId));this.logger.info(`Filtered to ${JSON.stringify(x)}`);let U={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};U.targetDownlinkBitrate=this.determineTargetRate();let $=this.subscribedReceiveSet.size(),q=this.downlinkStats.bandwidthEstimateKbps,Z=!this.videoPriorityBasedPolicyConfig.allowSubscribe($,q);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,k&&Z))return;let ee=this.priorityPolicy(U,x,p),et=!B.serverSideNetworkAdaptionIsNoneOrDefault(this.serverSideNetworkAdaption),ei=0;if(et||this.startupPeriod||!I?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?ei=this.handleProbe(p,U.targetDownlinkBitrate):0!==U.deltaToNextUpgrade&&(ei=this.maybeOverrideOrProbe(p,U,ee)),this.previousStreamsWithPreference=w,this.videoPreferencesUpdated=!1,1===ei){this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),this.prevTargetRateKbps=U.targetDownlinkBitrate;return}if(2===ei){let o=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(w,this.preProbeNonPausedReceiveStreams),this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+o);return}this.optimalNonPausedReceiveStreams=p.slice();let en=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(w,p),this.logger.getLogLevel()<=L.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==m||this.optimalReceiveStreams.length!==p.length||en!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(f,U.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=U.targetDownlinkBitrate,this.optimalReceiveStreams=p.slice()}calculateOptimalReceiveSet(){let o=new $.default;for(let p of(this.calculateOptimalReceiveStreams(),this.optimalReceiveStreams))o.add(p.streamId);if(!this.optimalReceiveSet.equal(o)){let p=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(o)} subscribedRate:${p}`)}this.optimalReceiveSet=o}determineTargetRate(){let o=0,p=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=p),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||p-this.firstEstimateTimestamp>VideoPriorityBasedPolicy.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?o=VideoPriorityBasedPolicy.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps),this.usingPrevTargetRate=!0,o=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,o>15e3&&this.logger.warn("bwe: "+o+" exceeds maximum limit (15000). Limit TargetDisplaySize with VideoPreferences to avoid this."),Math.min(o,15e3)}setProbeState(o){if(this.rateProbeState===o)return!1;let p=Date.now();switch(o){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(0!==this.lastProbeTimestamp&&!(p-this.lastProbeTimestamp>VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS))return!1;this.probePendingStartTimestamp=p;break;case"Probing":if(!(p-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs))return!1;this.lastProbeTimestamp=p,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,VideoPriorityBasedPolicy.MAX_HOLD_BEFORE_PROBE_MS)}return this.logger.info("bwe: setProbeState to "+o+" from "+this.rateProbeState),this.rateProbeState=o,!0}upgradeToStream(o,p){for(let f=0;fVideoPriorityBasedPolicy.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>VideoPriorityBasedPolicy.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=3*Math.max(VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs),2;let f=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(o)||p>f?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=VideoPriorityBasedPolicy.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(o,p,f){let m=this.chosenStreamsSameAsLast(o),_=0,w=p.targetDownlinkBitrate>VideoPriorityBasedPolicy.LOW_BITRATE_THRESHOLD_KBPS?VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*VideoPriorityBasedPolicy.TARGET_RATE_CHANGE_TRIGGER_PERCENT,I=p.targetDownlinkBitrate*w/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!m&&Math.abs(p.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,_;if(m||1===_)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(o,f),_=0)}else this.setProbeState("Not Probing");return _}calculateSubscribeRate(o){let p=0;for(let f of o)this.pausedStreamIds.contain(f.streamId)||this.pausedBwAttendeeIds.has(f.attendeeId)||(p+=f.maxBitrateKbps);return p}handleAppPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");for(let f of(this.pausedStreamIds=new $.default,this.tileController.getAllRemoteVideoTiles())){let m=f.state();if(m.paused&&!this.pausedBwAttendeeIds.has(m.boundAttendeeId)){let f=p.length;for(;f--;)p[f].attendeeId===m.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+m.boundAttendeeId+" streamId: "+p[f].streamId),this.pausedStreamIds.add(p[f].streamId),this.subscribedReceiveSet.contain(p[f].streamId)&&o.push(p[f]),p.splice(f,1))}}}processBwPausedStreams(o,p){if(!this.tileController)return void this.logger.warn("tileController not found!");let f=this.getCurrentVideoPreferences();if(f&&this.shouldPauseTiles){let m=this.tileController.getAllVideoTiles();for(let _ of f){let f=this.getVideoTileForAttendeeId(_.attendeeId,m),w=(null==f?void 0:f.state().paused)||!1;if(p.some(o=>o.attendeeId===_.attendeeId))w&&this.pausedBwAttendeeIds.has(_.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBeUnpausedByDownlinkPolicy(f.id())}),this.tileController.unpauseVideoTile(f.id()),this.pausedBwAttendeeIds.delete(_.attendeeId));else{let m=o.some(o=>o.attendeeId===_.attendeeId);if(f&&m){let o=this.optimalReceiveStreams.find(o=>o.attendeeId===_.attendeeId);void 0!==o&&(w||(this.logger.info(`bwe: pausing streamId ${o.streamId} attendee ${_.attendeeId} due to bandwidth`),this.forEachObserver(o=>{o.tileWillBePausedByDownlinkPolicy(f.id())}),this.tileController.pauseVideoTile(f.id())),p.push(o)),this.pausedBwAttendeeIds.add(_.attendeeId)}else if(m){let o=this.tileController.addVideoTile();o.bindVideoStream(_.attendeeId,!1,null,0,0,0,null),this.forEachObserver(p=>{p.tileWillBePausedByDownlinkPolicy(o.id())}),o.pause(),this.logger.info(`bwe: Created video tile ${o.id()} for bw paused attendee ${_.attendeeId}`),this.pausedBwAttendeeIds.add(_.attendeeId)}}}}}cleanBwPausedTiles(o){if(!this.tileController)return void this.logger.warn("tileController not found!");let p=this.tileController.getAllRemoteVideoTiles(),f=this.getCurrentVideoPreferences();for(let m of p){let p=m.state();!p.boundVideoStream&&(o.some(o=>o.attendeeId===p.boundAttendeeId)?void 0===f||f.some(o=>o.attendeeId===p.boundAttendeeId)||this.tileController.removeVideoTile(p.tileId):(this.tileController.removeVideoTile(p.tileId),this.logger.info(`bwe: Removed video tile ${p.tileId} for bw paused attendee ${p.boundAttendeeId}`)))}}priorityPolicy(o,p,f){let m,_,w=this.getCurrentVideoPreferences(),I=w.highestPriority(),k=I;for(;-1!==k;){for(let I of(_=-1,w))if(I.priority===k)for(let _ of p)_.attendeeId!==I.attendeeId||f.some(o=>o.groupId===_.groupId)||(o.chosenTotalBitrate+_.avgBitrateKbps<=o.targetDownlinkBitrate?(f.push(_),o.chosenTotalBitrate+=_.avgBitrateKbps):0===o.deltaToNextUpgrade&&(o.deltaToNextUpgrade=_.avgBitrateKbps,m=_));else if(I.priority>k){_=I.priority;break}for(let _ of w)if(_.priority===k){for(let w of p)if(w.attendeeId===_.attendeeId){let I=f.findIndex(o=>o.groupId===w.groupId&&o.maxBitrateKbps<=w.maxBitrateKbps&&o.avgBitrateKbpsk)break;if(k===I&&0!==o.deltaToNextUpgrade)break;k=_}return m}getVideoTileForAttendeeId(o,p){for(let f of p)if(f.state().boundAttendeeId===o)return f;return null}canUpgrade(o,p,f,m){let _=!1;return(p===Z.default.High||!m&&o<=f?_=!0:m&&p===Z.default.Medium&&o<=f&&(_=!0),_)?(this.logger.info(`bwe: canUpgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbps: ${o} targetBitrateKbps: ${f}`),!1)}hasSimulcastStreams(o,p,f){let m=0;for(let _ of o)_.attendeeId===p&&_.groupId===f&&m++;return this.logger.info(`bwe: attendeeId: ${p} groupId: ${f} hasSimulcastStreams: streamCount: ${m}`),m>1}streamsWithPreferenceDidChange(o){if(void 0===this.previousStreamsWithPreference||o.length!==this.previousStreamsWithPreference.length||!0===this.videoPreferencesUpdated)return!0;for(let p of o)if(void 0===this.previousStreamsWithPreference.find(o=>o.groupId===p.groupId&&o.streamId===p.streamId&&o.maxBitrateKbps===p.maxBitrateKbps))return!0;return!1}chosenStreamsSameAsLast(o){if(this.optimalNonPausedReceiveStreams.length!==o.length)return!1;for(let p of this.optimalNonPausedReceiveStreams)if(!o.some(o=>o.streamId===p.streamId))return!1;return!0}policyStateLogStr(o,p){let f={targetBitrate:p,subscribedRate:this.calculateSubscribeRate(this.optimalReceiveStreams),probeState:this.rateProbeState,startupPeriod:this.startupPeriod},m="remoteInfos: [";for(let p of o)m+=`{grpId:${p.groupId} strId:${p.streamId} maxBr:${p.maxBitrateKbps} avgBr:${p.avgBitrateKbps}}, `;m+="]";let _=`bwe: optimalReceiveSet ${JSON.stringify(f)}
bwe: prev ${JSON.stringify(this.prevDownlinkStats)}
bwe: now ${JSON.stringify(this.downlinkStats)}
bwe: ${m}
`;return(this.pausedStreamIds.size()>0||this.pausedBwAttendeeIds.size>0)&&(_+=`bwe: paused: app stream ids ${JSON.stringify(this.pausedStreamIds)} bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }
`),this.videoPreferences?_+=`bwe: preferences: ${JSON.stringify(this.videoPreferences)}`:_+=`bwe: default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,_}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}getServerSideNetworkAdaption(){return this.serverSideNetworkAdaption}setServerSideNetworkAdaption(o){this.serverSideNetworkAdaption=o,this.setProbeState("Not Probing")}supportedServerSideNetworkAdaptions(){return[B.default.None,B.default.BandwidthProbing,B.default.BandwidthProbingAndRemoteVideoQualityAdaption]}getVideoPreferences(){let o=this.getCurrentVideoPreferences();return o||(o=et.VideoPreferences.prepare().build()),o}wantsAllTemporalLayersInIndex(){return!0}};p.default=eo,eo.DEFAULT_BANDWIDTH_KBPS=2800,eo.STARTUP_PERIOD_MS=6e3,eo.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,eo.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,eo.LOW_BITRATE_THRESHOLD_KBPS=300,eo.MIN_TIME_BETWEEN_PROBE_MS=5e3,eo.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,eo.MAX_HOLD_BEFORE_PROBE_MS=3e4,eo.MAX_ALLOWED_PROBE_TIME_MS=6e4,eo.SPURIOUS_PACKET_LOST_THRESHOLD=2,eo.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},0x206997fe9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf8b13aac)),w=class VideoPriorityBasedPolicyConfig{constructor(o=0,p=0){this.networkIssueResponseDelayFactor=o,this.networkIssueRecoveryDelayFactor=p,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,this.serverSideNetworkAdaption=_.default.BandwidthProbingAndRemoteVideoQualityAdaption,o<0?o=0:o>1&&(o=1),this.networkIssueResponseDelayFactor=o,p<0?p=0:p>1&&(p=1),this.networkIssueRecoveryDelayFactor=p}allowSubscribe(o,p){let f=0,m=this.currentNetworkEvent;if(p>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=p,!0;if(!(pf)return this.referenceBitrate=p,!0;return!1}getSubscribeDelay(o,p){let f=VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,m=VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS-VideoPriorityBasedPolicyConfig.MINIMUM_DELAY_MS,_=this.networkIssueResponseDelayFactor;return 1===o&&(f+=m*_*(1+p/10),f=Math.min(VideoPriorityBasedPolicyConfig.MAXIMUM_DELAY_MS,f)),f}};p.default=w,w.MINIMUM_DELAY_MS=2e3,w.MAXIMUM_DELAY_MS=8e3,w.Default=new w(0,0),w.UnstableNetworkPreset=new w(0,1),w.StableNetworkPreset=new w(1,0)},0x5b9f0577:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoQualityAdaptationPreference=void 0,(m=f=p.VideoQualityAdaptationPreference||(p.VideoQualityAdaptationPreference={}))[m.Balanced=0]="Balanced",m[m.MaintainFramerate=1]="MaintainFramerate",m[m.MaintainResolution=2]="MaintainResolution",p.default=f},0x22bbb4e3f:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{create(){let o={clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,paused:!0,pause:()=>{o.paused=!0},play:()=>(o.paused=!1,Promise.resolve())};return o}}},0x8cc00a0b:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.canvas=o,this.destroyed=!1}destroy(){this.canvas=null,this.destroyed=!0}asCanvasImageSource(){return f(this,void 0,void 0,function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)})}asCanvasElement(){return this.canvas}}},0x20f5ac25c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x8cc00a0b)),I=_(f(0x86cb8dc3));p.default=class{constructor(o,p,f=new I.default){this.logger=o,this.stages=p,this.fr=15,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=o=>m(this,void 0,void 0,function*(){let o;if(!this.inputVideoStream)return;let p=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let f=[];f.push(this.sourceBuffers[0]);try{for(let o of this.processors)f=yield o.process(f)}catch{this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()});return}this.destBuffers=f;try{o=yield this.destBuffers[0].asCanvasImageSource()}catch{this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()}));return}let m=o.width,_=o.height;0!==m&&0!==_&&(this.canvasOutput.width!==m&&this.canvasOutput.height!==_&&(this.canvasOutput.width=m,this.canvasOutput.height=_),this.outputCtx.drawImage(o,0,0,m,_,0,0,m,_),this.hasStarted||(this.hasStarted=!0,this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})));let w=performance.now()-p,I=2e3/this.framerate-w,k=Math.max(0,1e3/this.framerate-w);I<=0&&this.forEachObserver(o=>{o.processingLatencyTooHigh&&o.processingLatencyTooHigh(w)}),yield this.timer.start(k,this.process.bind(this))}),this.timer=f}destroy(){if(this.stop(),this.stages)for(let o of this.stages)o.destroy();this.timer.destroy()}get framerate(){return this.fr}set framerate(o){this.fr=o<0||void 0===o?15:o}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(let o of this.outputMediaStream.getVideoTracks())o.stop();this.hasStarted&&(this.hasStarted=!1,this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()}))}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}getInputMediaStream(){return m(this,void 0,void 0,function*(){return this.inputVideoStream})}getActiveOutputMediaStream(){return this.isOutputMediaStreamActive()||(this.outputMediaStream=this.canvasOutput.captureStream(this.framerate),this.cloneInputAudioTracksToOutput()),this.outputMediaStream}setInputMediaStream(o){return m(this,void 0,void 0,function*(){if(!o)return void this.stop();if(0===o.getVideoTracks().length)return void this.logger.error("No video tracks in input media stream, ignoring");this.inputVideoStream=o;let p=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${JSON.stringify(p)}`),this.framerate=p.frameRate,this.canvasOutput.width=p.width,this.canvasOutput.height=p.height,this.videoInput.addEventListener("loadedmetadata",this.process),this.videoInput.srcObject=this.inputVideoStream,this.videoInput.setAttribute("playsinline","true");let f=new w.default(this.canvasInput);this.sourceBuffers.push(f),this.videoInput.load();try{yield this.videoInput.play()}catch{this.logger.warn("Video element play() overrided by another load().")}this.cloneInputAudioTracksToOutput()})}cloneInputAudioTracksToOutput(){if(!this.isOutputMediaStreamActive()||null===this.inputVideoStream)return void this.logger.info("Not cloning input audio tracks to output, do not have media streams ready");for(let o of this.outputMediaStream.getAudioTracks())this.logger.info(`Removing audio track ${o.id} from output stream`),this.outputMediaStream.removeTrack(o);for(let o of this.inputVideoStream.getAudioTracks())this.logger.info(`Adding audio track ${o.id} to output stream`),this.outputMediaStream.addTrack(o)}isOutputMediaStreamActive(){return this.outputMediaStream&&this.outputMediaStream.active}set processors(o){this.stages=o}get processors(){return this.stages}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}destroyInputMediaStreamAndBuffers(){if(this.inputVideoStream)for(let o of this.inputVideoStream.getTracks())o.stop();for(let o of(this.inputVideoStream=null,this.sourceBuffers))o.destroy();this.sourceBuffers=[]}}},0x86cb8dc3:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.workerTimer=void 0,this.callback=void 0,this.workerTimer=this.createWorkerTimer()}createWorkerTimer(){try{let o=new Blob([`self.onmessage = async function(e){
var timerID = null;
const awaitTimeout = delay => new Promise( resolve => {
timerID = setTimeout(resolve, delay);
})
await awaitTimeout(e.data);
postMessage(timerID);
}`],{type:"application/javascript"});return new Worker(window.URL.createObjectURL(o))}catch{}}start(o,p){return f(this,void 0,void 0,function*(){this.callback=p,this.workerTimer?(this.workerTimer.onmessage=o=>{this.lastTimeout=o.data,this.callback()},this.workerTimer.postMessage(o)):this.lastTimeout=setTimeout(()=>{this.callback()},o)})}destroy(){return f(this,void 0,void 0,function*(){this.callback=void 0,this.lastTimeout&&(clearTimeout(this.lastTimeout),this.lastTimeout=void 0),this.workerTimer&&(this.workerTimer.terminate(),this.workerTimer=void 0)})}}},0xd9718ba1:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2)),I=_(f(0x20f5ac25c));p.default=class DefaultVideoTransformDevice{constructor(o,p,f,m=new w.default){this.logger=o,this.device=p,this.processors=f,this.browserBehavior=m,this.observers=new Set,this.pipe=new I.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}passEventControllerToProcessors(o){if(this.pipe.processors)for(let p of this.pipe.processors)"function"==typeof p.setEventController&&p.setEventController(o)}chooseNewInnerDevice(o){let p=new DefaultVideoTransformDevice(this.logger,o,this.processors,this.browserBehavior);return p.pipe=this.pipe,p}getInnerDevice(){return this.device}intrinsicDevice(){return m(this,void 0,void 0,function*(){return this.device})}transformStream(o){return m(this,void 0,void 0,function*(){return yield this.pipe.setInputMediaStream(o),this.inputMediaStream=o,this.pipe.getActiveOutputMediaStream()})}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");let o=this.device&&this.device.id;if(this.pipe.stop(),!o&&this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop()}stop(){return m(this,void 0,void 0,function*(){if(this.inputMediaStream)for(let o of this.inputMediaStream.getVideoTracks())o.stop();this.pipe.destroy(),this.inputMediaStream=null})}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}processingDidStart(){this.logger.info("video transform device processing started"),this.forEachObserver(o=>{o.processingDidStart&&o.processingDidStart()})}processingLatencyTooHigh(o){this.forEachObserver(p=>{p.processingLatencyTooHigh&&p.processingLatencyTooHigh(o)})}processingDidFailToStart(){this.logger.info("video transform device processing failed to start"),this.forEachObserver(o=>{o.processingDidFailToStart&&o.processingDidFailToStart()})}processingDidStop(){this.logger.info("video transform device processing stopped"),this.forEachObserver(o=>{o.processingDidStop&&o.processingDidStop()})}forEachObserver(o){for(let p of this.observers)setTimeout(()=>{o(p)},0)}get framerate(){return this.pipe.framerate}set framerate(o){this.pipe.framerate=o}}},0x84671e3f:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{process(o){return f(this,void 0,void 0,function*(){return o})}destroy(){return f(this,void 0,void 0,function*(){})}}},0xabb871f6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DeferredPromise=void 0,p.DeferredPromise=class{constructor(){this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}getPromise(){return this.promise}resolvePromise(o){this.resolve(o)}resolveAndReplacePromise(o){this.resolve(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}rejectPromise(o){this.reject(o)}rejectAndReplacePromise(o){this.reject(o),this.promise=new Promise((o,p)=>{this.resolve=o,this.reject=p})}}},0x8012092c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxCanvasOpsManager=void 0;let _=f(0x23955cc68);p.VideoFxCanvasOpsManager=class{constructor(o,p){this.streamParameters=o,this.outputCanvas=p,this.configureCanvasPipeline()}getInferenceInputData(o){return this.inferenceCtx.save(),this.inferenceCtx.scale(this.horizontalResizeScalar,this.verticalResizeScalar),this.inferenceCtx.drawImage(o,0,0),this.inferenceCtx.restore(),this.inferenceCtx.getImageData(0,0,_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS)}configureForStreamParameters(o){return m(this,void 0,void 0,function*(){if(this.streamParameters=o,this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.backgroundReplacementCanvas){let o=document.createElement("canvas");o.width=this.streamParameters.width,o.height=this.streamParameters.height,o.getContext("2d").drawImage(this.backgroundReplacementCanvas,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=o}this.configureCanvasPipeline()})}configureCanvasPipeline(){this.inferenceCanvas=document.createElement("canvas"),this.inferenceCtx=this.inferenceCanvas.getContext("2d",{willReadFrequently:!0}),this.inferenceCanvas.width=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,this.inferenceCanvas.height=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.horizontalResizeScalar=_.SEGMENTATION_MODEL.WIDTH_IN_PIXELS/this.streamParameters.width,this.verticalResizeScalar=_.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS/this.streamParameters.height}getBackgroundReplacementCanvas(){return this.backgroundReplacementCanvas}loadReplacementBackground(o){return m(this,void 0,void 0,function*(){let p=o.backgroundReplacement.backgroundImageURL,f=o.backgroundReplacement.defaultColor;if(p)try{let o=yield this.loadImage(p);this.backgroundReplacementImage=o,this.resizeAndSetReplacementImage(this.backgroundReplacementImage)}catch(o){throw this.logger.error(o),Error("Failed to set the replacement image.")}else this.resizeAndSetReplacementColor(f)})}resizeAndSetReplacementImage(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.drawImage(o,0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}resizeAndSetReplacementColor(o){let p=document.createElement("canvas"),f=p.getContext("2d");p.width=this.streamParameters.width,p.height=this.streamParameters.height,f.fillStyle=o,f.fillRect(0,0,this.streamParameters.width,this.streamParameters.height),this.backgroundReplacementCanvas=p}loadImage(o){return m(this,void 0,void 0,function*(){let p=yield fetch(o).catch(o=>{throw this.logger.error(o.toString()),Error("Failed to fetch image.")}),f=yield p.blob(),m=new Image;return m.src=URL.createObjectURL(f),new Promise((o,p)=>{m.onload=()=>{o(m)},m.onerror=o=>{p(o)}})})}}},0x23955cc68:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_FX_SPEC=p.FXLIB_PATH=p.WORKER_PATH=p.CDN_BASE_PATH=p.RESOURCE_CONSTRAINTS=p.SEGMENTATION_MODEL=p.DEFAULT_STREAM_PARAMETERS=p.WORKER_MSG=void 0,p.WORKER_MSG={BUILD_ENGINE_REQUEST:"BuildEngineRequest",BUILD_ENGINE_RESPONSE:"BuildEngineResponse",PERFORM_SEGMENTATION_REQUEST:"PerformSegmentationRequest",PERFORM_SEGMENTATION_RESPONSE:"PerformSegmentationResponse",PERFORM_SEGMENTATION_SAB_REQUEST:"PerformSegmentationSABRequest",PERFORM_SEGMENTATION_SAB_RESPONSE:"PerformSegmentationSABResponse",DESTROY_ASSETS_REQUEST:"DestroyAssetsRequest",DESTROY_ASSETS_RESPONSE:"DestroyAssetsResponse",CLOSE_WORKER_REQUEST:"CloseWorkerRequest"},p.DEFAULT_STREAM_PARAMETERS={FRAMES_PER_SECOND:15,WIDTH_IN_PIXEL:960,HEIGHT_IN_PIXEL:540,CHANNEL_COUNT:4},p.SEGMENTATION_MODEL={LOAD_SUCCESS:2,WIDTH_IN_PIXELS:176,HEIGHT_IN_PIXELS:160},p.RESOURCE_CONSTRAINTS={DEFAULT_PROCESSING_BUDGET_PER_FRAME:50,SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION:1,SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT:500,BLUR_DEFAULT_CYCLE_PERCENTAGE:10,BLUR_SAMPLING_PERIOD_FRAME_COUNT:1e3,MIN_PROCESSING_BUDGET:0,MAX_PROCESSING_BUDGET:100},p.CDN_BASE_PATH="https://static.sdkassets.chime.aws";let f="/ml_media_fx/otherassets";p.WORKER_PATH=`${f}/worker.js`,p.FXLIB_PATH=`${f}/fxlib.js`,p.DEFAULT_VIDEO_FX_SPEC={paths:{cdnBasePath:p.CDN_BASE_PATH,workerPath:p.WORKER_PATH,fxLibPath:p.FXLIB_PATH}}},0x14b0f3819:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x6cf4e7cb),I=f(0x1e62759b2),k=f(0x1676280b0),M=_(f(0x9a4430b2)),x=_(f(0xf05a6831)),O=f(0xb79a45b7),L=_(f(0x22a0f7c69)),B=_(f(0x8cc00a0b)),U=f(0xabb871f6),$=f(0x8012092c),q=f(0x23955cc68),Z=f(0x1d603096a),ee=class VideoFxProcessor{constructor(o,p=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,f){this.logger=o,this.outputCanvas=document.createElement("canvas"),this.canvasVideoFrameBuffer=new B.default(this.outputCanvas),this.videoFxSpec=q.DEFAULT_VIDEO_FX_SPEC;try{this.validateProcessingBudgetPerFrame(p)}catch(o){throw this.logger.error(o),Error(`Cannot instantiate VideoFxProcessor due to invalid processingBudgetPerFrame of ${p}`)}f&&(this.eventController=f),this.effectConfig={backgroundBlur:{isEnabled:!1,strength:"low"},backgroundReplacement:{isEnabled:!1,backgroundImageURL:null,defaultColor:"black"}},this.segmentationRequestPromise=new U.DeferredPromise,this.segmentationRateManager=new Z.VideoFxSegmentationRateManager(this.logger,p),this.streamParameters={framerate:q.DEFAULT_STREAM_PARAMETERS.FRAMES_PER_SECOND,width:q.DEFAULT_STREAM_PARAMETERS.WIDTH_IN_PIXEL,height:q.DEFAULT_STREAM_PARAMETERS.HEIGHT_IN_PIXEL,channels:q.DEFAULT_STREAM_PARAMETERS.CHANNEL_COUNT},VideoFxProcessor.isSharedArrayBufferSupported&&(this.sharedImageBuffer=new SharedArrayBuffer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS*q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS*this.streamParameters.channels),this.sharedImageData=new Uint8ClampedArray(this.sharedImageBuffer)),this.logger.info(`VideoFx supports Shared Array Buffer: ${VideoFxProcessor.isSharedArrayBufferSupported}`),this.canvasOpsManager=new $.VideoFxCanvasOpsManager(this.streamParameters,this.outputCanvas),this.outputCanvas.width=this.streamParameters.width,this.outputCanvas.height=this.streamParameters.height,this.segmentationMask=new ImageData(this.streamParameters.width,this.streamParameters.height),this.logger.info(`VideoFxProcessor instantiated with a processingBudgetPerFrame of ${p}`)}process(o){return m(this,void 0,void 0,function*(){return o})}fxProcess(o){return m(this,void 0,void 0,function*(){let p=o[0].asCanvasElement();this.didStreamParametersChange(p)&&(yield this.adjustProcessorForNewStreamParameters(p));try{yield this.manageSegmentationMask(p)}catch(o){throw this.logger.error(o),Error("Video stream could not be processed")}return yield this.renderer.render(p,this.segmentationMask),o[0]=this.canvasVideoFrameBuffer,o})}noOpProcess(o){return m(this,void 0,void 0,function*(){return o})}didStreamParametersChange(o){return o.width!==this.streamParameters.width||o.height!==this.streamParameters.height}adjustProcessorForNewStreamParameters(o){return m(this,void 0,void 0,function*(){this.streamParameters.width=o.width,this.streamParameters.height=o.height,yield this.canvasOpsManager.configureForStreamParameters(this.streamParameters),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,this.effectConfig)})}destroy(){return m(this,void 0,void 0,function*(){this.canvasVideoFrameBuffer.destroy(),this.fxLibScript&&this.fxLibScript.parentNode&&this.fxLibScript.parentNode.removeChild(this.fxLibScript),this.engineWorker&&(this.destroyedAssetsPromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.DESTROY_ASSETS_REQUEST}),yield this.destroyedAssetsPromise.getPromise(),this.engineWorker.postMessage({msg:q.WORKER_MSG.CLOSE_WORKER_REQUEST})),this.logger.info("VideoFxProcessor destroyed.")})}manageSegmentationMask(o){return m(this,void 0,void 0,function*(){try{if(this.segmentationRateManager.submitFrame(),this.segmentationRateManager.shouldApplySegmentation()){this.segmentationRateManager.startSegmentation();let p=this.canvasOpsManager.getInferenceInputData(o);this.segmentationMask=yield this.generateSegmentationMask(p),this.segmentationRateManager.completeSegmentation()}}catch(o){throw this.logger.error(o.toString()),Error("Can not properly manage the returned segmentation mask")}})}generateSegmentationMask(o){return m(this,void 0,void 0,function*(){VideoFxProcessor.isSharedArrayBufferSupported?(this.sharedImageData.set(o.data),this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_REQUEST,payload:this.sharedImageBuffer})):this.engineWorker.postMessage({msg:q.WORKER_MSG.PERFORM_SEGMENTATION_REQUEST,payload:o},[o.data.buffer]);try{return yield this.segmentationRequestPromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Segmentation mask could not be generated")}})}cloneConfigFrom(o){return{backgroundBlur:{isEnabled:o.backgroundBlur.isEnabled,strength:o.backgroundBlur.strength},backgroundReplacement:{isEnabled:o.backgroundReplacement.isEnabled,backgroundImageURL:o.backgroundReplacement.backgroundImageURL,defaultColor:o.backgroundReplacement.defaultColor}}}setVideoFxSpec(o){o.paths&&(this.videoFxSpec.paths=o.paths)}setEffectConfig(o){return m(this,void 0,void 0,function*(){if(this.sameVideoFxConfig(o,this.effectConfig))return;let p=this.cloneConfigFrom(o);try{yield this.validateEffectConfig(p)}catch(o){throw this.logger.error(o.toString()),Error("Provided effect config is invalid, not updating VideoFxProcessor")}p.backgroundReplacement.isEnabled&&(yield this.canvasOpsManager.loadReplacementBackground(p),yield this.renderer.setBackgroundReplacementCanvas(this.canvasOpsManager.getBackgroundReplacementCanvas())),yield this.renderer.configure(this.streamParameters.width,this.streamParameters.height,p),this.effectConfig=p,this.effectConfig.backgroundBlur.isEnabled||this.effectConfig.backgroundReplacement.isEnabled?this.process=this.fxProcess:this.process=this.noOpProcess,this.logger.info(`VideoFxProcessor effect configuration updated to: ${JSON.stringify(this.effectConfig)}`),this.eventController&&this.publishVideoFxConfigEvent()})}validateEffectConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundBlur.isEnabled&&o.backgroundReplacement.isEnabled)throw Error("Invalid VideoFx configuration: Background Blur and Background Replacement can not both be enabled");o.backgroundReplacement.isEnabled&&(yield this.validateReplacementConfig(o))})}validateReplacementConfig(o){return m(this,void 0,void 0,function*(){if(o.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement can not have both an image URL and default color");if(!o.backgroundReplacement.backgroundImageURL&&!o.backgroundReplacement.defaultColor)throw Error("Invalid VideoFx configuration: Background Replacement image URL and default can not both be null/undefined");try{o.backgroundReplacement.backgroundImageURL&&(yield this.canvasOpsManager.loadImage(o.backgroundReplacement.backgroundImageURL))}catch(o){throw this.logger.error(o.toString()),Error("Invalid VideoFx configuration: backgroundImageURL failed to load")}let p=o.backgroundReplacement.defaultColor;if(p&&"black"!==p&&"#000000"!==p&&"#000"!==p){if(p.includes("#")&&!new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/).test(p))throw Error(`Invalid hexadecimal color code for default replacement background: ${p}`);let o=document.createElement("canvas").getContext("2d"),f=o.fillStyle;if(o.fillStyle=p,o.fillStyle===f)throw Error(`Invalid color for default replacement background: ${p}`)}})}validateProcessingBudgetPerFrame(o){if(oq.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET)throw Error(`Invalid resource constraint: cycle percentage must be within range of ${q.RESOURCE_CONSTRAINTS.MIN_PROCESSING_BUDGET} and ${q.RESOURCE_CONSTRAINTS.MAX_PROCESSING_BUDGET}`)}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("Loading required assets for the VideoFxProcessor");try{let o=this.getVideoFxAssetParams();yield this.loadEngineWorker(o),yield this.buildEngine(o),yield this.loadFxLib(o),this.renderer=constructRenderer(q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS,this.effectConfig,this.outputCanvas)}catch(o){throw this.logger.error(o.toString()),Error("Failed to load necessary assets for the VideoFxProcessor")}this.logger.info("Finished loading of essential VideoFxProcessor assets.")})}getVideoFxAssetParams(){let o=O.getDefaultAssetSpec();return{assetGroup:o.assetGroup,revisionID:o.revisionID,sdk:encodeURIComponent(L.default.sdkVersion),ua:encodeURIComponent(L.default.sdkUserAgentLowResolution)}}getPathFromVideoFxAssetParams(o,p){let f=new URL(o);for(let[o,m]of Object.entries(p))if(void 0!==m){let p=encodeURIComponent(o),_=encodeURIComponent(m);f.searchParams.set(p,_)}return f.toString()}loadEngineWorker(o){return m(this,void 0,void 0,function*(){try{let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.workerPath,o);this.engineWorker=yield I.loadWorker(p,"VideoFxEngineWorker",{},null),this.logger.info("Successfully loaded the VideoFxProcessor's engine worker"),this.engineWorker.addEventListener("message",o=>this.engineWorkerReceiver(o))}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the VideoFxProcessor's engine worker")}})}buildEngine(o){return m(this,void 0,void 0,function*(){this.buildEnginePromise=new U.DeferredPromise,this.engineWorker.postMessage({msg:q.WORKER_MSG.BUILD_ENGINE_REQUEST,payload:{cdnBasePath:this.videoFxSpec.paths.cdnBasePath,sdkVersioningParams:o}});try{yield this.buildEnginePromise.getPromise()}catch(o){throw this.logger.error(o.toString()),Error("Failed to instantiate the VideoFxEngine")}})}loadFxLib(o){return m(this,void 0,void 0,function*(){let p=this.getPathFromVideoFxAssetParams(this.videoFxSpec.paths.cdnBasePath+this.videoFxSpec.paths.fxLibPath,o);try{let o=yield w.fetchWithBehavior(p,{method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"},{});if(!o.ok)throw Error("Fetch failed.");let f=window.URL.createObjectURL((yield o.blob()));yield new Promise((o,p)=>{this.fxLibScript=document.createElement("script"),this.fxLibScript.setAttribute("src",f),this.fxLibScript.setAttribute("type","module"),this.fxLibScript.setAttribute("async","false"),this.fxLibScript.addEventListener("load",o),this.fxLibScript.addEventListener("error",p),document.body.appendChild(this.fxLibScript)})}catch(o){throw this.logger.error(o.toString()),Error("Failed to load the fxlib")}})}getEffectConfig(){return this.cloneConfigFrom(this.effectConfig)}engineWorkerReceiver(o){let p=o.data;switch(p.msg){case q.WORKER_MSG.BUILD_ENGINE_RESPONSE:this.settleEngineBuildPromise(p.payload);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_RESPONSE:this.settleSegmentationPromise(p.payload.output);break;case q.WORKER_MSG.PERFORM_SEGMENTATION_SAB_RESPONSE:this.settleSegmentationPromiseSAB();break;case q.WORKER_MSG.DESTROY_ASSETS_RESPONSE:this.destroyedAssetsPromise.resolvePromise();break;default:this.logger.info(`VideoFx worker received unknown event msg: ${JSON.stringify(p)}`)}}settleEngineBuildPromise(o){o!==q.SEGMENTATION_MODEL.LOAD_SUCCESS?this.buildEnginePromise.rejectPromise(Error("Failed to build VideoFxProcessor's engine")):(this.logger.info("Successfully built the VideoFxEngine"),this.buildEnginePromise.resolvePromise())}settleSegmentationPromise(o){o?this.segmentationRequestPromise.resolveAndReplacePromise(o):this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation on the input image"))}settleSegmentationPromiseSAB(){try{let o=new ImageData(new Uint8ClampedArray(this.sharedImageData),q.SEGMENTATION_MODEL.WIDTH_IN_PIXELS,q.SEGMENTATION_MODEL.HEIGHT_IN_PIXELS);this.segmentationRequestPromise.resolveAndReplacePromise(o)}catch(o){this.segmentationRequestPromise.rejectAndReplacePromise(Error("Failed to perform a segmentation with a shared array buffer on the input image"))}}setToNoOpProcess(){this.process=this.noOpProcess}static isSupported(o=new x.default,p=!0){return m(this,void 0,void 0,function*(){let f=!0,checkEnv=(p,m)=>{p&&(o.info(m),f=!1)};checkEnv("u"m(this,void 0,void 0,function*(){if(p)try{let p=new VideoFxProcessor(o);yield p.loadAssets(),yield p.destroy()}catch{return o.info("Browser environment is unable to access the required external assets."),Promise.resolve(!1)}return Promise.resolve(!0)});return Promise.resolve(!!f&&(yield checkProcessor()))})}static create(o,p,f=q.RESOURCE_CONSTRAINTS.DEFAULT_PROCESSING_BUDGET_PER_FRAME,_){return m(this,void 0,void 0,function*(){let m=new VideoFxProcessor(o,f);_&&m.setVideoFxSpec(_);try{return yield m.loadAssets(),yield m.setEffectConfig(p),m}catch(p){throw o.error(p.toString()),m.setToNoOpProcess(),Error("VideoFxProcessor built with support for only NoOp processing")}})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishVideoFxConfigEvent())}publishVideoFxConfigEvent(){let o={backgroundBlurEnabled:this.effectConfig.backgroundBlur.isEnabled.toString(),backgroundBlurStrength:this.effectConfig.backgroundBlur.strength,backgroundReplacementEnabled:this.effectConfig.backgroundReplacement.isEnabled.toString(),backgroundFilterVersion:2};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}sameVideoFxConfig(o,p){return o.backgroundBlur.isEnabled===p.backgroundBlur.isEnabled&&o.backgroundBlur.strength===p.backgroundBlur.strength&&o.backgroundReplacement.backgroundImageURL===p.backgroundReplacement.backgroundImageURL&&o.backgroundReplacement.defaultColor===p.backgroundReplacement.defaultColor&&o.backgroundReplacement.isEnabled===p.backgroundReplacement.isEnabled}};p.default=ee,ee.isSharedArrayBufferSupported="u">typeof SharedArrayBuffer},0x1d603096a:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VideoFxSegmentationRateManager=void 0;let m=f(0x23955cc68);p.VideoFxSegmentationRateManager=class{constructor(o,p){this.logger=o,this.targetSegmentationCyclePercentage=p/100,this.frameCountOverSamplingPeriod=0,this.totalSegmentationDurationOverSamplingPeriod=0,this.samplingPeriodStartTime=performance.now(),this.framesPerSegmentation=m.RESOURCE_CONSTRAINTS.SEGMENTATION_DEFAULT_FRAMES_PER_SEGMENTATION}submitFrame(){this.frameCountOverSamplingPeriod++}shouldApplySegmentation(){return this.frameCountOverSamplingPeriod%this.framesPerSegmentation==0}startSegmentation(){this.frameSegmentationStartTime=performance.now()}completeSegmentation(){this.totalSegmentationDurationOverSamplingPeriod+=performance.now()-this.frameSegmentationStartTime,this.frameCountOverSamplingPeriod>=m.RESOURCE_CONSTRAINTS.SEGMENTATION_SAMPLING_PERIOD_FRAME_COUNT&&this.adjustFramesPerSegmentation(this.totalSegmentationDurationOverSamplingPeriod/(performance.now()-this.samplingPeriodStartTime))}adjustFramesPerSegmentation(o){o>this.targetSegmentationCyclePercentage?(this.framesPerSegmentation++,this.logger.info(`Segmentation cycle percentage above the configured maximal value. Decreasing segmentation rate to 1 segmentation per ${this.framesPerSegmentation} frames`)):this.framesPerSegmentation>1&&o{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x5b4a3d7a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class DefaultVideoStreamIdSet{constructor(o){this.ids=new Set(o)}add(o){this.ids.add(o)}array(){return Array.from(this.ids.values()).sort((o,p)=>o-p)}contain(o){return this.ids.has(o)}forEach(o){this.ids.forEach(o)}empty(){return 0===this.ids.size}size(){return this.ids.size}equal(o){if(!o)return 0===this.ids.size;let p=this.array(),f=o.array();if(p.length!==f.length)return!1;for(let o=0;o0&&o<1e3?1:Math.trunc(o/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];let o=[];return this.currentIndex.sources.forEach(p=>{let f=new I.default;f.attendeeId=p.attendeeId,f.groupId=p.groupId,f.streamId=p.streamId,f.maxBitrateKbps=p.maxBitrateKbps,f.avgBitrateKbps=this.convertBpsToKbps(p.avgBitrateBps),f.width=p.width,f.height=p.height,f.maxFrameRate=p.framerate,o.push(f)}),o}integrateUplinkPolicyDecision(o){if(o&&o.length){let p=o[0];this.videoStreamDescription.maxBitrateKbps=p.maxBitrate/1e3,this.videoStreamDescription.maxFrameRate=p.maxFramerate}}integrateIndexFrame(o){if(this.currentIndex=o,!o)return;let p=new Map,f=!1;for(let m of o.sources){if(!p.has(m.attendeeId)){p.set(m.attendeeId,m.groupId);continue}let o=p.get(m.attendeeId);op.get(o.attendeeId)===o.groupId)),this.streamToAttendeeMap=null,this.groupIdToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}remoteVideoUpdateSent(){this.indexForLastRemoteVideoUpdate=this.currentIndex}integrateSubscribeAckFrame(o){this.currentSubscribeAck=o,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToGroupMap=this.buildSSRCToGroupMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe),this.sendVideoStreamId=0,o.allocations&&void 0!==o.allocations&&o.allocations.length>0&&(this.sendVideoStreamId=o.allocations[0].streamId)}integrateBitratesFrame(o){if(this.currentIndex)for(let p of o.bitrates){let o=this.currentIndex.sources.find(o=>o.streamId===p.sourceStreamId);void 0!==o&&(o.avgBitrateBps=p.avgBitrateBps)}}allStreams(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.sources)o.add(p.streamId);return o}allVideoSendingSourcesExcludingSelf(o){let p=[],f=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(let m of this.currentIndex.sources){let{attendeeId:w,externalUserId:I,mediaType:k}=m;w===o||k!==_.SdkStreamMediaType.VIDEO||f.has(w)||(p.push({attendee:{attendeeId:w,externalUserId:I}}),f.add(w))}return p}streamSelectionUnderBandwidthConstraint(o,p,f,m){let I=new Set;if(this.currentIndex)for(let m of this.currentIndex.sources)m.attendeeId!==o&&m.mediaType===_.SdkStreamMediaType.VIDEO&&(p.has(m.attendeeId)||f.has(m.attendeeId)||I.add(m.attendeeId));let k=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(o),M=new Map,x=0;k.forEach((o,p)=>{M.set(p,o[0]),x+=o[0].maxBitrateKbps}),x=this.trySelectHighBitrateForAttendees(k,p,x,m,M),this.trySelectHighBitrateForAttendees(k,I,x,m,M);let O=new w.default;for(let o of M.values())O.add(o.streamId);return O}highestQualityStreamFromEachGroupExcludingSelf(o){let p=new w.default;if(this.currentIndex){let f=new Map;for(let p of this.currentIndex.sources)p.attendeeId!==o&&p.mediaType===_.SdkStreamMediaType.VIDEO&&(!f.has(p.groupId)||p.maxBitrateKbps>f.get(p.groupId).maxBitrateKbps)&&f.set(p.groupId,p);for(let o of f.values())p.add(o.streamId)}return p}numberOfVideoPublishingParticipantsExcludingSelf(o){return this.highestQualityStreamFromEachGroupExcludingSelf(o).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToAttendeeMap)return this.logger.warn(`no attendee found for track ${o}`),"";let f=this.subscribeStreamToAttendeeMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known attendee`),"")}externalUserIdForTrack(o){let p=this.streamIdForTrack(o);if(void 0===p||!this.subscribeStreamToExternalUserIdMap)return this.logger.warn(`no external user id found for track ${o}`),"";let f=this.subscribeStreamToExternalUserIdMap.get(p);return f||(this.logger.info(`track ${o} (stream ${p}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(o){if(!this.streamToAttendeeMap)if(!this.currentIndex)return"";else this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex);let p=this.streamToAttendeeMap.get(o);return p||(this.logger.info(`stream ID ${o} does not correspond to a known attendee`),"")}attendeeIdForGroupId(o){if(!this.groupIdToAttendeeMap)if(!this.currentIndex)return"";else this.groupIdToAttendeeMap=this.buildGroupIdToAttendeeMap(this.currentIndex);let p=this.groupIdToAttendeeMap.get(o);return p||(this.logger.info(`group ID ${o} does not correspond to a known attendee`),"")}groupIdForStreamId(o){if(this.currentIndex&&this.currentIndex.sources){for(let p of this.currentIndex.sources)if(p.streamId===o)return p.groupId;if(this.indexForSubscribe){for(let p of this.indexForSubscribe.sources)if(p.streamId===o)return p.groupId}if(this.indexForLastRemoteVideoUpdate){for(let p of this.indexForLastRemoteVideoUpdate.sources)if(p.streamId===o)return p.groupId}}}StreamIdsInSameGroup(o,p){return this.groupIdForStreamId(o)===this.groupIdForStreamId(p)}streamIdForTrack(o){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(o)}streamIdForSSRC(o){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(o)}overrideStreamIdMappings(o,p){if(this.subscribeTrackToStreamMap){for(let[f,m]of this.subscribeTrackToStreamMap.entries())if(o===m){this.subscribeTrackToStreamMap.set(f,p);break}}if(this.subscribeSsrcToStreamMap){for(let[f,m]of this.subscribeSsrcToStreamMap.entries())if(o===m){this.subscribeSsrcToStreamMap.set(f,p);break}}}groupIdForSSRC(o){if(this.subscribeSsrcToGroupMap)return this.subscribeSsrcToGroupMap.get(o)}streamsPausedAtSource(){let o=new w.default;if(this.currentIndex)for(let p of this.currentIndex.pausedAtSourceIds)o.add(p);return o}sendVideoStreamIdFromRid(o){return this.sendVideoStreamId}buildTrackToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`trackMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.trackLabel,f.streamId);return p}buildSSRCToStreamMap(o){let p=new Map;for(let f of(this.logger.debug(()=>`ssrcMap ${JSON.stringify(o.tracks)}`),o.tracks))f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,f.streamId);return p}buildSSRCToGroupMap(o){let p=new Map;for(let f of o.tracks)f.trackLabel.length>0&&f.streamId>0&&p.set(f.ssrc,this.groupIdForStreamId(f.streamId));return p}buildStreamToAttendeeMap(o){let p=new Map;if(o)for(let f of o.sources)p.set(f.streamId,f.attendeeId);return p}buildGroupIdToAttendeeMap(o){let p=new Map;for(let f of o.sources)p.set(f.groupId,f.attendeeId);return p}buildStreamExternalUserIdMap(o){let p=new Map;if(o)for(let f of o.sources)f.externalUserId&&p.set(f.streamId,f.externalUserId);return p}trySelectHighBitrateForAttendees(o,p,f,m,_){for(let w of p){if(f>=m)break;if(o.has(w)){for(let p of o.get(w).reverse())if(f-_.get(w).maxBitrateKbps+p.maxBitrateKbps{o.sort((o,p)=>o.maxBitrateKbps>p.maxBitrateKbps?1:o.maxBitrateKbps{o.push(p.clone())}),o}integrateUplinkPolicyDecision(o){let p=!0,f=0;for(let m=0;m0&&(this._localStreamInfos[f].timeEnabled=Date.now()),this._localStreamInfos[f].maxBitrateKbps=_,this._localStreamInfos[f].maxFrameRate=w,this._localStreamInfos[f].disabledByUplinkPolicy=0===_,f++}p&&this._localStreamInfos.splice(f)}integrateBitratesFrame(o){super.integrateBitratesFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let f of o.bitrates)p.add(f.sourceStreamId),this.streamIdToBitrateKbpsMap.set(f.sourceStreamId,this.convertBpsToKbps(f.avgBitrateBps));for(let o of f)p.has(o)||(this.streamIdToBitrateKbpsMap.get(o)===SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(o,SimulcastVideoStreamIndex.NOT_SENDING_STREAM_BITRATE));this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let o="";for(let p of this._localStreamInfos)o+=`streamId=${p.streamId} maxBitrate=${p.maxBitrateKbps} disabledByUplink=${p.disabledByUplinkPolicy}
`;this.logger.debug(()=>o)}integrateIndexFrame(o){super.integrateIndexFrame(o);let p=new Set,f=new Set(this.streamIdToBitrateKbpsMap.keys());for(let o of this.currentIndex.sources)o.mediaType===_.SdkStreamMediaType.VIDEO&&(p.add(o.streamId),this.streamIdToBitrateKbpsMap.has(o.streamId)||this.streamIdToBitrateKbpsMap.set(o.streamId,SimulcastVideoStreamIndex.UNSEEN_STREAM_BITRATE));for(let o of f)p.has(o)||this.streamIdToBitrateKbpsMap.delete(o)}integrateSubscribeAckFrame(o){if(super.integrateSubscribeAckFrame(o),!o.allocations||void 0===o.allocations)return;let p=0;for(let f of(this._sendRidToVideoStreamIdMap.clear(),o.allocations)){if(this._localStreamInfos.length{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x252035ee7);p.default=class VideoStreamDescription{constructor(o,p,f,m,_){this.attendeeId="",this.groupId=0,this.streamId=0,this.ssrc=0,this.trackLabel="",this.maxBitrateKbps=0,this.avgBitrateKbps=0,this.maxFrameRate=0,this.width=0,this.height=0,this.timeEnabled=0,this.disabledByWebRTC=!1,this.disabledByUplinkPolicy=!1,this.rid="",this.attendeeId=o,this.groupId=p,this.streamId=f,this.maxBitrateKbps=m,this.avgBitrateKbps=_}clone(){let o=new VideoStreamDescription;return o.attendeeId=this.attendeeId,o.groupId=this.groupId,o.streamId=this.streamId,o.ssrc=this.ssrc,o.trackLabel=this.trackLabel,o.maxBitrateKbps=this.maxBitrateKbps,o.avgBitrateKbps=this.avgBitrateKbps,o.maxFrameRate=this.maxFrameRate,o.timeEnabled=this.timeEnabled,o.disabledByUplinkPolicy=this.disabledByUplinkPolicy,o.width=this.width,o.height=this.height,o}toStreamDescriptor(){let o=m.SdkStreamDescriptor.create();return o.mediaType=m.SdkStreamMediaType.VIDEO,o.trackLabel=this.trackLabel,o.attendeeId=this.attendeeId,o.streamId=this.streamId,o.groupId=this.groupId,o.framerate=this.maxFrameRate,o.maxBitrateKbps=this.disabledByUplinkPolicy?0:this.maxBitrateKbps,o.avgBitrateBps=this.avgBitrateKbps,o}totalPixels(){return this.width*this.height}}},9224556e3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observerQueue=new Set,this.element=null,this.resizeObserver=new ResizeObserver(o=>{for(let p of o){let{width:o,height:f}=p.contentRect;this.notifyObservers(o,f)}})}notifyObservers(o,p){for(let f of this.observerQueue)f.videoElementResolutionChanged(o,p)}registerObserver(o){this.observerQueue.add(o)}removeObserver(o){this.observerQueue.delete(o)}bindVideoElement(o){this.element!==o&&(this.element&&this.resizeObserver.unobserve(this.element),this.element=o,this.element&&this.resizeObserver.observe(this.element))}}},0xb747ec80:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x9a4430b2)),w=m(f(0x230534cc6)),I=m(f(0x1a64b5418));p.default=class DefaultVideoTile{constructor(o,p,f,m,_){this.tileController=f,this.devicePixelRatioMonitor=m,this.resolutionMonitor=_,this.tileState=new I.default,this.tileState.tileId=o,this.tileState.localTile=p,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(o,p,f){let m=f&&"environment"!==o.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";if(DefaultVideoTile.setVideoElementFlag(p,"disablePictureInPicture",f),DefaultVideoTile.setVideoElementFlag(p,"disableRemotePlayback",f),p.style.transform!==m&&(p.style.transform=m),p.hasAttribute("controls")&&p.removeAttribute("controls"),p.hasAttribute("autoplay")||p.setAttribute("autoplay","true"),p.hasAttribute("playsinline")||p.setAttribute("playsinline","true"),p.hasAttribute("muted")||(p.setAttribute("muted","true"),p.muted=!0),p.srcObject!==o&&(p.srcObject=o,new _.default().requiresVideoPlayWorkaround()&&p.paused)){let o=p.play();void 0!==o&&o.catch(o=>{console.warn("Error playing video in Safari",o)}).then(()=>{console.debug("Video played successfully in Safari")})}}static disconnectVideoStreamFromVideoElement(o,p,f=!1){if(o)if(p)f||(o.srcObject=null,o.style.transform="");else{if(!o.srcObject)return;o.pause(),o.style.transform="",DefaultVideoTile.setVideoElementFlag(o,"disablePictureInPicture",!1),DefaultVideoTile.setVideoElementFlag(o,"disableRemotePlayback",!1),o.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new I.default}devicePixelRatioChanged(o){this.tileState.devicePixelRatio=o,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(o,p,f,m,_,I,k,M){let x=!1;this.tileState.boundAttendeeId!==o&&(this.tileState.boundAttendeeId=o,new w.default(o).hasModality(w.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),x=!0),this.tileState.boundExternalUserId!==k&&(this.tileState.boundExternalUserId=k,x=!0),this.tileState.localTile!==p&&(this.tileState.localTile=p,x=!0),this.tileState.boundVideoStream!==f&&(this.tileState.boundVideoStream=f,x=!0),this.tileState.videoStreamContentWidth!==m&&(this.tileState.videoStreamContentWidth=m,x=!0),this.tileState.videoStreamContentHeight!==_&&(this.tileState.videoStreamContentHeight=_,x=!0),this.tileState.streamId!==I&&(this.tileState.streamId=I,x=!0),this.tileState.groupId!==M&&(this.tileState.groupId=M,x=!0),x&&this.sendTileStateUpdate()}bindVideoElement(o){var p;let f=!1;this.tileState.boundVideoElement!==o&&(this.tileState.boundVideoElement=o,null==(p=this.resolutionMonitor)||p.bindVideoElement(this.tileState.boundVideoElement),f=!0),null!==this.tileState.boundVideoElement?(this.tileState.videoElementCSSWidthPixels!==o.clientWidth&&(this.tileState.videoElementCSSWidthPixels=o.clientWidth,f=!0),this.tileState.videoElementCSSHeightPixels!==o.clientHeight&&(this.tileState.videoElementCSSHeightPixels=o.clientHeight,f=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),f&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return!this.tileState.poorConnection&&(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return!!this.tileState.poorConnection&&(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0)}capture(){if(!this.tileState.active)return null;let o=document.createElement("canvas"),p=this.tileState.boundVideoElement;o.width=p.videoWidth||p.width,o.height=p.videoHeight||p.height;let f=o.getContext("2d");return f.drawImage(p,0,0,o.width,o.height),f.getImageData(0,0,o.width,o.height)}setStreamId(o){this.tileState.streamId=o,this.tileController.sendTileStateUpdate(this.state())}sendTileStateUpdate(){this.updateActiveState(),this.updateVideoStreamOnVideoElement(),this.updateVideoElementPhysicalPixels(),this.tileController.sendTileStateUpdate(this.state())}updateActiveState(){this.tileState.active=!!(!this.tileState.paused&&!this.tileState.poorConnection&&this.tileState.boundAttendeeId&&this.tileState.boundVideoElement&&this.tileState.boundVideoStream)}updateVideoElementPhysicalPixels(){"number"==typeof this.tileState.videoElementCSSWidthPixels&&"number"==typeof this.tileState.videoElementCSSHeightPixels?(this.tileState.videoElementPhysicalWidthPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSWidthPixels,this.tileState.videoElementPhysicalHeightPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSHeightPixels):(this.tileState.videoElementPhysicalWidthPixels=null,this.tileState.videoElementPhysicalHeightPixels=null)}updateVideoStreamOnVideoElement(){this.tileState.active?DefaultVideoTile.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):DefaultVideoTile.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(o,p,f){p in o&&(o[p]=f)}}},0x1a64b5418:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class VideoTileState{constructor(){this.tileId=null,this.localTile=!1,this.localTileStarted=!1,this.isContent=!1,this.active=!1,this.paused=!1,this.poorConnection=!1,this.boundAttendeeId=null,this.boundExternalUserId=null,this.boundVideoStream=null,this.boundVideoElement=null,this.nameplate=null,this.videoStreamContentWidth=null,this.videoStreamContentHeight=null,this.videoElementCSSWidthPixels=null,this.videoElementCSSHeightPixels=null,this.devicePixelRatio=0,this.videoElementPhysicalWidthPixels=null,this.videoElementPhysicalHeightPixels=null,this.streamId=null,this.groupId=null}clone(){let o=new VideoTileState;return o.tileId=this.tileId,o.localTile=this.localTile,o.isContent=this.isContent,o.active=this.active,o.paused=this.paused,o.poorConnection=this.poorConnection,o.boundAttendeeId=this.boundAttendeeId,o.boundExternalUserId=this.boundExternalUserId,o.boundVideoStream=this.boundVideoStream,o.boundVideoElement=this.boundVideoElement,o.nameplate=this.nameplate,o.videoStreamContentWidth=this.videoStreamContentWidth,o.videoStreamContentHeight=this.videoStreamContentHeight,o.videoElementCSSWidthPixels=this.videoElementCSSWidthPixels,o.videoElementCSSHeightPixels=this.videoElementCSSHeightPixels,o.devicePixelRatio=this.devicePixelRatio,o.videoElementPhysicalWidthPixels=this.videoElementPhysicalWidthPixels,o.videoElementPhysicalHeightPixels=this.videoElementPhysicalHeightPixels,o.streamId=this.streamId,o.groupId=this.groupId,o}}},0x129e504bc:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x170a3ef32)),I=_(f(0x167bde784)),k=_(f(0x2074869bd)),M=f(0xab1ef933),x=_(f(9224556e3)),O=_(f(0xb747ec80));p.default=class{constructor(o,p,f){this.tileFactory=o,this.audioVideoController=p,this.logger=f,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set,this.resolutionObservers=new Set,this.keepLastFrameWhenPaused=!1,this.keepLastFrameWhenPaused=p.configuration.keepLastFrameWhenPaused}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new I.default(new k.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return m(this,void 0,void 0,function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;let o=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,o.destroy()})}bindVideoElement(o,p){let f=this.getVideoTile(o);null===f?this.logger.warn(`Ignoring video element binding for unknown tile id ${o}`):f.bindVideoElement(p)}unbindVideoElement(o,p=!0){let f=this.getVideoTile(o);if(null===f)return void this.logger.warn(`Ignoring video element unbinding for unknown tile id ${o}`);this.logger.info("Unbinding the video element"),this.notifyRemoteObserversOfUnbound(f.state().boundAttendeeId);let m=f.stateRef().boundVideoElement;f.bindVideoElement(null),p&&(this.logger.info("Cleaning up the video element"),O.default.disconnectVideoStreamFromVideoElement(m,!1))}startLocalVideoTile(){if(this.audioVideoController.configuration.meetingFeatures.videoMaxResolution===w.default.VideoDisabled)return this.logger.warn("Could not start camera video because max video resolution was set to None"),-1;let o=this.findOrCreateLocalVideoTile();return this.currentLocalTile.stateRef().localTileStarted=!0,this.audioVideoController.update({needsRenegotiation:!0}),o.id()}stopLocalVideoTile(){this.currentLocalTile&&(this.currentLocalTile.stateRef().localTileStarted=!1,this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.audioVideoController.update({needsRenegotiation:!0}))}hasStartedLocalVideoTile(){return!!(this.currentLocalTile&&this.currentLocalTile.stateRef().localTileStarted)}removeLocalVideoTile(){this.currentLocalTile&&this.removeVideoTile(this.currentLocalTile.id())}getLocalVideoTile(){return this.currentLocalTile}pauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)||(this.audioVideoController.pauseReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.add(o)),p.pause())}unpauseVideoTile(o){let p=this.getVideoTile(o);p&&(this.currentPausedTilesByIds.has(o)&&(this.audioVideoController.resumeReceivingStream(p.stateRef().streamId),this.currentPausedTilesByIds.delete(o)),p.unpause())}getVideoTile(o){return this.tileMap.has(o)?this.tileMap.get(o):null}getVideoTileArea(o){let p=o.state(),f=0,m=0;return p.boundVideoElement&&(f=p.boundVideoElement.clientHeight*p.devicePixelRatio,m=p.boundVideoElement.clientWidth*p.devicePixelRatio),f*m}getAllRemoteVideoTiles(){let o=[];return this.tileMap.forEach((p,f)=>{this.currentLocalTile&&f===this.currentLocalTile.id()||o.push(p)}),o}getAllVideoTiles(){return Array.from(this.tileMap.values())}addVideoTile(o=!1){let p=this.nextTileId;this.nextTileId+=1,this.createDevicePixelRatioMonitorIfNeeded();let f=this.tileFactory.makeTile(p,o,this,this.devicePixelRatioMonitor,this.createResolutionMonitor(p));return this.tileMap.set(p,f),f}removeVideoTile(o){if(!this.tileMap.has(o))return;let p=this.tileMap.get(o);this.currentLocalTile===p&&(this.currentLocalTile=null),p.destroy(),this.tileMap.delete(o),this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileWasRemoved).map(f=>f.bind(p)(o))}),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(o){let p=[];for(let f of this.getAllVideoTiles()){let m=f.state();m.boundAttendeeId===o&&(this.removeVideoTile(m.tileId),p.push(m.tileId))}return p}removeAllVideoTiles(){for(let o of Array.from(this.tileMap.keys()))this.removeVideoTile(o)}sendTileStateUpdate(o){this.audioVideoController.forEachObserver(p=>{M.Maybe.of(p.videoTileDidUpdate).map(f=>f.bind(p)(o))})}haveVideoTilesWithStreams(){for(let o of this.getAllVideoTiles())if(o.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(o){return!!this.getVideoTileForAttendeeId(o)}getVideoTileForAttendeeId(o){for(let p of this.getAllVideoTiles())if(p.state().boundAttendeeId===o)return p}captureVideoTile(o){let p=this.getVideoTile(o);return p?p.capture():null}registerVideoTileResolutionObserver(o){this.resolutionObservers.add(o)}removeVideoTileResolutionObserver(o){this.resolutionObservers.delete(o)}notifyResolutionObserversOfChange(o,p,f){for(let m of this.resolutionObservers)m.videoTileResolutionDidChange(o,p,f)}notifyRemoteObserversOfUnbound(o){for(let p of this.resolutionObservers)p.videoTileUnbound(o)}createResolutionMonitor(o){let p=new class{constructor(o,p){this.controller=o,this.tileId=p}videoElementResolutionChanged(o,p){let f=this.controller.getVideoTile(this.tileId);if(f){let m=f.state().boundAttendeeId;this.controller.notifyResolutionObserversOfChange(m,o,p)}}}(this,o),f=new x.default;return f.registerObserver(p),f}findOrCreateLocalVideoTile(){return this.currentLocalTile||(this.currentLocalTile=this.addVideoTile(!0),this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId)),this.currentLocalTile}}},0x86c4609a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xb747ec80));p.default=class{makeTile(o,p,f,m,w){return new _.default(o,p,f,m,w)}}},0x12d110f57:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x11b1e3853:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x8f26277b)),w=m(f(0x4287252)),I=f(0xab1ef933),k=m(f(0x17f8c39ba)),M=m(f(0x12d110f57)),x=class DefaultSimulcastUplinkPolicy{constructor(o,p){this.selfAttendeeId=o,this.logger=p,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.videoIndex=null,this.observerQueue=new Set,this.hiTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd,this.enableFhdVideo=!1,this.optimalParameters=new k.default(0,0,0,0,!0),this.parametersInEffect=new k.default(0,0,0,0,!0),this.currentQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps]),this.newQualityMap=this.fillEncodingParamWithBitrates([this.lowTargetBitrateKbps,0,this.hiTargetBitrateKbps])}updateConnectionMetric(o){}calculateEncodingParameters(){let o=[new M.default,new M.default,new M.default];this.shouldDisableSimulcast?(this.newActiveStreams=0,o[0].maxBitrateKbps=0,o[1].maxBitrateKbps=this.hiTargetBitrateKbps,o[2].maxBitrateKbps=0):this.numSenders<=4?(this.newActiveStreams=1,o[0].maxBitrateKbps=this.lowTargetBitrateKbps,o[1].maxBitrateKbps=0,o[2].maxBitrateKbps=this.hiTargetBitrateKbps):(this.newActiveStreams=2,o[0].maxBitrateKbps=2*this.lowTargetBitrateKbps/3,o[1].maxBitrateKbps=this.numSenders<=6?this.midTargetBitrateKbps:.6*this.midTargetBitrateKbps,o[2].maxBitrateKbps=0);let p=o.map((o,p,f)=>o.maxBitrateKbps);return this.newQualityMap=this.fillEncodingParamWithBitrates(p),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters numSources:${this.numSenders} shouldDisableSimulcast:${this.shouldDisableSimulcast} newQualityMap: ${this.getQualityMapString(this.newQualityMap)}`),this.newQualityMap}chooseMediaTrackConstraints(){}chooseEncodingParameters(){return this.currentQualityMap=this.newQualityMap,this.activeStreamsToPublish!==this.newActiveStreams&&(this.activeStreamsToPublish=this.newActiveStreams,this.publishEncodingSimulcastLayer()),this.currentQualityMap}updateIndex(o){let p=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,f=p!==this.numSenders,m=o.numberOfParticipants(),_=m>=0&&m<=2,w=this.shouldDisableSimulcast!==_;this.numSenders=p,this.shouldDisableSimulcast=_,this.optimalParameters=new k.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=o,(f||w)&&(this.newQualityMap=this.calculateEncodingParameters())}wantsResubscribe(){return!this.encodingParametersEqual()}compareEncodingParameter(o,p){return JSON.stringify(o)===JSON.stringify(p)}encodingParametersEqual(){let o=!1;for(let p of w.default.NAME_ARR_ASCENDING)if(o=o||!this.compareEncodingParameter(this.newQualityMap.get(p),this.currentQualityMap.get(p)))break;return!o}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return this.enableFhdVideo?1920:1280}captureHeight(){return this.enableFhdVideo?1080:768}captureFrameRate(){return 15}maxBandwidthKbps(){return this.enableFhdVideo?2500:1400}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableFhdVideo=o,this.hiTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kHiTargetBitrateKbpsHd,this.midTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kMidTargetBitrateKbpsHd,this.lowTargetBitrateKbps=o?DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsFhd:DefaultSimulcastUplinkPolicy.kLowTargetBitrateKbpsHd}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!0}fillEncodingParamWithBitrates(o){let p=new Map,f=w.default.NAME_ARR_ASCENDING,m=this.shouldDisableSimulcast?1:4;for(let _=0;_0,scaleResolutionDownBy:Math.max(m,1),maxBitrate:1e3*o[_]}),m/=2}return p}getQualityMapString(o){let p="";return 3===this.videoIndex.localStreamDescriptions().length&&o.forEach(o=>{p+=`{ rid: ${o.rid} active:${o.active} maxBitrate:${o.maxBitrate}}`}),p}getEncodingSimulcastLayer(o){switch(o){case 0:return _.default.High;case 1:return _.default.LowAndHigh;case 2:return _.default.LowAndMedium}}publishEncodingSimulcastLayer(){let o=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver(p=>{I.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}addObserver(o){this.logger.info("adding simulcast uplink observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing simulcast uplink observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)o(p)}};p.default=x,x.kHiTargetBitrateKbpsHd=1200,x.kMidTargetBitrateKbpsHd=600,x.kLowTargetBitrateKbpsHd=300,x.kHiTargetBitrateKbpsFhd=2e3,x.kMidTargetBitrateKbpsFhd=1e3,x.kLowTargetBitrateKbpsFhd=500},0x13892dc9a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xf1a8ac2));p.default=class{constructor(o,p){this.encodingParams=p,this.enableUhdContent=!1,this.defaultHiTargetBitrateKbps=1200,this.defaultLowTargetBitrateKbps=300}updateConnectionMetric(o){}chooseMediaTrackConstraints(){}chooseEncodingParameters(){var o,p,f,m,w,I,k,M,x,O,L,B;let U=new Map,$=_.default.NAME_ARR_ASCENDING;return U.set($[0],{rid:$[0],active:!0,scaleResolutionDownBy:(null==(p=null==(o=this.encodingParams)?void 0:o.low)?void 0:p.scaleResolutionDownBy)||2,maxBitrate:1e3*((null==(m=null==(f=this.encodingParams)?void 0:f.low)?void 0:m.maxBitrateKbps)||this.defaultLowTargetBitrateKbps),maxFramerate:(null==(I=null==(w=this.encodingParams)?void 0:w.low)?void 0:I.maxFramerate)||5}),U.set($[1],{rid:$[1],active:!0,scaleResolutionDownBy:(null==(M=null==(k=this.encodingParams)?void 0:k.high)?void 0:M.scaleResolutionDownBy)||1,maxBitrate:1e3*((null==(O=null==(x=this.encodingParams)?void 0:x.high)?void 0:O.maxBitrateKbps)||this.defaultHiTargetBitrateKbps),maxFramerate:null==(B=null==(L=this.encodingParams)?void 0:L.high)?void 0:B.maxFramerate}),U}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return this.enableUhdContent?2e3:1200}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){this.enableUhdContent=o,this.defaultHiTargetBitrateKbps=o?2e3:1200,this.defaultLowTargetBitrateKbps=o?500:300}addObserver(o){}removeObserver(o){}forEachObserver(o){}}},0xf9210d7b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x17f8c39ba)),I=class NScaleVideoUplinkBandwidthPolicy{constructor(o,p=!0,f,m){this.selfAttendeeId=o,this.scaleResolution=p,this.logger=f,this.browserBehavior=m,this.numberOfPublishedVideoSources=void 0,this.idealMaxBandwidthKbps=1500,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.enableHighResolutionFeature=!1,this.enableSVC=!1,this.isUsingSVCCodec=!0,this.numParticipants=0,this.reset()}reset(){this.numberOfPublishedVideoSources=void 0,this.optimalParameters=new w.default(0,0,0,0,!1),this.parametersInEffect=new w.default(0,0,0,0,!1),this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){var p;let f=!0;this.transceiverController&&(f=this.transceiverController.hasVideoInput());let m=o.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+ +!!f,_=o.numberOfParticipants();if(this.numParticipants===_&&this.numberOfPublishedVideoSources===m){null==(p=this.logger)||p.debug("Skipping update index; Number of participants has not changed");return}this.numberOfPublishedVideoSources=m,this.numParticipants=_,this.updateOptimalParameters()}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}updateOptimalParameters(){let o=1;if(this.transceiverController){let p=this.getStreamCaptureSetting();p&&(o=this.calculateEncodingParameters(p).scaleResolutionDownBy)}this.optimalParameters=new w.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,o,this.enableSVC&&this.numParticipants>2&&this.isUsingSVCCodec)}captureWidth(){let o=640;return this.getNumberOfPublishedVideoSources()>4&&(o=320),o}captureHeight(){let o=384;return this.getNumberOfPublishedVideoSources()>4&&(o=192),o}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);return Math.trunc(2>=this.getNumberOfPublishedVideoSources()?this.idealMaxBandwidthKbps:4>=this.getNumberOfPublishedVideoSources()?2*this.idealMaxBandwidthKbps/3:(544/11+14880/(11*this.getNumberOfPublishedVideoSources()))/600*this.idealMaxBandwidthKbps)}setIdealMaxBandwidthKbps(o){this.idealMaxBandwidthKbps=o}setHasBandwidthPriority(o){this.hasBandwidthPriority=o}setTransceiverController(o){this.transceiverController=o}setSVCEnabled(o){var p;this.enableSVC=o,null==(p=this.logger)||p.info(`setSVCEnabled, enable: ${o}}`)}setHighResolutionFeatureEnabled(o){this.enableHighResolutionFeature=o}updateTransceiverController(){return m(this,void 0,void 0,function*(){let o=this.getStreamCaptureSetting();if(!o)return;let p=this.calculateEncodingParameters(o);this.shouldUpdateEndcodingParameters(p)&&(this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey,p),this.transceiverController.setEncodingParameters(this.encodingParamMap))})}shouldUpdateEndcodingParameters(o){var p,f;let m=null==(f=null==(p=this.transceiverController.localVideoTransceiver().sender.getParameters())?void 0:p.encodings)?void 0:f[0];return o.maxBitrate!==(null==m?void 0:m.maxBitrate)||o.scaleResolutionDownBy!==(null==m?void 0:m.scaleResolutionDownBy)||(null==o?void 0:o.scalabilityMode)!==(null==m?void 0:m.scalabilityMode)}calculateEncodingParameters(o){var p,f,m;let _=1e3*this.maxBandwidthKbps(),w=1,I=720;if(void 0!==o.height&&void 0!==o.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2&&(480===(I=NScaleVideoUplinkBandwidthPolicy.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),NScaleVideoUplinkBandwidthPolicy.targetHeightArray.length-1)][+!!this.enableHighResolutionFeature])&&(null==(p=this.browserBehavior)?void 0:p.disable480pResolutionScaleDown())&&(I=360),w=Math.max(Math.min(o.height,o.width)/I,1),null==(f=this.logger)||f.info(`Resolution scale factor is ${w} for capture resolution ${o.width}x${o.height}. New dimension is ${o.width/w}x${o.height/w}`)),!this.enableSVC)return{scaleResolutionDownBy:w,maxBitrate:_};{let o;return o=this.numParticipants>=0&&this.numParticipants<3||!this.isUsingSVCCodec?"L1T1":"L3T3",null==(m=this.logger)||m.info(`calculateEncodingParameters: SVC: ${this.enableSVC} participants: ${this.numParticipants} publishers: ${this.getNumberOfPublishedVideoSources()} bitrate: ${_} targetHeight: ${I} scalabilityMode: ${o} isUsingSVCCodec: ${this.isUsingSVCCodec}`),{scaleResolutionDownBy:w,maxBitrate:_,scalabilityMode:o}}}getStreamCaptureSetting(){var o,p,f,m;return null==(m=null==(f=null==(p=null==(o=this.transceiverController)?void 0:o.localVideoTransceiver())?void 0:p.sender)?void 0:f.track)?void 0:m.getSettings()}getNumberOfPublishedVideoSources(){var o;return null!=(o=this.numberOfPublishedVideoSources)?o:0}wantsVideoDependencyDescriptorRtpHeaderExtension(){return this.enableSVC}setMeetingSupportedVideoSendCodecs(o,p){let f=null!=o?o:p,m=f.length>0&&NScaleVideoUplinkBandwidthPolicy.SVCCodecNames.includes(f[0].codecName);m!==this.isUsingSVCCodec&&(this.isUsingSVCCodec=m,this.updateOptimalParameters())}};p.default=I,I.encodingMapKey="video",I.targetHeightArray=[[0,0],[0,0],[0,0],[540,720],[540,720],[480,540],[480,540],[480,540],[480,540],[360,480],[360,480],[360,480],[360,480],[270,360],[270,360],[270,360],[270,360],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270],[180,270]],I.SVCCodecNames=["VP9"]},0x143cfada8:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x17f8c39ba));p.default=class{updateConnectionMetric(o){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(o){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new _.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(o){}setHasBandwidthPriority(o){}setHighResolutionFeatureEnabled(o){}wantsVideoDependencyDescriptorRtpHeaderExtension(){return!1}}},0x11982bbce:(o,p)=>{"use strict";function stringify(o){return o.map(o=>"object"==typeof o?JSON.stringify(o):`${o}`).join(" ")}Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.base=o}debug(...o){this.base.debug(stringify(o))}info(...o){this.base.info(stringify(o))}warn(...o){this.base.warn(stringify(o))}error(...o){this.base.error(stringify(o))}}},0xbb137ed2:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusDeviceTransformer=void 0;let w=f(0xed65dabf),I=f(0xb79a45b7),k=_(f(0x22a0f7c69)),M=_(f(0x11982bbce)),x=_(f(0xa8bfd6e5)),O=_(f(0x24cbcf4c2)),L=class VoiceFocusDeviceTransformer{constructor(o,{preload:p=!0,logger:f,fetchBehavior:m=VoiceFocusDeviceTransformer.defaultFetchBehavior()},_){this.spec=o,this.supported=!0,this.logger=f,this.vfLogger=f?new M.default(f):void 0,this.preload=p,this.fetchBehavior=m,this.spec=VoiceFocusDeviceTransformer.augmentSpec(this.spec),_&&(this.configuration=Promise.resolve(_))}static isSupported(o,p){var f,m;let _=VoiceFocusDeviceTransformer.defaultFetchBehavior(),k=(null==p?void 0:p.logger)?new M.default(p.logger):void 0;if(I.isIFramed())if((null==p?void 0:p.allowIFrame)===!1)return null==(f=null==p?void 0:p.logger)||f.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);else null==(m=null==p?void 0:p.logger)||m.warn("Amazon Voice Focus support check inside iframe: not recommended.");return w.VoiceFocus.isSupported(VoiceFocusDeviceTransformer.augmentSpec(o),{fetchBehavior:_,logger:k})}static create(o={},p={},f,_,w){var I,k,M;return m(this,void 0,void 0,function*(){_&&_.Meeting.Meeting&&(_=_.Meeting);let m=(null==(M=null==(k=null==(I=null==_?void 0:_.Meeting)?void 0:I.MeetingFeatures)?void 0:k.Audio)?void 0:M.EchoReduction)==="AVAILABLE",w=f&&!0===f.supported&&"ns_es"===f.model.name&&!m,x="ns_es"===o.name&&!m;if(w||x)throw Error("Echo Reduction requested but not enabled.");let O=new VoiceFocusDeviceTransformer(o,p,f);return yield O.init(),O})}static configure(o={},p={}){return m(this,void 0,void 0,function*(){return new VoiceFocusDeviceTransformer(o,p,void 0).configure(!0)})}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(o,p){return m(this,void 0,void 0,function*(){if(this.supported)try{let[f,m]=yield this.allocateVoiceFocus(!0),_=Object.assign(Object.assign({},p),{es:"ns_es"===this.spec.name});return new x.default(o,f,m,_)}catch{return}})}static destroyVoiceFocus(o){var p;return m(this,void 0,void 0,function*(){null==(p=null==o?void 0:o.vf)||p.destroy()})}static augmentSpec(o){return o&&(o.assetGroup||o.revisionID)?o:Object.assign(Object.assign({},o),{assetGroup:VoiceFocusDeviceTransformer.currentSDKAssetGroup()})}configure(o=!1){return m(this,void 0,void 0,function*(){let p={fetchBehavior:this.fetchBehavior,preResolve:o,logger:this.vfLogger};return w.VoiceFocus.configure(this.spec,p)})}init(){var o;return m(this,void 0,void 0,function*(){this.configuration||(this.configuration=this.configure());let p=yield this.configuration;if(!p.supported){this.supported=!1;return}this.pendingVoiceFocus=this.createVoiceFocus(p,this.preload);try{yield this.pendingVoiceFocus}catch(p){null==(o=this.logger)||o.error(`Unable to initialize Amazon Voice Focus: ${p}`),this.supported=!1}})}createVoiceFocus(o,p){return m(this,void 0,void 0,function*(){let f=new O.default;return this.vf=yield w.VoiceFocus.init(o,{delegate:f,preload:p,logger:this.vfLogger}),[this.vf,f]})}allocateVoiceFocus(o){return m(this,void 0,void 0,function*(){if(!this.supported)throw Error("Not supported.");if(this.pendingVoiceFocus){let o=this.pendingVoiceFocus;return this.pendingVoiceFocus=void 0,o}return this.createVoiceFocus((yield this.configuration),o)})}static majorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return k.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){let o=this.majorVersion();return o?`sdk-${o}`:"stable-v1"}static defaultFetchBehavior(){let o=VoiceFocusDeviceTransformer.majorMinorVersion()||"unknown",p=k.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(o)}&ua=${encodeURIComponent(p)}`}}};p.VoiceFocusDeviceTransformer=L,p.default=L},0xa8bfd6e5:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x9a4430b2));function isDefaultDevice(o){return"default"===o||!!o&&"object"==typeof o&&("deviceId"in o&&"default"===o.deviceId||"id"in o&&"default"===o.id)}p.default=class VoiceFocusTransformDevice{constructor(o,p,f,m,_=!1,I,k=new w.default,M=new Map,x,O){this.device=o,this.voiceFocus=p,this.delegate=f,this.nodeOptions=m,this.failed=_,this.node=I,this.browserBehavior=k,this.farEndStreamToAudioSourceNode=M,this.mixDestNode=x,this.mixSourceNode=O}getInnerDevice(){return this.device}mute(o){return m(this,void 0,void 0,function*(){this.node&&(o?yield this.node.disable():yield this.node.enable())})}stop(){return m(this,void 0,void 0,function*(){this.node&&(this.node.disconnect(),yield this.node.stop())})}chooseNewInnerDevice(o){return m(this,void 0,void 0,function*(){return this.device!==o||isDefaultDevice(o)?new VoiceFocusTransformDevice(o,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this})}intrinsicDevice(){return m(this,void 0,void 0,function*(){let o;if(this.failed)return this.device;let p=this.nodeOptions.es,f={echoCancellation:!p,googEchoCancellation:!p,googEchoCancellation2:!p,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};return(f.autoGainControl=o=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,f.googAutoGainControl=o,f.googAutoGainControl2=o,this.device)?"string"==typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?f.deviceId=this.device:f.deviceId={exact:this.device},f):this.device.id?this.device:Object.assign(Object.assign({},this.device),f):f})}createAudioNode(o){var p,f;return m(this,void 0,void 0,function*(){if((null==(p=this.node)?void 0:p.context)===o)return{start:this.node,end:this.node};let m=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{if(null==(f=this.node)||f.disconnect(),this.node=yield this.voiceFocus.createNode(o,m),this.nodeOptions.es){for(let p of(this.mixDestNode=new MediaStreamAudioDestinationNode(o,{channelCount:1,channelCountMode:"explicit"}),this.farEndStreamToAudioSourceNode.keys()))this.assignFarEndStreamToAudioSourceNode(p);this.createMixSourceNode()}let p=this.node,_=this.node;return{start:p,end:_}}catch(o){throw this.failed=!0,this.delegate.onFallback(this,o),o}})}observeMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.addAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.addFarEndStream(p)})}unObserveMeetingAudio(o){return m(this,void 0,void 0,function*(){if(!this.nodeOptions.es)return;o.removeAudioMixObserver(this);let p=yield o.getCurrentMeetingAudioStream();p&&this.removeFarendStream(p)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}addFarEndStream(o){return m(this,void 0,void 0,function*(){!this.nodeOptions.es||!o||this.farEndStreamToAudioSourceNode.has(o)||(this.node?this.assignFarEndStreamToAudioSourceNode(o):this.farEndStreamToAudioSourceNode.set(o,null))})}removeFarendStream(o){var p;return m(this,void 0,void 0,function*(){null==(p=this.farEndStreamToAudioSourceNode.get(o))||p.disconnect(),this.farEndStreamToAudioSourceNode.delete(o)})}meetingAudioStreamBecameActive(o){return m(this,void 0,void 0,function*(){this.addFarEndStream(o)})}meetingAudioStreamBecameInactive(o){return m(this,void 0,void 0,function*(){this.removeFarendStream(o)})}assignFarEndStreamToAudioSourceNode(o){let p=this.node.context.createMediaStreamSource(o);p.channelCount=1,p.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(o,p),p.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}}},0x24cbcf4c2:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}onFallback(o,p){var f;for(let m of this.observers)null==(f=m.voiceFocusFellBackToInnerStream)||f.call(m,o,p)}onCPUWarning(){var o;for(let p of this.observers)null==(o=p.voiceFocusInsufficientResources)||o.call(p)}}},0x20da5c30a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class DefaultVolumeIndicatorAdapter{constructor(o,p,f,m,_){this.logger=o,this.realtimeController=p,this.minVolumeDecibels=f,this.maxVolumeDecibels=m,this.selfAttendeeId=_,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(o){let p=0;for(let f of o.streams){let m=!!f.attendeeId,_=!!f.externalUserId,w=f.hasOwnProperty("muted"),I=!!f.dropped;if(m){this.attendeeIdToStreamId[f.attendeeId]&&this.attendeeIdToStreamId[f.attendeeId]f.audioStreamId&&this.streamIdToAttendeeId[p]===m){w=!0;break}}w||this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,_,I,{attendeeIndex:p++,attendeesInFrame:o.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(o),this.sessionReconnected=!1)}cleanUpState(o){let p=Object.values(this.streamIdToAttendeeId),f=o.streams.map(o=>o.attendeeId);for(let[o,m]of p.filter(o=>!f.includes(o)).entries()){let p=this.attendeeIdToStreamId[m],f=this.streamIdToExternalUserId[p];if(delete this.streamIdToAttendeeId[p],delete this.streamIdToExternalUserId[p],delete this.warnedAboutMissingStreamIdMapping[p],delete this.attendeeIdToStreamId[m],m===this.selfAttendeeId){this.logger.warn("the volume indicator adapter cleans up the current attendee (presence = false) after reconnection");continue}this.realtimeController.realtimeSetAttendeeIdPresence(m,!1,f,!1,{attendeeIndex:o,attendeesInFrame:m.length})}}sendRealtimeUpdatesForAudioMetadata(o){let p=null,f=null;for(let m of o.attendeeStates){let o=this.attendeeIdForStreamId(m.audioStreamId);m.hasOwnProperty("volume")&&(null===p&&(p={}),null!==o&&(p[o]=this.normalizedVolume(m))),m.hasOwnProperty("signalStrength")&&(null===f&&(f={}),null!==o&&(f[o]=this.normalizedSignalStrength(m)))}this.applyRealtimeUpdatesForAudioMetadata(p,f)}normalizedVolume(o){return Math.min(Math.max(1-(-o.volume-this.maxVolumeDecibels)/(this.minVolumeDecibels-this.maxVolumeDecibels),0),1)}normalizedSignalStrength(o){return Math.min(Math.max(o.signalStrength/DefaultVolumeIndicatorAdapter.MAX_SIGNAL_STRENGTH_LEVELS,0),1)}applyRealtimeUpdatesForAudioMetadata(o,p){for(let f in this.streamIdToAttendeeId){let m=this.streamIdToAttendeeId[f],_=this.streamIdToExternalUserId[f],w=null,I=null;null!==o&&(w=o.hasOwnProperty(m)?o[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_VOLUME),null!==p&&(I=p.hasOwnProperty(m)?p[m]:DefaultVolumeIndicatorAdapter.IMPLICIT_SIGNAL_STRENGTH),(null!==w||null!==I)&&this.realtimeController.realtimeUpdateVolumeIndicator(m,w,null,I,_)}}attendeeIdForStreamId(o){if(0===o)return null;let p=this.streamIdToAttendeeId[o];return p||(this.warnedAboutMissingStreamIdMapping[o]||(this.warnedAboutMissingStreamIdMapping[o]=!0,this.logger.warn(`volume indicator stream id ${o} seen before being defined`)),null)}};p.default=f,f.MAX_SIGNAL_STRENGTH_LEVELS=2,f.IMPLICIT_VOLUME=0,f.IMPLICIT_SIGNAL_STRENGTH=1},0x947abb4a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x22a0f7c69)),w=m(f(0x1a3216942));p.default=class{constructor(o){this.logger=o}create(o,p,f){this.connection=new WebSocket(f?o:_.default.urlWithVersion(o),p),this.connection.binaryType="arraybuffer"}send(o){if(!this.connection)return this.logger.error("WebSocket not yet created or already destroyed."),!1;try{return o instanceof Uint8Array?this.connection.send(o.buffer):this.connection.send(o),!0}catch(o){return this.logger.debug(()=>`send error: ${o.message}, websocket state=${w.default[this.readyState()]}`),!1}}close(o,p){var f;null==(f=this.connection)||f.close(o,p)}destroy(){this.connection=void 0}addEventListener(o,p){this.connection?this.connection.addEventListener(o,p):this.logger.warn("Cannot add event listener with no WebSocket connection.")}removeEventListener(o,p){var f;null==(f=this.connection)||f.removeEventListener(o,p)}readyState(){if(!this.connection)return w.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return w.default.Connecting;case WebSocket.OPEN:return w.default.Open;case WebSocket.CLOSING:return w.default.Closing;case WebSocket.CLOSED:return w.default.Closed}}}},0x1a3216942:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.WebSocketReadyState=void 0,(m=f=p.WebSocketReadyState||(p.WebSocketReadyState={}))[m.None=0]="None",m[m.Connecting=1]="Connecting",m[m.Open=2]="Open",m[m.Closing=3]="Closing",m[m.Closed=4]="Closed",p.default=f},0x21cc7ae41:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.decideModel=p.measureAndDecideExecutionApproach=void 0;let _=f(0x1e62759b2),w=f(0x1676280b0),I=3,k={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}},M=class{constructor(o,p){this.fetchConfig=o,this.logger=p;const f=`${o.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:o.headers,escapedQueryString:o.escapedQueryString},this.worker=(0,_.loadWorker)(f,"VoiceFocusEstimator",this.fetchBehavior,p)}roundtrip(o,p,f){return new Promise((m,_)=>{this.worker.then(_=>{let w;w=o=>{let{message:I,key:k}=o.data;I===p&&k===f&&(_.removeEventListener("message",w),m(o.data))},_.addEventListener("message",w),_.postMessage(o)}).catch(o=>{var p;null==(p=this.logger)||p.error("Failed to load worker.",o),_(o)})})}supportsSIMD(o){let p="simd",f=o||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,m={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:f,key:p};return this.roundtrip(m,"simd-support",p).then(o=>o.supports)}measure(o,p){let f=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,m=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,_=`bench:${o}`,w={message:"measure",fetchBehavior:this.fetchBehavior,budget:p,path:o?m:f,key:_};return this.roundtrip(w,"measurement",_).then(o=>{if(o.measurement)return o.measurement;throw Error("Failed to measure.")})}stop(){this.worker.then(o=>{var p;null==(p=this.logger)||p.debug("Stopping estimator worker."),o.terminate()}).catch(o=>{})}},featureCheck=(o,p,f,_)=>m(void 0,void 0,void 0,function*(){let m={supportsSIMD:o,supportsSAB:(0,w.supportsSharedArrayBuffer)(globalThis,window,f),duration:-1};if(o)return null==f||f.info("Supports SIMD: true (force)"),m;let I=_||new M(p,f);try{let p=!(0,w.isOldChrome)(window,f)&&(yield I.supportsSIMD());return null==f||f.info(`Supports SIMD: ${p} (force: ${o})`),m.supportsSIMD=p,m}finally{_||I.stop()}});p.measureAndDecideExecutionApproach=(o,p,f,_=k)=>m(void 0,void 0,void 0,function*(){let x,O=o.executionPreference,{usagePreference:L,variantPreference:B,namePreference:U,simdPreference:$,estimatorBudget:q,executionQuantaPreference:Z}=o;"interactivity"===L&&"inline"!==O&&(null==f||f.debug(`Overriding execution preference ${O} to reflect interactivity preference.`),O="inline");let ee="force"===$,et="auto"!==B,ei="auto"!==O;try{if(et&&ei)x=yield featureCheck(ee,p,f);else x=yield m(void 0,void 0,void 0,function*(){let o=new M(p,f);try{let m=yield featureCheck(ee,p,f,o);if(m.supportsSIMD)try{return m.duration=yield o.measure(!0,q),null==f||f.info("SIMD timing:",m.duration),m}catch{null==f||f.warn("Failed SIMD estimation; falling back to non-SIMD."),m.supportsSIMD=!1}return m.duration=yield o.measure(!1,q),null==f||f.info("No-SIMD timing:",m.duration),m}catch(o){throw null==f||f.error("Could not feature check.",o),o}finally{o.stop()}})}catch(o){throw null==f||f.error("Could not load estimator.",o),Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:o,supportsSAB:p,duration:f,executionPreference:m="auto",simdPreference:_,variantPreference:M="auto",namePreference:x="default",usagePreference:O,executionQuantaPreference:L=I},B=k,U)=>{let $="force"===_||"disable"!==_&&o,q=-1!==f,Z=q?($?2.5:2.63)/f:0,ee=$?B.simd:B.wasm,et=q?(1===L?.6:"quality"===O?.65*L:.5*L)*Z:0,ei=q?.7*Z:0,unsupported=o=>({supported:!1,reason:o});if(q){if(Z({supported:!0,useSIMD:$,processor:o,executionApproach:p,variant:f,executionQuanta:"inline"===p?L:void 0,name:x}),resolveVariant=(o,p,f)=>"auto"!==p?!q||o>f[p]?p:"failed":o>f.c100?"c100":o>f.c50?"c50":o>f.c20?"c20":o>f.c10?"c10":"failed",reducePreference=o=>{switch(o||"auto"){case"auto":{let o=reducePreference("inline"),p=reducePreference("worker");if(null==U||U.debug(`Reducing auto preference: ${JSON.stringify(o)} vs ${JSON.stringify(p)}`),!1===o.supported||!1===p.supported)return p;if(o.variant===p.variant||"c50"===o.variant)return o;return p}case"worker":if((0,w.supportsSharedArrayBuffer)(globalThis,window,U))return reducePreference("worker-sab");return reducePreference("worker-postMessage");case"inline":{let o=resolveVariant(et,M,ee.inline);if("failed"===o)return unsupported(`Performance score ${et} not sufficient for inline use with variant preference ${M}.`);return succeed("voicefocus-inline-processor","inline",o)}case"worker-sab":{if(!p){let o="Requested worker-sab but no SharedArrayBuffer support.";return null==U||U.warn(o),{supported:!1,reason:o}}let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use with variant preference ${M}.`);return succeed("voicefocus-worker-sab-processor","worker-sab",o)}case"worker-postMessage":{let o=resolveVariant(ei,M,ee.worker);if("failed"===o)return unsupported(`Performance score ${ei} not sufficient for worker use.`);if("ns_es"===x){let o="Requested echo suppression but postMessage executor does not support it.";return null==U||U.warn(o),{supported:!1,reason:o}}return succeed("voicefocus-worker-postMessage-processor","worker-postMessage",o)}}};return reducePreference(m)})(Object.assign(Object.assign({},x),{simdPreference:$,executionPreference:O,variantPreference:B,namePreference:U,usagePreference:L,executionQuantaPreference:Z}),_,f)}),p.decideModel=({category:o,name:p,variant:f,simd:m,url:_})=>`${o}-${p}-${f}-v1${m?"_simd":""}`},0x6cf4e7cb:(o,p)=>{"use strict";function fetchWithBehavior(o,p,f){return f?fetch(withQueryString(o,f),withRequestHeaders(p,f)):fetch(o,p)}function withRequestHeaders(o,p){return(null==p?void 0:p.headers)?o?Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},o.headers||{}),p.headers)}):{headers:p.headers}:o}function withQueryString(o,p){if(!(null==p?void 0:p.escapedQueryString))return o;let f=-1!==o.lastIndexOf("?");return`${o}${f?"&":"?"}${p.escapedQueryString}`}Object.defineProperty(p,"__esModule",{value:!0}),p.isValidRevisionID=p.isValidAssetGroup=p.resolveURL=p.addQueryParams=p.withQueryString=p.withRequestHeaders=p.fetchWithBehavior=void 0,p.fetchWithBehavior=fetchWithBehavior,p.withRequestHeaders=withRequestHeaders,p.withQueryString=withQueryString,p.addQueryParams=function(o,p){let f=Object.keys(p);if(!f.length)return o;let m=new URLSearchParams(null==o?void 0:o.escapedQueryString);for(let o of f)m.append(o,p[o]);return Object.assign(Object.assign({},o),{escapedQueryString:m.toString()})};let f={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};p.resolveURL=function(o,p){return fetchWithBehavior(o,f,p).then(p=>p.redirected?p.url:o)},p.isValidAssetGroup=function(o){return!!o&&/^[-.a-zA-Z0-9]+$/.test(o)},p.isValidRevisionID=function(o){return!!o&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(o)}},0x1e62759b2:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.loadWorker=void 0;let m=f(0x6cf4e7cb),_={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};p.loadWorker=(o,p,f,w)=>{null==w||w.debug(`Loading ${p} worker from ${o}.`);let I=!1;try{I=self.origin===new URL(o).origin}catch(o){null==w||w.error("Could not compare origins.",o)}return I?Promise.resolve(new Worker((0,m.withQueryString)(o,f),{name:p})):(0,m.fetchWithBehavior)(o,_,f).then(o=>{if(o.ok)return o.blob().then(o=>new Worker(window.URL.createObjectURL(o)));throw Error("Fetch failed.")})}},0x1676280b0:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.isOldChrome=p.supportsWASMStreaming=p.supportsSharedArrayBuffer=p.supportsWASM=p.supportsAudioWorklet=p.supportsWorker=p.supportsVoiceFocusWorker=p.supportsWASMPostMessage=p.isSafari=void 0;let _=f(0x1e62759b2);p.isSafari=(o=globalThis)=>{let p=o.navigator.userAgent,f=p.match(/Safari\//),m=p.match(/Chrom(?:e|ium)\//);return!!(f&&!m)},p.supportsWASMPostMessage=(o=globalThis)=>!(0,p.isSafari)(o)&&(!((o=globalThis)=>!!o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(o)||95>(chromeVersion(o)||0)),p.supportsVoiceFocusWorker=(o=globalThis,f,w)=>m(void 0,void 0,void 0,function*(){if(!(0,p.supportsWorker)(o,w))return!1;let m=`${f.paths.workers}worker-v1.js`;try{let o=yield(0,_.loadWorker)(m,"VoiceFocusTestWorker",f,w);try{o.terminate()}catch(o){null==w||w.debug("Failed to terminate worker.",o)}return!0}catch(o){return null==w||w.info("Failed to fetch and instantiate test worker",o),!1}}),p.supportsWorker=(o=globalThis,p)=>{try{return!!o.Worker}catch(o){return null==p||p.info("Does not support Worker",o),!1}},p.supportsAudioWorklet=(o=globalThis,p)=>{try{return!!o.AudioWorklet&&!!o.AudioWorkletNode}catch(o){return null==p||p.info("Does not support Audio Worklet",o),!1}},p.supportsWASM=(o=globalThis,p)=>{try{return!!o.WebAssembly&&(!!o.WebAssembly.compile||!!o.WebAssembly.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM",o),!1}},p.supportsSharedArrayBuffer=(o=globalThis,p=globalThis,f)=>{try{return!!o.SharedArrayBuffer&&(!!p.chrome||!!o.crossOriginIsolated)}catch{return null==f||f.info("Does not support SharedArrayBuffer."),!1}},p.supportsWASMStreaming=(o=globalThis,p)=>{var f;try{return!!(null==(f=o.WebAssembly)?void 0:f.compileStreaming)}catch(o){return null==p||p.info("Does not support WASM streaming compilation",o),!1}};let chromeVersion=(o=globalThis)=>{try{if(!o.chrome)return}catch{}let p=o.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);if(p)return parseInt(p[1],10)};p.isOldChrome=(o=globalThis,p)=>{let f=chromeVersion(o);return!!f&&f<90&&(null==p||p.debug(`Chrome ${f} has incomplete SIMD support.`),!0)}},0x92a11642:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.VoiceFocusAudioWorkletNode=void 0,p.VoiceFocusAudioWorkletNode=class extends("u">typeof globalThis&&globalThis.AudioWorkletNode||class{}){}},0xed65dabf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.getAudioInput=p.createAudioContext=p.VoiceFocus=void 0;let _=f(0x21cc7ae41),w=f(0x6cf4e7cb),I=f(0x1e62759b2),k=f(0x1676280b0),M=f(0x1f5a31ee0),x=f(0x54e7c75c),O=f(0xe087f61d),L={useVoiceFocusAGC:!1,useBuiltInAGC:!0},B="stable-v1",U="https://static.sdkassets.chime.aws",$={processors:`${U}/processors/`,workers:`${U}/workers/`,wasm:`${U}/wasm/`,models:`${U}/wasm/`},q={latencyHint:0},Z={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},ee=Object.assign(Object.assign({},Z),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),et=Object.assign(Object.assign({},Z),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),ei={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:x.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:O.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:M.default}},validateAssetSpec=(o,p)=>{if(void 0!==o&&!(0,w.isValidAssetGroup)(o))throw Error(`Invalid asset group ${o}`);if(void 0!==p&&!(0,w.isValidRevisionID)(p))throw Error(`Invalid revision ID ${p}`)},urlForModel=(o,p)=>`${p.models}${(0,_.decideModel)(o)}.wasm`,er=class VoiceFocus{constructor(o,p,f,m,_,w){this.processorURL=p,this.nodeConstructor=f,this.nodeOptions=m,this.executionQuanta=_,this.logger=w,this.internal={worker:o,isDestroyed:!1}}getModelMetrics(){var o;return null==(o=this.internal.voiceFocusNode)?void 0:o.getModelMetrics()}reset(){var o,p,f;null==(o=this.internal.voiceFocusNode)||o.reset(),null==(p=this.internal.sourceNode)||p.disconnect(),null==(f=this.internal.destinationNode)||f.disconnect()}enable(){var o;null==(o=this.internal.voiceFocusNode)||o.enable()}disable(){var o;null==(o=this.internal.voiceFocusNode)||o.disable()}setMode(o){var p;null==(p=this.internal.voiceFocusNode)||p.setMode(o)}destroy(){var o,p,f,_,w;return m(this,void 0,void 0,function*(){let{worker:m,isDestroyed:I,voiceFocusNode:k,destinationNode:M,sourceNode:x,audioContext:O}=this.internal;if(I){null==(o=this.logger)||o.debug("Voice Focus is already destroyed");return}try{null==m||m.terminate(),null==x||x.disconnect(),null==M||M.disconnect(),yield Promise.all([null!=(p=null==O?void 0:O.close().catch(o=>o))?p:yield Promise.resolve(),null!=(f=null==k?void 0:k.stop().catch(o=>o))?f:yield Promise.resolve()]),this.internal.audioContext=void 0,this.internal.voiceFocusNode=void 0,this.internal.sourceNode=void 0,this.internal.destinationNode=void 0,null==(_=this.logger)||_.debug("Voice Focus destroyed successfully")}catch(o){throw null==(w=this.logger)||w.error("Error while destroying the Voice Focus instance: ",o),o}finally{this.internal.isDestroyed=!0}})}static isSupported(o,p){let{fetchBehavior:f,logger:m}=p||{};if("u"new this.nodeConstructor(o,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:M})))}applyToStream(o,p,f,_=!1){var w,I,k;return m(this,void 0,void 0,function*(){let m;if(this.internal.isDestroyed)throw Error("Unable to apply stream because VoiceFocus worker has been destroyed");null==(w=this.internal.sourceNode)||w.disconnect(),null==(I=this.internal.destinationNode)||I.disconnect(),_&&this.internal.voiceFocusNode&&this.internal.voiceFocusNode.isEnabled()?(null==(k=this.logger)||k.info("Re-using existing voice focus node"),m=this.internal.voiceFocusNode):m=yield this.createNode(p,f);let M=p.createMediaStreamSource(o);M.connect(m);let x=p.createMediaStreamDestination();return m.connect(x),this.internal=Object.assign(Object.assign({},this.internal),{voiceFocusNode:m,sourceNode:M,destinationNode:x,audioContext:p}),{node:m,source:M,destination:x,stream:x.stream}})}applyToSourceNode(o,p,f){return m(this,void 0,void 0,function*(){let m=yield this.createNode(p,f);return o.connect(m),m})}};p.VoiceFocus=er,p.createAudioContext=(o=q)=>new(window.AudioContext||window.webkitAudioContext)(o),p.getAudioInput=(o,p,f)=>m(void 0,void 0,void 0,function*(){var m,_;let{constraints:w,spec:I,delegate:k,preload:M=!0,options:x}=p,{logger:O}=f,B=yield er.configure(I,f);if(!B.supported)return null==(m=f.logger)||m.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(w);let U=yield er.init(B,{delegate:k,preload:M,logger:O}),$=(null==(_=p.options)?void 0:_.agc)||L,q=yield window.navigator.mediaDevices.getUserMedia(((o,p)=>{let f;if(f=p.useBuiltInAGC?ee:et,!o)return{audio:f};if(!o.audio)return o;if(o.video)throw Error("Not adding Voice Focus to multi-device getUserMedia call.");return Object.assign(Object.assign({},o),{audio:!0===o.audio?f:Object.assign(Object.assign({},o.audio),f)})})(w,$));return U.applyToStream(q,o,x).then(o=>o.stream)})},0x1f5a31ee0:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.cpuWarningCount=0,this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,worker:m,fetchBehavior:w,logger:I,delegate:k}=p;this.logger=I,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=k,I&&I.debug("VoiceFocusInlineNode:",f),this.worker=m,this.worker.onmessage=this.onWorkerMessage.bind(this);const M=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:M,key:"model",fetchBehavior:w,path:f}),this.enabled=!0}onModuleBufferLoaded(o,p){this.port.postMessage({message:"module-buffer",buffer:o,key:p})}onModuleLoaded(o,p){this.port.postMessage({message:"module",module:o,key:p})}enable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){var o;return m(this,void 0,void 0,function*(){this.port.postMessage({message:"stop"});try{null==(o=this.worker)||o.terminate()}catch(o){console.error("failed to terminate worker:",o)}this.disconnect(),this.enabled=!1})}reset(){this.metrics={latencyMillisAverage:0,snr:{average:0,averageActive:0,variance:0,varianceActive:0},drr:{average:0,variance:0,averageActive:0,varianceActive:0},vad:{average:0},cpu:{lateInvoke:0,longInvoke:0}},this.port.postMessage({message:"reset"})}isEnabled(){return this.enabled}onProcessorMessage(o){var p,f,m,_,w,I;let{data:k}=o,{message:M}=k;switch(M){case"cpu":let{reason:x,count:O}=k;x&&O&&(this.metrics.cpu=Object.assign(Object.assign({},this.metrics.cpu),{[x]:O+this.metrics.cpu[x]})),this.cpuWarningCount++;let L=Date.now(),B=this.cpuWarningLastTriggered||L,U=Math.abs(L-B);(!this.cpuWarningLastTriggered||U>5e3)&&(null==(p=this.logger)||p.warn(`CPU warning (count: ${this.cpuWarningCount}):`,M),this.cpuWarningCount=0,this.cpuWarningLastTriggered=L),null==(f=this.delegate)||f.onCPUWarning();break;case"metrics":let{metrics:$}=k;if(!$){null==(m=this.logger)||m.warn("Got metrics message but no metrics payload");break}if(this.metrics=Object.assign(Object.assign({},this.metrics),$),this.logger){let o=Date.now();o-(null!=(_=this.metricsLastRecorded)?_:0)>5e3&&(null==(w=this.logger)||w.debug("Contact metrics:",this.metrics),this.metricsLastRecorded=o)}break;default:null==(I=this.logger)||I.debug("Ignoring processor message.")}}getModelMetrics(){return this.metrics}onWorkerMessage(o){let p=o.data;switch(p.message){case"module-buffer":if(!p.buffer||!p.key)return;this.onModuleBufferLoaded(p.buffer,p.key);break;case"module":if(!p.module||!p.key)return;this.onModuleLoaded(p.module,p.key);break;case"stopped":this.worker&&this.worker.terminate();break;default:return}}}},0xe087f61d:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,audioBufferURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,agc:x,supportFarendStream:O}=p.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===o.sampleRate?160:480,enabled:M,agc:x,fetchBehavior:I,model:f,supportFarendStream:O});const L=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:L,key:"buffer",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":this.port.postMessage({message:"ready",shared:f.shared},f.shared?Object.values(f.shared):[]);break;case"data":if(!f.buffer)return;this.port.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"data":if(!f.buffer)return;this.worker.postMessage({message:"data",buffer:f.buffer},[f.buffer]);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f);break;default:return}}}},0x54e7c75c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x1676280b0),w=f(0x92a11642);p.default=class extends w.VoiceFocusAudioWorkletNode{constructor(o,p){super(o,p.processor,p),this.enabled=!1,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:f,resamplerURL:m,worker:w,fetchBehavior:I,delegate:k}=p;this.delegate=k,this.worker=w,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:M,supportFarendStream:x}=p.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===o.sampleRate?160:480,enabled:M,model:f,supportFarendStream:x});const O=(0,_.supportsWASMPostMessage)(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:O,key:"resampler",fetchBehavior:I,path:m}),this.enabled=!0}enable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,1),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"enable"}),this.enabled=!0})}disable(){return m(this,void 0,void 0,function*(){this.state?(Atomics.store(this.state,1,0),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"disable"}),this.enabled=!1})}setMode(o){return m(this,void 0,void 0,function*(){this.port.postMessage({message:"set-mode",mode:o})})}stop(){return m(this,void 0,void 0,function*(){if(this.state)Atomics.store(this.state,1,2),Atomics.notify(this.state,0,1);else try{this.worker.postMessage({message:"stop"})}catch{}this.disconnect(),this.enabled=!1})}getModelMetrics(){}reset(){}isEnabled(){return this.enabled}onWorkerMessage(o){var p;let f=o.data;switch(f.message){case"ready":if(!f.shared)throw Error("No shared state.");this.state=new Int32Array(f.shared.state),this.port.postMessage(f);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(f);break;case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;default:return}}onProcessorMessage(o){var p;let f=o.data;switch(f.message){case"cpu":null==(p=this.delegate)||p.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(f)}}}},0x4a1b883a:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.RawSha256=void 0;var m=f(0x6d171382);p.RawSha256=function(){function RawSha256(){this.state=Int32Array.from(m.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return RawSha256.prototype.update=function(o){if(this.finished)throw Error("Attempted to update an already finished hash.");var p=0,f=o.byteLength;if(this.bytesHashed+=f,8*this.bytesHashed>m.MAX_HASHABLE_LENGTH)throw Error("Cannot hash more than 2^53 - 1 bits");for(;f>0;)this.buffer[this.bufferLength++]=o[p++],f--,this.bufferLength===m.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},RawSha256.prototype.digest=function(){if(!this.finished){var o=8*this.bytesHashed,p=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),f=this.bufferLength;if(p.setUint8(this.bufferLength++,128),f%m.BLOCK_SIZE>=m.BLOCK_SIZE-8){for(var _=this.bufferLength;_>>24&255,w[4*_+1]=this.state[_]>>>16&255,w[4*_+2]=this.state[_]>>>8&255,w[4*_+3]=this.state[_]>>>0&255;return w},RawSha256.prototype.hashBuffer=function(){for(var o=this.buffer,p=this.state,f=p[0],_=p[1],w=p[2],I=p[3],k=p[4],M=p[5],x=p[6],O=p[7],L=0;L>>17|B<<15)^(B>>>19|B<<13)^B>>>10,$=((B=this.temp[L-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3;this.temp[L]=(U+this.temp[L-7]|0)+($+this.temp[L-16]|0)}var q=(((k>>>6|k<<26)^(k>>>11|k<<21)^(k>>>25|k<<7))+(k&M^~k&x)|0)+(O+(m.KEY[L]+this.temp[L]|0)|0)|0,Z=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&_^f&w^_&w)|0;O=x,x=M,M=k,k=I+q|0,I=w,w=_,_=f,f=q+Z|0}p[0]+=f,p[1]+=_,p[2]+=w,p[3]+=I,p[4]+=k,p[5]+=M,p[6]+=x,p[7]+=O},RawSha256}()},0x6d171382:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.MAX_HASHABLE_LENGTH=p.INIT=p.KEY=p.DIGEST_LENGTH=p.BLOCK_SIZE=void 0,p.BLOCK_SIZE=64,p.DIGEST_LENGTH=32,p.KEY=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),p.INIT=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],p.MAX_HASHABLE_LENGTH=0x1fffffffffffff},0x2869cb2b:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),f(0x2cf9a037).__exportStar(f(0xea66e871),p)},0xea66e871:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Sha256=void 0;var m=f(0x2cf9a037),_=f(0x6d171382),w=f(0x4a1b883a),I=f(0xfc6febaa);function bufferFromSecret(o){var p=(0,I.convertToBuffer)(o);if(p.byteLength>_.BLOCK_SIZE){var f=new w.RawSha256;f.update(p),p=f.digest()}var m=new Uint8Array(_.BLOCK_SIZE);return m.set(p),m}p.Sha256=function(){function Sha256(o){if(this.hash=new w.RawSha256,o){this.outer=new w.RawSha256;var p=bufferFromSecret(o),f=new Uint8Array(_.BLOCK_SIZE);f.set(p);for(var m=0;m<_.BLOCK_SIZE;m++)p[m]^=54,f[m]^=92;this.hash.update(p),this.outer.update(f);for(var m=0;m{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.convertToBuffer=void 0;var m=f(0x1d34794c1),_="u">typeof Buffer&&Buffer.from?function(o){return Buffer.from(o,"utf8")}:m.fromUtf8;p.convertToBuffer=function(o){return o instanceof Uint8Array?o:"string"==typeof o?_(o):ArrayBuffer.isView(o)?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(o)}},0xfc6febaa:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=p.numToUint8=p.isEmptyData=p.convertToBuffer=void 0;var m=f(0x151526ea2);Object.defineProperty(p,"convertToBuffer",{enumerable:!0,get:function(){return m.convertToBuffer}});var _=f(0x244fb30b3);Object.defineProperty(p,"isEmptyData",{enumerable:!0,get:function(){return _.isEmptyData}});var w=f(0xb35e88d9);Object.defineProperty(p,"numToUint8",{enumerable:!0,get:function(){return w.numToUint8}});var I=f(0x1f69f634);Object.defineProperty(p,"uint32ArrayFrom",{enumerable:!0,get:function(){return I.uint32ArrayFrom}})},0x244fb30b3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isEmptyData=void 0,p.isEmptyData=function(o){return"string"==typeof o?0===o.length:0===o.byteLength}},0xb35e88d9:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.numToUint8=void 0,p.numToUint8=function(o){return new Uint8Array([(0xff000000&o)>>24,(0xff0000&o)>>16,(65280&o)>>8,255&o])}},0x1f69f634:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.uint32ArrayFrom=void 0,p.uint32ArrayFrom=function(o){if(!Uint32Array.from){for(var p=new Uint32Array(o.length),f=0;f{"use strict";let{Deflate:m,deflate:_,deflateRaw:w,gzip:I}=f(0xa9814691),{Inflate:k,inflate:M,inflateRaw:x,ungzip:O}=f(0xcafc2cd),L=f(0x7c5bfc5);o.exports.Deflate=m,o.exports.deflate=_,o.exports.deflateRaw=w,o.exports.gzip=I,o.exports.Inflate=k,o.exports.inflate=M,o.exports.inflateRaw=x,o.exports.ungzip=O,o.exports.constants=L},0xa9814691:(o,p,f)=>{"use strict";let m=f(0x1c125237f),_=f(0x69a3d875),w=f(0x1834971a6),I=f(0x16ee44604),k=f(0x1cd54c07e),M=Object.prototype.toString,{Z_NO_FLUSH:x,Z_SYNC_FLUSH:O,Z_FULL_FLUSH:L,Z_FINISH:B,Z_OK:U,Z_STREAM_END:$,Z_DEFAULT_COMPRESSION:q,Z_DEFAULT_STRATEGY:Z,Z_DEFLATED:ee}=f(0x7c5bfc5);function Deflate(o){this.options=_.assign({level:q,method:ee,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z},o||{});let p=this.options;p.raw&&p.windowBits>0?p.windowBits=-p.windowBits:p.gzip&&p.windowBits>0&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(f!==U)throw Error(I[f]);if(p.header&&m.deflateSetHeader(this.strm,p.header),p.dictionary){let o;if(o="string"==typeof p.dictionary?w.string2buf(p.dictionary):"[object ArrayBuffer]"===M.call(p.dictionary)?new Uint8Array(p.dictionary):p.dictionary,(f=m.deflateSetDictionary(this.strm,o))!==U)throw Error(I[f]);this._dict_set=!0}}function deflate(o,p){let f=new Deflate(p);if(f.push(o,!0),f.err)throw f.msg||I[f.err];return f.result}function deflateRaw(o,p){return(p=p||{}).raw=!0,deflate(o,p)}function gzip(o,p){return(p=p||{}).gzip=!0,deflate(o,p)}Deflate.prototype.push=function(o,p){let f,_,I=this.strm,k=this.options.chunkSize;if(this.ended)return!1;for(_=p===~~p?p:!0===p?B:x,"string"==typeof o?I.input=w.string2buf(o):"[object ArrayBuffer]"===M.call(o)?I.input=new Uint8Array(o):I.input=o,I.next_in=0,I.avail_in=I.input.length;;){if(0===I.avail_out&&(I.output=new Uint8Array(k),I.next_out=0,I.avail_out=k),(_===O||_===L)&&I.avail_out<=6){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if((f=m.deflate(I,_))===$)return I.next_out>0&&this.onData(I.output.subarray(0,I.next_out)),f=m.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===U;if(0===I.avail_out){this.onData(I.output);continue}if(_>0&&I.next_out>0){this.onData(I.output.subarray(0,I.next_out)),I.avail_out=0;continue}if(0===I.avail_in)break}return!0},Deflate.prototype.onData=function(o){this.chunks.push(o)},Deflate.prototype.onEnd=function(o){o===U&&(this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Deflate=Deflate,o.exports.deflate=deflate,o.exports.deflateRaw=deflateRaw,o.exports.gzip=gzip,o.exports.constants=f(0x7c5bfc5)},0xcafc2cd:(o,p,f)=>{"use strict";let m=f(0x5ae41d37),_=f(0x69a3d875),w=f(0x1834971a6),I=f(0x16ee44604),k=f(0x1cd54c07e),M=f(0x1bc0bb2fc),x=Object.prototype.toString,{Z_NO_FLUSH:O,Z_FINISH:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee}=f(0x7c5bfc5);function Inflate(o){this.options=_.assign({chunkSize:65536,windowBits:15,to:""},o||{});let p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,0===p.windowBits&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(o&&o.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;let f=m.inflateInit2(this.strm,p.windowBits);if(f!==B||(this.header=new M,m.inflateGetHeader(this.strm,this.header),p.dictionary&&("string"==typeof p.dictionary?p.dictionary=w.string2buf(p.dictionary):"[object ArrayBuffer]"===x.call(p.dictionary)&&(p.dictionary=new Uint8Array(p.dictionary)),p.raw)&&(f=m.inflateSetDictionary(this.strm,p.dictionary))!==B))throw Error(I[f])}function inflate(o,p){let f=new Inflate(p);if(f.push(o),f.err)throw f.msg||I[f.err];return f.result}function inflateRaw(o,p){return(p=p||{}).raw=!0,inflate(o,p)}Inflate.prototype.push=function(o,p){let f,_,I,k=this.strm,M=this.options.chunkSize,et=this.options.dictionary;if(this.ended)return!1;for(_=p===~~p?p:!0===p?L:O,"[object ArrayBuffer]"===x.call(o)?k.input=new Uint8Array(o):k.input=o,k.next_in=0,k.avail_in=k.input.length;;){for(0===k.avail_out&&(k.output=new Uint8Array(M),k.next_out=0,k.avail_out=M),(f=m.inflate(k,_))===$&&et&&((f=m.inflateSetDictionary(k,et))===B?f=m.inflate(k,_):f===Z&&(f=$));k.avail_in>0&&f===U&&k.state.wrap>0&&0!==o[k.next_in];)m.inflateReset(k),f=m.inflate(k,_);switch(f){case q:case Z:case $:case ee:return this.onEnd(f),this.ended=!0,!1}if(I=k.avail_out,k.next_out&&(0===k.avail_out||f===U))if("string"===this.options.to){let o=w.utf8border(k.output,k.next_out),p=k.next_out-o,f=w.buf2string(k.output,o);k.next_out=p,k.avail_out=M-p,p&&k.output.set(k.output.subarray(o,o+p),0),this.onData(f)}else this.onData(k.output.length===k.next_out?k.output:k.output.subarray(0,k.next_out));if(f!==B||0!==I){if(f===U)return f=m.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,!0;if(0===k.avail_in)break}}return!0},Inflate.prototype.onData=function(o){this.chunks.push(o)},Inflate.prototype.onEnd=function(o){o===B&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=_.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg},o.exports.Inflate=Inflate,o.exports.inflate=inflate,o.exports.inflateRaw=inflateRaw,o.exports.ungzip=inflate,o.exports.constants=f(0x7c5bfc5)},0x69a3d875:o=>{"use strict";let _has=(o,p)=>Object.prototype.hasOwnProperty.call(o,p);o.exports.assign=function(o){let p=Array.prototype.slice.call(arguments,1);for(;p.length;){let f=p.shift();if(f){if("object"!=typeof f)throw TypeError(f+"must be non-object");for(let p in f)_has(f,p)&&(o[p]=f[p])}}return o},o.exports.flattenChunks=o=>{let p=0;for(let f=0,m=o.length;f{"use strict";let p=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{p=!1}let f=new Uint8Array(256);for(let o=0;o<256;o++)f[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;f[254]=f[254]=1,o.exports.string2buf=o=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(o);let p,f,m,_,w,I=o.length,k=0;for(_=0;_>>6:(f<65536?p[w++]=224|f>>>12:(p[w++]=240|f>>>18,p[w++]=128|f>>>12&63),p[w++]=128|f>>>6&63),p[w++]=128|63&f);return p},o.exports.buf2string=(o,m)=>{let _,w,I=m||o.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(o.subarray(0,m));let k=Array(2*I);for(w=0,_=0;_4){k[w++]=65533,_+=m-1;continue}for(p&=2===m?31:3===m?15:7;m>1&&_1){k[w++]=65533;continue}p<65536?k[w++]=p:(p-=65536,k[w++]=55296|p>>10&1023,k[w++]=56320|1023&p)}var M=w;if(M<65534&&k.subarray&&p)return String.fromCharCode.apply(null,k.length===M?k:k.subarray(0,M));let x="";for(let o=0;o{(p=p||o.length)>o.length&&(p=o.length);let m=p-1;for(;m>=0&&(192&o[m])==128;)m--;return m<0||0===m?p:m+f[o[m]]>p?m:p}},0x23985e12d:o=>{"use strict";o.exports=(o,p,f,m)=>{let _=65535&o,w=o>>>16&65535,I=0;for(;0!==f;){I=f>2e3?2e3:f,f-=I;do w=w+(_=_+p[m++]|0)|0;while(--I)_%=65521,w%=65521}return _|w<<16}},0x7c5bfc5:o=>{"use strict";o.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},0x23f5d121b:o=>{"use strict";let p=new Uint32Array((()=>{let o,p=[];for(var f=0;f<256;f++){o=f;for(var m=0;m<8;m++)o=1&o?0xedb88320^o>>>1:o>>>1;p[f]=o}return p})());o.exports=(o,f,m,_)=>{let w=_+m;o^=-1;for(let m=_;m>>8^p[(o^f[m])&255];return -1^o}},0x1c125237f:(o,p,f)=>{"use strict";let{_tr_init:m,_tr_stored_block:_,_tr_flush_block:w,_tr_tally:I,_tr_align:k}=f(0x148a53f1),M=f(0x23985e12d),x=f(0x23f5d121b),O=f(0x16ee44604),{Z_NO_FLUSH:L,Z_PARTIAL_FLUSH:B,Z_FULL_FLUSH:U,Z_FINISH:$,Z_BLOCK:q,Z_OK:Z,Z_STREAM_END:ee,Z_STREAM_ERROR:et,Z_DATA_ERROR:ei,Z_BUF_ERROR:er,Z_DEFAULT_COMPRESSION:en,Z_FILTERED:eo,Z_HUFFMAN_ONLY:es,Z_RLE:ea,Z_FIXED:el,Z_DEFAULT_STRATEGY:ed,Z_UNKNOWN:ec,Z_DEFLATED:eu}=f(0x7c5bfc5),eh=573,err=(o,p)=>(o.msg=O[p],p),rank=o=>(o<<1)-9*(o>4),zero=o=>{let p=o.length;for(;--p>=0;)o[p]=0},HASH=(o,p,f)=>(p<{let p=o.state,f=p.pending;f>o.avail_out&&(f=o.avail_out),0!==f&&(o.output.set(p.pending_buf.subarray(p.pending_out,p.pending_out+f),o.next_out),o.next_out+=f,p.pending_out+=f,o.total_out+=f,o.avail_out-=f,p.pending-=f,0===p.pending&&(p.pending_out=0))},flush_block_only=(o,p)=>{w(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,p),o.block_start=o.strstart,flush_pending(o.strm)},put_byte=(o,p)=>{o.pending_buf[o.pending++]=p},putShortMSB=(o,p)=>{o.pending_buf[o.pending++]=p>>>8&255,o.pending_buf[o.pending++]=255&p},read_buf=(o,p,f,m)=>{let _=o.avail_in;return(_>m&&(_=m),0===_)?0:(o.avail_in-=_,p.set(o.input.subarray(o.next_in,o.next_in+_),f),1===o.state.wrap?o.adler=M(o.adler,p,_,f):2===o.state.wrap&&(o.adler=x(o.adler,p,_,f)),o.next_in+=_,o.total_in+=_,_)},longest_match=(o,p)=>{let f,m,_=o.max_chain_length,w=o.strstart,I=o.prev_length,k=o.nice_match,M=o.strstart>o.w_size-262?o.strstart-(o.w_size-262):0,x=o.window,O=o.w_mask,L=o.prev,B=o.strstart+258,U=x[w+I-1],$=x[w+I];o.prev_length>=o.good_match&&(_>>=2),k>o.lookahead&&(k=o.lookahead);do{if(x[(f=p)+I]!==$||x[f+I-1]!==U||x[f]!==x[w]||x[++f]!==x[w+1])continue;w+=2,f++;do;while(x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&x[++w]===x[++f]&&wI){if(o.match_start=p,I=m,m>=k)break;U=x[w+I-1],$=x[w+I]}}while((p=L[p&O])>M&&0!=--_)return I<=o.lookahead?I:o.lookahead},fill_window=o=>{let p,f,m,_,w,I=o.w_size;do{if(_=o.window_size-o.lookahead-o.strstart,o.strstart>=I+(I-262)){o.window.set(o.window.subarray(I,I+I),0),o.match_start-=I,o.strstart-=I,o.block_start-=I,p=f=o.hash_size;do m=o.head[--p],o.head[p]=m>=I?m-I:0;while(--f)p=f=I;do m=o.prev[--p],o.prev[p]=m>=I?m-I:0;while(--f)_+=I}if(0===o.strm.avail_in)break;if(f=read_buf(o.strm,o.window,o.strstart+o.lookahead,_),o.lookahead+=f,o.lookahead+o.insert>=3)for(w=o.strstart-o.insert,o.ins_h=o.window[w],o.ins_h=HASH(o,o.ins_h,o.window[w+1]);o.insert&&(o.ins_h=HASH(o,o.ins_h,o.window[w+3-1]),o.prev[w&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=w,w++,o.insert--,!(o.lookahead+o.insert<3)););}while(o.lookahead<262&&0!==o.strm.avail_in)},deflate_fast=(o,p)=>{let f,m;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),0!==f&&o.strstart-f<=o.w_size-262&&(o.match_length=longest_match(o,f)),o.match_length>=3)if(m=I(o,o.strstart-o.match_start,o.match_length-3),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=3){o.match_length--;do o.strstart++,o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(0!=--o.match_length)o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+1]);else m=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2},deflate_slow=(o,p)=>{let f,m,_;for(;;){if(o.lookahead<262){if(fill_window(o),o.lookahead<262&&p===L)return 1;if(0===o.lookahead)break}if(f=0,o.lookahead>=3&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=2,0!==f&&o.prev_length4096)&&(o.match_length=2)),o.prev_length>=3&&o.match_length<=o.prev_length){_=o.strstart+o.lookahead-3,m=I(o,o.strstart-1-o.prev_match,o.prev_length-3),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=_&&(o.ins_h=HASH(o,o.ins_h,o.window[o.strstart+3-1]),f=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(0!=--o.prev_length)if(o.match_available=0,o.match_length=2,o.strstart++,m&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}else if(o.match_available){if((m=I(o,0,o.window[o.strstart-1]))&&flush_block_only(o,!1),o.strstart++,o.lookahead--,0===o.strm.avail_out)return 1}else o.match_available=1,o.strstart++,o.lookahead--}return(o.match_available&&(m=I(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart<2?o.strstart:2,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2};function Config(o,p,f,m,_){this.good_length=o,this.max_lazy=p,this.nice_length=f,this.max_chain=m,this.func=_}let ep=[new Config(0,0,0,0,(o,p)=>{let f=65535;for(65535>o.pending_buf_size-5&&(f=o.pending_buf_size-5);;){if(o.lookahead<=1){if(fill_window(o),0===o.lookahead&&p===L)return 1;if(0===o.lookahead)break}o.strstart+=o.lookahead,o.lookahead=0;let m=o.block_start+f;if((0===o.strstart||o.strstart>=m)&&(o.lookahead=o.strstart-m,o.strstart=m,flush_block_only(o,!1),0===o.strm.avail_out)||o.strstart-o.block_start>=o.w_size-262&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:(o.strstart>o.block_start&&(flush_block_only(o,!1),o.strm.avail_out),1)}),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)];function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=eu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*eh),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let deflateResetKeep=o=>{if(!o||!o.state)return err(o,et);o.total_in=o.total_out=0,o.data_type=ec;let p=o.state;return p.pending=0,p.pending_out=0,p.wrap<0&&(p.wrap=-p.wrap),p.status=p.wrap?42:113,o.adler=+(2!==p.wrap),p.last_flush=L,m(p),Z},deflateReset=o=>{var p;let f=deflateResetKeep(o);return f===Z&&((p=o.state).window_size=2*p.w_size,zero(p.head),p.max_lazy_match=ep[p.level].max_lazy,p.good_match=ep[p.level].good_length,p.nice_match=ep[p.level].nice_length,p.max_chain_length=ep[p.level].max_chain,p.strstart=0,p.block_start=0,p.lookahead=0,p.insert=0,p.match_length=p.prev_length=2,p.match_available=0,p.ins_h=0),f},deflateInit2=(o,p,f,m,_,w)=>{if(!o)return et;let I=1;if(p===en&&(p=6),m<0?(I=0,m=-m):m>15&&(I=2,m-=16),_<1||_>9||f!==eu||m<8||m>15||p<0||p>9||w<0||w>el)return err(o,et);8===m&&(m=9);let k=new DeflateState;return o.state=k,k.strm=o,k.wrap=I,k.gzhead=null,k.w_bits=m,k.w_size=1<deflateInit2(o,p,eu,15,8,ed),o.exports.deflateInit2=deflateInit2,o.exports.deflateReset=deflateReset,o.exports.deflateResetKeep=deflateResetKeep,o.exports.deflateSetHeader=(o,p)=>o&&o.state&&2===o.state.wrap?(o.state.gzhead=p,Z):et,o.exports.deflate=(o,p)=>{let f,m;if(!o||!o.state||p>q||p<0)return o?err(o,et):et;let w=o.state;if(!o.output||!o.input&&0!==o.avail_in||666===w.status&&p!==$)return err(o,0===o.avail_out?er:et);w.strm=o;let M=w.last_flush;if(w.last_flush=p,42===w.status)if(2===w.wrap)o.adler=0,put_byte(w,31),put_byte(w,139),put_byte(w,8),w.gzhead?(put_byte(w,+!!w.gzhead.text+2*!!w.gzhead.hcrc+4*!!w.gzhead.extra+8*!!w.gzhead.name+16*!!w.gzhead.comment),put_byte(w,255&w.gzhead.time),put_byte(w,w.gzhead.time>>8&255),put_byte(w,w.gzhead.time>>16&255),put_byte(w,w.gzhead.time>>24&255),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,255&w.gzhead.os),w.gzhead.extra&&w.gzhead.extra.length&&(put_byte(w,255&w.gzhead.extra.length),put_byte(w,w.gzhead.extra.length>>8&255)),w.gzhead.hcrc&&(o.adler=x(o.adler,w.pending_buf,w.pending,0)),w.gzindex=0,w.status=69):(put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,0),put_byte(w,9===w.level?2:4*(w.strategy>=es||w.level<2)),put_byte(w,3),w.status=113);else{let p=eu+(w.w_bits-8<<4)<<8;p|=(w.strategy>=es||w.level<2?0:w.level<6?1:6===w.level?2:3)<<6,0!==w.strstart&&(p|=32),p+=31-p%31,w.status=113,putShortMSB(w,p),0!==w.strstart&&(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),o.adler=1}if(69===w.status)if(w.gzhead.extra){for(f=w.pending;w.gzindex<(65535&w.gzhead.extra.length)&&(w.pending!==w.pending_buf_size||(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending!==w.pending_buf_size));)put_byte(w,255&w.gzhead.extra[w.gzindex]),w.gzindex++;w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),w.gzindex===w.gzhead.extra.length&&(w.gzindex=0,w.status=73)}else w.status=73;if(73===w.status)if(w.gzhead.name){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindexf&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.gzindex=0,w.status=91)}else w.status=91;if(91===w.status)if(w.gzhead.comment){f=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>f&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),flush_pending(o),f=w.pending,w.pending===w.pending_buf_size)){m=1;break}m=w.gzindexf&&(o.adler=x(o.adler,w.pending_buf,w.pending-f,f)),0===m&&(w.status=103)}else w.status=103;if(103===w.status&&(w.gzhead.hcrc?(w.pending+2>w.pending_buf_size&&flush_pending(o),w.pending+2<=w.pending_buf_size&&(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),o.adler=0,w.status=113)):w.status=113),0!==w.pending){if(flush_pending(o),0===o.avail_out)return w.last_flush=-1,Z}else if(0===o.avail_in&&rank(p)<=rank(M)&&p!==$)return err(o,er);if(666===w.status&&0!==o.avail_in)return err(o,er);if(0!==o.avail_in||0!==w.lookahead||p!==L&&666!==w.status){let f=w.strategy===es?((o,p)=>{let f;for(;;){if(0===o.lookahead&&(fill_window(o),0===o.lookahead)){if(p===L)return 1;break}if(o.match_length=0,f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):w.strategy===ea?((o,p)=>{let f,m,_,w,k=o.window;for(;;){if(o.lookahead<=258){if(fill_window(o),o.lookahead<=258&&p===L)return 1;if(0===o.lookahead)break}if(o.match_length=0,o.lookahead>=3&&o.strstart>0&&(m=k[_=o.strstart-1])===k[++_]&&m===k[++_]&&m===k[++_]){w=o.strstart+258;do;while(m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&m===k[++_]&&_o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=3?(f=I(o,1,o.match_length-3),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(f=I(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),f&&(flush_block_only(o,!1),0===o.strm.avail_out))return 1}return(o.insert=0,p===$)?(flush_block_only(o,!0),0===o.strm.avail_out)?3:4:o.last_lit&&(flush_block_only(o,!1),0===o.strm.avail_out)?1:2})(w,p):ep[w.level].func(w,p);if((3===f||4===f)&&(w.status=666),1===f||3===f)return 0===o.avail_out&&(w.last_flush=-1),Z;if(2===f&&(p===B?k(w):p!==q&&(_(w,0,0,!1),p===U&&(zero(w.head),0===w.lookahead&&(w.strstart=0,w.block_start=0,w.insert=0))),flush_pending(o),0===o.avail_out))return w.last_flush=-1,Z}return p!==$?Z:w.wrap<=0?ee:(2===w.wrap?(put_byte(w,255&o.adler),put_byte(w,o.adler>>8&255),put_byte(w,o.adler>>16&255),put_byte(w,o.adler>>24&255),put_byte(w,255&o.total_in),put_byte(w,o.total_in>>8&255),put_byte(w,o.total_in>>16&255),put_byte(w,o.total_in>>24&255)):(putShortMSB(w,o.adler>>>16),putShortMSB(w,65535&o.adler)),flush_pending(o),w.wrap>0&&(w.wrap=-w.wrap),0!==w.pending?Z:ee)},o.exports.deflateEnd=o=>{if(!o||!o.state)return et;let p=o.state.status;return 42!==p&&69!==p&&73!==p&&91!==p&&103!==p&&113!==p&&666!==p?err(o,et):(o.state=null,113===p?err(o,ei):Z)},o.exports.deflateSetDictionary=(o,p)=>{let f=p.length;if(!o||!o.state)return et;let m=o.state,_=m.wrap;if(2===_||1===_&&42!==m.status||m.lookahead)return et;if(1===_&&(o.adler=M(o.adler,p,f,0)),m.wrap=0,f>=m.w_size){0===_&&(zero(m.head),m.strstart=0,m.block_start=0,m.insert=0);let o=new Uint8Array(m.w_size);o.set(p.subarray(f-m.w_size,f),0),p=o,f=m.w_size}let w=o.avail_in,I=o.next_in,k=o.input;for(o.avail_in=f,o.next_in=0,o.input=p,fill_window(m);m.lookahead>=3;){let o=m.strstart,p=m.lookahead-2;do m.ins_h=HASH(m,m.ins_h,m.window[o+3-1]),m.prev[o&m.w_mask]=m.head[m.ins_h],m.head[m.ins_h]=o,o++;while(--p)m.strstart=o,m.lookahead=2,fill_window(m)}return m.strstart+=m.lookahead,m.block_start=m.strstart,m.insert=m.lookahead,m.lookahead=0,m.match_length=m.prev_length=2,m.match_available=0,o.next_in=I,o.input=k,o.avail_in=w,m.wrap=_,Z},o.exports.deflateInfo="pako deflate (from Nodeca project)"},0x1bc0bb2fc:o=>{"use strict";o.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},0xd44af05d:o=>{"use strict";o.exports=function(o,p){let f,m,_,w,I,k,M,x,O,L,B,U,$,q,Z,ee,et,ei,er,en,eo,es,ea,el,ed=o.state;f=o.next_in,ea=o.input,m=f+(o.avail_in-5),_=o.next_out,el=o.output,w=_-(p-o.avail_out),I=_+(o.avail_out-257),k=ed.dmax,M=ed.wsize,x=ed.whave,O=ed.wnext,L=ed.window,B=ed.hold,U=ed.bits,$=ed.lencode,q=ed.distcode,Z=(1<>>=ei=et>>>24,U-=ei,0==(ei=et>>>16&255))el[_++]=65535&et;else if(16&ei)for(er=65535&et,(ei&=15)&&(U>>=ei,U-=ei),U<15&&(B+=ea[f++]<>>=ei=et>>>24,U-=ei,16&(ei=et>>>16&255)){if(en=65535&et,U<(ei&=15)&&(B+=ea[f++]<k){o.msg="invalid distance too far back",ed.mode=30;break e}if(B>>>=ei,U-=ei,en>(ei=_-w)){if((ei=en-ei)>x&&ed.sane){o.msg="invalid distance too far back",ed.mode=30;break e}if(eo=0,es=L,0===O){if(eo+=M-ei,ei2;)el[_++]=es[eo++],el[_++]=es[eo++],el[_++]=es[eo++],er-=3;er&&(el[_++]=es[eo++],er>1&&(el[_++]=es[eo++]))}else{eo=_-en;do el[_++]=el[eo++],el[_++]=el[eo++],el[_++]=el[eo++],er-=3;while(er>2)er&&(el[_++]=el[eo++],er>1&&(el[_++]=el[eo++]))}}else if((64&ei)==0){et=q[(65535&et)+(B&(1<>3,U-=er<<3,B&=(1<{"use strict";let m,_,w=f(0x23985e12d),I=f(0x23f5d121b),k=f(0xd44af05d),M=f(0x10d305eb4),{Z_FINISH:x,Z_BLOCK:O,Z_TREES:L,Z_OK:B,Z_STREAM_END:U,Z_NEED_DICT:$,Z_STREAM_ERROR:q,Z_DATA_ERROR:Z,Z_MEM_ERROR:ee,Z_BUF_ERROR:et,Z_DEFLATED:ei}=f(0x7c5bfc5),zswap32=o=>(o>>>24&255)+(o>>>8&65280)+((65280&o)<<8)+((255&o)<<24);function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let inflateResetKeep=o=>{if(!o||!o.state)return q;let p=o.state;return o.total_in=o.total_out=p.total=0,o.msg="",p.wrap&&(o.adler=1&p.wrap),p.mode=1,p.last=0,p.havedict=0,p.dmax=32768,p.head=null,p.hold=0,p.bits=0,p.lencode=p.lendyn=new Int32Array(852),p.distcode=p.distdyn=new Int32Array(592),p.sane=1,p.back=-1,B},inflateReset=o=>{if(!o||!o.state)return q;let p=o.state;return p.wsize=0,p.whave=0,p.wnext=0,inflateResetKeep(o)},inflateReset2=(o,p)=>{let f;if(!o||!o.state)return q;let m=o.state;return(p<0?(f=0,p=-p):(f=(p>>4)+1,p<48&&(p&=15)),p&&(p<8||p>15))?q:(null!==m.window&&m.wbits!==p&&(m.window=null),m.wrap=f,m.wbits=p,inflateReset(o))},inflateInit2=(o,p)=>{if(!o)return q;let f=new InflateState;o.state=f,f.window=null;let m=inflateReset2(o,p);return m!==B&&(o.state=null),m},er=!0,fixedtables=o=>{if(er){m=new Int32Array(512),_=new Int32Array(32);let p=0;for(;p<144;)o.lens[p++]=8;for(;p<256;)o.lens[p++]=9;for(;p<280;)o.lens[p++]=7;for(;p<288;)o.lens[p++]=8;for(M(1,o.lens,0,288,m,0,o.work,{bits:9}),p=0;p<32;)o.lens[p++]=5;M(2,o.lens,0,32,_,0,o.work,{bits:5}),er=!1}o.lencode=m,o.lenbits=9,o.distcode=_,o.distbits=5},updatewindow=(o,p,f,m)=>{let _,w=o.state;return null===w.window&&(w.wsize=1<=w.wsize?(w.window.set(p.subarray(f-w.wsize,f),0),w.wnext=0,w.whave=w.wsize):((_=w.wsize-w.wnext)>m&&(_=m),w.window.set(p.subarray(f-m,f-m+_),w.wnext),(m-=_)?(w.window.set(p.subarray(f-m,f),0),w.wnext=m,w.whave=w.wsize):(w.wnext+=_,w.wnext===w.wsize&&(w.wnext=0),w.whaveinflateInit2(o,15),o.exports.inflateInit2=inflateInit2,o.exports.inflate=(o,p)=>{let f,m,_,er,en,eo,es,ea,el,ed,ec,eu,eh,ep,ef,em,eg,eS,ev,eb,ey,e_,eC,eT,eE=0,ew=new Uint8Array(4),eI=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!o||!o.state||!o.output||!o.input&&0!==o.avail_in)return q;12===(f=o.state).mode&&(f.mode=13),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,ed=eo,ec=es,e_=B;t:for(;;)switch(f.mode){case 1:if(0===f.wrap){f.mode=13;break}for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<>>8&255,f.check=I(f.check,ew,2,0),ea=0,el=0,f.mode=2;break}if(f.flags=0,f.head&&(f.head.done=!1),!(1&f.wrap)||(((255&ea)<<8)+(ea>>8))%31){o.msg="incorrect header check",f.mode=30;break}if((15&ea)!==ei){o.msg="unknown compression method",f.mode=30;break}if(ea>>>=4,el-=4,ey=(15&ea)+8,0===f.wbits)f.wbits=ey;else if(ey>f.wbits){o.msg="invalid window size",f.mode=30;break}f.dmax=1<>8&1),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=3;case 3:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<>>8&255,ew[2]=ea>>>16&255,ew[3]=ea>>>24&255,f.check=I(f.check,ew,4,0)),ea=0,el=0,f.mode=4;case 4:for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<>8),512&f.flags&&(ew[0]=255&ea,ew[1]=ea>>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0,f.mode=5;case 5:if(1024&f.flags){for(;el<16;){if(0===eo)break t;eo--,ea+=m[er++]<>>8&255,f.check=I(f.check,ew,2,0)),ea=0,el=0}else f.head&&(f.head.extra=null);f.mode=6;case 6:if(1024&f.flags&&((eu=f.length)>eo&&(eu=eo),eu&&(f.head&&(ey=f.head.extra_len-f.length,f.head.extra||(f.head.extra=new Uint8Array(f.head.extra_len)),f.head.extra.set(m.subarray(er,er+eu),ey)),512&f.flags&&(f.check=I(f.check,m,eu,er)),eo-=eu,er+=eu,f.length-=eu),f.length))break t;f.length=0,f.mode=7;case 7:if(2048&f.flags){if(0===eo)break t;eu=0;do ey=m[er+eu++],f.head&&ey&&f.length<65536&&(f.head.name+=String.fromCharCode(ey));while(ey&&eu>9&1,f.head.done=!0),o.adler=f.check=0,f.mode=12;break;case 10:for(;el<32;){if(0===eo)break t;eo--,ea+=m[er++]<>>=7&el,el-=7&el,f.mode=27;break}for(;el<3;){if(0===eo)break t;eo--,ea+=m[er++]<>>=1)){case 0:f.mode=14;break;case 1:if(fixedtables(f),f.mode=20,p===L){ea>>>=2,el-=2;break t}break;case 2:f.mode=17;break;case 3:o.msg="invalid block type",f.mode=30}ea>>>=2,el-=2;break;case 14:for(ea>>>=7&el,el-=7⪙el<32;){if(0===eo)break t;eo--,ea+=m[er++]<>>16^65535)){o.msg="invalid stored block lengths",f.mode=30;break}if(f.length=65535&ea,ea=0,el=0,f.mode=15,p===L)break t;case 15:f.mode=16;case 16:if(eu=f.length){if(eu>eo&&(eu=eo),eu>es&&(eu=es),0===eu)break t;_.set(m.subarray(er,er+eu),en),eo-=eu,er+=eu,es-=eu,en+=eu,f.length-=eu;break}f.mode=12;break;case 17:for(;el<14;){if(0===eo)break t;eo--,ea+=m[er++]<>>=5))+1,el-=5,f.ncode=(15&(ea>>>=5))+4,ea>>>=4,el-=4,f.nlen>286||f.ndist>30){o.msg="too many length or distance symbols",f.mode=30;break}f.have=0,f.mode=18;case 18:for(;f.have>>=3,el-=3}for(;f.have<19;)f.lens[eI[f.have++]]=0;if(f.lencode=f.lendyn,f.lenbits=7,eC={bits:f.lenbits},e_=M(0,f.lens,0,19,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid code lengths set",f.mode=30;break}f.have=0,f.mode=19;case 19:for(;f.have>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<>>=ef,el-=ef,f.lens[f.have++]=eg;else{if(16===eg){for(eT=ef+2;el>>=ef,el-=ef,0===f.have){o.msg="invalid bit length repeat",f.mode=30;break}ey=f.lens[f.have-1],eu=3+(3&ea),ea>>>=2,el-=2}else if(17===eg){for(eT=ef+3;el>>=ef,el-=ef,ey=0,eu=3+(7&ea),ea>>>=3,el-=3}else{for(eT=ef+7;el>>=ef,el-=ef,ey=0,eu=11+(127&ea),ea>>>=7,el-=7}if(f.have+eu>f.nlen+f.ndist){o.msg="invalid bit length repeat",f.mode=30;break}for(;eu--;)f.lens[f.have++]=ey}}if(30===f.mode)break;if(0===f.lens[256]){o.msg="invalid code -- missing end-of-block",f.mode=30;break}if(f.lenbits=9,eC={bits:f.lenbits},e_=M(1,f.lens,0,f.nlen,f.lencode,0,f.work,eC),f.lenbits=eC.bits,e_){o.msg="invalid literal/lengths set",f.mode=30;break}if(f.distbits=6,f.distcode=f.distdyn,eC={bits:f.distbits},e_=M(2,f.lens,f.nlen,f.ndist,f.distcode,0,f.work,eC),f.distbits=eC.bits,e_){o.msg="invalid distances set",f.mode=30;break}if(f.mode=20,p===L)break t;case 20:f.mode=21;case 21:if(eo>=6&&es>=258){o.next_out=en,o.avail_out=es,o.next_in=er,o.avail_in=eo,f.hold=ea,f.bits=el,k(o,ec),en=o.next_out,_=o.output,es=o.avail_out,er=o.next_in,m=o.input,eo=o.avail_in,ea=f.hold,el=f.bits,12===f.mode&&(f.back=-1);break}for(f.back=0;ef=(eE=f.lencode[ea&(1<>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,f.length=eg,0===em){f.mode=26;break}if(32&em){f.back=-1,f.mode=12;break}if(64&em){o.msg="invalid literal/length code",f.mode=30;break}f.extra=15&em,f.mode=22;case 22:if(f.extra){for(eT=f.extra;el>>=f.extra,el-=f.extra,f.back+=f.extra}f.was=f.length,f.mode=23;case 23:for(;ef=(eE=f.distcode[ea&(1<>>24,em=eE>>>16&255,eg=65535&eE,!(ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<>eS)])>>>24,em=eE>>>16&255,eg=65535&eE,!(eS+ef<=el);){if(0===eo)break t;eo--,ea+=m[er++]<>>=eS,el-=eS,f.back+=eS}if(ea>>>=ef,el-=ef,f.back+=ef,64&em){o.msg="invalid distance code",f.mode=30;break}f.offset=eg,f.extra=15&em,f.mode=24;case 24:if(f.extra){for(eT=f.extra;el>>=f.extra,el-=f.extra,f.back+=f.extra}if(f.offset>f.dmax){o.msg="invalid distance too far back",f.mode=30;break}f.mode=25;case 25:if(0===es)break t;if(eu=ec-es,f.offset>eu){if((eu=f.offset-eu)>f.whave&&f.sane){o.msg="invalid distance too far back",f.mode=30;break}eu>f.wnext?(eu-=f.wnext,eh=f.wsize-eu):eh=f.wnext-eu,eu>f.length&&(eu=f.length),ep=f.window}else ep=_,eh=en-f.offset,eu=f.length;eu>es&&(eu=es),es-=eu,f.length-=eu;do _[en++]=ep[eh++];while(--eu)0===f.length&&(f.mode=21);break;case 26:if(0===es)break t;_[en++]=f.length,es--,f.mode=21;break;case 27:if(f.wrap){for(;el<32;){if(0===eo)break t;eo--,ea|=m[er++]<{if(!o||!o.state)return q;let p=o.state;return p.window&&(p.window=null),o.state=null,B},o.exports.inflateGetHeader=(o,p)=>{if(!o||!o.state)return q;let f=o.state;return(2&f.wrap)==0?q:(f.head=p,p.done=!1,B)},o.exports.inflateSetDictionary=(o,p)=>{let f,m=p.length;return o&&o.state&&(0===(f=o.state).wrap||11===f.mode)?11===f.mode&&w(1,p,m,0)!==f.check?Z:updatewindow(o,p,m,m)?(f.mode=31,ee):(f.havedict=1,B):q},o.exports.inflateInfo="pako inflate (from Nodeca project)"},0x10d305eb4:o=>{"use strict";let p=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),f=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),m=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);o.exports=(o,w,I,k,M,x,O,L)=>{let B,U,$,q,Z,ee,et,ei,er,en=L.bits,eo=0,es=0,ea=0,el=0,ed=0,ec=0,eu=0,eh=0,ep=0,ef=0,em=null,eg=0,eS=new Uint16Array(16),ev=new Uint16Array(16),eb=null,ey=0;for(eo=0;eo<=15;eo++)eS[eo]=0;for(es=0;es=1&&0===eS[el];el--);if(ed>el&&(ed=el),0===el)return M[x++]=0x1400000,M[x++]=0x1400000,L.bits=1,0;for(ea=1;ea0&&(0===o||1!==el))return -1;for(eo=1,ev[1]=0;eo<15;eo++)ev[eo+1]=ev[eo]+eS[eo];for(es=0;es852||2===o&&ep>592)return 1;for(;;){et=eo-eu,O[es]ee?(ei=eb[ey+O[es]],er=em[eg+O[es]]):(ei=96,er=0),B=1<>eu)+(U-=B)]=et<<24|ei<<16|er;while(0!==U)for(B=1<>=1;if(0!==B?(ef&=B-1,ef+=B):ef=0,es++,0==--eS[eo]){if(eo===el)break;eo=w[I+O[es]]}if(eo>ed&&(ef&q)!==$){for(0===eu&&(eu=ed),Z+=ea,eh=1<<(ec=eo-eu);ec+eu852||2===o&&ep>592)return 1;M[$=ef&q]=ed<<24|ec<<16|Z-x}}return 0!==ef&&(M[Z+ef]=eo-eu<<24|4194304),L.bits=ed,0}},0x16ee44604:o=>{"use strict";o.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},0x148a53f1:o=>{"use strict";let p,f,m;function zero(o){let p=o.length;for(;--p>=0;)o[p]=0}let _=573,w=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),I=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),k=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x=Array(576);zero(x);let O=Array(60);zero(O);let L=Array(512);zero(L);let B=Array(256);zero(B);let U=Array(29);zero(U);let $=Array(30);function StaticTreeDesc(o,p,f,m,_){this.static_tree=o,this.extra_bits=p,this.extra_base=f,this.elems=m,this.max_length=_,this.has_stree=o&&o.length}function TreeDesc(o,p){this.dyn_tree=o,this.max_code=0,this.stat_desc=p}zero($);let d_code=o=>o<256?L[o]:L[256+(o>>>7)],put_short=(o,p)=>{o.pending_buf[o.pending++]=255&p,o.pending_buf[o.pending++]=p>>>8&255},send_bits=(o,p,f)=>{o.bi_valid>16-f?(o.bi_buf|=p<>16-o.bi_valid,o.bi_valid+=f-16):(o.bi_buf|=p<{send_bits(o,f[2*p],f[2*p+1])},bi_reverse=(o,p)=>{let f=0;do f|=1&o,o>>>=1,f<<=1;while(--p>0)return f>>>1},gen_codes=(o,p,f)=>{let m,_,w=Array(16),I=0;for(m=1;m<=15;m++)w[m]=I=I+f[m-1]<<1;for(_=0;_<=p;_++){let p=o[2*_+1];0!==p&&(o[2*_]=bi_reverse(w[p]++,p))}},init_block=o=>{let p;for(p=0;p<286;p++)o.dyn_ltree[2*p]=0;for(p=0;p<30;p++)o.dyn_dtree[2*p]=0;for(p=0;p<19;p++)o.bl_tree[2*p]=0;o.dyn_ltree[512]=1,o.opt_len=o.static_len=0,o.last_lit=o.matches=0},bi_windup=o=>{o.bi_valid>8?put_short(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0},smaller=(o,p,f,m)=>{let _=2*p,w=2*f;return o[_]{let m=o.heap[f],_=f<<1;for(;_<=o.heap_len&&(_{let m,_,k,M,x=0;if(0!==o.last_lit)do m=o.pending_buf[o.d_buf+2*x]<<8|o.pending_buf[o.d_buf+2*x+1],_=o.pending_buf[o.l_buf+x],x++,0===m?send_code(o,_,p):(send_code(o,(k=B[_])+256+1,p),0!==(M=w[k])&&send_bits(o,_-=U[k],M),send_code(o,k=d_code(--m),f),0!==(M=I[k])&&send_bits(o,m-=$[k],M));while(x{let f,m,w,I=p.dyn_tree,k=p.stat_desc.static_tree,M=p.stat_desc.has_stree,x=p.stat_desc.elems,O=-1;for(f=0,o.heap_len=0,o.heap_max=_;f>1;f>=1;f--)pqdownheap(o,I,f);w=x;do f=o.heap[1],o.heap[1]=o.heap[o.heap_len--],pqdownheap(o,I,1),m=o.heap[1],o.heap[--o.heap_max]=f,o.heap[--o.heap_max]=m,I[2*w]=I[2*f]+I[2*m],o.depth[w]=(o.depth[f]>=o.depth[m]?o.depth[f]:o.depth[m])+1,I[2*f+1]=I[2*m+1]=w,o.heap[1]=w++,pqdownheap(o,I,1);while(o.heap_len>=2)o.heap[--o.heap_max]=o.heap[1],((o,p)=>{let f,m,w,I,k,M,x=p.dyn_tree,O=p.max_code,L=p.stat_desc.static_tree,B=p.stat_desc.has_stree,U=p.stat_desc.extra_bits,$=p.stat_desc.extra_base,q=p.stat_desc.max_length,Z=0;for(I=0;I<=15;I++)o.bl_count[I]=0;for(x[2*o.heap[o.heap_max]+1]=0,f=o.heap_max+1;f<_;f++)(I=x[2*x[2*(m=o.heap[f])+1]+1]+1)>q&&(I=q,Z++),x[2*m+1]=I,!(m>O)&&(o.bl_count[I]++,k=0,m>=$&&(k=U[m-$]),M=x[2*m],o.opt_len+=M*(I+k),B&&(o.static_len+=M*(L[2*m+1]+k)));if(0!==Z){do{for(I=q-1;0===o.bl_count[I];)I--;o.bl_count[I]--,o.bl_count[I+1]+=2,o.bl_count[q]--,Z-=2}while(Z>0)for(I=q;0!==I;I--)for(m=o.bl_count[I];0!==m;)!((w=o.heap[--f])>O)&&(x[2*w+1]!==I&&(o.opt_len+=(I-x[2*w+1])*x[2*w],x[2*w+1]=I),m--)}})(o,p),gen_codes(I,O,o.bl_count)},scan_tree=(o,p,f)=>{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),p[(f+1)*2+1]=65535,m=0;m<=f;m++)_=I,I=p[(m+1)*2+1],++k{let m,_,w=-1,I=p[1],k=0,M=7,x=4;for(0===I&&(M=138,x=3),m=0;m<=f;m++)if(_=I,I=p[(m+1)*2+1],!(++k{send_bits(o,0+ +!!m,3),bi_windup(o),put_short(o,f),put_short(o,~f),o.pending_buf.set(o.window.subarray(p,p+f),o.pending),o.pending+=f};o.exports._tr_init=o=>{q||((()=>{let o,_,M,q,Z,ee=Array(16);for(q=0,M=0;q<28;q++)for(o=0,U[q]=M;o<1<>=7;q<30;q++)for(o=0,$[q]=Z<<7;o<1<{let _,w,I=0;o.level>0?(2===o.strm.data_type&&(o.strm.data_type=(o=>{let p,f=0xf3ffc07f;for(p=0;p<=31;p++,f>>>=1)if(1&f&&0!==o.dyn_ltree[2*p])return 0;if(0!==o.dyn_ltree[18]||0!==o.dyn_ltree[20]||0!==o.dyn_ltree[26])return 1;for(p=32;p<256;p++)if(0!==o.dyn_ltree[2*p])return 1;return 0})(o)),build_tree(o,o.l_desc),build_tree(o,o.d_desc),I=(o=>{let p;for(scan_tree(o,o.dyn_ltree,o.l_desc.max_code),scan_tree(o,o.dyn_dtree,o.d_desc.max_code),build_tree(o,o.bl_desc),p=18;p>=3&&0===o.bl_tree[2*M[p]+1];p--);return o.opt_len+=3*(p+1)+5+5+4,p})(o),_=o.opt_len+3+7>>>3,(w=o.static_len+3+7>>>3)<=_&&(_=w)):_=w=f+5,f+4<=_&&-1!==p?_tr_stored_block(o,p,f,m):4===o.strategy||w===_?(send_bits(o,2+ +!!m,3),compress_block(o,x,O)):(send_bits(o,4+ +!!m,3),((o,p,f,m)=>{let _;for(send_bits(o,p-257,5),send_bits(o,f-1,5),send_bits(o,m-4,4),_=0;_(o.pending_buf[o.d_buf+2*o.last_lit]=p>>>8&255,o.pending_buf[o.d_buf+2*o.last_lit+1]=255&p,o.pending_buf[o.l_buf+o.last_lit]=255&f,o.last_lit++,0===p?o.dyn_ltree[2*f]++:(o.matches++,p--,o.dyn_ltree[(B[f]+256+1)*2]++,o.dyn_dtree[2*d_code(p)]++),o.last_lit===o.lit_bufsize-1),o.exports._tr_align=o=>{send_bits(o,2,3),send_code(o,256,x),16===o.bi_valid?(put_short(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=255&o.bi_buf,o.bi_buf>>=8,o.bi_valid-=8)}},0x1cd54c07e:o=>{"use strict";o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},0x1204db3cc:(o,p,f)=>{"use strict";o.exports=f(0x169ae5e0c)},0x169ae5e0c:(o,p,f)=>{"use strict";function configure(){p.util._configure(),p.Writer._configure(p.BufferWriter),p.Reader._configure(p.BufferReader)}p.build="minimal",p.Writer=f(0x7d2690f1),p.BufferWriter=f(0x23920c7c0),p.Reader=f(0x1b9e9f855),p.BufferReader=f(0x156ec91a4),p.util=f(0x11446c62a),p.rpc=f(0xe0b485a5),p.roots=f(0x345f92ab),p.configure=configure,configure()},0x1b9e9f855:(o,p,f)=>{"use strict";o.exports=Reader;var m,_,w=f(0x11446c62a),I=w.LongBits,k=w.utf8;function indexOutOfRange(o,p){return RangeError("index out of range: "+o.pos+" + "+(p||1)+" > "+o.len)}function Reader(o){this.buf=o,this.pos=0,this.len=o.length}var M="u">typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new Reader(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new Reader(o);throw Error("illegal buffer")},create=function(){return w.Buffer?function(o){return(Reader.create=function(o){return w.Buffer.isBuffer(o)?new _(o):M(o)})(o)}:M};function readLongVarint(){var o=new I(0,0),p=0;if(this.len-this.pos>4){for(;p<4;++p)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;p=0}else{for(;p<3;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*p)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*p)>>>0,o}if(this.len-this.pos>4){for(;p<5;++p)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}else for(;p<5;++p){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*p+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function readFixed32_end(o,p){return(o[p-4]|o[p-3]<<8|o[p-2]<<16|o[p-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new I(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=create(),Reader.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice,Reader.prototype.uint32=(m=0xffffffff,function(){if(m=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(m=(m|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(m=(m|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return m;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return m}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var o=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var o=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},Reader.prototype.bytes=function(){var o=this.uint32(),p=this.pos,f=this.pos+o;if(f>this.len)throw indexOutOfRange(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(p,f);if(p===f){var m=w.Buffer;return m?m.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,p,f)},Reader.prototype.string=function(){var o=this.bytes();return k.read(o,0,o.length)},Reader.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw indexOutOfRange(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(128&this.buf[this.pos++])return this},Reader.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},Reader._configure=function(o){_=o,Reader.create=create(),_._configure();var p=w.Long?"toLong":"toNumber";w.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[p](!1)},uint64:function(){return readLongVarint.call(this)[p](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[p](!1)},fixed64:function(){return readFixed64.call(this)[p](!0)},sfixed64:function(){return readFixed64.call(this)[p](!1)}})}},0x156ec91a4:(o,p,f)=>{"use strict";o.exports=BufferReader;var m=f(0x1b9e9f855);(BufferReader.prototype=Object.create(m.prototype)).constructor=BufferReader;var _=f(0x11446c62a);function BufferReader(o){m.call(this,o)}BufferReader._configure=function(){_.Buffer&&(BufferReader.prototype._slice=_.Buffer.prototype.slice)},BufferReader.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},BufferReader._configure()},0x345f92ab:o=>{"use strict";o.exports={}},0xe0b485a5:(o,p,f)=>{"use strict";p.Service=f(0xbd812f41)},0xbd812f41:(o,p,f)=>{"use strict";o.exports=Service;var m=f(0x11446c62a);function Service(o,p,f){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");m.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!p,this.responseDelimited=!!f}(Service.prototype=Object.create(m.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function rpcCall(o,p,f,_,w){if(!_)throw TypeError("request must be specified");var I=this;if(!w)return m.asPromise(rpcCall,I,o,p,f,_);if(!I.rpcImpl)return void setTimeout(function(){w(Error("already ended"))},0);try{return I.rpcImpl(o,p[I.requestDelimited?"encodeDelimited":"encode"](_).finish(),function(p,m){if(p)return I.emit("error",p,o),w(p);if(null===m)return void I.end(!0);if(!(m instanceof f))try{m=f[I.responseDelimited?"decodeDelimited":"decode"](m)}catch(p){return I.emit("error",p,o),w(p)}return I.emit("data",m,o),w(null,m)})}catch(p){I.emit("error",p,o),setTimeout(function(){w(p)},0);return}},Service.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},0x55f77dd5:(o,p,f)=>{"use strict";o.exports=LongBits;var m=f(0x11446c62a);function LongBits(o,p){this.lo=o>>>0,this.hi=p>>>0}var _=LongBits.zero=new LongBits(0,0);_.toNumber=function(){return 0},_.zzEncode=_.zzDecode=function(){return this},_.length=function(){return 1};var w=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(o){if(0===o)return _;var p=o<0;p&&(o=-o);var f=o>>>0,m=(o-f)/0x100000000>>>0;return p&&(m=~m>>>0,f=~f>>>0,++f>0xffffffff&&(f=0,++m>0xffffffff&&(m=0))),new LongBits(f,m)},LongBits.from=function(o){if("number"==typeof o)return LongBits.fromNumber(o);if(m.isString(o))if(!m.Long)return LongBits.fromNumber(parseInt(o,10));else o=m.Long.fromString(o);return o.low||o.high?new LongBits(o.low>>>0,o.high>>>0):_},LongBits.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var p=~this.lo+1>>>0,f=~this.hi>>>0;return p||(f=f+1>>>0),-(p+0x100000000*f)}return this.lo+0x100000000*this.hi},LongBits.prototype.toLong=function(o){return m.Long?new m.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var I=String.prototype.charCodeAt;LongBits.fromHash=function(o){return o===w?_:new LongBits((I.call(o,0)|I.call(o,1)<<8|I.call(o,2)<<16|I.call(o,3)<<24)>>>0,(I.call(o,4)|I.call(o,5)<<8|I.call(o,6)<<16|I.call(o,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},LongBits.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},LongBits.prototype.length=function(){var o=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return 0===f?0===p?o<16384?o<128?1:2:o<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:f<128?9:10}},0x11446c62a:function(o,p,f){"use strict";function merge(o,p,f){for(var m=Object.keys(p),_=0;_typeof window&&window||"u">typeof self&&self||this,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},p.isString=function(o){return"string"==typeof o||o instanceof String},p.isObject=function(o){return o&&"object"==typeof o},p.isset=p.isSet=function(o,p){var f=o[p];return!!(null!=f&&o.hasOwnProperty(p))&&("object"!=typeof f||(Array.isArray(f)?f.length:Object.keys(f).length)>0)},p.Buffer=function(){try{var o=p.inquire("buffer").Buffer;return o.prototype.utf8Write?o:null}catch{return null}}(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(o){return"number"==typeof o?p.Buffer?p._Buffer_allocUnsafe(o):new p.Array(o):p.Buffer?p._Buffer_from(o):"u"typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long"),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(o){return o?p.LongBits.from(o).toHash():p.LongBits.zeroHash},p.longFromHash=function(o,f){var m=p.LongBits.fromHash(o);return p.Long?p.Long.fromBits(m.lo,m.hi,f):m.toNumber(!!f)},p.merge=merge,p.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)},p.newError=newError,p.ProtocolError=newError("ProtocolError"),p.oneOfGetter=function(o){for(var p={},f=0;f-1;--f)if(1===p[o[f]]&&void 0!==this[o[f]]&&null!==this[o[f]])return o[f]}},p.oneOfSetter=function(o){return function(p){for(var f=0;f{"use strict";o.exports=Writer;var m,_=f(0x11446c62a),w=_.LongBits,I=_.base64,k=_.utf8;function Op(o,p,f){this.fn=o,this.len=p,this.next=void 0,this.val=f}function noop(){}function State(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create=function(){return _.Buffer?function(){return(Writer.create=function(){return new m})()}:function(){return new Writer}};function writeByte(o,p,f){p[f]=255&o}function writeVarint32(o,p,f){for(;o>127;)p[f++]=127&o|128,o>>>=7;p[f]=o}function VarintOp(o,p){this.len=o,this.next=void 0,this.val=p}function writeVarint64(o,p,f){for(;o.hi;)p[f++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)p[f++]=127&o.lo|128,o.lo=o.lo>>>7;p[f++]=o.lo}function writeFixed32(o,p,f){p[f]=255&o,p[f+1]=o>>>8&255,p[f+2]=o>>>16&255,p[f+3]=o>>>24}Writer.create=create(),Writer.alloc=function(o){return new _.Array(o)},_.Array!==Array&&(Writer.alloc=_.pool(Writer.alloc,_.Array.prototype.subarray)),Writer.prototype._push=function(o,p,f){return this.tail=this.tail.next=new Op(o,p,f),this.len+=p,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new VarintOp((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<0x10000000?4:5,o)).len,this},Writer.prototype.int32=function(o){return o<0?this._push(writeVarint64,10,w.fromNumber(o)):this.uint32(o)},Writer.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},Writer.prototype.uint64=function(o){var p=w.from(o);return this._push(writeVarint64,p.length(),p)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(o){var p=w.from(o).zzEncode();return this._push(writeVarint64,p.length(),p)},Writer.prototype.bool=function(o){return this._push(writeByte,1,+!!o)},Writer.prototype.fixed32=function(o){return this._push(writeFixed32,4,o>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(o){var p=w.from(o);return this._push(writeFixed32,4,p.lo)._push(writeFixed32,4,p.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(o){return this._push(_.float.writeFloatLE,4,o)},Writer.prototype.double=function(o){return this._push(_.float.writeDoubleLE,8,o)};var M=_.Array.prototype.set?function(o,p,f){p.set(o,f)}:function(o,p,f){for(var m=0;m>>0;if(!p)return this._push(writeByte,1,0);if(_.isString(o)){var f=Writer.alloc(p=I.length(o));I.decode(o,f,0),o=f}return this.uint32(p)._push(M,p,o)},Writer.prototype.string=function(o){var p=k.length(o);return p?this.uint32(p)._push(k.write,p,o):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var o=this.head,p=this.tail,f=this.len;return this.reset().uint32(f),f&&(this.tail.next=o.next,this.tail=p,this.len+=f),this},Writer.prototype.finish=function(){for(var o=this.head.next,p=this.constructor.alloc(this.len),f=0;o;)o.fn(o.val,p,f),f+=o.len,o=o.next;return p},Writer._configure=function(o){m=o,Writer.create=create(),m._configure()}},0x23920c7c0:(o,p,f)=>{"use strict";o.exports=BufferWriter;var m=f(0x7d2690f1);(BufferWriter.prototype=Object.create(m.prototype)).constructor=BufferWriter;var _=f(0x11446c62a);function BufferWriter(){m.call(this)}function writeStringBuffer(o,p,f){o.length<40?_.utf8.write(o,p,f):p.utf8Write?p.utf8Write(o,f):p.write(o,f)}BufferWriter._configure=function(){BufferWriter.alloc=_._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=_.Buffer&&_.Buffer.prototype instanceof Uint8Array&&"set"===_.Buffer.prototype.set.name?function(o,p,f){p.set(o,f)}:function(o,p,f){if(o.copy)o.copy(p,f,0,o.length);else for(var m=0;m>>0;return this.uint32(p),p&&this._push(BufferWriter.writeBytesBuffer,p,o),this},BufferWriter.prototype.string=function(o){var p=_.Buffer.byteLength(o);return this.uint32(p),p&&this._push(writeStringBuffer,p,o),this},BufferWriter._configure()},0x2cf9a037:(o,p,f)=>{"use strict";f.r(p),f.d(p,{__assign:()=>__assign,__asyncDelegator:()=>__asyncDelegator,__asyncGenerator:()=>__asyncGenerator,__asyncValues:()=>__asyncValues,__await:()=>__await,__awaiter:()=>__awaiter,__classPrivateFieldGet:()=>__classPrivateFieldGet,__classPrivateFieldSet:()=>__classPrivateFieldSet,__createBinding:()=>__createBinding,__decorate:()=>__decorate,__exportStar:()=>__exportStar,__extends:()=>__extends,__generator:()=>__generator,__importDefault:()=>__importDefault,__importStar:()=>__importStar,__makeTemplateObject:()=>__makeTemplateObject,__metadata:()=>__metadata,__param:()=>__param,__read:()=>__read,__rest:()=>__rest,__spread:()=>__spread,__spreadArrays:()=>__spreadArrays,__values:()=>__values});var extendStatics=function(o,p){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(o,p){o.__proto__=p}||function(o,p){for(var f in p)p.hasOwnProperty(f)&&(o[f]=p[f])})(o,p)};function __extends(o,p){function __(){this.constructor=o}extendStatics(o,p),o.prototype=null===p?Object.create(p):(__.prototype=p.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(o){for(var p,f=1,m=arguments.length;fp.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f}function __decorate(o,p,f,m){var _,w=arguments.length,I=w<3?p:null===m?m=Object.getOwnPropertyDescriptor(p,f):m;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)I=Reflect.decorate(o,p,f,m);else for(var k=o.length-1;k>=0;k--)(_=o[k])&&(I=(w<3?_(I):w>3?_(p,f,I):_(p,f))||I);return w>3&&I&&Object.defineProperty(p,f,I),I}function __param(o,p){return function(f,m){p(f,m,o)}}function __metadata(o,p){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(o,p)}function __awaiter(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})}function __generator(o,p){var f,m,_,w,I={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return w={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(w[Symbol.iterator]=function(){return this}),w;function verb(o){return function(p){return step([o,p])}}function step(w){if(f)throw TypeError("Generator is already executing.");for(;I;)try{if(f=1,m&&(_=2&w[0]?m.return:w[0]?m.throw||((_=m.return)&&_.call(m),0):m.next)&&!(_=_.call(m,w[1])).done)return _;switch(m=0,_&&(w=[2&w[0],_.value]),w[0]){case 0:case 1:_=w;break;case 4:return I.label++,{value:w[1],done:!1};case 5:I.label++,m=w[1],w=[0];continue;case 7:w=I.ops.pop(),I.trys.pop();continue;default:if(!(_=(_=I.trys).length>0&&_[_.length-1])&&(6===w[0]||2===w[0])){I=0;continue}if(3===w[0]&&(!_||w[1]>_[0]&&w[1]<_[3])){I.label=w[1];break}if(6===w[0]&&I.label<_[1]){I.label=_[1],_=w;break}if(_&&I.label<_[2]){I.label=_[2],I.ops.push(w);break}_[2]&&I.ops.pop(),I.trys.pop();continue}w=p.call(o,I)}catch(o){w=[6,o],m=0}finally{f=_=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}}function __createBinding(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}function __exportStar(o,p){for(var f in o)"default"===f||p.hasOwnProperty(f)||(p[f]=o[f])}function __values(o){var p="function"==typeof Symbol&&Symbol.iterator,f=p&&o[p],m=0;if(f)return f.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&m>=o.length&&(o=void 0),{value:o&&o[m++],done:!o}}};throw TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,p){var f="function"==typeof Symbol&&o[Symbol.iterator];if(!f)return o;var m,_,w=f.call(o),I=[];try{for(;(void 0===p||p-- >0)&&!(m=w.next()).done;)I.push(m.value)}catch(o){_={error:o}}finally{try{m&&!m.done&&(f=w.return)&&f.call(w)}finally{if(_)throw _.error}}return I}function __spread(){for(var o=[],p=0;p1||resume(o,p)})})}function resume(o,p){try{step(_[o](p))}catch(o){settle(w[0][3],o)}}function step(o){o.value instanceof __await?Promise.resolve(o.value.v).then(fulfill,reject):settle(w[0][2],o)}function fulfill(o){resume("next",o)}function reject(o){resume("throw",o)}function settle(o,p){o(p),w.shift(),w.length&&resume(w[0][0],w[0][1])}}function __asyncDelegator(o){var p,f;return p={},verb("next"),verb("throw",function(o){throw o}),verb("return"),p[Symbol.iterator]=function(){return this},p;function verb(m,_){p[m]=o[m]?function(p){return(f=!f)?{value:__await(o[m](p)),done:"return"===m}:_?_(p):p}:_}}function __asyncValues(o){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var p,f=o[Symbol.asyncIterator];return f?f.call(o):(o=__values(o),p={},verb("next"),verb("throw"),verb("return"),p[Symbol.asyncIterator]=function(){return this},p);function verb(f){p[f]=o[f]&&function(p){return new Promise(function(m,_){settle(m,_,(p=o[f](p)).done,p.value)})}}function settle(o,p,f,m){Promise.resolve(m).then(function(p){o({value:p,done:f})},p)}}function __makeTemplateObject(o,p){return Object.defineProperty?Object.defineProperty(o,"raw",{value:p}):o.raw=p,o}function __importStar(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)Object.hasOwnProperty.call(o,f)&&(p[f]=o[f]);return p.default=o,p}function __importDefault(o){return o&&o.__esModule?o:{default:o}}function __classPrivateFieldGet(o,p){if(!p.has(o))throw TypeError("attempted to get private field on non-instance");return p.get(o)}function __classPrivateFieldSet(o,p,f){if(!p.has(o))throw TypeError("attempted to set private field on non-instance");return p.set(o,f),f}},0x2056040c6:function(o,p,f){var m;!function(_){"use strict";var w="function",I="undefined",k="object",M="string",x="major",O="model",L="name",B="type",U="vendor",$="version",q="architecture",Z="console",ee="mobile",et="tablet",ei="smarttv",er="wearable",en="embedded",eo="Amazon",es="Apple",ea="ASUS",el="BlackBerry",ed="Browser",ec="Chrome",eu="Firefox",eh="Google",ep="Huawei",ef="Microsoft",em="Motorola",eg="Opera",eS="Samsung",ev="Sharp",eb="Sony",ey="Xiaomi",e_="Zebra",eC="Facebook",eT="Chromium OS",eE="Mac OS",ew=" Browser",extend=function(o,p){var f={};for(var m in o)p[m]&&p[m].length%2==0?f[m]=p[m].concat(o[m]):f[m]=o[m];return f},enumerize=function(o){for(var p={},f=0;f0?2===I.length?typeof I[1]==w?this[I[0]]=I[1].call(this,x):this[I[0]]=I[1]:3===I.length?typeof I[1]!==w||I[1].exec&&I[1].test?this[I[0]]=x?x.replace(I[1],I[2]):void 0:this[I[0]]=x?I[1].call(this,x,I[2]):void 0:4===I.length&&(this[I[0]]=x?I[3].call(this,x.replace(I[1],I[2])):void 0):this[I]=x||void 0;O+=2}},strMapper=function(o,p){for(var f in p)if(typeof p[f]===k&&p[f].length>0){for(var m=0;m2&&(o[O]="iPad",o[B]=et),o},this.getEngine=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.engine),o},this.getOS=function(){var o={};return o[L]=void 0,o[$]=void 0,rgxMapper.call(o,m,ei.os),er&&!o[L]&&Z&&Z.platform&&"Unknown"!=Z.platform&&(o[L]=Z.platform.replace(/chrome os/i,eT).replace(/macos/i,eE)),o},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return m},this.setUA=function(o){return m=typeof o===M&&o.length>500?trim(o,500):o,this},this.setUA(m),this};UAParser.VERSION="1.0.40",UAParser.BROWSER=enumerize([L,$,x]),UAParser.CPU=enumerize([q]),UAParser.DEVICE=enumerize([O,U,B,Z,ee,ei,et,er,en]),UAParser.ENGINE=UAParser.OS=enumerize([L,$]),typeof p!==I?(o.exports&&(p=o.exports=UAParser),p.UAParser=UAParser):f.amdO?void 0===(m=(function(){return UAParser}).call(p,f,p,o))||(o.exports=m):typeof _!==I&&(_.UAParser=UAParser);var ek=typeof _!==I&&(_.jQuery||_.Zepto);if(ek&&!ek.ua){var eM=new UAParser;ek.ua=eM.getResult(),ek.ua.get=function(){return eM.getUA()},ek.ua.set=function(o){eM.setUA(o);var p=eM.getResult();for(var f in p)ek.ua[f]=p[f]}}}("object"==typeof window?window:this)},0x173eb4b02:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x7b80cc62));p.default=class{constructor(o,p,f,m=1e3,_=200){this.realtimeController=o,this.selfAttendeeId=p,this.hasBandwidthPriorityCallback=f,this.waitIntervalMs=m,this.updateIntervalMs=_,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(o){return!this.activeSpeakers||0===this.speakerScores[o]&&this.activeSpeakers.includes(o)||this.speakerScores[o]>0&&!this.activeSpeakers.includes(o)}updateActiveSpeakers(o,p,f){if(!this.needUpdate(f))return;let m=[],_=Object.keys(this.speakerScores);for(let o=0;o<_.length;o++){let p=_[o];m.push({attendeeId:p,activeScore:this.speakerScores[p]})}let w=m.sort((o,p)=>p.activeScore-o.activeScore).filter(function(o){return o.activeScore>0}).map(function(o){return o.attendeeId});this.activeSpeakers=w,p(w);let I=w.length>0&&w[0]===this.selfAttendeeId&&o.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==I&&(this.hasBandwidthPriority=I,this.hasBandwidthPriorityCallback(I))}updateScore(o,p,f,m,_){let w=o.calculateScore(f,m,_);this.speakerScores[f]!==w&&(this.speakerScores[f]=w,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f))}subscribe(o,p,f,m){let handler=(f,m)=>{if(!m){this.speakerScores[f]=0,this.mostRecentUpdateTimestamp[f]=Date.now(),this.updateActiveSpeakers(o,p,f);return}this.realtimeController.realtimeSubscribeToVolumeIndicator(f,(f,m,_,w)=>{this.mostRecentUpdateTimestamp[f]=Date.now(),null!==_&&(this.speakerMuteState[f]=_),this.updateScore(o,p,f,m,_)})};this.detectorCallbackToHandler.set(p,handler);let _=new w.default(this.updateIntervalMs);if(_.start(()=>{for(let f in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[f]>this.waitIntervalMs&&this.updateScore(o,p,f,0,this.speakerMuteState[f])}),this.detectorCallbackToActivityTimer.set(p,_),f&&m){let o=new w.default(m);o.start(()=>{f(this.speakerScores)}),this.detectorCallbackToScoresTimer.set(p,o)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(handler)}unsubscribe(o){let p=this.detectorCallbackToHandler.get(o);this.detectorCallbackToHandler.delete(o),p&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(p);let f=this.detectorCallbackToActivityTimer.get(o);f&&(f.stop(),this.detectorCallbackToActivityTimer.delete(o));let m=this.detectorCallbackToScoresTimer.get(o);m&&(m.stop(),this.detectorCallbackToHandler.delete(o))}destroy(){return m(this,void 0,void 0,function*(){for(let o of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o);for(let o of this.detectorCallbackToActivityTimer.values())o.stop();for(let o of this.detectorCallbackToScoresTimer.values())o.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()})}}},0x13c61502e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=.9,p=.01,f=.2,m=.2){this.speakerWeight=o,this.cutoffThreshold=p,this.silenceThreshold=f,this.takeoverRate=m,this.volumes={}}calculateScore(o,p,f){(f||null===p)&&(p=0),this.volumes.hasOwnProperty(o)||(this.volumes[o]=0),p=+(p>this.silenceThreshold);let m=this.volumes[o]*this.speakerWeight+p*(1-this.speakerWeight);for(let f in this.volumes[o]=m,this.volumes)f!==o&&(this.volumes[f]=Math.max(this.volumes[f]-this.takeoverRate*p,0));return m{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ApplicationMetadata{constructor(o,p){this.appName=o,this.appVersion=p}static create(o,p){let f=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!o||o.length>32)throw Error("appName should be a valid string and 1 to 32 characters in length");if(!f.test(o))throw Error(`appName must satisfy ${f} regular expression`);if(!p||p.length>32)throw Error("appVersion should be a valid string and 1 to 32 characters in length");if(!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm.test(p))throw Error("appVersion must satisfy Semantic Versioning format");return new ApplicationMetadata(o,p)}}},0xd80a42d3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x5cbe4bac:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x573f705d));p.default=class{constructor(o){this.logger=o,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new w.default,this.observers=new Set}bindAudioElement(o){return m(this,void 0,void 0,function*(){if(!o)throw Error(`Cannot bind audio element: ${o}`);return this.audioElement=o,this.audioElement.autoplay=!0,this.bindAudioMix()})}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null,this.forEachObserver(o=>{this.audioStream&&o.meetingAudioStreamBecameInactive(this.audioStream)}))}bindAudioStream(o){return m(this,void 0,void 0,function*(){if(o){this.audioStream=o;try{yield this.bindAudioMix()}catch(o){this.logger&&this.logger.warn(`Failed to bind audio stream: ${o}`)}}})}bindAudioDevice(o){return m(this,void 0,void 0,function*(){if(o&&!this.browserBehavior.supportsSetSinkId())throw Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=o,this.bindAudioMix()})}forEachObserver(o){for(let p of this.observers)I.default.nextTick(()=>{o(p)})}bindAudioMix(){var o,p;return m(this,void 0,void 0,function*(){if(!this.audioElement)return;let f=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),f!==this.audioStream&&this.forEachObserver(o=>{f&&o.meetingAudioStreamBecameInactive(f),this.audioStream&&o.meetingAudioStreamBecameActive(this.audioStream)});let m=(null==(o=this.audioDevice)?void 0:o.deviceId)!==this.audioElement.sinkId;if(m&&void 0===this.audioElement.sinkId)throw Error("Cannot select audio output device. This browser does not support setSinkId.");let _=this.audioDevice?this.audioDevice.deviceId:"";if(_===this.audioElement.sinkId)return;let w=this.audioElement,I=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=null),m)try{yield w.setSinkId(_)}catch(o){throw null==(p=this.logger)||p.error(`Failed to set sinkId for audio element: ${o}`),o}this.browserBehavior.hasChromiumWebRTC()&&(w.srcObject=I)})}getCurrentMeetingAudioStream(){return m(this,void 0,void 0,function*(){return this.audioStream})}addAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.add(o)})}removeAudioMixObserver(o){return m(this,void 0,void 0,function*(){this.observers.delete(o)})}audioOutputDidChange(o){return m(this,void 0,void 0,function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(o)})}}},0x249fc81e5:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x165009cb4));p.default=class AudioProfile{constructor(o=null,p=!0){this.audioBitrateBps=o,this.enableAudioRedundancy=new _.default().supportsAudioRedundancy()&&p}static fullbandSpeechMono(o=!0){return new AudioProfile(4e4,o)}static fullbandMusicMono(o=!0){return new AudioProfile(64e3,o)}static fullbandMusicStereo(o=!0){return new AudioProfile(128e3,o)}isStereo(){return 128e3===this.audioBitrateBps}hasRedundancyEnabled(){return this.enableAudioRedundancy}}},0x1c48b14ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=void 0;let _=m(f(0xc30676e4));p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT=25;let w=class{constructor(){this.logger=null,this.browserBehavior=null,this.meetingSessionConfiguration=null,this.signalingClient=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,this.audioMixController=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.prioritizedSendVideoCodecCapabilities=[],this.degradedVideoSendCodecs=[],this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.enableSVC=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null,this.retryCount=0,this.isSessionConnected=!1}resetConnectionSpecificState(){this.peer&&this.peer.close(),this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,void 0!==this.transceiverController&&this.transceiverController.reset(),this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.videoDownlinkBandwidthPolicy.reset(),this.videoUplinkBandwidthPolicy.reset&&this.videoUplinkBandwidthPolicy.reset(),this.lastVideosToReceive=null,this.lastVideoSubscriptionConfiguration=new Map,this.videoSubscriptions=null,this.videoSubscriptionLimit=p.DEFAULT_VIDEO_SUBSCRIPTION_LIMIT,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videosToReceive=new _.default,this.videosPaused=new _.default,this.currentVideoSendCodec=void 0,this.meetingSupportedVideoSendCodecPreferences=void 0,this.videoDuplexMode=null,this.isSessionConnected=!1}};p.default=w},0x10a965f7c:function(o,p,f){"use strict";var m=this&&this.__createBinding||(Object.create?function(o,p,f,m){void 0===m&&(m=f),Object.defineProperty(o,m,{enumerable:!0,get:function(){return p[f]}})}:function(o,p,f,m){void 0===m&&(m=f),o[m]=p[f]}),_=this&&this.__setModuleDefault||(Object.create?function(o,p){Object.defineProperty(o,"default",{enumerable:!0,value:p})}:function(o,p){o.default=p}),w=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var p={};if(null!=o)for(var f in o)"default"!==f&&Object.prototype.hasOwnProperty.call(o,f)&&m(p,o,f);return _(p,o),p},I=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},k=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let M=k(f(0x173eb4b02)),x=k(f(0x5cbe4bac)),O=k(f(0x249fc81e5)),L=k(f(0x165009cb4)),B=k(f(0x73406699)),U=k(f(0x7cabad69)),$=k(f(0x3b3f192c)),q=f(0x1029db6ff),Z=k(f(0xb28de657)),ee=k(f(0x234745d42)),et=k(f(0x17310e8bb)),ei=k(f(0x1a154f9b0)),er=k(f(0x504c9394)),en=k(f(0x102abe35c)),eo=k(f(0x573f705d)),es=k(f(0x17e3191d)),ea=k(f(0x1c843e818)),el=k(f(0x195905627)),ed=k(f(0xd03588a6)),ec=k(f(0x14f60ed93)),eu=k(f(0x24718f0be)),eh=w(f(0x1e93e1412)),ep=k(f(0x16bec8feb)),ef=k(f(0xcb99c5a5)),em=f(0xe88b24d9),eg=k(f(0xf8f9c263)),eS=k(f(0xd60c9fd8)),ev=k(f(0x11ee4612e)),eb=k(f(0x302be147)),ey=k(f(0x1cd1bb811)),e_=k(f(0xad28f8b8)),eC=k(f(0x25372cf50)),eT=k(f(0x1c594fec7)),eE=k(f(0x20543e8f4)),ew=k(f(0x138bc4923)),eI=k(f(0x1f0d2ad73)),eA=k(f(0x1f9377021)),ek=k(f(0x1c97ddc23)),eM=k(f(0x1f71fad3b)),ex=k(f(0x2429ed05e)),eP=k(f(0x18781162e)),eR=k(f(0x130a7607d)),eO=k(f(0x151ad6ab5)),eD=k(f(0x222af4e39)),eL=k(f(0xc70eec36)),eN=k(f(0x1fc5185a)),eF=k(f(0x15fdb9011)),eV=k(f(0x21d574c92)),eB=k(f(0x1174c5f22)),eU=k(f(0x24564ad46)),ej=k(f(0x93a0ab1c)),eH=k(f(0xdeeb6fe4)),ez=k(f(0x2293b1f8c)),eG=k(f(0x24fd8c738)),eW=f(0xb529932d),e$=k(f(0xb40abe4c)),eK=k(f(0x1a174c132)),eq=k(f(0x15ad5180a)),eJ=f(0xfa5b698a),eY=k(f(0xc30676e4)),eX=k(f(0x243b05980)),eQ=k(f(0x217dc1bb8)),eZ=k(f(0x198994116)),e0=k(f(0x168367eac)),e1=k(f(0x16364c8d1)),e2=k(f(0xb231bce1)),e3=k(f(0x194492f4c)),e4=k(f(0x1c48b14ba)),e5=class DefaultAudioVideoController{constructor(o,p,f,m,_,w){this._audioProfile=new O.default,this.connectionHealthData=new B.default,this.observerQueue=new Set,this.meetingSessionContext=new e4.default,this.enableSimulcast=!1,this.enableSVC=!1,this.useUpdateTransceiverControllerForUplink=!1,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.receiveRemotePauseResumeTask=void 0,this.destroyed=!1,this._logger=p,this.sessionStateController=new ea.default(this._logger),this._configuration=o,this._webSocketAdapter=f,this._realtimeController=new en.default(m),this._realtimeController.realtimeSetLocalAttendeeId(o.credentials.attendeeId,o.credentials.externalUserId),this._mediaStreamBroker=m,this._reconnectController=_,this._videoTileController=new eZ.default(new e0.default,this,this._logger),this._audioMixController=new x.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=w,this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers||(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)&&new L.default().hasChromiumWebRTC()?this.videoSendCodecPreferences=[es.default.av1Main(),es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()]:this.videoSendCodecPreferences=[es.default.vp9Profile0(),es.default.h264ConstrainedBaselineProfile(),es.default.vp8()])}destroy(){return I(this,void 0,void 0,function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0})}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new M.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(o){return(this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),this.rtcPeerConnection)?this.rtcPeerConnection.getStats(o):null}setAudioProfile(o){this._audioProfile=o}addObserver(o){this.logger.info("adding meeting observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing meeting observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)eo.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}initSignalingClient(){this.connectionHealthData.reset(),this.meetingSessionContext.signalingClient||(this.meetingSessionContext=new e4.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new L.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.audioProfile=this._audioProfile,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new eu.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then(()=>{let handleClosed=()=>I(this,void 0,void 0,function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()});this.preStartObserver={handleSignalingClientEvent(o){o.type===ep.default.WebSocketClosed&&handleClosed()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)}).catch(o=>{this.logger.error(`Signaling task pre-start failed: ${o}`),this.signalingTask=void 0})}start(o){this.startReturningPromise(o).then(()=>{this.logger.info("start completed")}).catch(o=>{this.logger.error(`start failed: ${o}`)})}startReturningPromise(o){return(null==o?void 0:o.signalingOnly)===!0?this.prestart():(this.activeSpeakerDetector,new Promise((o,p)=>{this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!1).then(o).catch(p)})}))}connectWithPromises(o){let p=this.meetingSessionContext,timeout=(o,p)=>new eB.default(this.logger,p,o);this.monitorTask=new eI.default(p,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);let f=this.monitorTask.once(),m=new ex.default(p).once();this.receiveIndexTask=new eO.default(p),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();let _=new eL.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new ew.default(p),new eD.default(p),new eT.default(p),this.receiveIndexTask]).once(),w=new ey.default(p).once(_),I=new eS.default(p).once(w,m),k=new e_.default(p).once(I),M=new eN.default(p).once(k),x=new eC.default(p).once(M),O=new eV.default(p).once(x);return this.receiveRemotePauseResumeTask=new eP.default(p),this.receiveRemotePauseResumeTask.once(O),new eL.default(this.logger,this.wrapTaskName("AudioVideoStart"),[f,timeout(this.configuration.connectionTimeoutMs,new eL.default(this.logger,"Peer",[O,this.receiveRemotePauseResumeTask,o?new eB.default(this.logger,new ek.default(this.logger,"FinalizeConnection",[new eU.default(p),new eF.default(p)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new eF.default(p)]))])}actionConnect(o){var p;return I(this,void 0,void 0,function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&new L.default().hasChromiumWebRTC(),this.enableSimulcast&&this.configuration.enableSVC&&this.logger.warn("SVC cannot be enabled at the same time as simulcast. Disabling SVC, using simulcast."),this.enableSVC=!this.enableSimulcast&&this.configuration.enableSVC&&new L.default().supportsScalableVideoCoding();let f=!!this.configuration.urls.audioHostURL;if(f?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new eH.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext):this.meetingSessionContext.transceiverController=new ez.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new ej.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new eG.default(this.logger,this.meetingSessionContext.browserBehavior,this.meetingSessionContext)),this.meetingSessionContext.volumeIndicatorAdapter=new e3.default(this.logger,this._realtimeController,DefaultAudioVideoController.MIN_VOLUME_DECIBELS,DefaultAudioVideoController.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.meetingSessionContext.enableSVC=this.enableSVC,this.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy;o||(o=new e1.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=o),o.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eq.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new eQ.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new eX.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new e2.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.videoUplinkBandwidthPolicy.setSVCEnabled(this.enableSVC)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new eK.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&(this.useUpdateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;if(new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT)){let o=this.configuration.meetingFeatures.contentMaxResolution===$.default.VideoResolutionUHD;o&&this.setVideoMaxBandwidthKbps(2500),this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}else{let o=this.configuration.meetingFeatures.videoMaxResolution===$.default.VideoResolutionFHD;this.meetingSessionContext.videoUplinkBandwidthPolicy.setHighResolutionFeatureEnabled(o)}this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.setWantsResubscribeObserver(()=>this.update({needsRenegotiation:!1})),this.meetingSessionContext.lastKnownVideoAvailability=new et.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new e$.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new eY.default,this.meetingSessionContext.videosPaused=new eY.default,this.meetingSessionContext.statsCollector=new eg.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new U.default(this,this._realtimeController,this.connectionHealthData,new er.default(this.meetingSessionContext.signalingClient,DefaultAudioVideoController.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},this._videoTileController.registerVideoTileResolutionObserver(this.meetingSessionContext.statsCollector),o||(this.meetingSessionContext.retryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!1))}),null==(p=this.eventController)||p.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);let m=f&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;this.logger.info("Needs to wait for attendee presence? "+m);let _=this.connectWithPromises(m);try{yield _.run(),this.connectionHealthData.setConnectionStartTime();let o=new ei.default(this.configuration.credentials.attendeeId).hasModality(ei.default.MODALITY_CONTENT);this.connectionHealthData.setIsContentShare(o),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var o;this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,null==(o=this.eventController)||o.publishEvent("meetingStartSucceeded",q.audioVideoEventAttributesFromState(this.meetingSessionContext)),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()})}catch(p){this.signalingTask=void 0;let o=new Z.default(this.getMeetingStatusCode(p)||ee.default.TaskFailed);if(this.logger.info(`Start failed: ${o} due to error ${p}.`),this.sessionStateController.state()===ed.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(el.default.Fail,()=>I(this,void 0,void 0,function*(){yield this.actionDisconnect(o,!0,p),this.handleMeetingSessionStatus(o,p)||this.notifyStop(o,p)}))}})}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new eB.default(this.logger,new eA.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=em.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.meetingSessionContext.isSessionConnected=!0,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStart).map(p=>p.bind(o)())}),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var o;return(this._reconnectController.disableReconnect(),this.sessionStateController.state()===ed.default.NotConnected)?(null==(o=this.meetingSessionContext.signalingClient)||o.closeConnection(),this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise((o,p)=>{this.sessionStateController.perform(el.default.Disconnect,()=>{this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new Z.default(ee.default.Left),!1,null).then(o).catch(p)})})}stop(){this.stopReturningPromise()}actionDisconnect(o,p,f){return I(this,void 0,void 0,function*(){try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new eB.default(this.logger,new eE.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(o){this.logger.info("fail to stop")}try{let o=[new eB.default(this.logger,new eb.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new eL.default(this.logger,this.wrapTaskName("AudioVideoClean"),o).run()}catch(o){this.logger.info("fail to clean")}this.sessionStateController.perform(el.default.FinishDisconnecting,()=>{p||this.notifyStop(o,f)}),this._videoTileController.removeVideoTileResolutionObserver(this.meetingSessionContext.statsCollector)})}update(o={needsRenegotiation:!0}){let p=o.needsRenegotiation;if(p||(p=void 0===this.meetingSessionContext.peer),p||(p=!this.updateRemoteVideosFromPolicy()),p||(p=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!p)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe"),this.updateNumberOfPublishedVideoSources();let f=this.sessionStateController.perform(el.default.Update,()=>{this.actionUpdateWithRenegotiation(!0)});return f===ec.default.Transitioned||f===ec.default.DeferredTransition}updateNumberOfPublishedVideoSources(){let o=this.configuration.credentials.attendeeId,p=this._videoTileController.hasStartedLocalVideoTile();if(null!==this.meetingSessionContext.videoStreamIndex){let f=this.meetingSessionContext.videoStreamIndex.numberOfVideoPublishingParticipantsExcludingSelf(o)+ +!!p;this.connectionHealthData.setNumberOfPublishedVideoSources(f)}}updateRemoteVideosFromPolicy(){if(this.meetingSessionContext.videoDownlinkBandwidthPolicy&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getVideoPreferences&&void 0!==this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&!eh.serverSideNetworkAdaptionIsNoneOrDefault(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption())){if(!this.sendRemoteVideoUpdate())return!1;if(this.meetingSessionContext.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()===eh.default.BandwidthProbingAndRemoteVideoQualityAdaption)return this.isNotAddingOrRemovingStreams()}return this.updateRemoteVideosIfNotAddingOrRemovingStreams()}updateRemoteVideosIfNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.simulcastStreamUpdates,m=o.removed,_=this.meetingSessionContext,w=[];for(let[o,p]of f.entries()){let f=new ef.default;if(f.streamId=p,f.attendeeId=_.videoStreamIndex.attendeeIdForStreamId(p),f.mid=_.transceiverController.getMidForStreamId(o),void 0===f.mid)return this.logger.info(`No MID found for stream ID ${o}, cannot update stream without renegotiation`),!1;if(w.push(f),_.transceiverController.setStreamIdForMid(f.mid,p),_.videoStreamIndex.overrideStreamIdMappings(o,p),_.videoTileController.haveVideoTileForAttendeeId(f.attendeeId)){let o=_.videoTileController.getVideoTileForAttendeeId(f.attendeeId);if(!o.setStreamId)return!1;o.setStreamId(p)}}return 0!==w.length&&_.signalingClient.remoteVideoUpdate(w,[]),0===p.length&&0===m.length&&(_.videoStreamIndex.remoteVideoUpdateSent(),!0)}detectChangesInVideosToReceive(){let o=this.meetingSessionContext;if(null===o.videosToReceive||!o.transceiverController||!o.transceiverController.getMidForStreamId||!o.transceiverController.setStreamIdForMid||!o.videosToReceive.forEach||!o.signalingClient.remoteVideoUpdate||!o.videoStreamIndex.overrideStreamIdMappings)return;let p=[],f=new Map,m=[];if(null===o.lastVideosToReceive)p=o.videosToReceive.array();else{let _=o.videoStreamIndex;o.videosToReceive.forEach(m=>{if(o.lastVideosToReceive.contain(m))return;let w=!1;o.lastVideosToReceive.forEach(o=>{!w&&_.StreamIdsInSameGroup(o,m)&&(f.set(o,m),w=!0)}),w||p.push(m)}),m=o.lastVideosToReceive.array().filter(p=>{let m=o.videosToReceive.contain(p),_=f.has(p);return!m&&!_})}return this.logger.info(`Request to update remote videos with added: [${p}], updated: [${Array.from(f.entries()).map(([o,p])=>`${o}->${p}`).join(",")}], removed: [${m}]`),{added:p,removed:m,simulcastStreamUpdates:f}}isNotAddingOrRemovingStreams(){let o=this.detectChangesInVideosToReceive();if(void 0===o)return!1;let p=o.added,f=o.removed;return 0===p.length&&0===f.length&&(this.meetingSessionContext.videoStreamIndex.remoteVideoUpdateSent(),!0)}sendRemoteVideoUpdate(){let o=this.meetingSessionContext;if(null===o.videosToReceive)return!1;let p=o.videosToReceive.array().map(p=>o.videoStreamIndex.groupIdForStreamId(p));this.receiveRemotePauseResumeTask.updateSubscribedGroupdIds(new Set(p));let f=eJ.convertVideoPreferencesToSignalingClientVideoSubscriptionConfiguration(o,p,o.videoDownlinkBandwidthPolicy.getVideoPreferences()),m=new Map,_=[];for(let p of f){let f=!1;if(o.lastVideoSubscriptionConfiguration.has(p.groupId)){let m=o.lastVideoSubscriptionConfiguration.get(p.groupId);p.equals(m)||(this.logger.debug(`${JSON.stringify(p)} does not equal ${JSON.stringify(m)}, sending update`),f=!0)}else f=!0;m.set(p.groupId,p),f&&_.push(p)}o.lastVideoSubscriptionConfiguration=m;let w=[];if(null!==o.lastVideosToReceive){let f=new Set(p);for(let p of o.lastVideosToReceive.array()){let m=o.videoStreamIndex.groupIdForStreamId(p);if(!f.has(m)){let p=o.transceiverController.getMidForGroupId(m);if(void 0===p){o.logger.warn(`Could not find MID for group ID to remove: ${m}`);continue}w.push(p)}}}return(0!==_.length||0!==w.length)&&o.signalingClient.remoteVideoUpdate(_,w),!0}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){let o=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&this.meetingSessionContext.transceiverController.hasVideoInput()&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(o)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;let o=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!!o&&!!o.headerExtensions&&o.headerExtensions.some(o=>"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"===o.uri)}restartLocalVideo(o){let restartVideo=()=>I(this,void 0,void 0,function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdateWithRenegotiation(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdateWithRenegotiation(!0),o()}),p=this.sessionStateController.perform(el.default.Update,()=>{restartVideo()});return p===ec.default.Transitioned||p===ec.default.DeferredTransition}replaceLocalVideo(o){return I(this,void 0,void 0,function*(){if(!o||o.getVideoTracks().length<1)throw Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");let p=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(p){let f=p.state(),m=o.getVideoTracks()[0].getSettings();p.bindVideoStream(f.boundAttendeeId,!0,o,m.width,m.height,f.streamId,f.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(o.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=o,this.logger.info("Local video input is updated")})}replaceLocalAudio(o){return I(this,void 0,void 0,function*(){if(!o||o.getAudioTracks().length<1)throw Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(o.getAudioTracks()[0])))throw Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=o,this.logger.info("Local audio input is updated")})}actionUpdateWithRenegotiation(o){return I(this,void 0,void 0,function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),o&&this.sessionStateController.perform(el.default.FinishUpdating,()=>{this.actionFinishUpdating()})}catch(o){this.sessionStateController.perform(el.default.FinishUpdating,()=>{let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);p.statusCode()!==ee.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(p,o)})}})}notifyStop(o,p){var f;if(this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoDidStop).map(f=>f.bind(p)(o))}),this.eventController){let m=Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]}),_=p&&p.message||(null==(f=o.toString)?void 0:f.call(o))||"";null===this.meetingSessionContext.startTimeMs?(m.meetingErrorMessage=_,delete m.meetingDurationMs,delete m.attendeePresenceDurationMs,delete m.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",m)):o.isFailure()||o.isAudioConnectionFailure()?(m.meetingErrorMessage=_,this.eventController.publishEvent("meetingFailed",m)):this.eventController.publishEvent("meetingEnded",m)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{let o=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(o)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(o,p){this.promotedToPrimaryMeeting&&(this.promotedToPrimaryMeeting=!1,this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.AudioVideoDisconnectedWhilePromoted)))}));let f=this._reconnectController.retryWithBackoff(()=>I(this,void 0,void 0,function*(){this.sessionStateController.state()===ed.default.NotConnected?this.sessionStateController.perform(el.default.Connect,()=>{this.actionConnect(!0)}):this.sessionStateController.perform(el.default.Reconnect,()=>{this.actionReconnect(o)}),this.meetingSessionContext.retryCount+=1}),()=>{this.logger.info("canceled retry")});return f||this.sessionStateController.perform(el.default.Fail,()=>{this.actionDisconnect(o,!1,p)}),f}actionReconnect(o){return I(this,void 0,void 0,function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoDidStartConnecting).map(p=>p.bind(o)(!0))})),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset(),this.receiveRemotePauseResumeTask=new eP.default(this.meetingSessionContext);try{yield new eL.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new eB.default(this.logger,new eL.default(this.logger,"Media",[new ev.default(this.meetingSessionContext),new eL.default(this.logger,"Signaling",[new eA.default(this.meetingSessionContext),new eT.default(this.meetingSessionContext)]),new ey.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new eR.default(this.meetingSessionContext),new eB.default(this.logger,new eL.default(this.logger,"UpdateSession",[new eS.default(this.meetingSessionContext),new e_.default(this.meetingSessionContext),new eN.default(this.meetingSessionContext),new eC.default(this.meetingSessionContext),new eV.default(this.meetingSessionContext),new eF.default(this.meetingSessionContext),this.receiveRemotePauseResumeTask]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(el.default.FinishConnecting,()=>{var p;null==(p=this.eventController)||p.publishEvent("meetingReconnected",Object.assign(Object.assign({},q.audioVideoEventAttributesFromState(this.meetingSessionContext)),{meetingStatus:ee.default[o.statusCode()]})),this.actionFinishConnecting()})}catch(o){this.sessionStateController.perform(el.default.FinishConnecting,()=>{this.logger.info("failed to reconnect audio-video session");let p=new Z.default(this.getMeetingStatusCode(o)||ee.default.TaskFailed);this.handleMeetingSessionStatus(p,o)})}this.connectionHealthData.setConnectionStartTime()})}wrapTaskName(o){return`${o}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(o){let p=/the meeting status code: (\d+)/.exec(o&&o.message);return p&&p.length>1?Number.parseInt(p[1],10):null}enforceBandwidthLimitationForSender(o){return I(this,void 0,void 0,function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(o)})}handleMeetingSessionStatus(o,p){if(this.logger.info(`handling status: ${ee.default[o.statusCode()]}`),!o.isTerminal()&&this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(o),o.statusCode()===ee.default.IncompatibleSDP)return this.restartLocalVideo(()=>{this.logger.info("handled incompatible SDP by attempting to restart video")}),!0;if(o.statusCode()===ee.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver(o=>{eW.Maybe.of(o.videoSendDidBecomeUnavailable).map(p=>p.bind(o)())}),!1;if(o.statusCode()===ee.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver(p=>{eW.Maybe.of(p.audioVideoWasDemotedFromPrimaryMeeting).map(f=>f.bind(p)(o))}),!1;if(o.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(o.isFailure()||o.isTerminal())&&this.meetingSessionContext.reconnectController){let f=this.reconnect(o,p);return f?this.logger.warn(`The audio video controller will reconnect due to status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`):this.logger.error(`The audio video controller failed with status code ${ee.default[o.statusCode()]}${p?` and error: ${p.message}`:""}`),f}return!1}setVideoMaxBandwidthKbps(o){if(o<=0)throw Error("Max bandwidth kbps has to be greater than 0");this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${o} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(o)),this.maxUplinkBandwidthKbps=o}handleHasBandwidthPriority(o){return I(this,void 0,void 0,function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink){this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o),yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();return}let p=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(o);let f=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();p!==f&&(this.logger.info(`video send bandwidth priority ${o} max has changed from ${p} kbps to ${f} kbps`),yield this.enforceBandwidthLimitationForSender(f))}})}pauseReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([o])}resumeReceivingStream(o){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([o])}setVideoCodecSendPreferences(o){this.videoSendCodecPreferences=o,this.meetingSessionContext.videoSendCodecPreferences=o,this.sessionStateController.state()!==ed.default.NotConnected&&this.update({needsRenegotiation:!0})}getRemoteVideoSources(){let{videoStreamIndex:o}=this.meetingSessionContext;if(!o)return this.logger.info("meeting has not started"),[];let p=this.configuration.credentials.attendeeId;return o.allVideoSendingSourcesExcludingSelf(p)}encodingSimulcastLayersDidChange(o){this.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver(p=>{eW.Maybe.of(p.encodingSimulcastLayersDidChange).map(f=>f.bind(p)(o))})}promoteToPrimaryMeeting(o){return this.actionPromoteToPrimaryMeeting(o)}actionPromoteToPrimaryMeeting(o){return I(this,void 0,void 0,function*(){let p=new Z.default(ee.default.SignalingRequestFailed);return yield new eL.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new eB.default(this.logger,new eM.default(this.meetingSessionContext,o,o=>{p=o}),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=p.statusCode()===ee.default.OK,p})}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver(o=>{eW.Maybe.of(o.audioVideoWasDemotedFromPrimaryMeeting).map(p=>p.bind(o)(new Z.default(ee.default.OK)))})}videoInputDidChange(o){return I(this,void 0,void 0,function*(){(this.logger.info("Receive a video input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer)?this._videoTileController.hasStartedLocalVideoTile()&&(o?yield this.replaceLocalVideo(o):this._videoTileController.stopLocalVideoTile()):this.logger.info("Skip updating video input because there is no active meeting and peer connection")})}audioInputDidChange(o){return I(this,void 0,void 0,function*(){if(this.logger.info("Receive an audio input change event"),!this.meetingSessionContext||!this.meetingSessionContext.peer)return void this.logger.info("Skip updating audio input because there is no active meeting and peer connection");if(!o)try{o=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(o){this.logger.error("Could not acquire audio track from mediaStreamBroker");return}yield this.replaceLocalAudio(o)})}};p.default=e5,e5.MIN_VOLUME_DECIBELS=-42,e5.MAX_VOLUME_DECIBELS=-14,e5.PING_PONG_INTERVAL_MS=1e4},0x233121a41:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3)),w=m(f(0x674df13c)),I=m(f(0x23cb0924a)),k=m(f(0x41c6ff55)),M=m(f(0x13b48f1ad)),x=m(f(0x16342f6ad)),O=m(f(0xb28de657)),L=m(f(0x234745d42)),B=m(f(0xd5022a77)),U=m(f(0x1b1a7866)),$=m(f(0x5cfde354)),q=m(f(0x10a965f7c));p.default=class extends q.default{constructor(o){const p=new M.default;p.meetingId="",p.externalMeetingId="",p.credentials=new x.default,p.credentials.attendeeId="",p.credentials.joinToken="",p.urls=new B.default,p.urls.turnControlURL="",p.urls.audioHostURL="",p.urls.signalingURL="wss://localhost/";const f=new I.default;super(o||p,f,new $.default(new I.default),new k.default,new U.default(0,new _.default(0,0,0)),new w.default(o||p,f))}setAudioProfile(o){}start(){}stop(){}promoteToPrimaryMeeting(o){return Promise.resolve(new O.default(L.default.OK))}demoteFromPrimaryMeeting(){}}},0x12f2a530c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x20a4e5a2e);p.default=class{constructor(o,p,f,m,_,w){this.audioVideoController=o,this.videoTileController=p,this.realtimeController=f,this.audioMixController=m,this.deviceController=_,this.contentShareController=w}addObserver(o){this.audioVideoController.addObserver(o),this.trace("addObserver")}removeObserver(o){this.audioVideoController.removeObserver(o),this.trace("removeObserver")}setAudioProfile(o){this.trace("setAudioProfile",o),this.audioVideoController.setAudioProfile(o)}start(o){this.audioVideoController.start(o),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(o){return this.trace("getRTCPeerConnectionStats",o?o.id:null),this.audioVideoController.getRTCPeerConnectionStats(o)}bindAudioElement(o){let p=this.audioMixController.bindAudioElement(o);return this.trace("bindAudioElement",o.id,p),p}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(o){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(o)}removeAudioMixObserver(o){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(o)}bindVideoElement(o,p){this.videoTileController.bindVideoElement(o,p),this.trace("bindVideoElement",{tileId:o,videoElementId:p.id})}unbindVideoElement(o,p=!0){this.videoTileController.unbindVideoElement(o,p),this.trace("unbindVideoElement",{tileId:o,cleanUpVideoElement:p})}startLocalVideoTile(){let o=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,o),o}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){let o=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,o),o}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){let o=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),o}pauseVideoTile(o){this.videoTileController.pauseVideoTile(o),this.trace("pauseVideoTile",o)}unpauseVideoTile(o){this.videoTileController.unpauseVideoTile(o),this.trace("unpauseVideoTile",o)}getVideoTile(o){let p=this.videoTileController.getVideoTile(o);return this.trace("getVideoTile",o),p}getAllRemoteVideoTiles(){let o=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),o}getAllVideoTiles(){let o=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),o}addVideoTile(){let o=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,o.state()),o}removeVideoTile(o){this.videoTileController.removeVideoTile(o),this.trace("removeVideoTile",o)}removeVideoTilesByAttendeeId(o){let p=this.videoTileController.removeVideoTilesByAttendeeId(o);return this.trace("removeVideoTilesByAttendeeId",o,p),p}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(o){let p=this.videoTileController.captureVideoTile(o);return this.trace("captureVideoTile",o),p}realtimeSubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(o){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(o),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSetCanUnmuteLocalAudio(o),this.trace("realtimeSetCanUnmuteLocalAudio",o)}realtimeSubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}realtimeCanUnmuteLocalAudio(){let o=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,o),o}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){let o=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),o}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}realtimeIsLocalAudioMuted(){let o=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),o}realtimeSubscribeToVolumeIndicator(o,p){this.realtimeController.realtimeSubscribeToVolumeIndicator(o,p),this.trace("realtimeSubscribeToVolumeIndicator",o)}realtimeUnsubscribeFromVolumeIndicator(o,p){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(o,p),this.trace("realtimeUnsubscribeFromVolumeIndicator",o,p)}realtimeSubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(o){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(o),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(o,p,f){this.realtimeController.realtimeSendDataMessage(o,p,f),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(o,p){this.realtimeController.realtimeSubscribeToReceiveDataMessage(o,p),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(o){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(o),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(o){this.realtimeController.realtimeSubscribeToFatalError(o),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(o){this.realtimeController.realtimeUnsubscribeToFatalError(o),this.trace("realtimeUnsubscribeToFatalError")}subscribeToActiveSpeakerDetector(o,p,f,m){this.audioVideoController.activeSpeakerDetector.subscribe(o,p,f,m),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(o){this.audioVideoController.activeSpeakerDetector.unsubscribe(o),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioInputDevices(o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listVideoInputDevices(o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.deviceController.listAudioOutputDevices(o);return this.trace("listAudioOutputDevices",o,p),p})}startAudioInput(o){return m(this,void 0,void 0,function*(){return this.trace("startAudioInput",o),this.deviceController.startAudioInput(o)})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()})}startVideoInput(o){return m(this,void 0,void 0,function*(){return _.isVideoTransformDevice(o)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",o),this.deviceController.startVideoInput(o)})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()})}chooseAudioOutput(o){let p=this.deviceController.chooseAudioOutput(o);return this.trace("chooseAudioOutput",o),p}addDeviceChangeObserver(o){this.deviceController.addDeviceChangeObserver(o),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.deviceController.removeDeviceChangeObserver(o),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){let o=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),o}startVideoPreviewForVideoInput(o){this.deviceController.startVideoPreviewForVideoInput(o),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){this.deviceController.stopVideoPreviewForVideoInput(o),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){this.deviceController.setDeviceLabelTrigger(o),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=this.deviceController.mixIntoAudioInput(o);return this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){this.deviceController.chooseVideoInputQuality(o,p,f),this.trace("chooseVideoInputQuality",{width:o,height:p,frameRate:f})}setVideoMaxBandwidthKbps(o){this.audioVideoController.setVideoMaxBandwidthKbps(o),this.trace("setVideoMaxBandwidthKbps",o)}setVideoCodecSendPreferences(o){this.audioVideoController.setVideoCodecSendPreferences(o),this.trace("setVideoCodecSendPreferences",o)}getVideoInputQualitySettings(){let o=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),o}setContentAudioProfile(o){this.trace("setContentAudioProfile",o),this.contentShareController.setContentAudioProfile(o)}enableSimulcastForContentShare(o,p){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(o,p)}enableSVCForContentShare(o){this.trace("enableSVCForContentShare"),this.contentShareController.enableSVCForContentShare(o)}startContentShare(o){let p=this.contentShareController.startContentShare(o);return this.trace("startContentShare"),p}startContentShareFromScreenCapture(o,p){let f=this.contentShareController.startContentShareFromScreenCapture(o,p);return this.trace("startContentShareFromScreenCapture"),f}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(o){this.contentShareController.addContentShareObserver(o),this.trace("addContentShareObserver")}removeContentShareObserver(o){this.contentShareController.removeContentShareObserver(o),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(o){this.contentShareController.setContentShareVideoCodecPreferences(o),this.trace("setContentShareVideoCodecPreferences")}trace(o,p,f){let m=this.audioVideoController.configuration.meetingId,_=this.audioVideoController.configuration.credentials.attendeeId,w=`API/DefaultAudioVideoFacade/${m}/${_}/${o}`;void 0!==p&&(w+=` ${JSON.stringify(p)}`),void 0!==f&&(w+=` -> ${JSON.stringify(f)}`),this.audioVideoController.logger.info(w)}getRemoteVideoSources(){let o=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,o),o}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(o){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);let p=this.audioVideoController.promoteToPrimaryMeeting(o);return this.trace("promoteToPrimaryMeeting",null,p),p}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(o){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}}},0x17a4528e8:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x24d089a26)),I=f(0x17991f3f2);p.default=class extends w.default{constructor(o,p){super(o,p),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("BackgroundBlur processor using builtin blur")}drawImageWithMask(o,p){let f=this.blurredImage,{canvasCtx:m,targetCanvas:_}=this,{width:w,height:I}=_;p&&f?(this.scaledCanvas.getContext("2d").putImageData(p,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),m.save(),m.clearRect(0,0,w,I),m.drawImage(this.scaledCanvas,0,0,w,I),m.globalCompositeOperation="source-in",m.drawImage(o,0,0,w,I),m.globalCompositeOperation="destination-over",m.drawImage(this.blurCanvas,0,0,w,I),m.restore()):m.clearRect(0,0,w,I)}setBlurStrength(o){if(super.setBlurStrength(o),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});let o=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:o.path,inputHeight:o.input.height,inputWidth:o.input.width,inputChannels:4,modelRangeMin:o.input.range[0],modelRangeMax:o.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(o){this.blurredImage=o.payload.blurOutput,super.handlePredict(o)}destroy(){var o;let p=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){p.destroy.call(this),null==(o=this.blurCanvas)||o.remove(),this.blurCanvas=void 0})}}},0x24d089a26:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16455e291)),I=f(0x17991f3f2),k=_(f(0xdfc34e9e));p.default=class extends w.default{constructor(o,p){super("background blur",o,p,new k.default),this.blurAmount=0,this.setBlurStrength(p.blurStrength),this.logger.info("BackgroundBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: { blurStrength: ${p.blurStrength}, filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}validateOptions(o){if(super.validateOptions(o),!o.blurStrength)throw Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.filter=`blur(${this.blurAmount}px)`,f.drawImage(o,0,0,m.width,m.height),f.restore()}setBlurStrength(o){this._blurStrength=o,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=I.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}static isSupported(){return m(this,void 0,void 0,function*(){let o=document.createElement("canvas"),p=void 0!==o.getContext("2d").filter;return o.remove(),p})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){let o={backgroundBlurEnabled:"true",backgroundBlurStrength:this._blurStrength,backgroundReplacementEnabled:"false",backgroundFilterVersion:1};this.eventController.publishEvent("backgroundFilterConfigSelected",o)}}},0x17991f3f2:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.BlurStrengthMapper=void 0;let f=class{static getBlurAmount(o,p){if(o<=0)throw Error(`invalid value for blur strength: ${o}`);return Math.round(o*p.height/this.BLUR_STRENGTH_DIVISOR)}};p.BlurStrengthMapper=f,f.BLUR_STRENGTH_DIVISOR=540,p.default={LOW:7,MEDIUM:15,HIGH:30}},0x20e5c1309:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x6e3c7bbd)),I=_(f(0xb3c65cf4)),k=_(f(0x1e476648b)),M=_(f(0x23b2002bd)),x=_(f(0x17a4528e8)),O=_(f(0x24d089a26)),L=_(f(0x17991f3f2)),B=class extends M.default{setBlurStrength(){}loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}};p.default=class BackgroundBlurVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){let f;o=BackgroundBlurVideoFrameProcessor.resolveSpec(o);let{logger:m}=p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),_=yield BackgroundBlurVideoFrameProcessor.isSupported(o,p);return(m.info(`processor is ${_?"":"not"} supported`),_)?((yield O.default.isSupported())?(m.info("Using browser-provided background blur"),f=new O.default(o,p)):(m.info("Using built-in background blur"),f=new x.default(o,p)),yield f.loadAssets(),f):(m.warn("Using no-op processor because background blur is not supported"),new B)})}static resolveOptions(o={}){let p=Object.assign({},o);return p.blurStrength||(p.blurStrength=L.default.MEDIUM),p.logger||(p.logger=new I.default("BackgroundBlurProcessor",k.default.INFO)),p=super.resolveOptions(p)}static isSupported(o,p){return o=BackgroundBlurVideoFrameProcessor.resolveSpec(o),p=BackgroundBlurVideoFrameProcessor.resolveOptions(p),super.isSupported(o,p)}}},0xdfc34e9e:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x10857f88a));p.default=class extends _.default{}},0xfc893d67:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ModelSpecBuilder{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new ModelSpecBuilder}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){return this.path="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite",this.input={height:144,width:256,range:[0,1],channels:3},this.output={height:144,width:256,range:[0,1],channels:1},this}withPath(o){return this.path=o,this}withInput(o){return this.input=o,this}withOutput(o){return this.output=o,this}validate(){if(!this.path)throw Error("model spec path is not set");if(!this.input)throw Error("model spec input is not set");if(!this.output)throw Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}}},0x129e30dac:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.delegate=o,this.reportingPeriodMillis=p,this.filterCPUUtilization=f,this.logger=m,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(o){let p=o-this.lastReportedEventTimestamp;if(p>=this.reportingPeriodMillis){let f=this.filterCount,m=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=o,0===this.framerate||0===f)return;let _=Math.round(m/f),w=Math.round(this.framerate*(p/1e3))-f,I=Math.round(100*m/p);_>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:w,avgFilterDurationMillis:_,framerate:this.framerate,periodMillis:p}),I>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:I,filterMillis:m,periodMillis:p})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(o){o!==this.framerate&&(this.framerate=o,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());let p=Date.now();this.reportEvent(p)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},0x16455e291:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.BackgroundFilterMonitor=void 0;let w=f(0x2037185f8),I=_(f(0x9ce0607d)),k=_(f(0x129e30dac)),M=class{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise(o=>this.resolve=o)),this.promise}next(o){this.value=o,this.resolve(o),delete this.promise}};p.default=class BackgroundFilterProcessor{constructor(o,p,f,m,_){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new I.default(this.targetCanvas),this.mask$=new M,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=BackgroundFilterProcessor.createWorkerPromise(),this.loadModelPromise=BackgroundFilterProcessor.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=o,this.validateSpec(p),this.validateOptions(f),this.spec=p,this.logger=f.logger,this.delegate=m,this.initCPUMonitor(f),this.eventController=_}static createWorkerPromise(){let o={resolve:null,reject:null,promise:null};return o.promise=new Promise((p,f)=>{o.resolve=p,o.reject=f}),o}validateSpec(o){if(!o)throw Error("processor has null spec");if(!o.model)throw Error("processor spec has null model");if(!o.paths)throw Error("processor spec has null paths")}validateOptions(o){if(!o)throw Error("processor has null options");if(!o.logger)throw Error("processor has null options - logger");if(!o.reportingPeriodMillis)throw Error("processor has null options - reportingPeriodMillis");if(!o.filterCPUUtilization)throw Error("processor has null options - filterCPUUtilization")}initCPUMonitor(o){this.videoFramesPerFilterUpdate=1,this.frameCounter=new k.default(this.delegate,o.reportingPeriodMillis,o.filterCPUUtilization,this.logger),this.cpuMonitor=new x(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(o){return JSON.stringify(o,null,2)}handleInitialize(o){if(this.logger.info(`received initialize message: ${this.stringify(o)}`),!o.payload){this.logger.error("failed to initialize module"),this.initWorkerPromise.reject(Error("failed to initialize the module"));return}let p=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:p.path,inputHeight:p.input.height,inputWidth:p.input.width,inputChannels:4,modelRangeMin:p.input.range[0],modelRangeMax:p.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(o){if(this.logger.info(`received load model message: ${this.stringify(o)}`),2!==o.payload){this.logger.error("failed to load model! status: "+o.payload),this.loadModelPromise.reject(Error("failed to load model! status: "+o.payload));return}this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(o){this.mask$.next(o.payload.output)}handleWorkerEvent(o){let p=o.data;switch(p.msg){case"initialize":this.handleInitialize(p);break;case"loadModel":this.handleLoadModel(p);break;case"predict":this.handlePredict(p);break;default:this.logger.info(`unexpected event msg: ${this.stringify(p)}`)}}loadAssets(){return m(this,void 0,void 0,function*(){this.logger.info("start initializing the processor");try{this.worker=yield w.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},null),this.worker.addEventListener("message",o=>this.handleWorkerEvent(o)),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(o){throw Error(`could not initialize the ${this.filterType} video frame processor due to '${o.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)})}process(o){return m(this,void 0,void 0,function*(){if(this.destroyed)return o;this.frameCounter.frameReceived(o[0].framerate),this.cpuMonitor.frameReceived();let p=o[0].asCanvasElement();if(!p)return o;if(!this.modelInitialized)return o[0]=this.canvasVideoFrameBuffer,o;let f=p.width,m=p.height;if(0===f||0===m)return o;0===this.sourceWidth&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),(this.sourceWidth!==f||this.sourceHeight!==m)&&(this.sourceWidth=f,this.sourceHeight=m,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let o=this.mask$.value,f=this.spec.model.input.width/p.width,m=this.spec.model.input.height/p.height;void 0===this.scaledCanvas&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);let _=this.scaledCanvas.getContext("2d");_.save(),_.scale(f,m),_.drawImage(p,0,0),_.restore();let w=_.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate==0){let p=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:w},[w.data.buffer]),o=yield p}this.destroyed||this.drawImageWithMask(p,o)}catch(p){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${p}`),o}finally{this.frameCounter.filterComplete(),this.frameNumber++}return o[0]=this.canvasVideoFrameBuffer,o})}updateVideoFramesPerFilterUpdate(o){o!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=o,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var o,p,f,_;return m(this,void 0,void 0,function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),null==(o=this.worker)||o.postMessage({msg:"destroy"}),null==(p=this.worker)||p.postMessage({msg:"stop"}),null==(f=this.targetCanvas)||f.remove(),this.targetCanvas=void 0,null==(_=this.scaledCanvas)||_.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)})}};let x=class{constructor(o,p){this.monitoringPeriodMillis=o,this.observer=p,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){let o=Date.now();o-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.reduceCPUUtilization())}frameReceived(){let o=Date.now();o-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=o,this.observer.increaseCPUUtilization())}};p.BackgroundFilterMonitor=x},0x6e3c7bbd:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x2037185f8),I=f(0x19eda6376),k=_(f(0xfc893d67)),M=_(f(0x165009cb4)),x=_(f(0xaf1ae5b3)),O="https://static.sdkassets.chime.aws",L={worker:`${O}/bgblur/workers/worker.js`,wasm:`${O}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${O}/bgblur/wasm/_cwt-wasm-simd.wasm`};p.default=class{static defaultAssetSpec(){let o=x.default.sdkVersionSemVer;return{assetGroup:`sdk-${o.major}.${o.minor}`}}static createUrlWithParams(o,p){let f=new URL(o);for(let o of Object.keys(p))void 0!==p[o]&&f.searchParams.set(o,p[o]);return f.toString()}static resolveSpec(o){let{paths:p=L,model:f=k.default.builder().withSelfieSegmentationDefaults().build(),assetGroup:m=this.defaultAssetSpec().assetGroup,revisionID:_=this.defaultAssetSpec().revisionID}=o||{},w={assetGroup:m,revisionID:_,sdk:encodeURIComponent(x.default.sdkVersion),ua:encodeURIComponent(x.default.sdkUserAgentLowResolution)};return p.worker=this.createUrlWithParams(p.worker,w),p.wasm=this.createUrlWithParams(p.wasm,w),p.simd=this.createUrlWithParams(p.simd,w),f.path=this.createUrlWithParams(f.path,w),{paths:p,model:f,assetGroup:m,revisionID:_}}static resolveOptions(o){return o.reportingPeriodMillis||(o.reportingPeriodMillis=1e3),o.filterCPUUtilization?(o.filterCPUUtilization<0||o.filterCPUUtilization>100)&&(o.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),o.filterCPUUtilization=30):o.filterCPUUtilization=30,o}static isSupported(o,p){let{logger:f}=p;return"u"{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.observers=new Set}addObserver(o){this.observers.add(o)}removeObserver(o){this.observers.delete(o)}filterFrameDurationHigh(o){var p;for(let f of this.observers)null==(p=f.filterFrameDurationHigh)||p.call(f,o)}filterCPUUtilizationHigh(o){var p;for(let f of this.observers)null==(p=f.filterCPUUtilizationHigh)||p.call(f,o)}}},0x93043d23:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x16455e291)),I=_(f(0x190970c58));p.default=class BackgroundReplacementFilter extends w.default{constructor(o,p){super("background replacement",o,p,new I.default),this.replacementBlob=p.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: { filterCPUUtilization: ${p.filterCPUUtilization}, reportingPeriodMillis: ${p.reportingPeriodMillis}}`)}setImageBlob(o){return m(this,void 0,void 0,function*(){this.replacementBlob=o,this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl())})}initOnFirstExecution(){}drawImageWithMask(o,p){p||(p=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(p,0,0);let{canvasCtx:f,targetCanvas:m}=this,{width:_,height:w}=m;f.save(),f.clearRect(0,0,_,w),f.drawImage(this.scaledCanvas,0,0,_,w),f.globalCompositeOperation="source-in",f.drawImage(o,0,0,_,w),f.globalCompositeOperation="destination-over",f.drawImage(this.replacementImage,0,0,m.width,m.height),f.restore()}static loadImageExecutor(o,p,f){let m=new Image;m.crossOrigin="Anonymous",m.addEventListener("load",()=>{o(m)},!1),m.addEventListener("error",o=>{p(Error(`Could not load replacement image ${m.src}: ${o.message}`))},!1),m.src=f}static loadImage(o){return m(this,void 0,void 0,function*(){return new Promise((p,f)=>this.loadImageExecutor(p,f,o))})}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){let o=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return m(this,void 0,void 0,function*(){this.replacementImage=yield BackgroundReplacementFilter.loadImage(this.createReplacementObjectUrl()),o.loadAssets.call(this)})}addObserver(o){this.delegate.addObserver(o)}removeObserver(o){this.delegate.removeObserver(o)}destroy(){let o=Object.create(null,{destroy:{get:()=>super.destroy}});return m(this,void 0,void 0,function*(){o.destroy.call(this),this.revokeReplacementObjectUrl()})}setEventController(o){this.eventController?this.eventController=o:(this.eventController=o,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){this.eventController.publishEvent("backgroundFilterConfigSelected",{backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1})}}},0x1c4b3e1a7:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x6e3c7bbd)),I=_(f(0xb3c65cf4)),k=_(f(0x1e476648b)),M=_(f(0x23b2002bd)),x=_(f(0x93043d23)),O=class extends M.default{loadAssets(){return m(this,void 0,void 0,function*(){})}addObserver(){}removeObserver(){}setImageBlob(){return m(this,void 0,void 0,function*(){})}};p.default=class BackgroundReplacementVideoFrameProcessor extends w.default{static create(o,p){return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let{logger:f}=p;if(!(yield BackgroundReplacementVideoFrameProcessor.isSupported(o,p)))return f.warn("Using no-op processor because background replacement is not supported"),new O;f.info("Using background replacement filter");let m=new x.default(o,p);return yield m.loadAssets(),m})}static resolveOptions(o={}){let p=Object.assign({},o);return p.logger||(p.logger=new I.default("BackgroundReplacementProcessor",k.default.INFO)),super.resolveOptions(p)}static resolveOptionsAsync(o){return m(this,void 0,void 0,function*(){if(!o.imageBlob){let p=document.createElement("canvas");p.width=100,p.height=100;let f=p.getContext("2d");f.fillStyle="blue",f.fillRect(0,0,100,100),o.imageBlob=yield new Promise(o=>{p.toBlob(o)})}})}static isSupported(o,p){let f=Object.create(null,{isSupported:{get:()=>super.isSupported}});return m(this,void 0,void 0,function*(){o=this.resolveSpec(o),p=this.resolveOptions(p),yield this.resolveOptionsAsync(p);let m=p.imageBlob,_=URL.createObjectURL(m);try{yield x.default.loadImage(_)}catch(o){return p.logger.info(`Failed to fetch load replacement image ${o.message}`),!1}finally{URL.revokeObjectURL(_)}return f.isSupported.call(this,o,p)})}}},0x190970c58:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x10857f88a));p.default=class extends _.default{}},6329639e3:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){let o=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,o}}},0x1026e31ba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3)),w=m(f(0x415bfbb2));p.default=class{constructor(o,p,f){this.fixedWaitMs=o,this.shortBackoffMs=p,this.longBackoffMs=f}create(){return new _.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(o){return new w.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,o)}}},0x415bfbb2:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(6329639e3));p.default=class extends _.default{constructor(o,p,f,m){super(o,p,f),this.limit=m,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw Error("retry limit exceeded");return super.nextBackoffAmountMs()}}},0x165009cb4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0x22e89c4d),w=f(0x13f6890b8),I=class DefaultBrowserBehavior{constructor(){this.FALLBACK_BROWSER={type:"browser",name:"unknown",version:"unknown",os:"unknown"},this.browser=_.detect()||this.FALLBACK_BROWSER,this.uaParserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null,this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview","edge-ios"]}version(){return this.browser.version}majorVersion(){return null!==this.version()?parseInt(this.version().split(".")[0]):-1}osMajorVersion(){return parseInt(this.uaParserResult.os.version.split(".")[0])}engine(){return this.uaParserResult.engine.name}engineMajorVersion(){return parseInt(this.uaParserResult.engine.version.split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(let o of this.chromeLike)if(o===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(let o of this.webkitBrowsers)if(o===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}requiresPlaybackLatencyHintForAudioContext(){return -1!==navigator.userAgent.indexOf("Windows")}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()&&!this.isIOSEdge()||this.isIOSSafari()&&this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK||this.majorVersion()>=DefaultBrowserBehavior.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK}supportsBackgroundFilter(){return("safari"!==this.name()||15!==this.majorVersion())&&!!this.supportsCanvasCapturedStreamPlayback()}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsDependencyDescriptorRtpHeaderExtension(){return this.hasChromiumWebRTC()}supportsScalableVideoCoding(){return this.hasChromiumWebRTC()&&"Blink"===this.engine()&&this.engineMajorVersion()>=111}supportsAudioRedundancy(){return this.hasChromiumWebRTC()?this.engineMajorVersion()>=107:!this.hasFirefoxWebRTC()}requiresResolutionAlignment(o,p){return this.isAndroid()&&this.isPixel3()?[64*Math.ceil(o/64),64*Math.ceil(p/64)]:[o,p]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()o.includes("a=rtpmap:")).map(o=>o.replace(/.* /,"").replace(/\/.*/,"")).filter((o,p,f)=>f.indexOf(o)===p).filter(o=>"rtx"!==o&&"red"!==o&&"ulpfec"!==o)})}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return this.isIOS()&&("15.1.0"===this.version()||/( OS 15_1)/i.test(navigator.userAgent))}requiresVideoPlayWorkaround(){return this.isSafari()}requiresAudioContextResetOnDeviceFailureForWebAudio(){return this.isIOS()}isVideoFxSupportedBrowser(){return this.supportsBackgroundFilter()}isIOSSafari(){return"ios"===this.browser.name||"ios-webview"===this.browser.name||"safari"===this.browser.name&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}isSafari(){return"safari"===this.browser.name||this.isIOSSafari()}isFirefox(){return"firefox"===this.browser.name}isIOSFirefox(){return"fxios"===this.browser.name}isIOSChrome(){return"crios"===this.browser.name}isChrome(){return"chrome"===this.browser.name}isEdge(){return"edge-chromium"===this.browser.name}isIOSEdge(){return"edge-ios"===this.browser.name}isSamsungInternet(){return"samsung"===this.browser.name}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isIOS(){return this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox()}};p.default=I,I.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16,I.MIN_IOS_NON_SAFARI_SUPPORT_CANVAS_STREAM_PLAYBACK=106},0xc9ba5f35:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0x138ccc65a)),I=m(f(0x2fbf3af)),k=m(f(0x22562ac09));p.default=class ClientMetricReport{constructor(o,p,f){this.logger=o,this.videoStreamIndex=p,this.selfAttendeeId=f,this.globalMetricReport=new k.default,this.streamMetricReports={},this.rtcStatsReport={},this.customStatsReports=[],this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.overriddenObservableMetrics=new Map,this.identityValue=(o,p)=>Number((p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.decoderLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.concealedSamples-(f.previousMetrics.concealedSamples||0),_=f.currentMetrics.totalSamplesReceived-(f.previousMetrics.totalSamplesReceived||0);return _<=0||_-m<=0?0:m/_*100},this.packetLossPercent=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics[o]-(f.previousMetrics[o]||0),_=f.currentMetrics.packetsLost-(f.previousMetrics.packetsLost||0),w=m+_;return w<=0||_<=0?0:100*_/w},this.jitterBufferMs=(o,p)=>{let f=this.streamMetricReports[p],m=f.currentMetrics.jitterBufferDelay-(f.previousMetrics.jitterBufferDelay||0),_=f.currentMetrics.jitterBufferEmittedCount-(f.previousMetrics.jitterBufferEmittedCount||0);return m<=0||_<=0?0:m/_*1e3},this.countPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:Math.trunc(_/m)},this.bitsPerSecond=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=(f.currentMetrics[o]-(f.previousMetrics[o]||0))*8;return _<=0?0:Math.trunc(_/m)},this.secondsToMilliseconds=(o,p)=>Number(1e3*(p?this.streamMetricReports[p]:this.globalMetricReport).currentMetrics[o]),this.averageTimeSpentPerSecondInMilliseconds=(o,p)=>{let f=p?this.streamMetricReports[p]:this.globalMetricReport,m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=f.currentMetrics[o]-(f.previousMetrics[o]||0);return _<=0?0:1e3*_/m},this.averageCpuQualityLimitationDurationPerSecondInMilliseconds=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.previousObjectMetrics[o]||void 0===f.currentObjectMetrics[o])return NaN;let m=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(m<=0)return 0;this.previousTimestampMs<=0&&(m=1);let _=0,w=0;for(let[p,m]of Object.entries(f.previousObjectMetrics[o]))"cpu"===p&&(_=m);for(let[p,m]of Object.entries(f.currentObjectMetrics[o]))"cpu"===p&&(w=m);let I=w-_;return I<=0?0:1e3*I/m},this.isHardwareImplementation=(o,p)=>{let f=this.streamMetricReports[p];if(void 0===f.currentStringMetrics[o])return NaN;let m=String(f.currentStringMetrics[o]),_=m.includes("ExternalDecoder")||m.includes("ExternalEncoder")||m.includes("EncodeAccelerator")||m.includes("DecodeAccelerator"),w=m.includes("fallback from");return _&&!w?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:_.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.STUN_RTT_MS},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_MIC_AUDIO_LEVEL,source:"audioLevel"}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.RTC_SPK_BITRATE},audioLevel:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_AUDIO_LEVEL},totalAudioPacketsLost:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_LOST},totalAudioPacketsExpected:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_EXPECTED},totalAudioPacketsRecoveredRed:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_RED},totalAudioPacketsRecoveredFec:{transform:this.identityValue,type:_.SdkMetric.Type.RTC_SPK_TOTAL_RECOVERED_FEC}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_SENT_JITTER_MS},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE},qualityLimitationDurations:{transform:this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU},videoCodecDegradationHighEncodeCpu:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_HIGH_ENCODE_CPU},videoCodecDegradationEncodeFailure:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_CODEC_DEGRADATION_ENCODE_FAILURE},videoInputWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_WIDTH},videoInputHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_INPUT_HEIGHT}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:_.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:_.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:_.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:_.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE},totalFreezesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_FREEZE_DURATION},freezeCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_FREEZE_COUNT},totalPausesDuration:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:_.SdkMetric.Type.VIDEO_PAUSE_DURATION},pauseCount:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_PAUSE_COUNT},framesDropped:{transform:this.countPerSecond,type:_.SdkMetric.Type.VIDEO_DROPPED_FPS},videoRenderWidth:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_WIDTH},videoRenderHeight:{transform:this.identityValue,type:_.SdkMetric.Type.VIDEO_RENDER_HEIGHT}},this.streamDimensionMap={encoderImplementation:_.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:_.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFramesInputPerSecond:{source:"framesPerSecond",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamEncoderImplementation:{source:"encoderImplementation",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamTotalEncodeTimePerSecond:{source:"totalEncodeTime",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoUpstreamCpuQualityLimitationDurationPerSecond:{source:"qualityLimitationDurations",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:I.default.VIDEO,dir:w.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:I.default.VIDEO,dir:w.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:I.default.AUDIO,dir:w.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:I.default.VIDEO,dir:w.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:I.default.VIDEO,dir:w.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"},audioDownstreamLevel:{source:"audioLevel",media:I.default.AUDIO,dir:w.default.DOWNSTREAM},audioUpstreamLevel:{source:"audioLevel"}}}getMetricMap(o,p){switch(o){case I.default.AUDIO:switch(p){case w.default.UPSTREAM:return this.audioUpstreamMetricMap;case w.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case I.default.VIDEO:switch(p){case w.default.UPSTREAM:return this.videoUpstreamMetricMap;case w.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(o){if(this.overriddenObservableMetrics.has(o))return this.overriddenObservableMetrics.get(o);let p=this.observableMetricSpec[o],{transform:f,source:m}=this.getMetricMap(p.media,p.dir)[p.source];if(!p.hasOwnProperty("media"))return f(m||p.source);for(let o in this.streamMetricReports){let _=this.streamMetricReports[o];if(_.direction===p.dir&&_.mediaType===p.media)return f(m||p.source,Number(o))}return 0}getObservableVideoMetricValue(o,p){let f=this.observableVideoMetricSpec[o],{transform:m,source:_}=this.getMetricMap(f.media,f.dir)[f.source];return m(_||f.source,p)}getVideoUpstreamSsrcs(){let o=[];for(let p in this.streamMetricReports)this.streamMetricReports[p].mediaType===I.default.VIDEO&&this.streamMetricReports[p].direction===w.default.UPSTREAM&&o.push(Number(p));return o}getObservableMetrics(){let o={};for(let p in this.observableMetricSpec)o[p]=this.getObservableMetricValue(p);return o}getObservableVideoMetrics(){let o={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),o;for(let p in this.streamMetricReports)if(this.streamMetricReports[p].mediaType===I.default.VIDEO){let f={};for(let o in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[o].dir===this.streamMetricReports[p].direction){let m=this.getObservableVideoMetricValue(o,Number(p));isNaN(m)||(f[o]=m)}let m=this.streamMetricReports[p].groupId,_=this.streamMetricReports[p].streamId,w="";o[w=void 0!==this.videoStreamIndex.attendeeIdForGroupId?m?this.videoStreamIndex.attendeeIdForGroupId(m):this.selfAttendeeId:_?this.videoStreamIndex.attendeeIdForStreamId(_):this.selfAttendeeId]=o[w]?o[w]:{},o[w][p]=f}return o}getRTCStatsReport(){return this.rtcStatsReport}clone(){let o=new ClientMetricReport(this.logger,this.videoStreamIndex,this.selfAttendeeId);return o.globalMetricReport=this.globalMetricReport,o.streamMetricReports=this.streamMetricReports,o.rtcStatsReport=this.rtcStatsReport,o.customStatsReports=this.customStatsReports,o.currentTimestampMs=this.currentTimestampMs,o.previousTimestampMs=this.previousTimestampMs,o.overriddenObservableMetrics=this.overriddenObservableMetrics,o}print(){let o={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug(()=>`Client Metric Report: ${JSON.stringify(o)}`)}removeDestroyedSsrcs(){for(let o in this.streamMetricReports)this.currentSsrcs[o]||delete this.streamMetricReports[o]}overrideObservableMetric(o,p){this.overriddenObservableMetrics.set(o,p)}}},0x138ccc65a:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportDirection=void 0,(m=f=p.ClientMetricReportDirection||(p.ClientMetricReportDirection={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM",p.default=f},0x2fbf3af:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.ClientMetricReportMediaType=void 0,(m=f=p.ClientMetricReportMediaType||(p.ClientMetricReportMediaType={}))[m.AUDIO=0]="AUDIO",m[m.VIDEO=1]="VIDEO",p.default=f},0x1979c5b3a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{}},0x22562ac09:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0x250d201d4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.currentTimestampMs=0,this.ssrc=0,this.totalAudioPacketsLost=0,this.totalAudioPacketsExpected=0,this.totalAudioPacketsRecoveredRed=0,this.totalAudioPacketsRecoveredFec=0}}},0x2e51c102:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={},this.previousObjectMetrics={},this.currentObjectMetrics={}}}},0xbc5a8cda:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.minHealth=o.minHealth,this.maxHealth=o.maxHealth,this.currentHealth=o.initialHealth,this.currentData=p.clone(),this.name=f}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(o){this.currentData=o}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){let o=this.health();return o!==this.currentHealth?(this.currentHealth=o,o):null}}},0x73406699:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class ConnectionHealthData{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.isVideoEncoderHardware=!1,this.videoEncodingTimeInMs=0,this.videoEncodingTimePerFrameInMs=0,this.cpuLimitationDuration=0,this.videoInputFps=0,this.videoEncodeFps=0,this.isContentShare=!1,this.numberOfPublishedVideoSources=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(o,p){return Date.now()=ReconnectionHealthPolicy.CONNECTION_UNHEALTHY_THRESHOLD,p=this.currentData.consecutiveMissedPongs>=ReconnectionHealthPolicy.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;let f=this.audioDelayPointsOverMaximum>ReconnectionHealthPolicy.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return(f&&(this.audioDelayPointsOverMaximum=0),o||p||f)?(this.logger.warn(`reconnection recommended due to: no packets received: ${o}, missed pongs: ${p}, bad audio delay: ${f}`),0):1}}},0x19f6220b7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda));p.default=class extends _.default{constructor(o,p,f){super(p,f,"Sending Audio Health"),this.logger=o,this.sendingAudioFailureSamplesToConsider=p.sendingAudioFailureSamplesToConsider>0?p.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=p.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=p.maximumTimesToWarn,this.coolDownTimeMs=p.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){let o=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),p=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return o&&p}health(){if(this.isSendingAudioUnhealthy()){let o=Date.now()-this.lastWarnTimestampMsthis.minimumHealth())||o?this.currentHealth:(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())}return this.maximumHealth()}}},0x1461f4056:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda));p.default=class extends _.default{constructor(o,p){super(o,p,"Unusable Audio Warning"),this.coolDownTimeMs=o.cooldownTimeMs,this.pastSamplesToConsider=o.pastSamplesToConsider,this.fractionalLoss=o.fractionalLoss,this.packetsExpected=o.packetsExpected,this.maximumTimesToWarn=o.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length=this.fractionalLoss)return 1*(0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,!!(this.warnCount>this.maximumTimesToWarn)));return 1}}},0x109562310:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoConcurrentSendersHealth),this.concurrentVideoSendersThreshold=o.concurrentVideoSendersThreshold}health(){return this.currentData.isContentShare?this.maximumHealth():this.currentData.numberOfPublishedVideoSources>this.concurrentVideoSendersThreshold?this.minimumHealth():this.maximumHealth()}}},0x1cdcbf76c:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.VideoEncodingConnectionHealthPolicyName=void 0,(m=f=p.VideoEncodingConnectionHealthPolicyName||(p.VideoEncodingConnectionHealthPolicyName={})).VideoEncodingCpuHealth="Video Encoding CPU Health",m.VideoEncodingFramerateHealth="Video Encoding framerate Health",m.VideoConcurrentSendersHealth="Video Concurrent Senders Health",p.default=f},0x1bdf2cac3:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingCpuHealth),this.consecutiveHighEncodeCpuCnt=0,this.consecutiveHighEncodeCpuThreshold=o.consecutiveHighEncodeCpuThreshold,this.highEncodeCpuMsThreshold=o.highEncodeCpuMsThreshold,this.highEncodeCpuMsPerFrameThreshold=o.highEncodeCpuMsPerFrameThreshold}health(){let o=this.currentData.videoEncodingTimeInMs>=this.highEncodeCpuMsThreshold&&this.currentData.videoEncodingTimePerFrameInMs>=this.highEncodeCpuMsPerFrameThreshold;if(!this.currentData.isVideoEncoderHardware&&(o||this.currentData.cpuLimitationDuration>0)){if(this.consecutiveHighEncodeCpuCnt++,this.consecutiveHighEncodeCpuCnt>this.consecutiveHighEncodeCpuThreshold)return this.consecutiveHighEncodeCpuCnt=0,this.minimumHealth()}else this.consecutiveHighEncodeCpuCnt=0;return this.maximumHealth()}}},0x225dfdbba:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0xbc5a8cda)),w=m(f(0x1cdcbf76c));p.default=class extends _.default{constructor(o,p){super(o,p,w.default.VideoEncodingFramerateHealth),this.consecutiveEncodeFailureCnt=0,this.consecutiveVideoEncodingFailureThreshold=o.consecutiveVideoEncodingFailureThreshold}health(){if(0===this.currentData.videoEncodeFps&&this.currentData.videoInputFps>0){if(this.consecutiveEncodeFailureCnt++,this.consecutiveEncodeFailureCnt>this.consecutiveVideoEncodingFailureThreshold)return this.consecutiveEncodeFailureCnt=0,this.minimumHealth()}else this.consecutiveEncodeFailureCnt=0;return this.maximumHealth()}}},0x7cabad69:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0xb529932d);p.default=class{constructor(o,p,f,m,_){this.audioVideoController=o,this.realtimeController=p,this.connectionHealthData=f,this.pingPong=m,this.statsCollector=_,this.isActive=!1,this.hasSeenValidCandidatePairMetricsBefore=!1,this.lastTotalBytesReceived=0,this.lastTotalStunMessagesReceived=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(o=>{this.isActive&&this.receiveSignalStrengthChange(o)})}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(o){0===o?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):o<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(o,p,f){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",p),this.statsCollector.logLatency("ping_pong_clock_skew",f),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(o){let p=0,f=0,m=o.getObservableMetrics(),_=m.audioPacketsReceived,w=m.audioPacketsReceivedFractionLoss,I=m.audioSpeakerDelayMs;"number"!=typeof I||isNaN(I)||this.connectionHealthData.setAudioSpeakerDelayMs(I);let k=o.getRTCStatsReport(),M=0,x=0;k.forEach(o=>{"candidate-pair"===o.type&&(o.bytesReceived&&(M+=o.bytesReceived),o.requestsReceived&&(x+=o.requestsReceived),o.responsesReceived&&(x+=o.responsesReceived))});let O=M-this.lastTotalBytesReceived;this.lastTotalBytesReceived=M;let L=x-this.lastTotalStunMessagesReceived;this.lastTotalStunMessagesReceived=x,"number"!=typeof _||"number"!=typeof w||(p=_,f=w,p<0||f<0||O<0||L<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,p),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,f),O>0||L>0?(this.hasSeenValidCandidatePairMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidCandidatePairMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===p||f>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),"number"==typeof m.audioPacketsSent&&this.updateAudioPacketsSentInConnectionHealth(m.audioPacketsSent),this.updateVideoEncodingHealth(o),this.updateConnectionHealth()))}updateAudioPacketsSentInConnectionHealth(o){o>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}updateVideoEncodingHealth(o){let p=this.audioVideoController.videoTileController.hasStartedLocalVideoTile(),f=o.getVideoUpstreamSsrcs();if(!p||0===f.length){this.connectionHealthData.setIsVideoEncoderHardware(!1),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(0),this.connectionHealthData.setCpuLimitationDuration(0),this.connectionHealthData.setVideoInputFps(0),this.connectionHealthData.setVideoEncodeFps(0);return}let m=!1,_=0,w=0,I=0,k=0;for(let p of f)m||(m=!!o.getObservableVideoMetricValue("videoUpstreamEncoderImplementation",p)),_+=o.getObservableVideoMetricValue("videoUpstreamTotalEncodeTimePerSecond",p),w+=o.getObservableVideoMetricValue("videoUpstreamCpuQualityLimitationDurationPerSecond",p),I+=o.getObservableVideoMetricValue("videoUpstreamFramesInputPerSecond",p),k+=o.getObservableVideoMetricValue("videoUpstreamFramesEncodedPerSecond",p);let M=k>0?_/k:0;this.connectionHealthData.setIsVideoEncoderHardware(!!m),this.connectionHealthData.setVideoEncodingTimeInMs(_),this.connectionHealthData.setVideoEncodingTimePerFrameInMs(M),this.connectionHealthData.setCpuLimitationDuration(w),this.connectionHealthData.setVideoInputFps(I),this.connectionHealthData.setVideoEncodeFps(k)}addToMinuteWindow(o,p){o.unshift(p),o.length>60&&o.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver(o=>{m.Maybe.of(o.connectionHealthDidChange).map(p=>p.bind(o)(this.connectionHealthData.clone()))})}}},0x104cf28d8:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Modality="#content",p.default=f},0x11817b564:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0xba48c8f4)),k=class ContentShareMediaStreamBroker{constructor(o){this.logger=o}get mediaStream(){return this._mediaStream}set mediaStream(o){this._mediaStream=o}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return 0===this._mediaStream.getAudioTracks().length?(this.logger.info("No audio stream available. Synthesizing an audio stream."),I.default.synthesizeAudioDevice(0)):this._mediaStream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){return this._mediaStream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){return o&&o.video&&o.video.mandatory&&o.video.mandatory.chromeMediaSource&&o.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(o):navigator.mediaDevices.getDisplayMedia(o)})}acquireScreenCaptureDisplayInputStream(o,p){return m(this,void 0,void 0,function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(o,p))})}screenCaptureDisplayMediaConstraints(o,p){return{audio:!!(!o&&new w.default().getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!o&&{frameRate:{max:p||ContentShareMediaStreamBroker.defaultFrameRate}}),o&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:o,maxFrameRate:p||ContentShareMediaStreamBroker.defaultFrameRate}})}}toggleMediaStream(o){let p=!1;if(this.mediaStream)for(let f=0;f{this.stopContentShare()});this.contentAudioVideo.start()}})}startContentShareFromScreenCapture(o,p){return m(this,void 0,void 0,function*(){let f=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(o,p);return yield this.startContentShare(f),f})}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidPause).map(p=>p.call(o))})}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidUnpause).map(p=>p.call(o))})}setContentShareVideoCodecPreferences(o){this.contentAudioVideo.setVideoCodecSendPreferences(o)}destroy(){return m(this,void 0,void 0,function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)})}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(o){this.observerQueue.add(o)}removeContentShareObserver(o){this.observerQueue.delete(o)}forEachContentShareObserver(o){for(let p of this.observerQueue)x.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}audioVideoDidStart(){var o;(null==(o=this.mediaStreamBroker.mediaStream)?void 0:o.getVideoTracks().length)>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(o){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStop).map(p=>p.call(o))})}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence((o,p,f,m)=>{let _=new M.default(o).hasModality(M.default.MODALITY_CONTENT),w=new M.default(o).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!_||!w||!p||this.contentShareTile)return;let I=this.mediaStreamBroker.mediaStream;if(null==I?void 0:I.getVideoTracks().length){let o,p;this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();let f=I.getVideoTracks()[0];if(f.getSettings){let m=f.getSettings();o=m.width,p=m.height}else{let m=f.getCapabilities();o=m.width,p=m.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,I,o,p,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver(o=>{O.Maybe.of(o.contentShareDidStart).map(p=>p.call(o))})})}}},0xd6e2cff:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=class CSPMonitor{static register(){"document"in f.g&&document.addEventListener&&CSPMonitor.shouldRegisterCSPMonitor&&!CSPMonitor.added&&(document.addEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.added=!0)}static unregister(){"document"in f.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",CSPMonitor.listener),CSPMonitor.loggers=new Set,CSPMonitor.added=!1)}static disable(){CSPMonitor.shouldRegisterCSPMonitor=!1,CSPMonitor.unregister()}static addLogger(o){o&&CSPMonitor.loggers.add(o)}static removeLogger(o){o&&CSPMonitor.loggers.delete(o)}};p.default=m,m.loggers=new Set,m.shouldRegisterCSPMonitor=!0,m.added=!1,m.listener=o=>{let p=`Security Policy Violation
Blocked URI: ${o.blockedURI}
Violated Directive: ${o.violatedDirective}
Original Policy: ${o.originalPolicy}
Document URI: ${o.documentURI}
Source File: ${o.sourceFile}
Line No.: ${o.lineNumber}
`;for(let o of m.loggers)o.error(p);0===m.loggers.size&&console.error(p)}},0x239b30f5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m,_,w){this.timestampMs=o,this.topic=p,this.data=f,this.senderAttendeeId=m,this.senderExternalUserId=_,this.throttled=!!w}text(){return new TextDecoder().decode(this.data)}json(){return JSON.parse(new TextDecoder().decode(this.data))}}},0x1f56347ad:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isDestroyable=void 0,p.isDestroyable=function(o){return o&&"destroy"in o}},0x97143bf9:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isAudioTransformDevice=void 0,p.isAudioTransformDevice=function(o){return!!o&&"object"==typeof o&&"mute"in o&&"stop"in o&&"intrinsicDevice"in o}},0xba48c8f4:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x165009cb4)),I=_(f(0x2321cdcd0)),k=_(f(0x573f705d)),M=_(f(0x8f5563d8)),x=f(0xb529932d),O=_(f(0x18c01a5bb)),L=_(f(0x4c923b82)),B=f(0x97143bf9),U=_(f(0x12584ea7b)),$=_(f(0x1f53ed78a)),q=_(f(0x1db5bc494)),Z=_(f(0x1b486d07c)),ee=_(f(0xa4c520e9)),et=_(f(0xfb8fdb39)),ei=_(f(0x1055aac05)),er=_(f(0x3b3f192c)),en=f(0x20a4e5a2e),eo=class DefaultDeviceController{constructor(o,p,f=new w.default,m){this.logger=o,this.browserBehavior=f,this.eventController=m,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new M.default,this.videoInputTaskQueue=new M.default,this.muted=!1,this.mediaStreamMuteObserver=(o,p)=>{for(let f of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(f)&&f.audioInputMuteStateChanged&&f.audioInputMuteStateChanged(o,p)})},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:_=!1,useMediaConstraintsFallback:x=!0}=p||{};this.useWebAudio=_,this.useMediaConstraintsFallback=x,this.videoInputQualitySettings=new er.default(DefaultDeviceController.defaultVideoWidth,DefaultDeviceController.defaultVideoHeight,DefaultDeviceController.defaultVideoFrameRate);const O=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=O[0],this.videoInputQualitySettings.videoHeight=O[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=new I.default().create();const o=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(o)}`)}catch(p){o.error(p.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},null==(o=this.mediaDeviceWrapper)||o.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var o;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),null==(o=this.mediaDeviceWrapper)||o.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return!!this.deviceChangeObservers.size||this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return m(this,void 0,void 0,function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()})}listAudioInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audioinput",o);return this.trace("listAudioInputDevices",o,p),p})}listVideoInputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("videoinput",o);return this.trace("listVideoInputDevices",o,p),p})}listAudioOutputDevices(o=!1){return m(this,void 0,void 0,function*(){let p=yield this.listDevicesOfKind("audiooutput",o);return this.trace("listAudioOutputDevices",o,p),p})}pushAudioMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(o){var p;null==(p=this.eventController)||p.publishEvent(void 0===o?"videoInputUnselected":"videoInputSelected")}startAudioInput(o){return m(this,void 0,void 0,function*(){return yield this.audioInputTaskQueue.add(()=>this.startAudioInputTask(o))})}startAudioInputTask(o){var p;return m(this,void 0,void 0,function*(){if(void 0===o)return void this.logger.error("Audio input device cannot be undefined");try{if(B.isAudioTransformDevice(o)?(this.logger.info(`Choosing transform input device ${o}`),yield this.chooseAudioTransformInputDevice(o)):(this.logger.info(`Choosing intrinsic audio input device ${o}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",o)),this.trace("startAudioInputDevice",o,"success"),this.useWebAudio)return this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null==(p=this.transform)?void 0:p.device.mute(this.muted),this.getMediaStreamDestinationNode().stream;return this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream}catch(o){throw o}})}stopAudioInput(){return m(this,void 0,void 0,function*(){return this.audioInputTaskQueue.add(()=>this.stopAudioInputTask())})}stopAudioInputTask(){return m(this,void 0,void 0,function*(){try{if(this.useWebAudio)return void this.releaseAudioTransformStream();this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}})}chooseAudioTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){let f;if((null==(p=this.transform)?void 0:p.device)===o)return;if(!this.useWebAudio)throw Error("Cannot apply transform device without enabling Web Audio.");let m=DefaultDeviceController.getAudioContext();if(m instanceof OfflineAudioContext);else switch(m.state){case"running":break;case"closed":throw Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield m.resume()}try{f=yield o.createAudioNode(m)}catch(o){throw this.logger.error(`Unable to create transform device node: ${o}.`),o}let _=yield o.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",_),this.logger.debug(`Got inner stream: ${_}.`),this.setTransform(o,f)})}chooseVideoTransformInputDevice(o){var p;return m(this,void 0,void 0,function*(){if(this.eventController&&o instanceof O.default&&o.passEventControllerToProcessors(this.eventController),o===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");let f=this.chosenVideoTransformDevice;f&&this.logger.info("Switched from previous VideoTransformDevice");let m=!!f,_=yield o.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null==(p=this.activeDevices.video)?void 0:p.stream,_)){this.logger.info("video transform device needs new intrinsic device"),m&&f.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=o,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",_),this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream);return}this.chosenVideoTransformDevice=o,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield o.transformStream(this.activeDevices.video.stream)})}startVideoInput(o){return m(this,void 0,void 0,function*(){return yield this.videoInputTaskQueue.add(()=>this.startVideoInputTask(o))})}startVideoInputTask(o){return m(this,void 0,void 0,function*(){if(!o)return void this.logger.error("Invalid video input device");try{if(en.isVideoTransformDevice(o))return this.logger.info(`Choosing video transform device ${o}`),yield this.chooseVideoTransformInputDevice(o),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream;return this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",o),this.trace("startVideoInputDevice",o),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream}catch(o){throw o}})}stopVideoInput(){return m(this,void 0,void 0,function*(){return this.videoInputTaskQueue.add(()=>this.stopVideoInputTask())})}stopVideoInputTask(){return m(this,void 0,void 0,function*(){try{if(this.chosenVideoInputIsTransformDevice())return void this.releaseVideoTransformStream();this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}})}chooseAudioOutput(o){return m(this,void 0,void 0,function*(){this.audioOutputDeviceId=o,this.watchForDeviceChangesIfNecessary();let p=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(p),this.trace("chooseAudioOutput",o,null)})}addDeviceChangeObserver(o){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(o),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(o){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(o),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var o,p;if(!this.activeDevices.audio)return null;let f=null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.end;if(f){let o=f.context.createAnalyser();return o.removeOriginalInputs=()=>{try{f.disconnect(o)}catch(o){}},f.connect(o),o}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(o){let p=DefaultDeviceController.getAudioContext(),f=p.createAnalyser(),m=p.createMediaStreamSource(o);return m.connect(f),this.trace("createAnalyserNodeForAudioInput"),f.removeOriginalInputs=()=>{try{m.disconnect(f)}catch{}},f}startVideoPreviewForVideoInput(o){if(!this.activeDevices.video){this.logger.warn("cannot bind video preview since video input device has not been chosen"),this.trace("startVideoPreviewForVideoInput",o.id);return}L.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,o,!0),this.trace("startVideoPreviewForVideoInput",o.id)}stopVideoPreviewForVideoInput(o){L.default.disconnectVideoStreamFromVideoElement(o,!1),this.trace("stopVideoPreviewForVideoInput",o.id)}setDeviceLabelTrigger(o){if(this.deviceInfoCache){for(let o of this.deviceInfoCache)if(!o.label){this.deviceInfoCache=null;break}}this.deviceLabelTrigger=o,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(o){let p=null;return this.useWebAudio?(p=DefaultDeviceController.getAudioContext().createMediaStreamSource(o)).connect(this.getMediaStreamOutputNode()):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",o.id),p}chooseVideoInputQuality(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(o,p);this.videoInputQualitySettings=new er.default(m[0],m[1],f)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return m(this,void 0,void 0,function*(){return(this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio)?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream})}acquireVideoInputStream(){return m(this,void 0,void 0,function*(){if(!this.activeDevices.video)throw Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream})}acquireDisplayInputStream(o){return m(this,void 0,void 0,function*(){throw Error("unsupported")})}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(o){let p=this.activeDevices[o];if(!p)return;let f=p.endedCallback,m=p.trackMuteCallback,_=p.trackUnmuteCallback;for(let w of p.stream.getTracks())w.stop(),f&&w.removeEventListener("ended",f),m&&w.removeEventListener("mute",m),_&&w.removeEventListener("unmute",_),delete p.endedCallback,delete p.trackMuteCallback,delete p.trackUnmuteCallback,delete this.activeDevices[o]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(o){var p;let f=this.activeDevices.audio;if(this.useWebAudio&&(f=this.getMediaStreamDestinationNode()),f){for(let p of f.stream.getTracks())p.enabled!==o&&(p.enabled=o);!o!==this.muted&&(this.muted=!o,null==(p=this.transform)||p.device.mute(this.muted))}}static getIntrinsicDeviceId(o){if(!o)return;if("string"==typeof o)return o;if(o.id)return o.id;let p=o.deviceId;return p?"string"==typeof p||Array.isArray(p)?p:"string"==typeof p.exact||Array.isArray(p.exact)?p.exact:void 0:void 0}static createEmptyAudioDevice(){return DefaultDeviceController.synthesizeAudioDevice(0)}static synthesizeAudioDevice(o){let p=DefaultDeviceController.getAudioContext(),f=p.createMediaStreamDestination();if(o){let m=p.createGain();m.gain.value=.1,m.connect(f);let _=p.createOscillator();_.frequency.value=o,_.connect(m),_.start()}else{let o=p.createBufferSource();try{o.buffer=p.createBuffer(1,5*p.sampleRate,p.sampleRate)}catch(f){if(f&&"NotSupportedError"===f.name)o.buffer=p.createBuffer(1,5*DefaultDeviceController.defaultSampleRate,DefaultDeviceController.defaultSampleRate);else throw f}o.buffer.getChannelData(0)[0]=3e-4,o.loop=!0,o.connect(f),o.start()}return f.stream}listDevicesOfKind(o,p){return m(this,void 0,void 0,function*(){return(p||null===this.deviceInfoCache||!this.isWatchingForDeviceChanges())&&(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(o)})}updateDeviceInfoCacheFromBrowser(){var o;return m(this,void 0,void 0,function*(){if("u"{this.handleDeviceChange()});this.alreadyHandlingDeviceChange=!0;let o=this.listCachedDevicesOfKind("audioinput"),p=this.listCachedDevicesOfKind("videoinput"),f=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();let m=this.listCachedDevicesOfKind("audioinput"),_=this.listCachedDevicesOfKind("videoinput"),w=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver(I=>{this.areDeviceListsEqual(o,m)||x.Maybe.of(I.audioInputsChanged).map(o=>o.bind(I)(m)),this.areDeviceListsEqual(p,_)||x.Maybe.of(I.videoInputsChanged).map(o=>o.bind(I)(_)),this.areDeviceListsEqual(f,w)||x.Maybe.of(I.audioOutputsChanged).map(o=>o.bind(I)(w))}),this.alreadyHandlingDeviceChange=!1})}handleDeviceStreamEnded(o,p){return m(this,void 0,void 0,function*(){try{"audio"===o?(this.useWebAudio&&this.browserBehavior.requiresAudioContextResetOnDeviceFailureForWebAudio()?(this.logger.warn("Audio input device which was active is no longer available, suspending and resuming audio context before resetting to empty device to ensure packets are sent"),yield this.stopAudioInput(),DefaultDeviceController.suspendAudioContext(),DefaultDeviceController.resumeAudioContext()):this.logger.warn("Audio input device which was active is no longer available, resetting to empty device to ensure packets are sent"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch(o){this.logger.error("Failed to choose null device after stream ended.")}"audio"===o?this.forEachObserver(o=>{x.Maybe.of(o.audioInputStreamEnded).map(f=>f.bind(o)(p))}):this.forEachObserver(o=>{x.Maybe.of(o.videoInputStreamEnded).map(f=>f.bind(o)(p))})})}forEachObserver(o){for(let p of this.deviceChangeObservers)k.default.nextTick(()=>{this.deviceChangeObservers.has(p)&&o(p)})}forEachMediaStreamBrokerObserver(o){for(let p of this.mediaStreamBrokerObservers)k.default.nextTick(()=>{this.mediaStreamBrokerObservers.has(p)&&o(p)})}areDeviceListsEqual(o,p){return JSON.stringify(o.map(o=>JSON.stringify(o)).sort())===JSON.stringify(p.map(o=>JSON.stringify(o)).sort())}intrinsicDeviceAsMediaStream(o){return o&&o.id?o:null}hasSameMediaStreamId(o,p,f){var m,_,w,I;let k;return"audio"===o?!!(k=null==f?void 0:f.audio.streamId)&&k===(null==(_=null==(m=p.constraints)?void 0:m.audio)?void 0:_.streamId):!!(k=null==f?void 0:f.video.streamId)&&k===(null==(I=null==(w=null==p?void 0:p.constraints)?void 0:w.video)?void 0:I.streamId)}hasSameGroupId(o,p,f){if(""===o)return!0;let m=DefaultDeviceController.getIntrinsicDeviceId(f);return this.logger.debug(`Checking deviceIds ${m} of type ${typeof m} with groupId ${o}`),"string"==typeof m&&o===this.getGroupIdFromDeviceId(p,m)}getGroupIdFromDeviceId(o,p){if(null!==this.deviceInfoCache){let f=this.listCachedDevicesOfKind(`${o}input`).find(o=>o.deviceId===p);if(f&&f.groupId)return this.logger.debug(`GroupId of deviceId ${p} found in cache is ${f.groupId}`),f.groupId}return this.logger.debug(`GroupId of deviceId ${p} found in cache is empty`),""}handleGetUserMediaError(o,p){if(!o)throw new $.default(o);switch(o.name){case"NotReadableError":case"TrackStartError":throw new Z.default(o);case"NotFoundError":case"DevicesNotFoundError":throw new q.default(o);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":if(p&&p{this.activeDevices[o]&&this.activeDevices[o].stream===p.stream&&(this.handleDeviceStreamEnded(o,m),delete p.endedCallback)},_.addEventListener("ended",p.endedCallback,{once:!0})),"audio"===o){let o=p.stream.getAudioTracks()[0];if(o){let f=o.getSettings().deviceId||p.stream;p.trackMuteCallback=()=>{this.mediaStreamMuteObserver(f,!0)},p.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(f,!1)},o.addEventListener("mute",p.trackMuteCallback,{once:!1}),o.addEventListener("unmute",p.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),o.muted?p.trackMuteCallback():p.trackUnmuteCallback()}}})}calculateMediaStreamConstraints(o,p,f,m){if(m&&1===this.listCachedDevicesOfKind(`${o}input`).length)return!0;let _={};return(this.browserBehavior.requiresNoExactMediaStreamConstraints()?_.deviceId=p:_.deviceId={exact:p},f&&(_.groupId=f),m)?_:"video"===o?(_.width={ideal:this.videoInputQualitySettings.videoWidth},_.height={ideal:this.videoInputQualitySettings.videoHeight},_.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},_):(this.supportSampleRateConstraint()&&(_.sampleRate={ideal:DefaultDeviceController.defaultSampleRate}),this.supportSampleSizeConstraint()&&(_.sampleSize={ideal:DefaultDeviceController.defaultSampleSize}),this.supportChannelCountConstraint()&&(_.channelCount={ideal:DefaultDeviceController.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},_))}getMediaStreamConstraintsFromTrackConstraints(o,p){return"audio"===o?{audio:p}:{video:p}}getMediaStreamConstraints(o,p,f=!1){let m={};if(!p)return null;let _=this.intrinsicDeviceAsMediaStream(p);if(_)return m.streamId=_.id,this.getMediaStreamConstraintsFromTrackConstraints(o,m);if("string"==typeof p){let _="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(null!==this.deviceInfoCache?_=this.getGroupIdFromDeviceId(o,p):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),m=this.calculateMediaStreamConstraints(o,p,_,f),this.getMediaStreamConstraintsFromTrackConstraints(o,m)}return isMediaDeviceInfo(p)?m=this.calculateMediaStreamConstraints(o,p.deviceId,p.groupId,f):m=p,this.getMediaStreamConstraintsFromTrackConstraints(o,m)}deviceInfoFromDeviceId(o,p){if(null===this.deviceInfoCache)return null;for(let f of this.deviceInfoCache)if(f.kind===o&&f.deviceId===p)return f;return null}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(o,p){if(!o||!o.active||!p)return!1;if(p.id)return o.id===p.id;let f=this.getMediaTrackSettings(o);if(!f.deviceId)return!1;let m=DefaultDeviceController.getIntrinsicDeviceId(p);return"string"==typeof m&&f.deviceId===m}getMediaTrackSettings(o){var p;return null==(p=o.getTracks()[0])?void 0:p.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();let o=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(o)}setTransform(o,p){var f,m;null==(m=null==(f=this.transform)?void 0:f.nodes)||m.end.disconnect(),this.transform={nodes:p,device:o};let _=null==p?void 0:p.end,w=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${_} to destination ${w}.`),null==_||_.connect(w),this.reconnectAudioInputs()}removeTransform(){var o;let p=this.transform;if(p)return null==(o=this.transform.nodes)||o.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),p}attachAudioInputStreamToAudioContext(o){var p;null==(p=this.audioInputSourceNode)||p.disconnect(),this.audioInputSourceNode=DefaultDeviceController.getAudioContext().createMediaStreamSource(o);let f=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(f)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=DefaultDeviceController.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var o,p;return(null==(p=null==(o=this.transform)?void 0:o.nodes)?void 0:p.start)||this.getMediaStreamDestinationNode()}static setDefaultLatencyHint(o){DefaultDeviceController.defaultLatencyHint=o}static getAudioContext(){if(!DefaultDeviceController.audioContext){let o={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(o.sampleRate=DefaultDeviceController.defaultSampleRate),new w.default().requiresPlaybackLatencyHintForAudioContext()&&(o.latencyHint="playback"),DefaultDeviceController.defaultLatencyHint&&(o.latencyHint=DefaultDeviceController.defaultLatencyHint),DefaultDeviceController.audioContext=new(window.AudioContext||window.webkitAudioContext)(o)}return DefaultDeviceController.audioContext}static suspendAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.suspend():Promise.resolve()})}static resumeAudioContext(){return m(this,void 0,void 0,function*(){return DefaultDeviceController.audioContext?DefaultDeviceController.audioContext.resume():Promise.resolve()})}static closeAudioContext(){if(DefaultDeviceController.audioContext)try{DefaultDeviceController.audioContext.close()}catch(o){}DefaultDeviceController.audioContext=null}addMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.add(o)}removeMediaStreamBrokerObserver(o){this.mediaStreamBrokerObservers.delete(o)}publishVideoInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.videoInputDidChange&&p.videoInputDidChange(o)}),this.pushVideoMeetingStateForPermissions(o)}publishAudioInputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioInputDidChange&&p.audioInputDidChange(o)}),this.pushAudioMeetingStateForPermissions(o)}publishAudioOutputDidChangeEvent(o){this.forEachMediaStreamBrokerObserver(p=>{p.audioOutputDidChange&&p.audioOutputDidChange(o)})}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(o,p,f){let m=`API/DefaultDeviceController/${o}`;void 0!==p&&(m+=` ${JSON.stringify(p)}`),void 0!==f&&(m+=` -> ${JSON.stringify(f)}`),this.logger.info(m)}};function isMediaDeviceInfo(o){return"object"==typeof o&&"deviceId"in o&&"groupId"in o&&"kind"in o&&"label"in o}p.default=eo,eo.permissionDeniedOriginDetectionThresholdMs=500,eo.defaultVideoWidth=960,eo.defaultVideoHeight=540,eo.defaultVideoFrameRate=15,eo.defaultSampleRate=48e3,eo.defaultSampleSize=16,eo.defaultChannelCount=1,eo.audioContext=null},0x12584ea7b:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.groupId=""}matchesConstraints(o){return JSON.stringify(this.constraints)===JSON.stringify(o)}}},0x1f53ed78a:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class extends Error{constructor(o,p){super(p||"Error fetching device."),this.cause=o,this.name="GetUserMediaError"}}},0x19e6a0f9b:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.NoOpDeviceControllerWithEventController=void 0;let w=_(f(0x41c6ff55)),I=_(f(0x3b3f192c)),k=class extends w.default{constructor(o){super(),this.destroyed=!1}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0})}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(o){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(o){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(o){return Promise.reject()}addDeviceChangeObserver(o){}removeDeviceChangeObserver(o){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(o){}stopVideoPreviewForVideoInput(o){}setDeviceLabelTrigger(o){}mixIntoAudioInput(o){return null}chooseVideoInputQuality(o,p,f){}getVideoInputQualitySettings(){return I.default.VideoDisabled}};p.default=k,p.NoOpDeviceControllerWithEventController=class extends k{constructor(o){super(),this.eventController=o}}},0x1db5bc494:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="NotFoundError"}}},0x1b486d07c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="NotReadableError"}}},0xa4c520e9:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o,p){super(o),this.constraint=p,this.name="OverconstrainedError"}}},0xfb8fdb39:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o,p){super(o,p),this.name="PermissionDeniedError"}}},0x215250f11:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o){this.inner=o}mute(o){return f(this,void 0,void 0,function*(){})}stop(){var o;return f(this,void 0,void 0,function*(){null==(o=this.node)||o.disconnect()})}intrinsicDevice(){return f(this,void 0,void 0,function*(){return this.inner})}createAudioNode(o){var p;return f(this,void 0,void 0,function*(){return null==(p=this.node)||p.disconnect(),this.node=yield this.createSingleAudioNode(o),{start:this.node,end:this.node}})}}},0x1055aac05:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1f53ed78a));p.default=class extends _.default{constructor(o){super(o),this.name="TypeError"}}},0x3b3f192c:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class{constructor(o,p,f){this.videoWidth=o,this.videoHeight=p,this.videoFrameRate=f}equals(o){return this.videoWidth===o.videoWidth&&this.videoHeight===o.videoHeight&&this.videoFrameRate===o.videoFrameRate}};p.default=f,f.VideoDisabled=new f(0,0,0),f.VideoResolutionHD=new f(1280,720,30),f.VideoResolutionFHD=new f(1920,1080,30),f.VideoResolutionUHD=new f(3840,2160,30)},0x20a4e5a2e:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.isVideoTransformDevice=void 0,p.isVideoTransformDevice=function(o){return!!o&&"object"==typeof o&&"transformStream"in o&&"stop"in o&&"intrinsicDevice"in o}},0x16ee58416:function(o,p){"use strict";var f=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p){if(this.devicePixelRatioSource=o,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach(o=>{o.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())})},"u"{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{devicePixelRatio(){return!("u"p.indexOf(m)&&(f[m]=o[m]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols)for(var _=0,m=Object.getOwnPropertySymbols(o);_p.indexOf(m[_])&&Object.prototype.propertyIsEnumerable.call(o,m[_])&&(f[m[_]]=o[m[_]]);return f},w=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let I=w(f(6329639e3)),k=w(f(0x7b80cc62)),M=w(f(0x6cbaf532)),x=f(0x149d24991),O=class InMemoryJSONEventBuffer{constructor(o,p,f,w,I){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=o=>({type:o.type,v:o.v,payloads:[...o.payloads]}),this.sendEvents=()=>m(this,void 0,void 0,function*(){if(this.lock)return;let o=this.getItems(this.flushSize);if(0===o.length)return;this.lock=!0;let p=this.makeRequestBody(o),f=!1,m=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(m,o);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${p}`);let o=yield this.send(p);if(this.cancellableEvents.delete(m),o.ok)try{let f=yield o.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${p} message: ${JSON.stringify(f)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${o} for events ${p}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${p} with response status ${o.status}`),f=!0}catch(o){f=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${p} to the ingestion endpoint ${o}`)}finally{this.lock=!1}f&&(this.cancellableEvents.delete(m),this.failedIngestionEvents.push(...o))});const k=new M.default(I).getParserResult(),{browserMajorVersion:x}=k,O=_(k,["browserMajorVersion"]),L=p.toJSON(),{type:B,v:U}=L,$=_(L,["type","v"]);this.authenticationToken=p.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},O),$),Object.keys(this.metadata).forEach(o=>this.attributesToFilter.push(o)),this.type=B,this.v=U,this.ingestionURL=f,this.logger=I,this.importantEvents=new Set(w);const{maxBufferCapacityKb:q,totalBufferItems:Z,flushSize:ee,flushIntervalMs:et,retryCountLimit:ei}=o;this.maxBufferCapacityBytes=1024*q,this.totalBufferItems=Z,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/Z),this.flushIntervalMs=et,this.flushSize=ee,this.retryCountLimit=ei,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=o=>this.beaconEventHandler(o),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in f.g&&window.addEventListener&&"document"in f.g&&document.addEventListener&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(o){("visibilitychange"===o.type&&"hidden"===document.visibilityState||"pagehide"===o.type)&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){this.beaconEventListener&&"window"in f.g&&window.removeEventListener&&"document"in f.g&&document.removeEventListener&&(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var o;this.removeEventListeners(),this.addEventListeners(),null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=new k.default(this.flushIntervalMs),this.intervalScheduler.start(()=>this.sendEvents())}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_=m&&this.filterAttributes(m,this.attributesToFilter),w=Object.assign({name:p,ts:f},_);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(w)}`);let I=this.getSize(w);if(I>InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED)throw Error(`Event Reporting - Item to be added has size ${I} bytes. Item cannot exceed max item size allowed of ${InMemoryJSONEventBuffer.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(p)){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(w)}`),this.sendEventImmediately({name:p,ts:f,attributes:_});return}if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),Error("Buffer full");if(this.currentIngestionEvent.payloads.push(w),this.ingestionEventSize+=I,this.bufferItemThresholdReached(I)){let o=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(o),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}})}filterAttributes(o,p){let f=new Set(p);return Object.keys(o).filter(o=>f.has(o)).forEach(p=>delete o[p]),o}initializeAndGetCurrentIngestionEvent(){let o={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(o),o}bufferItemThresholdReached(o){return o+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===InMemoryJSONEventBuffer.MAX_PAYLOAD_ITEMS}getSize(o){let p=0;if("object"==typeof o)for(let[f,m]of Object.entries(o))p+=this.getPrimitiveSize(f),p+=this.getSize(m);else p+=this.getPrimitiveSize(o);return p}getPrimitiveSize(o){let p=0;return"string"==typeof o?p+=2*o.length:"number"==typeof o&&(p+=8),p}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return 0===this.buffer.length||0===this.bufferSize}getItems(o,p=0){return this.isEmpty()?[]:(o=Math.min(this.buffer.length,o+1),this.buffer.splice(p,o))}makeBeaconRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o,authorization:this.authenticationToken})}makeRequestBody(o){return JSON.stringify({metadata:this.metadata,events:o})}sendEventImmediately(o){return m(this,void 0,void 0,function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(o)}`);let{name:p,ts:f,attributes:m}=o,_={type:this.type,v:this.v,payloads:[Object.assign({name:p,ts:f},m)]},w=!1,I=null,k=this.makeRequestBody([_]);try{if((I=yield this.send(k)).ok){try{let o=yield I.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${k}, message: ${JSON.stringify(o)}`)}catch(o){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${o} for event ${k}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${k} with response status ${I.status}`),w=!0}catch(o){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${k} to the ingestion endpoint ${o}.`),w=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){let o=this.makeBeaconRequestBody([_]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${o}`),w=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,o)}}catch(o){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${k}`),w=!0}}w&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${k}`),this.failedIngestionEvents.push(_))})}send(o){return m(this,void 0,void 0,function*(){let p=new I.default(InMemoryJSONEventBuffer.RETRY_FIXED_BACKOFF_WAIT_MS,InMemoryJSONEventBuffer.RETRY_SHORT_BACKOFF_MS,InMemoryJSONEventBuffer.RETRY_LONG_BACKOFF_MS);try{let f=0;for(;f0){let p=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);o.push(p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(p)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){let p=this.failedIngestionEvents.map(o=>this.deepCopyCurrentIngestionEvent(o));o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(p)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>0&&(this.cancellableEvents.forEach(p=>{o.push(...p),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(p)}`)}),this.cancellableEvents.clear()),0===o.length)return;let p=this.makeBeaconRequestBody(o);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${p}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,p)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${p}`)}catch(o){this.logger.warn(`Event Reporting - Sending beacon data ${p} failed with error ${o}`)}})}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.reset()})}};p.default=O,O.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),O.RETRY_FIXED_BACKOFF_WAIT_MS=0,O.RETRY_SHORT_BACKOFF_MS=1e3,O.RETRY_LONG_BACKOFF_MS=15e3,O.MAX_PAYLOAD_ITEMS=2,O.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},0x75bc23e7:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o=5e3,p=2,f=64,m=100,_=15){this.flushIntervalMs=o,this.flushSize=p,this.maxBufferCapacityKb=f,this.totalBufferItems=m,this.retryCountLimit=_}}},0x1029db6ff:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.audioVideoEventAttributesFromState=void 0,p.audioVideoEventAttributesFromState=function(o){let p={};return null!==o.startTimeMs&&(p.meetingDurationMs=Math.round(Date.now()-o.startTimeMs)),null!==o.signalingOpenDurationMs&&(p.signalingOpenDurationMs=o.signalingOpenDurationMs),null!==o.iceGatheringDurationMs&&(p.iceGatheringDurationMs=o.iceGatheringDurationMs),null!==o.attendeePresenceDurationMs&&(p.attendeePresenceDurationMs=o.attendeePresenceDurationMs),null!==o.meetingStartDurationMs&&(p.meetingStartDurationMs=o.meetingStartDurationMs),void 0!==o.maxVideoTileCount&&(p.maxVideoTileCount=o.maxVideoTileCount),void 0!==o.poorConnectionCount&&(p.poorConnectionCount=o.poorConnectionCount),void 0!==o.retryCount&&(p.retryCount=o.retryCount),p}},0x674df13c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x13f6890b8),I=f(0x1f56347ad),k=_(f(0x1b3a9c949)),M=_(f(0x235df13ff)),x=_(f(0x1e8ca6e4)),O=_(f(0x573f705d)),L=_(f(0xaf1ae5b3)),B=_(f(0x1a5824c20)),U=class DefaultEventController{constructor(o,p,f){var m,_,I,k,M,x,O;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=p,this.configuration=o,this.setupEventReporter(o,p,f);try{this.parserResult=navigator&&navigator.userAgent?new w.UAParser(navigator.userAgent).getResult():null}catch(o){this.logger.error(o.message)}this.browserMajorVersion=(null==(I=null==(_=null==(m=this.parserResult)?void 0:m.browser)?void 0:_.version)?void 0:I.split(".")[0])||DefaultEventController.UNAVAILABLE,this.browserName=(null==(k=this.parserResult)?void 0:k.browser.name)||DefaultEventController.UNAVAILABLE,this.browserVersion=(null==(M=this.parserResult)?void 0:M.browser.version)||DefaultEventController.UNAVAILABLE,this.deviceName=[(null==(x=this.parserResult)?void 0:x.device.vendor)||"",(null==(O=this.parserResult)?void 0:O.device.model)||""].join(" ").trim()||DefaultEventController.UNAVAILABLE}addObserver(o){this.observerSet.add(o)}removeObserver(o){this.observerSet.delete(o)}forEachObserver(o){for(let p of this.observerSet)O.default.nextTick(()=>{this.observerSet.has(p)&&o(p)})}publishEvent(o,p){return m(this,void 0,void 0,function*(){let f=Date.now();this.meetingHistoryStates.push({name:o,timestampMs:f});let m=Object.freeze(Object.assign(this.getAttributes(f),p));this.forEachObserver(p=>{p.eventDidReceive(o,m)}),this.reportEvent(o,f,p)})}reportEvent(o,p,f){var _;return m(this,void 0,void 0,function*(){let m;try{f&&(m=B.default(f)),yield null==(_=this.eventReporter)?void 0:_.reportEvent(p,o,m)}catch(o){this.logger.error(`Error reporting event ${o}`)}})}setupEventReporter(o,p,f){if(f)this._eventReporter=f;else if(o.urls){let f=o.urls.eventIngestionURL;if(f){this.logger.info("Event ingestion URL is present in the configuration");let{meetingId:m,credentials:{attendeeId:_,joinToken:w}}=o,I=new x.default(m,_,w),O=new k.default(I,f);this._eventReporter=new M.default(O,p)}}}getAttributes(o){var p,f;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.configuration.externalMeetingId?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:(null==(p=this.parserResult)?void 0:p.os.name)||DefaultEventController.UNAVAILABLE,osVersion:(null==(f=this.parserResult)?void 0:f.os.version)||DefaultEventController.UNAVAILABLE,sdkVersion:L.default.sdkVersion,sdkName:L.default.sdkName,timestampMs:o}}get eventReporter(){return this._eventReporter}destroy(){return m(this,void 0,void 0,function*(){I.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0})}};p.default=U,U.UNAVAILABLE="Unavailable"},0x1a5824c20:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=o=>{let p={};for(let[f,m]of Object.entries(o))if(null==m||""===m)continue;else if("number"==typeof m||"string"==typeof m)p[f]=m;else throw TypeError("Unhandled type received while flattening attributes.");return p}},0x1b3a9c949:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x75bc23e7));p.default=class{constructor(o,p,f=new _.default){this.eventsClientConfiguration=o,this.ingestionURL=p,this.eventBufferConfiguration=f}}},0x235df13ff:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x1f56347ad),I=_(f(0x27607683));p.default=class{constructor(o,p){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded","deviceLabelTriggerFailed"],this.destroyed=!1;const{eventsClientConfiguration:f,ingestionURL:m,eventBufferConfiguration:_}=o,{eventsToIgnore:w}=f;this.eventBuffer=new I.default(_,f,m,this.importantEvents,p),this.logger=p,this.eventsToIgnore=w,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(o){this.logger.error(`Event Reporting - Error starting the event buffer ${o}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(o){this.logger.error(`Event Reporting - Error stopping the event buffer ${o}`)}}reportEvent(o,p,f){return m(this,void 0,void 0,function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${o}, ${p}, ${JSON.stringify(f)}`),this.eventsToIgnore.includes(p))return void this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${p} event will be ignored as it is in events to ignore`);try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:o,name:p,attributes:f})}catch(o){this.logger.error(`Event Reporting - Error adding event to buffer ${o}`)}})}destroy(){return m(this,void 0,void 0,function*(){this.destroyed=!0,this.stop(),w.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0})}}},0xe23a89c1:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{reportEvent(o,p,f){}start(){}stop(){}}},0x1e8ca6e4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m=[]){this.type="Meet",this.v=1,this.meetingId=o,this.attendeeId=p,this.eventsToIgnore=m,this.authenticationToken=f}getAuthenticationToken(){return this.authenticationToken}toJSON(){let o={};return o.type=this.type,o.v=this.v,o.meetingId=this.meetingId,o.attendeeId=this.attendeeId,o}}},0x12192fed6:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0}),p.DefaultEventController=p.DefaultDevicePixelRatioMonitor=p.DefaultDeviceController=p.DefaultContentShareController=p.DefaultBrowserBehavior=p.DefaultAudioVideoFacade=p.DefaultAudioVideoController=p.DefaultAudioMixController=p.DefaultActiveSpeakerPolicy=p.DefaultActiveSpeakerDetector=p.DataMessage=p.CreateSDPTask=p.CreatePeerConnectionTask=p.ContentShareMediaStreamBroker=p.ContentShareConstants=p.ConsoleLogger=p.ConnectionHealthPolicyConfiguration=p.ConnectionHealthData=p.ClientVideoStreamReceivingReport=p.ClientMetricReportMediaType=p.ClientMetricReportDirection=p.ClientMetricReport=p.CleanStoppedSessionTask=p.CleanRestartedSessionTask=p.CheckVideoInputFeedback=p.CheckVideoConnectivityFeedback=p.CheckNetworkUDPConnectivityFeedback=p.CheckNetworkTCPConnectivityFeedback=p.CheckContentShareConnectivityFeedback=p.CheckCameraResolutionFeedback=p.CheckAudioOutputFeedback=p.CheckAudioInputFeedback=p.CheckAudioConnectivityFeedback=p.CanvasVideoFrameBuffer=p.CSPMonitor=p.BitrateParameters=p.BaseTask=p.BaseConnectionHealthPolicy=p.BackgroundReplacementVideoFrameProcessor=p.BackgroundFilterVideoFrameProcessor=p.BackgroundBlurVideoFrameProcessor=p.BackgroundBlurStrength=p.AudioVideoControllerState=p.AudioProfile=p.AudioLogEvent=p.Attendee=p.AttachMediaInputTask=p.AsyncScheduler=p.ApplicationMetadata=p.AllHighestVideoBandwidthPolicy=void 0,p.MeetingFeatures=p.MeetingEventsClientConfiguration=p.MediaDeviceProxyHandler=p.Maybe=p.LogLevel=p.Log=p.ListenForVolumeIndicatorsTask=p.LeaveAndReceiveLeaveAckTask=p.JoinAndReceiveIndexTask=p.IntervalScheduler=p.InMemoryJSONEventBuffer=p.GlobalMetricReport=p.GetUserMediaError=p.FullJitterLimitedBackoff=p.FullJitterBackoffFactory=p.FullJitterBackoff=p.FinishGatheringICECandidatesTask=p.EventIngestionConfiguration=p.EventBufferConfiguration=p.DeviceSelection=p.DevicePixelRatioWindowSource=p.DefaultWebSocketAdapter=p.DefaultVolumeIndicatorAdapter=p.DefaultVideoTransformDevice=p.DefaultVideoTileFactory=p.DefaultVideoTileController=p.DefaultVideoTile=p.DefaultVideoStreamIndex=p.DefaultVideoStreamIdSet=p.DefaultVideoFrameProcessorTimer=p.DefaultVideoFrameProcessorPipeline=p.DefaultVideoElementResolutionMonitor=p.DefaultVideoCaptureAndEncodeParameter=p.DefaultUserAgentParser=p.DefaultTranscriptionController=p.DefaultTransceiverController=p.DefaultSimulcastUplinkPolicyForContentShare=p.DefaultSimulcastUplinkPolicy=p.DefaultSignalingClient=p.DefaultSigV4=p.DefaultSessionStateController=p.DefaultReconnectController=p.DefaultRealtimeController=p.DefaultPingPong=p.DefaultModality=p.DefaultMessagingSession=p.DefaultMeetingSession=p.DefaultMeetingReadinessChecker=p.DefaultMeetingEventReporter=p.DefaultMediaDeviceFactory=void 0,p.RedundantAudioEncoder=p.ReconnectionHealthPolicy=p.ReceiveVideoStreamIndexTask=p.ReceiveVideoInputTask=p.ReceiveRemoteVideoPauseResumeTask=p.ReceiveAudioInputTask=p.RealtimeVolumeIndicator=p.RealtimeState=p.RealtimeAttendeePositionInFrame=p.PromoteToPrimaryMeetingTask=p.PromiseQueue=p.PrefetchSortBy=p.PrefetchOn=p.PermissionDeniedError=p.ParallelGroupTask=p.POSTLogger=p.OverconstrainedError=p.OpenSignalingConnectionTask=p.OnceTask=p.NotReadableError=p.NotFoundError=p.None=p.NoVideoUplinkBandwidthPolicy=p.NoVideoDownlinkBandwidthPolicy=p.NoOpVideoFrameProcessor=p.NoOpVideoElementFactory=p.NoOpTask=p.NoOpMediaStreamBroker=p.NoOpLogger=p.NoOpEventReporter=p.NoOpDeviceController=p.NoOpDebugLogger=p.NoOpAudioVideoController=p.NScaleVideoUplinkBandwidthPolicy=p.MutableVideoPreferences=p.MultiLogger=p.MonitorTask=p.ModelSpecBuilder=p.MessagingSessionConfiguration=p.Message=p.MeetingSessionVideoAvailability=p.MeetingSessionURLs=p.MeetingSessionTURNCredentials=p.MeetingSessionStatusCode=p.MeetingSessionStatus=p.MeetingSessionLifecycleEventCondition=p.MeetingSessionLifecycleEvent=p.MeetingSessionCredentials=p.MeetingSessionConfiguration=p.MeetingReadinessCheckerConfiguration=void 0,p.VideoEncodingConcurrentSendersHealthPolicy=p.VideoCodecCapability=p.VideoAdaptiveProbePolicy=p.Versioning=p.UnusableAudioWarningConnectionHealthPolicy=p.TypeError=p.TranscriptionStatusType=p.TranscriptionStatus=p.TranscriptResult=p.TranscriptLanguageWithScore=p.TranscriptItemType=p.TranscriptItem=p.TranscriptEntity=p.TranscriptAlternative=p.Transcript=p.TimeoutTask=p.TimeoutScheduler=p.TaskStatus=p.TargetDisplaySize=p.SubscribeAndReceiveSubscribeAckTask=p.StreamMetricReport=p.Some=p.SingleNodeAudioTransformDevice=p.SimulcastVideoStreamIndex=p.SimulcastTransceiverController=p.SimulcastLayers=p.SimulcastContentShareTransceiverController=p.SignalingClientVideoSubscriptionConfiguration=p.SignalingClientSubscribe=p.SignalingClientJoin=p.SignalingClientEventType=p.SignalingClientEvent=p.SignalingClientConnectionRequest=p.SignalingAndMetricsConnectionMonitor=p.SetRemoteDescriptionTask=p.SetLocalDescriptionTask=p.SessionStateControllerTransitionResult=p.SessionStateControllerState=p.SessionStateControllerDeferPriority=p.SessionStateControllerAction=p.ServerSideNetworkAdaption=p.SerialGroupTask=p.SendingAudioFailureConnectionHealthPolicy=p.SendAndReceiveDataMessagesTask=p.SDPMediaSection=p.SDPCandidateType=p.SDP=p.RunnableTask=p.RedundantAudioRecoveryMetricReport=p.RedundantAudioEncoderWorkerCode=void 0,p.isVideoTransformDevice=p.isDestroyable=p.isAudioTransformDevice=p.ZLIBTextCompressor=p.WebSocketReadyState=p.WaitForAttendeePresenceTask=p.VoiceFocusTransformDevice=p.VoiceFocusDeviceTransformer=p.VideoTileState=p.VideoStreamDescription=p.VideoSource=p.VideoQualitySettings=p.VideoQualityAdaptationPreference=p.VideoPriorityBasedPolicyConfig=p.VideoPriorityBasedPolicy=p.VideoPreferences=p.VideoPreference=p.VideoOnlyTransceiverController=p.VideoLogEvent=p.VideoFxProcessor=p.VideoEncodingFramerateConnectionHealthPolicy=p.VideoEncodingCpuConnectionHealthPolicy=p.VideoEncodingConnectionHealthPolicyName=void 0,p.AllHighestVideoBandwidthPolicy=m(f(0x1a174c132)).default,p.ApplicationMetadata=m(f(0x1f0ef6b1d)).default,p.AsyncScheduler=m(f(0x573f705d)).default,p.AttachMediaInputTask=m(f(0xd60c9fd8)).default,p.Attendee=m(f(0xd80a42d3)).default,p.AudioLogEvent=m(f(0x77ea1113)).default,p.AudioProfile=m(f(0x249fc81e5)).default,p.AudioVideoControllerState=m(f(0x1c48b14ba)).default,p.BackgroundBlurStrength=m(f(0x17991f3f2)).default,p.BackgroundBlurVideoFrameProcessor=m(f(0x20e5c1309)).default,p.BackgroundFilterVideoFrameProcessor=m(f(0x6e3c7bbd)).default,p.BackgroundReplacementVideoFrameProcessor=m(f(0x1c4b3e1a7)).default,p.BaseConnectionHealthPolicy=m(f(0xbc5a8cda)).default,p.BaseTask=m(f(0xcef35194)).default,p.BitrateParameters=m(f(0x6e3f6fb5)).default,p.CSPMonitor=m(f(0xd6e2cff)).default,p.CanvasVideoFrameBuffer=m(f(0x9ce0607d)).default,p.CheckAudioConnectivityFeedback=m(f(0x24376ea0b)).default,p.CheckAudioInputFeedback=m(f(0x1413581de)).default,p.CheckAudioOutputFeedback=m(f(0x19a603785)).default,p.CheckCameraResolutionFeedback=m(f(0x1498c149)).default,p.CheckContentShareConnectivityFeedback=m(f(0x9ebd6343)).default,p.CheckNetworkTCPConnectivityFeedback=m(f(0x19b975cfe)).default,p.CheckNetworkUDPConnectivityFeedback=m(f(0x914a193a)).default,p.CheckVideoConnectivityFeedback=m(f(0xe0deb82)).default,p.CheckVideoInputFeedback=m(f(0x101039145)).default,p.CleanRestartedSessionTask=m(f(0x11ee4612e)).default,p.CleanStoppedSessionTask=m(f(0x302be147)).default,p.ClientMetricReport=m(f(0xc9ba5f35)).default,p.ClientMetricReportDirection=m(f(0x138ccc65a)).default,p.ClientMetricReportMediaType=m(f(0x2fbf3af)).default,p.ClientVideoStreamReceivingReport=m(f(0x1979c5b3a)).default,p.ConnectionHealthData=m(f(0x73406699)).default,p.ConnectionHealthPolicyConfiguration=m(f(0x1a55f11d7)).default,p.ConsoleLogger=m(f(0xb3c65cf4)).default,p.ContentShareConstants=m(f(0x104cf28d8)).default,p.ContentShareMediaStreamBroker=m(f(0x11817b564)).default,p.CreatePeerConnectionTask=m(f(0x1cd1bb811)).default,p.CreateSDPTask=m(f(0xad28f8b8)).default,p.DataMessage=m(f(0x239b30f5)).default,p.DefaultActiveSpeakerDetector=m(f(0x173eb4b02)).default,p.DefaultActiveSpeakerPolicy=m(f(0x13c61502e)).default,p.DefaultAudioMixController=m(f(0x5cbe4bac)).default,p.DefaultAudioVideoController=m(f(0x10a965f7c)).default,p.DefaultAudioVideoFacade=m(f(0x12f2a530c)).default,p.DefaultBrowserBehavior=m(f(0x165009cb4)).default,p.DefaultContentShareController=m(f(0xd371be18)).default,p.DefaultDeviceController=m(f(0xba48c8f4)).default,p.DefaultDevicePixelRatioMonitor=m(f(0x16ee58416)).default,p.DefaultEventController=m(f(0x674df13c)).default,p.DefaultMediaDeviceFactory=m(f(0x2321cdcd0)).default,p.DefaultMeetingEventReporter=m(f(0x235df13ff)).default,p.DefaultMeetingReadinessChecker=m(f(0x149c6311c)).default,p.DefaultMeetingSession=m(f(0x25170ce4c)).default,p.DefaultMessagingSession=m(f(0x1b035f840)).default,p.DefaultModality=m(f(0x1a154f9b0)).default,p.DefaultPingPong=m(f(0x504c9394)).default,p.DefaultRealtimeController=m(f(0x102abe35c)).default,p.DefaultReconnectController=m(f(0x1b1a7866)).default,p.DefaultSessionStateController=m(f(0x1c843e818)).default,p.DefaultSigV4=m(f(0x1303d0742)).default,p.DefaultSignalingClient=m(f(0x24718f0be)).default,p.DefaultSimulcastUplinkPolicy=m(f(0x16364c8d1)).default,p.DefaultSimulcastUplinkPolicyForContentShare=m(f(0x111b8e0a0)).default,p.DefaultTransceiverController=m(f(0x93a0ab1c)).default,p.DefaultTranscriptionController=m(f(0x81e9befe)).default,p.DefaultUserAgentParser=m(f(0x6cbaf532)).default,p.DefaultVideoCaptureAndEncodeParameter=m(f(0xb40abe4c)).default,p.DefaultVideoElementResolutionMonitor=m(f(0xf6f7535a)).default,p.DefaultVideoFrameProcessorPipeline=m(f(0x1217e92b2)).default,p.DefaultVideoFrameProcessorTimer=m(f(0x1a23785fd)).default,p.DefaultVideoStreamIdSet=m(f(0xc30676e4)).default,p.DefaultVideoStreamIndex=m(f(0x243b05980)).default,p.DefaultVideoTile=m(f(0x4c923b82)).default,p.DefaultVideoTileController=m(f(0x198994116)).default,p.DefaultVideoTileFactory=m(f(0x168367eac)).default,p.DefaultVideoTransformDevice=m(f(0x18c01a5bb)).default,p.DefaultVolumeIndicatorAdapter=m(f(0x194492f4c)).default,p.DefaultWebSocketAdapter=m(f(0x5cfde354)).default,p.DevicePixelRatioWindowSource=m(f(0xc4db2fcf)).default,p.DeviceSelection=m(f(0x12584ea7b)).default,p.EventBufferConfiguration=m(f(0x75bc23e7)).default,p.EventIngestionConfiguration=m(f(0x1b3a9c949)).default,p.FinishGatheringICECandidatesTask=m(f(0x25372cf50)).default,p.FullJitterBackoff=m(f(6329639e3)).default,p.FullJitterBackoffFactory=m(f(0x1026e31ba)).default,p.FullJitterLimitedBackoff=m(f(0x415bfbb2)).default,p.GetUserMediaError=m(f(0x1f53ed78a)).default,p.GlobalMetricReport=m(f(0x22562ac09)).default,p.InMemoryJSONEventBuffer=m(f(0x27607683)).default,p.IntervalScheduler=m(f(0x7b80cc62)).default,p.JoinAndReceiveIndexTask=m(f(0x1c594fec7)).default,p.LeaveAndReceiveLeaveAckTask=m(f(0x20543e8f4)).default,p.ListenForVolumeIndicatorsTask=m(f(0x138bc4923)).default,p.Log=m(f(0x191ba1823)).default,p.LogLevel=m(f(0x1e476648b)).default,p.MediaDeviceProxyHandler=m(f(0x183adc8bf)).default,p.MeetingEventsClientConfiguration=m(f(0x1e8ca6e4)).default,p.MeetingFeatures=m(f(0x899d3924)).default,p.MeetingReadinessCheckerConfiguration=m(f(0xa82cad81)).default,p.MeetingSessionConfiguration=m(f(0x13b48f1ad)).default,p.MeetingSessionCredentials=m(f(0x16342f6ad)).default,p.MeetingSessionLifecycleEvent=m(f(0x1cf28fcb9)).default,p.MeetingSessionLifecycleEventCondition=m(f(0x1210847be)).default,p.MeetingSessionStatus=m(f(0xb28de657)).default,p.MeetingSessionStatusCode=m(f(0x234745d42)).default,p.MeetingSessionTURNCredentials=m(f(0x1736cf0a4)).default,p.MeetingSessionURLs=m(f(0xd5022a77)).default,p.MeetingSessionVideoAvailability=m(f(0x17310e8bb)).default,p.Message=m(f(0x143e5a9e5)).default,p.MessagingSessionConfiguration=m(f(0x51d90877)).default,p.ModelSpecBuilder=m(f(0xfc893d67)).default,p.MonitorTask=m(f(0x1f0d2ad73)).default,p.MultiLogger=m(f(0x2a7fe8bc)).default,p.NScaleVideoUplinkBandwidthPolicy=m(f(0xb231bce1)).default,p.NoOpAudioVideoController=m(f(0x233121a41)).default,p.NoOpDebugLogger=m(f(0x23cb0924a)).default,p.NoOpDeviceController=m(f(0x19e6a0f9b)).default,p.NoOpEventReporter=m(f(0xe23a89c1)).default,p.NoOpLogger=m(f(0x53f60ff7)).default,p.NoOpMediaStreamBroker=m(f(0x41c6ff55)).default,p.NoOpTask=m(f(0xb013a83d)).default,p.NoOpVideoElementFactory=m(f(0x62a0374d)).default,p.NoOpVideoFrameProcessor=m(f(0x23b2002bd)).default,p.NoVideoDownlinkBandwidthPolicy=m(f(0x1f64282a8)).default,p.NoVideoUplinkBandwidthPolicy=m(f(0x1a94aa22a)).default,p.NotFoundError=m(f(0x1db5bc494)).default,p.NotReadableError=m(f(0x1b486d07c)).default,p.OnceTask=m(f(0xba0e3d5c)).default,p.OpenSignalingConnectionTask=m(f(0x1f9377021)).default,p.OverconstrainedError=m(f(0xa4c520e9)).default,p.POSTLogger=m(f(0x1693bacd9)).default,p.ParallelGroupTask=m(f(0x1c97ddc23)).default,p.PermissionDeniedError=m(f(0xfb8fdb39)).default,p.PrefetchOn=m(f(0x22cfd1a2d)).default,p.PrefetchSortBy=m(f(0x1c2a9938d)).default,p.PromiseQueue=m(f(0x8f5563d8)).default,p.PromoteToPrimaryMeetingTask=m(f(0x1f71fad3b)).default,p.RealtimeAttendeePositionInFrame=m(f(0x151a585f0)).default,p.RealtimeState=m(f(0x485efac6)).default,p.RealtimeVolumeIndicator=m(f(0xf6b5b898)).default,p.ReceiveAudioInputTask=m(f(0x2429ed05e)).default,p.ReceiveRemoteVideoPauseResumeTask=m(f(0x18781162e)).default,p.ReceiveVideoInputTask=m(f(0x130a7607d)).default,p.ReceiveVideoStreamIndexTask=m(f(0x151ad6ab5)).default,p.ReconnectionHealthPolicy=m(f(0x938e8e62)).default,p.RedundantAudioEncoder=m(f(0x1a763535d)).default,p.RedundantAudioEncoderWorkerCode=m(f(0x11e4e5f0d)).default,p.RedundantAudioRecoveryMetricReport=m(f(0x250d201d4)).default,p.RunnableTask=m(f(0x4d761108)).default,p.SDP=m(f(0x1fa7d4829)).default,p.SDPCandidateType=m(f(0x19cb5e2ee)).default,p.SDPMediaSection=m(f(0xe8571b46)).default,p.SendAndReceiveDataMessagesTask=m(f(0x222af4e39)).default,p.SendingAudioFailureConnectionHealthPolicy=m(f(0x19f6220b7)).default,p.SerialGroupTask=m(f(0xc70eec36)).default,p.ServerSideNetworkAdaption=m(f(0x1e93e1412)).default,p.SessionStateControllerAction=m(f(0x195905627)).default,p.SessionStateControllerDeferPriority=m(f(0xb577390f)).default,p.SessionStateControllerState=m(f(0xd03588a6)).default,p.SessionStateControllerTransitionResult=m(f(0x14f60ed93)).default,p.SetLocalDescriptionTask=m(f(0x1fc5185a)).default,p.SetRemoteDescriptionTask=m(f(0x15fdb9011)).default,p.SignalingAndMetricsConnectionMonitor=m(f(0x7cabad69)).default,p.SignalingClientConnectionRequest=m(f(0xe105a372)).default,p.SignalingClientEvent=m(f(0x872e39a3)).default,p.SignalingClientEventType=m(f(0x16bec8feb)).default,p.SignalingClientJoin=m(f(0x22a5b38fd)).default,p.SignalingClientSubscribe=m(f(0x5fcce137)).default,p.SignalingClientVideoSubscriptionConfiguration=m(f(0xcb99c5a5)).default,p.SimulcastContentShareTransceiverController=m(f(0xdeeb6fe4)).default,p.SimulcastLayers=m(f(0x14216d675)).default,p.SimulcastTransceiverController=m(f(0x2293b1f8c)).default,p.SimulcastVideoStreamIndex=m(f(0x217dc1bb8)).default,p.SingleNodeAudioTransformDevice=m(f(0x215250f11)).default,p.StreamMetricReport=m(f(0x2e51c102)).default,p.SubscribeAndReceiveSubscribeAckTask=m(f(0x21d574c92)).default,p.TargetDisplaySize=m(f(0x555510c7)).default,p.TaskStatus=m(f(0x372fc7cb)).default,p.TimeoutScheduler=m(f(0x6ee73800)).default,p.TimeoutTask=m(f(0x1174c5f22)).default,p.Transcript=m(f(0x1121523e7)).default,p.TranscriptAlternative=m(f(0x424746be)).default,p.TranscriptEntity=m(f(0x42b6168)).default,p.TranscriptItem=m(f(0x42104fac)).default,p.TranscriptItemType=m(f(0x232d483ec)).default,p.TranscriptLanguageWithScore=m(f(0x10098a09)).default,p.TranscriptResult=m(f(0x1dc662042)).default,p.TranscriptionStatus=m(f(0x7ae7be1)).default,p.TranscriptionStatusType=m(f(0xb7217889)).default,p.TypeError=m(f(0x1055aac05)).default,p.UnusableAudioWarningConnectionHealthPolicy=m(f(0x1461f4056)).default,p.Versioning=m(f(0xaf1ae5b3)).default,p.VideoAdaptiveProbePolicy=m(f(0x15ad5180a)).default,p.VideoCodecCapability=m(f(0x17e3191d)).default,p.VideoEncodingConcurrentSendersHealthPolicy=m(f(0x109562310)).default,p.VideoEncodingConnectionHealthPolicyName=m(f(0x1cdcbf76c)).default,p.VideoEncodingCpuConnectionHealthPolicy=m(f(0x1bdf2cac3)).default,p.VideoEncodingFramerateConnectionHealthPolicy=m(f(0x225dfdbba)).default,p.VideoFxProcessor=m(f(0xfbd337fb)).default,p.VideoLogEvent=m(f(0x154fd3c86)).default,p.VideoOnlyTransceiverController=m(f(0x24fd8c738)).default,p.VideoPreference=m(f(0x78621d61)).default,p.VideoPreferences=m(f(0xfa5b698a)).default,p.VideoPriorityBasedPolicy=m(f(0x1341fb415)).default,p.VideoPriorityBasedPolicyConfig=m(f(0x74de7c3b)).default,p.VideoQualityAdaptationPreference=m(f(0x3350552d)).default,p.VideoQualitySettings=m(f(0x3b3f192c)).default,p.VideoSource=m(f(0x15db02d39)).default,p.VideoStreamDescription=m(f(0x2187d54cb)).default,p.VideoTileState=m(f(0x131f83592)).default,p.VoiceFocusDeviceTransformer=m(f(0x21f91d24)).default,p.VoiceFocusTransformDevice=m(f(0xd91ec153)).default,p.WaitForAttendeePresenceTask=m(f(0x24564ad46)).default,p.WebSocketReadyState=m(f(0x165cc79a4)).default,p.ZLIBTextCompressor=m(f(0xb97f5b8b)).default;let _=f(0xfa5b698a);Object.defineProperty(p,"MutableVideoPreferences",{enumerable:!0,get:function(){return _.MutableVideoPreferences}});let w=f(0xb529932d);Object.defineProperty(p,"Some",{enumerable:!0,get:function(){return w.Some}}),Object.defineProperty(p,"None",{enumerable:!0,get:function(){return w.None}}),Object.defineProperty(p,"Maybe",{enumerable:!0,get:function(){return w.Maybe}});let I=f(0x97143bf9);Object.defineProperty(p,"isAudioTransformDevice",{enumerable:!0,get:function(){return I.isAudioTransformDevice}});let k=f(0x1f56347ad);Object.defineProperty(p,"isDestroyable",{enumerable:!0,get:function(){return k.isDestroyable}});let M=f(0x20a4e5a2e);Object.defineProperty(p,"isVideoTransformDevice",{enumerable:!0,get:function(){return M.isVideoTransformDevice}})},0xb3c65cf4:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(o,p=_.default.WARN){this.name=o,this.level=p}info(o){this.log(_.default.INFO,o)}warn(o){this.log(_.default.WARN,o)}error(o){this.log(_.default.ERROR,o)}debug(o){_.default.DEBUG{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f,m){this.sequenceNumber=o,this.message=p,this.timestampMs=f,this.logLevel=m}}},0x1e476648b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.LogLevel=void 0,(m=f=p.LogLevel||(p.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR",m[m.OFF=4]="OFF",p.default=f},0x2a7fe8bc:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(...o){this._loggers=o}info(o){for(let p of this._loggers)p.info(o)}warn(o){for(let p of this._loggers)p.warn(o)}error(o){for(let p of this._loggers)p.error(o)}debug(o){let p,f;for(let m of(f="string"==typeof o?o:o?()=>(p||(p=o()),p):""+o,this._loggers))m.debug(f)}setLogLevel(o){for(let p of this._loggers)p.setLogLevel(o)}getLogLevel(){for(let o of this._loggers)return o.getLogLevel();return _.default.OFF}}},0x23cb0924a:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b)),w=m(f(0x53f60ff7));p.default=class extends w.default{constructor(){super(_.default.DEBUG)}}},0x53f60ff7:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1e476648b));p.default=class{constructor(o=_.default.OFF){this.level=o}info(o){}warn(o){}error(o){}debug(o){_.default.DEBUG{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in f.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in f.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(o){k.default.DEBUGm(this,void 0,void 0,function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;let o=this.logCapture.slice(0,this.batchSize),p=this.makeRequestBody(o);try{let f=yield fetch(this.url,Object.assign({method:"POST",body:p},this.headers?{headers:this.headers}:{}));200===f.status&&(this.logCapture=this.logCapture.slice(o.length))}catch(o){console.warn("[POSTLogger] "+o.message)}finally{this.lock=!1}}))}stop(){var o;null==(o=this.intervalScheduler)||o.stop(),this.intervalScheduler=void 0,this.removeEventListener();let p=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,p)}destroy(){return m(this,void 0,void 0,function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0})}makeRequestBody(o){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:o}))}log(o,p){if(otypeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new _.default);throw Error("navigator.mediaDevices is not supported")}}},0x183adc8bf:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x573f705d)),I=_(f(0x7b80cc62)),k=class MediaDeviceProxyHandler{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(o,p,f)=>{if(!Reflect.has(o,p))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===p)return this.patchAddEventListener(o,p,f);else if("removeEventListener"===p)return this.patchRemoveEventListener(o,p,f)}let m=Reflect.get(o,p,f);return"function"==typeof m?m.bind(o):m},this.patchAddEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.add(f),this.scheduler||(this.scheduler=new I.default(MediaDeviceProxyHandler.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(o,p,f)=>{let m=Reflect.get(o,p,f);return(p,f,_)=>{if("devicechange"!==p)return Reflect.apply(m,o,[p,f,_]);this.deviceChangeListeners.delete(f),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>m(this,void 0,void 0,function*(){let o=yield this.sortedDeviceList();this.devices&&(o.length!==this.devices.length||o.some((o,p)=>o.deviceId!==this.devices[p].deviceId))&&this.handleDeviceChangeEvent(),this.devices=o})}sortedDeviceList(){return m(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort((o,p)=>o.deviceIdp.deviceId?-1:0)})}handleDeviceChangeEvent(){for(let o of this.deviceChangeListeners)w.default.nextTick(()=>{if(this.deviceChangeListeners.has(o)){let p=new Event("devicechange");"function"==typeof o?o(p):o.handleEvent(p)}})}};p.default=k,k.INTERVAL_MS=1e3},0x41c6ff55:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(o){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(o){}removeMediaStreamBrokerObserver(o){}}},0x24376ea0b:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioConnectivityFeedback=void 0,(m=f=p.CheckAudioConnectivityFeedback||(p.CheckAudioConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.AudioInputRequestFailed=1]="AudioInputRequestFailed",m[m.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.AudioNotReceived=4]="AudioNotReceived",p.default=f},0x1413581de:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioInputFeedback=void 0,(m=f=p.CheckAudioInputFeedback||(p.CheckAudioInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0x19a603785:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckAudioOutputFeedback=void 0,(m=f=p.CheckAudioOutputFeedback||(p.CheckAudioOutputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",p.default=f},0x1498c149:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckCameraResolutionFeedback=void 0,(m=f=p.CheckCameraResolutionFeedback||(p.CheckCameraResolutionFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.ResolutionNotSupported=2]="ResolutionNotSupported",m[m.PermissionDenied=3]="PermissionDenied",p.default=f},0x9ebd6343:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckContentShareConnectivityFeedback=void 0,(m=f=p.CheckContentShareConnectivityFeedback||(p.CheckContentShareConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",m[m.TimedOut=3]="TimedOut",m[m.ConnectionFailed=4]="ConnectionFailed",p.default=f},0x19b975cfe:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkTCPConnectivityFeedback=void 0,(m=f=p.CheckNetworkTCPConnectivityFeedback||(p.CheckNetworkTCPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0x914a193a:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckNetworkUDPConnectivityFeedback=void 0,(m=f=p.CheckNetworkUDPConnectivityFeedback||(p.CheckNetworkUDPConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",m[m.ConnectionFailed=2]="ConnectionFailed",m[m.ICENegotiationFailed=3]="ICENegotiationFailed",p.default=f},0xe0deb82:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoConnectivityFeedback=void 0,(m=f=p.CheckVideoConnectivityFeedback||(p.CheckVideoConnectivityFeedback={}))[m.Succeeded=0]="Succeeded",m[m.VideoInputRequestFailed=1]="VideoInputRequestFailed",m[m.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",m[m.ConnectionFailed=3]="ConnectionFailed",m[m.VideoNotSent=4]="VideoNotSent",p.default=f},0x101039145:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.CheckVideoInputFeedback=void 0,(m=f=p.CheckVideoInputFeedback||(p.CheckVideoInputFeedback={}))[m.Succeeded=0]="Succeeded",m[m.Failed=1]="Failed",m[m.PermissionDenied=2]="PermissionDenied",p.default=f},0x149c6311c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x5cbe4bac)),I=_(f(0x165009cb4)),k=_(f(0xba48c8f4)),M=_(f(0xfb8fdb39)),x=_(f(0xcef35194)),O=_(f(0x1174c5f22)),L=_(f(0x24376ea0b)),B=_(f(0x1413581de)),U=_(f(0x19a603785)),$=_(f(0x1498c149)),q=_(f(0x9ebd6343)),Z=_(f(0x19b975cfe)),ee=_(f(0x914a193a)),et=_(f(0xe0deb82)),ei=_(f(0x101039145)),er=_(f(0xa82cad81));p.default=class DefaultMeetingReadinessChecker{constructor(o,p,f=new er.default){this.logger=o,this.meetingSession=p,this.configuration=f,this.browserBehavior=new I.default}static delay(o){return m(this,void 0,void 0,function*(){return new Promise(p=>setTimeout(p,o))})}checkAudioInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(o),yield this.meetingSession.audioVideo.stopAudioInput(),B.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${o}`),o instanceof M.default)return B.default.PermissionDenied;return B.default.Failed}})}checkAudioOutput(o,p,f=null){return m(this,void 0,void 0,function*(){try{let m=o?k.default.getIntrinsicDeviceId(o):"";if(yield this.playTone(m,this.configuration.audioOutputFrequency,f),yield p())return U.default.Succeeded;return U.default.Failed}catch(o){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${o}`),U.default.Failed}finally{yield this.stopTone()}})}playTone(o,p,f){return m(this,void 0,void 0,function*(){let m=this.configuration.audioOutputGain;this.oscillatorNode&&(yield this.stopTone()),this.audioContext=k.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=p,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);let _=this.audioContext.currentTime+.1;this.gainNode.gain.setValueAtTime(0,_),this.gainNode.gain.linearRampToValueAtTime(m,_+.1),this.oscillatorNode.start();let I=new w.default(this.logger),M=f||new Audio,x=this.destinationStream.stream;this.audioElement=M;try{this.browserBehavior.supportsSetSinkId()&&(yield I.bindAudioDevice({deviceId:o}))}catch(o){this.logger.error(`Failed to bind audio device: ${o}`)}try{yield I.bindAudioElement(M)}catch(o){this.logger.error(`Failed to bind audio element: ${o}`)}yield I.bindAudioStream(x)})}stopTone(){return m(this,void 0,void 0,function*(){if(!this.audioContext||!this.gainNode||!this.oscillatorNode||!this.destinationStream)return;let cleanup=()=>{this.audioElement&&(this.audioElement.pause(),this.audioElement.srcObject=null),this.oscillatorNode&&this.gainNode&&this.oscillatorNode.disconnect(this.gainNode),this.gainNode&&this.destinationStream&&this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null,this.audioElement=null},o=new Promise(o=>{this.oscillatorNode.addEventListener("ended",()=>{cleanup(),o()},{once:!0})}),p=this.configuration.audioOutputGain,f=this.audioContext.currentTime;this.gainNode.gain.setValueAtTime(p,f),this.gainNode.gain.linearRampToValueAtTime(0,f+.1),this.oscillatorNode.stop(f+.1+.1),yield o})}checkVideoInput(o){return m(this,void 0,void 0,function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(o),yield this.meetingSession.audioVideo.stopVideoInput(),ei.default.Succeeded}catch(o){if(this.logger.error(`MeetingReadinessChecker: Video check failed with error ${o}`),o instanceof M.default)return ei.default.PermissionDenied;return ei.default.Failed}})}checkCameraResolution(o,p,f){return m(this,void 0,void 0,function*(){let m;try{let _=k.default.getIntrinsicDeviceId(o),w={video:this.calculateVideoConstraint(_,p,f)};m=yield navigator.mediaDevices.getUserMedia(w)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${p} height ${f} failed with error ${o}`),o&&"OverconstrainedError"===o.name)return $.default.ResolutionNotSupported;if(o&&"NotAllowedError"===o.name)return $.default.PermissionDenied;return $.default.Failed}finally{m&&m.getTracks().forEach(function(o){o.stop()})}return $.default.Succeeded})}calculateVideoConstraint(o,p,f){let m=this.browserBehavior.requiresResolutionAlignment(p,f),_={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(_.deviceId=o,_.width=p,_.height=f):(_.deviceId={exact:o},_.width={exact:m[0]},_.height={exact:m[1]}),_}checkContentShareConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f=!1,_={contentShareDidStart:()=>{p=!0}},w={audioVideoDidStart:()=>{f=!0}};try{if(this.meetingSession.audioVideo.addObserver(w),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(_),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(o),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f&&p})),!f)return q.default.ConnectionFailed;return yield this.stopMeeting(),p?q.default.Succeeded:q.default.TimedOut}catch(o){if(this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${o}`),"NotAllowedError"===o.name)return q.default.PermissionDenied;return q.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(w),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(_)}})}checkAudioConnectivity(o){return m(this,void 0,void 0,function*(){let p=!1,f={packetsReceived:0},_=this.meetingSession.audioVideo,w={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"inbound-rtp"===o.type&&("audio"===o.mediaType||"audio"===o.kind)&&(f.packetsReceived=o.packetsReceived)})}},attendeePresenceHandler=(o,f,m,_)=>{o===this.meetingSession.configuration.credentials.attendeeId&&f&&(p=!0)};try{yield _.startAudioInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${o}`),o instanceof M.default)return L.default.AudioInputPermissionDenied;return L.default.AudioInputRequestFailed}return(_.realtimeSubscribeToAttendeeIdPresence(attendeePresenceHandler),_.addObserver(w),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return this.isAudioConnectionSuccessful(p,f)})),_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),this.isAudioConnectionSuccessful(p,f)?L.default.Succeeded:L.default.AudioNotReceived):(_.removeObserver(w),_.realtimeUnsubscribeToAttendeeIdPresence(attendeePresenceHandler),yield this.meetingSession.audioVideo.stopAudioInput(),L.default.ConnectionFailed)})}checkVideoConnectivity(o){return m(this,void 0,void 0,function*(){let p=this.meetingSession.audioVideo,f=0,_={metricsDidReceive(o){o.getRTCStatsReport().forEach(o=>{"outbound-rtp"===o.type&&("video"===o.mediaType||"video"===o.kind)&&(f=o.packetsSent)})}};try{yield p.startVideoInput(o)}catch(o){if(this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${o}`),o instanceof M.default)return et.default.VideoInputPermissionDenied;return et.default.VideoInputRequestFailed}return(p.addObserver(_),yield this.startMeeting())?(p.startLocalVideoTile(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return f>0})),yield p.stopVideoInput(),yield this.stopMeeting(),p.removeObserver(_),f<=0)?et.default.VideoNotSent:et.default.Succeeded:et.default.ConnectionFailed})}checkNetworkUDPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),ee.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=tcp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?ee.default.Succeeded:ee.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,ee.default.ConnectionFailed)})}checkNetworkTCPConnectivity(){return m(this,void 0,void 0,function*(){let o=!1,p={metricsDidReceive(p){p.getRTCStatsReport().forEach(p=>{"candidate-pair"===p.type&&"succeeded"===p.state&&(o=!0)})}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(o){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${o}`),Z.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=o=>{let p=this.originalURLRewriter(o);return p.includes("transport=udp")?"":p};let f=this.meetingSession.audioVideo;return(f.addObserver(p),yield this.startMeeting())?(yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),f.removeObserver(p),o)?Z.default.Succeeded:Z.default.ICENegotiationFailed:(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,Z.default.ConnectionFailed)})}startMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStart:()=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}stopMeeting(){return m(this,void 0,void 0,function*(){let o=!1,p={audioVideoDidStop:p=>{o=!0}};return this.meetingSession.audioVideo.addObserver(p),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask(()=>m(this,void 0,void 0,function*(){return o})),this.meetingSession.audioVideo.removeObserver(p),o})}executeTimeoutTask(o){return m(this,void 0,void 0,function*(){let p=!1,f=class extends x.default{constructor(o,p){super(o),this.waitDurationMs=p,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return m(this,void 0,void 0,function*(){for(;!this.isCancelled;){if(yield o()){p=!0;break}yield DefaultMeetingReadinessChecker.delay(this.waitDurationMs)}})}},_=new O.default(this.logger,new f(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield _.run(),p})}isAudioConnectionSuccessful(o,p){return o&&p.packetsReceived>0}}},0xa82cad81:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}}},0x25170ce4c:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=_(f(0x10a965f7c)),I=_(f(0x12f2a530c)),k=_(f(6329639e3)),M=_(f(0x165009cb4)),x=_(f(0x11817b564)),O=_(f(0xd371be18)),L=_(f(0xd6e2cff)),B=f(0x1f56347ad),U=_(f(0x674df13c)),$=_(f(0x1b1a7866)),q=_(f(0x5cfde354));p.default=class{constructor(o,p,f,m){this._eventController=m,this._configuration=o,this._logger=p,this.checkBrowserSupportAndFeatureConfiguration(),L.default.addLogger(this._logger),L.default.register(),this._eventController||(this._eventController=new U.default(o,p)),f.eventController||(f.eventController=this.eventController),this.audioVideoController=new w.default(this._configuration,this._logger,new q.default(this._logger),f,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=f,this.logger.info(`MeetingFeatures: ${JSON.stringify(o.meetingFeatures)}`);const _=new x.default(this._logger);this.contentShareController=new O.default(_,new w.default(O.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new q.default(this._logger),_,new $.default(this._configuration.reconnectTimeoutMs,new k.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new I.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return m(this,void 0,void 0,function*(){B.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),B.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),B.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),L.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0})}checkBrowserSupportAndFeatureConfiguration(){let o=new M.default,p=`${o.name()} ${o.majorVersion()} (${o.version()})`;if(this.logger.info(`browser is ${p}`),o.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${o.supportString()}.`),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!o.hasChromiumWebRTC())throw Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(o.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${o.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")),this._configuration.enableSVC&&(this._configuration.enableSVC=!1,this.logger.info("SVC is not successfully enabled since simulcast is enabled"))),this._configuration.enableSVC&&!o.supportsScalableVideoCoding()&&(this._configuration.enableSVC=!1,this.logger.info("SVC is only supported on Chromium-based browsers with version 111 or above"))}isSimulcastUplinkPolicy(o){return!!(o&&o.addObserver)}}},0x899d3924:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x3b3f192c));p.default=class MeetingFeatures{constructor(o=_.default.VideoResolutionHD,p=_.default.VideoResolutionFHD){this.videoMaxResolution=o,this.contentMaxResolution=p}clone(){return new MeetingFeatures(this.videoMaxResolution,this.contentMaxResolution)}}},0x13b48f1ad:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x1a55f11d7)),w=m(f(0x3b3f192c)),I=f(0x149d24991),k=m(f(0x899d3924)),M=m(f(0x16342f6ad)),x=m(f(0xd5022a77));p.default=class{constructor(o,p){var f,m;if(this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new _.default,this.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.enableSVC=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,this.disablePeriodicKeyframeRequestOnContentSender=!1,this.meetingFeatures=new k.default,o){(o=I.toLowerCasePropertyNames(o)).meeting&&(o=o.meeting),this.meetingId=o.meetingid,this.externalMeetingId=o.externalmeetingid,this.urls=new x.default,this.urls.audioHostURL=o.mediaplacement.audiohosturl,this.urls.signalingURL=o.mediaplacement.signalingurl,this.urls.turnControlURL=o.mediaplacement.turncontrolurl,o.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=o.mediaplacement.eventingestionurl);const parseVideoResolution=(o,p)=>{switch(o){case"None":return w.default.VideoDisabled;case"HD":return w.default.VideoResolutionHD;case"FHD":return w.default.VideoResolutionFHD;case"UHD":return w.default.VideoResolutionUHD;default:return p}};if((null==(f=o.meetingfeatures)?void 0:f.video)!==void 0||(null==(m=o.meetingfeatures)?void 0:m.content)!==void 0){const p=void 0===o.meetingfeatures.video?"HD":o.meetingfeatures.video.maxresolution,f=void 0===o.meetingfeatures.content?"FHD":o.meetingfeatures.content.maxresolution;this.meetingFeatures=new k.default(parseVideoResolution(p,w.default.VideoResolutionHD),parseVideoResolution(f,w.default.VideoResolutionFHD))}}p&&((p=I.toLowerCasePropertyNames(p)).attendee&&(p=p.attendee),this.credentials=new M.default,this.credentials.attendeeId=p.attendeeid,this.credentials.externalUserId=p.externaluserid,this.credentials.joinToken=p.jointoken)}}},0x16342f6ad:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:""}}}},0x1cf28fcb9:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEvent=void 0,(m=f=p.MeetingSessionLifecycleEvent||(p.MeetingSessionLifecycleEvent={}))[m.Connecting=0]="Connecting",m[m.Started=1]="Started",m[m.Stopped=2]="Stopped",p.default=f},0x1210847be:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionLifecycleEventCondition=void 0,(m=f=p.MeetingSessionLifecycleEventCondition||(p.MeetingSessionLifecycleEventCondition={}))[m.ConnectingNew=0]="ConnectingNew",m[m.ReconnectingExisting=1]="ReconnectingExisting",m[m.StartedNew=2]="StartedNew",m[m.StartedExisting=3]="StartedExisting",m[m.StartedAfterReconnect=4]="StartedAfterReconnect",m[m.StoppedCleanly=5]="StoppedCleanly",m[m.StoppedWithFailure=6]="StoppedWithFailure",p.default=f},0xb28de657:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=f(0xe88b24d9),w=m(f(0x234745d42));p.default=class MeetingSessionStatus{constructor(o){this._statusCode=o}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:case w.default.VideoCallAtSourceCapacity:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.ICEGatheringTimeoutWorkaround:case w.default.ConnectionHealthReconnect:case w.default.RealtimeApiFailed:case w.default.TaskFailed:case w.default.NoAttendeePresent:case w.default.SignalingChannelClosedUnexpectedly:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case w.default.Left:case w.default.AudioJoinedFromAnotherDevice:case w.default.AudioAuthenticationRejected:case w.default.AudioCallAtCapacity:case w.default.MeetingEnded:case w.default.AudioDisconnected:case w.default.TURNCredentialsForbidden:case w.default.SignalingBadRequest:case w.default.SignalingRequestFailed:case w.default.VideoCallAtSourceCapacity:case w.default.RealtimeApiFailed:case w.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case w.default.AudioAuthenticationRejected:case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.ICEGatheringTimeoutWorkaround:case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:case w.default.RealtimeApiFailed:case w.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case w.default.OK:return"Everything is OK so far.";case w.default.Left:return"The attendee left the meeting.";case w.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case w.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case w.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case w.default.MeetingEnded:return"The meeting ended.";case w.default.AudioInternalServerError:case w.default.AudioServiceUnavailable:case w.default.AudioDisconnected:return"The audio connection failed.";case w.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case w.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case w.default.SignalingBadRequest:case w.default.SignalingInternalServerError:case w.default.SignalingRequestFailed:return"The signaling connection failed.";case w.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case w.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case w.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case w.default.TaskFailed:return"The connection failed. See the error message for more details.";case w.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case w.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case w.default.NoAttendeePresent:return"The attendee was not present.";case w.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case w.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case w.default.AudioVideoDisconnectedWhilePromoted:return"The client disconnected while promoted, which will automatically demote. The attendee must promote again to participate.";case w.default.AudioDisconnectAudio:return"The audio connection failed.";case w.default.SignalingChannelClosedUnexpectedly:return"The signaling channel was closed unexpectedly. This may be due to a network change or backend detected failure.";default:{let o=this._statusCode;throw Error(`Unhandled case: ${o}`)}}}static fromSignalFrame(o){return o.error&&o.error.status?this.fromSignalingStatus(o.error.status):o.type===_.SdkSignalFrame.Type.AUDIO_STATUS?o.audioStatus?this.fromAudioStatus(o.audioStatus.audioStatus):new MeetingSessionStatus(w.default.SignalingRequestFailed):o.type===_.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new MeetingSessionStatus(w.default.AudioVideoWasRemovedFromPrimaryMeeting):new MeetingSessionStatus(w.default.OK)}static fromAudioStatus(o){switch(o){case 200:return new MeetingSessionStatus(w.default.OK);case 301:return new MeetingSessionStatus(w.default.AudioJoinedFromAnotherDevice);case 302:return new MeetingSessionStatus(w.default.AudioDisconnectAudio);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);case 410:return new MeetingSessionStatus(w.default.MeetingEnded);case 411:return new MeetingSessionStatus(w.default.AudioAttendeeRemoved);case 500:return new MeetingSessionStatus(w.default.AudioInternalServerError);case 503:return new MeetingSessionStatus(w.default.AudioServiceUnavailable);default:if(2===Math.floor(o/100))return new MeetingSessionStatus(w.default.OK);return new MeetingSessionStatus(w.default.AudioDisconnected)}}static fromSignalingStatus(o){switch(o){case 206:return new MeetingSessionStatus(w.default.VideoCallSwitchToViewOnly);case 509:return new MeetingSessionStatus(w.default.VideoCallAtSourceCapacity);case 403:return new MeetingSessionStatus(w.default.AudioAuthenticationRejected);case 409:return new MeetingSessionStatus(w.default.AudioCallAtCapacity);default:switch(Math.floor(o/100)){case 2:return new MeetingSessionStatus(w.default.OK);case 4:return new MeetingSessionStatus(w.default.SignalingBadRequest);case 5:return new MeetingSessionStatus(w.default.SignalingInternalServerError);default:return new MeetingSessionStatus(w.default.SignalingRequestFailed)}}}}},0x234745d42:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),p.MeetingSessionStatusCode=void 0,(m=f=p.MeetingSessionStatusCode||(p.MeetingSessionStatusCode={}))[m.OK=0]="OK",m[m.Left=1]="Left",m[m.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",m[m.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",m[m.AudioCallAtCapacity=4]="AudioCallAtCapacity",m[m.MeetingEnded=5]="MeetingEnded",m[m.AudioInternalServerError=6]="AudioInternalServerError",m[m.AudioServiceUnavailable=7]="AudioServiceUnavailable",m[m.AudioDisconnected=8]="AudioDisconnected",m[m.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",m[m.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",m[m.SignalingBadRequest=11]="SignalingBadRequest",m[m.SignalingInternalServerError=12]="SignalingInternalServerError",m[m.SignalingRequestFailed=13]="SignalingRequestFailed",m[m.SignalingChannelClosedUnexpectedly=14]="SignalingChannelClosedUnexpectedly",m[m.ICEGatheringTimeoutWorkaround=15]="ICEGatheringTimeoutWorkaround",m[m.ConnectionHealthReconnect=16]="ConnectionHealthReconnect",m[m.RealtimeApiFailed=17]="RealtimeApiFailed",m[m.TaskFailed=18]="TaskFailed",m[m.IncompatibleSDP=19]="IncompatibleSDP",m[m.TURNCredentialsForbidden=20]="TURNCredentialsForbidden",m[m.NoAttendeePresent=21]="NoAttendeePresent",m[m.AudioAttendeeRemoved=22]="AudioAttendeeRemoved",m[m.AudioVideoWasRemovedFromPrimaryMeeting=23]="AudioVideoWasRemovedFromPrimaryMeeting",m[m.AudioVideoDisconnectedWhilePromoted=24]="AudioVideoDisconnectedWhilePromoted",m[m.AudioDisconnectAudio=25]="AudioDisconnectAudio",p.default=f},0x1736cf0a4:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},0xd5022a77:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this._audioHostURL=null,this._signalingURL=null,this._turnControlURL=null,this._eventIngestionURL=null,this.urlRewriter=o=>o,this.urlRewriterMulti=null}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(o){this._audioHostURL=o}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(o){this._signalingURL=o}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(o){this._turnControlURL=o}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(o){this._eventIngestionURL=o}}},0x17310e8bb:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class MeetingSessionVideoAvailability{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(o){return this.remoteVideoAvailable===o.remoteVideoAvailable&&this.canStartLocalVideo===o.canStartLocalVideo}clone(){let o=new MeetingSessionVideoAvailability;return o.remoteVideoAvailable=this.remoteVideoAvailable,o.canStartLocalVideo=this.canStartLocalVideo,o}}},0x143e5a9e5:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(o,p,f){this.type=o,this.headers=p,this.payload=f}}},0x1b035f840:function(o,p,f){"use strict";var m=this&&this.__awaiter||function(o,p,f,m){function adopt(o){return o instanceof f?o:new f(function(p){p(o)})}return new(f||(f=Promise))(function(f,_){function fulfilled(o){try{step(m.next(o))}catch(o){_(o)}}function rejected(o){try{step(m.throw(o))}catch(o){_(o)}}function step(o){o.done?f(o.value):adopt(o.value).then(fulfilled,rejected)}step((m=m.apply(o,p||[])).next())})},_=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let w=f(0x510b1d7f),I=_(f(6329639e3)),k=_(f(0xd6e2cff)),M=_(f(0x143e5a9e5)),x=_(f(0x1b1a7866)),O=_(f(0x573f705d)),L=_(f(0x1303d0742)),B=_(f(0x5cfde354)),U=_(f(0x165cc79a4)),$=_(f(0x22cfd1a2d));p.default=class{constructor(o,p,f,m,_){this.configuration=o,this.logger=p,this.webSocket=f,this.reconnectController=m,this.sigV4=_,this.observerQueue=new Set,this.webSocket||(this.webSocket=new B.default(this.logger)),this.reconnectController||(this.reconnectController=new x.default(o.reconnectTimeoutMs,new I.default(o.reconnectFixedWaitMs,o.reconnectShortBackoffMs,o.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new L.default(this.configuration.chimeClient)),k.default.addLogger(this.logger),k.default.register(),this.preBootstrapMessages=[]}addObserver(o){this.logger.info("adding messaging observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing messaging observer"),this.observerQueue.delete(o)}start(){return m(this,void 0,void 0,function*(){this.isClosed()?yield this.startConnecting(!1):this.logger.info("messaging session already started")})}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),k.default.removeLogger(this.logger))}forEachObserver(o){for(let p of this.observerQueue)O.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}setUpEventListeners(){this.webSocket.addEventListener("open",()=>{this.openEventHandler()}),this.webSocket.addEventListener("message",o=>{this.receiveMessageHandler(o.data)}),this.webSocket.addEventListener("close",o=>{this.closeEventHandler(o)}),this.webSocket.addEventListener("error",()=>{this.logger.error("WebSocket error")})}startConnecting(o){return m(this,void 0,void 0,function*(){return yield this.startConnectingInternal(o),yield new Promise((o,p)=>{this.bootstrapResolved=o,this.bootstrapRejected=p})})}startConnectingInternal(o){var p;return m(this,void 0,void 0,function*(){let f=this.configuration.endpointUrl;if(o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),o||void 0===f)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){let o=yield this.configuration.chimeClient.getMessagingSessionEndpoint();f=(null==(p=o.Endpoint)?void 0:p.Url)?o.Endpoint.Url:(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else f=(yield this.configuration.chimeClient.send(new w.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${f}`)}catch(p){this.logger.error(`Messaging Session failed to resolve endpoint: ${p}`);let o=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});this.closeEventHandler(o);return}let m=yield this.prepareWebSocketUrl(f);this.logger.info(`opening connection to ${m}`),o||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(m,[],!0),this.forEachObserver(p=>{p.messagingSessionDidStartConnecting&&p.messagingSessionDidStartConnecting(o)}),this.setUpEventListeners()})}prepareWebSocketUrl(o){return m(this,void 0,void 0,function*(){let p=new Map;return p.set("userArn",[this.configuration.userArn]),p.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===$.default.Connect&&p.set("prefetch-on",[$.default.Connect]),this.configuration.prefetchSortBy&&p.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",o,"/connect","",p)})}isClosed(){return this.webSocket.readyState()===U.default.None||this.webSocket.readyState()===U.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(o){try{let p=JSON.parse(o),f=p.Headers["x-amz-chime-event-type"],m=new M.default(f,p.Headers,p.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==f){if(!this.isSessionEstablished)return void this.preBootstrapMessages.push(m)}else{this.forEachObserver(o=>{o.messagingSessionDidStart&&o.messagingSessionDidStart()}),this.bootstrapResolved(),this.isSessionEstablished=!0;let o=this.preBootstrapMessages.length;for(let p=0;p{this.sendMessageToObserver(p,o)})}}this.forEachObserver(o=>{this.sendMessageToObserver(o,m)})}catch(o){this.logger.error(`Messaging parsing failed: ${o}`)}}sendMessageToObserver(o,p){o.messagingSessionDidReceiveMessage&&o.messagingSessionDidReceiveMessage(p)}retryConnection(){return this.reconnectController.retryWithBackoff(()=>m(this,void 0,void 0,function*(){yield this.startConnecting(!0)}),null)}closeEventHandler(o){this.logger.info(`WebSocket close: ${o.code} ${o.reason}`),4999!==o.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(o.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver(p=>{p.messagingSessionDidStop&&p.messagingSessionDidStop(o)}):this.bootstrapRejected(o))}canReconnect(o){return 1001===o||1006===o||o>=1011&&o<=1014||o>4e3&&4002!==o&&4003!==o&&4401!==o}}},0x51d90877:(o,p,f)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let m=f(0x149d24991);p.default=class{constructor(o,p,f,m){this.userArn=o,this.messagingSessionId=p,this.endpointUrl=f,this.chimeClient=m,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.prefetchSortBy=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){let o=new Uint32Array(1);return m.getRandomValues(o),o[0].toString()}}},0x22cfd1a2d:(o,p)=>{"use strict";var f;Object.defineProperty(p,"__esModule",{value:!0}),(f||(f={})).Connect="connect",p.default=f},0x1c2a9938d:(o,p)=>{"use strict";var f,m;Object.defineProperty(p,"__esModule",{value:!0}),(m=f||(f={})).Unread="unread",m.LastMessageTimestamp="last-message-timestamp",p.default=f},0x1a154f9b0:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x104cf28d8)),w=class DefaultModality{constructor(o){this._id=o}id(){return this._id}base(){return this._id?this._id.split(DefaultModality.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";let o=this._id.split(DefaultModality.MODALITY_SEPARATOR);return 2===o.length?o[1]:""}hasModality(o){return""!==o&&this.modality()===o}withModality(o){let p=new DefaultModality(this.base()+DefaultModality.MODALITY_SEPARATOR+o);return""===o||""===this.base()||new DefaultModality(p._id).modality()!==o?new DefaultModality(this.base()):p}};p.default=w,w.MODALITY_SEPARATOR=_.default.Modality[0],w.MODALITY_CONTENT=_.default.Modality.substring(1)},0x504c9394:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x573f705d)),w=m(f(0x7b80cc62)),I=m(f(0x16bec8feb)),k=f(0xe88b24d9),M=f(0xb529932d);p.default=class{constructor(o,p,f){this.signalingClient=o,this.intervalMs=p,this.logger=f,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new w.default(this.intervalMs),this.pingId=0}addObserver(o){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(o)}removeObserver(o){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(o)}forEachObserver(o){for(let p of this.observerQueue)_.default.nextTick(()=>{this.observerQueue.has(p)&&o(p)})}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start(()=>{this.ping()}),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver(o=>{M.Maybe.of(o.didMissPongs).map(p=>p.bind(o)(this.consecutivePongsUnaccountedFor))})),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1|0;let o=k.SdkPingPongFrame.create();o.pingId=this.pingId,o.type=k.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(o),this.logger.debug(()=>`sent ping ${this.pingId}`)}pong(o){let p=k.SdkPingPongFrame.create();p.pingId=o,p.type=k.SdkPingPongType.PONG,this.signalingClient.pingPong(p)}handleSignalingClientEvent(o){switch(o.type){case I.default.WebSocketOpen:this.startPingInterval();break;case I.default.WebSocketFailed:case I.default.WebSocketError:this.logger.warn(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.WebSocketClosing:case I.default.WebSocketClosed:this.logger.info(`stopped pinging (${I.default[o.type]})`),this.stopPingInterval();break;case I.default.ReceivedSignalFrame:if(o.message.type!==k.SdkSignalFrame.Type.PING_PONG)break;if(o.message.pingPong.type===k.SdkPingPongType.PONG){let p,f=o.message.pingPong.pingId;if(f!==this.pingId){this.logger.warn(`unexpected ping id ${f} (expected ${this.pingId})`);break}if(this.consecutivePongsUnaccountedFor=0,"number"==typeof o.message.timestampMs)p=o.message.timestampMs;else break;this.logger.debug(()=>`received pong ${f} with timestamp ${p}`);let m=o.timestampMs-this.pingTimestampLocalMs,_=Math.round(p-m/2),w=this.pingTimestampLocalMs-_;this.logger.info(`local clock skew estimate=${w}ms from ping-pong time=${m}ms`),this.forEachObserver(o=>{M.Maybe.of(o.didReceivePong).map(p=>p.bind(o)(f,w,m))})}else this.pong(o.message.pingPong.pingId)}}}},0x102abe35c:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x81e9befe)),w=f(0x149d24991),I=m(f(0x485efac6)),k=m(f(0xf6b5b898));p.default=class{constructor(o,p){this.mediaStreamBroker=o,this.state=new I.default,this._transcriptionController=p||new _.default(this)}realtimeSetLocalAttendeeId(o,p){this.state.localAttendeeId=o,this.state.localExternalUserId=p}realtimeSetAttendeeIdPresence(o,p,f,m,_){try{for(let w of(p&&(this.state.attendeeIdToExternalUserId[o]=f),this.state.attendeeIdChangesCallbacks))w(o,p,f,m,_)}catch(o){this.onError(o)}}realtimeSubscribeToAttendeeIdPresence(o){try{this.state.attendeeIdChangesCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToAttendeeIdPresence(o){try{let p=this.state.attendeeIdChangesCallbacks.indexOf(o);-1!==p&&this.state.attendeeIdChangesCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSetCanUnmuteLocalAudio(o){try{if(this.state.canUnmute===o)return;for(let p of(this.state.canUnmute=o,this.state.setCanUnmuteLocalAudioCallbacks))p(o)}catch(o){this.onError(o)}}realtimeSubscribeToSetCanUnmuteLocalAudio(o){try{this.state.setCanUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(o){try{let p=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.setCanUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{for(let o of(this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!0)}catch(o){this.onError(o)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{for(let o of(this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId),this.state.muteAndUnmuteLocalAudioCallbacks))o(!1);return!0}catch(o){return this.onError(o),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(o){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(o){try{let p=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(o);-1!==p&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(o,p){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(o)||(this.state.volumeIndicatorCallbacks[o]=[]),this.state.volumeIndicatorCallbacks[o].push(p),this.sendVolumeIndicatorChange(o,!0,!0,!0,this.state.attendeeIdToExternalUserId[o])}catch(o){this.onError(o)}}realtimeUnsubscribeFromVolumeIndicator(o,p){if(this.state.volumeIndicatorCallbacks[o])if(p){let f=this.state.volumeIndicatorCallbacks[o].indexOf(p);f>=0&&this.state.volumeIndicatorCallbacks[o].splice(f,1)}else delete this.state.volumeIndicatorCallbacks[o]}realtimeUpdateVolumeIndicator(o,p,f,m,_){try{f=this.applyLocalMuteOverride(o,f);let w=this.getVolumeIndicatorState(o),I=!1,k=!1,M=!1;null!==f&&w.muted!==f&&(w.muted=f,k=!0,w.muted&&0!==w.volume&&(w.volume=0,I=!0)),w.muted||null===p||(w.volume!==p&&(w.volume=p,I=!0),null===w.muted&&(w.muted=!1,k=!0)),null!==m&&w.signalStrength!==m&&(w.signalStrength=m,M=!0),this.sendVolumeIndicatorChange(o,I,k,M,_)}catch(o){this.onError(o)}}realtimeSubscribeToLocalSignalStrengthChange(o){try{if(this.state.localSignalStrengthChangeCallbacks.push(o),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(o){this.onError(o)}}realtimeUnsubscribeToLocalSignalStrengthChange(o){try{let p=this.state.localSignalStrengthChangeCallbacks.indexOf(o);-1!==p&&this.state.localSignalStrengthChangeCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSubscribeToSendDataMessage(o){try{this.state.sendDataMessageCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeFromSendDataMessage(o){try{let p=this.state.sendDataMessageCallbacks.indexOf(o);-1!==p&&this.state.sendDataMessageCallbacks.splice(p,1)}catch(o){this.onError(o)}}realtimeSendDataMessage(o,p,f){try{for(let m of this.state.sendDataMessageCallbacks)m(o,p,f)}catch(o){this.onError(o)}}realtimeSubscribeToReceiveDataMessage(o,p){try{this.state.receiveDataMessageCallbacks.has(o)?this.state.receiveDataMessageCallbacks.get(o).push(p):this.state.receiveDataMessageCallbacks.set(o,[p])}catch(o){this.onError(o)}}realtimeUnsubscribeFromReceiveDataMessage(o){try{this.state.receiveDataMessageCallbacks.delete(o)}catch(o){this.onError(o)}}realtimeReceiveDataMessage(o){try{w.iterateEvery(this.state.receiveDataMessageCallbacks.get(o.topic),p=>{p(o)})}catch(o){Promise.reject(o)}}realtimeSubscribeToFatalError(o){try{this.state.fatalErrorCallbacks.push(o)}catch(o){this.onError(o)}}realtimeUnsubscribeToFatalError(o){try{let p=this.state.fatalErrorCallbacks.indexOf(o);-1!==p&&this.state.fatalErrorCallbacks.splice(p,1)}catch(o){this.onError(o)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(o){o?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(o,p){let f=this.state.localAttendeeId,m=this.state.muted;return o===f&&"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?m:p}sendVolumeIndicatorChange(o,p,f,m,_){if(this.sendLocalSignalStrengthChange(o,m),!this.state.volumeIndicatorCallbacks.hasOwnProperty(o))return;let w=this.getVolumeIndicatorState(o),I=new k.default;if(p&&(I.volume=w.volume),f&&(I.muted=w.muted),m&&(I.signalStrength=w.signalStrength),!this.stateIsEmpty(I))for(let p of this.state.volumeIndicatorCallbacks[o])p(o,I.volume,I.muted,I.signalStrength,_)}sendLocalSignalStrengthChange(o,p){if(!p||o!==this.state.localAttendeeId)return;let f=this.getVolumeIndicatorState(o).signalStrength;if(null!==f)for(let o of this.state.localSignalStrengthChangeCallbacks)o(f)}getVolumeIndicatorState(o){return this.state.volumeIndicatorState.hasOwnProperty(o)||(this.state.volumeIndicatorState[o]=new k.default),this.state.volumeIndicatorState[o]}stateIsEmpty(o){return null===o.volume&&null===o.muted&&null===o.signalStrength}onError(o){try{for(let p of this.state.fatalErrorCallbacks)p(o)}catch(p){try{console.error(o),console.error(p)}catch{}}}}},0x151a585f0:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},0x485efac6:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},0xf6b5b898:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},0x1b1a7866:function(o,p,f){"use strict";var m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(p,"__esModule",{value:!0});let _=m(f(0x6ee73800));p.default=class DefaultReconnectController{constructor(o,p){this.reconnectTimeoutMs=o,this.backoffPolicy=p,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs||this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(o){this._isFirstConnection=o,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(o,p){let f=this.shouldReconnect&&!this.hasPastReconnectDeadline();return f&&(this.backoffCancel=p,this.backoffTimer=new _.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start(()=>{this.backoffCancel=null,o()})),f}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new DefaultReconnectController(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(o){this.lastActiveTimestampMs=o}}},0x1a763535d:(o,p)=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});let f=class RedundantAudioEncoder{constructor(){this.maxRedPacketSizeBytes=1024,this.maxAudioPayloadSizeBytes=1e3,this.maxRedTimestampOffset=16384,this.redHeaderSizeBytes=4,this.redLastHeaderSizeBytes=1,this.redPacketizationTime=960,this.redPacketDistance=2,this.maxRedEncodings=2,this.redMaxRecoveryDistance=this.redPacketDistance*this.maxRedEncodings+1,this.maxEncodingHistorySize=10,this.numRedundantEncodings=0,this.redundancyEnabled=!0,this.lossReportInterval=24e4,this.maxOutOfOrderPacketDistance=16,this.OPUS_BAD_ARG=-1,this.OPUS_INVALID_PACKET=-4,this.OPUS_MAX_OPUS_FRAMES=48,this.OPUS_MAX_FRAME_SIZE_BYTES=1275,this.encodingHistory=[],this.opusPayloadType=0,this.redPayloadType=0,this.initializePacketLogs()}static initializeWorker(){RedundantAudioEncoder.log("Initializing RedundantAudioEncoder");let o=new RedundantAudioEncoder;self.RTCRtpScriptTransformer&&(self.onrtctransform=p=>{"SenderTransform"===p.transformer.options.type?o.setupSenderTransform(p.transformer.readable,p.transformer.writable):"ReceiverTransform"===p.transformer.options.type?o.setupReceiverTransform(p.transformer.readable,p.transformer.writable):"PassthroughTransform"===p.transformer.options.type&&o.setupPassthroughTransform(p.transformer.readable,p.transformer.writable)}),self.onmessage=p=>{"StartRedWorker"===p.data.msgType?(o.setupSenderTransform(p.data.send.readable,p.data.send.writable),o.setupReceiverTransform(p.data.receive.readable,p.data.receive.writable)):"PassthroughTransform"===p.data.msgType?(o.setupPassthroughTransform(p.data.send.readable,p.data.send.writable),o.setupPassthroughTransform(p.data.receive.readable,p.data.receive.writable)):"RedPayloadType"===p.data.msgType?o.setRedPayloadType(p.data.payloadType):"OpusPayloadType"===p.data.msgType?o.setOpusPayloadType(p.data.payloadType):"UpdateNumRedundantEncodings"===p.data.msgType?o.setNumRedundantEncodings(p.data.numRedundantEncodings):"Enable"===p.data.msgType?o.setRedundancyEnabled(!0):"Disable"===p.data.msgType&&o.setRedundancyEnabled(!1)}}static log(o){RedundantAudioEncoder.shouldLog&&self.postMessage({type:"REDWorkerLog",log:`[AudioRed] ${o}`})}static getNumRedundantEncodingsForPacketLoss(o){let p=0,f=!1;return o<=8?p=0:o<=18?p=1:o<=75?p=2:(p=0,f=!0),[p,f]}setupPassthroughTransform(o,p){RedundantAudioEncoder.log("Setting up passthrough transform"),o.pipeTo(p)}setupSenderTransform(o,p){RedundantAudioEncoder.log("Setting up sender RED transform");let f=new TransformStream({transform:this.senderTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setupReceiverTransform(o,p){RedundantAudioEncoder.log("Setting up receiver RED transform");let f=new TransformStream({transform:this.receivePacketLogTransform.bind(this)});o.pipeThrough(f).pipeTo(p)}setRedPayloadType(o){this.redPayloadType=o,RedundantAudioEncoder.log(`red payload type set to ${this.redPayloadType}`)}setOpusPayloadType(o){this.opusPayloadType=o,RedundantAudioEncoder.log(`opus payload type set to ${this.opusPayloadType}`)}setNumRedundantEncodings(o){this.numRedundantEncodings=o,this.numRedundantEncodings>this.maxRedEncodings&&(this.numRedundantEncodings=this.maxRedEncodings),RedundantAudioEncoder.log(`Updated numRedundantEncodings to ${this.numRedundantEncodings}`)}setRedundancyEnabled(o){this.redundancyEnabled=o,RedundantAudioEncoder.log(`redundancy ${this.redundancyEnabled?"enabled":"disabled"}`)}enqueueAudioFrameIfPayloadSizeIsValid(o,p){o.data.byteLength>this.maxAudioPayloadSizeBytes||p.enqueue(o)}senderTransform(o,p){if(o.getMetadata().payloadType!==this.redPayloadType)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let f=this.getPrimaryPayload(o.timestamp,o.data);if(!f)return void this.enqueueAudioFrameIfPayloadSizeIsValid(o,p);let m=this.encode(o.timestamp,f);m&&(o.data=m),this.enqueueAudioFrameIfPayloadSizeIsValid(o,p)}getPrimaryPayload(o,p){let f=this.splitEncodings(o,p);return!f||f.length<1?null:f[f.length-1].payload}splitEncodings(o,p,f=!1,m){let _=new DataView(p),w=_.byteLength,I=0,k=0,M=0,x=0,O=!1,L=[],B=[],U=[];for(;w>0;){if(O=(128&_.getUint8(x))==0){if((127&_.getUint8(x))!==this.opusPayloadType||(I+=this.redLastHeaderSizeBytes,k+=this.redLastHeaderSizeBytes,I>=_.byteLength))return null;M=_.byteLength-I;break}{if(w