diff --git a/404.html b/404.html index c419948..72d436e 100644 --- a/404.html +++ b/404.html @@ -30,7 +30,7 @@ })(); - + diff --git a/assets/index-cda1b36e.js b/assets/index-3de0e7e6.js similarity index 66% rename from assets/index-cda1b36e.js rename to assets/index-3de0e7e6.js index 740caf8..6991c88 100644 --- a/assets/index-cda1b36e.js +++ b/assets/index-3de0e7e6.js @@ -22,7 +22,7 @@ function _mergeNamespaces(a,o){for(var _e=0;_e>>1,cn=Ft[yn];if(0>>1;ynct(fn,vn))Tnct(_n,fn)?(Ft[yn]=_n,Ft[Tn]=vn,yn=Tn):(Ft[yn]=fn,Ft[bn]=vn,yn=bn);else if(Tnct(_n,vn))Ft[yn]=_n,Ft[Tn]=vn,yn=Tn;else break e}}return un}function ct(Ft,un){var vn=Ft.sortIndex-un.sortIndex;return vn!==0?vn:Ft.id-un.id}if(typeof performance=="object"&&typeof performance.now=="function"){var gt=performance;a.unstable_now=function(){return gt.now()}}else{var rt=Date,it=rt.now();a.unstable_now=function(){return rt.now()-it}}var s=[],et=[],nt=1,at=null,ht=3,dt=!1,ut=!1,lt=!1,mt=typeof setTimeout=="function"?setTimeout:null,ot=typeof clearTimeout=="function"?clearTimeout:null,pt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ft(Ft){for(var un=_e(et);un!==null;){if(un.callback===null)tt(et);else if(un.startTime<=Ft)tt(et),un.sortIndex=un.expirationTime,o(s,un);else break;un=_e(et)}}function yt(Ft){if(lt=!1,ft(Ft),!ut)if(_e(s)!==null)ut=!0,nn(vt);else{var un=_e(et);un!==null&&zt(yt,un.startTime-Ft)}}function vt(Ft,un){ut=!1,lt&&(lt=!1,ot(Nt),Nt=-1),dt=!0;var vn=ht;try{for(ft(un),at=_e(s);at!==null&&(!(at.expirationTime>un)||Ft&&!Mt());){var yn=at.callback;if(typeof yn=="function"){at.callback=null,ht=at.priorityLevel;var cn=yn(at.expirationTime<=un);un=a.unstable_now(),typeof cn=="function"?at.callback=cn:at===_e(s)&&tt(s),ft(un)}else tt(s);at=_e(s)}if(at!==null)var gn=!0;else{var bn=_e(et);bn!==null&&zt(yt,bn.startTime-un),gn=!1}return gn}finally{at=null,ht=vn,dt=!1}}var bt=!1,At=null,Nt=-1,St=5,wt=-1;function Mt(){return!(a.unstable_now()-wtFt||125yn?(Ft.sortIndex=vn,o(et,Ft),_e(s)===null&&Ft===_e(et)&&(lt?(ot(Nt),Nt=-1):lt=!0,zt(yt,vn-yn))):(Ft.sortIndex=cn,o(s,Ft),ut||dt||(ut=!0,nn(vt))),Ft},a.unstable_shouldYield=Mt,a.unstable_wrapCallback=function(Ft){var un=ht;return function(){var vn=ht;ht=un;try{return Ft.apply(this,arguments)}finally{ht=vn}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + */(function(a){function o(Ft,un){var vn=Ft.length;Ft.push(un);e:for(;0>>1,cn=Ft[yn];if(0>>1;ynct(fn,vn))Tnct(On,fn)?(Ft[yn]=On,Ft[Tn]=vn,yn=Tn):(Ft[yn]=fn,Ft[Cn]=vn,yn=Cn);else if(Tnct(On,vn))Ft[yn]=On,Ft[Tn]=vn,yn=Tn;else break e}}return un}function ct(Ft,un){var vn=Ft.sortIndex-un.sortIndex;return vn!==0?vn:Ft.id-un.id}if(typeof performance=="object"&&typeof performance.now=="function"){var gt=performance;a.unstable_now=function(){return gt.now()}}else{var rt=Date,it=rt.now();a.unstable_now=function(){return rt.now()-it}}var s=[],et=[],nt=1,at=null,ht=3,dt=!1,pt=!1,lt=!1,mt=typeof setTimeout=="function"?setTimeout:null,ot=typeof clearTimeout=="function"?clearTimeout:null,ut=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ft(Ft){for(var un=_e(et);un!==null;){if(un.callback===null)tt(et);else if(un.startTime<=Ft)tt(et),un.sortIndex=un.expirationTime,o(s,un);else break;un=_e(et)}}function bt(Ft){if(lt=!1,ft(Ft),!pt)if(_e(s)!==null)pt=!0,nn(vt);else{var un=_e(et);un!==null&&zt(bt,un.startTime-Ft)}}function vt(Ft,un){pt=!1,lt&&(lt=!1,ot(Nt),Nt=-1),dt=!0;var vn=ht;try{for(ft(un),at=_e(s);at!==null&&(!(at.expirationTime>un)||Ft&&!Mt());){var yn=at.callback;if(typeof yn=="function"){at.callback=null,ht=at.priorityLevel;var cn=yn(at.expirationTime<=un);un=a.unstable_now(),typeof cn=="function"?at.callback=cn:at===_e(s)&&tt(s),ft(un)}else tt(s);at=_e(s)}if(at!==null)var gn=!0;else{var Cn=_e(et);Cn!==null&&zt(bt,Cn.startTime-un),gn=!1}return gn}finally{at=null,ht=vn,dt=!1}}var yt=!1,At=null,Nt=-1,St=5,wt=-1;function Mt(){return!(a.unstable_now()-wtFt||125yn?(Ft.sortIndex=vn,o(et,Ft),_e(s)===null&&Ft===_e(et)&&(lt?(ot(Nt),Nt=-1):lt=!0,zt(bt,vn-yn))):(Ft.sortIndex=cn,o(s,Ft),pt||dt||(pt=!0,nn(vt))),Ft},a.unstable_shouldYield=Mt,a.unstable_wrapCallback=function(Ft){var un=ht;return function(){var vn=ht;ht=un;try{return Ft.apply(this,arguments)}finally{ht=vn}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** * @license React * react-dom.production.min.js * @@ -34,10 +34,10 @@ function _mergeNamespaces(a,o){for(var _e=0;_eit||ct[rt]!==gt[it]){var s=` -`+ct[rt].replace(" at new "," at ");return a.displayName&&s.includes("")&&(s=s.replace("",a.displayName)),s}while(1<=rt&&0<=it);break}}}finally{Na=!1,Error.prepareStackTrace=_e}return(a=a?a.displayName||a.name:"")?Ma(a):""}function Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return""}}function Qa(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case Ca:return(a.displayName||"Context")+".Consumer";case Ba:return(a._context.displayName||"Context")+".Provider";case Da:var o=a.render;return a=a.displayName,a||(a=o.displayName||o.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Ga:return o=a.displayName||null,o!==null?o:Qa(a.type)||"Memo";case Ha:o=a._payload,a=a._init;try{return Qa(a(o))}catch{}}return null}function Ra(a){var o=a.type;switch(a.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=o.render,a=a.displayName||a.name||"",o.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(o);case 8:return o===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Sa(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ta(a){var o=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ua(a){var o=Ta(a)?"checked":"value",_e=Object.getOwnPropertyDescriptor(a.constructor.prototype,o),tt=""+a[o];if(!a.hasOwnProperty(o)&&typeof _e<"u"&&typeof _e.get=="function"&&typeof _e.set=="function"){var ct=_e.get,gt=_e.set;return Object.defineProperty(a,o,{configurable:!0,get:function(){return ct.call(this)},set:function(rt){tt=""+rt,gt.call(this,rt)}}),Object.defineProperty(a,o,{enumerable:_e.enumerable}),{getValue:function(){return tt},setValue:function(rt){tt=""+rt},stopTracking:function(){a._valueTracker=null,delete a[o]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var o=a._valueTracker;if(!o)return!0;var _e=o.getValue(),tt="";return a&&(tt=Ta(a)?a.checked?"true":"false":a.value),a=tt,a!==_e?(o.setValue(a),!0):!1}function Xa(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Ya(a,o){var _e=o.checked;return A$3({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_e??a._wrapperState.initialChecked})}function Za(a,o){var _e=o.defaultValue==null?"":o.defaultValue,tt=o.checked!=null?o.checked:o.defaultChecked;_e=Sa(o.value!=null?o.value:_e),a._wrapperState={initialChecked:tt,initialValue:_e,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ab(a,o){o=o.checked,o!=null&&ta(a,"checked",o,!1)}function bb(a,o){ab(a,o);var _e=Sa(o.value),tt=o.type;if(_e!=null)tt==="number"?(_e===0&&a.value===""||a.value!=_e)&&(a.value=""+_e):a.value!==""+_e&&(a.value=""+_e);else if(tt==="submit"||tt==="reset"){a.removeAttribute("value");return}o.hasOwnProperty("value")?cb(a,o.type,_e):o.hasOwnProperty("defaultValue")&&cb(a,o.type,Sa(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(a.defaultChecked=!!o.defaultChecked)}function db(a,o,_e){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var tt=o.type;if(!(tt!=="submit"&&tt!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+a._wrapperState.initialValue,_e||o===a.value||(a.value=o),a.defaultValue=o}_e=a.name,_e!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,_e!==""&&(a.name=_e)}function cb(a,o,_e){(o!=="number"||Xa(a.ownerDocument)!==a)&&(_e==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+_e&&(a.defaultValue=""+_e))}var eb=Array.isArray;function fb(a,o,_e,tt){if(a=a.options,o){o={};for(var ct=0;ct<_e.length;ct++)o["$"+_e[ct]]=!0;for(_e=0;_e"+o.valueOf().toString()+"",o=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;o.firstChild;)a.appendChild(o.firstChild)}});function ob(a,o){if(o){var _e=a.firstChild;if(_e&&_e===a.lastChild&&_e.nodeType===3){_e.nodeValue=o;return}}a.textContent=o}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(a){qb.forEach(function(o){o=o+a.charAt(0).toUpperCase()+a.substring(1),pb[o]=pb[a]})});function rb(a,o,_e){return o==null||typeof o=="boolean"||o===""?"":_e||typeof o!="number"||o===0||pb.hasOwnProperty(a)&&pb[a]?(""+o).trim():o+"px"}function sb(a,o){a=a.style;for(var _e in o)if(o.hasOwnProperty(_e)){var tt=_e.indexOf("--")===0,ct=rb(_e,o[_e],tt);_e==="float"&&(_e="cssFloat"),tt?a.setProperty(_e,ct):a[_e]=ct}}var tb=A$3({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(a,o){if(o){if(tb[a]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(p$2(137,a));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(p$2(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(p$2(61))}if(o.style!=null&&typeof o.style!="object")throw Error(p$2(62))}}function vb(a,o){if(a.indexOf("-")===-1)return typeof o.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var yb=null,zb=null,Ab=null;function Bb(a){if(a=Cb(a)){if(typeof yb!="function")throw Error(p$2(280));var o=a.stateNode;o&&(o=Db(o),yb(a.stateNode,a.type,o))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,o=Ab;if(Ab=zb=null,Bb(a),o)for(a=0;a>>=0,a===0?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;function tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function uc(a,o){var _e=a.pendingLanes;if(_e===0)return 0;var tt=0,ct=a.suspendedLanes,gt=a.pingedLanes,rt=_e&268435455;if(rt!==0){var it=rt&~ct;it!==0?tt=tc(it):(gt&=rt,gt!==0&&(tt=tc(gt)))}else rt=_e&~ct,rt!==0?tt=tc(rt):gt!==0&&(tt=tc(gt));if(tt===0)return 0;if(o!==0&&o!==tt&&!(o&ct)&&(ct=tt&-tt,gt=o&-o,ct>=gt||ct===16&&(gt&4194240)!==0))return o;if(tt&4&&(tt|=_e&16),o=a.entangledLanes,o!==0)for(a=a.entanglements,o&=tt;0_e;_e++)o.push(a);return o}function Ac(a,o,_e){a.pendingLanes|=o,o!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,o=31-oc(o),a[o]=_e}function Bc(a,o){var _e=a.pendingLanes&~o;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=o,a.mutableReadLanes&=o,a.entangledLanes&=o,o=a.entanglements;var tt=a.eventTimes;for(a=a.expirationTimes;0<_e;){var ct=31-oc(_e),gt=1<=be),ee$1=String.fromCharCode(32),fe=!1;function ge(a,o){switch(a){case"keyup":return $d.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ie=!1;function je(a,o){switch(a){case"compositionend":return he(o);case"keypress":return o.which!==32?null:(fe=!0,ee$1);case"textInput":return a=o.data,a===ee$1&&fe?null:a;default:return null}}function ke(a,o){if(ie)return a==="compositionend"||!ae&&ge(a,o)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:_e,offset:o-a};a=tt}e:{for(;_e;){if(_e.nextSibling){_e=_e.nextSibling;break e}_e=_e.parentNode}_e=void 0}_e=Je(_e)}}function Le(a,o){return a&&o?a===o?!0:a&&a.nodeType===3?!1:o&&o.nodeType===3?Le(a,o.parentNode):"contains"in a?a.contains(o):a.compareDocumentPosition?!!(a.compareDocumentPosition(o)&16):!1:!1}function Me(){for(var a=window,o=Xa();o instanceof a.HTMLIFrameElement;){try{var _e=typeof o.contentWindow.location.href=="string"}catch{_e=!1}if(_e)a=o.contentWindow;else break;o=Xa(a.document)}return o}function Ne(a){var o=a&&a.nodeName&&a.nodeName.toLowerCase();return o&&(o==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||o==="textarea"||a.contentEditable==="true")}function Oe(a){var o=Me(),_e=a.focusedElem,tt=a.selectionRange;if(o!==_e&&_e&&_e.ownerDocument&&Le(_e.ownerDocument.documentElement,_e)){if(tt!==null&&Ne(_e)){if(o=tt.start,a=tt.end,a===void 0&&(a=o),"selectionStart"in _e)_e.selectionStart=o,_e.selectionEnd=Math.min(a,_e.value.length);else if(a=(o=_e.ownerDocument||document)&&o.defaultView||window,a.getSelection){a=a.getSelection();var ct=_e.textContent.length,gt=Math.min(tt.start,ct);tt=tt.end===void 0?gt:Math.min(tt.end,ct),!a.extend&>>tt&&(ct=tt,tt=gt,gt=ct),ct=Ke(_e,gt);var rt=Ke(_e,tt);ct&&rt&&(a.rangeCount!==1||a.anchorNode!==ct.node||a.anchorOffset!==ct.offset||a.focusNode!==rt.node||a.focusOffset!==rt.offset)&&(o=o.createRange(),o.setStart(ct.node,ct.offset),a.removeAllRanges(),gt>tt?(a.addRange(o),a.extend(rt.node,rt.offset)):(o.setEnd(rt.node,rt.offset),a.addRange(o)))}}for(o=[],a=_e;a=a.parentNode;)a.nodeType===1&&o.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof _e.focus=="function"&&_e.focus(),_e=0;_e=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(a,o,_e){var tt=_e.window===_e?_e.document:_e.nodeType===9?_e:_e.ownerDocument;Te||Qe==null||Qe!==Xa(tt)||(tt=Qe,"selectionStart"in tt&&Ne(tt)?tt={start:tt.selectionStart,end:tt.selectionEnd}:(tt=(tt.ownerDocument&&tt.ownerDocument.defaultView||window).getSelection(),tt={anchorNode:tt.anchorNode,anchorOffset:tt.anchorOffset,focusNode:tt.focusNode,focusOffset:tt.focusOffset}),Se&&Ie(Se,tt)||(Se=tt,tt=oe(Re,"onSelect"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(a,o){Tf++,Sf[Tf]=a.current,a.current=o}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,o){var _e=a.type.contextTypes;if(!_e)return Vf;var tt=a.stateNode;if(tt&&tt.__reactInternalMemoizedUnmaskedChildContext===o)return tt.__reactInternalMemoizedMaskedChildContext;var ct={},gt;for(gt in _e)ct[gt]=o[gt];return tt&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=o,a.__reactInternalMemoizedMaskedChildContext=ct),ct}function Zf(a){return a=a.childContextTypes,a!=null}function $f(){E$1(Wf),E$1(H)}function ag(a,o,_e){if(H.current!==Vf)throw Error(p$2(168));G$1(H,o),G$1(Wf,_e)}function bg(a,o,_e){var tt=a.stateNode;if(o=o.childContextTypes,typeof tt.getChildContext!="function")return _e;tt=tt.getChildContext();for(var ct in tt)if(!(ct in o))throw Error(p$2(108,Ra(a)||"Unknown",ct));return A$3({},_e,tt)}function cg(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G$1(H,a),G$1(Wf,Wf.current),!0}function dg(a,o,_e){var tt=a.stateNode;if(!tt)throw Error(p$2(169));_e?(a=bg(a,o,Xf),tt.__reactInternalMemoizedMergedChildContext=a,E$1(Wf),E$1(H),G$1(H,a)):E$1(Wf),G$1(Wf,_e)}var eg=null,fg=!1,gg=!1;function hg(a){eg===null?eg=[a]:eg.push(a)}function ig(a){fg=!0,hg(a)}function jg(){if(!gg&&eg!==null){gg=!0;var a=0,o=C$1;try{var _e=eg;for(C$1=1;a<_e.length;a++){var tt=_e[a];do tt=tt(!0);while(tt!==null)}eg=null,fg=!1}catch(ct){throw eg!==null&&(eg=eg.slice(a+1)),ac(fc,jg),ct}finally{C$1=o,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(a,o){kg[lg++]=ng,kg[lg++]=mg,mg=a,ng=o}function ug(a,o,_e){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=a;var tt=rg;a=sg;var ct=32-oc(tt)-1;tt&=~(1<>=rt,ct-=rt,rg=1<<32-oc(o)+ct|_e<Nt?(St=At,At=null):St=At.sibling;var wt=ht(ot,At,ft[Nt],yt);if(wt===null){At===null&&(At=St);break}a&&At&&wt.alternate===null&&o(ot,At),pt=gt(wt,pt,Nt),bt===null?vt=wt:bt.sibling=wt,bt=wt,At=St}if(Nt===ft.length)return _e(ot,At),I&&tg(ot,Nt),vt;if(At===null){for(;NtNt?(St=At,At=null):St=At.sibling;var Mt=ht(ot,At,wt.value,yt);if(Mt===null){At===null&&(At=St);break}a&&At&&Mt.alternate===null&&o(ot,At),pt=gt(Mt,pt,Nt),bt===null?vt=Mt:bt.sibling=Mt,bt=Mt,At=St}if(wt.done)return _e(ot,At),I&&tg(ot,Nt),vt;if(At===null){for(;!wt.done;Nt++,wt=ft.next())wt=at(ot,wt.value,yt),wt!==null&&(pt=gt(wt,pt,Nt),bt===null?vt=wt:bt.sibling=wt,bt=wt);return I&&tg(ot,Nt),vt}for(At=tt(ot,At);!wt.done;Nt++,wt=ft.next())wt=dt(At,ot,Nt,wt.value,yt),wt!==null&&(a&&wt.alternate!==null&&At.delete(wt.key===null?Nt:wt.key),pt=gt(wt,pt,Nt),bt===null?vt=wt:bt.sibling=wt,bt=wt);return a&&At.forEach(function(Ht){return o(ot,Ht)}),I&&tg(ot,Nt),vt}function mt(ot,pt,ft,yt){if(typeof ft=="object"&&ft!==null&&ft.type===ya&&ft.key===null&&(ft=ft.props.children),typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case va:e:{for(var vt=ft.key,bt=pt;bt!==null;){if(bt.key===vt){if(vt=ft.type,vt===ya){if(bt.tag===7){_e(ot,bt.sibling),pt=ct(bt,ft.props.children),pt.return=ot,ot=pt;break e}}else if(bt.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===Ha&&uh(vt)===bt.type){_e(ot,bt.sibling),pt=ct(bt,ft.props),pt.ref=sh(ot,bt,ft),pt.return=ot,ot=pt;break e}_e(ot,bt);break}else o(ot,bt);bt=bt.sibling}ft.type===ya?(pt=Ah(ft.props.children,ot.mode,yt,ft.key),pt.return=ot,ot=pt):(yt=yh(ft.type,ft.key,ft.props,null,ot.mode,yt),yt.ref=sh(ot,pt,ft),yt.return=ot,ot=yt)}return rt(ot);case wa:e:{for(bt=ft.key;pt!==null;){if(pt.key===bt)if(pt.tag===4&&pt.stateNode.containerInfo===ft.containerInfo&&pt.stateNode.implementation===ft.implementation){_e(ot,pt.sibling),pt=ct(pt,ft.children||[]),pt.return=ot,ot=pt;break e}else{_e(ot,pt);break}else o(ot,pt);pt=pt.sibling}pt=zh(ft,ot.mode,yt),pt.return=ot,ot=pt}return rt(ot);case Ha:return bt=ft._init,mt(ot,pt,bt(ft._payload),yt)}if(eb(ft))return ut(ot,pt,ft,yt);if(Ka(ft))return lt(ot,pt,ft,yt);th(ot,ft)}return typeof ft=="string"&&ft!==""||typeof ft=="number"?(ft=""+ft,pt!==null&&pt.tag===6?(_e(ot,pt.sibling),pt=ct(pt,ft),pt.return=ot,ot=pt):(_e(ot,pt),pt=xh(ft,ot.mode,yt),pt.return=ot,ot=pt),rt(ot)):_e(ot,pt)}return mt}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p$2(174));return a}function Ih(a,o){switch(G$1(Gh,o),G$1(Fh,a),G$1(Eh,Dh),a=o.nodeType,a){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:lb(null,"");break;default:a=a===8?o.parentNode:o,o=a.namespaceURI||null,a=a.tagName,o=lb(o,a)}E$1(Eh),G$1(Eh,o)}function Jh(){E$1(Eh),E$1(Fh),E$1(Gh)}function Kh(a){Hh(Gh.current);var o=Hh(Eh.current),_e=lb(o,a.type);o!==_e&&(G$1(Fh,a),G$1(Eh,_e))}function Lh(a){Fh.current===a&&(E$1(Eh),E$1(Fh))}var M$1=Uf(0);function Mh(a){for(var o=a;o!==null;){if(o.tag===13){var _e=o.memoizedState;if(_e!==null&&(_e=_e.dehydrated,_e===null||_e.data==="$?"||_e.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if(o.flags&128)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Nh=[];function Oh(){for(var a=0;a_e?_e:4,a(!0);var tt=Qh.transition;Qh.transition={};try{a(!1),o()}finally{C$1=_e,Qh.transition=tt}}function Fi(){return di().memoizedState}function Gi(a,o,_e){var tt=lh(a);if(_e={lane:tt,action:_e,hasEagerState:!1,eagerState:null,next:null},Hi(a))Ii(o,_e);else if(_e=Yg(a,o,_e,tt),_e!==null){var ct=L();mh(_e,a,tt,ct),Ji(_e,o,tt)}}function ri(a,o,_e){var tt=lh(a),ct={lane:tt,action:_e,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(o,ct);else{var gt=a.alternate;if(a.lanes===0&&(gt===null||gt.lanes===0)&&(gt=o.lastRenderedReducer,gt!==null))try{var rt=o.lastRenderedState,it=gt(rt,_e);if(ct.hasEagerState=!0,ct.eagerState=it,He(it,rt)){var s=o.interleaved;s===null?(ct.next=ct,Xg(o)):(ct.next=s.next,s.next=ct),o.interleaved=ct;return}}catch{}finally{}_e=Yg(a,o,ct,tt),_e!==null&&(ct=L(),mh(_e,a,tt,ct),Ji(_e,o,tt))}}function Hi(a){var o=a.alternate;return a===N$1||o!==null&&o===N$1}function Ii(a,o){Th=Sh=!0;var _e=a.pending;_e===null?o.next=o:(o.next=_e.next,_e.next=o),a.pending=o}function Ji(a,o,_e){if(_e&4194240){var tt=o.lanes;tt&=a.pendingLanes,_e|=tt,o.lanes=_e,Cc(a,_e)}}var ai={readContext:Vg,useCallback:Q$1,useContext:Q$1,useEffect:Q$1,useImperativeHandle:Q$1,useInsertionEffect:Q$1,useLayoutEffect:Q$1,useMemo:Q$1,useReducer:Q$1,useRef:Q$1,useState:Q$1,useDebugValue:Q$1,useDeferredValue:Q$1,useTransition:Q$1,useMutableSource:Q$1,useSyncExternalStore:Q$1,useId:Q$1,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,o){return ci().memoizedState=[a,o===void 0?null:o],a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,o,_e){return _e=_e!=null?_e.concat([a]):null,ti(4194308,4,yi.bind(null,o,a),_e)},useLayoutEffect:function(a,o){return ti(4194308,4,a,o)},useInsertionEffect:function(a,o){return ti(4,2,a,o)},useMemo:function(a,o){var _e=ci();return o=o===void 0?null:o,a=a(),_e.memoizedState=[a,o],a},useReducer:function(a,o,_e){var tt=ci();return o=_e!==void 0?_e(o):o,tt.memoizedState=tt.baseState=o,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:o},tt.queue=a,a=a.dispatch=Gi.bind(null,N$1,a),[tt.memoizedState,a]},useRef:function(a){var o=ci();return a={current:a},o.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),o=a[0];return a=Ei.bind(null,a[1]),ci().memoizedState=a,[o,a]},useMutableSource:function(){},useSyncExternalStore:function(a,o,_e){var tt=N$1,ct=ci();if(I){if(_e===void 0)throw Error(p$2(407));_e=_e()}else{if(_e=o(),R$1===null)throw Error(p$2(349));Rh&30||ni(tt,o,_e)}ct.memoizedState=_e;var gt={value:_e,getSnapshot:o};return ct.queue=gt,vi(ki.bind(null,tt,gt,a),[a]),tt.flags|=2048,li(9,mi.bind(null,tt,gt,_e,o),void 0,null),_e},useId:function(){var a=ci(),o=R$1.identifierPrefix;if(I){var _e=sg,tt=rg;_e=(tt&~(1<<32-oc(tt)-1)).toString(32)+_e,o=":"+o+"R"+_e,_e=Uh++,0<_e&&(o+="H"+_e.toString(32)),o+=":"}else _e=Vh++,o=":"+o+"r"+_e.toString(32)+":";return a.memoizedState=o},unstable_isNewReconciler:!1},Zh={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:fi,useRef:si,useState:function(){return fi(ei)},useDebugValue:Ai,useDeferredValue:function(a){var o=di();return Di(o,O$1.memoizedState,a)},useTransition:function(){var a=fi(ei)[0],o=di().memoizedState;return[a,o]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1},$h={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:gi,useRef:si,useState:function(){return gi(ei)},useDebugValue:Ai,useDeferredValue:function(a){var o=di();return O$1===null?o.memoizedState=a:Di(o,O$1.memoizedState,a)},useTransition:function(){var a=gi(ei)[0],o=di().memoizedState;return[a,o]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1};function Ki(a,o){try{var _e="",tt=o;do _e+=Pa(tt),tt=tt.return;while(tt);var ct=_e}catch(gt){ct=` +`+ct[rt].replace(" at new "," at ");return a.displayName&&s.includes("")&&(s=s.replace("",a.displayName)),s}while(1<=rt&&0<=it);break}}}finally{Na=!1,Error.prepareStackTrace=_e}return(a=a?a.displayName||a.name:"")?Ma(a):""}function Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return""}}function Qa(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case Ca:return(a.displayName||"Context")+".Consumer";case Ba:return(a._context.displayName||"Context")+".Provider";case Da:var o=a.render;return a=a.displayName,a||(a=o.displayName||o.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Ga:return o=a.displayName||null,o!==null?o:Qa(a.type)||"Memo";case Ha:o=a._payload,a=a._init;try{return Qa(a(o))}catch{}}return null}function Ra(a){var o=a.type;switch(a.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=o.render,a=a.displayName||a.name||"",o.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(o);case 8:return o===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Sa(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ta(a){var o=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ua(a){var o=Ta(a)?"checked":"value",_e=Object.getOwnPropertyDescriptor(a.constructor.prototype,o),tt=""+a[o];if(!a.hasOwnProperty(o)&&typeof _e<"u"&&typeof _e.get=="function"&&typeof _e.set=="function"){var ct=_e.get,gt=_e.set;return Object.defineProperty(a,o,{configurable:!0,get:function(){return ct.call(this)},set:function(rt){tt=""+rt,gt.call(this,rt)}}),Object.defineProperty(a,o,{enumerable:_e.enumerable}),{getValue:function(){return tt},setValue:function(rt){tt=""+rt},stopTracking:function(){a._valueTracker=null,delete a[o]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var o=a._valueTracker;if(!o)return!0;var _e=o.getValue(),tt="";return a&&(tt=Ta(a)?a.checked?"true":"false":a.value),a=tt,a!==_e?(o.setValue(a),!0):!1}function Xa(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Ya(a,o){var _e=o.checked;return A$3({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_e??a._wrapperState.initialChecked})}function Za(a,o){var _e=o.defaultValue==null?"":o.defaultValue,tt=o.checked!=null?o.checked:o.defaultChecked;_e=Sa(o.value!=null?o.value:_e),a._wrapperState={initialChecked:tt,initialValue:_e,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ab(a,o){o=o.checked,o!=null&&ta(a,"checked",o,!1)}function bb(a,o){ab(a,o);var _e=Sa(o.value),tt=o.type;if(_e!=null)tt==="number"?(_e===0&&a.value===""||a.value!=_e)&&(a.value=""+_e):a.value!==""+_e&&(a.value=""+_e);else if(tt==="submit"||tt==="reset"){a.removeAttribute("value");return}o.hasOwnProperty("value")?cb(a,o.type,_e):o.hasOwnProperty("defaultValue")&&cb(a,o.type,Sa(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(a.defaultChecked=!!o.defaultChecked)}function db(a,o,_e){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var tt=o.type;if(!(tt!=="submit"&&tt!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+a._wrapperState.initialValue,_e||o===a.value||(a.value=o),a.defaultValue=o}_e=a.name,_e!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,_e!==""&&(a.name=_e)}function cb(a,o,_e){(o!=="number"||Xa(a.ownerDocument)!==a)&&(_e==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+_e&&(a.defaultValue=""+_e))}var eb=Array.isArray;function fb(a,o,_e,tt){if(a=a.options,o){o={};for(var ct=0;ct<_e.length;ct++)o["$"+_e[ct]]=!0;for(_e=0;_e"+o.valueOf().toString()+"",o=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;o.firstChild;)a.appendChild(o.firstChild)}});function ob(a,o){if(o){var _e=a.firstChild;if(_e&&_e===a.lastChild&&_e.nodeType===3){_e.nodeValue=o;return}}a.textContent=o}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(a){qb.forEach(function(o){o=o+a.charAt(0).toUpperCase()+a.substring(1),pb[o]=pb[a]})});function rb(a,o,_e){return o==null||typeof o=="boolean"||o===""?"":_e||typeof o!="number"||o===0||pb.hasOwnProperty(a)&&pb[a]?(""+o).trim():o+"px"}function sb(a,o){a=a.style;for(var _e in o)if(o.hasOwnProperty(_e)){var tt=_e.indexOf("--")===0,ct=rb(_e,o[_e],tt);_e==="float"&&(_e="cssFloat"),tt?a.setProperty(_e,ct):a[_e]=ct}}var tb=A$3({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(a,o){if(o){if(tb[a]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(p$2(137,a));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(p$2(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(p$2(61))}if(o.style!=null&&typeof o.style!="object")throw Error(p$2(62))}}function vb(a,o){if(a.indexOf("-")===-1)return typeof o.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var yb=null,zb=null,Ab=null;function Bb(a){if(a=Cb(a)){if(typeof yb!="function")throw Error(p$2(280));var o=a.stateNode;o&&(o=Db(o),yb(a.stateNode,a.type,o))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,o=Ab;if(Ab=zb=null,Bb(a),o)for(a=0;a>>=0,a===0?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;function tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function uc(a,o){var _e=a.pendingLanes;if(_e===0)return 0;var tt=0,ct=a.suspendedLanes,gt=a.pingedLanes,rt=_e&268435455;if(rt!==0){var it=rt&~ct;it!==0?tt=tc(it):(gt&=rt,gt!==0&&(tt=tc(gt)))}else rt=_e&~ct,rt!==0?tt=tc(rt):gt!==0&&(tt=tc(gt));if(tt===0)return 0;if(o!==0&&o!==tt&&!(o&ct)&&(ct=tt&-tt,gt=o&-o,ct>=gt||ct===16&&(gt&4194240)!==0))return o;if(tt&4&&(tt|=_e&16),o=a.entangledLanes,o!==0)for(a=a.entanglements,o&=tt;0_e;_e++)o.push(a);return o}function Ac(a,o,_e){a.pendingLanes|=o,o!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,o=31-oc(o),a[o]=_e}function Bc(a,o){var _e=a.pendingLanes&~o;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=o,a.mutableReadLanes&=o,a.entangledLanes&=o,o=a.entanglements;var tt=a.eventTimes;for(a=a.expirationTimes;0<_e;){var ct=31-oc(_e),gt=1<=be),ee$1=String.fromCharCode(32),fe=!1;function ge(a,o){switch(a){case"keyup":return $d.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ie=!1;function je(a,o){switch(a){case"compositionend":return he(o);case"keypress":return o.which!==32?null:(fe=!0,ee$1);case"textInput":return a=o.data,a===ee$1&&fe?null:a;default:return null}}function ke(a,o){if(ie)return a==="compositionend"||!ae&&ge(a,o)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:_e,offset:o-a};a=tt}e:{for(;_e;){if(_e.nextSibling){_e=_e.nextSibling;break e}_e=_e.parentNode}_e=void 0}_e=Je(_e)}}function Le(a,o){return a&&o?a===o?!0:a&&a.nodeType===3?!1:o&&o.nodeType===3?Le(a,o.parentNode):"contains"in a?a.contains(o):a.compareDocumentPosition?!!(a.compareDocumentPosition(o)&16):!1:!1}function Me(){for(var a=window,o=Xa();o instanceof a.HTMLIFrameElement;){try{var _e=typeof o.contentWindow.location.href=="string"}catch{_e=!1}if(_e)a=o.contentWindow;else break;o=Xa(a.document)}return o}function Ne(a){var o=a&&a.nodeName&&a.nodeName.toLowerCase();return o&&(o==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||o==="textarea"||a.contentEditable==="true")}function Oe(a){var o=Me(),_e=a.focusedElem,tt=a.selectionRange;if(o!==_e&&_e&&_e.ownerDocument&&Le(_e.ownerDocument.documentElement,_e)){if(tt!==null&&Ne(_e)){if(o=tt.start,a=tt.end,a===void 0&&(a=o),"selectionStart"in _e)_e.selectionStart=o,_e.selectionEnd=Math.min(a,_e.value.length);else if(a=(o=_e.ownerDocument||document)&&o.defaultView||window,a.getSelection){a=a.getSelection();var ct=_e.textContent.length,gt=Math.min(tt.start,ct);tt=tt.end===void 0?gt:Math.min(tt.end,ct),!a.extend&>>tt&&(ct=tt,tt=gt,gt=ct),ct=Ke(_e,gt);var rt=Ke(_e,tt);ct&&rt&&(a.rangeCount!==1||a.anchorNode!==ct.node||a.anchorOffset!==ct.offset||a.focusNode!==rt.node||a.focusOffset!==rt.offset)&&(o=o.createRange(),o.setStart(ct.node,ct.offset),a.removeAllRanges(),gt>tt?(a.addRange(o),a.extend(rt.node,rt.offset)):(o.setEnd(rt.node,rt.offset),a.addRange(o)))}}for(o=[],a=_e;a=a.parentNode;)a.nodeType===1&&o.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof _e.focus=="function"&&_e.focus(),_e=0;_e=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(a,o,_e){var tt=_e.window===_e?_e.document:_e.nodeType===9?_e:_e.ownerDocument;Te||Qe==null||Qe!==Xa(tt)||(tt=Qe,"selectionStart"in tt&&Ne(tt)?tt={start:tt.selectionStart,end:tt.selectionEnd}:(tt=(tt.ownerDocument&&tt.ownerDocument.defaultView||window).getSelection(),tt={anchorNode:tt.anchorNode,anchorOffset:tt.anchorOffset,focusNode:tt.focusNode,focusOffset:tt.focusOffset}),Se&&Ie(Se,tt)||(Se=tt,tt=oe(Re,"onSelect"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(a,o){Tf++,Sf[Tf]=a.current,a.current=o}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,o){var _e=a.type.contextTypes;if(!_e)return Vf;var tt=a.stateNode;if(tt&&tt.__reactInternalMemoizedUnmaskedChildContext===o)return tt.__reactInternalMemoizedMaskedChildContext;var ct={},gt;for(gt in _e)ct[gt]=o[gt];return tt&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=o,a.__reactInternalMemoizedMaskedChildContext=ct),ct}function Zf(a){return a=a.childContextTypes,a!=null}function $f(){E$1(Wf),E$1(H)}function ag(a,o,_e){if(H.current!==Vf)throw Error(p$2(168));G$1(H,o),G$1(Wf,_e)}function bg(a,o,_e){var tt=a.stateNode;if(o=o.childContextTypes,typeof tt.getChildContext!="function")return _e;tt=tt.getChildContext();for(var ct in tt)if(!(ct in o))throw Error(p$2(108,Ra(a)||"Unknown",ct));return A$3({},_e,tt)}function cg(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G$1(H,a),G$1(Wf,Wf.current),!0}function dg(a,o,_e){var tt=a.stateNode;if(!tt)throw Error(p$2(169));_e?(a=bg(a,o,Xf),tt.__reactInternalMemoizedMergedChildContext=a,E$1(Wf),E$1(H),G$1(H,a)):E$1(Wf),G$1(Wf,_e)}var eg=null,fg=!1,gg=!1;function hg(a){eg===null?eg=[a]:eg.push(a)}function ig(a){fg=!0,hg(a)}function jg(){if(!gg&&eg!==null){gg=!0;var a=0,o=C$1;try{var _e=eg;for(C$1=1;a<_e.length;a++){var tt=_e[a];do tt=tt(!0);while(tt!==null)}eg=null,fg=!1}catch(ct){throw eg!==null&&(eg=eg.slice(a+1)),ac(fc,jg),ct}finally{C$1=o,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(a,o){kg[lg++]=ng,kg[lg++]=mg,mg=a,ng=o}function ug(a,o,_e){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=a;var tt=rg;a=sg;var ct=32-oc(tt)-1;tt&=~(1<>=rt,ct-=rt,rg=1<<32-oc(o)+ct|_e<Nt?(St=At,At=null):St=At.sibling;var wt=ht(ot,At,ft[Nt],bt);if(wt===null){At===null&&(At=St);break}a&&At&&wt.alternate===null&&o(ot,At),ut=gt(wt,ut,Nt),yt===null?vt=wt:yt.sibling=wt,yt=wt,At=St}if(Nt===ft.length)return _e(ot,At),I&&tg(ot,Nt),vt;if(At===null){for(;NtNt?(St=At,At=null):St=At.sibling;var Mt=ht(ot,At,wt.value,bt);if(Mt===null){At===null&&(At=St);break}a&&At&&Mt.alternate===null&&o(ot,At),ut=gt(Mt,ut,Nt),yt===null?vt=Mt:yt.sibling=Mt,yt=Mt,At=St}if(wt.done)return _e(ot,At),I&&tg(ot,Nt),vt;if(At===null){for(;!wt.done;Nt++,wt=ft.next())wt=at(ot,wt.value,bt),wt!==null&&(ut=gt(wt,ut,Nt),yt===null?vt=wt:yt.sibling=wt,yt=wt);return I&&tg(ot,Nt),vt}for(At=tt(ot,At);!wt.done;Nt++,wt=ft.next())wt=dt(At,ot,Nt,wt.value,bt),wt!==null&&(a&&wt.alternate!==null&&At.delete(wt.key===null?Nt:wt.key),ut=gt(wt,ut,Nt),yt===null?vt=wt:yt.sibling=wt,yt=wt);return a&&At.forEach(function(Ht){return o(ot,Ht)}),I&&tg(ot,Nt),vt}function mt(ot,ut,ft,bt){if(typeof ft=="object"&&ft!==null&&ft.type===ya&&ft.key===null&&(ft=ft.props.children),typeof ft=="object"&&ft!==null){switch(ft.$$typeof){case va:e:{for(var vt=ft.key,yt=ut;yt!==null;){if(yt.key===vt){if(vt=ft.type,vt===ya){if(yt.tag===7){_e(ot,yt.sibling),ut=ct(yt,ft.props.children),ut.return=ot,ot=ut;break e}}else if(yt.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===Ha&&uh(vt)===yt.type){_e(ot,yt.sibling),ut=ct(yt,ft.props),ut.ref=sh(ot,yt,ft),ut.return=ot,ot=ut;break e}_e(ot,yt);break}else o(ot,yt);yt=yt.sibling}ft.type===ya?(ut=Ah(ft.props.children,ot.mode,bt,ft.key),ut.return=ot,ot=ut):(bt=yh(ft.type,ft.key,ft.props,null,ot.mode,bt),bt.ref=sh(ot,ut,ft),bt.return=ot,ot=bt)}return rt(ot);case wa:e:{for(yt=ft.key;ut!==null;){if(ut.key===yt)if(ut.tag===4&&ut.stateNode.containerInfo===ft.containerInfo&&ut.stateNode.implementation===ft.implementation){_e(ot,ut.sibling),ut=ct(ut,ft.children||[]),ut.return=ot,ot=ut;break e}else{_e(ot,ut);break}else o(ot,ut);ut=ut.sibling}ut=zh(ft,ot.mode,bt),ut.return=ot,ot=ut}return rt(ot);case Ha:return yt=ft._init,mt(ot,ut,yt(ft._payload),bt)}if(eb(ft))return pt(ot,ut,ft,bt);if(Ka(ft))return lt(ot,ut,ft,bt);th(ot,ft)}return typeof ft=="string"&&ft!==""||typeof ft=="number"?(ft=""+ft,ut!==null&&ut.tag===6?(_e(ot,ut.sibling),ut=ct(ut,ft),ut.return=ot,ot=ut):(_e(ot,ut),ut=xh(ft,ot.mode,bt),ut.return=ot,ot=ut),rt(ot)):_e(ot,ut)}return mt}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p$2(174));return a}function Ih(a,o){switch(G$1(Gh,o),G$1(Fh,a),G$1(Eh,Dh),a=o.nodeType,a){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:lb(null,"");break;default:a=a===8?o.parentNode:o,o=a.namespaceURI||null,a=a.tagName,o=lb(o,a)}E$1(Eh),G$1(Eh,o)}function Jh(){E$1(Eh),E$1(Fh),E$1(Gh)}function Kh(a){Hh(Gh.current);var o=Hh(Eh.current),_e=lb(o,a.type);o!==_e&&(G$1(Fh,a),G$1(Eh,_e))}function Lh(a){Fh.current===a&&(E$1(Eh),E$1(Fh))}var M$1=Uf(0);function Mh(a){for(var o=a;o!==null;){if(o.tag===13){var _e=o.memoizedState;if(_e!==null&&(_e=_e.dehydrated,_e===null||_e.data==="$?"||_e.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if(o.flags&128)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break;for(;o.sibling===null;){if(o.return===null||o.return===a)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Nh=[];function Oh(){for(var a=0;a_e?_e:4,a(!0);var tt=Qh.transition;Qh.transition={};try{a(!1),o()}finally{C$1=_e,Qh.transition=tt}}function Fi(){return di().memoizedState}function Gi(a,o,_e){var tt=lh(a);if(_e={lane:tt,action:_e,hasEagerState:!1,eagerState:null,next:null},Hi(a))Ii(o,_e);else if(_e=Yg(a,o,_e,tt),_e!==null){var ct=L();mh(_e,a,tt,ct),Ji(_e,o,tt)}}function ri(a,o,_e){var tt=lh(a),ct={lane:tt,action:_e,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(o,ct);else{var gt=a.alternate;if(a.lanes===0&&(gt===null||gt.lanes===0)&&(gt=o.lastRenderedReducer,gt!==null))try{var rt=o.lastRenderedState,it=gt(rt,_e);if(ct.hasEagerState=!0,ct.eagerState=it,He(it,rt)){var s=o.interleaved;s===null?(ct.next=ct,Xg(o)):(ct.next=s.next,s.next=ct),o.interleaved=ct;return}}catch{}finally{}_e=Yg(a,o,ct,tt),_e!==null&&(ct=L(),mh(_e,a,tt,ct),Ji(_e,o,tt))}}function Hi(a){var o=a.alternate;return a===N$1||o!==null&&o===N$1}function Ii(a,o){Th=Sh=!0;var _e=a.pending;_e===null?o.next=o:(o.next=_e.next,_e.next=o),a.pending=o}function Ji(a,o,_e){if(_e&4194240){var tt=o.lanes;tt&=a.pendingLanes,_e|=tt,o.lanes=_e,Cc(a,_e)}}var ai={readContext:Vg,useCallback:Q$1,useContext:Q$1,useEffect:Q$1,useImperativeHandle:Q$1,useInsertionEffect:Q$1,useLayoutEffect:Q$1,useMemo:Q$1,useReducer:Q$1,useRef:Q$1,useState:Q$1,useDebugValue:Q$1,useDeferredValue:Q$1,useTransition:Q$1,useMutableSource:Q$1,useSyncExternalStore:Q$1,useId:Q$1,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,o){return ci().memoizedState=[a,o===void 0?null:o],a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,o,_e){return _e=_e!=null?_e.concat([a]):null,ti(4194308,4,yi.bind(null,o,a),_e)},useLayoutEffect:function(a,o){return ti(4194308,4,a,o)},useInsertionEffect:function(a,o){return ti(4,2,a,o)},useMemo:function(a,o){var _e=ci();return o=o===void 0?null:o,a=a(),_e.memoizedState=[a,o],a},useReducer:function(a,o,_e){var tt=ci();return o=_e!==void 0?_e(o):o,tt.memoizedState=tt.baseState=o,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:o},tt.queue=a,a=a.dispatch=Gi.bind(null,N$1,a),[tt.memoizedState,a]},useRef:function(a){var o=ci();return a={current:a},o.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),o=a[0];return a=Ei.bind(null,a[1]),ci().memoizedState=a,[o,a]},useMutableSource:function(){},useSyncExternalStore:function(a,o,_e){var tt=N$1,ct=ci();if(I){if(_e===void 0)throw Error(p$2(407));_e=_e()}else{if(_e=o(),R$1===null)throw Error(p$2(349));Rh&30||ni(tt,o,_e)}ct.memoizedState=_e;var gt={value:_e,getSnapshot:o};return ct.queue=gt,vi(ki.bind(null,tt,gt,a),[a]),tt.flags|=2048,li(9,mi.bind(null,tt,gt,_e,o),void 0,null),_e},useId:function(){var a=ci(),o=R$1.identifierPrefix;if(I){var _e=sg,tt=rg;_e=(tt&~(1<<32-oc(tt)-1)).toString(32)+_e,o=":"+o+"R"+_e,_e=Uh++,0<_e&&(o+="H"+_e.toString(32)),o+=":"}else _e=Vh++,o=":"+o+"r"+_e.toString(32)+":";return a.memoizedState=o},unstable_isNewReconciler:!1},Zh={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:fi,useRef:si,useState:function(){return fi(ei)},useDebugValue:Ai,useDeferredValue:function(a){var o=di();return Di(o,O$1.memoizedState,a)},useTransition:function(){var a=fi(ei)[0],o=di().memoizedState;return[a,o]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1},$h={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:gi,useRef:si,useState:function(){return gi(ei)},useDebugValue:Ai,useDeferredValue:function(a){var o=di();return O$1===null?o.memoizedState=a:Di(o,O$1.memoizedState,a)},useTransition:function(){var a=gi(ei)[0],o=di().memoizedState;return[a,o]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1};function Ki(a,o){try{var _e="",tt=o;do _e+=Pa(tt),tt=tt.return;while(tt);var ct=_e}catch(gt){ct=` Error generating stack: `+gt.message+` -`+gt.stack}return{value:a,source:o,stack:ct,digest:null}}function Li(a,o,_e){return{value:a,source:null,stack:_e??null,digest:o??null}}function Mi(a,o){try{console.error(o.value)}catch(_e){setTimeout(function(){throw _e})}}var Ni=typeof WeakMap=="function"?WeakMap:Map;function Oi(a,o,_e){_e=ch(-1,_e),_e.tag=3,_e.payload={element:null};var tt=o.value;return _e.callback=function(){Pi||(Pi=!0,Qi=tt),Mi(a,o)},_e}function Ri(a,o,_e){_e=ch(-1,_e),_e.tag=3;var tt=a.type.getDerivedStateFromError;if(typeof tt=="function"){var ct=o.value;_e.payload=function(){return tt(ct)},_e.callback=function(){Mi(a,o)}}var gt=a.stateNode;return gt!==null&&typeof gt.componentDidCatch=="function"&&(_e.callback=function(){Mi(a,o),typeof tt!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var rt=o.stack;this.componentDidCatch(o.value,{componentStack:rt!==null?rt:""})}),_e}function Ti(a,o,_e){var tt=a.pingCache;if(tt===null){tt=a.pingCache=new Ni;var ct=new Set;tt.set(o,ct)}else ct=tt.get(o),ct===void 0&&(ct=new Set,tt.set(o,ct));ct.has(_e)||(ct.add(_e),a=Ui.bind(null,a,o,_e),o.then(a,a))}function Vi(a){do{var o;if((o=a.tag===13)&&(o=a.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return a;a=a.return}while(a!==null);return null}function Wi(a,o,_e,tt,ct){return a.mode&1?(a.flags|=65536,a.lanes=ct,a):(a===o?a.flags|=65536:(a.flags|=128,_e.flags|=131072,_e.flags&=-52805,_e.tag===1&&(_e.alternate===null?_e.tag=17:(o=ch(-1,1),o.tag=2,dh(_e,o,1))),_e.lanes|=1),a)}var Xi=ua$1.ReactCurrentOwner,Ug=!1;function Yi(a,o,_e,tt){o.child=a===null?Ch(o,null,_e,tt):Bh(o,a.child,_e,tt)}function Zi(a,o,_e,tt,ct){_e=_e.render;var gt=o.ref;return Tg(o,ct),tt=Xh(a,o,_e,tt,gt,ct),_e=bi(),a!==null&&!Ug?(o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~ct,$i(a,o,ct)):(I&&_e&&vg(o),o.flags|=1,Yi(a,o,tt,ct),o.child)}function aj(a,o,_e,tt,ct){if(a===null){var gt=_e.type;return typeof gt=="function"&&!bj(gt)&>.defaultProps===void 0&&_e.compare===null&&_e.defaultProps===void 0?(o.tag=15,o.type=gt,cj(a,o,gt,tt,ct)):(a=yh(_e.type,null,tt,o,o.mode,ct),a.ref=o.ref,a.return=o,o.child=a)}if(gt=a.child,!(a.lanes&ct)){var rt=gt.memoizedProps;if(_e=_e.compare,_e=_e!==null?_e:Ie,_e(rt,tt)&&a.ref===o.ref)return $i(a,o,ct)}return o.flags|=1,a=wh(gt,tt),a.ref=o.ref,a.return=o,o.child=a}function cj(a,o,_e,tt,ct){if(a!==null){var gt=a.memoizedProps;if(Ie(gt,tt)&&a.ref===o.ref)if(Ug=!1,o.pendingProps=tt=gt,(a.lanes&ct)!==0)a.flags&131072&&(Ug=!0);else return o.lanes=a.lanes,$i(a,o,ct)}return dj(a,o,_e,tt,ct)}function ej(a,o,_e){var tt=o.pendingProps,ct=tt.children,gt=a!==null?a.memoizedState:null;if(tt.mode==="hidden")if(!(o.mode&1))o.memoizedState={baseLanes:0,cachePool:null,transitions:null},G$1(fj,gj),gj|=_e;else{if(!(_e&1073741824))return a=gt!==null?gt.baseLanes|_e:_e,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:a,cachePool:null,transitions:null},o.updateQueue=null,G$1(fj,gj),gj|=a,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt=gt!==null?gt.baseLanes:_e,G$1(fj,gj),gj|=tt}else gt!==null?(tt=gt.baseLanes|_e,o.memoizedState=null):tt=_e,G$1(fj,gj),gj|=tt;return Yi(a,o,ct,_e),o.child}function hj(a,o){var _e=o.ref;(a===null&&_e!==null||a!==null&&a.ref!==_e)&&(o.flags|=512,o.flags|=2097152)}function dj(a,o,_e,tt,ct){var gt=Zf(_e)?Xf:H.current;return gt=Yf(o,gt),Tg(o,ct),_e=Xh(a,o,_e,tt,gt,ct),tt=bi(),a!==null&&!Ug?(o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~ct,$i(a,o,ct)):(I&&tt&&vg(o),o.flags|=1,Yi(a,o,_e,ct),o.child)}function ij(a,o,_e,tt,ct){if(Zf(_e)){var gt=!0;cg(o)}else gt=!1;if(Tg(o,ct),o.stateNode===null)jj(a,o),ph(o,_e,tt),rh(o,_e,tt,ct),tt=!0;else if(a===null){var rt=o.stateNode,it=o.memoizedProps;rt.props=it;var s=rt.context,et=_e.contextType;typeof et=="object"&&et!==null?et=Vg(et):(et=Zf(_e)?Xf:H.current,et=Yf(o,et));var nt=_e.getDerivedStateFromProps,at=typeof nt=="function"||typeof rt.getSnapshotBeforeUpdate=="function";at||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(it!==tt||s!==et)&&qh(o,rt,tt,et),$g=!1;var ht=o.memoizedState;rt.state=ht,gh(o,tt,rt,ct),s=o.memoizedState,it!==tt||ht!==s||Wf.current||$g?(typeof nt=="function"&&(kh(o,_e,nt,tt),s=o.memoizedState),(it=$g||oh(o,_e,it,tt,ht,s,et))?(at||typeof rt.UNSAFE_componentWillMount!="function"&&typeof rt.componentWillMount!="function"||(typeof rt.componentWillMount=="function"&&rt.componentWillMount(),typeof rt.UNSAFE_componentWillMount=="function"&&rt.UNSAFE_componentWillMount()),typeof rt.componentDidMount=="function"&&(o.flags|=4194308)):(typeof rt.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=tt,o.memoizedState=s),rt.props=tt,rt.state=s,rt.context=et,tt=it):(typeof rt.componentDidMount=="function"&&(o.flags|=4194308),tt=!1)}else{rt=o.stateNode,bh(a,o),it=o.memoizedProps,et=o.type===o.elementType?it:Lg(o.type,it),rt.props=et,at=o.pendingProps,ht=rt.context,s=_e.contextType,typeof s=="object"&&s!==null?s=Vg(s):(s=Zf(_e)?Xf:H.current,s=Yf(o,s));var dt=_e.getDerivedStateFromProps;(nt=typeof dt=="function"||typeof rt.getSnapshotBeforeUpdate=="function")||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(it!==at||ht!==s)&&qh(o,rt,tt,s),$g=!1,ht=o.memoizedState,rt.state=ht,gh(o,tt,rt,ct);var ut=o.memoizedState;it!==at||ht!==ut||Wf.current||$g?(typeof dt=="function"&&(kh(o,_e,dt,tt),ut=o.memoizedState),(et=$g||oh(o,_e,et,tt,ht,ut,s)||!1)?(nt||typeof rt.UNSAFE_componentWillUpdate!="function"&&typeof rt.componentWillUpdate!="function"||(typeof rt.componentWillUpdate=="function"&&rt.componentWillUpdate(tt,ut,s),typeof rt.UNSAFE_componentWillUpdate=="function"&&rt.UNSAFE_componentWillUpdate(tt,ut,s)),typeof rt.componentDidUpdate=="function"&&(o.flags|=4),typeof rt.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof rt.componentDidUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=1024),o.memoizedProps=tt,o.memoizedState=ut),rt.props=tt,rt.state=ut,rt.context=s,tt=et):(typeof rt.componentDidUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=1024),tt=!1)}return kj(a,o,_e,tt,gt,ct)}function kj(a,o,_e,tt,ct,gt){hj(a,o);var rt=(o.flags&128)!==0;if(!tt&&!rt)return ct&&dg(o,_e,!1),$i(a,o,gt);tt=o.stateNode,Xi.current=o;var it=rt&&typeof _e.getDerivedStateFromError!="function"?null:tt.render();return o.flags|=1,a!==null&&rt?(o.child=Bh(o,a.child,null,gt),o.child=Bh(o,null,it,gt)):Yi(a,o,it,gt),o.memoizedState=tt.state,ct&&dg(o,_e,!0),o.child}function lj(a){var o=a.stateNode;o.pendingContext?ag(a,o.pendingContext,o.pendingContext!==o.context):o.context&&ag(a,o.context,!1),Ih(a,o.containerInfo)}function mj(a,o,_e,tt,ct){return Ig(),Jg(ct),o.flags|=256,Yi(a,o,_e,tt),o.child}var nj={dehydrated:null,treeContext:null,retryLane:0};function oj(a){return{baseLanes:a,cachePool:null,transitions:null}}function pj(a,o,_e){var tt=o.pendingProps,ct=M$1.current,gt=!1,rt=(o.flags&128)!==0,it;if((it=rt)||(it=a!==null&&a.memoizedState===null?!1:(ct&2)!==0),it?(gt=!0,o.flags&=-129):(a===null||a.memoizedState!==null)&&(ct|=1),G$1(M$1,ct&1),a===null)return Eg(o),a=o.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?(o.mode&1?a.data==="$!"?o.lanes=8:o.lanes=1073741824:o.lanes=1,null):(rt=tt.children,a=tt.fallback,gt?(tt=o.mode,gt=o.child,rt={mode:"hidden",children:rt},!(tt&1)&>!==null?(gt.childLanes=0,gt.pendingProps=rt):gt=qj(rt,tt,0,null),a=Ah(a,tt,_e,null),gt.return=o,a.return=o,gt.sibling=a,o.child=gt,o.child.memoizedState=oj(_e),o.memoizedState=nj,a):rj(o,rt));if(ct=a.memoizedState,ct!==null&&(it=ct.dehydrated,it!==null))return sj(a,o,rt,tt,it,ct,_e);if(gt){gt=tt.fallback,rt=o.mode,ct=a.child,it=ct.sibling;var s={mode:"hidden",children:tt.children};return!(rt&1)&&o.child!==ct?(tt=o.child,tt.childLanes=0,tt.pendingProps=s,o.deletions=null):(tt=wh(ct,s),tt.subtreeFlags=ct.subtreeFlags&14680064),it!==null?gt=wh(it,gt):(gt=Ah(gt,rt,_e,null),gt.flags|=2),gt.return=o,tt.return=o,tt.sibling=gt,o.child=tt,tt=gt,gt=o.child,rt=a.child.memoizedState,rt=rt===null?oj(_e):{baseLanes:rt.baseLanes|_e,cachePool:null,transitions:rt.transitions},gt.memoizedState=rt,gt.childLanes=a.childLanes&~_e,o.memoizedState=nj,tt}return gt=a.child,a=gt.sibling,tt=wh(gt,{mode:"visible",children:tt.children}),!(o.mode&1)&&(tt.lanes=_e),tt.return=o,tt.sibling=null,a!==null&&(_e=o.deletions,_e===null?(o.deletions=[a],o.flags|=16):_e.push(a)),o.child=tt,o.memoizedState=null,tt}function rj(a,o){return o=qj({mode:"visible",children:o},a.mode,0,null),o.return=a,a.child=o}function tj(a,o,_e,tt){return tt!==null&&Jg(tt),Bh(o,a.child,null,_e),a=rj(o,o.pendingProps.children),a.flags|=2,o.memoizedState=null,a}function sj(a,o,_e,tt,ct,gt,rt){if(_e)return o.flags&256?(o.flags&=-257,tt=Li(Error(p$2(422))),tj(a,o,rt,tt)):o.memoizedState!==null?(o.child=a.child,o.flags|=128,null):(gt=tt.fallback,ct=o.mode,tt=qj({mode:"visible",children:tt.children},ct,0,null),gt=Ah(gt,ct,rt,null),gt.flags|=2,tt.return=o,gt.return=o,tt.sibling=gt,o.child=tt,o.mode&1&&Bh(o,a.child,null,rt),o.child.memoizedState=oj(rt),o.memoizedState=nj,gt);if(!(o.mode&1))return tj(a,o,rt,null);if(ct.data==="$!"){if(tt=ct.nextSibling&&ct.nextSibling.dataset,tt)var it=tt.dgst;return tt=it,gt=Error(p$2(419)),tt=Li(gt,tt,void 0),tj(a,o,rt,tt)}if(it=(rt&a.childLanes)!==0,Ug||it){if(tt=R$1,tt!==null){switch(rt&-rt){case 4:ct=2;break;case 16:ct=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:ct=32;break;case 536870912:ct=268435456;break;default:ct=0}ct=ct&(tt.suspendedLanes|rt)?0:ct,ct!==0&&ct!==gt.retryLane&&(gt.retryLane=ct,Zg(a,ct),mh(tt,a,ct,-1))}return uj(),tt=Li(Error(p$2(421))),tj(a,o,rt,tt)}return ct.data==="$?"?(o.flags|=128,o.child=a.child,o=vj.bind(null,a),ct._reactRetry=o,null):(a=gt.treeContext,yg=Lf(ct.nextSibling),xg=o,I=!0,zg=null,a!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=a.id,sg=a.overflow,qg=o),o=rj(o,tt.children),o.flags|=4096,o)}function wj(a,o,_e){a.lanes|=o;var tt=a.alternate;tt!==null&&(tt.lanes|=o),Sg(a.return,o,_e)}function xj(a,o,_e,tt,ct){var gt=a.memoizedState;gt===null?a.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:tt,tail:_e,tailMode:ct}:(gt.isBackwards=o,gt.rendering=null,gt.renderingStartTime=0,gt.last=tt,gt.tail=_e,gt.tailMode=ct)}function yj(a,o,_e){var tt=o.pendingProps,ct=tt.revealOrder,gt=tt.tail;if(Yi(a,o,tt.children,_e),tt=M$1.current,tt&2)tt=tt&1|2,o.flags|=128;else{if(a!==null&&a.flags&128)e:for(a=o.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&wj(a,_e,o);else if(a.tag===19)wj(a,_e,o);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}tt&=1}if(G$1(M$1,tt),!(o.mode&1))o.memoizedState=null;else switch(ct){case"forwards":for(_e=o.child,ct=null;_e!==null;)a=_e.alternate,a!==null&&Mh(a)===null&&(ct=_e),_e=_e.sibling;_e=ct,_e===null?(ct=o.child,o.child=null):(ct=_e.sibling,_e.sibling=null),xj(o,!1,ct,_e,gt);break;case"backwards":for(_e=null,ct=o.child,o.child=null;ct!==null;){if(a=ct.alternate,a!==null&&Mh(a)===null){o.child=ct;break}a=ct.sibling,ct.sibling=_e,_e=ct,ct=a}xj(o,!0,_e,null,gt);break;case"together":xj(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function jj(a,o){!(o.mode&1)&&a!==null&&(a.alternate=null,o.alternate=null,o.flags|=2)}function $i(a,o,_e){if(a!==null&&(o.dependencies=a.dependencies),hh|=o.lanes,!(_e&o.childLanes))return null;if(a!==null&&o.child!==a.child)throw Error(p$2(153));if(o.child!==null){for(a=o.child,_e=wh(a,a.pendingProps),o.child=_e,_e.return=o;a.sibling!==null;)a=a.sibling,_e=_e.sibling=wh(a,a.pendingProps),_e.return=o;_e.sibling=null}return o.child}function zj(a,o,_e){switch(o.tag){case 3:lj(o),Ig();break;case 5:Kh(o);break;case 1:Zf(o.type)&&cg(o);break;case 4:Ih(o,o.stateNode.containerInfo);break;case 10:var tt=o.type._context,ct=o.memoizedProps.value;G$1(Mg,tt._currentValue),tt._currentValue=ct;break;case 13:if(tt=o.memoizedState,tt!==null)return tt.dehydrated!==null?(G$1(M$1,M$1.current&1),o.flags|=128,null):_e&o.child.childLanes?pj(a,o,_e):(G$1(M$1,M$1.current&1),a=$i(a,o,_e),a!==null?a.sibling:null);G$1(M$1,M$1.current&1);break;case 19:if(tt=(_e&o.childLanes)!==0,a.flags&128){if(tt)return yj(a,o,_e);o.flags|=128}if(ct=o.memoizedState,ct!==null&&(ct.rendering=null,ct.tail=null,ct.lastEffect=null),G$1(M$1,M$1.current),tt)break;return null;case 22:case 23:return o.lanes=0,ej(a,o,_e)}return $i(a,o,_e)}var Aj,Bj,Cj,Dj;Aj=function(a,o){for(var _e=o.child;_e!==null;){if(_e.tag===5||_e.tag===6)a.appendChild(_e.stateNode);else if(_e.tag!==4&&_e.child!==null){_e.child.return=_e,_e=_e.child;continue}if(_e===o)break;for(;_e.sibling===null;){if(_e.return===null||_e.return===o)return;_e=_e.return}_e.sibling.return=_e.return,_e=_e.sibling}};Bj=function(){};Cj=function(a,o,_e,tt){var ct=a.memoizedProps;if(ct!==tt){a=o.stateNode,Hh(Eh.current);var gt=null;switch(_e){case"input":ct=Ya(a,ct),tt=Ya(a,tt),gt=[];break;case"select":ct=A$3({},ct,{value:void 0}),tt=A$3({},tt,{value:void 0}),gt=[];break;case"textarea":ct=gb(a,ct),tt=gb(a,tt),gt=[];break;default:typeof ct.onClick!="function"&&typeof tt.onClick=="function"&&(a.onclick=Bf)}ub(_e,tt);var rt;_e=null;for(et in ct)if(!tt.hasOwnProperty(et)&&ct.hasOwnProperty(et)&&ct[et]!=null)if(et==="style"){var it=ct[et];for(rt in it)it.hasOwnProperty(rt)&&(_e||(_e={}),_e[rt]="")}else et!=="dangerouslySetInnerHTML"&&et!=="children"&&et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&et!=="autoFocus"&&(ea.hasOwnProperty(et)?gt||(gt=[]):(gt=gt||[]).push(et,null));for(et in tt){var s=tt[et];if(it=ct!=null?ct[et]:void 0,tt.hasOwnProperty(et)&&s!==it&&(s!=null||it!=null))if(et==="style")if(it){for(rt in it)!it.hasOwnProperty(rt)||s&&s.hasOwnProperty(rt)||(_e||(_e={}),_e[rt]="");for(rt in s)s.hasOwnProperty(rt)&&it[rt]!==s[rt]&&(_e||(_e={}),_e[rt]=s[rt])}else _e||(gt||(gt=[]),gt.push(et,_e)),_e=s;else et==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,it=it?it.__html:void 0,s!=null&&it!==s&&(gt=gt||[]).push(et,s)):et==="children"?typeof s!="string"&&typeof s!="number"||(gt=gt||[]).push(et,""+s):et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&(ea.hasOwnProperty(et)?(s!=null&&et==="onScroll"&&D$1("scroll",a),gt||it===s||(gt=[])):(gt=gt||[]).push(et,s))}_e&&(gt=gt||[]).push("style",_e);var et=gt;(o.updateQueue=et)&&(o.flags|=4)}};Dj=function(a,o,_e,tt){_e!==tt&&(o.flags|=4)};function Ej(a,o){if(!I)switch(a.tailMode){case"hidden":o=a.tail;for(var _e=null;o!==null;)o.alternate!==null&&(_e=o),o=o.sibling;_e===null?a.tail=null:_e.sibling=null;break;case"collapsed":_e=a.tail;for(var tt=null;_e!==null;)_e.alternate!==null&&(tt=_e),_e=_e.sibling;tt===null?o||a.tail===null?a.tail=null:a.tail.sibling=null:tt.sibling=null}}function S$2(a){var o=a.alternate!==null&&a.alternate.child===a.child,_e=0,tt=0;if(o)for(var ct=a.child;ct!==null;)_e|=ct.lanes|ct.childLanes,tt|=ct.subtreeFlags&14680064,tt|=ct.flags&14680064,ct.return=a,ct=ct.sibling;else for(ct=a.child;ct!==null;)_e|=ct.lanes|ct.childLanes,tt|=ct.subtreeFlags,tt|=ct.flags,ct.return=a,ct=ct.sibling;return a.subtreeFlags|=tt,a.childLanes=_e,o}function Fj(a,o,_e){var tt=o.pendingProps;switch(wg(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$2(o),null;case 1:return Zf(o.type)&&$f(),S$2(o),null;case 3:return tt=o.stateNode,Jh(),E$1(Wf),E$1(H),Oh(),tt.pendingContext&&(tt.context=tt.pendingContext,tt.pendingContext=null),(a===null||a.child===null)&&(Gg(o)?o.flags|=4:a===null||a.memoizedState.isDehydrated&&!(o.flags&256)||(o.flags|=1024,zg!==null&&(Gj(zg),zg=null))),Bj(a,o),S$2(o),null;case 5:Lh(o);var ct=Hh(Gh.current);if(_e=o.type,a!==null&&o.stateNode!=null)Cj(a,o,_e,tt,ct),a.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!tt){if(o.stateNode===null)throw Error(p$2(166));return S$2(o),null}if(a=Hh(Eh.current),Gg(o)){tt=o.stateNode,_e=o.type;var gt=o.memoizedProps;switch(tt[Of]=o,tt[Pf]=gt,a=(o.mode&1)!==0,_e){case"dialog":D$1("cancel",tt),D$1("close",tt);break;case"iframe":case"object":case"embed":D$1("load",tt);break;case"video":case"audio":for(ct=0;ct<\/script>",a=a.removeChild(a.firstChild)):typeof tt.is=="string"?a=rt.createElement(_e,{is:tt.is}):(a=rt.createElement(_e),_e==="select"&&(rt=a,tt.multiple?rt.multiple=!0:tt.size&&(rt.size=tt.size))):a=rt.createElementNS(a,_e),a[Of]=o,a[Pf]=tt,Aj(a,o,!1,!1),o.stateNode=a;e:{switch(rt=vb(_e,tt),_e){case"dialog":D$1("cancel",a),D$1("close",a),ct=tt;break;case"iframe":case"object":case"embed":D$1("load",a),ct=tt;break;case"video":case"audio":for(ct=0;ctHj&&(o.flags|=128,tt=!0,Ej(gt,!1),o.lanes=4194304)}else{if(!tt)if(a=Mh(rt),a!==null){if(o.flags|=128,tt=!0,_e=a.updateQueue,_e!==null&&(o.updateQueue=_e,o.flags|=4),Ej(gt,!0),gt.tail===null&>.tailMode==="hidden"&&!rt.alternate&&!I)return S$2(o),null}else 2*B$1()-gt.renderingStartTime>Hj&&_e!==1073741824&&(o.flags|=128,tt=!0,Ej(gt,!1),o.lanes=4194304);gt.isBackwards?(rt.sibling=o.child,o.child=rt):(_e=gt.last,_e!==null?_e.sibling=rt:o.child=rt,gt.last=rt)}return gt.tail!==null?(o=gt.tail,gt.rendering=o,gt.tail=o.sibling,gt.renderingStartTime=B$1(),o.sibling=null,_e=M$1.current,G$1(M$1,tt?_e&1|2:_e&1),o):(S$2(o),null);case 22:case 23:return Ij(),tt=o.memoizedState!==null,a!==null&&a.memoizedState!==null!==tt&&(o.flags|=8192),tt&&o.mode&1?gj&1073741824&&(S$2(o),o.subtreeFlags&6&&(o.flags|=8192)):S$2(o),null;case 24:return null;case 25:return null}throw Error(p$2(156,o.tag))}function Jj(a,o){switch(wg(o),o.tag){case 1:return Zf(o.type)&&$f(),a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 3:return Jh(),E$1(Wf),E$1(H),Oh(),a=o.flags,a&65536&&!(a&128)?(o.flags=a&-65537|128,o):null;case 5:return Lh(o),null;case 13:if(E$1(M$1),a=o.memoizedState,a!==null&&a.dehydrated!==null){if(o.alternate===null)throw Error(p$2(340));Ig()}return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 19:return E$1(M$1),null;case 4:return Jh(),null;case 10:return Rg(o.type._context),null;case 22:case 23:return Ij(),null;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Mj(a,o){var _e=a.ref;if(_e!==null)if(typeof _e=="function")try{_e(null)}catch(tt){W$2(a,o,tt)}else _e.current=null}function Nj(a,o,_e){try{_e()}catch(tt){W$2(a,o,tt)}}var Oj=!1;function Pj(a,o){if(Cf=dd,a=Me(),Ne(a)){if("selectionStart"in a)var _e={start:a.selectionStart,end:a.selectionEnd};else e:{_e=(_e=a.ownerDocument)&&_e.defaultView||window;var tt=_e.getSelection&&_e.getSelection();if(tt&&tt.rangeCount!==0){_e=tt.anchorNode;var ct=tt.anchorOffset,gt=tt.focusNode;tt=tt.focusOffset;try{_e.nodeType,gt.nodeType}catch{_e=null;break e}var rt=0,it=-1,s=-1,et=0,nt=0,at=a,ht=null;t:for(;;){for(var dt;at!==_e||ct!==0&&at.nodeType!==3||(it=rt+ct),at!==gt||tt!==0&&at.nodeType!==3||(s=rt+tt),at.nodeType===3&&(rt+=at.nodeValue.length),(dt=at.firstChild)!==null;)ht=at,at=dt;for(;;){if(at===a)break t;if(ht===_e&&++et===ct&&(it=rt),ht===gt&&++nt===tt&&(s=rt),(dt=at.nextSibling)!==null)break;at=ht,ht=at.parentNode}at=dt}_e=it===-1||s===-1?null:{start:it,end:s}}else _e=null}_e=_e||{start:0,end:0}}else _e=null;for(Df={focusedElem:a,selectionRange:_e},dd=!1,V=o;V!==null;)if(o=V,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,V=a;else for(;V!==null;){o=V;try{var ut=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ut!==null){var lt=ut.memoizedProps,mt=ut.memoizedState,ot=o.stateNode,pt=ot.getSnapshotBeforeUpdate(o.elementType===o.type?lt:Lg(o.type,lt),mt);ot.__reactInternalSnapshotBeforeUpdate=pt}break;case 3:var ft=o.stateNode.containerInfo;ft.nodeType===1?ft.textContent="":ft.nodeType===9&&ft.documentElement&&ft.removeChild(ft.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163))}}catch(yt){W$2(o,o.return,yt)}if(a=o.sibling,a!==null){a.return=o.return,V=a;break}V=o.return}return ut=Oj,Oj=!1,ut}function Qj(a,o,_e){var tt=o.updateQueue;if(tt=tt!==null?tt.lastEffect:null,tt!==null){var ct=tt=tt.next;do{if((ct.tag&a)===a){var gt=ct.destroy;ct.destroy=void 0,gt!==void 0&&Nj(o,_e,gt)}ct=ct.next}while(ct!==tt)}}function Rj(a,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var _e=o=o.next;do{if((_e.tag&a)===a){var tt=_e.create;_e.destroy=tt()}_e=_e.next}while(_e!==o)}}function Sj(a){var o=a.ref;if(o!==null){var _e=a.stateNode;switch(a.tag){case 5:a=_e;break;default:a=_e}typeof o=="function"?o(a):o.current=a}}function Tj(a){var o=a.alternate;o!==null&&(a.alternate=null,Tj(o)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(o=a.stateNode,o!==null&&(delete o[Of],delete o[Pf],delete o[of],delete o[Qf],delete o[Rf])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Uj(a){return a.tag===5||a.tag===3||a.tag===4}function Vj(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Uj(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Wj(a,o,_e){var tt=a.tag;if(tt===5||tt===6)a=a.stateNode,o?_e.nodeType===8?_e.parentNode.insertBefore(a,o):_e.insertBefore(a,o):(_e.nodeType===8?(o=_e.parentNode,o.insertBefore(a,_e)):(o=_e,o.appendChild(a)),_e=_e._reactRootContainer,_e!=null||o.onclick!==null||(o.onclick=Bf));else if(tt!==4&&(a=a.child,a!==null))for(Wj(a,o,_e),a=a.sibling;a!==null;)Wj(a,o,_e),a=a.sibling}function Xj(a,o,_e){var tt=a.tag;if(tt===5||tt===6)a=a.stateNode,o?_e.insertBefore(a,o):_e.appendChild(a);else if(tt!==4&&(a=a.child,a!==null))for(Xj(a,o,_e),a=a.sibling;a!==null;)Xj(a,o,_e),a=a.sibling}var X$1=null,Yj=!1;function Zj(a,o,_e){for(_e=_e.child;_e!==null;)ak(a,o,_e),_e=_e.sibling}function ak(a,o,_e){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,_e)}catch{}switch(_e.tag){case 5:U||Mj(_e,o);case 6:var tt=X$1,ct=Yj;X$1=null,Zj(a,o,_e),X$1=tt,Yj=ct,X$1!==null&&(Yj?(a=X$1,_e=_e.stateNode,a.nodeType===8?a.parentNode.removeChild(_e):a.removeChild(_e)):X$1.removeChild(_e.stateNode));break;case 18:X$1!==null&&(Yj?(a=X$1,_e=_e.stateNode,a.nodeType===8?Kf(a.parentNode,_e):a.nodeType===1&&Kf(a,_e),bd(a)):Kf(X$1,_e.stateNode));break;case 4:tt=X$1,ct=Yj,X$1=_e.stateNode.containerInfo,Yj=!0,Zj(a,o,_e),X$1=tt,Yj=ct;break;case 0:case 11:case 14:case 15:if(!U&&(tt=_e.updateQueue,tt!==null&&(tt=tt.lastEffect,tt!==null))){ct=tt=tt.next;do{var gt=ct,rt=gt.destroy;gt=gt.tag,rt!==void 0&&(gt&2||gt&4)&&Nj(_e,o,rt),ct=ct.next}while(ct!==tt)}Zj(a,o,_e);break;case 1:if(!U&&(Mj(_e,o),tt=_e.stateNode,typeof tt.componentWillUnmount=="function"))try{tt.props=_e.memoizedProps,tt.state=_e.memoizedState,tt.componentWillUnmount()}catch(it){W$2(_e,o,it)}Zj(a,o,_e);break;case 21:Zj(a,o,_e);break;case 22:_e.mode&1?(U=(tt=U)||_e.memoizedState!==null,Zj(a,o,_e),U=tt):Zj(a,o,_e);break;default:Zj(a,o,_e)}}function bk(a){var o=a.updateQueue;if(o!==null){a.updateQueue=null;var _e=a.stateNode;_e===null&&(_e=a.stateNode=new Lj),o.forEach(function(tt){var ct=ck.bind(null,a,tt);_e.has(tt)||(_e.add(tt),tt.then(ct,ct))})}}function dk(a,o){var _e=o.deletions;if(_e!==null)for(var tt=0;tt<_e.length;tt++){var ct=_e[tt];try{var gt=a,rt=o,it=rt;e:for(;it!==null;){switch(it.tag){case 5:X$1=it.stateNode,Yj=!1;break e;case 3:X$1=it.stateNode.containerInfo,Yj=!0;break e;case 4:X$1=it.stateNode.containerInfo,Yj=!0;break e}it=it.return}if(X$1===null)throw Error(p$2(160));ak(gt,rt,ct),X$1=null,Yj=!1;var s=ct.alternate;s!==null&&(s.return=null),ct.return=null}catch(et){W$2(ct,o,et)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)ek(o,a),o=o.sibling}function ek(a,o){var _e=a.alternate,tt=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(dk(o,a),fk(a),tt&4){try{Qj(3,a,a.return),Rj(3,a)}catch(lt){W$2(a,a.return,lt)}try{Qj(5,a,a.return)}catch(lt){W$2(a,a.return,lt)}}break;case 1:dk(o,a),fk(a),tt&512&&_e!==null&&Mj(_e,_e.return);break;case 5:if(dk(o,a),fk(a),tt&512&&_e!==null&&Mj(_e,_e.return),a.flags&32){var ct=a.stateNode;try{ob(ct,"")}catch(lt){W$2(a,a.return,lt)}}if(tt&4&&(ct=a.stateNode,ct!=null)){var gt=a.memoizedProps,rt=_e!==null?_e.memoizedProps:gt,it=a.type,s=a.updateQueue;if(a.updateQueue=null,s!==null)try{it==="input"&>.type==="radio"&>.name!=null&&ab(ct,gt),vb(it,rt);var et=vb(it,gt);for(rt=0;rtct&&(ct=rt),tt&=~gt}if(tt=ct,tt=B$1()-tt,tt=(120>tt?120:480>tt?480:1080>tt?1080:1920>tt?1920:3e3>tt?3e3:4320>tt?4320:1960*mk(tt/1960))-tt,10a?16:a,xk===null)var tt=!1;else{if(a=xk,xk=null,yk=0,K$1&6)throw Error(p$2(331));var ct=K$1;for(K$1|=4,V=a.current;V!==null;){var gt=V,rt=gt.child;if(V.flags&16){var it=gt.deletions;if(it!==null){for(var s=0;sB$1()-gk?Lk(a,0):sk|=_e),Ek(a,o)}function Zk(a,o){o===0&&(a.mode&1?(o=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):o=1);var _e=L();a=Zg(a,o),a!==null&&(Ac(a,o,_e),Ek(a,_e))}function vj(a){var o=a.memoizedState,_e=0;o!==null&&(_e=o.retryLane),Zk(a,_e)}function ck(a,o){var _e=0;switch(a.tag){case 13:var tt=a.stateNode,ct=a.memoizedState;ct!==null&&(_e=ct.retryLane);break;case 19:tt=a.stateNode;break;default:throw Error(p$2(314))}tt!==null&&tt.delete(o),Zk(a,_e)}var Wk;Wk=function(a,o,_e){if(a!==null)if(a.memoizedProps!==o.pendingProps||Wf.current)Ug=!0;else{if(!(a.lanes&_e)&&!(o.flags&128))return Ug=!1,zj(a,o,_e);Ug=!!(a.flags&131072)}else Ug=!1,I&&o.flags&1048576&&ug(o,ng,o.index);switch(o.lanes=0,o.tag){case 2:var tt=o.type;jj(a,o),a=o.pendingProps;var ct=Yf(o,H.current);Tg(o,_e),ct=Xh(null,o,tt,a,ct,_e);var gt=bi();return o.flags|=1,typeof ct=="object"&&ct!==null&&typeof ct.render=="function"&&ct.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Zf(tt)?(gt=!0,cg(o)):gt=!1,o.memoizedState=ct.state!==null&&ct.state!==void 0?ct.state:null,ah(o),ct.updater=nh,o.stateNode=ct,ct._reactInternals=o,rh(o,tt,a,_e),o=kj(null,o,tt,!0,gt,_e)):(o.tag=0,I&>&&vg(o),Yi(null,o,ct,_e),o=o.child),o;case 16:tt=o.elementType;e:{switch(jj(a,o),a=o.pendingProps,ct=tt._init,tt=ct(tt._payload),o.type=tt,ct=o.tag=$k(tt),a=Lg(tt,a),ct){case 0:o=dj(null,o,tt,a,_e);break e;case 1:o=ij(null,o,tt,a,_e);break e;case 11:o=Zi(null,o,tt,a,_e);break e;case 14:o=aj(null,o,tt,Lg(tt.type,a),_e);break e}throw Error(p$2(306,tt,""))}return o;case 0:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),dj(a,o,tt,ct,_e);case 1:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),ij(a,o,tt,ct,_e);case 3:e:{if(lj(o),a===null)throw Error(p$2(387));tt=o.pendingProps,gt=o.memoizedState,ct=gt.element,bh(a,o),gh(o,tt,null,_e);var rt=o.memoizedState;if(tt=rt.element,gt.isDehydrated)if(gt={element:tt,isDehydrated:!1,cache:rt.cache,pendingSuspenseBoundaries:rt.pendingSuspenseBoundaries,transitions:rt.transitions},o.updateQueue.baseState=gt,o.memoizedState=gt,o.flags&256){ct=Ki(Error(p$2(423)),o),o=mj(a,o,tt,_e,ct);break e}else if(tt!==ct){ct=Ki(Error(p$2(424)),o),o=mj(a,o,tt,_e,ct);break e}else for(yg=Lf(o.stateNode.containerInfo.firstChild),xg=o,I=!0,zg=null,_e=Ch(o,null,tt,_e),o.child=_e;_e;)_e.flags=_e.flags&-3|4096,_e=_e.sibling;else{if(Ig(),tt===ct){o=$i(a,o,_e);break e}Yi(a,o,tt,_e)}o=o.child}return o;case 5:return Kh(o),a===null&&Eg(o),tt=o.type,ct=o.pendingProps,gt=a!==null?a.memoizedProps:null,rt=ct.children,Ef(tt,ct)?rt=null:gt!==null&&Ef(tt,gt)&&(o.flags|=32),hj(a,o),Yi(a,o,rt,_e),o.child;case 6:return a===null&&Eg(o),null;case 13:return pj(a,o,_e);case 4:return Ih(o,o.stateNode.containerInfo),tt=o.pendingProps,a===null?o.child=Bh(o,null,tt,_e):Yi(a,o,tt,_e),o.child;case 11:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),Zi(a,o,tt,ct,_e);case 7:return Yi(a,o,o.pendingProps,_e),o.child;case 8:return Yi(a,o,o.pendingProps.children,_e),o.child;case 12:return Yi(a,o,o.pendingProps.children,_e),o.child;case 10:e:{if(tt=o.type._context,ct=o.pendingProps,gt=o.memoizedProps,rt=ct.value,G$1(Mg,tt._currentValue),tt._currentValue=rt,gt!==null)if(He(gt.value,rt)){if(gt.children===ct.children&&!Wf.current){o=$i(a,o,_e);break e}}else for(gt=o.child,gt!==null&&(gt.return=o);gt!==null;){var it=gt.dependencies;if(it!==null){rt=gt.child;for(var s=it.firstContext;s!==null;){if(s.context===tt){if(gt.tag===1){s=ch(-1,_e&-_e),s.tag=2;var et=gt.updateQueue;if(et!==null){et=et.shared;var nt=et.pending;nt===null?s.next=s:(s.next=nt.next,nt.next=s),et.pending=s}}gt.lanes|=_e,s=gt.alternate,s!==null&&(s.lanes|=_e),Sg(gt.return,_e,o),it.lanes|=_e;break}s=s.next}}else if(gt.tag===10)rt=gt.type===o.type?null:gt.child;else if(gt.tag===18){if(rt=gt.return,rt===null)throw Error(p$2(341));rt.lanes|=_e,it=rt.alternate,it!==null&&(it.lanes|=_e),Sg(rt,_e,o),rt=gt.sibling}else rt=gt.child;if(rt!==null)rt.return=gt;else for(rt=gt;rt!==null;){if(rt===o){rt=null;break}if(gt=rt.sibling,gt!==null){gt.return=rt.return,rt=gt;break}rt=rt.return}gt=rt}Yi(a,o,ct.children,_e),o=o.child}return o;case 9:return ct=o.type,tt=o.pendingProps.children,Tg(o,_e),ct=Vg(ct),tt=tt(ct),o.flags|=1,Yi(a,o,tt,_e),o.child;case 14:return tt=o.type,ct=Lg(tt,o.pendingProps),ct=Lg(tt.type,ct),aj(a,o,tt,ct,_e);case 15:return cj(a,o,o.type,o.pendingProps,_e);case 17:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),jj(a,o),o.tag=1,Zf(tt)?(a=!0,cg(o)):a=!1,Tg(o,_e),ph(o,tt,ct),rh(o,tt,ct,_e),kj(null,o,tt,!0,a,_e);case 19:return yj(a,o,_e);case 22:return ej(a,o,_e)}throw Error(p$2(156,o.tag))};function Gk(a,o){return ac(a,o)}function al(a,o,_e,tt){this.tag=a,this.key=_e,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=tt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(a,o,_e,tt){return new al(a,o,_e,tt)}function bj(a){return a=a.prototype,!(!a||!a.isReactComponent)}function $k(a){if(typeof a=="function")return bj(a)?1:0;if(a!=null){if(a=a.$$typeof,a===Da)return 11;if(a===Ga)return 14}return 2}function wh(a,o){var _e=a.alternate;return _e===null?(_e=Bg(a.tag,o,a.key,a.mode),_e.elementType=a.elementType,_e.type=a.type,_e.stateNode=a.stateNode,_e.alternate=a,a.alternate=_e):(_e.pendingProps=o,_e.type=a.type,_e.flags=0,_e.subtreeFlags=0,_e.deletions=null),_e.flags=a.flags&14680064,_e.childLanes=a.childLanes,_e.lanes=a.lanes,_e.child=a.child,_e.memoizedProps=a.memoizedProps,_e.memoizedState=a.memoizedState,_e.updateQueue=a.updateQueue,o=a.dependencies,_e.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},_e.sibling=a.sibling,_e.index=a.index,_e.ref=a.ref,_e}function yh(a,o,_e,tt,ct,gt){var rt=2;if(tt=a,typeof a=="function")bj(a)&&(rt=1);else if(typeof a=="string")rt=5;else e:switch(a){case ya:return Ah(_e.children,ct,gt,o);case za:rt=8,ct|=8;break;case Aa:return a=Bg(12,_e,o,ct|2),a.elementType=Aa,a.lanes=gt,a;case Ea:return a=Bg(13,_e,o,ct),a.elementType=Ea,a.lanes=gt,a;case Fa:return a=Bg(19,_e,o,ct),a.elementType=Fa,a.lanes=gt,a;case Ia:return qj(_e,ct,gt,o);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case Ba:rt=10;break e;case Ca:rt=9;break e;case Da:rt=11;break e;case Ga:rt=14;break e;case Ha:rt=16,tt=null;break e}throw Error(p$2(130,a==null?a:typeof a,""))}return o=Bg(rt,_e,o,ct),o.elementType=a,o.type=tt,o.lanes=gt,o}function Ah(a,o,_e,tt){return a=Bg(7,a,tt,o),a.lanes=_e,a}function qj(a,o,_e,tt){return a=Bg(22,a,tt,o),a.elementType=Ia,a.lanes=_e,a.stateNode={isHidden:!1},a}function xh(a,o,_e){return a=Bg(6,a,null,o),a.lanes=_e,a}function zh(a,o,_e){return o=Bg(4,a.children!==null?a.children:[],a.key,o),o.lanes=_e,o.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},o}function bl(a,o,_e,tt,ct){this.tag=o,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=tt,this.onRecoverableError=ct,this.mutableSourceEagerHydrationData=null}function cl(a,o,_e,tt,ct,gt,rt,it,s){return a=new bl(a,o,_e,it,s),o===1?(o=1,gt===!0&&(o|=8)):o=0,gt=Bg(3,null,null,o),a.current=gt,gt.stateNode=a,gt.memoizedState={element:tt,isDehydrated:_e,cache:null,transitions:null,pendingSuspenseBoundaries:null},ah(gt),a}function dl(a,o,_e){var tt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(a){console.error(a)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports;const ReactDOM=getDefaultExportFromCjs(reactDomExports);var createRoot,m$2=reactDomExports;createRoot=m$2.createRoot,m$2.hydrateRoot;/** +`+gt.stack}return{value:a,source:o,stack:ct,digest:null}}function Li(a,o,_e){return{value:a,source:null,stack:_e??null,digest:o??null}}function Mi(a,o){try{console.error(o.value)}catch(_e){setTimeout(function(){throw _e})}}var Ni=typeof WeakMap=="function"?WeakMap:Map;function Oi(a,o,_e){_e=ch(-1,_e),_e.tag=3,_e.payload={element:null};var tt=o.value;return _e.callback=function(){Pi||(Pi=!0,Qi=tt),Mi(a,o)},_e}function Ri(a,o,_e){_e=ch(-1,_e),_e.tag=3;var tt=a.type.getDerivedStateFromError;if(typeof tt=="function"){var ct=o.value;_e.payload=function(){return tt(ct)},_e.callback=function(){Mi(a,o)}}var gt=a.stateNode;return gt!==null&&typeof gt.componentDidCatch=="function"&&(_e.callback=function(){Mi(a,o),typeof tt!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var rt=o.stack;this.componentDidCatch(o.value,{componentStack:rt!==null?rt:""})}),_e}function Ti(a,o,_e){var tt=a.pingCache;if(tt===null){tt=a.pingCache=new Ni;var ct=new Set;tt.set(o,ct)}else ct=tt.get(o),ct===void 0&&(ct=new Set,tt.set(o,ct));ct.has(_e)||(ct.add(_e),a=Ui.bind(null,a,o,_e),o.then(a,a))}function Vi(a){do{var o;if((o=a.tag===13)&&(o=a.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return a;a=a.return}while(a!==null);return null}function Wi(a,o,_e,tt,ct){return a.mode&1?(a.flags|=65536,a.lanes=ct,a):(a===o?a.flags|=65536:(a.flags|=128,_e.flags|=131072,_e.flags&=-52805,_e.tag===1&&(_e.alternate===null?_e.tag=17:(o=ch(-1,1),o.tag=2,dh(_e,o,1))),_e.lanes|=1),a)}var Xi=ua$1.ReactCurrentOwner,Ug=!1;function Yi(a,o,_e,tt){o.child=a===null?Ch(o,null,_e,tt):Bh(o,a.child,_e,tt)}function Zi(a,o,_e,tt,ct){_e=_e.render;var gt=o.ref;return Tg(o,ct),tt=Xh(a,o,_e,tt,gt,ct),_e=bi(),a!==null&&!Ug?(o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~ct,$i(a,o,ct)):(I&&_e&&vg(o),o.flags|=1,Yi(a,o,tt,ct),o.child)}function aj(a,o,_e,tt,ct){if(a===null){var gt=_e.type;return typeof gt=="function"&&!bj(gt)&>.defaultProps===void 0&&_e.compare===null&&_e.defaultProps===void 0?(o.tag=15,o.type=gt,cj(a,o,gt,tt,ct)):(a=yh(_e.type,null,tt,o,o.mode,ct),a.ref=o.ref,a.return=o,o.child=a)}if(gt=a.child,!(a.lanes&ct)){var rt=gt.memoizedProps;if(_e=_e.compare,_e=_e!==null?_e:Ie,_e(rt,tt)&&a.ref===o.ref)return $i(a,o,ct)}return o.flags|=1,a=wh(gt,tt),a.ref=o.ref,a.return=o,o.child=a}function cj(a,o,_e,tt,ct){if(a!==null){var gt=a.memoizedProps;if(Ie(gt,tt)&&a.ref===o.ref)if(Ug=!1,o.pendingProps=tt=gt,(a.lanes&ct)!==0)a.flags&131072&&(Ug=!0);else return o.lanes=a.lanes,$i(a,o,ct)}return dj(a,o,_e,tt,ct)}function ej(a,o,_e){var tt=o.pendingProps,ct=tt.children,gt=a!==null?a.memoizedState:null;if(tt.mode==="hidden")if(!(o.mode&1))o.memoizedState={baseLanes:0,cachePool:null,transitions:null},G$1(fj,gj),gj|=_e;else{if(!(_e&1073741824))return a=gt!==null?gt.baseLanes|_e:_e,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:a,cachePool:null,transitions:null},o.updateQueue=null,G$1(fj,gj),gj|=a,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt=gt!==null?gt.baseLanes:_e,G$1(fj,gj),gj|=tt}else gt!==null?(tt=gt.baseLanes|_e,o.memoizedState=null):tt=_e,G$1(fj,gj),gj|=tt;return Yi(a,o,ct,_e),o.child}function hj(a,o){var _e=o.ref;(a===null&&_e!==null||a!==null&&a.ref!==_e)&&(o.flags|=512,o.flags|=2097152)}function dj(a,o,_e,tt,ct){var gt=Zf(_e)?Xf:H.current;return gt=Yf(o,gt),Tg(o,ct),_e=Xh(a,o,_e,tt,gt,ct),tt=bi(),a!==null&&!Ug?(o.updateQueue=a.updateQueue,o.flags&=-2053,a.lanes&=~ct,$i(a,o,ct)):(I&&tt&&vg(o),o.flags|=1,Yi(a,o,_e,ct),o.child)}function ij(a,o,_e,tt,ct){if(Zf(_e)){var gt=!0;cg(o)}else gt=!1;if(Tg(o,ct),o.stateNode===null)jj(a,o),ph(o,_e,tt),rh(o,_e,tt,ct),tt=!0;else if(a===null){var rt=o.stateNode,it=o.memoizedProps;rt.props=it;var s=rt.context,et=_e.contextType;typeof et=="object"&&et!==null?et=Vg(et):(et=Zf(_e)?Xf:H.current,et=Yf(o,et));var nt=_e.getDerivedStateFromProps,at=typeof nt=="function"||typeof rt.getSnapshotBeforeUpdate=="function";at||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(it!==tt||s!==et)&&qh(o,rt,tt,et),$g=!1;var ht=o.memoizedState;rt.state=ht,gh(o,tt,rt,ct),s=o.memoizedState,it!==tt||ht!==s||Wf.current||$g?(typeof nt=="function"&&(kh(o,_e,nt,tt),s=o.memoizedState),(it=$g||oh(o,_e,it,tt,ht,s,et))?(at||typeof rt.UNSAFE_componentWillMount!="function"&&typeof rt.componentWillMount!="function"||(typeof rt.componentWillMount=="function"&&rt.componentWillMount(),typeof rt.UNSAFE_componentWillMount=="function"&&rt.UNSAFE_componentWillMount()),typeof rt.componentDidMount=="function"&&(o.flags|=4194308)):(typeof rt.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=tt,o.memoizedState=s),rt.props=tt,rt.state=s,rt.context=et,tt=it):(typeof rt.componentDidMount=="function"&&(o.flags|=4194308),tt=!1)}else{rt=o.stateNode,bh(a,o),it=o.memoizedProps,et=o.type===o.elementType?it:Lg(o.type,it),rt.props=et,at=o.pendingProps,ht=rt.context,s=_e.contextType,typeof s=="object"&&s!==null?s=Vg(s):(s=Zf(_e)?Xf:H.current,s=Yf(o,s));var dt=_e.getDerivedStateFromProps;(nt=typeof dt=="function"||typeof rt.getSnapshotBeforeUpdate=="function")||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(it!==at||ht!==s)&&qh(o,rt,tt,s),$g=!1,ht=o.memoizedState,rt.state=ht,gh(o,tt,rt,ct);var pt=o.memoizedState;it!==at||ht!==pt||Wf.current||$g?(typeof dt=="function"&&(kh(o,_e,dt,tt),pt=o.memoizedState),(et=$g||oh(o,_e,et,tt,ht,pt,s)||!1)?(nt||typeof rt.UNSAFE_componentWillUpdate!="function"&&typeof rt.componentWillUpdate!="function"||(typeof rt.componentWillUpdate=="function"&&rt.componentWillUpdate(tt,pt,s),typeof rt.UNSAFE_componentWillUpdate=="function"&&rt.UNSAFE_componentWillUpdate(tt,pt,s)),typeof rt.componentDidUpdate=="function"&&(o.flags|=4),typeof rt.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof rt.componentDidUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=1024),o.memoizedProps=tt,o.memoizedState=pt),rt.props=tt,rt.state=pt,rt.context=s,tt=et):(typeof rt.componentDidUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||it===a.memoizedProps&&ht===a.memoizedState||(o.flags|=1024),tt=!1)}return kj(a,o,_e,tt,gt,ct)}function kj(a,o,_e,tt,ct,gt){hj(a,o);var rt=(o.flags&128)!==0;if(!tt&&!rt)return ct&&dg(o,_e,!1),$i(a,o,gt);tt=o.stateNode,Xi.current=o;var it=rt&&typeof _e.getDerivedStateFromError!="function"?null:tt.render();return o.flags|=1,a!==null&&rt?(o.child=Bh(o,a.child,null,gt),o.child=Bh(o,null,it,gt)):Yi(a,o,it,gt),o.memoizedState=tt.state,ct&&dg(o,_e,!0),o.child}function lj(a){var o=a.stateNode;o.pendingContext?ag(a,o.pendingContext,o.pendingContext!==o.context):o.context&&ag(a,o.context,!1),Ih(a,o.containerInfo)}function mj(a,o,_e,tt,ct){return Ig(),Jg(ct),o.flags|=256,Yi(a,o,_e,tt),o.child}var nj={dehydrated:null,treeContext:null,retryLane:0};function oj(a){return{baseLanes:a,cachePool:null,transitions:null}}function pj(a,o,_e){var tt=o.pendingProps,ct=M$1.current,gt=!1,rt=(o.flags&128)!==0,it;if((it=rt)||(it=a!==null&&a.memoizedState===null?!1:(ct&2)!==0),it?(gt=!0,o.flags&=-129):(a===null||a.memoizedState!==null)&&(ct|=1),G$1(M$1,ct&1),a===null)return Eg(o),a=o.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?(o.mode&1?a.data==="$!"?o.lanes=8:o.lanes=1073741824:o.lanes=1,null):(rt=tt.children,a=tt.fallback,gt?(tt=o.mode,gt=o.child,rt={mode:"hidden",children:rt},!(tt&1)&>!==null?(gt.childLanes=0,gt.pendingProps=rt):gt=qj(rt,tt,0,null),a=Ah(a,tt,_e,null),gt.return=o,a.return=o,gt.sibling=a,o.child=gt,o.child.memoizedState=oj(_e),o.memoizedState=nj,a):rj(o,rt));if(ct=a.memoizedState,ct!==null&&(it=ct.dehydrated,it!==null))return sj(a,o,rt,tt,it,ct,_e);if(gt){gt=tt.fallback,rt=o.mode,ct=a.child,it=ct.sibling;var s={mode:"hidden",children:tt.children};return!(rt&1)&&o.child!==ct?(tt=o.child,tt.childLanes=0,tt.pendingProps=s,o.deletions=null):(tt=wh(ct,s),tt.subtreeFlags=ct.subtreeFlags&14680064),it!==null?gt=wh(it,gt):(gt=Ah(gt,rt,_e,null),gt.flags|=2),gt.return=o,tt.return=o,tt.sibling=gt,o.child=tt,tt=gt,gt=o.child,rt=a.child.memoizedState,rt=rt===null?oj(_e):{baseLanes:rt.baseLanes|_e,cachePool:null,transitions:rt.transitions},gt.memoizedState=rt,gt.childLanes=a.childLanes&~_e,o.memoizedState=nj,tt}return gt=a.child,a=gt.sibling,tt=wh(gt,{mode:"visible",children:tt.children}),!(o.mode&1)&&(tt.lanes=_e),tt.return=o,tt.sibling=null,a!==null&&(_e=o.deletions,_e===null?(o.deletions=[a],o.flags|=16):_e.push(a)),o.child=tt,o.memoizedState=null,tt}function rj(a,o){return o=qj({mode:"visible",children:o},a.mode,0,null),o.return=a,a.child=o}function tj(a,o,_e,tt){return tt!==null&&Jg(tt),Bh(o,a.child,null,_e),a=rj(o,o.pendingProps.children),a.flags|=2,o.memoizedState=null,a}function sj(a,o,_e,tt,ct,gt,rt){if(_e)return o.flags&256?(o.flags&=-257,tt=Li(Error(p$2(422))),tj(a,o,rt,tt)):o.memoizedState!==null?(o.child=a.child,o.flags|=128,null):(gt=tt.fallback,ct=o.mode,tt=qj({mode:"visible",children:tt.children},ct,0,null),gt=Ah(gt,ct,rt,null),gt.flags|=2,tt.return=o,gt.return=o,tt.sibling=gt,o.child=tt,o.mode&1&&Bh(o,a.child,null,rt),o.child.memoizedState=oj(rt),o.memoizedState=nj,gt);if(!(o.mode&1))return tj(a,o,rt,null);if(ct.data==="$!"){if(tt=ct.nextSibling&&ct.nextSibling.dataset,tt)var it=tt.dgst;return tt=it,gt=Error(p$2(419)),tt=Li(gt,tt,void 0),tj(a,o,rt,tt)}if(it=(rt&a.childLanes)!==0,Ug||it){if(tt=R$1,tt!==null){switch(rt&-rt){case 4:ct=2;break;case 16:ct=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:ct=32;break;case 536870912:ct=268435456;break;default:ct=0}ct=ct&(tt.suspendedLanes|rt)?0:ct,ct!==0&&ct!==gt.retryLane&&(gt.retryLane=ct,Zg(a,ct),mh(tt,a,ct,-1))}return uj(),tt=Li(Error(p$2(421))),tj(a,o,rt,tt)}return ct.data==="$?"?(o.flags|=128,o.child=a.child,o=vj.bind(null,a),ct._reactRetry=o,null):(a=gt.treeContext,yg=Lf(ct.nextSibling),xg=o,I=!0,zg=null,a!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=a.id,sg=a.overflow,qg=o),o=rj(o,tt.children),o.flags|=4096,o)}function wj(a,o,_e){a.lanes|=o;var tt=a.alternate;tt!==null&&(tt.lanes|=o),Sg(a.return,o,_e)}function xj(a,o,_e,tt,ct){var gt=a.memoizedState;gt===null?a.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:tt,tail:_e,tailMode:ct}:(gt.isBackwards=o,gt.rendering=null,gt.renderingStartTime=0,gt.last=tt,gt.tail=_e,gt.tailMode=ct)}function yj(a,o,_e){var tt=o.pendingProps,ct=tt.revealOrder,gt=tt.tail;if(Yi(a,o,tt.children,_e),tt=M$1.current,tt&2)tt=tt&1|2,o.flags|=128;else{if(a!==null&&a.flags&128)e:for(a=o.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&wj(a,_e,o);else if(a.tag===19)wj(a,_e,o);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}tt&=1}if(G$1(M$1,tt),!(o.mode&1))o.memoizedState=null;else switch(ct){case"forwards":for(_e=o.child,ct=null;_e!==null;)a=_e.alternate,a!==null&&Mh(a)===null&&(ct=_e),_e=_e.sibling;_e=ct,_e===null?(ct=o.child,o.child=null):(ct=_e.sibling,_e.sibling=null),xj(o,!1,ct,_e,gt);break;case"backwards":for(_e=null,ct=o.child,o.child=null;ct!==null;){if(a=ct.alternate,a!==null&&Mh(a)===null){o.child=ct;break}a=ct.sibling,ct.sibling=_e,_e=ct,ct=a}xj(o,!0,_e,null,gt);break;case"together":xj(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function jj(a,o){!(o.mode&1)&&a!==null&&(a.alternate=null,o.alternate=null,o.flags|=2)}function $i(a,o,_e){if(a!==null&&(o.dependencies=a.dependencies),hh|=o.lanes,!(_e&o.childLanes))return null;if(a!==null&&o.child!==a.child)throw Error(p$2(153));if(o.child!==null){for(a=o.child,_e=wh(a,a.pendingProps),o.child=_e,_e.return=o;a.sibling!==null;)a=a.sibling,_e=_e.sibling=wh(a,a.pendingProps),_e.return=o;_e.sibling=null}return o.child}function zj(a,o,_e){switch(o.tag){case 3:lj(o),Ig();break;case 5:Kh(o);break;case 1:Zf(o.type)&&cg(o);break;case 4:Ih(o,o.stateNode.containerInfo);break;case 10:var tt=o.type._context,ct=o.memoizedProps.value;G$1(Mg,tt._currentValue),tt._currentValue=ct;break;case 13:if(tt=o.memoizedState,tt!==null)return tt.dehydrated!==null?(G$1(M$1,M$1.current&1),o.flags|=128,null):_e&o.child.childLanes?pj(a,o,_e):(G$1(M$1,M$1.current&1),a=$i(a,o,_e),a!==null?a.sibling:null);G$1(M$1,M$1.current&1);break;case 19:if(tt=(_e&o.childLanes)!==0,a.flags&128){if(tt)return yj(a,o,_e);o.flags|=128}if(ct=o.memoizedState,ct!==null&&(ct.rendering=null,ct.tail=null,ct.lastEffect=null),G$1(M$1,M$1.current),tt)break;return null;case 22:case 23:return o.lanes=0,ej(a,o,_e)}return $i(a,o,_e)}var Aj,Bj,Cj,Dj;Aj=function(a,o){for(var _e=o.child;_e!==null;){if(_e.tag===5||_e.tag===6)a.appendChild(_e.stateNode);else if(_e.tag!==4&&_e.child!==null){_e.child.return=_e,_e=_e.child;continue}if(_e===o)break;for(;_e.sibling===null;){if(_e.return===null||_e.return===o)return;_e=_e.return}_e.sibling.return=_e.return,_e=_e.sibling}};Bj=function(){};Cj=function(a,o,_e,tt){var ct=a.memoizedProps;if(ct!==tt){a=o.stateNode,Hh(Eh.current);var gt=null;switch(_e){case"input":ct=Ya(a,ct),tt=Ya(a,tt),gt=[];break;case"select":ct=A$3({},ct,{value:void 0}),tt=A$3({},tt,{value:void 0}),gt=[];break;case"textarea":ct=gb(a,ct),tt=gb(a,tt),gt=[];break;default:typeof ct.onClick!="function"&&typeof tt.onClick=="function"&&(a.onclick=Bf)}ub(_e,tt);var rt;_e=null;for(et in ct)if(!tt.hasOwnProperty(et)&&ct.hasOwnProperty(et)&&ct[et]!=null)if(et==="style"){var it=ct[et];for(rt in it)it.hasOwnProperty(rt)&&(_e||(_e={}),_e[rt]="")}else et!=="dangerouslySetInnerHTML"&&et!=="children"&&et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&et!=="autoFocus"&&(ea.hasOwnProperty(et)?gt||(gt=[]):(gt=gt||[]).push(et,null));for(et in tt){var s=tt[et];if(it=ct!=null?ct[et]:void 0,tt.hasOwnProperty(et)&&s!==it&&(s!=null||it!=null))if(et==="style")if(it){for(rt in it)!it.hasOwnProperty(rt)||s&&s.hasOwnProperty(rt)||(_e||(_e={}),_e[rt]="");for(rt in s)s.hasOwnProperty(rt)&&it[rt]!==s[rt]&&(_e||(_e={}),_e[rt]=s[rt])}else _e||(gt||(gt=[]),gt.push(et,_e)),_e=s;else et==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,it=it?it.__html:void 0,s!=null&&it!==s&&(gt=gt||[]).push(et,s)):et==="children"?typeof s!="string"&&typeof s!="number"||(gt=gt||[]).push(et,""+s):et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&(ea.hasOwnProperty(et)?(s!=null&&et==="onScroll"&&D$1("scroll",a),gt||it===s||(gt=[])):(gt=gt||[]).push(et,s))}_e&&(gt=gt||[]).push("style",_e);var et=gt;(o.updateQueue=et)&&(o.flags|=4)}};Dj=function(a,o,_e,tt){_e!==tt&&(o.flags|=4)};function Ej(a,o){if(!I)switch(a.tailMode){case"hidden":o=a.tail;for(var _e=null;o!==null;)o.alternate!==null&&(_e=o),o=o.sibling;_e===null?a.tail=null:_e.sibling=null;break;case"collapsed":_e=a.tail;for(var tt=null;_e!==null;)_e.alternate!==null&&(tt=_e),_e=_e.sibling;tt===null?o||a.tail===null?a.tail=null:a.tail.sibling=null:tt.sibling=null}}function S$2(a){var o=a.alternate!==null&&a.alternate.child===a.child,_e=0,tt=0;if(o)for(var ct=a.child;ct!==null;)_e|=ct.lanes|ct.childLanes,tt|=ct.subtreeFlags&14680064,tt|=ct.flags&14680064,ct.return=a,ct=ct.sibling;else for(ct=a.child;ct!==null;)_e|=ct.lanes|ct.childLanes,tt|=ct.subtreeFlags,tt|=ct.flags,ct.return=a,ct=ct.sibling;return a.subtreeFlags|=tt,a.childLanes=_e,o}function Fj(a,o,_e){var tt=o.pendingProps;switch(wg(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$2(o),null;case 1:return Zf(o.type)&&$f(),S$2(o),null;case 3:return tt=o.stateNode,Jh(),E$1(Wf),E$1(H),Oh(),tt.pendingContext&&(tt.context=tt.pendingContext,tt.pendingContext=null),(a===null||a.child===null)&&(Gg(o)?o.flags|=4:a===null||a.memoizedState.isDehydrated&&!(o.flags&256)||(o.flags|=1024,zg!==null&&(Gj(zg),zg=null))),Bj(a,o),S$2(o),null;case 5:Lh(o);var ct=Hh(Gh.current);if(_e=o.type,a!==null&&o.stateNode!=null)Cj(a,o,_e,tt,ct),a.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!tt){if(o.stateNode===null)throw Error(p$2(166));return S$2(o),null}if(a=Hh(Eh.current),Gg(o)){tt=o.stateNode,_e=o.type;var gt=o.memoizedProps;switch(tt[Of]=o,tt[Pf]=gt,a=(o.mode&1)!==0,_e){case"dialog":D$1("cancel",tt),D$1("close",tt);break;case"iframe":case"object":case"embed":D$1("load",tt);break;case"video":case"audio":for(ct=0;ct<\/script>",a=a.removeChild(a.firstChild)):typeof tt.is=="string"?a=rt.createElement(_e,{is:tt.is}):(a=rt.createElement(_e),_e==="select"&&(rt=a,tt.multiple?rt.multiple=!0:tt.size&&(rt.size=tt.size))):a=rt.createElementNS(a,_e),a[Of]=o,a[Pf]=tt,Aj(a,o,!1,!1),o.stateNode=a;e:{switch(rt=vb(_e,tt),_e){case"dialog":D$1("cancel",a),D$1("close",a),ct=tt;break;case"iframe":case"object":case"embed":D$1("load",a),ct=tt;break;case"video":case"audio":for(ct=0;ctHj&&(o.flags|=128,tt=!0,Ej(gt,!1),o.lanes=4194304)}else{if(!tt)if(a=Mh(rt),a!==null){if(o.flags|=128,tt=!0,_e=a.updateQueue,_e!==null&&(o.updateQueue=_e,o.flags|=4),Ej(gt,!0),gt.tail===null&>.tailMode==="hidden"&&!rt.alternate&&!I)return S$2(o),null}else 2*B$1()-gt.renderingStartTime>Hj&&_e!==1073741824&&(o.flags|=128,tt=!0,Ej(gt,!1),o.lanes=4194304);gt.isBackwards?(rt.sibling=o.child,o.child=rt):(_e=gt.last,_e!==null?_e.sibling=rt:o.child=rt,gt.last=rt)}return gt.tail!==null?(o=gt.tail,gt.rendering=o,gt.tail=o.sibling,gt.renderingStartTime=B$1(),o.sibling=null,_e=M$1.current,G$1(M$1,tt?_e&1|2:_e&1),o):(S$2(o),null);case 22:case 23:return Ij(),tt=o.memoizedState!==null,a!==null&&a.memoizedState!==null!==tt&&(o.flags|=8192),tt&&o.mode&1?gj&1073741824&&(S$2(o),o.subtreeFlags&6&&(o.flags|=8192)):S$2(o),null;case 24:return null;case 25:return null}throw Error(p$2(156,o.tag))}function Jj(a,o){switch(wg(o),o.tag){case 1:return Zf(o.type)&&$f(),a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 3:return Jh(),E$1(Wf),E$1(H),Oh(),a=o.flags,a&65536&&!(a&128)?(o.flags=a&-65537|128,o):null;case 5:return Lh(o),null;case 13:if(E$1(M$1),a=o.memoizedState,a!==null&&a.dehydrated!==null){if(o.alternate===null)throw Error(p$2(340));Ig()}return a=o.flags,a&65536?(o.flags=a&-65537|128,o):null;case 19:return E$1(M$1),null;case 4:return Jh(),null;case 10:return Rg(o.type._context),null;case 22:case 23:return Ij(),null;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Mj(a,o){var _e=a.ref;if(_e!==null)if(typeof _e=="function")try{_e(null)}catch(tt){W$2(a,o,tt)}else _e.current=null}function Nj(a,o,_e){try{_e()}catch(tt){W$2(a,o,tt)}}var Oj=!1;function Pj(a,o){if(Cf=dd,a=Me(),Ne(a)){if("selectionStart"in a)var _e={start:a.selectionStart,end:a.selectionEnd};else e:{_e=(_e=a.ownerDocument)&&_e.defaultView||window;var tt=_e.getSelection&&_e.getSelection();if(tt&&tt.rangeCount!==0){_e=tt.anchorNode;var ct=tt.anchorOffset,gt=tt.focusNode;tt=tt.focusOffset;try{_e.nodeType,gt.nodeType}catch{_e=null;break e}var rt=0,it=-1,s=-1,et=0,nt=0,at=a,ht=null;t:for(;;){for(var dt;at!==_e||ct!==0&&at.nodeType!==3||(it=rt+ct),at!==gt||tt!==0&&at.nodeType!==3||(s=rt+tt),at.nodeType===3&&(rt+=at.nodeValue.length),(dt=at.firstChild)!==null;)ht=at,at=dt;for(;;){if(at===a)break t;if(ht===_e&&++et===ct&&(it=rt),ht===gt&&++nt===tt&&(s=rt),(dt=at.nextSibling)!==null)break;at=ht,ht=at.parentNode}at=dt}_e=it===-1||s===-1?null:{start:it,end:s}}else _e=null}_e=_e||{start:0,end:0}}else _e=null;for(Df={focusedElem:a,selectionRange:_e},dd=!1,V=o;V!==null;)if(o=V,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,V=a;else for(;V!==null;){o=V;try{var pt=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(pt!==null){var lt=pt.memoizedProps,mt=pt.memoizedState,ot=o.stateNode,ut=ot.getSnapshotBeforeUpdate(o.elementType===o.type?lt:Lg(o.type,lt),mt);ot.__reactInternalSnapshotBeforeUpdate=ut}break;case 3:var ft=o.stateNode.containerInfo;ft.nodeType===1?ft.textContent="":ft.nodeType===9&&ft.documentElement&&ft.removeChild(ft.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163))}}catch(bt){W$2(o,o.return,bt)}if(a=o.sibling,a!==null){a.return=o.return,V=a;break}V=o.return}return pt=Oj,Oj=!1,pt}function Qj(a,o,_e){var tt=o.updateQueue;if(tt=tt!==null?tt.lastEffect:null,tt!==null){var ct=tt=tt.next;do{if((ct.tag&a)===a){var gt=ct.destroy;ct.destroy=void 0,gt!==void 0&&Nj(o,_e,gt)}ct=ct.next}while(ct!==tt)}}function Rj(a,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var _e=o=o.next;do{if((_e.tag&a)===a){var tt=_e.create;_e.destroy=tt()}_e=_e.next}while(_e!==o)}}function Sj(a){var o=a.ref;if(o!==null){var _e=a.stateNode;switch(a.tag){case 5:a=_e;break;default:a=_e}typeof o=="function"?o(a):o.current=a}}function Tj(a){var o=a.alternate;o!==null&&(a.alternate=null,Tj(o)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(o=a.stateNode,o!==null&&(delete o[Of],delete o[Pf],delete o[of],delete o[Qf],delete o[Rf])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Uj(a){return a.tag===5||a.tag===3||a.tag===4}function Vj(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Uj(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Wj(a,o,_e){var tt=a.tag;if(tt===5||tt===6)a=a.stateNode,o?_e.nodeType===8?_e.parentNode.insertBefore(a,o):_e.insertBefore(a,o):(_e.nodeType===8?(o=_e.parentNode,o.insertBefore(a,_e)):(o=_e,o.appendChild(a)),_e=_e._reactRootContainer,_e!=null||o.onclick!==null||(o.onclick=Bf));else if(tt!==4&&(a=a.child,a!==null))for(Wj(a,o,_e),a=a.sibling;a!==null;)Wj(a,o,_e),a=a.sibling}function Xj(a,o,_e){var tt=a.tag;if(tt===5||tt===6)a=a.stateNode,o?_e.insertBefore(a,o):_e.appendChild(a);else if(tt!==4&&(a=a.child,a!==null))for(Xj(a,o,_e),a=a.sibling;a!==null;)Xj(a,o,_e),a=a.sibling}var X$1=null,Yj=!1;function Zj(a,o,_e){for(_e=_e.child;_e!==null;)ak(a,o,_e),_e=_e.sibling}function ak(a,o,_e){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,_e)}catch{}switch(_e.tag){case 5:U||Mj(_e,o);case 6:var tt=X$1,ct=Yj;X$1=null,Zj(a,o,_e),X$1=tt,Yj=ct,X$1!==null&&(Yj?(a=X$1,_e=_e.stateNode,a.nodeType===8?a.parentNode.removeChild(_e):a.removeChild(_e)):X$1.removeChild(_e.stateNode));break;case 18:X$1!==null&&(Yj?(a=X$1,_e=_e.stateNode,a.nodeType===8?Kf(a.parentNode,_e):a.nodeType===1&&Kf(a,_e),bd(a)):Kf(X$1,_e.stateNode));break;case 4:tt=X$1,ct=Yj,X$1=_e.stateNode.containerInfo,Yj=!0,Zj(a,o,_e),X$1=tt,Yj=ct;break;case 0:case 11:case 14:case 15:if(!U&&(tt=_e.updateQueue,tt!==null&&(tt=tt.lastEffect,tt!==null))){ct=tt=tt.next;do{var gt=ct,rt=gt.destroy;gt=gt.tag,rt!==void 0&&(gt&2||gt&4)&&Nj(_e,o,rt),ct=ct.next}while(ct!==tt)}Zj(a,o,_e);break;case 1:if(!U&&(Mj(_e,o),tt=_e.stateNode,typeof tt.componentWillUnmount=="function"))try{tt.props=_e.memoizedProps,tt.state=_e.memoizedState,tt.componentWillUnmount()}catch(it){W$2(_e,o,it)}Zj(a,o,_e);break;case 21:Zj(a,o,_e);break;case 22:_e.mode&1?(U=(tt=U)||_e.memoizedState!==null,Zj(a,o,_e),U=tt):Zj(a,o,_e);break;default:Zj(a,o,_e)}}function bk(a){var o=a.updateQueue;if(o!==null){a.updateQueue=null;var _e=a.stateNode;_e===null&&(_e=a.stateNode=new Lj),o.forEach(function(tt){var ct=ck.bind(null,a,tt);_e.has(tt)||(_e.add(tt),tt.then(ct,ct))})}}function dk(a,o){var _e=o.deletions;if(_e!==null)for(var tt=0;tt<_e.length;tt++){var ct=_e[tt];try{var gt=a,rt=o,it=rt;e:for(;it!==null;){switch(it.tag){case 5:X$1=it.stateNode,Yj=!1;break e;case 3:X$1=it.stateNode.containerInfo,Yj=!0;break e;case 4:X$1=it.stateNode.containerInfo,Yj=!0;break e}it=it.return}if(X$1===null)throw Error(p$2(160));ak(gt,rt,ct),X$1=null,Yj=!1;var s=ct.alternate;s!==null&&(s.return=null),ct.return=null}catch(et){W$2(ct,o,et)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)ek(o,a),o=o.sibling}function ek(a,o){var _e=a.alternate,tt=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(dk(o,a),fk(a),tt&4){try{Qj(3,a,a.return),Rj(3,a)}catch(lt){W$2(a,a.return,lt)}try{Qj(5,a,a.return)}catch(lt){W$2(a,a.return,lt)}}break;case 1:dk(o,a),fk(a),tt&512&&_e!==null&&Mj(_e,_e.return);break;case 5:if(dk(o,a),fk(a),tt&512&&_e!==null&&Mj(_e,_e.return),a.flags&32){var ct=a.stateNode;try{ob(ct,"")}catch(lt){W$2(a,a.return,lt)}}if(tt&4&&(ct=a.stateNode,ct!=null)){var gt=a.memoizedProps,rt=_e!==null?_e.memoizedProps:gt,it=a.type,s=a.updateQueue;if(a.updateQueue=null,s!==null)try{it==="input"&>.type==="radio"&>.name!=null&&ab(ct,gt),vb(it,rt);var et=vb(it,gt);for(rt=0;rtct&&(ct=rt),tt&=~gt}if(tt=ct,tt=B$1()-tt,tt=(120>tt?120:480>tt?480:1080>tt?1080:1920>tt?1920:3e3>tt?3e3:4320>tt?4320:1960*mk(tt/1960))-tt,10a?16:a,xk===null)var tt=!1;else{if(a=xk,xk=null,yk=0,K$1&6)throw Error(p$2(331));var ct=K$1;for(K$1|=4,V=a.current;V!==null;){var gt=V,rt=gt.child;if(V.flags&16){var it=gt.deletions;if(it!==null){for(var s=0;sB$1()-gk?Lk(a,0):sk|=_e),Ek(a,o)}function Zk(a,o){o===0&&(a.mode&1?(o=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):o=1);var _e=L();a=Zg(a,o),a!==null&&(Ac(a,o,_e),Ek(a,_e))}function vj(a){var o=a.memoizedState,_e=0;o!==null&&(_e=o.retryLane),Zk(a,_e)}function ck(a,o){var _e=0;switch(a.tag){case 13:var tt=a.stateNode,ct=a.memoizedState;ct!==null&&(_e=ct.retryLane);break;case 19:tt=a.stateNode;break;default:throw Error(p$2(314))}tt!==null&&tt.delete(o),Zk(a,_e)}var Wk;Wk=function(a,o,_e){if(a!==null)if(a.memoizedProps!==o.pendingProps||Wf.current)Ug=!0;else{if(!(a.lanes&_e)&&!(o.flags&128))return Ug=!1,zj(a,o,_e);Ug=!!(a.flags&131072)}else Ug=!1,I&&o.flags&1048576&&ug(o,ng,o.index);switch(o.lanes=0,o.tag){case 2:var tt=o.type;jj(a,o),a=o.pendingProps;var ct=Yf(o,H.current);Tg(o,_e),ct=Xh(null,o,tt,a,ct,_e);var gt=bi();return o.flags|=1,typeof ct=="object"&&ct!==null&&typeof ct.render=="function"&&ct.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Zf(tt)?(gt=!0,cg(o)):gt=!1,o.memoizedState=ct.state!==null&&ct.state!==void 0?ct.state:null,ah(o),ct.updater=nh,o.stateNode=ct,ct._reactInternals=o,rh(o,tt,a,_e),o=kj(null,o,tt,!0,gt,_e)):(o.tag=0,I&>&&vg(o),Yi(null,o,ct,_e),o=o.child),o;case 16:tt=o.elementType;e:{switch(jj(a,o),a=o.pendingProps,ct=tt._init,tt=ct(tt._payload),o.type=tt,ct=o.tag=$k(tt),a=Lg(tt,a),ct){case 0:o=dj(null,o,tt,a,_e);break e;case 1:o=ij(null,o,tt,a,_e);break e;case 11:o=Zi(null,o,tt,a,_e);break e;case 14:o=aj(null,o,tt,Lg(tt.type,a),_e);break e}throw Error(p$2(306,tt,""))}return o;case 0:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),dj(a,o,tt,ct,_e);case 1:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),ij(a,o,tt,ct,_e);case 3:e:{if(lj(o),a===null)throw Error(p$2(387));tt=o.pendingProps,gt=o.memoizedState,ct=gt.element,bh(a,o),gh(o,tt,null,_e);var rt=o.memoizedState;if(tt=rt.element,gt.isDehydrated)if(gt={element:tt,isDehydrated:!1,cache:rt.cache,pendingSuspenseBoundaries:rt.pendingSuspenseBoundaries,transitions:rt.transitions},o.updateQueue.baseState=gt,o.memoizedState=gt,o.flags&256){ct=Ki(Error(p$2(423)),o),o=mj(a,o,tt,_e,ct);break e}else if(tt!==ct){ct=Ki(Error(p$2(424)),o),o=mj(a,o,tt,_e,ct);break e}else for(yg=Lf(o.stateNode.containerInfo.firstChild),xg=o,I=!0,zg=null,_e=Ch(o,null,tt,_e),o.child=_e;_e;)_e.flags=_e.flags&-3|4096,_e=_e.sibling;else{if(Ig(),tt===ct){o=$i(a,o,_e);break e}Yi(a,o,tt,_e)}o=o.child}return o;case 5:return Kh(o),a===null&&Eg(o),tt=o.type,ct=o.pendingProps,gt=a!==null?a.memoizedProps:null,rt=ct.children,Ef(tt,ct)?rt=null:gt!==null&&Ef(tt,gt)&&(o.flags|=32),hj(a,o),Yi(a,o,rt,_e),o.child;case 6:return a===null&&Eg(o),null;case 13:return pj(a,o,_e);case 4:return Ih(o,o.stateNode.containerInfo),tt=o.pendingProps,a===null?o.child=Bh(o,null,tt,_e):Yi(a,o,tt,_e),o.child;case 11:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),Zi(a,o,tt,ct,_e);case 7:return Yi(a,o,o.pendingProps,_e),o.child;case 8:return Yi(a,o,o.pendingProps.children,_e),o.child;case 12:return Yi(a,o,o.pendingProps.children,_e),o.child;case 10:e:{if(tt=o.type._context,ct=o.pendingProps,gt=o.memoizedProps,rt=ct.value,G$1(Mg,tt._currentValue),tt._currentValue=rt,gt!==null)if(He(gt.value,rt)){if(gt.children===ct.children&&!Wf.current){o=$i(a,o,_e);break e}}else for(gt=o.child,gt!==null&&(gt.return=o);gt!==null;){var it=gt.dependencies;if(it!==null){rt=gt.child;for(var s=it.firstContext;s!==null;){if(s.context===tt){if(gt.tag===1){s=ch(-1,_e&-_e),s.tag=2;var et=gt.updateQueue;if(et!==null){et=et.shared;var nt=et.pending;nt===null?s.next=s:(s.next=nt.next,nt.next=s),et.pending=s}}gt.lanes|=_e,s=gt.alternate,s!==null&&(s.lanes|=_e),Sg(gt.return,_e,o),it.lanes|=_e;break}s=s.next}}else if(gt.tag===10)rt=gt.type===o.type?null:gt.child;else if(gt.tag===18){if(rt=gt.return,rt===null)throw Error(p$2(341));rt.lanes|=_e,it=rt.alternate,it!==null&&(it.lanes|=_e),Sg(rt,_e,o),rt=gt.sibling}else rt=gt.child;if(rt!==null)rt.return=gt;else for(rt=gt;rt!==null;){if(rt===o){rt=null;break}if(gt=rt.sibling,gt!==null){gt.return=rt.return,rt=gt;break}rt=rt.return}gt=rt}Yi(a,o,ct.children,_e),o=o.child}return o;case 9:return ct=o.type,tt=o.pendingProps.children,Tg(o,_e),ct=Vg(ct),tt=tt(ct),o.flags|=1,Yi(a,o,tt,_e),o.child;case 14:return tt=o.type,ct=Lg(tt,o.pendingProps),ct=Lg(tt.type,ct),aj(a,o,tt,ct,_e);case 15:return cj(a,o,o.type,o.pendingProps,_e);case 17:return tt=o.type,ct=o.pendingProps,ct=o.elementType===tt?ct:Lg(tt,ct),jj(a,o),o.tag=1,Zf(tt)?(a=!0,cg(o)):a=!1,Tg(o,_e),ph(o,tt,ct),rh(o,tt,ct,_e),kj(null,o,tt,!0,a,_e);case 19:return yj(a,o,_e);case 22:return ej(a,o,_e)}throw Error(p$2(156,o.tag))};function Gk(a,o){return ac(a,o)}function al(a,o,_e,tt){this.tag=a,this.key=_e,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=tt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(a,o,_e,tt){return new al(a,o,_e,tt)}function bj(a){return a=a.prototype,!(!a||!a.isReactComponent)}function $k(a){if(typeof a=="function")return bj(a)?1:0;if(a!=null){if(a=a.$$typeof,a===Da)return 11;if(a===Ga)return 14}return 2}function wh(a,o){var _e=a.alternate;return _e===null?(_e=Bg(a.tag,o,a.key,a.mode),_e.elementType=a.elementType,_e.type=a.type,_e.stateNode=a.stateNode,_e.alternate=a,a.alternate=_e):(_e.pendingProps=o,_e.type=a.type,_e.flags=0,_e.subtreeFlags=0,_e.deletions=null),_e.flags=a.flags&14680064,_e.childLanes=a.childLanes,_e.lanes=a.lanes,_e.child=a.child,_e.memoizedProps=a.memoizedProps,_e.memoizedState=a.memoizedState,_e.updateQueue=a.updateQueue,o=a.dependencies,_e.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},_e.sibling=a.sibling,_e.index=a.index,_e.ref=a.ref,_e}function yh(a,o,_e,tt,ct,gt){var rt=2;if(tt=a,typeof a=="function")bj(a)&&(rt=1);else if(typeof a=="string")rt=5;else e:switch(a){case ya:return Ah(_e.children,ct,gt,o);case za:rt=8,ct|=8;break;case Aa:return a=Bg(12,_e,o,ct|2),a.elementType=Aa,a.lanes=gt,a;case Ea:return a=Bg(13,_e,o,ct),a.elementType=Ea,a.lanes=gt,a;case Fa:return a=Bg(19,_e,o,ct),a.elementType=Fa,a.lanes=gt,a;case Ia:return qj(_e,ct,gt,o);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case Ba:rt=10;break e;case Ca:rt=9;break e;case Da:rt=11;break e;case Ga:rt=14;break e;case Ha:rt=16,tt=null;break e}throw Error(p$2(130,a==null?a:typeof a,""))}return o=Bg(rt,_e,o,ct),o.elementType=a,o.type=tt,o.lanes=gt,o}function Ah(a,o,_e,tt){return a=Bg(7,a,tt,o),a.lanes=_e,a}function qj(a,o,_e,tt){return a=Bg(22,a,tt,o),a.elementType=Ia,a.lanes=_e,a.stateNode={isHidden:!1},a}function xh(a,o,_e){return a=Bg(6,a,null,o),a.lanes=_e,a}function zh(a,o,_e){return o=Bg(4,a.children!==null?a.children:[],a.key,o),o.lanes=_e,o.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},o}function bl(a,o,_e,tt,ct){this.tag=o,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=tt,this.onRecoverableError=ct,this.mutableSourceEagerHydrationData=null}function cl(a,o,_e,tt,ct,gt,rt,it,s){return a=new bl(a,o,_e,it,s),o===1?(o=1,gt===!0&&(o|=8)):o=0,gt=Bg(3,null,null,o),a.current=gt,gt.stateNode=a,gt.memoizedState={element:tt,isDehydrated:_e,cache:null,transitions:null,pendingSuspenseBoundaries:null},ah(gt),a}function dl(a,o,_e){var tt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(a){console.error(a)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports;const ReactDOM=getDefaultExportFromCjs(reactDomExports);var createRoot,m$2=reactDomExports;createRoot=m$2.createRoot,m$2.hydrateRoot;/** * @remix-run/router v1.10.0 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+gt.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(a){for(var o=1;o"u")throw new Error(o)}function warning(a,o){if(!a){typeof console<"u"&&console.warn(o);try{throw new Error(o)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(a,o){return{usr:a.state,key:a.key,idx:o}}function createLocation(a,o,_e,tt){return _e===void 0&&(_e=null),_extends$3({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof o=="string"?parsePath(o):o,{state:_e,key:o&&o.key||tt||createKey()})}function createPath(a){let{pathname:o="/",search:_e="",hash:tt=""}=a;return _e&&_e!=="?"&&(o+=_e.charAt(0)==="?"?_e:"?"+_e),tt&&tt!=="#"&&(o+=tt.charAt(0)==="#"?tt:"#"+tt),o}function parsePath(a){let o={};if(a){let _e=a.indexOf("#");_e>=0&&(o.hash=a.substr(_e),a=a.substr(0,_e));let tt=a.indexOf("?");tt>=0&&(o.search=a.substr(tt),a=a.substr(0,tt)),a&&(o.pathname=a)}return o}function getUrlBasedHistory(a,o,_e,tt){tt===void 0&&(tt={});let{window:ct=document.defaultView,v5Compat:gt=!1}=tt,rt=ct.history,it=Action.Pop,s=null,et=nt();et==null&&(et=0,rt.replaceState(_extends$3({},rt.state,{idx:et}),""));function nt(){return(rt.state||{idx:null}).idx}function at(){it=Action.Pop;let mt=nt(),ot=mt==null?null:mt-et;et=mt,s&&s({action:it,location:lt.location,delta:ot})}function ht(mt,ot){it=Action.Push;let pt=createLocation(lt.location,mt,ot);_e&&_e(pt,mt),et=nt()+1;let ft=getHistoryState(pt,et),yt=lt.createHref(pt);try{rt.pushState(ft,"",yt)}catch(vt){if(vt instanceof DOMException&&vt.name==="DataCloneError")throw vt;ct.location.assign(yt)}gt&&s&&s({action:it,location:lt.location,delta:1})}function dt(mt,ot){it=Action.Replace;let pt=createLocation(lt.location,mt,ot);_e&&_e(pt,mt),et=nt();let ft=getHistoryState(pt,et),yt=lt.createHref(pt);rt.replaceState(ft,"",yt),gt&&s&&s({action:it,location:lt.location,delta:0})}function ut(mt){let ot=ct.location.origin!=="null"?ct.location.origin:ct.location.href,pt=typeof mt=="string"?mt:createPath(mt);return invariant(ot,"No window.location.(origin|href) available to create URL for href: "+pt),new URL(pt,ot)}let lt={get action(){return it},get location(){return a(ct,rt)},listen(mt){if(s)throw new Error("A history only accepts one active listener");return ct.addEventListener(PopStateEventType,at),s=mt,()=>{ct.removeEventListener(PopStateEventType,at),s=null}},createHref(mt){return o(ct,mt)},createURL:ut,encodeLocation(mt){let ot=ut(mt);return{pathname:ot.pathname,search:ot.search,hash:ot.hash}},push:ht,replace:dt,go(mt){return rt.go(mt)}};return lt}var ResultType;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(ResultType||(ResultType={}));function matchRoutes(a,o,_e){_e===void 0&&(_e="/");let tt=typeof o=="string"?parsePath(o):o,ct=stripBasename(tt.pathname||"/",_e);if(ct==null)return null;let gt=flattenRoutes(a);rankRouteBranches(gt);let rt=null;for(let it=0;rt==null&&it{let s={relativePath:it===void 0?gt.path||"":it,caseSensitive:gt.caseSensitive===!0,childrenIndex:rt,route:gt};s.relativePath.startsWith("/")&&(invariant(s.relativePath.startsWith(tt),'Absolute route path "'+s.relativePath+'" nested under path '+('"'+tt+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),s.relativePath=s.relativePath.slice(tt.length));let et=joinPaths([tt,s.relativePath]),nt=_e.concat(s);gt.children&>.children.length>0&&(invariant(gt.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+et+'".')),flattenRoutes(gt.children,o,nt,et)),!(gt.path==null&&!gt.index)&&o.push({path:et,score:computeScore(et,gt.index),routesMeta:nt})};return a.forEach((gt,rt)=>{var it;if(gt.path===""||!((it=gt.path)!=null&&it.includes("?")))ct(gt,rt);else for(let s of explodeOptionalSegments(gt.path))ct(gt,rt,s)}),o}function explodeOptionalSegments(a){let o=a.split("/");if(o.length===0)return[];let[_e,...tt]=o,ct=_e.endsWith("?"),gt=_e.replace(/\?$/,"");if(tt.length===0)return ct?[gt,""]:[gt];let rt=explodeOptionalSegments(tt.join("/")),it=[];return it.push(...rt.map(s=>s===""?gt:[gt,s].join("/"))),ct&&it.push(...rt),it.map(s=>a.startsWith("/")&&s===""?"/":s)}function rankRouteBranches(a){a.sort((o,_e)=>o.score!==_e.score?_e.score-o.score:compareIndexes(o.routesMeta.map(tt=>tt.childrenIndex),_e.routesMeta.map(tt=>tt.childrenIndex)))}const paramRe=/^:\w+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=a=>a==="*";function computeScore(a,o){let _e=a.split("/"),tt=_e.length;return _e.some(isSplat)&&(tt+=splatPenalty),o&&(tt+=indexRouteValue),_e.filter(ct=>!isSplat(ct)).reduce((ct,gt)=>ct+(paramRe.test(gt)?dynamicSegmentValue:gt===""?emptySegmentValue:staticSegmentValue),tt)}function compareIndexes(a,o){return a.length===o.length&&a.slice(0,-1).every((tt,ct)=>tt===o[ct])?a[a.length-1]-o[o.length-1]:0}function matchRouteBranch(a,o){let{routesMeta:_e}=a,tt={},ct="/",gt=[];for(let rt=0;rt<_e.length;++rt){let it=_e[rt],s=rt===_e.length-1,et=ct==="/"?o:o.slice(ct.length)||"/",nt=matchPath({path:it.relativePath,caseSensitive:it.caseSensitive,end:s},et);if(!nt)return null;Object.assign(tt,nt.params);let at=it.route;gt.push({params:tt,pathname:joinPaths([ct,nt.pathname]),pathnameBase:normalizePathname(joinPaths([ct,nt.pathnameBase])),route:at}),nt.pathnameBase!=="/"&&(ct=joinPaths([ct,nt.pathnameBase]))}return gt}function matchPath(a,o){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[_e,tt]=compilePath(a.path,a.caseSensitive,a.end),ct=o.match(_e);if(!ct)return null;let gt=ct[0],rt=gt.replace(/(.)\/+$/,"$1"),it=ct.slice(1);return{params:tt.reduce((et,nt,at)=>{if(nt==="*"){let ht=it[at]||"";rt=gt.slice(0,gt.length-ht.length).replace(/(.)\/+$/,"$1")}return et[nt]=safelyDecodeURIComponent(it[at]||"",nt),et},{}),pathname:gt,pathnameBase:rt,pattern:a}}function compilePath(a,o,_e){o===void 0&&(o=!1),_e===void 0&&(_e=!0),warning(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let tt=[],ct="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(rt,it)=>(tt.push(it),"/([^\\/]+)"));return a.endsWith("*")?(tt.push("*"),ct+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):_e?ct+="\\/*$":a!==""&&a!=="/"&&(ct+="(?:(?=\\/|$))"),[new RegExp(ct,o?void 0:"i"),tt]}function safelyDecodeURI(a){try{return decodeURI(a)}catch(o){return warning(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+o+").")),a}}function safelyDecodeURIComponent(a,o){try{return decodeURIComponent(a)}catch(_e){return warning(!1,'The value for the URL param "'+o+'" will not be decoded because'+(' the string "'+a+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+_e+").")),a}}function stripBasename(a,o){if(o==="/")return a;if(!a.toLowerCase().startsWith(o.toLowerCase()))return null;let _e=o.endsWith("/")?o.length-1:o.length,tt=a.charAt(_e);return tt&&tt!=="/"?null:a.slice(_e)||"/"}function resolvePath(a,o){o===void 0&&(o="/");let{pathname:_e,search:tt="",hash:ct=""}=typeof a=="string"?parsePath(a):a;return{pathname:_e?_e.startsWith("/")?_e:resolvePathname(_e,o):o,search:normalizeSearch(tt),hash:normalizeHash(ct)}}function resolvePathname(a,o){let _e=o.replace(/\/+$/,"").split("/");return a.split("/").forEach(ct=>{ct===".."?_e.length>1&&_e.pop():ct!=="."&&_e.push(ct)}),_e.length>1?_e.join("/"):"/"}function getInvalidPathError(a,o,_e,tt){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+o+"` field ["+JSON.stringify(tt)+"]. Please separate it out to the ")+("`to."+_e+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(a){return a.filter((o,_e)=>_e===0||o.route.path&&o.route.path.length>0)}function resolveTo(a,o,_e,tt){tt===void 0&&(tt=!1);let ct;typeof a=="string"?ct=parsePath(a):(ct=_extends$3({},a),invariant(!ct.pathname||!ct.pathname.includes("?"),getInvalidPathError("?","pathname","search",ct)),invariant(!ct.pathname||!ct.pathname.includes("#"),getInvalidPathError("#","pathname","hash",ct)),invariant(!ct.search||!ct.search.includes("#"),getInvalidPathError("#","search","hash",ct)));let gt=a===""||ct.pathname==="",rt=gt?"/":ct.pathname,it;if(tt||rt==null)it=_e;else{let at=o.length-1;if(rt.startsWith("..")){let ht=rt.split("/");for(;ht[0]==="..";)ht.shift(),at-=1;ct.pathname=ht.join("/")}it=at>=0?o[at]:"/"}let s=resolvePath(ct,it),et=rt&&rt!=="/"&&rt.endsWith("/"),nt=(gt||rt===".")&&_e.endsWith("/");return!s.pathname.endsWith("/")&&(et||nt)&&(s.pathname+="/"),s}const joinPaths=a=>a.join("/").replace(/\/\/+/g,"/"),normalizePathname=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,normalizeHash=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function isRouteErrorResponse(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** + */function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(a){for(var o=1;o"u")throw new Error(o)}function warning(a,o){if(!a){typeof console<"u"&&console.warn(o);try{throw new Error(o)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(a,o){return{usr:a.state,key:a.key,idx:o}}function createLocation(a,o,_e,tt){return _e===void 0&&(_e=null),_extends$3({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof o=="string"?parsePath(o):o,{state:_e,key:o&&o.key||tt||createKey()})}function createPath(a){let{pathname:o="/",search:_e="",hash:tt=""}=a;return _e&&_e!=="?"&&(o+=_e.charAt(0)==="?"?_e:"?"+_e),tt&&tt!=="#"&&(o+=tt.charAt(0)==="#"?tt:"#"+tt),o}function parsePath(a){let o={};if(a){let _e=a.indexOf("#");_e>=0&&(o.hash=a.substr(_e),a=a.substr(0,_e));let tt=a.indexOf("?");tt>=0&&(o.search=a.substr(tt),a=a.substr(0,tt)),a&&(o.pathname=a)}return o}function getUrlBasedHistory(a,o,_e,tt){tt===void 0&&(tt={});let{window:ct=document.defaultView,v5Compat:gt=!1}=tt,rt=ct.history,it=Action.Pop,s=null,et=nt();et==null&&(et=0,rt.replaceState(_extends$3({},rt.state,{idx:et}),""));function nt(){return(rt.state||{idx:null}).idx}function at(){it=Action.Pop;let mt=nt(),ot=mt==null?null:mt-et;et=mt,s&&s({action:it,location:lt.location,delta:ot})}function ht(mt,ot){it=Action.Push;let ut=createLocation(lt.location,mt,ot);_e&&_e(ut,mt),et=nt()+1;let ft=getHistoryState(ut,et),bt=lt.createHref(ut);try{rt.pushState(ft,"",bt)}catch(vt){if(vt instanceof DOMException&&vt.name==="DataCloneError")throw vt;ct.location.assign(bt)}gt&&s&&s({action:it,location:lt.location,delta:1})}function dt(mt,ot){it=Action.Replace;let ut=createLocation(lt.location,mt,ot);_e&&_e(ut,mt),et=nt();let ft=getHistoryState(ut,et),bt=lt.createHref(ut);rt.replaceState(ft,"",bt),gt&&s&&s({action:it,location:lt.location,delta:0})}function pt(mt){let ot=ct.location.origin!=="null"?ct.location.origin:ct.location.href,ut=typeof mt=="string"?mt:createPath(mt);return invariant(ot,"No window.location.(origin|href) available to create URL for href: "+ut),new URL(ut,ot)}let lt={get action(){return it},get location(){return a(ct,rt)},listen(mt){if(s)throw new Error("A history only accepts one active listener");return ct.addEventListener(PopStateEventType,at),s=mt,()=>{ct.removeEventListener(PopStateEventType,at),s=null}},createHref(mt){return o(ct,mt)},createURL:pt,encodeLocation(mt){let ot=pt(mt);return{pathname:ot.pathname,search:ot.search,hash:ot.hash}},push:ht,replace:dt,go(mt){return rt.go(mt)}};return lt}var ResultType;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(ResultType||(ResultType={}));function matchRoutes(a,o,_e){_e===void 0&&(_e="/");let tt=typeof o=="string"?parsePath(o):o,ct=stripBasename(tt.pathname||"/",_e);if(ct==null)return null;let gt=flattenRoutes(a);rankRouteBranches(gt);let rt=null;for(let it=0;rt==null&&it{let s={relativePath:it===void 0?gt.path||"":it,caseSensitive:gt.caseSensitive===!0,childrenIndex:rt,route:gt};s.relativePath.startsWith("/")&&(invariant(s.relativePath.startsWith(tt),'Absolute route path "'+s.relativePath+'" nested under path '+('"'+tt+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),s.relativePath=s.relativePath.slice(tt.length));let et=joinPaths([tt,s.relativePath]),nt=_e.concat(s);gt.children&>.children.length>0&&(invariant(gt.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+et+'".')),flattenRoutes(gt.children,o,nt,et)),!(gt.path==null&&!gt.index)&&o.push({path:et,score:computeScore(et,gt.index),routesMeta:nt})};return a.forEach((gt,rt)=>{var it;if(gt.path===""||!((it=gt.path)!=null&&it.includes("?")))ct(gt,rt);else for(let s of explodeOptionalSegments(gt.path))ct(gt,rt,s)}),o}function explodeOptionalSegments(a){let o=a.split("/");if(o.length===0)return[];let[_e,...tt]=o,ct=_e.endsWith("?"),gt=_e.replace(/\?$/,"");if(tt.length===0)return ct?[gt,""]:[gt];let rt=explodeOptionalSegments(tt.join("/")),it=[];return it.push(...rt.map(s=>s===""?gt:[gt,s].join("/"))),ct&&it.push(...rt),it.map(s=>a.startsWith("/")&&s===""?"/":s)}function rankRouteBranches(a){a.sort((o,_e)=>o.score!==_e.score?_e.score-o.score:compareIndexes(o.routesMeta.map(tt=>tt.childrenIndex),_e.routesMeta.map(tt=>tt.childrenIndex)))}const paramRe=/^:\w+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=a=>a==="*";function computeScore(a,o){let _e=a.split("/"),tt=_e.length;return _e.some(isSplat)&&(tt+=splatPenalty),o&&(tt+=indexRouteValue),_e.filter(ct=>!isSplat(ct)).reduce((ct,gt)=>ct+(paramRe.test(gt)?dynamicSegmentValue:gt===""?emptySegmentValue:staticSegmentValue),tt)}function compareIndexes(a,o){return a.length===o.length&&a.slice(0,-1).every((tt,ct)=>tt===o[ct])?a[a.length-1]-o[o.length-1]:0}function matchRouteBranch(a,o){let{routesMeta:_e}=a,tt={},ct="/",gt=[];for(let rt=0;rt<_e.length;++rt){let it=_e[rt],s=rt===_e.length-1,et=ct==="/"?o:o.slice(ct.length)||"/",nt=matchPath({path:it.relativePath,caseSensitive:it.caseSensitive,end:s},et);if(!nt)return null;Object.assign(tt,nt.params);let at=it.route;gt.push({params:tt,pathname:joinPaths([ct,nt.pathname]),pathnameBase:normalizePathname(joinPaths([ct,nt.pathnameBase])),route:at}),nt.pathnameBase!=="/"&&(ct=joinPaths([ct,nt.pathnameBase]))}return gt}function matchPath(a,o){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[_e,tt]=compilePath(a.path,a.caseSensitive,a.end),ct=o.match(_e);if(!ct)return null;let gt=ct[0],rt=gt.replace(/(.)\/+$/,"$1"),it=ct.slice(1);return{params:tt.reduce((et,nt,at)=>{if(nt==="*"){let ht=it[at]||"";rt=gt.slice(0,gt.length-ht.length).replace(/(.)\/+$/,"$1")}return et[nt]=safelyDecodeURIComponent(it[at]||"",nt),et},{}),pathname:gt,pathnameBase:rt,pattern:a}}function compilePath(a,o,_e){o===void 0&&(o=!1),_e===void 0&&(_e=!0),warning(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let tt=[],ct="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(rt,it)=>(tt.push(it),"/([^\\/]+)"));return a.endsWith("*")?(tt.push("*"),ct+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):_e?ct+="\\/*$":a!==""&&a!=="/"&&(ct+="(?:(?=\\/|$))"),[new RegExp(ct,o?void 0:"i"),tt]}function safelyDecodeURI(a){try{return decodeURI(a)}catch(o){return warning(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+o+").")),a}}function safelyDecodeURIComponent(a,o){try{return decodeURIComponent(a)}catch(_e){return warning(!1,'The value for the URL param "'+o+'" will not be decoded because'+(' the string "'+a+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+_e+").")),a}}function stripBasename(a,o){if(o==="/")return a;if(!a.toLowerCase().startsWith(o.toLowerCase()))return null;let _e=o.endsWith("/")?o.length-1:o.length,tt=a.charAt(_e);return tt&&tt!=="/"?null:a.slice(_e)||"/"}function resolvePath(a,o){o===void 0&&(o="/");let{pathname:_e,search:tt="",hash:ct=""}=typeof a=="string"?parsePath(a):a;return{pathname:_e?_e.startsWith("/")?_e:resolvePathname(_e,o):o,search:normalizeSearch(tt),hash:normalizeHash(ct)}}function resolvePathname(a,o){let _e=o.replace(/\/+$/,"").split("/");return a.split("/").forEach(ct=>{ct===".."?_e.length>1&&_e.pop():ct!=="."&&_e.push(ct)}),_e.length>1?_e.join("/"):"/"}function getInvalidPathError(a,o,_e,tt){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+o+"` field ["+JSON.stringify(tt)+"]. Please separate it out to the ")+("`to."+_e+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(a){return a.filter((o,_e)=>_e===0||o.route.path&&o.route.path.length>0)}function resolveTo(a,o,_e,tt){tt===void 0&&(tt=!1);let ct;typeof a=="string"?ct=parsePath(a):(ct=_extends$3({},a),invariant(!ct.pathname||!ct.pathname.includes("?"),getInvalidPathError("?","pathname","search",ct)),invariant(!ct.pathname||!ct.pathname.includes("#"),getInvalidPathError("#","pathname","hash",ct)),invariant(!ct.search||!ct.search.includes("#"),getInvalidPathError("#","search","hash",ct)));let gt=a===""||ct.pathname==="",rt=gt?"/":ct.pathname,it;if(tt||rt==null)it=_e;else{let at=o.length-1;if(rt.startsWith("..")){let ht=rt.split("/");for(;ht[0]==="..";)ht.shift(),at-=1;ct.pathname=ht.join("/")}it=at>=0?o[at]:"/"}let s=resolvePath(ct,it),et=rt&&rt!=="/"&&rt.endsWith("/"),nt=(gt||rt===".")&&_e.endsWith("/");return!s.pathname.endsWith("/")&&(et||nt)&&(s.pathname+="/"),s}const joinPaths=a=>a.join("/").replace(/\/\/+/g,"/"),normalizePathname=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,normalizeHash=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function isRouteErrorResponse(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** * React Router v6.17.0 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+gt.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(a){for(var o=1;os.pathnameBase)),rt=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{rt.current=!0}),reactExports.useCallback(function(s,et){if(et===void 0&&(et={}),!rt.current)return;if(typeof s=="number"){_e.go(s);return}let nt=resolveTo(s,JSON.parse(gt),ct,et.relative==="path");a==null&&o!=="/"&&(nt.pathname=nt.pathname==="/"?o:joinPaths([o,nt.pathname])),(et.replace?_e.replace:_e.push)(nt,et.state,et)},[o,_e,gt,ct,a])}function useParams(){let{matches:a}=reactExports.useContext(RouteContext),o=a[a.length-1];return o?o.params:{}}function useRoutes(a,o){return useRoutesImpl(a,o)}function useRoutesImpl(a,o,_e){useInRouterContext()||invariant(!1);let{navigator:tt}=reactExports.useContext(NavigationContext),{matches:ct}=reactExports.useContext(RouteContext),gt=ct[ct.length-1],rt=gt?gt.params:{};gt&>.pathname;let it=gt?gt.pathnameBase:"/";gt&>.route;let s=useLocation(),et;if(o){var nt;let lt=typeof o=="string"?parsePath(o):o;it==="/"||(nt=lt.pathname)!=null&&nt.startsWith(it)||invariant(!1),et=lt}else et=s;let at=et.pathname||"/",ht=it==="/"?at:at.slice(it.length)||"/",dt=matchRoutes(a,{pathname:ht}),ut=_renderMatches(dt&&dt.map(lt=>Object.assign({},lt,{params:Object.assign({},rt,lt.params),pathname:joinPaths([it,tt.encodeLocation?tt.encodeLocation(lt.pathname).pathname:lt.pathname]),pathnameBase:lt.pathnameBase==="/"?it:joinPaths([it,tt.encodeLocation?tt.encodeLocation(lt.pathnameBase).pathname:lt.pathnameBase])})),ct,_e);return o&&ut?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$2({pathname:"/",search:"",hash:"",state:null,key:"default"},et),navigationType:Action.Pop}},ut):ut}function DefaultErrorComponent(){let a=useRouteError(),o=isRouteErrorResponse(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),_e=a instanceof Error?a.stack:null,ct={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},gt=null;return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},o),_e?reactExports.createElement("pre",{style:ct},_e):null,gt)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(o){super(o),this.state={location:o.location,revalidation:o.revalidation,error:o.error}}static getDerivedStateFromError(o){return{error:o}}static getDerivedStateFromProps(o,_e){return _e.location!==o.location||_e.revalidation!=="idle"&&o.revalidation==="idle"?{error:o.error,location:o.location,revalidation:o.revalidation}:{error:o.error||_e.error,location:_e.location,revalidation:o.revalidation||_e.revalidation}}componentDidCatch(o,_e){console.error("React Router caught the following error during render",o,_e)}render(){return this.state.error?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(a){let{routeContext:o,match:_e,children:tt}=a,ct=reactExports.useContext(DataRouterContext);return ct&&ct.static&&ct.staticContext&&(_e.route.errorElement||_e.route.ErrorBoundary)&&(ct.staticContext._deepestRenderedBoundaryId=_e.route.id),reactExports.createElement(RouteContext.Provider,{value:o},tt)}function _renderMatches(a,o,_e){var tt;if(o===void 0&&(o=[]),_e===void 0&&(_e=null),a==null){var ct;if((ct=_e)!=null&&ct.errors)a=_e.matches;else return null}let gt=a,rt=(tt=_e)==null?void 0:tt.errors;if(rt!=null){let it=gt.findIndex(s=>s.route.id&&(rt==null?void 0:rt[s.route.id]));it>=0||invariant(!1),gt=gt.slice(0,Math.min(gt.length,it+1))}return gt.reduceRight((it,s,et)=>{let nt=s.route.id?rt==null?void 0:rt[s.route.id]:null,at=null;_e&&(at=s.route.errorElement||defaultErrorElement);let ht=o.concat(gt.slice(0,et+1)),dt=()=>{let ut;return nt?ut=at:s.route.Component?ut=reactExports.createElement(s.route.Component,null):s.route.element?ut=s.route.element:ut=it,reactExports.createElement(RenderedRoute,{match:s,routeContext:{outlet:it,matches:ht,isDataRoute:_e!=null},children:ut})};return _e&&(s.route.ErrorBoundary||s.route.errorElement||et===0)?reactExports.createElement(RenderErrorBoundary,{location:_e.location,revalidation:_e.revalidation,component:at,error:nt,children:dt(),routeContext:{outlet:null,matches:ht,isDataRoute:!0}}):dt()},null)}var DataRouterHook$1=function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a}(DataRouterHook$1||{}),DataRouterStateHook$1=function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a}(DataRouterStateHook$1||{});function useDataRouterContext(a){let o=reactExports.useContext(DataRouterContext);return o||invariant(!1),o}function useDataRouterState(a){let o=reactExports.useContext(DataRouterStateContext);return o||invariant(!1),o}function useRouteContext(a){let o=reactExports.useContext(RouteContext);return o||invariant(!1),o}function useCurrentRouteId(a){let o=useRouteContext(),_e=o.matches[o.matches.length-1];return _e.route.id||invariant(!1),_e.route.id}function useRouteError(){var a;let o=reactExports.useContext(RouteErrorContext),_e=useDataRouterState(DataRouterStateHook$1.UseRouteError),tt=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return o||((a=_e.errors)==null?void 0:a[tt])}function useNavigateStable(){let{router:a}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),o=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),_e=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{_e.current=!0}),reactExports.useCallback(function(ct,gt){gt===void 0&&(gt={}),_e.current&&(typeof ct=="number"?a.navigate(ct):a.navigate(ct,_extends$2({fromRouteId:o},gt)))},[a,o])}function Route(a){invariant(!1)}function Router(a){let{basename:o="/",children:_e=null,location:tt,navigationType:ct=Action.Pop,navigator:gt,static:rt=!1}=a;useInRouterContext()&&invariant(!1);let it=o.replace(/^\/*/,"/"),s=reactExports.useMemo(()=>({basename:it,navigator:gt,static:rt}),[it,gt,rt]);typeof tt=="string"&&(tt=parsePath(tt));let{pathname:et="/",search:nt="",hash:at="",state:ht=null,key:dt="default"}=tt,ut=reactExports.useMemo(()=>{let lt=stripBasename(et,it);return lt==null?null:{location:{pathname:lt,search:nt,hash:at,state:ht,key:dt},navigationType:ct}},[it,et,nt,at,ht,dt,ct]);return ut==null?null:reactExports.createElement(NavigationContext.Provider,{value:s},reactExports.createElement(LocationContext.Provider,{children:_e,value:ut}))}function Routes(a){let{children:o,location:_e}=a;return useRoutes(createRoutesFromChildren(o),_e)}new Promise(()=>{});function createRoutesFromChildren(a,o){o===void 0&&(o=[]);let _e=[];return reactExports.Children.forEach(a,(tt,ct)=>{if(!reactExports.isValidElement(tt))return;let gt=[...o,ct];if(tt.type===reactExports.Fragment){_e.push.apply(_e,createRoutesFromChildren(tt.props.children,gt));return}tt.type!==Route&&invariant(!1),!tt.props.index||!tt.props.children||invariant(!1);let rt={id:tt.props.id||gt.join("-"),caseSensitive:tt.props.caseSensitive,element:tt.props.element,Component:tt.props.Component,index:tt.props.index,path:tt.props.path,loader:tt.props.loader,action:tt.props.action,errorElement:tt.props.errorElement,ErrorBoundary:tt.props.ErrorBoundary,hasErrorBoundary:tt.props.ErrorBoundary!=null||tt.props.errorElement!=null,shouldRevalidate:tt.props.shouldRevalidate,handle:tt.props.handle,lazy:tt.props.lazy};tt.props.children&&(rt.children=createRoutesFromChildren(tt.props.children,gt)),_e.push(rt)}),_e}/** + */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(a){for(var o=1;os.pathnameBase)),rt=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{rt.current=!0}),reactExports.useCallback(function(s,et){if(et===void 0&&(et={}),!rt.current)return;if(typeof s=="number"){_e.go(s);return}let nt=resolveTo(s,JSON.parse(gt),ct,et.relative==="path");a==null&&o!=="/"&&(nt.pathname=nt.pathname==="/"?o:joinPaths([o,nt.pathname])),(et.replace?_e.replace:_e.push)(nt,et.state,et)},[o,_e,gt,ct,a])}function useParams(){let{matches:a}=reactExports.useContext(RouteContext),o=a[a.length-1];return o?o.params:{}}function useRoutes(a,o){return useRoutesImpl(a,o)}function useRoutesImpl(a,o,_e){useInRouterContext()||invariant(!1);let{navigator:tt}=reactExports.useContext(NavigationContext),{matches:ct}=reactExports.useContext(RouteContext),gt=ct[ct.length-1],rt=gt?gt.params:{};gt&>.pathname;let it=gt?gt.pathnameBase:"/";gt&>.route;let s=useLocation(),et;if(o){var nt;let lt=typeof o=="string"?parsePath(o):o;it==="/"||(nt=lt.pathname)!=null&&nt.startsWith(it)||invariant(!1),et=lt}else et=s;let at=et.pathname||"/",ht=it==="/"?at:at.slice(it.length)||"/",dt=matchRoutes(a,{pathname:ht}),pt=_renderMatches(dt&&dt.map(lt=>Object.assign({},lt,{params:Object.assign({},rt,lt.params),pathname:joinPaths([it,tt.encodeLocation?tt.encodeLocation(lt.pathname).pathname:lt.pathname]),pathnameBase:lt.pathnameBase==="/"?it:joinPaths([it,tt.encodeLocation?tt.encodeLocation(lt.pathnameBase).pathname:lt.pathnameBase])})),ct,_e);return o&&pt?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$2({pathname:"/",search:"",hash:"",state:null,key:"default"},et),navigationType:Action.Pop}},pt):pt}function DefaultErrorComponent(){let a=useRouteError(),o=isRouteErrorResponse(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),_e=a instanceof Error?a.stack:null,ct={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},gt=null;return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},o),_e?reactExports.createElement("pre",{style:ct},_e):null,gt)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(o){super(o),this.state={location:o.location,revalidation:o.revalidation,error:o.error}}static getDerivedStateFromError(o){return{error:o}}static getDerivedStateFromProps(o,_e){return _e.location!==o.location||_e.revalidation!=="idle"&&o.revalidation==="idle"?{error:o.error,location:o.location,revalidation:o.revalidation}:{error:o.error||_e.error,location:_e.location,revalidation:o.revalidation||_e.revalidation}}componentDidCatch(o,_e){console.error("React Router caught the following error during render",o,_e)}render(){return this.state.error?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(a){let{routeContext:o,match:_e,children:tt}=a,ct=reactExports.useContext(DataRouterContext);return ct&&ct.static&&ct.staticContext&&(_e.route.errorElement||_e.route.ErrorBoundary)&&(ct.staticContext._deepestRenderedBoundaryId=_e.route.id),reactExports.createElement(RouteContext.Provider,{value:o},tt)}function _renderMatches(a,o,_e){var tt;if(o===void 0&&(o=[]),_e===void 0&&(_e=null),a==null){var ct;if((ct=_e)!=null&&ct.errors)a=_e.matches;else return null}let gt=a,rt=(tt=_e)==null?void 0:tt.errors;if(rt!=null){let it=gt.findIndex(s=>s.route.id&&(rt==null?void 0:rt[s.route.id]));it>=0||invariant(!1),gt=gt.slice(0,Math.min(gt.length,it+1))}return gt.reduceRight((it,s,et)=>{let nt=s.route.id?rt==null?void 0:rt[s.route.id]:null,at=null;_e&&(at=s.route.errorElement||defaultErrorElement);let ht=o.concat(gt.slice(0,et+1)),dt=()=>{let pt;return nt?pt=at:s.route.Component?pt=reactExports.createElement(s.route.Component,null):s.route.element?pt=s.route.element:pt=it,reactExports.createElement(RenderedRoute,{match:s,routeContext:{outlet:it,matches:ht,isDataRoute:_e!=null},children:pt})};return _e&&(s.route.ErrorBoundary||s.route.errorElement||et===0)?reactExports.createElement(RenderErrorBoundary,{location:_e.location,revalidation:_e.revalidation,component:at,error:nt,children:dt(),routeContext:{outlet:null,matches:ht,isDataRoute:!0}}):dt()},null)}var DataRouterHook$1=function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a}(DataRouterHook$1||{}),DataRouterStateHook$1=function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a}(DataRouterStateHook$1||{});function useDataRouterContext(a){let o=reactExports.useContext(DataRouterContext);return o||invariant(!1),o}function useDataRouterState(a){let o=reactExports.useContext(DataRouterStateContext);return o||invariant(!1),o}function useRouteContext(a){let o=reactExports.useContext(RouteContext);return o||invariant(!1),o}function useCurrentRouteId(a){let o=useRouteContext(),_e=o.matches[o.matches.length-1];return _e.route.id||invariant(!1),_e.route.id}function useRouteError(){var a;let o=reactExports.useContext(RouteErrorContext),_e=useDataRouterState(DataRouterStateHook$1.UseRouteError),tt=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return o||((a=_e.errors)==null?void 0:a[tt])}function useNavigateStable(){let{router:a}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),o=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),_e=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{_e.current=!0}),reactExports.useCallback(function(ct,gt){gt===void 0&&(gt={}),_e.current&&(typeof ct=="number"?a.navigate(ct):a.navigate(ct,_extends$2({fromRouteId:o},gt)))},[a,o])}function Route(a){invariant(!1)}function Router(a){let{basename:o="/",children:_e=null,location:tt,navigationType:ct=Action.Pop,navigator:gt,static:rt=!1}=a;useInRouterContext()&&invariant(!1);let it=o.replace(/^\/*/,"/"),s=reactExports.useMemo(()=>({basename:it,navigator:gt,static:rt}),[it,gt,rt]);typeof tt=="string"&&(tt=parsePath(tt));let{pathname:et="/",search:nt="",hash:at="",state:ht=null,key:dt="default"}=tt,pt=reactExports.useMemo(()=>{let lt=stripBasename(et,it);return lt==null?null:{location:{pathname:lt,search:nt,hash:at,state:ht,key:dt},navigationType:ct}},[it,et,nt,at,ht,dt,ct]);return pt==null?null:reactExports.createElement(NavigationContext.Provider,{value:s},reactExports.createElement(LocationContext.Provider,{children:_e,value:pt}))}function Routes(a){let{children:o,location:_e}=a;return useRoutes(createRoutesFromChildren(o),_e)}new Promise(()=>{});function createRoutesFromChildren(a,o){o===void 0&&(o=[]);let _e=[];return reactExports.Children.forEach(a,(tt,ct)=>{if(!reactExports.isValidElement(tt))return;let gt=[...o,ct];if(tt.type===reactExports.Fragment){_e.push.apply(_e,createRoutesFromChildren(tt.props.children,gt));return}tt.type!==Route&&invariant(!1),!tt.props.index||!tt.props.children||invariant(!1);let rt={id:tt.props.id||gt.join("-"),caseSensitive:tt.props.caseSensitive,element:tt.props.element,Component:tt.props.Component,index:tt.props.index,path:tt.props.path,loader:tt.props.loader,action:tt.props.action,errorElement:tt.props.errorElement,ErrorBoundary:tt.props.ErrorBoundary,hasErrorBoundary:tt.props.ErrorBoundary!=null||tt.props.errorElement!=null,shouldRevalidate:tt.props.shouldRevalidate,handle:tt.props.handle,lazy:tt.props.lazy};tt.props.children&&(rt.children=createRoutesFromChildren(tt.props.children,gt)),_e.push(rt)}),_e}/** * React Router DOM v6.17.0 * * Copyright (c) Remix Software Inc. @@ -64,169 +64,8 @@ Error generating stack: `+gt.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function createSearchParams(a){return a===void 0&&(a=""),new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((o,_e)=>{let tt=a[_e];return o.concat(Array.isArray(tt)?tt.map(ct=>[_e,ct]):[[_e,tt]])},[]))}function getSearchParamsForLocation(a,o){let _e=createSearchParams(a);return o&&o.forEach((tt,ct)=>{_e.has(ct)||o.getAll(ct).forEach(gt=>{_e.append(ct,gt)})}),_e}const START_TRANSITION="startTransition",startTransitionImpl=React$2[START_TRANSITION];function BrowserRouter(a){let{basename:o,children:_e,future:tt,window:ct}=a,gt=reactExports.useRef();gt.current==null&&(gt.current=createBrowserHistory({window:ct,v5Compat:!0}));let rt=gt.current,[it,s]=reactExports.useState({action:rt.action,location:rt.location}),{v7_startTransition:et}=tt||{},nt=reactExports.useCallback(at=>{et&&startTransitionImpl?startTransitionImpl(()=>s(at)):s(at)},[s,et]);return reactExports.useLayoutEffect(()=>rt.listen(nt),[rt,nt]),reactExports.createElement(Router,{basename:o,children:_e,location:it.location,navigationType:it.action,navigator:rt})}var DataRouterHook;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(a){a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useSearchParams(a){let o=reactExports.useRef(createSearchParams(a)),_e=reactExports.useRef(!1),tt=useLocation(),ct=reactExports.useMemo(()=>getSearchParamsForLocation(tt.search,_e.current?null:o.current),[tt.search]),gt=useNavigate(),rt=reactExports.useCallback((it,s)=>{const et=createSearchParams(typeof it=="function"?it(ct):it);_e.current=!0,gt("?"+et,s)},[gt,ct]);return[ct,rt]}var lib={},uaParser_min={exports:{}};(function(a,o){(function(_e,tt){var ct="1.0.36",gt="",rt="?",it="function",s="undefined",et="object",nt="string",at="major",ht="model",dt="name",ut="type",lt="vendor",mt="version",ot="architecture",pt="console",ft="mobile",yt="tablet",vt="smarttv",bt="wearable",At="embedded",Nt=350,St="Amazon",wt="Apple",Mt="ASUS",Ht="BlackBerry",Ot="Browser",Dt="Chrome",Gt="Edge",nn="Firefox",zt="Google",Ft="Huawei",un="LG",vn="Microsoft",yn="Motorola",cn="Opera",gn="Samsung",bn="Sharp",fn="Sony",Tn="Xiaomi",_n="Zebra",Un="Facebook",Pn="Chromium OS",In="Mac OS",Rn=function(An,Wn){var Cn={};for(var Nn in An)Wn[Nn]&&Wn[Nn].length%2===0?Cn[Nn]=Wn[Nn].concat(An[Nn]):Cn[Nn]=An[Nn];return Cn},On=function(An){for(var Wn={},Cn=0;Cn0?st.length===2?typeof st[1]==it?this[st[0]]=st[1].call(this,Rt):this[st[0]]=st[1]:st.length===3?typeof st[1]===it&&!(st[1].exec&&st[1].test)?this[st[0]]=Rt?st[1].call(this,Rt,st[2]):tt:this[st[0]]=Rt?Rt.replace(st[1],st[2]):tt:st.length===4&&(this[st[0]]=Rt?st[3].call(this,Rt.replace(st[1],st[2])):tt):this[st]=Rt||tt;Cn+=2}},on=function(An,Wn){for(var Cn in Wn)if(typeof Wn[Cn]===et&&Wn[Cn].length>0){for(var Nn=0;Nn2&&(Tt[ht]="iPad",Tt[ut]=yt),Tt},this.getEngine=function(){var Tt={};return Tt[dt]=tt,Tt[mt]=tt,Zn.call(Tt,Nn,kt.engine),Tt},this.getOS=function(){var Tt={};return Tt[dt]=tt,Tt[mt]=tt,Zn.call(Tt,Nn,kt.os),st&&!Tt[dt]&&qt&&qt.platform!="Unknown"&&(Tt[dt]=qt.platform.replace(/chrome os/i,Pn).replace(/macos/i,In)),Tt},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 Nn},this.setUA=function(Tt){return Nn=typeof Tt===nt&&Tt.length>Nt?Fn(Tt,Nt):Tt,this},this.setUA(Nn),this};$n.VERSION=ct,$n.BROWSER=On([dt,mt,at]),$n.CPU=On([ot]),$n.DEVICE=On([ht,lt,ut,pt,ft,vt,yt,bt,At]),$n.ENGINE=$n.OS=On([dt,mt]),a.exports&&(o=a.exports=$n),o.UAParser=$n;var Jn=typeof _e!==s&&(_e.jQuery||_e.Zepto);if(Jn&&!Jn.ua){var Kn=new $n;Jn.ua=Kn.getResult(),Jn.ua.get=function(){return Kn.getUA()},Jn.ua.set=function(An){Kn.setUA(An);var Wn=Kn.getResult();for(var Cn in Wn)Jn.ua[Cn]=Wn[Cn]}}})(typeof window=="object"?window:commonjsGlobal)})(uaParser_min,uaParser_min.exports);var uaParser_minExports=uaParser_min.exports;Object.defineProperty(lib,"__esModule",{value:!0});function _interopDefault(a){return a&&typeof a=="object"&&"default"in a?a.default:a}var React=reactExports,React__default=_interopDefault(React),UAParser$1=uaParser_minExports,ClientUAInstance=new UAParser$1,browser=ClientUAInstance.getBrowser(),cpu=ClientUAInstance.getCPU(),device=ClientUAInstance.getDevice(),engine=ClientUAInstance.getEngine(),os=ClientUAInstance.getOS(),ua=ClientUAInstance.getUA(),setUa=function(o){return ClientUAInstance.setUA(o)},parseUserAgent=function(o){if(!o){console.error("No userAgent string was provided");return}var _e=new UAParser$1(o);return{UA:_e,browser:_e.getBrowser(),cpu:_e.getCPU(),device:_e.getDevice(),engine:_e.getEngine(),os:_e.getOS(),ua:_e.getUA(),setUserAgent:function(ct){return _e.setUA(ct)}}},UAHelper=Object.freeze({ClientUAInstance,browser,cpu,device,engine,os,ua,setUa,parseUserAgent});function ownKeys(a,o){var _e=Object.keys(a);if(Object.getOwnPropertySymbols){var tt=Object.getOwnPropertySymbols(a);o&&(tt=tt.filter(function(ct){return Object.getOwnPropertyDescriptor(a,ct).enumerable})),_e.push.apply(_e,tt)}return _e}function _objectSpread2(a){for(var o=1;o=0)&&(_e[ct]=a[ct]);return _e}function _objectWithoutProperties(a,o){if(a==null)return{};var _e=_objectWithoutPropertiesLoose$1(a,o),tt,ct;if(Object.getOwnPropertySymbols){var gt=Object.getOwnPropertySymbols(a);for(ct=0;ct=0)&&Object.prototype.propertyIsEnumerable.call(a,tt)&&(_e[tt]=a[tt])}return _e}function _assertThisInitialized$1(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _possibleConstructorReturn(a,o){if(o&&(typeof o=="object"||typeof o=="function"))return o;if(o!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$1(a)}function _slicedToArray(a,o){return _arrayWithHoles(a)||_iterableToArrayLimit(a,o)||_unsupportedIterableToArray(a,o)||_nonIterableRest()}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _iterableToArrayLimit(a,o){var _e=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(_e!=null){var tt=[],ct=!0,gt=!1,rt,it;try{for(_e=_e.call(a);!(ct=(rt=_e.next()).done)&&(tt.push(rt.value),!(o&&tt.length===o));ct=!0);}catch(s){gt=!0,it=s}finally{try{!ct&&_e.return!=null&&_e.return()}finally{if(gt)throw it}}return tt}}function _unsupportedIterableToArray(a,o){if(a){if(typeof a=="string")return _arrayLikeToArray(a,o);var _e=Object.prototype.toString.call(a).slice(8,-1);if(_e==="Object"&&a.constructor&&(_e=a.constructor.name),_e==="Map"||_e==="Set")return Array.from(a);if(_e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_e))return _arrayLikeToArray(a,o)}}function _arrayLikeToArray(a,o){(o==null||o>a.length)&&(o=a.length);for(var _e=0,tt=new Array(o);_e1&&arguments[1]!==void 0?arguments[1]:"none";return o||_e},getNavigatorInstance=function(){return typeof window<"u"&&(window.navigator||navigator)?window.navigator||navigator:!1},isIOS13Check=function(o){var _e=getNavigatorInstance();return _e&&_e.platform&&(_e.platform.indexOf(o)!==-1||_e.platform==="MacIntel"&&_e.maxTouchPoints>1&&!window.MSStream)},browserPayload=function(o,_e,tt,ct,gt){return{isBrowser:o,browserMajorVersion:setDefaults(_e.major),browserFullVersion:setDefaults(_e.version),browserName:setDefaults(_e.name),engineName:setDefaults(tt.name),engineVersion:setDefaults(tt.version),osName:setDefaults(ct.name),osVersion:setDefaults(ct.version),userAgent:setDefaults(gt)}},mobilePayload=function(o,_e,tt,ct){return _objectSpread2({},o,{vendor:setDefaults(_e.vendor),model:setDefaults(_e.model),os:setDefaults(tt.name),osVersion:setDefaults(tt.version),ua:setDefaults(ct)})},smartTvPayload=function(o,_e,tt,ct){return{isSmartTV:o,engineName:setDefaults(_e.name),engineVersion:setDefaults(_e.version),osName:setDefaults(tt.name),osVersion:setDefaults(tt.version),userAgent:setDefaults(ct)}},consolePayload=function(o,_e,tt,ct){return{isConsole:o,engineName:setDefaults(_e.name),engineVersion:setDefaults(_e.version),osName:setDefaults(tt.name),osVersion:setDefaults(tt.version),userAgent:setDefaults(ct)}},wearablePayload=function(o,_e,tt,ct){return{isWearable:o,engineName:setDefaults(_e.name),engineVersion:setDefaults(_e.version),osName:setDefaults(tt.name),osVersion:setDefaults(tt.version),userAgent:setDefaults(ct)}},embeddedPayload=function(o,_e,tt,ct,gt){return{isEmbedded:o,vendor:setDefaults(_e.vendor),model:setDefaults(_e.model),engineName:setDefaults(tt.name),engineVersion:setDefaults(tt.version),osName:setDefaults(ct.name),osVersion:setDefaults(ct.version),userAgent:setDefaults(gt)}};function deviceDetect(a){var o=a?parseUserAgent(a):UAHelper,_e=o.device,tt=o.browser,ct=o.engine,gt=o.os,rt=o.ua,it=checkDeviceType(_e.type),s=it.isBrowser,et=it.isMobile,nt=it.isTablet,at=it.isSmartTV,ht=it.isConsole,dt=it.isWearable,ut=it.isEmbedded;if(s)return browserPayload(s,tt,ct,gt,rt);if(at)return smartTvPayload(at,ct,gt,rt);if(ht)return consolePayload(ht,ct,gt,rt);if(et||nt)return mobilePayload(it,_e,gt,rt);if(dt)return wearablePayload(dt,ct,gt,rt);if(ut)return embeddedPayload(ut,_e,ct,gt,rt)}var isMobileType=function(o){var _e=o.type;return _e===DeviceTypes.Mobile},isTabletType=function(o){var _e=o.type;return _e===DeviceTypes.Tablet},isMobileAndTabletType=function(o){var _e=o.type;return _e===DeviceTypes.Mobile||_e===DeviceTypes.Tablet},isSmartTVType=function(o){var _e=o.type;return _e===DeviceTypes.SmartTv},isBrowserType=function(o){var _e=o.type;return _e===DeviceTypes.Browser},isWearableType=function(o){var _e=o.type;return _e===DeviceTypes.Wearable},isConsoleType=function(o){var _e=o.type;return _e===DeviceTypes.Console},isEmbeddedType=function(o){var _e=o.type;return _e===DeviceTypes.Embedded},getMobileVendor=function(o){var _e=o.vendor;return setDefaults(_e)},getMobileModel=function(o){var _e=o.model;return setDefaults(_e)},getDeviceType=function(o){var _e=o.type;return setDefaults(_e,"browser")},isAndroidType=function(o){var _e=o.name;return _e===OsTypes.Android},isWindowsType=function(o){var _e=o.name;return _e===OsTypes.Windows},isMacOsType=function(o){var _e=o.name;return _e===OsTypes.MAC_OS},isWinPhoneType=function(o){var _e=o.name;return _e===OsTypes.WindowsPhone},isIOSType=function(o){var _e=o.name;return _e===OsTypes.IOS},getOsVersion=function(o){var _e=o.version;return setDefaults(_e)},getOsName=function(o){var _e=o.name;return setDefaults(_e)},isChromeType=function(o){var _e=o.name;return _e===BrowserTypes.Chrome},isFirefoxType=function(o){var _e=o.name;return _e===BrowserTypes.Firefox},isChromiumType=function(o){var _e=o.name;return _e===BrowserTypes.Chromium},isEdgeType=function(o){var _e=o.name;return _e===BrowserTypes.Edge},isYandexType=function(o){var _e=o.name;return _e===BrowserTypes.Yandex},isSafariType=function(o){var _e=o.name;return _e===BrowserTypes.Safari||_e===BrowserTypes.MobileSafari},isMobileSafariType=function(o){var _e=o.name;return _e===BrowserTypes.MobileSafari},isOperaType=function(o){var _e=o.name;return _e===BrowserTypes.Opera},isIEType=function(o){var _e=o.name;return _e===BrowserTypes.InternetExplorer||_e===BrowserTypes.Ie},isMIUIType=function(o){var _e=o.name;return _e===BrowserTypes.MIUI},isSamsungBrowserType=function(o){var _e=o.name;return _e===BrowserTypes.SamsungBrowser},getBrowserFullVersion=function(o){var _e=o.version;return setDefaults(_e)},getBrowserVersion=function(o){var _e=o.major;return setDefaults(_e)},getBrowserName=function(o){var _e=o.name;return setDefaults(_e)},getEngineName=function(o){var _e=o.name;return setDefaults(_e)},getEngineVersion=function(o){var _e=o.version;return setDefaults(_e)},isElectronType=function(){var o=getNavigatorInstance(),_e=o&&o.userAgent&&o.userAgent.toLowerCase();return typeof _e=="string"?/electron/.test(_e):!1},isEdgeChromiumType=function(o){return typeof o=="string"&&o.indexOf("Edg/")!==-1},getIOS13=function(){var o=getNavigatorInstance();return o&&(/iPad|iPhone|iPod/.test(o.platform)||o.platform==="MacIntel"&&o.maxTouchPoints>1)&&!window.MSStream},getIPad13=function(){return isIOS13Check("iPad")},getIphone13=function(){return isIOS13Check("iPhone")},getIPod13=function(){return isIOS13Check("iPod")},getUseragent=function(o){return setDefaults(o)};function buildSelectorsObject(a){var o=a||UAHelper,_e=o.device,tt=o.browser,ct=o.os,gt=o.engine,rt=o.ua;return{isSmartTV:isSmartTVType(_e),isConsole:isConsoleType(_e),isWearable:isWearableType(_e),isEmbedded:isEmbeddedType(_e),isMobileSafari:isMobileSafariType(tt)||getIPad13(),isChromium:isChromiumType(tt),isMobile:isMobileAndTabletType(_e)||getIPad13(),isMobileOnly:isMobileType(_e),isTablet:isTabletType(_e)||getIPad13(),isBrowser:isBrowserType(_e),isDesktop:isBrowserType(_e),isAndroid:isAndroidType(ct),isWinPhone:isWinPhoneType(ct),isIOS:isIOSType(ct)||getIPad13(),isChrome:isChromeType(tt),isFirefox:isFirefoxType(tt),isSafari:isSafariType(tt),isOpera:isOperaType(tt),isIE:isIEType(tt),osVersion:getOsVersion(ct),osName:getOsName(ct),fullBrowserVersion:getBrowserFullVersion(tt),browserVersion:getBrowserVersion(tt),browserName:getBrowserName(tt),mobileVendor:getMobileVendor(_e),mobileModel:getMobileModel(_e),engineName:getEngineName(gt),engineVersion:getEngineVersion(gt),getUA:getUseragent(rt),isEdge:isEdgeType(tt)||isEdgeChromiumType(rt),isYandex:isYandexType(tt),deviceType:getDeviceType(_e),isIOS13:getIOS13(),isIPad13:getIPad13(),isIPhone13:getIphone13(),isIPod13:getIPod13(),isElectron:isElectronType(),isEdgeChromium:isEdgeChromiumType(rt),isLegacyEdge:isEdgeType(tt)&&!isEdgeChromiumType(rt),isWindows:isWindowsType(ct),isMacOs:isMacOsType(ct),isMIUI:isMIUIType(tt),isSamsungBrowser:isSamsungBrowserType(tt)}}var isSmartTV=isSmartTVType(device),isConsole=isConsoleType(device),isWearable=isWearableType(device),isEmbedded=isEmbeddedType(device),isMobileSafari=isMobileSafariType(browser)||getIPad13(),isChromium=isChromiumType(browser),isMobile=isMobileAndTabletType(device)||getIPad13(),isMobileOnly=isMobileType(device),isTablet=isTabletType(device)||getIPad13(),isBrowser$1=isBrowserType(device),isDesktop=isBrowserType(device),isAndroid=isAndroidType(os),isWinPhone=isWinPhoneType(os),isIOS=isIOSType(os)||getIPad13(),isChrome=isChromeType(browser),isFirefox=isFirefoxType(browser),isSafari=isSafariType(browser),isOpera=isOperaType(browser),isIE=isIEType(browser),osVersion=getOsVersion(os),osName=getOsName(os),fullBrowserVersion=getBrowserFullVersion(browser),browserVersion=getBrowserVersion(browser),browserName=getBrowserName(browser),mobileVendor=getMobileVendor(device),mobileModel=getMobileModel(device),engineName=getEngineName(engine),engineVersion=getEngineVersion(engine),getUA=getUseragent(ua),isEdge=isEdgeType(browser)||isEdgeChromiumType(ua),isYandex=isYandexType(browser),deviceType=getDeviceType(device),isIOS13=getIOS13(),isIPad13=getIPad13(),isIPhone13=getIphone13(),isIPod13=getIPod13(),isElectron=isElectronType(),isEdgeChromium=isEdgeChromiumType(ua),isLegacyEdge=isEdgeType(browser)&&!isEdgeChromiumType(ua),isWindows=isWindowsType(os),isMacOs=isMacOsType(os),isMIUI=isMIUIType(browser),isSamsungBrowser=isSamsungBrowserType(browser),getSelectorsByUserAgent=function(o){if(!o||typeof o!="string"){console.error("No valid user agent string was provided");return}var _e=parseUserAgent(o),tt=_e.device,ct=_e.browser,gt=_e.os,rt=_e.engine,it=_e.ua;return buildSelectorsObject({device:tt,browser:ct,os:gt,engine:rt,ua:it})},AndroidView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isAndroid?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},BrowserView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isBrowser$1?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},IEView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isIE?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},IOSView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isIOS?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},MobileView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isMobile?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},TabletView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isTablet?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},WinPhoneView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isWinPhone?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},MobileOnlyView=function(o){var _e=o.renderWithFragment,tt=o.children;o.viewClassName,o.style;var ct=_objectWithoutProperties(o,["renderWithFragment","children","viewClassName","style"]);return isMobileOnly?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},SmartTVView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isSmartTV?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},ConsoleView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isConsole?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},WearableView=function(o){var _e=o.renderWithFragment,tt=o.children,ct=_objectWithoutProperties(o,["renderWithFragment","children"]);return isWearable?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",ct,tt):null},CustomView=function(o){var _e=o.renderWithFragment,tt=o.children;o.viewClassName,o.style;var ct=o.condition,gt=_objectWithoutProperties(o,["renderWithFragment","children","viewClassName","style","condition"]);return ct?_e?React__default.createElement(React.Fragment,null,tt):React__default.createElement("div",gt,tt):null};function withOrientationChange(a){return function(o){_inherits(_e,o);function _e(tt){var ct;return _classCallCheck(this,_e),ct=_possibleConstructorReturn(this,_getPrototypeOf(_e).call(this,tt)),ct.isEventListenerAdded=!1,ct.handleOrientationChange=ct.handleOrientationChange.bind(_assertThisInitialized$1(ct)),ct.onOrientationChange=ct.onOrientationChange.bind(_assertThisInitialized$1(ct)),ct.onPageLoad=ct.onPageLoad.bind(_assertThisInitialized$1(ct)),ct.state={isLandscape:!1,isPortrait:!1},ct}return _createClass(_e,[{key:"handleOrientationChange",value:function(){this.isEventListenerAdded||(this.isEventListenerAdded=!0);var ct=window.innerWidth>window.innerHeight?90:0;this.setState({isPortrait:ct===0,isLandscape:ct===90})}},{key:"onOrientationChange",value:function(){this.handleOrientationChange()}},{key:"onPageLoad",value:function(){this.handleOrientationChange()}},{key:"componentDidMount",value:function(){(typeof window>"u"?"undefined":_typeof(window))!==void 0&&isMobile&&(this.isEventListenerAdded?window.removeEventListener("load",this.onPageLoad,!1):(this.handleOrientationChange(),window.addEventListener("load",this.onPageLoad,!1)),window.addEventListener("resize",this.onOrientationChange,!1))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.onOrientationChange,!1)}},{key:"render",value:function(){return React__default.createElement(a,_extends$1({},this.props,{isLandscape:this.state.isLandscape,isPortrait:this.state.isPortrait}))}}]),_e}(React__default.Component)}function useMobileOrientation(){var a=React.useState(function(){var gt=window.innerWidth>window.innerHeight?90:0;return{isPortrait:gt===0,isLandscape:gt===90,orientation:gt===0?"portrait":"landscape"}}),o=_slicedToArray(a,2),_e=o[0],tt=o[1],ct=React.useCallback(function(){var gt=window.innerWidth>window.innerHeight?90:0,rt={isPortrait:gt===0,isLandscape:gt===90,orientation:gt===0?"portrait":"landscape"};_e.orientation!==rt.orientation&&tt(rt)},[_e.orientation]);return React.useEffect(function(){return(typeof window>"u"?"undefined":_typeof(window))!==void 0&&isMobile&&(ct(),window.addEventListener("load",ct,!1),window.addEventListener("resize",ct,!1)),function(){window.removeEventListener("resize",ct,!1),window.removeEventListener("load",ct,!1)}},[ct]),_e}function useDeviceData(a){var o=a||window.navigator.userAgent;return parseUserAgent(o)}function useDeviceSelectors(a){var o=a||window.navigator.userAgent,_e=useDeviceData(o),tt=buildSelectorsObject(_e);return[tt,_e]}lib.AndroidView=AndroidView;lib.BrowserTypes=BrowserTypes;lib.BrowserView=BrowserView;lib.ConsoleView=ConsoleView;lib.CustomView=CustomView;lib.IEView=IEView;lib.IOSView=IOSView;lib.MobileOnlyView=MobileOnlyView;lib.MobileView=MobileView;lib.OsTypes=OsTypes;lib.SmartTVView=SmartTVView;lib.TabletView=TabletView;lib.WearableView=WearableView;lib.WinPhoneView=WinPhoneView;lib.browserName=browserName;lib.browserVersion=browserVersion;lib.deviceDetect=deviceDetect;lib.deviceType=deviceType;lib.engineName=engineName;lib.engineVersion=engineVersion;lib.fullBrowserVersion=fullBrowserVersion;lib.getSelectorsByUserAgent=getSelectorsByUserAgent;lib.getUA=getUA;lib.isAndroid=isAndroid;lib.isBrowser=isBrowser$1;lib.isChrome=isChrome;lib.isChromium=isChromium;lib.isConsole=isConsole;lib.isDesktop=isDesktop;lib.isEdge=isEdge;lib.isEdgeChromium=isEdgeChromium;lib.isElectron=isElectron;lib.isEmbedded=isEmbedded;lib.isFirefox=isFirefox;lib.isIE=isIE;lib.isIOS=isIOS;lib.isIOS13=isIOS13;lib.isIPad13=isIPad13;lib.isIPhone13=isIPhone13;lib.isIPod13=isIPod13;lib.isLegacyEdge=isLegacyEdge;lib.isMIUI=isMIUI;lib.isMacOs=isMacOs;var isMobile_1=lib.isMobile=isMobile;lib.isMobileOnly=isMobileOnly;lib.isMobileSafari=isMobileSafari;lib.isOpera=isOpera;lib.isSafari=isSafari;lib.isSamsungBrowser=isSamsungBrowser;lib.isSmartTV=isSmartTV;lib.isTablet=isTablet;lib.isWearable=isWearable;lib.isWinPhone=isWinPhone;lib.isWindows=isWindows;lib.isYandex=isYandex;lib.mobileModel=mobileModel;lib.mobileVendor=mobileVendor;lib.osName=osName;lib.osVersion=osVersion;lib.parseUserAgent=parseUserAgent;lib.setUserAgent=setUserAgent;lib.useDeviceData=useDeviceData;lib.useDeviceSelectors=useDeviceSelectors;lib.useMobileOrientation=useMobileOrientation;lib.withOrientationChange=withOrientationChange;var uaParser={exports:{}};(function(a,o){(function(_e,tt){var ct="1.0.36",gt="",rt="?",it="function",s="undefined",et="object",nt="string",at="major",ht="model",dt="name",ut="type",lt="vendor",mt="version",ot="architecture",pt="console",ft="mobile",yt="tablet",vt="smarttv",bt="wearable",At="embedded",Nt=350,St="Amazon",wt="Apple",Mt="ASUS",Ht="BlackBerry",Ot="Browser",Dt="Chrome",Gt="Edge",nn="Firefox",zt="Google",Ft="Huawei",un="LG",vn="Microsoft",yn="Motorola",cn="Opera",gn="Samsung",bn="Sharp",fn="Sony",Tn="Xiaomi",_n="Zebra",Un="Facebook",Pn="Chromium OS",In="Mac OS",Rn=function(An,Wn){var Cn={};for(var Nn in An)Wn[Nn]&&Wn[Nn].length%2===0?Cn[Nn]=Wn[Nn].concat(An[Nn]):Cn[Nn]=An[Nn];return Cn},On=function(An){for(var Wn={},Cn=0;Cn0?st.length===2?typeof st[1]==it?this[st[0]]=st[1].call(this,Rt):this[st[0]]=st[1]:st.length===3?typeof st[1]===it&&!(st[1].exec&&st[1].test)?this[st[0]]=Rt?st[1].call(this,Rt,st[2]):tt:this[st[0]]=Rt?Rt.replace(st[1],st[2]):tt:st.length===4&&(this[st[0]]=Rt?st[3].call(this,Rt.replace(st[1],st[2])):tt):this[st]=Rt||tt;Cn+=2}},on=function(An,Wn){for(var Cn in Wn)if(typeof Wn[Cn]===et&&Wn[Cn].length>0){for(var Nn=0;Nn2&&(Tt[ht]="iPad",Tt[ut]=yt),Tt},this.getEngine=function(){var Tt={};return Tt[dt]=tt,Tt[mt]=tt,Zn.call(Tt,Nn,kt.engine),Tt},this.getOS=function(){var Tt={};return Tt[dt]=tt,Tt[mt]=tt,Zn.call(Tt,Nn,kt.os),st&&!Tt[dt]&&qt&&qt.platform!="Unknown"&&(Tt[dt]=qt.platform.replace(/chrome os/i,Pn).replace(/macos/i,In)),Tt},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 Nn},this.setUA=function(Tt){return Nn=typeof Tt===nt&&Tt.length>Nt?Fn(Tt,Nt):Tt,this},this.setUA(Nn),this};$n.VERSION=ct,$n.BROWSER=On([dt,mt,at]),$n.CPU=On([ot]),$n.DEVICE=On([ht,lt,ut,pt,ft,vt,yt,bt,At]),$n.ENGINE=$n.OS=On([dt,mt]),a.exports&&(o=a.exports=$n),o.UAParser=$n;var Jn=typeof _e!==s&&(_e.jQuery||_e.Zepto);if(Jn&&!Jn.ua){var Kn=new $n;Jn.ua=Kn.getResult(),Jn.ua.get=function(){return Kn.getUA()},Jn.ua.set=function(An){Kn.setUA(An);var Wn=Kn.getResult();for(var Cn in Wn)Jn.ua[Cn]=Wn[Cn]}}})(typeof window=="object"?window:commonjsGlobal)})(uaParser,uaParser.exports);var uaParserExports=uaParser.exports,base64={exports:{}};/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */base64.exports;(function(a,o){(function(_e){var tt=o,ct=a&&a.exports==tt&&a,gt=typeof commonjsGlobal=="object"&&commonjsGlobal;(gt.global===gt||gt.window===gt)&&(_e=gt);var rt=function(ut){this.message=ut};rt.prototype=new Error,rt.prototype.name="InvalidCharacterError";var it=function(ut){throw new rt(ut)},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",et=/[\t\n\f\r ]/g,nt=function(ut){ut=String(ut).replace(et,"");var lt=ut.length;lt%4==0&&(ut=ut.replace(/==?$/,""),lt=ut.length),(lt%4==1||/[^+a-zA-Z0-9/]/.test(ut))&&it("Invalid character: the string to be decoded is not correctly encoded.");for(var mt=0,ot,pt,ft="",yt=-1;++yt>(-2*mt&6)));return ft},at=function(ut){ut=String(ut),/[^\0-\xFF]/.test(ut)&&it("The string to be encoded contains characters outside of the Latin1 range.");for(var lt=ut.length%3,mt="",ot=-1,pt,ft,yt,vt,bt=ut.length-lt;++ot>18&63)+s.charAt(vt>>12&63)+s.charAt(vt>>6&63)+s.charAt(vt&63);return lt==2?(pt=ut.charCodeAt(ot)<<8,ft=ut.charCodeAt(++ot),vt=pt+ft,mt+=s.charAt(vt>>10)+s.charAt(vt>>4&63)+s.charAt(vt<<2&63)+"="):lt==1&&(vt=ut.charCodeAt(ot),mt+=s.charAt(vt>>2)+s.charAt(vt<<4&63)+"=="),mt},ht={encode:at,decode:nt,version:"1.0.0"};if(tt&&!tt.nodeType)if(ct)ct.exports=ht;else for(var dt in ht)ht.hasOwnProperty(dt)&&(tt[dt]=ht[dt]);else _e.base64=ht})(commonjsGlobal)})(base64,base64.exports);var base64Exports=base64.exports;function commonjsRequire(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var apiRTC_min={exports:{}};(function(a,o){(function(tt){a.exports=tt()})(function(){return function(){function tt(ct,gt,rt){function it(nt,at){if(!gt[nt]){if(!ct[nt]){var ht=typeof commonjsRequire=="function"&&commonjsRequire;if(!at&&ht)return ht(nt,!0);if(s)return s(nt,!0);var dt=new Error("Cannot find module '"+nt+"'");throw dt.code="MODULE_NOT_FOUND",dt}var ut=gt[nt]={exports:{}};ct[nt][0].call(ut.exports,function(lt){return it(ct[nt][1][lt]||lt)},ut,ut.exports,tt,ct,gt,rt)}return gt[nt].exports}for(var s=typeof commonjsRequire=="function"&&commonjsRequire,et=0;et0&&arguments[0]!==void 0?arguments[0]:{}).window,ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},lt=it.log,mt=it.detectBrowser(dt),ot={browserDetails:mt,commonShim:ht,extractVersion:it.extractVersion,disableLog:it.disableLog,disableWarnings:it.disableWarnings};switch(mt.browser){case"chrome":if(!s||!s.shimPeerConnection||!ut.shimChrome)return lt("Chrome shim is not included in this adapter release."),ot;lt("adapter.js shimming chrome."),ot.browserShim=s,s.shimGetUserMedia(dt),s.shimMediaStream(dt),s.shimPeerConnection(dt),s.shimOnTrack(dt),s.shimAddTrackRemoveTrack(dt),s.shimGetSendersWithDtmf(dt),s.shimGetStats(dt),s.shimSenderReceiverGetStats(dt),s.fixNegotiationNeeded(dt),ht.shimRTCIceCandidate(dt),ht.shimConnectionState(dt),ht.shimMaxMessageSize(dt),ht.shimSendThrowTypeError(dt),ht.removeAllowExtmapMixed(dt);break;case"firefox":if(!nt||!nt.shimPeerConnection||!ut.shimFirefox)return lt("Firefox shim is not included in this adapter release."),ot;lt("adapter.js shimming firefox."),ot.browserShim=nt,nt.shimGetUserMedia(dt),nt.shimPeerConnection(dt),nt.shimOnTrack(dt),nt.shimRemoveStream(dt),nt.shimSenderGetStats(dt),nt.shimReceiverGetStats(dt),nt.shimRTCDataChannel(dt),ht.shimRTCIceCandidate(dt),ht.shimConnectionState(dt),ht.shimMaxMessageSize(dt),ht.shimSendThrowTypeError(dt);break;case"edge":if(!et||!et.shimPeerConnection||!ut.shimEdge)return lt("MS edge shim is not included in this adapter release."),ot;lt("adapter.js shimming edge."),ot.browserShim=et,et.shimGetUserMedia(dt),et.shimGetDisplayMedia(dt),et.shimPeerConnection(dt),et.shimReplaceTrack(dt),ht.shimMaxMessageSize(dt),ht.shimSendThrowTypeError(dt);break;case"safari":if(!at||!ut.shimSafari)return lt("Safari shim is not included in this adapter release."),ot;lt("adapter.js shimming safari."),ot.browserShim=at,at.shimRTCIceServerUrls(dt),at.shimCreateOfferLegacy(dt),at.shimCallbacksAPI(dt),at.shimLocalStreamsAPI(dt),at.shimRemoteStreamsAPI(dt),at.shimTrackEventTransceiver(dt),at.shimGetUserMedia(dt),ht.shimRTCIceCandidate(dt),ht.shimMaxMessageSize(dt),ht.shimSendThrowTypeError(dt),ht.removeAllowExtmapMixed(dt);break;default:lt("Unsupported browser!")}return ot};var it=rt(tt("./utils")),s=rt(tt("./chrome/chrome_shim")),et=rt(tt("./edge/edge_shim")),nt=rt(tt("./firefox/firefox_shim")),at=rt(tt("./safari/safari_shim")),ht=rt(tt("./common_shim"))},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(tt,ct,gt){function rt(at){at.RTCPeerConnection.prototype.getLocalStreams=function(){var mt=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(ot){return mt._shimmedLocalStreams[ot][0]})};var ht=at.RTCPeerConnection.prototype.addTrack;at.RTCPeerConnection.prototype.addTrack=function(mt,ot){if(!ot)return ht.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var pt=ht.apply(this,arguments);return this._shimmedLocalStreams[ot.id]?this._shimmedLocalStreams[ot.id].indexOf(pt)===-1&&this._shimmedLocalStreams[ot.id].push(pt):this._shimmedLocalStreams[ot.id]=[ot,pt],pt};var dt=at.RTCPeerConnection.prototype.addStream;at.RTCPeerConnection.prototype.addStream=function(mt){var ot=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},mt.getTracks().forEach(function(yt){if(ot.getSenders().find(function(vt){return vt.track===yt}))throw new DOMException("Track already exists.","InvalidAccessError")});var pt=this.getSenders();dt.apply(this,arguments);var ft=this.getSenders().filter(function(yt){return pt.indexOf(yt)===-1});this._shimmedLocalStreams[mt.id]=[mt].concat(ft)};var ut=at.RTCPeerConnection.prototype.removeStream;at.RTCPeerConnection.prototype.removeStream=function(mt){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[mt.id],ut.apply(this,arguments)};var lt=at.RTCPeerConnection.prototype.removeTrack;at.RTCPeerConnection.prototype.removeTrack=function(mt){var ot=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},mt&&Object.keys(this._shimmedLocalStreams).forEach(function(pt){var ft=ot._shimmedLocalStreams[pt].indexOf(mt);ft!==-1&&ot._shimmedLocalStreams[pt].splice(ft,1),ot._shimmedLocalStreams[pt].length===1&&delete ot._shimmedLocalStreams[pt]}),lt.apply(this,arguments)}}Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=gt.shimGetUserMedia=void 0;var it=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(at){return typeof at}:function(at){return at&&typeof Symbol=="function"&&at.constructor===Symbol&&at!==Symbol.prototype?"symbol":typeof at},s=tt("./getusermedia");Object.defineProperty(gt,"shimGetUserMedia",{enumerable:!0,get:function(){return s.shimGetUserMedia}});var et=tt("./getdisplaymedia");Object.defineProperty(gt,"shimGetDisplayMedia",{enumerable:!0,get:function(){return et.shimGetDisplayMedia}}),gt.shimMediaStream=function(at){at.MediaStream=at.MediaStream||at.webkitMediaStream},gt.shimOnTrack=function(at){if((at===void 0?"undefined":it(at))!=="object"||!at.RTCPeerConnection||"ontrack"in at.RTCPeerConnection.prototype)nt.wrapPeerConnectionEvent(at,"track",function(dt){return dt.transceiver||Object.defineProperty(dt,"transceiver",{value:{receiver:dt.receiver}}),dt});else{Object.defineProperty(at.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(dt){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=dt)},enumerable:!0,configurable:!0});var ht=at.RTCPeerConnection.prototype.setRemoteDescription;at.RTCPeerConnection.prototype.setRemoteDescription=function(){var dt=this;return this._ontrackpoly||(this._ontrackpoly=function(ut){ut.stream.addEventListener("addtrack",function(lt){var mt=void 0;mt=at.RTCPeerConnection.prototype.getReceivers?dt.getReceivers().find(function(pt){return pt.track&&pt.track.id===lt.track.id}):{track:lt.track};var ot=new Event("track");ot.track=lt.track,ot.receiver=mt,ot.transceiver={receiver:mt},ot.streams=[ut.stream],dt.dispatchEvent(ot)}),ut.stream.getTracks().forEach(function(lt){var mt=void 0;mt=at.RTCPeerConnection.prototype.getReceivers?dt.getReceivers().find(function(pt){return pt.track&&pt.track.id===lt.id}):{track:lt};var ot=new Event("track");ot.track=lt,ot.receiver=mt,ot.transceiver={receiver:mt},ot.streams=[ut.stream],dt.dispatchEvent(ot)})},this.addEventListener("addstream",this._ontrackpoly)),ht.apply(this,arguments)}}},gt.shimGetSendersWithDtmf=function(at){if((at===void 0?"undefined":it(at))==="object"&&at.RTCPeerConnection&&!("getSenders"in at.RTCPeerConnection.prototype)&&"createDTMFSender"in at.RTCPeerConnection.prototype){var ht=function(pt,ft){return{track:ft,get dtmf(){return this._dtmf===void 0&&(ft.kind==="audio"?this._dtmf=pt.createDTMFSender(ft):this._dtmf=null),this._dtmf},_pc:pt}};if(!at.RTCPeerConnection.prototype.getSenders){at.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var dt=at.RTCPeerConnection.prototype.addTrack;at.RTCPeerConnection.prototype.addTrack=function(pt,ft){var yt=dt.apply(this,arguments);return yt||(yt=ht(this,pt),this._senders.push(yt)),yt};var ut=at.RTCPeerConnection.prototype.removeTrack;at.RTCPeerConnection.prototype.removeTrack=function(pt){ut.apply(this,arguments);var ft=this._senders.indexOf(pt);ft!==-1&&this._senders.splice(ft,1)}}var lt=at.RTCPeerConnection.prototype.addStream;at.RTCPeerConnection.prototype.addStream=function(pt){var ft=this;this._senders=this._senders||[],lt.apply(this,[pt]),pt.getTracks().forEach(function(yt){ft._senders.push(ht(ft,yt))})};var mt=at.RTCPeerConnection.prototype.removeStream;at.RTCPeerConnection.prototype.removeStream=function(pt){var ft=this;this._senders=this._senders||[],mt.apply(this,[pt]),pt.getTracks().forEach(function(yt){var vt=ft._senders.find(function(bt){return bt.track===yt});vt&&ft._senders.splice(ft._senders.indexOf(vt),1)})}}else if((at===void 0?"undefined":it(at))==="object"&&at.RTCPeerConnection&&"getSenders"in at.RTCPeerConnection.prototype&&"createDTMFSender"in at.RTCPeerConnection.prototype&&at.RTCRtpSender&&!("dtmf"in at.RTCRtpSender.prototype)){var ot=at.RTCPeerConnection.prototype.getSenders;at.RTCPeerConnection.prototype.getSenders=function(){var pt=this,ft=ot.apply(this,[]);return ft.forEach(function(yt){return yt._pc=pt}),ft},Object.defineProperty(at.RTCRtpSender.prototype,"dtmf",{get:function(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},gt.shimGetStats=function(at){if(at.RTCPeerConnection){var ht=at.RTCPeerConnection.prototype.getStats;at.RTCPeerConnection.prototype.getStats=function(dt,ut,lt){var mt=this,ot=arguments;if(arguments.length>0&&typeof dt=="function")return ht.apply(this,arguments);if(ht.length===0&&(arguments.length===0||typeof arguments[0]!="function"))return ht.apply(this,[]);var pt=function(vt){var bt={};return vt.result().forEach(function(At){var Nt={id:At.id,timestamp:At.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[At.type]||At.type};At.names().forEach(function(St){Nt[St]=At.stat(St)}),bt[Nt.id]=Nt}),bt},ft=function(vt){return new Map(Object.keys(vt).map(function(bt){return[bt,vt[bt]]}))};if(arguments.length>=2){var yt=function(vt){ot[1](ft(pt(vt)))};return ht.apply(this,[yt,arguments[0]])}return new Promise(function(vt,bt){ht.apply(mt,[function(At){vt(ft(pt(At)))},bt])}).then(ut,lt)}}},gt.shimSenderReceiverGetStats=function(at){if((at===void 0?"undefined":it(at))==="object"&&at.RTCPeerConnection&&at.RTCRtpSender&&at.RTCRtpReceiver){if(!("getStats"in at.RTCRtpSender.prototype)){var ht=at.RTCPeerConnection.prototype.getSenders;ht&&(at.RTCPeerConnection.prototype.getSenders=function(){var mt=this,ot=ht.apply(this,[]);return ot.forEach(function(pt){return pt._pc=mt}),ot});var dt=at.RTCPeerConnection.prototype.addTrack;dt&&(at.RTCPeerConnection.prototype.addTrack=function(){var mt=dt.apply(this,arguments);return mt._pc=this,mt}),at.RTCRtpSender.prototype.getStats=function(){var mt=this;return this._pc.getStats().then(function(ot){return nt.filterStats(ot,mt.track,!0)})}}if(!("getStats"in at.RTCRtpReceiver.prototype)){var ut=at.RTCPeerConnection.prototype.getReceivers;ut&&(at.RTCPeerConnection.prototype.getReceivers=function(){var mt=this,ot=ut.apply(this,[]);return ot.forEach(function(pt){return pt._pc=mt}),ot}),nt.wrapPeerConnectionEvent(at,"track",function(mt){return mt.receiver._pc=mt.srcElement,mt}),at.RTCRtpReceiver.prototype.getStats=function(){var mt=this;return this._pc.getStats().then(function(ot){return nt.filterStats(ot,mt.track,!1)})}}if("getStats"in at.RTCRtpSender.prototype&&"getStats"in at.RTCRtpReceiver.prototype){var lt=at.RTCPeerConnection.prototype.getStats;at.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof at.MediaStreamTrack){var mt=arguments[0],ot=void 0,pt=void 0,ft=void 0;return this.getSenders().forEach(function(yt){yt.track===mt&&(ot?ft=!0:ot=yt)}),this.getReceivers().forEach(function(yt){return yt.track===mt&&(pt?ft=!0:pt=yt),yt.track===mt}),ft||ot&&pt?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):ot?ot.getStats():pt?pt.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return lt.apply(this,arguments)}}}},gt.shimAddTrackRemoveTrackWithNative=rt,gt.shimAddTrackRemoveTrack=function(at){function ht(yt,vt){var bt=vt.sdp;return Object.keys(yt._reverseStreams||[]).forEach(function(At){var Nt=yt._reverseStreams[At],St=yt._streams[Nt.id];bt=bt.replace(new RegExp(St.id,"g"),Nt.id)}),new RTCSessionDescription({type:vt.type,sdp:bt})}function dt(yt,vt){var bt=vt.sdp;return Object.keys(yt._reverseStreams||[]).forEach(function(At){var Nt=yt._reverseStreams[At],St=yt._streams[Nt.id];bt=bt.replace(new RegExp(Nt.id,"g"),St.id)}),new RTCSessionDescription({type:vt.type,sdp:bt})}if(at.RTCPeerConnection){var ut=nt.detectBrowser(at);if(at.RTCPeerConnection.prototype.addTrack&&ut.version>=65)return rt(at);var lt=at.RTCPeerConnection.prototype.getLocalStreams;at.RTCPeerConnection.prototype.getLocalStreams=function(){var yt=this,vt=lt.apply(this);return this._reverseStreams=this._reverseStreams||{},vt.map(function(bt){return yt._reverseStreams[bt.id]})};var mt=at.RTCPeerConnection.prototype.addStream;at.RTCPeerConnection.prototype.addStream=function(yt){var vt=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},yt.getTracks().forEach(function(At){if(vt.getSenders().find(function(Nt){return Nt.track===At}))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[yt.id]){var bt=new at.MediaStream(yt.getTracks());this._streams[yt.id]=bt,this._reverseStreams[bt.id]=yt,yt=bt}mt.apply(this,[yt])};var ot=at.RTCPeerConnection.prototype.removeStream;at.RTCPeerConnection.prototype.removeStream=function(yt){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ot.apply(this,[this._streams[yt.id]||yt]),delete this._reverseStreams[this._streams[yt.id]?this._streams[yt.id].id:yt.id],delete this._streams[yt.id]},at.RTCPeerConnection.prototype.addTrack=function(yt,vt){var bt=this;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var At=[].slice.call(arguments,1);if(At.length!==1||!At[0].getTracks().find(function(wt){return wt===yt}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(function(wt){return wt.track===yt}))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var Nt=this._streams[vt.id];if(Nt)Nt.addTrack(yt),Promise.resolve().then(function(){bt.dispatchEvent(new Event("negotiationneeded"))});else{var St=new at.MediaStream([yt]);this._streams[vt.id]=St,this._reverseStreams[St.id]=vt,this.addStream(St)}return this.getSenders().find(function(wt){return wt.track===yt})},["createOffer","createAnswer"].forEach(function(yt){var vt=at.RTCPeerConnection.prototype[yt];at.RTCPeerConnection.prototype[yt]=function(){var bt=this,At=arguments;return arguments.length&&typeof arguments[0]=="function"?vt.apply(this,[function(Nt){var St=ht(bt,Nt);At[0].apply(null,[St])},function(Nt){At[1]&&At[1].apply(null,Nt)},arguments[2]]):vt.apply(this,arguments).then(function(Nt){return ht(bt,Nt)})}});var pt=at.RTCPeerConnection.prototype.setLocalDescription;at.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=dt(this,arguments[0]),pt.apply(this,arguments)):pt.apply(this,arguments)};var ft=Object.getOwnPropertyDescriptor(at.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(at.RTCPeerConnection.prototype,"localDescription",{get:function(){var yt=ft.get.apply(this);return yt.type===""?yt:ht(this,yt)}}),at.RTCPeerConnection.prototype.removeTrack=function(yt){var vt=this;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!yt._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(yt._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var bt=void 0;Object.keys(this._streams).forEach(function(At){vt._streams[At].getTracks().find(function(Nt){return yt.track===Nt})&&(bt=vt._streams[At])}),bt&&(bt.getTracks().length===1?this.removeStream(this._reverseStreams[bt.id]):bt.removeTrack(yt.track),this.dispatchEvent(new Event("negotiationneeded")))}}},gt.shimPeerConnection=function(at){if(!at.RTCPeerConnection&&at.webkitRTCPeerConnection&&(at.RTCPeerConnection=at.webkitRTCPeerConnection),at.RTCPeerConnection){["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(dt){var ut=at.RTCPeerConnection.prototype[dt];at.RTCPeerConnection.prototype[dt]=function(){return arguments[0]=new(dt==="addIceCandidate"?at.RTCIceCandidate:at.RTCSessionDescription)(arguments[0]),ut.apply(this,arguments)}});var ht=at.RTCPeerConnection.prototype.addIceCandidate;at.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?ht.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}},gt.fixNegotiationNeeded=function(at){nt.wrapPeerConnectionEvent(at,"negotiationneeded",function(ht){if(ht.target.signalingState==="stable")return ht})};var nt=function(at){if(at&&at.__esModule)return at;var ht={};if(at!=null)for(var dt in at)Object.prototype.hasOwnProperty.call(at,dt)&&(ht[dt]=at[dt]);return ht.default=at,ht}(tt("../utils.js"))},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=function(rt,it){rt.navigator.mediaDevices&&"getDisplayMedia"in rt.navigator.mediaDevices||rt.navigator.mediaDevices&&(typeof it=="function"?rt.navigator.mediaDevices.getDisplayMedia=function(s){return it(s).then(function(et){var nt=s.video&&s.video.width,at=s.video&&s.video.height,ht=s.video&&s.video.frameRate;return s.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:et,maxFrameRate:ht||3}},nt&&(s.video.mandatory.maxWidth=nt),at&&(s.video.mandatory.maxHeight=at),rt.navigator.mediaDevices.getUserMedia(s)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},{}],5:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0});var rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(et){return typeof et}:function(et){return et&&typeof Symbol=="function"&&et.constructor===Symbol&&et!==Symbol.prototype?"symbol":typeof et};gt.shimGetUserMedia=function(et){var nt=et&&et.navigator;if(nt.mediaDevices){var at=it.detectBrowser(et),ht=function(mt){if((mt===void 0?"undefined":rt(mt))!=="object"||mt.mandatory||mt.optional)return mt;var ot={};return Object.keys(mt).forEach(function(pt){if(pt!=="require"&&pt!=="advanced"&&pt!=="mediaSource"){var ft=rt(mt[pt])==="object"?mt[pt]:{ideal:mt[pt]};ft.exact!==void 0&&typeof ft.exact=="number"&&(ft.min=ft.max=ft.exact);var yt=function(bt,At){return bt?bt+At.charAt(0).toUpperCase()+At.slice(1):At==="deviceId"?"sourceId":At};if(ft.ideal!==void 0){ot.optional=ot.optional||[];var vt={};typeof ft.ideal=="number"?(vt[yt("min",pt)]=ft.ideal,ot.optional.push(vt),(vt={})[yt("max",pt)]=ft.ideal,ot.optional.push(vt)):(vt[yt("",pt)]=ft.ideal,ot.optional.push(vt))}ft.exact!==void 0&&typeof ft.exact!="number"?(ot.mandatory=ot.mandatory||{},ot.mandatory[yt("",pt)]=ft.exact):["min","max"].forEach(function(bt){ft[bt]!==void 0&&(ot.mandatory=ot.mandatory||{},ot.mandatory[yt(bt,pt)]=ft[bt])})}}),mt.advanced&&(ot.optional=(ot.optional||[]).concat(mt.advanced)),ot},dt=function(mt,ot){if(at.version>=61)return ot(mt);if((mt=JSON.parse(JSON.stringify(mt)))&&rt(mt.audio)==="object"){var pt=function(bt,At,Nt){At in bt&&!(Nt in bt)&&(bt[Nt]=bt[At],delete bt[At])};pt((mt=JSON.parse(JSON.stringify(mt))).audio,"autoGainControl","googAutoGainControl"),pt(mt.audio,"noiseSuppression","googNoiseSuppression"),mt.audio=ht(mt.audio)}if(mt&&rt(mt.video)==="object"){var ft=mt.video.facingMode;ft=ft&&((ft===void 0?"undefined":rt(ft))==="object"?ft:{ideal:ft});var yt=at.version<66;if(ft&&(ft.exact==="user"||ft.exact==="environment"||ft.ideal==="user"||ft.ideal==="environment")&&(!nt.mediaDevices.getSupportedConstraints||!nt.mediaDevices.getSupportedConstraints().facingMode||yt)){delete mt.video.facingMode;var vt=void 0;if(ft.exact==="environment"||ft.ideal==="environment"?vt=["back","rear"]:ft.exact!=="user"&&ft.ideal!=="user"||(vt=["front"]),vt)return nt.mediaDevices.enumerateDevices().then(function(bt){var At=(bt=bt.filter(function(Nt){return Nt.kind==="videoinput"})).find(function(Nt){return vt.some(function(St){return Nt.label.toLowerCase().includes(St)})});return!At&&bt.length&&vt.includes("back")&&(At=bt[bt.length-1]),At&&(mt.video.deviceId=ft.exact?{exact:At.deviceId}:{ideal:At.deviceId}),mt.video=ht(mt.video),s("chrome: "+JSON.stringify(mt)),ot(mt)})}mt.video=ht(mt.video)}return s("chrome: "+JSON.stringify(mt)),ot(mt)},ut=function(mt){return at.version>=64?mt:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[mt.name]||mt.name,message:mt.message,constraint:mt.constraint||mt.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(nt.getUserMedia=(function(mt,ot,pt){dt(mt,function(ft){nt.webkitGetUserMedia(ft,ot,function(yt){pt&&pt(ut(yt))})})}).bind(nt),nt.mediaDevices.getUserMedia){var lt=nt.mediaDevices.getUserMedia.bind(nt.mediaDevices);nt.mediaDevices.getUserMedia=function(mt){return dt(mt,function(ot){return lt(ot).then(function(pt){if(ot.audio&&!pt.getAudioTracks().length||ot.video&&!pt.getVideoTracks().length)throw pt.getTracks().forEach(function(ft){ft.stop()}),new DOMException("","NotFoundError");return pt},function(pt){return Promise.reject(ut(pt))})})}}}};var it=function(et){if(et&&et.__esModule)return et;var nt={};if(et!=null)for(var at in et)Object.prototype.hasOwnProperty.call(et,at)&&(nt[at]=et[at]);return nt.default=et,nt}(tt("../utils.js")),s=it.log},{"../utils.js":15}],6:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0});var rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(et){return typeof et}:function(et){return et&&typeof Symbol=="function"&&et.constructor===Symbol&&et!==Symbol.prototype?"symbol":typeof et};gt.shimRTCIceCandidate=function(et){if(et.RTCIceCandidate&&!(et.RTCIceCandidate&&"foundation"in et.RTCIceCandidate.prototype)){var nt=et.RTCIceCandidate;et.RTCIceCandidate=function(at){if((at===void 0?"undefined":rt(at))==="object"&&at.candidate&&at.candidate.indexOf("a=")===0&&((at=JSON.parse(JSON.stringify(at))).candidate=at.candidate.substr(2)),at.candidate&&at.candidate.length){var ht=new nt(at),dt=it.default.parseCandidate(at.candidate),ut=Object.assign(ht,dt);return ut.toJSON=function(){return{candidate:ut.candidate,sdpMid:ut.sdpMid,sdpMLineIndex:ut.sdpMLineIndex,usernameFragment:ut.usernameFragment}},ut}return new nt(at)},et.RTCIceCandidate.prototype=nt.prototype,s.wrapPeerConnectionEvent(et,"icecandidate",function(at){return at.candidate&&Object.defineProperty(at,"candidate",{value:new et.RTCIceCandidate(at.candidate),writable:"false"}),at})}},gt.shimMaxMessageSize=function(et){if(!et.RTCSctpTransport&&et.RTCPeerConnection){var nt=s.detectBrowser(et);"sctp"in et.RTCPeerConnection.prototype||Object.defineProperty(et.RTCPeerConnection.prototype,"sctp",{get:function(){return this._sctp===void 0?null:this._sctp}});var at=function(mt){if(!mt||!mt.sdp)return!1;var ot=it.default.splitSections(mt.sdp);return ot.shift(),ot.some(function(pt){var ft=it.default.parseMLine(pt);return ft&&ft.kind==="application"&&ft.protocol.indexOf("SCTP")!==-1})},ht=function(mt){var ot=mt.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ot===null||ot.length<2)return-1;var pt=parseInt(ot[1],10);return pt!==pt?-1:pt},dt=function(mt){var ot=65536;return nt.browser==="firefox"&&(ot=nt.version<57?mt===-1?16384:2147483637:nt.version<60?nt.version===57?65535:65536:2147483637),ot},ut=function(mt,ot){var pt=65536;nt.browser==="firefox"&&nt.version===57&&(pt=65535);var ft=it.default.matchPrefix(mt.sdp,"a=max-message-size:");return ft.length>0?pt=parseInt(ft[0].substr(19),10):nt.browser==="firefox"&&ot!==-1&&(pt=2147483637),pt},lt=et.RTCPeerConnection.prototype.setRemoteDescription;et.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,at(arguments[0])){var mt=ht(arguments[0]),ot=dt(mt),pt=ut(arguments[0],mt),ft=void 0;ft=ot===0&&pt===0?Number.POSITIVE_INFINITY:ot===0||pt===0?Math.max(ot,pt):Math.min(ot,pt);var yt={};Object.defineProperty(yt,"maxMessageSize",{get:function(){return ft}}),this._sctp=yt}return lt.apply(this,arguments)}}},gt.shimSendThrowTypeError=function(et){function nt(ht,dt){var ut=ht.send;ht.send=function(){var lt=arguments[0],mt=lt.length||lt.size||lt.byteLength;if(ht.readyState==="open"&&dt.sctp&&mt>dt.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+dt.sctp.maxMessageSize+" bytes)");return ut.apply(ht,arguments)}}if(et.RTCPeerConnection&&"createDataChannel"in et.RTCPeerConnection.prototype){var at=et.RTCPeerConnection.prototype.createDataChannel;et.RTCPeerConnection.prototype.createDataChannel=function(){var ht=at.apply(this,arguments);return nt(ht,this),ht},s.wrapPeerConnectionEvent(et,"datachannel",function(ht){return nt(ht.channel,ht.target),ht})}},gt.shimConnectionState=function(et){if(et.RTCPeerConnection&&!("connectionState"in et.RTCPeerConnection.prototype)){var nt=et.RTCPeerConnection.prototype;Object.defineProperty(nt,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(nt,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(at){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),at&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=at)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(at){var ht=nt[at];nt[at]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(dt){var ut=dt.target;if(ut._lastConnectionState!==ut.connectionState){ut._lastConnectionState=ut.connectionState;var lt=new Event("connectionstatechange",dt);ut.dispatchEvent(lt)}return dt},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),ht.apply(this,arguments)}})}},gt.removeAllowExtmapMixed=function(et){if(et.RTCPeerConnection){var nt=s.detectBrowser(et);if(!(nt.browser==="chrome"&&nt.version>=71||nt.browser==="safari"&&nt.version>=605)){var at=et.RTCPeerConnection.prototype.setRemoteDescription;et.RTCPeerConnection.prototype.setRemoteDescription=function(ht){return ht&&ht.sdp&&ht.sdp.indexOf(` -a=extmap-allow-mixed`)!==-1&&(ht.sdp=ht.sdp.split(` -`).filter(function(dt){return dt.trim()!=="a=extmap-allow-mixed"}).join(` -`)),at.apply(this,arguments)}}}};var it=function(et){return et&&et.__esModule?et:{default:et}}(tt("sdp")),s=function(et){if(et&&et.__esModule)return et;var nt={};if(et!=null)for(var at in et)Object.prototype.hasOwnProperty.call(et,at)&&(nt[at]=et[at]);return nt.default=et,nt}(tt("./utils"))},{"./utils":15,sdp:17}],7:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=gt.shimGetUserMedia=void 0;var rt=tt("./getusermedia");Object.defineProperty(gt,"shimGetUserMedia",{enumerable:!0,get:function(){return rt.shimGetUserMedia}});var it=tt("./getdisplaymedia");Object.defineProperty(gt,"shimGetDisplayMedia",{enumerable:!0,get:function(){return it.shimGetDisplayMedia}}),gt.shimPeerConnection=function(at){var ht=s.detectBrowser(at);if(at.RTCIceGatherer&&(at.RTCIceCandidate||(at.RTCIceCandidate=function(lt){return lt}),at.RTCSessionDescription||(at.RTCSessionDescription=function(lt){return lt}),ht.version<15025)){var dt=Object.getOwnPropertyDescriptor(at.MediaStreamTrack.prototype,"enabled");Object.defineProperty(at.MediaStreamTrack.prototype,"enabled",{set:function(lt){dt.set.call(this,lt);var mt=new Event("enabled");mt.enabled=lt,this.dispatchEvent(mt)}})}!at.RTCRtpSender||"dtmf"in at.RTCRtpSender.prototype||Object.defineProperty(at.RTCRtpSender.prototype,"dtmf",{get:function(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new at.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),at.RTCDtmfSender&&!at.RTCDTMFSender&&(at.RTCDTMFSender=at.RTCDtmfSender);var ut=(0,nt.default)(at,ht.version);at.RTCPeerConnection=function(lt){return lt&<.iceServers&&(lt.iceServers=(0,et.filterIceServers)(lt.iceServers,ht.version),s.log("ICE servers after filtering:",lt.iceServers)),new ut(lt)},at.RTCPeerConnection.prototype=ut.prototype},gt.shimReplaceTrack=function(at){!at.RTCRtpSender||"replaceTrack"in at.RTCRtpSender.prototype||(at.RTCRtpSender.prototype.replaceTrack=at.RTCRtpSender.prototype.setTrack)};var s=function(at){if(at&&at.__esModule)return at;var ht={};if(at!=null)for(var dt in at)Object.prototype.hasOwnProperty.call(at,dt)&&(ht[dt]=at[dt]);return ht.default=at,ht}(tt("../utils")),et=tt("./filtericeservers"),nt=function(at){return at&&at.__esModule?at:{default:at}}(tt("rtcpeerconnection-shim"))},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.filterIceServers=function(it,s){var et=!1;return(it=JSON.parse(JSON.stringify(it))).filter(function(nt){if(nt&&(nt.urls||nt.url)){var at=nt.urls||nt.url;nt.url&&!nt.urls&&rt.deprecated("RTCIceServer.url","RTCIceServer.urls");var ht=typeof at=="string";return ht&&(at=[at]),at=at.filter(function(dt){if(dt.indexOf("stun:")===0)return!1;var ut=dt.startsWith("turn")&&!dt.startsWith("turn:[")&&dt.includes("transport=udp");return ut&&!et?(et=!0,!0):ut&&!et}),delete nt.url,nt.urls=ht?at[0]:at,!!at.length}})};var rt=function(it){if(it&&it.__esModule)return it;var s={};if(it!=null)for(var et in it)Object.prototype.hasOwnProperty.call(it,et)&&(s[et]=it[et]);return s.default=it,s}(tt("../utils"))},{"../utils":15}],9:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=function(rt){"getDisplayMedia"in rt.navigator&&rt.navigator.mediaDevices&&(rt.navigator.mediaDevices&&"getDisplayMedia"in rt.navigator.mediaDevices||(rt.navigator.mediaDevices.getDisplayMedia=rt.navigator.getDisplayMedia.bind(rt.navigator)))}},{}],10:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetUserMedia=function(rt){var it=rt&&rt.navigator,s=function(nt){return{name:{PermissionDeniedError:"NotAllowedError"}[nt.name]||nt.name,message:nt.message,constraint:nt.constraint,toString:function(){return this.name}}},et=it.mediaDevices.getUserMedia.bind(it.mediaDevices);it.mediaDevices.getUserMedia=function(nt){return et(nt).catch(function(at){return Promise.reject(s(at))})}}},{}],11:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=gt.shimGetUserMedia=void 0;var rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(nt){return typeof nt}:function(nt){return nt&&typeof Symbol=="function"&&nt.constructor===Symbol&&nt!==Symbol.prototype?"symbol":typeof nt},it=tt("./getusermedia");Object.defineProperty(gt,"shimGetUserMedia",{enumerable:!0,get:function(){return it.shimGetUserMedia}});var s=tt("./getdisplaymedia");Object.defineProperty(gt,"shimGetDisplayMedia",{enumerable:!0,get:function(){return s.shimGetDisplayMedia}}),gt.shimOnTrack=function(nt){(nt===void 0?"undefined":rt(nt))==="object"&&nt.RTCTrackEvent&&"receiver"in nt.RTCTrackEvent.prototype&&!("transceiver"in nt.RTCTrackEvent.prototype)&&Object.defineProperty(nt.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},gt.shimPeerConnection=function(nt){var at=et.detectBrowser(nt);if((nt===void 0?"undefined":rt(nt))==="object"&&(nt.RTCPeerConnection||nt.mozRTCPeerConnection)){!nt.RTCPeerConnection&&nt.mozRTCPeerConnection&&(nt.RTCPeerConnection=nt.mozRTCPeerConnection),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(lt){var mt=nt.RTCPeerConnection.prototype[lt];nt.RTCPeerConnection.prototype[lt]=function(){return arguments[0]=new(lt==="addIceCandidate"?nt.RTCIceCandidate:nt.RTCSessionDescription)(arguments[0]),mt.apply(this,arguments)}});var ht=nt.RTCPeerConnection.prototype.addIceCandidate;nt.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?ht.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())};var dt={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},ut=nt.RTCPeerConnection.prototype.getStats;nt.RTCPeerConnection.prototype.getStats=function(lt,mt,ot){return ut.apply(this,[lt||null]).then(function(pt){if(at.version<53&&!mt)try{pt.forEach(function(ft){ft.type=dt[ft.type]||ft.type})}catch(ft){if(ft.name!=="TypeError")throw ft;pt.forEach(function(yt,vt){pt.set(vt,Object.assign({},yt,{type:dt[yt.type]||yt.type}))})}return pt}).then(mt,ot)}}},gt.shimSenderGetStats=function(nt){if((nt===void 0?"undefined":rt(nt))==="object"&&nt.RTCPeerConnection&&nt.RTCRtpSender&&!(nt.RTCRtpSender&&"getStats"in nt.RTCRtpSender.prototype)){var at=nt.RTCPeerConnection.prototype.getSenders;at&&(nt.RTCPeerConnection.prototype.getSenders=function(){var dt=this,ut=at.apply(this,[]);return ut.forEach(function(lt){return lt._pc=dt}),ut});var ht=nt.RTCPeerConnection.prototype.addTrack;ht&&(nt.RTCPeerConnection.prototype.addTrack=function(){var dt=ht.apply(this,arguments);return dt._pc=this,dt}),nt.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}},gt.shimReceiverGetStats=function(nt){if((nt===void 0?"undefined":rt(nt))==="object"&&nt.RTCPeerConnection&&nt.RTCRtpSender&&!(nt.RTCRtpSender&&"getStats"in nt.RTCRtpReceiver.prototype)){var at=nt.RTCPeerConnection.prototype.getReceivers;at&&(nt.RTCPeerConnection.prototype.getReceivers=function(){var ht=this,dt=at.apply(this,[]);return dt.forEach(function(ut){return ut._pc=ht}),dt}),et.wrapPeerConnectionEvent(nt,"track",function(ht){return ht.receiver._pc=ht.srcElement,ht}),nt.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}},gt.shimRemoveStream=function(nt){!nt.RTCPeerConnection||"removeStream"in nt.RTCPeerConnection.prototype||(nt.RTCPeerConnection.prototype.removeStream=function(at){var ht=this;et.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(dt){dt.track&&at.getTracks().includes(dt.track)&&ht.removeTrack(dt)})})},gt.shimRTCDataChannel=function(nt){nt.DataChannel&&!nt.RTCDataChannel&&(nt.RTCDataChannel=nt.DataChannel)};var et=function(nt){if(nt&&nt.__esModule)return nt;var at={};if(nt!=null)for(var ht in nt)Object.prototype.hasOwnProperty.call(nt,ht)&&(at[ht]=nt[ht]);return at.default=nt,at}(tt("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0}),gt.shimGetDisplayMedia=function(rt,it){rt.navigator.mediaDevices&&"getDisplayMedia"in rt.navigator.mediaDevices||rt.navigator.mediaDevices&&(rt.navigator.mediaDevices.getDisplayMedia=function(s){if(!s||!s.video){var et=new DOMException("getDisplayMedia without video constraints is undefined");return et.name="NotFoundError",et.code=8,Promise.reject(et)}return s.video===!0?s.video={mediaSource:it}:s.video.mediaSource=it,rt.navigator.mediaDevices.getUserMedia(s)})}},{}],13:[function(tt,ct,gt){Object.defineProperty(gt,"__esModule",{value:!0});var rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};gt.shimGetUserMedia=function(s){var et=it.detectBrowser(s),nt=s&&s.navigator,at=s&&s.MediaStreamTrack;if(nt.getUserMedia=function(mt,ot,pt){it.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),nt.mediaDevices.getUserMedia(mt).then(ot,pt)},!(et.version>55&&"autoGainControl"in nt.mediaDevices.getSupportedConstraints())){var ht=function(mt,ot,pt){ot in mt&&!(pt in mt)&&(mt[pt]=mt[ot],delete mt[ot])},dt=nt.mediaDevices.getUserMedia.bind(nt.mediaDevices);if(nt.mediaDevices.getUserMedia=function(mt){return(mt===void 0?"undefined":rt(mt))==="object"&&rt(mt.audio)==="object"&&(mt=JSON.parse(JSON.stringify(mt)),ht(mt.audio,"autoGainControl","mozAutoGainControl"),ht(mt.audio,"noiseSuppression","mozNoiseSuppression")),dt(mt)},at&&at.prototype.getSettings){var ut=at.prototype.getSettings;at.prototype.getSettings=function(){var mt=ut.apply(this,arguments);return ht(mt,"mozAutoGainControl","autoGainControl"),ht(mt,"mozNoiseSuppression","noiseSuppression"),mt}}if(at&&at.prototype.applyConstraints){var lt=at.prototype.applyConstraints;at.prototype.applyConstraints=function(mt){return this.kind==="audio"&&(mt===void 0?"undefined":rt(mt))==="object"&&(mt=JSON.parse(JSON.stringify(mt)),ht(mt,"autoGainControl","mozAutoGainControl"),ht(mt,"noiseSuppression","mozNoiseSuppression")),lt.apply(this,[mt])}}}};var it=function(s){if(s&&s.__esModule)return s;var et={};if(s!=null)for(var nt in s)Object.prototype.hasOwnProperty.call(s,nt)&&(et[nt]=s[nt]);return et.default=s,et}(tt("../utils"))},{"../utils":15}],14:[function(tt,ct,gt){function rt(et){return et&&et.video!==void 0?Object.assign({},et,{video:s.compactObject(et.video)}):et}Object.defineProperty(gt,"__esModule",{value:!0});var it=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(et){return typeof et}:function(et){return et&&typeof Symbol=="function"&&et.constructor===Symbol&&et!==Symbol.prototype?"symbol":typeof et};gt.shimLocalStreamsAPI=function(et){if((et===void 0?"undefined":it(et))==="object"&&et.RTCPeerConnection){if("getLocalStreams"in et.RTCPeerConnection.prototype||(et.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in et.RTCPeerConnection.prototype)){var nt=et.RTCPeerConnection.prototype.addTrack;et.RTCPeerConnection.prototype.addStream=function(at){var ht=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(at)||this._localStreams.push(at),at.getTracks().forEach(function(dt){return nt.call(ht,dt,at)})},et.RTCPeerConnection.prototype.addTrack=function(at,ht){return ht&&(this._localStreams?this._localStreams.includes(ht)||this._localStreams.push(ht):this._localStreams=[ht]),nt.call(this,at,ht)}}"removeStream"in et.RTCPeerConnection.prototype||(et.RTCPeerConnection.prototype.removeStream=function(at){var ht=this;this._localStreams||(this._localStreams=[]);var dt=this._localStreams.indexOf(at);if(dt!==-1){this._localStreams.splice(dt,1);var ut=at.getTracks();this.getSenders().forEach(function(lt){ut.includes(lt.track)&&ht.removeTrack(lt)})}})}},gt.shimRemoteStreamsAPI=function(et){if((et===void 0?"undefined":it(et))==="object"&&et.RTCPeerConnection&&("getRemoteStreams"in et.RTCPeerConnection.prototype||(et.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in et.RTCPeerConnection.prototype))){Object.defineProperty(et.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(at){var ht=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=at),this.addEventListener("track",this._onaddstreampoly=function(dt){dt.streams.forEach(function(ut){if(ht._remoteStreams||(ht._remoteStreams=[]),!ht._remoteStreams.includes(ut)){ht._remoteStreams.push(ut);var lt=new Event("addstream");lt.stream=ut,ht.dispatchEvent(lt)}})})}});var nt=et.RTCPeerConnection.prototype.setRemoteDescription;et.RTCPeerConnection.prototype.setRemoteDescription=function(){var at=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(ht){ht.streams.forEach(function(dt){if(at._remoteStreams||(at._remoteStreams=[]),!(at._remoteStreams.indexOf(dt)>=0)){at._remoteStreams.push(dt);var ut=new Event("addstream");ut.stream=dt,at.dispatchEvent(ut)}})}),nt.apply(at,arguments)}}},gt.shimCallbacksAPI=function(et){if((et===void 0?"undefined":it(et))==="object"&&et.RTCPeerConnection){var nt=et.RTCPeerConnection.prototype,at=nt.createOffer,ht=nt.createAnswer,dt=nt.setLocalDescription,ut=nt.setRemoteDescription,lt=nt.addIceCandidate;nt.createOffer=function(ot,pt){var ft=arguments.length>=2?arguments[2]:arguments[0],yt=at.apply(this,[ft]);return pt?(yt.then(ot,pt),Promise.resolve()):yt},nt.createAnswer=function(ot,pt){var ft=arguments.length>=2?arguments[2]:arguments[0],yt=ht.apply(this,[ft]);return pt?(yt.then(ot,pt),Promise.resolve()):yt};var mt=function(ot,pt,ft){var yt=dt.apply(this,[ot]);return ft?(yt.then(pt,ft),Promise.resolve()):yt};nt.setLocalDescription=mt,mt=function(ot,pt,ft){var yt=ut.apply(this,[ot]);return ft?(yt.then(pt,ft),Promise.resolve()):yt},nt.setRemoteDescription=mt,mt=function(ot,pt,ft){var yt=lt.apply(this,[ot]);return ft?(yt.then(pt,ft),Promise.resolve()):yt},nt.addIceCandidate=mt}},gt.shimGetUserMedia=function(et){var nt=et&&et.navigator;if(nt.mediaDevices&&nt.mediaDevices.getUserMedia){var at=nt.mediaDevices,ht=at.getUserMedia.bind(at);nt.mediaDevices.getUserMedia=function(dt){return ht(rt(dt))}}!nt.getUserMedia&&nt.mediaDevices&&nt.mediaDevices.getUserMedia&&(nt.getUserMedia=(function(dt,ut,lt){nt.mediaDevices.getUserMedia(dt).then(ut,lt)}).bind(nt))},gt.shimConstraints=rt,gt.shimRTCIceServerUrls=function(et){var nt=et.RTCPeerConnection;et.RTCPeerConnection=function(at,ht){if(at&&at.iceServers){for(var dt=[],ut=0;ut=lt&&parseInt(mt[lt],10)}function s(dt){return(dt===void 0?"undefined":nt(dt))!=="object"?dt:Object.keys(dt).reduce(function(ut,lt){var mt=nt(dt[lt])==="object",ot=mt?s(dt[lt]):dt[lt],pt=mt&&!Object.keys(ot).length;return ot===void 0||pt?ut:Object.assign(ut,rt({},lt,ot))},{})}function et(dt,ut,lt){ut&&!lt.has(ut.id)&&(lt.set(ut.id,ut),Object.keys(ut).forEach(function(mt){mt.endsWith("Id")?et(dt,dt.get(ut[mt]),lt):mt.endsWith("Ids")&&ut[mt].forEach(function(ot){et(dt,dt.get(ot),lt)})}))}Object.defineProperty(gt,"__esModule",{value:!0});var nt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(dt){return typeof dt}:function(dt){return dt&&typeof Symbol=="function"&&dt.constructor===Symbol&&dt!==Symbol.prototype?"symbol":typeof dt};gt.extractVersion=it,gt.wrapPeerConnectionEvent=function(dt,ut,lt){if(dt.RTCPeerConnection){var mt=dt.RTCPeerConnection.prototype,ot=mt.addEventListener;mt.addEventListener=function(ft,yt){if(ft!==ut)return ot.apply(this,arguments);var vt=function(bt){var At=lt(bt);At&&yt(At)};return this._eventMap=this._eventMap||{},this._eventMap[yt]=vt,ot.apply(this,[ft,vt])};var pt=mt.removeEventListener;mt.removeEventListener=function(ft,yt){if(ft!==ut||!this._eventMap||!this._eventMap[yt])return pt.apply(this,arguments);var vt=this._eventMap[yt];return delete this._eventMap[yt],pt.apply(this,[ft,vt])},Object.defineProperty(mt,"on"+ut,{get:function(){return this["_on"+ut]},set:function(ft){this["_on"+ut]&&(this.removeEventListener(ut,this["_on"+ut]),delete this["_on"+ut]),ft&&this.addEventListener(ut,this["_on"+ut]=ft)},enumerable:!0,configurable:!0})}},gt.disableLog=function(dt){return typeof dt!="boolean"?new Error("Argument type: "+(dt===void 0?"undefined":nt(dt))+". Please use a boolean."):(at=dt,dt?"adapter.js logging disabled":"adapter.js logging enabled")},gt.disableWarnings=function(dt){return typeof dt!="boolean"?new Error("Argument type: "+(dt===void 0?"undefined":nt(dt))+". Please use a boolean."):(ht=!dt,"adapter.js deprecation warnings "+(dt?"disabled":"enabled"))},gt.log=function(){if((typeof window>"u"?"undefined":nt(window))==="object"){if(at)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}},gt.deprecated=function(dt,ut){ht&&console.warn(dt+" is deprecated, please use "+ut+" instead.")},gt.detectBrowser=function(dt){var ut=dt.navigator,lt={browser:null,version:null};if(dt===void 0||!dt.navigator)return lt.browser="Not a browser.",lt;if(ut.mozGetUserMedia)lt.browser="firefox",lt.version=it(ut.userAgent,/Firefox\/(\d+)\./,1);else if(ut.webkitGetUserMedia||dt.isSecureContext===!1&&dt.webkitRTCPeerConnection&&!dt.RTCIceGatherer)lt.browser="chrome",lt.version=it(ut.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(ut.mediaDevices&&ut.userAgent.match(/Edge\/(\d+).(\d+)$/))lt.browser="edge",lt.version=it(ut.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!dt.RTCPeerConnection||!ut.userAgent.match(/AppleWebKit\/(\d+)\./))return lt.browser="Not a supported browser.",lt;lt.browser="safari",lt.version=it(ut.userAgent,/AppleWebKit\/(\d+)\./,1)}return lt},gt.compactObject=s,gt.walkStats=et,gt.filterStats=function(dt,ut,lt){var mt=lt?"outbound-rtp":"inbound-rtp",ot=new Map;if(ut===null)return ot;var pt=[];return dt.forEach(function(ft){ft.type==="track"&&ft.trackIdentifier===ut.id&&pt.push(ft)}),pt.forEach(function(ft){dt.forEach(function(yt){yt.type===mt&&yt.trackId===ft.id&&et(dt,yt,ot)})}),ot};var at=!0,ht=!0},{}],16:[function(tt,ct,gt){function rt(ut){return{inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ut.type]||ut.type}function it(ut,lt,mt,ot,pt){var ft=dt.writeRtpDescription(ut.kind,lt);if(ft+=dt.writeIceParameters(ut.iceGatherer.getLocalParameters()),ft+=dt.writeDtlsParameters(ut.dtlsTransport.getLocalParameters(),mt==="offer"?"actpass":pt||"active"),ft+="a=mid:"+ut.mid+`\r -`,ut.rtpSender&&ut.rtpReceiver?ft+=`a=sendrecv\r -`:ut.rtpSender?ft+=`a=sendonly\r -`:ut.rtpReceiver?ft+=`a=recvonly\r -`:ft+=`a=inactive\r -`,ut.rtpSender){var yt=ut.rtpSender._initialTrackId||ut.rtpSender.track.id;ut.rtpSender._initialTrackId=yt;var vt="msid:"+(ot?ot.id:"-")+" "+yt+`\r -`;ft+="a="+vt,ft+="a=ssrc:"+ut.sendEncodingParameters[0].ssrc+" "+vt,ut.sendEncodingParameters[0].rtx&&(ft+="a=ssrc:"+ut.sendEncodingParameters[0].rtx.ssrc+" "+vt,ft+="a=ssrc-group:FID "+ut.sendEncodingParameters[0].ssrc+" "+ut.sendEncodingParameters[0].rtx.ssrc+`\r -`)}return ft+="a=ssrc:"+ut.sendEncodingParameters[0].ssrc+" cname:"+dt.localCName+`\r -`,ut.rtpSender&&ut.sendEncodingParameters[0].rtx&&(ft+="a=ssrc:"+ut.sendEncodingParameters[0].rtx.ssrc+" cname:"+dt.localCName+`\r -`),ft}function s(ut,lt){var mt=!1;return(ut=JSON.parse(JSON.stringify(ut))).filter(function(ot){if(ot&&(ot.urls||ot.url)){var pt=ot.urls||ot.url;ot.url&&!ot.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var ft=typeof pt=="string";return ft&&(pt=[pt]),pt=pt.filter(function(yt){return yt.indexOf("turn:")===0&&yt.indexOf("transport=udp")!==-1&&yt.indexOf("turn:[")===-1&&!mt?(mt=!0,!0):yt.indexOf("stun:")===0&<>=14393&&yt.indexOf("?transport=udp")===-1}),delete ot.url,ot.urls=ft?pt[0]:pt,!!pt.length}})}function et(ut,lt){var mt={codecs:[],headerExtensions:[],fecMechanisms:[]},ot=function(ft,yt){ft=parseInt(ft,10);for(var vt=0;vt0;Nt--)this._iceGatherers.push(new ut.RTCIceGatherer({iceServers:vt.iceServers,gatherPolicy:vt.iceTransportPolicy}));else vt.iceCandidatePoolSize=0;this._config=vt,this.transceivers=[],this._sdpSessionId=dt.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(ft.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(ft.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),ft.prototype.onicecandidate=null,ft.prototype.onaddstream=null,ft.prototype.ontrack=null,ft.prototype.onremovestream=null,ft.prototype.onsignalingstatechange=null,ft.prototype.oniceconnectionstatechange=null,ft.prototype.onconnectionstatechange=null,ft.prototype.onicegatheringstatechange=null,ft.prototype.onnegotiationneeded=null,ft.prototype.ondatachannel=null,ft.prototype._dispatchEvent=function(vt,bt){this._isClosed||(this.dispatchEvent(bt),typeof this["on"+vt]=="function"&&this["on"+vt](bt))},ft.prototype._emitGatheringStateChange=function(){var vt=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",vt)},ft.prototype.getConfiguration=function(){return this._config},ft.prototype.getLocalStreams=function(){return this.localStreams},ft.prototype.getRemoteStreams=function(){return this.remoteStreams},ft.prototype._createTransceiver=function(vt,bt){var At=this.transceivers.length>0,Nt={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:vt,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&At)Nt.iceTransport=this.transceivers[0].iceTransport,Nt.dtlsTransport=this.transceivers[0].dtlsTransport;else{var St=this._createIceAndDtlsTransports();Nt.iceTransport=St.iceTransport,Nt.dtlsTransport=St.dtlsTransport}return bt||this.transceivers.push(Nt),Nt},ft.prototype.addTrack=function(vt,bt){if(this._isClosed)throw ht("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");if(this.transceivers.find(function(St){return St.track===vt}))throw ht("InvalidAccessError","Track already exists.");for(var At,Nt=0;Nt=15025)vt.getTracks().forEach(function(Nt){bt.addTrack(Nt,vt)});else{var At=vt.clone();vt.getTracks().forEach(function(Nt,St){var wt=At.getTracks()[St];Nt.addEventListener("enabled",function(Mt){wt.enabled=Mt.enabled})}),At.getTracks().forEach(function(Nt){bt.addTrack(Nt,At)})}},ft.prototype.removeTrack=function(vt){if(this._isClosed)throw ht("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(vt instanceof ut.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var bt=this.transceivers.find(function(Nt){return Nt.rtpSender===vt});if(!bt)throw ht("InvalidAccessError","Sender was not created by this connection.");var At=bt.stream;bt.rtpSender.stop(),bt.rtpSender=null,bt.track=null,bt.stream=null,this.transceivers.map(function(Nt){return Nt.stream}).indexOf(At)===-1&&this.localStreams.indexOf(At)>-1&&this.localStreams.splice(this.localStreams.indexOf(At),1),this._maybeFireNegotiationNeeded()},ft.prototype.removeStream=function(vt){var bt=this;vt.getTracks().forEach(function(At){var Nt=bt.getSenders().find(function(St){return St.track===At});Nt&&bt.removeTrack(Nt)})},ft.prototype.getSenders=function(){return this.transceivers.filter(function(vt){return!!vt.rtpSender}).map(function(vt){return vt.rtpSender})},ft.prototype.getReceivers=function(){return this.transceivers.filter(function(vt){return!!vt.rtpReceiver}).map(function(vt){return vt.rtpReceiver})},ft.prototype._createIceGatherer=function(vt,bt){var At=this;if(bt&&vt>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var Nt=new ut.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(Nt,"state",{value:"new",writable:!0}),this.transceivers[vt].bufferedCandidateEvents=[],this.transceivers[vt].bufferCandidates=function(St){var wt=!St.candidate||Object.keys(St.candidate).length===0;Nt.state=wt?"completed":"gathering",At.transceivers[vt].bufferedCandidateEvents!==null&&At.transceivers[vt].bufferedCandidateEvents.push(St)},Nt.addEventListener("localcandidate",this.transceivers[vt].bufferCandidates),Nt},ft.prototype._gather=function(vt,bt){var At=this,Nt=this.transceivers[bt].iceGatherer;if(!Nt.onlocalcandidate){var St=this.transceivers[bt].bufferedCandidateEvents;this.transceivers[bt].bufferedCandidateEvents=null,Nt.removeEventListener("localcandidate",this.transceivers[bt].bufferCandidates),Nt.onlocalcandidate=function(wt){if(!(At.usingBundle&&bt>0)){var Mt=new Event("icecandidate");Mt.candidate={sdpMid:vt,sdpMLineIndex:bt};var Ht=wt.candidate,Ot=!Ht||Object.keys(Ht).length===0;if(Ot)Nt.state!=="new"&&Nt.state!=="gathering"||(Nt.state="completed");else{Nt.state==="new"&&(Nt.state="gathering"),Ht.component=1,Ht.ufrag=Nt.getLocalParameters().usernameFragment;var Dt=dt.writeCandidate(Ht);Mt.candidate=Object.assign(Mt.candidate,dt.parseCandidate(Dt)),Mt.candidate.candidate=Dt,Mt.candidate.toJSON=function(){return{candidate:Mt.candidate.candidate,sdpMid:Mt.candidate.sdpMid,sdpMLineIndex:Mt.candidate.sdpMLineIndex,usernameFragment:Mt.candidate.usernameFragment}}}var Gt=dt.getMediaSections(At._localDescription.sdp);Gt[Mt.candidate.sdpMLineIndex]+=Ot?`a=end-of-candidates\r -`:"a="+Mt.candidate.candidate+`\r -`,At._localDescription.sdp=dt.getDescription(At._localDescription.sdp)+Gt.join("");var nn=At.transceivers.every(function(zt){return zt.iceGatherer&&zt.iceGatherer.state==="completed"});At.iceGatheringState!=="gathering"&&(At.iceGatheringState="gathering",At._emitGatheringStateChange()),Ot||At._dispatchEvent("icecandidate",Mt),nn&&(At._dispatchEvent("icecandidate",new Event("icecandidate")),At.iceGatheringState="complete",At._emitGatheringStateChange())}},ut.setTimeout(function(){St.forEach(function(wt){Nt.onlocalcandidate(wt)})},0)}},ft.prototype._createIceAndDtlsTransports=function(){var vt=this,bt=new ut.RTCIceTransport(null);bt.onicestatechange=function(){vt._updateIceConnectionState(),vt._updateConnectionState()};var At=new ut.RTCDtlsTransport(bt);return At.ondtlsstatechange=function(){vt._updateConnectionState()},At.onerror=function(){Object.defineProperty(At,"state",{value:"failed",writable:!0}),vt._updateConnectionState()},{iceTransport:bt,dtlsTransport:At}},ft.prototype._disposeIceAndDtlsTransports=function(vt){var bt=this.transceivers[vt].iceGatherer;bt&&(delete bt.onlocalcandidate,delete this.transceivers[vt].iceGatherer);var At=this.transceivers[vt].iceTransport;At&&(delete At.onicestatechange,delete this.transceivers[vt].iceTransport);var Nt=this.transceivers[vt].dtlsTransport;Nt&&(delete Nt.ondtlsstatechange,delete Nt.onerror,delete this.transceivers[vt].dtlsTransport)},ft.prototype._transceive=function(vt,bt,At){var Nt=et(vt.localCapabilities,vt.remoteCapabilities);bt&&vt.rtpSender&&(Nt.encodings=vt.sendEncodingParameters,Nt.rtcp={cname:dt.localCName,compound:vt.rtcpParameters.compound},vt.recvEncodingParameters.length&&(Nt.rtcp.ssrc=vt.recvEncodingParameters[0].ssrc),vt.rtpSender.send(Nt)),At&&vt.rtpReceiver&&Nt.codecs.length>0&&(vt.kind==="video"&&vt.recvEncodingParameters&<<15019&&vt.recvEncodingParameters.forEach(function(St){delete St.rtx}),vt.recvEncodingParameters.length?Nt.encodings=vt.recvEncodingParameters:Nt.encodings=[{}],Nt.rtcp={compound:vt.rtcpParameters.compound},vt.rtcpParameters.cname&&(Nt.rtcp.cname=vt.rtcpParameters.cname),vt.sendEncodingParameters.length&&(Nt.rtcp.ssrc=vt.sendEncodingParameters[0].ssrc),vt.rtpReceiver.receive(Nt))},ft.prototype.setLocalDescription=function(vt){var bt=this;if(["offer","answer"].indexOf(vt.type)===-1)return Promise.reject(ht("TypeError",'Unsupported type "'+vt.type+'"'));if(!nt("setLocalDescription",vt.type,bt.signalingState)||bt._isClosed)return Promise.reject(ht("InvalidStateError","Can not set local "+vt.type+" in state "+bt.signalingState));var At,Nt;if(vt.type==="offer")At=dt.splitSections(vt.sdp),Nt=At.shift(),At.forEach(function(wt,Mt){var Ht=dt.parseRtpParameters(wt);bt.transceivers[Mt].localCapabilities=Ht}),bt.transceivers.forEach(function(wt,Mt){bt._gather(wt.mid,Mt)});else if(vt.type==="answer"){At=dt.splitSections(bt._remoteDescription.sdp),Nt=At.shift();var St=dt.matchPrefix(Nt,"a=ice-lite").length>0;At.forEach(function(wt,Mt){var Ht=bt.transceivers[Mt],Ot=Ht.iceGatherer,Dt=Ht.iceTransport,Gt=Ht.dtlsTransport,nn=Ht.localCapabilities,zt=Ht.remoteCapabilities;if(!(dt.isRejected(wt)&&dt.matchPrefix(wt,"a=bundle-only").length===0)&&!Ht.rejected){var Ft=dt.getIceParameters(wt,Nt),un=dt.getDtlsParameters(wt,Nt);St&&(un.role="server"),bt.usingBundle&&Mt!==0||(bt._gather(Ht.mid,Mt),Dt.state==="new"&&Dt.start(Ot,Ft,St?"controlling":"controlled"),Gt.state==="new"&&Gt.start(un));var vn=et(nn,zt);bt._transceive(Ht,vn.codecs.length>0,!1)}})}return bt._localDescription={type:vt.type,sdp:vt.sdp},vt.type==="offer"?bt._updateSignalingState("have-local-offer"):bt._updateSignalingState("stable"),Promise.resolve()},ft.prototype.setRemoteDescription=function(vt){var bt=this;if(["offer","answer"].indexOf(vt.type)===-1)return Promise.reject(ht("TypeError",'Unsupported type "'+vt.type+'"'));if(!nt("setRemoteDescription",vt.type,bt.signalingState)||bt._isClosed)return Promise.reject(ht("InvalidStateError","Can not set remote "+vt.type+" in state "+bt.signalingState));var At={};bt.remoteStreams.forEach(function(Dt){At[Dt.id]=Dt});var Nt=[],St=dt.splitSections(vt.sdp),wt=St.shift(),Mt=dt.matchPrefix(wt,"a=ice-lite").length>0,Ht=dt.matchPrefix(wt,"a=group:BUNDLE ").length>0;bt.usingBundle=Ht;var Ot=dt.matchPrefix(wt,"a=ice-options:")[0];return bt.canTrickleIceCandidates=!!Ot&&Ot.substr(14).split(" ").indexOf("trickle")>=0,St.forEach(function(Dt,Gt){var nn=dt.splitLines(Dt),zt=dt.getKind(Dt),Ft=dt.isRejected(Dt)&&dt.matchPrefix(Dt,"a=bundle-only").length===0,un=nn[0].substr(2).split(" ")[2],vn=dt.getDirection(Dt,wt),yn=dt.parseMsid(Dt),cn=dt.getMid(Dt)||dt.generateIdentifier();if(Ft||zt==="application"&&(un==="DTLS/SCTP"||un==="UDP/DTLS/SCTP"))bt.transceivers[Gt]={mid:cn,kind:zt,protocol:un,rejected:!0};else{!Ft&&bt.transceivers[Gt]&&bt.transceivers[Gt].rejected&&(bt.transceivers[Gt]=bt._createTransceiver(zt,!0));var gn,bn,fn,Tn,_n,Un,Pn,In,Rn,On,Ln,qn=dt.parseRtpParameters(Dt);Ft||(On=dt.getIceParameters(Dt,wt),(Ln=dt.getDtlsParameters(Dt,wt)).role="client"),Pn=dt.parseRtpEncodingParameters(Dt);var jn=dt.parseRtcpParameters(Dt),Fn=dt.matchPrefix(Dt,"a=end-of-candidates",wt).length>0,Zn=dt.matchPrefix(Dt,"a=candidate:").map(function(Bn){return dt.parseCandidate(Bn)}).filter(function(Bn){return Bn.component===1});if((vt.type==="offer"||vt.type==="answer")&&!Ft&&Ht&&Gt>0&&bt.transceivers[Gt]&&(bt._disposeIceAndDtlsTransports(Gt),bt.transceivers[Gt].iceGatherer=bt.transceivers[0].iceGatherer,bt.transceivers[Gt].iceTransport=bt.transceivers[0].iceTransport,bt.transceivers[Gt].dtlsTransport=bt.transceivers[0].dtlsTransport,bt.transceivers[Gt].rtpSender&&bt.transceivers[Gt].rtpSender.setTransport(bt.transceivers[0].dtlsTransport),bt.transceivers[Gt].rtpReceiver&&bt.transceivers[Gt].rtpReceiver.setTransport(bt.transceivers[0].dtlsTransport)),vt.type!=="offer"||Ft)vt.type!=="answer"||Ft||(bn=(gn=bt.transceivers[Gt]).iceGatherer,fn=gn.iceTransport,Tn=gn.dtlsTransport,_n=gn.rtpReceiver,Un=gn.sendEncodingParameters,In=gn.localCapabilities,bt.transceivers[Gt].recvEncodingParameters=Pn,bt.transceivers[Gt].remoteCapabilities=qn,bt.transceivers[Gt].rtcpParameters=jn,Zn.length&&fn.state==="new"&&(!Mt&&!Fn||Ht&&Gt!==0?Zn.forEach(function(Bn){at(gn.iceTransport,Bn)}):fn.setRemoteCandidates(Zn)),Ht&&Gt!==0||(fn.state==="new"&&fn.start(bn,On,"controlling"),Tn.state==="new"&&Tn.start(Ln)),!et(gn.localCapabilities,gn.remoteCapabilities).codecs.filter(function(Bn){return Bn.name.toLowerCase()==="rtx"}).length&&gn.sendEncodingParameters[0].rtx&&delete gn.sendEncodingParameters[0].rtx,bt._transceive(gn,vn==="sendrecv"||vn==="recvonly",vn==="sendrecv"||vn==="sendonly"),!_n||vn!=="sendrecv"&&vn!=="sendonly"?delete gn.rtpReceiver:(Rn=_n.track,yn?(At[yn.stream]||(At[yn.stream]=new ut.MediaStream),mt(Rn,At[yn.stream]),Nt.push([Rn,_n,At[yn.stream]])):(At.default||(At.default=new ut.MediaStream),mt(Rn,At.default),Nt.push([Rn,_n,At.default]))));else{(gn=bt.transceivers[Gt]||bt._createTransceiver(zt)).mid=cn,gn.iceGatherer||(gn.iceGatherer=bt._createIceGatherer(Gt,Ht)),Zn.length&&gn.iceTransport.state==="new"&&(!Fn||Ht&&Gt!==0?Zn.forEach(function(Bn){at(gn.iceTransport,Bn)}):gn.iceTransport.setRemoteCandidates(Zn)),In=ut.RTCRtpReceiver.getCapabilities(zt),lt<15019&&(In.codecs=In.codecs.filter(function(Bn){return Bn.name!=="rtx"})),Un=gn.sendEncodingParameters||[{ssrc:1001*(2*Gt+2)}];var on=!1;if(vn==="sendrecv"||vn==="sendonly"){if(on=!gn.rtpReceiver,_n=gn.rtpReceiver||new ut.RTCRtpReceiver(gn.dtlsTransport,zt),on){var Hn;Rn=_n.track,yn&&yn.stream==="-"||(yn?(At[yn.stream]||(At[yn.stream]=new ut.MediaStream,Object.defineProperty(At[yn.stream],"id",{get:function(){return yn.stream}})),Object.defineProperty(Rn,"id",{get:function(){return yn.track}}),Hn=At[yn.stream]):(At.default||(At.default=new ut.MediaStream),Hn=At.default)),Hn&&(mt(Rn,Hn),gn.associatedRemoteMediaStreams.push(Hn)),Nt.push([Rn,_n,Hn])}}else gn.rtpReceiver&&gn.rtpReceiver.track&&(gn.associatedRemoteMediaStreams.forEach(function(Bn){var zn=Bn.getTracks().find(function($n){return $n.id===gn.rtpReceiver.track.id});zn&&ot(zn,Bn)}),gn.associatedRemoteMediaStreams=[]);gn.localCapabilities=In,gn.remoteCapabilities=qn,gn.rtpReceiver=_n,gn.rtcpParameters=jn,gn.sendEncodingParameters=Un,gn.recvEncodingParameters=Pn,bt._transceive(bt.transceivers[Gt],!1,on)}}}),bt._dtlsRole===void 0&&(bt._dtlsRole=vt.type==="offer"?"active":"passive"),bt._remoteDescription={type:vt.type,sdp:vt.sdp},vt.type==="offer"?bt._updateSignalingState("have-remote-offer"):bt._updateSignalingState("stable"),Object.keys(At).forEach(function(Dt){var Gt=At[Dt];if(Gt.getTracks().length){if(bt.remoteStreams.indexOf(Gt)===-1){bt.remoteStreams.push(Gt);var nn=new Event("addstream");nn.stream=Gt,ut.setTimeout(function(){bt._dispatchEvent("addstream",nn)})}Nt.forEach(function(zt){var Ft=zt[0],un=zt[1];Gt.id===zt[2].id&&pt(bt,Ft,un,[Gt])})}}),Nt.forEach(function(Dt){Dt[2]||pt(bt,Dt[0],Dt[1],[])}),ut.setTimeout(function(){bt&&bt.transceivers&&bt.transceivers.forEach(function(Dt){Dt.iceTransport&&Dt.iceTransport.state==="new"&&Dt.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),Dt.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},ft.prototype.close=function(){this.transceivers.forEach(function(vt){vt.iceTransport&&vt.iceTransport.stop(),vt.dtlsTransport&&vt.dtlsTransport.stop(),vt.rtpSender&&vt.rtpSender.stop(),vt.rtpReceiver&&vt.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},ft.prototype._updateSignalingState=function(vt){this.signalingState=vt;var bt=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",bt)},ft.prototype._maybeFireNegotiationNeeded=function(){var vt=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,ut.setTimeout(function(){if(vt.needNegotiation){vt.needNegotiation=!1;var bt=new Event("negotiationneeded");vt._dispatchEvent("negotiationneeded",bt)}},0))},ft.prototype._updateIceConnectionState=function(){var vt,bt={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(Nt){Nt.iceTransport&&!Nt.rejected&&bt[Nt.iceTransport.state]++}),vt="new",bt.failed>0?vt="failed":bt.checking>0?vt="checking":bt.disconnected>0?vt="disconnected":bt.new>0?vt="new":bt.connected>0?vt="connected":bt.completed>0&&(vt="completed"),vt!==this.iceConnectionState){this.iceConnectionState=vt;var At=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",At)}},ft.prototype._updateConnectionState=function(){var vt,bt={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(Nt){Nt.iceTransport&&Nt.dtlsTransport&&!Nt.rejected&&(bt[Nt.iceTransport.state]++,bt[Nt.dtlsTransport.state]++)}),bt.connected+=bt.completed,vt="new",bt.failed>0?vt="failed":bt.connecting>0?vt="connecting":bt.disconnected>0?vt="disconnected":bt.new>0?vt="new":bt.connected>0&&(vt="connected"),vt!==this.connectionState){this.connectionState=vt;var At=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",At)}},ft.prototype.createOffer=function(){var vt=this;if(vt._isClosed)return Promise.reject(ht("InvalidStateError","Can not call createOffer after close"));var bt=vt.transceivers.filter(function(Mt){return Mt.kind==="audio"}).length,At=vt.transceivers.filter(function(Mt){return Mt.kind==="video"}).length,Nt=arguments[0];if(Nt){if(Nt.mandatory||Nt.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");Nt.offerToReceiveAudio!==void 0&&(bt=Nt.offerToReceiveAudio===!0?1:Nt.offerToReceiveAudio===!1?0:Nt.offerToReceiveAudio),Nt.offerToReceiveVideo!==void 0&&(At=Nt.offerToReceiveVideo===!0?1:Nt.offerToReceiveVideo===!1?0:Nt.offerToReceiveVideo)}for(vt.transceivers.forEach(function(Mt){Mt.kind==="audio"?--bt<0&&(Mt.wantReceive=!1):Mt.kind==="video"&&--At<0&&(Mt.wantReceive=!1)});bt>0||At>0;)bt>0&&(vt._createTransceiver("audio"),bt--),At>0&&(vt._createTransceiver("video"),At--);var St=dt.writeSessionBoilerplate(vt._sdpSessionId,vt._sdpSessionVersion++);vt.transceivers.forEach(function(Mt,Ht){var Ot=Mt.track,Dt=Mt.kind,Gt=Mt.mid||dt.generateIdentifier();Mt.mid=Gt,Mt.iceGatherer||(Mt.iceGatherer=vt._createIceGatherer(Ht,vt.usingBundle));var nn=ut.RTCRtpSender.getCapabilities(Dt);lt<15019&&(nn.codecs=nn.codecs.filter(function(Ft){return Ft.name!=="rtx"})),nn.codecs.forEach(function(Ft){Ft.name==="H264"&&Ft.parameters["level-asymmetry-allowed"]===void 0&&(Ft.parameters["level-asymmetry-allowed"]="1"),Mt.remoteCapabilities&&Mt.remoteCapabilities.codecs&&Mt.remoteCapabilities.codecs.forEach(function(un){Ft.name.toLowerCase()===un.name.toLowerCase()&&Ft.clockRate===un.clockRate&&(Ft.preferredPayloadType=un.payloadType)})}),nn.headerExtensions.forEach(function(Ft){(Mt.remoteCapabilities&&Mt.remoteCapabilities.headerExtensions||[]).forEach(function(un){Ft.uri===un.uri&&(Ft.id=un.id)})});var zt=Mt.sendEncodingParameters||[{ssrc:1001*(2*Ht+1)}];Ot&<>=15019&&Dt==="video"&&!zt[0].rtx&&(zt[0].rtx={ssrc:zt[0].ssrc+1}),Mt.wantReceive&&(Mt.rtpReceiver=new ut.RTCRtpReceiver(Mt.dtlsTransport,Dt)),Mt.localCapabilities=nn,Mt.sendEncodingParameters=zt}),vt._config.bundlePolicy!=="max-compat"&&(St+="a=group:BUNDLE "+vt.transceivers.map(function(Mt){return Mt.mid}).join(" ")+`\r -`),St+=`a=ice-options:trickle\r -`,vt.transceivers.forEach(function(Mt,Ht){St+=it(Mt,Mt.localCapabilities,"offer",Mt.stream,vt._dtlsRole),St+=`a=rtcp-rsize\r -`,!Mt.iceGatherer||vt.iceGatheringState==="new"||Ht!==0&&vt.usingBundle||(Mt.iceGatherer.getLocalCandidates().forEach(function(Ot){Ot.component=1,St+="a="+dt.writeCandidate(Ot)+`\r -`}),Mt.iceGatherer.state==="completed"&&(St+=`a=end-of-candidates\r -`))});var wt=new ut.RTCSessionDescription({type:"offer",sdp:St});return Promise.resolve(wt)},ft.prototype.createAnswer=function(){var vt=this;if(vt._isClosed)return Promise.reject(ht("InvalidStateError","Can not call createAnswer after close"));if(vt.signalingState!=="have-remote-offer"&&vt.signalingState!=="have-local-pranswer")return Promise.reject(ht("InvalidStateError","Can not call createAnswer in signalingState "+vt.signalingState));var bt=dt.writeSessionBoilerplate(vt._sdpSessionId,vt._sdpSessionVersion++);vt.usingBundle&&(bt+="a=group:BUNDLE "+vt.transceivers.map(function(St){return St.mid}).join(" ")+`\r -`),bt+=`a=ice-options:trickle\r -`;var At=dt.getMediaSections(vt._remoteDescription.sdp).length;vt.transceivers.forEach(function(St,wt){if(!(wt+1>At)){if(St.rejected)return St.kind==="application"?St.protocol==="DTLS/SCTP"?bt+=`m=application 0 DTLS/SCTP 5000\r -`:bt+="m=application 0 "+St.protocol+` webrtc-datachannel\r -`:St.kind==="audio"?bt+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r -a=rtpmap:0 PCMU/8000\r -`:St.kind==="video"&&(bt+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r -a=rtpmap:120 VP8/90000\r -`),void(bt+=`c=IN IP4 0.0.0.0\r -a=inactive\r -a=mid:`+St.mid+`\r -`);if(St.stream){var Mt;St.kind==="audio"?Mt=St.stream.getAudioTracks()[0]:St.kind==="video"&&(Mt=St.stream.getVideoTracks()[0]),Mt&<>=15019&&St.kind==="video"&&!St.sendEncodingParameters[0].rtx&&(St.sendEncodingParameters[0].rtx={ssrc:St.sendEncodingParameters[0].ssrc+1})}var Ht=et(St.localCapabilities,St.remoteCapabilities);!Ht.codecs.filter(function(Ot){return Ot.name.toLowerCase()==="rtx"}).length&&St.sendEncodingParameters[0].rtx&&delete St.sendEncodingParameters[0].rtx,bt+=it(St,Ht,"answer",St.stream,vt._dtlsRole),St.rtcpParameters&&St.rtcpParameters.reducedSize&&(bt+=`a=rtcp-rsize\r -`)}});var Nt=new ut.RTCSessionDescription({type:"answer",sdp:bt});return Promise.resolve(Nt)},ft.prototype.addIceCandidate=function(vt){var bt,At=this;return vt&&vt.sdpMLineIndex===void 0&&!vt.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(Nt,St){if(!At._remoteDescription)return St(ht("InvalidStateError","Can not add ICE candidate without a remote description"));if(vt&&vt.candidate!==""){var wt=vt.sdpMLineIndex;if(vt.sdpMid){for(var Mt=0;Mt0?dt.parseCandidate(vt.candidate):{};if(Ot.protocol==="tcp"&&(Ot.port===0||Ot.port===9)||Ot.component&&Ot.component!==1)return Nt();if((wt===0||wt>0&&Ht.iceTransport!==At.transceivers[0].iceTransport)&&!at(Ht.iceTransport,Ot))return St(ht("OperationError","Can not add ICE candidate"));var Dt=vt.candidate.trim();Dt.indexOf("a=")===0&&(Dt=Dt.substr(2)),(bt=dt.getMediaSections(At._remoteDescription.sdp))[wt]+="a="+(Ot.type?Dt:"end-of-candidates")+`\r -`,At._remoteDescription.sdp=dt.getDescription(At._remoteDescription.sdp)+bt.join("")}else for(var Gt=0;Gt0?"m="+s:s).trim()+`\r -`})},rt.getDescription=function(it){var s=rt.splitSections(it);return s&&s[0]},rt.getMediaSections=function(it){var s=rt.splitSections(it);return s.shift(),s},rt.matchPrefix=function(it,s){return rt.splitLines(it).filter(function(et){return et.indexOf(s)===0})},rt.parseCandidate=function(it){for(var s,et={foundation:(s=it.indexOf("a=candidate:")===0?it.substring(12).split(" "):it.substring(10).split(" "))[0],component:parseInt(s[1],10),protocol:s[2].toLowerCase(),priority:parseInt(s[3],10),ip:s[4],address:s[4],port:parseInt(s[5],10),type:s[7]},nt=8;nt0?s[0].split("/")[1]:"sendrecv",uri:s[1]}},rt.writeExtmap=function(it){return"a=extmap:"+(it.id||it.preferredId)+(it.direction&&it.direction!=="sendrecv"?"/"+it.direction:"")+" "+it.uri+`\r -`},rt.parseFmtp=function(it){for(var s,et={},nt=it.substr(it.indexOf(" ")+1).split(";"),at=0;at-1?(et.attribute=it.substr(s+1,nt-s-1),et.value=it.substr(nt+1)):et.attribute=it.substr(s+1),et},rt.parseSsrcGroup=function(it){var s=it.substr(13).split(" ");return{semantics:s.shift(),ssrcs:s.map(function(et){return parseInt(et,10)})}},rt.getMid=function(it){var s=rt.matchPrefix(it,"a=mid:")[0];if(s)return s.substr(6)},rt.parseFingerprint=function(it){var s=it.substr(14).split(" ");return{algorithm:s[0].toLowerCase(),value:s[1]}},rt.getDtlsParameters=function(it,s){return{role:"auto",fingerprints:rt.matchPrefix(it+s,"a=fingerprint:").map(rt.parseFingerprint)}},rt.writeDtlsParameters=function(it,s){var et="a=setup:"+s+`\r -`;return it.fingerprints.forEach(function(nt){et+="a=fingerprint:"+nt.algorithm+" "+nt.value+`\r -`}),et},rt.getIceParameters=function(it,s){var et=rt.splitLines(it);return{usernameFragment:(et=et.concat(rt.splitLines(s))).filter(function(nt){return nt.indexOf("a=ice-ufrag:")===0})[0].substr(12),password:et.filter(function(nt){return nt.indexOf("a=ice-pwd:")===0})[0].substr(10)}},rt.writeIceParameters=function(it){return"a=ice-ufrag:"+it.usernameFragment+`\r -a=ice-pwd:`+it.password+`\r -`},rt.parseRtpParameters=function(it){for(var s={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},et=rt.splitLines(it)[0].split(" "),nt=3;nt0?"9":"0",et+=" UDP/TLS/RTP/SAVPF ",et+=s.codecs.map(function(at){return at.preferredPayloadType!==void 0?at.preferredPayloadType:at.payloadType}).join(" ")+`\r -`,et+=`c=IN IP4 0.0.0.0\r -`,et+=`a=rtcp:9 IN IP4 0.0.0.0\r -`,s.codecs.forEach(function(at){et+=rt.writeRtpMap(at),et+=rt.writeFmtp(at),et+=rt.writeRtcpFb(at)});var nt=0;return s.codecs.forEach(function(at){at.maxptime>nt&&(nt=at.maxptime)}),nt>0&&(et+="a=maxptime:"+nt+`\r -`),et+=`a=rtcp-mux\r -`,s.headerExtensions&&s.headerExtensions.forEach(function(at){et+=rt.writeExtmap(at)}),et},rt.parseRtpEncodingParameters=function(it){var s,et=[],nt=rt.parseRtpParameters(it),at=nt.fecMechanisms.indexOf("RED")!==-1,ht=nt.fecMechanisms.indexOf("ULPFEC")!==-1,dt=rt.matchPrefix(it,"a=ssrc:").map(function(ot){return rt.parseSsrcMedia(ot)}).filter(function(ot){return ot.attribute==="cname"}),ut=dt.length>0&&dt[0].ssrc,lt=rt.matchPrefix(it,"a=ssrc-group:FID").map(function(ot){return ot.substr(17).split(" ").map(function(pt){return parseInt(pt,10)})});lt.length>0&<[0].length>1&<[0][0]===ut&&(s=lt[0][1]),nt.codecs.forEach(function(ot){if(ot.name.toUpperCase()==="RTX"&&ot.parameters.apt){var pt={ssrc:ut,codecPayloadType:parseInt(ot.parameters.apt,10)};ut&&s&&(pt.rtx={ssrc:s}),et.push(pt),at&&((pt=JSON.parse(JSON.stringify(pt))).fec={ssrc:ut,mechanism:ht?"red+ulpfec":"red"},et.push(pt))}}),et.length===0&&ut&&et.push({ssrc:ut});var mt=rt.matchPrefix(it,"b=");return mt.length&&(mt=mt[0].indexOf("b=TIAS:")===0?parseInt(mt[0].substr(7),10):mt[0].indexOf("b=AS:")===0?1e3*parseInt(mt[0].substr(5),10)*.95-16e3:void 0,et.forEach(function(ot){ot.maxBitrate=mt})),et},rt.parseRtcpParameters=function(it){var s={},et=rt.matchPrefix(it,"a=ssrc:").map(function(ht){return rt.parseSsrcMedia(ht)}).filter(function(ht){return ht.attribute==="cname"})[0];et&&(s.cname=et.value,s.ssrc=et.ssrc);var nt=rt.matchPrefix(it,"a=rtcp-rsize");s.reducedSize=nt.length>0,s.compound=nt.length===0;var at=rt.matchPrefix(it,"a=rtcp-mux");return s.mux=at.length>0,s},rt.parseMsid=function(it){var s,et=rt.matchPrefix(it,"a=msid:");if(et.length===1)return s=et[0].substr(7).split(" "),{stream:s[0],track:s[1]};var nt=rt.matchPrefix(it,"a=ssrc:").map(function(at){return rt.parseSsrcMedia(at)}).filter(function(at){return at.attribute==="msid"});return nt.length>0?(s=nt[0].value.split(" "),{stream:s[0],track:s[1]}):void 0},rt.generateSessionId=function(){return Math.random().toString().substr(2,21)},rt.writeSessionBoilerplate=function(it,s,et){var nt,at=s!==void 0?s:2;return nt=it||rt.generateSessionId(),`v=0\r -o=`+(et||"thisisadapterortc")+" "+nt+" "+at+` IN IP4 127.0.0.1\r -s=-\r -t=0 0\r -`},rt.writeMediaSection=function(it,s,et,nt){var at=rt.writeRtpDescription(it.kind,s);if(at+=rt.writeIceParameters(it.iceGatherer.getLocalParameters()),at+=rt.writeDtlsParameters(it.dtlsTransport.getLocalParameters(),et==="offer"?"actpass":"active"),at+="a=mid:"+it.mid+`\r -`,it.direction?at+="a="+it.direction+`\r -`:it.rtpSender&&it.rtpReceiver?at+=`a=sendrecv\r -`:it.rtpSender?at+=`a=sendonly\r -`:it.rtpReceiver?at+=`a=recvonly\r -`:at+=`a=inactive\r -`,it.rtpSender){var ht="msid:"+nt.id+" "+it.rtpSender.track.id+`\r -`;at+="a="+ht,at+="a=ssrc:"+it.sendEncodingParameters[0].ssrc+" "+ht,it.sendEncodingParameters[0].rtx&&(at+="a=ssrc:"+it.sendEncodingParameters[0].rtx.ssrc+" "+ht,at+="a=ssrc-group:FID "+it.sendEncodingParameters[0].ssrc+" "+it.sendEncodingParameters[0].rtx.ssrc+`\r -`)}return at+="a=ssrc:"+it.sendEncodingParameters[0].ssrc+" cname:"+rt.localCName+`\r -`,it.rtpSender&&it.sendEncodingParameters[0].rtx&&(at+="a=ssrc:"+it.sendEncodingParameters[0].rtx.ssrc+" cname:"+rt.localCName+`\r -`),at},rt.getDirection=function(it,s){for(var et=rt.splitLines(it),nt=0;nt-1?Mt:wt}function mt(wt,Mt){var Ht=(Mt=Mt||{}).body;if(wt instanceof mt){if(wt.bodyUsed)throw new TypeError("Already read");this.url=wt.url,this.credentials=wt.credentials,Mt.headers||(this.headers=new it(wt.headers)),this.method=wt.method,this.mode=wt.mode,Ht||wt._bodyInit==null||(Ht=wt._bodyInit,wt.bodyUsed=!0)}else this.url=String(wt);if(this.credentials=Mt.credentials||this.credentials||"omit",!Mt.headers&&this.headers||(this.headers=new it(Mt.headers)),this.method=lt(Mt.method||this.method||"GET"),this.mode=Mt.mode||this.mode||null,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Ht)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Ht)}function ot(wt){var Mt=new FormData;return wt.trim().split("&").forEach(function(Ht){if(Ht){var Ot=Ht.split("="),Dt=Ot.shift().replace(/\+/g," "),Gt=Ot.join("=").replace(/\+/g," ");Mt.append(decodeURIComponent(Dt),decodeURIComponent(Gt))}}),Mt}function pt(wt){var Mt=new it;return wt.split(/\r?\n/).forEach(function(Ht){var Ot=Ht.split(":"),Dt=Ot.shift().trim();if(Dt){var Gt=Ot.join(":").trim();Mt.append(Dt,Gt)}}),Mt}function ft(wt,Mt){Mt||(Mt={}),this.type="default",this.status="status"in Mt?Mt.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in Mt?Mt.statusText:"OK",this.headers=new it(Mt.headers),this.url=Mt.url||"",this._initBody(wt)}if(!tt.fetch){var yt={searchParams:"URLSearchParams"in tt,iterable:"Symbol"in tt&&"iterator"in Symbol,blob:"FileReader"in tt&&"Blob"in tt&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in tt,arrayBuffer:"ArrayBuffer"in tt};if(yt.arrayBuffer)var vt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],bt=function(wt){return wt&&DataView.prototype.isPrototypeOf(wt)},At=ArrayBuffer.isView||function(wt){return wt&&vt.indexOf(Object.prototype.toString.call(wt))>-1};it.prototype.append=function(wt,Mt){wt=ct(wt),Mt=gt(Mt);var Ht=this.map[wt];this.map[wt]=Ht?Ht+","+Mt:Mt},it.prototype.delete=function(wt){delete this.map[ct(wt)]},it.prototype.get=function(wt){return wt=ct(wt),this.has(wt)?this.map[wt]:null},it.prototype.has=function(wt){return this.map.hasOwnProperty(ct(wt))},it.prototype.set=function(wt,Mt){this.map[ct(wt)]=gt(Mt)},it.prototype.forEach=function(wt,Mt){for(var Ht in this.map)this.map.hasOwnProperty(Ht)&&wt.call(Mt,this.map[Ht],Ht,this)},it.prototype.keys=function(){var wt=[];return this.forEach(function(Mt,Ht){wt.push(Ht)}),rt(wt)},it.prototype.values=function(){var wt=[];return this.forEach(function(Mt){wt.push(Mt)}),rt(wt)},it.prototype.entries=function(){var wt=[];return this.forEach(function(Mt,Ht){wt.push([Ht,Mt])}),rt(wt)},yt.iterable&&(it.prototype[Symbol.iterator]=it.prototype.entries);var Nt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];mt.prototype.clone=function(){return new mt(this,{body:this._bodyInit})},ut.call(mt.prototype),ut.call(ft.prototype),ft.prototype.clone=function(){return new ft(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new it(this.headers),url:this.url})},ft.error=function(){var wt=new ft(null,{status:0,statusText:""});return wt.type="error",wt};var St=[301,302,303,307,308];ft.redirect=function(wt,Mt){if(St.indexOf(Mt)===-1)throw new RangeError("Invalid status code");return new ft(null,{status:Mt,headers:{location:wt}})},tt.Headers=it,tt.Request=mt,tt.Response=ft,tt.fetch=function(wt,Mt){return new Promise(function(Ht,Ot){var Dt=new mt(wt,Mt),Gt=new XMLHttpRequest;Gt.onload=function(){var nn={status:Gt.status,statusText:Gt.statusText,headers:pt(Gt.getAllResponseHeaders()||"")};nn.url="responseURL"in Gt?Gt.responseURL:nn.headers.get("X-Request-URL");var zt="response"in Gt?Gt.response:Gt.responseText;Ht(new ft(zt,nn))},Gt.onerror=function(){Ot(new TypeError("Network request failed"))},Gt.ontimeout=function(){Ot(new TypeError("Network request failed"))},Gt.open(Dt.method,Dt.url,!0),Dt.credentials==="include"&&(Gt.withCredentials=!0),"responseType"in Gt&&yt.blob&&(Gt.responseType="blob"),Dt.headers.forEach(function(nn,zt){Gt.setRequestHeader(zt,nn)}),Gt.send(Dt._bodyInit===void 0?null:Dt._bodyInit)})},tt.fetch.polyfill=!0}}(typeof self<"u"?self:commonjsGlobal);var _e={};_e=function(){function tt(ut,lt){var mt,ot,pt,ft=[],yt=(ut=ut.push?ut:[ut]).length,vt=yt;for(mt=function(bt,At){At.length&&ft.push(bt),--vt||lt(ft)};yt--;)ot=ut[yt],(pt=at[ot])?mt(ot,pt):(ht[ot]=ht[ot]||[]).push(mt)}function ct(ut,lt){if(ut){var mt=ht[ut];if(at[ut]=lt,mt)for(;mt.length;)mt[0](ut,lt),mt.splice(0,1)}}function gt(ut,lt){ut.call&&(ut={success:ut}),lt.length?(ut.error||et)(lt):(ut.success||et)(ut)}function rt(ut,lt,mt,ot){var pt,ft,yt=document,vt=mt.async,bt=(mt.numRetries||0)+1,At=mt.before||et,Nt=ut.replace(/^(css|img)!/,""),St=mt.reqdelay||0;ot=ot||0,/(^css!|\.css$)/.test(ut)?(pt=!0,(ft=yt.createElement("link")).rel="stylesheet",ft.href=Nt):/(^img!|\.(png|gif|jpg|svg)$)/.test(ut)?(ft=yt.createElement("img")).src=Nt:((ft=yt.createElement("script")).src=ut,ft.async=vt===void 0||vt),ft.onload=ft.onerror=ft.onbeforeload=function(wt){var Mt=wt.type[0];if(pt&&"hideFocus"in ft)try{ft.sheet.cssText.length||(Mt="e")}catch{Mt="e"}if(Mt=="e"&&(ot+=1)"u"){var et={async:!0,numRetries:it.extJsLoadingRetryNb||100,reqdelay:it.extJsLoadingRetryDelay||200,success:function(){tt.rtcio=io,s.success()},error:function(nt){console.error("socket.io loading error"),s.error()},retrycb:function(nt,at){console.warn("socket.io loading retry :"+nt+" ,delay before retry :"+at),s.retrycb()}};it.socketioUrl!==void 0?_e([it.socketioUrl],"socketio",et):_e([rt+"://"+it.ccsServer+"/socket.io/v3/socket.io.js"],"socketio",et)}else console.log("Else loadjs io"),tt.rtcio=io,s.success()},tt.apiRTC_sioLoader=gt}(window);/*! For license information please see apiRTC-srcTmp.js.LICENSE.txt */(function(tt,ct){a.exports=ct()})(self,()=>(()=>{var tt={8364:function(rt,it,s){var et,nt=this&&this.__extends||(et=function(bt,At){return(et=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(Nt,St){Nt.__proto__=St}:function(Nt,St){for(var wt in St)Object.prototype.hasOwnProperty.call(St,wt)&&(Nt[wt]=St[wt])}))(bt,At)},function(bt,At){if(typeof At!="function"&&At!==null)throw new TypeError("Class extends value "+String(At)+" is not a constructor or null");function Nt(){this.constructor=bt}et(bt,At),bt.prototype=At===null?Object.create(At):(Nt.prototype=At.prototype,new Nt)}),at=(Object.defineProperty(it,"__esModule",{value:!0}),s(2043)),ht=s(7987),dt=at.getLogger("CloudAPI"),ut=(ht.reg(at),ht.apply(dt,{format:function(bt,At,Nt){return"".concat(Nt," - [").concat(bt,"] ").concat(At," : ")}}),dt.setDefaultLevel("error"),dt.setLevel("error"),"https://cloud.apizee.com"),lt="/api/v2/media/upload",mt="/api/v2/conversation/{convId}/media",ot="/api/v2/conferences",pt={updateWebconfTags:{fetchRetryCount:3,fetchRetryDelay:500}},ft=null,yt=function(){function bt(){if(this.cloudUrl=ut,this.JWTApzToken="",this.fetchRetries=100,this.fetchRetryDelay=200,ft!==null)return dt.debug("Cannot construct multiple CloudAPI, this is a singleton."),ft;ft=this}return bt.get=function(){return ft=ft===null?new bt:ft},bt.prototype.setLogLevel=function(At){dt.setLevel(At)},bt.prototype.getLogLevel=function(){var At="";switch(dt.getLevel()){case 0:At="trace";break;case 1:At="debug";break;case 2:At="info";break;case 3:At="warn";break;case 4:At="error";break;case 5:At="silent"}return At},bt.prototype.setCloudURL=function(At){dt.debug("setCloudURL :",At),this.cloudUrl=At},bt.prototype.setJWTApzToken=function(At){this.JWTApzToken=At},bt.prototype.setFetchRetries=function(At){dt.debug("setFetchRetries :",At),At!=null&&(this.fetchRetries=At)},bt.prototype.setFetchRetryDelay=function(At){dt.log("setFetchRetryDelay :",At),At!=null&&(this.fetchRetryDelay=At)},bt.prototype.request=function(At,Nt,St,wt,Mt,Ht){Mt===void 0&&(Mt={}),Ht===void 0&&(Ht={});var Ot=At.indexOf(this.cloudUrl)===-1?this.cloudUrl+At:At,Dt=null;return new Promise(function(Gt,nn){var zt,Ft=new XMLHttpRequest;if(Ht.hasOwnProperty("withCredentials")&&(Ft.withCredentials=Ht.withCredentials),Ft.onreadystatechange=function(bn){if(Ft.readyState===XMLHttpRequest.DONE)if(dt.debug("request onreadystatechange status :",Ft.status),200<=Ft.status&&Ft.status<300)if(Ft.responseText){var fn=null;try{fn=JSON.parse(Ft.responseText)}catch{fn=Ft.responseText}Gt(fn)}else Gt("No_responseTest");else{if(fn={status:Ft.status,text:Ft.statusText},Ft.responseText)try{fn.response=JSON.parse(Ft.responseText)}catch{fn.responseText=Ft.responseText}nn(fn)}},Ft.onprogress=function(bn){typeof wt=="function"&&wt(bn)},Ft.onerror=function(bn){nn(bn)},St==="GET")0{s.d(it,{_:()=>at}),s(2564);var et=s(1549).Y.get("ApiCCDataClient"),nt=apiCC.myWebRTC_Event,at=function(ht){this.sendData=function(dt,ut,lt){et.info("Call sending data function .... to :"+dt+" message :",ut);var mt,ot,pt=ht.channel.getNewCSeq(),ft=null;return mt={type:"dataMessage",senderId:ht.apiCCId,dstRoomId:dt,data:ut,cSeq:pt},ot=JSON.stringify(mt),et.log("C->S: "+ot),lt!==void 0?(et.log("Ack management activated"),ft=setTimeout(function(){lt({reason:"timeoutReached",cSeq:pt}),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[pt]},ht.messageTimeOutTimer),et.log("timeOutId: "+ft),ht.messageTimeOutTable[pt]=ft,ht.channel.socket.emit("dataMessage",ot,function(yt){et.log("callback on dataMessage"),et.log("callback reason :"+yt.reason),et.log("cSeq :"+yt.cSeq),lt(yt),apiCC.session.messageTimeOutTable[pt]!==void 0?(et.log("clearing timeOutId: "+apiCC.session.messageTimeOutTable[pt]),clearTimeout(apiCC.session.messageTimeOutTable[pt]),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[pt]):et.warn("messageTimeOutTable was already deleted : timeout may have been reached before Ack")})):(et.log("Ack management not activated"),ht.channel.socket.emit("dataMessage",ot)),pt},this.sendDataToGroup=function(dt,ut){et.info("[ApiCCDataClient] sendDataToGroup - "+dt);var lt,mt=ht.getConnectedUsersList(dt);for(lt=0;lt{s.d(it,{U:()=>ut}),s(9554),s(1539),s(4747),s(2564),s(2526),s(1817),s(2165),s(6992),s(8783),s(3948);var et=s(1549),nt=s(4708),at=s(940);function ht(lt){return ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(mt){return typeof mt}:function(mt){return mt&&typeof Symbol=="function"&&mt.constructor===Symbol&&mt!==Symbol.prototype?"symbol":typeof mt},ht(lt)}var dt=et.Y.get("ApiCCIMClient"),ut=function(lt,mt){this.convTable=[],this.myWebRTC_Event=apiCC.myWebRTC_Event,this.nickname=lt.nickname,this.photoURL=null,this.userDataSetted=!1,this.myWebRTC_Stack=new at.S(lt.channel.socket),this.findIMIdWithDestID=function(ot){var pt,ft=this.convTable.length;for(dt.log("findIMIdWithDestID = "+ot),pt=0;ptS: "+vt),ft!==void 0?(dt.log("Ack management activated"),St=setTimeout(function(){ft({reason:"timeoutReached",cSeq:wt}),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[wt]},lt.messageTimeOutTimer),dt.log("timeOutId: "+St),lt.messageTimeOutTable[wt]=St,lt.channel.socket.emit("IMMessage",vt,function(Mt){dt.log("callback on IMMessage"),dt.log("data :",Mt),dt.log("callback reason :"+Mt.reason),dt.log("callback convId :"+Mt.convId),dt.log("cSeq :"+Mt.cSeq),ft(Mt),apiCC.session.messageTimeOutTable[wt]!==void 0?(dt.log("clearing timeOutId: "+apiCC.session.messageTimeOutTable[wt]),clearTimeout(apiCC.session.messageTimeOutTable[wt]),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[wt]):dt.warn("messageTimeOutTable was already deleted : timeout may have been reached before Ack")})):(dt.log("Ack management not activated"),lt.channel.socket.emit("IMMessage",vt)),this.conversation!==null&&(Nt.innerHTML="me : "+yt+"
",this.conversation.appendChild(Nt),this.conversation.scrollTop=this.conversation.scrollHeight),wt},this.newConversationCreated=function(ot){dt.debug("newConversationCreated :"+ot),dt.log("msg.dstRoomId :"+ot.dstRoomId),dt.log("msg.IMId :"+ot.IMId);var pt={dest_roomId:ot.dstRoomId,IMId:ot.IMId};this.addInConvTable(pt)},this.receiveMessage=function(ot){dt.info("Call receiveMessage message :"+ot);var pt,ft=null;pt={dest_roomId:ot.senderId,IMId:ot.IMId},this.addInConvTable(pt),this.conversation!==null&&((ft=document.createElement("message")).innerHTML=""+ot.nickname+": "+ot.data+"
",this.conversation.appendChild(ft),this.conversation.scrollTop=this.conversation.scrollHeight),this.myWebRTC_Event.createReceiveIMMessageEvent(ot.senderId,ot.nickname,ot.photoURL,ot.data,ot.UUCSeq,ot.IMId)},this.createGroupChat=function(ot,pt){var ft,yt;dt.info("createGroupChat with contacts : "+ot+","+pt),ft={type:"createGroupChat",nickname:this.nickname,photoURL:this.photoURL,contactId1:ot,contactId2:pt},yt=JSON.stringify(ft),dt.log("C->S: "+yt),lt.channel.socket.emit("createGroupChat",yt)},this.groupChatCreation=function(ot){dt.debug("groupChatCreation"),this.myWebRTC_Event.createGroupChatCreationEvent(ot.status,ot.groupChatId,ot.contactId1,ot.invitationSendedToInitialDestId,ot.contactId2,ot.invitationSendedToNewContactId)},this.joinGroupChat=function(ot){var pt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};dt.debug("joinGroupChat : "+ot);var ft=null,yt=null;ft={type:"joinGroupChat",groupChatId:ot},pt.convId&&(ft.data={},ft.data.cloudConvId=pt.convId),yt=JSON.stringify(ft),dt.log("C->S: "+yt),lt.channel.socket.emit("joinGroupChat",yt)},this.groupChatInvitation=function(ot){dt.debug("groupChatInvitation"),this.myWebRTC_Event.createGroupChatInvitationEvent(ot.groupChatId,ot.senderId,ot.senderNickname,ot.senderPhotoURL,ot.contactList)},this.answerToGroupChatInvitation=function(ot,pt){var ft,yt;dt.debug("answerToGroupChatInvitation: "+ot+" : "+pt),pt===!0||pt===!1?(ft={type:"groupChatInvitationAnswer",groupChatId:ot,senderId:lt.apiCCId,nickname:this.nickname,photoURL:this.photoURL,accept:pt},yt=JSON.stringify(ft),dt.log("C->S: "+yt),lt.channel.socket.emit("groupChatInvitationAnswer",yt)):dt.log("accept value is not correct")},this.groupChatMemberUpdate=function(ot){dt.info("groupChatMemberUpdate"),this.myWebRTC_Event.createGroupChatMemberUpdateEvent(ot.groupChatId,ot.contactList,ot.status)},this.addUserInGroupChat=function(ot,pt){var ft,yt;dt.debug("addUser : "+pt+"in Group Chat with Id :"+ot),ft={type:"addUserInGroupChat",groupChatId:ot,nickname:this.nickname,photoURL:this.photoURL,contactId:pt},yt=JSON.stringify(ft),dt.log("C->S: "+yt),lt.channel.socket.emit("addUserInGroupChat",yt)},this.addUserInGroupChatAnswer=function(ot){dt.info("addUserInGroupChatAnswer"),this.myWebRTC_Event.createAddUserInGroupChatEvent(ot.invitationSended,ot.groupChatId,ot.contactId)},this.leaveGroupChat=function(ot){var pt,ft;dt.info("Leave Group Chat with Id :"+ot),pt={type:"leaveGroupChat",groupChatId:ot,nickname:this.nickname,photoURL:this.photoURL},ft=JSON.stringify(pt),dt.log("C->S: "+ft),lt.channel.socket.emit("leaveGroupChat",ft)},this.sendMessageToGroupChat=function(ot,pt,ft){var yt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};dt.info("Call sending message to Group Chat .... from :"+this.nickname+" message :"+pt);var vt=null,bt=null,At=apiCC.session.channel.getNewCSeq();vt={type:"groupChatMessage",groupChatId:ot,senderId:lt.apiCCId,nickname:this.nickname,cSeq:At,data:pt},(0,nt.Ym)(yt,"metadata","object")&&(vt.metadata=yt.metadata),bt=JSON.stringify(vt),ft!==null&&typeof ft=="function"?(apiCC.session.messageTimeOutTable[At]=setTimeout(function(){ft({reason:"timeoutReached",cSeq:At}),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[At]},apiCC.session.messageTimeOutTimer),dt.log("C->S: "+bt),lt.channel.socket.emit("groupChatMessage",bt,function(Nt){clearTimeout(apiCC.session.messageTimeOutTable[Nt.cSeq]),apiCC.session!==null&&apiCC.session!==void 0&&delete apiCC.session.messageTimeOutTable[Nt.cSeq],ft(Nt)})):(dt.log("C->S: "+bt),lt.channel.socket.emit("groupChatMessage",bt))},this.receiveGroupChatMessage=function(ot){dt.info("receiveGroupChatMessage"),this.myWebRTC_Event.createReceiveGroupChatMessageEvent(ot.groupChatId,ot.senderId,ot.nickname,ot.data,ot.metadata)},this.getConversationHistory=function(ot){var pt,ft;dt.debug("getConversationHistory"),pt={type:"getConversationHistory",convId:ot},ft=JSON.stringify(pt),dt.log("C->S: "+ft),lt.channel.socket.emit("getConversationHistory",ft)},this.receiveConversationHistory=function(ot){dt.debug("receiveConversationHistory"),dt.log("msg.convId :"+ot.convId);var pt,ft=0,yt=[],vt=null;if(ot.convHistory!==null)for(dt.log("msg.convHistory.length :"+ot.convHistory.length),ft=ot.convHistory.length,yt=[],pt=0;ptS: "+ft),lt.channel.socket.emit("setUserData",ft),this.userDataSetted=!0},this.getUserData=function(ot){var pt,ft;dt.info("getUserData"),pt={type:"getUserData",contactId:ot},ft=JSON.stringify(pt),dt.log("C->S: "+ft),lt.channel.socket.emit("getUserData",ft)},this.receiveUserDataAnswer=function(ot){dt.info("receiveUserDataAnswer"),this.myWebRTC_Event.createUserDataAnswerEvent(ot.userFound,ot.contactId,ot.nickname,ot.photoURL)},this.receiveFetchUserDataAnswer=function(ot){dt.info("receiveFetchUserDataAnswer"),this.myWebRTC_Event.createFetchUserDataAnswerEvent(ot)},this.initialize=function(ot){var pt,ft;this.conversation=document.getElementById(ot),this.conversation===null&&(dt.log("conversationElementId Div Name is not correct : INCORRECT_DIV_NAME_CONVERSATION"),dt.log("conversationElementId is null")),pt={type:"registerIM",username:this.nickname},ft=JSON.stringify(pt),dt.log("C->S: "+ft),lt.channel.socket.emit("registerIM",ft)},this.initialize(mt)}},9213:(rt,it,s)=>{s.d(it,{X:()=>ht}),s(2564),s(2526),s(1817),s(1539);var et=s(1549),nt=s(4708),at=et.Y.get("ApiCCPointerSharingClient"),ht=function dt(ut){this.roomTable={},this.getRoomIds=function(){var lt=[],mt=null;for(mt in this.roomTable)lt.push(mt);return lt},this.roomExists=function(lt){return this.roomTable.hasOwnProperty(lt)},this.roomActive=function(lt){return this.roomTable.hasOwnProperty(lt)&&this.roomTable[lt].state===dt.STATE_ACTIVE},this.joinRoom=function(lt,mt){var ot=this;at.info("ApiCCPointerSharingClient::joinRoom()"),(0,nt.Ym)(mt,"object")||(mt={}),(0,nt.ki)(mt,"success","function")||(mt.success=function(){}),(0,nt.ki)(mt,"failure","function")||(mt.failure=function(){}),this.roomTable.hasOwnProperty(lt)?mt.failure("room already joined",lt):(this.roomTable[lt]={roomId:lt,state:dt.STATE_JOINING,joinRoomCallbacks:mt},this.roomTable[lt].joinRoomTimeoutId=setTimeout(function(){delete ot.roomTable[lt],mt.failure("timeout",lt)},15e3),apiCC.session.roomMgr.joinRoom(lt,"pointerSharing"))},this.leaveRoom=function(lt){this.roomTable.hasOwnProperty(lt)&&delete this.roomTable[lt],apiCC.session.roomMgr.leaveRoom(lt,"pointerSharing")},this.inviteInRoom=function(lt,mt,ot){at.info("ApiCCPointerSharingClient::inviteInRoom()"),apiCC.session.roomMgr.inviteInRoom(lt,mt,"pointerSharing",ot)},this.sendPointerLocation=function(lt,mt,ot,pt,ft){var yt;return!(!this.roomTable.hasOwnProperty(lt)||this.roomTable[lt].state!==dt.STATE_ACTIVE||(yt={type:"pointerLocation",source:mt,x:ot,y:pt},(0,nt.Ym)(ft,"object")&&(yt.data=ft),apiCC.session.roomMgr.sendMessageToRoom(lt,"pointerSharing",yt),0))},this.processMessageRoomJoin=function(lt){this.roomTable.hasOwnProperty(lt.roomId)&&this.roomTable[lt.roomId].state===dt.STATE_JOINING&&(clearTimeout(this.roomTable[lt.roomId].joinRoomTimeoutId),delete this.roomTable[lt.roomId].joinRoomTimeoutId,this.roomTable[lt.roomId].state=dt.STATE_ACTIVE,this.roomTable[lt.roomId].joinRoomCallbacks.success(lt.roomId),delete this.roomTable[lt.roomId].joinRoomCallbacks)},this.stop=function(){for(var lt=this.getRoomIds(),mt=lt.length;--mt>=0;)this.leaveRoom(lt[mt])}};ht.STATE_IDLE=Symbol("idle"),ht.STATE_JOINING=Symbol("joining"),ht.STATE_ACTIVE=Symbol("active"),ht.STATE_ERROR=Symbol("error")},3720:(rt,it,s)=>{s.d(it,{K:()=>Nt}),s(1058),s(8309),s(3710),s(1539),s(9714),s(2564),s(9554),s(4747),s(2772),s(561),s(6699),s(2479),s(2707),s(9601),s(8674),s(2526),s(1817),s(2165),s(6992),s(8783),s(3948),s(2443),s(3680),s(3706),s(2703),s(9070),s(8011),s(489),s(8304),s(7042);var et=s(1549),nt=et.Y.get("RoomManager"),at=function(St,wt){nt.debug("RoomManager"),this.myWebRTC_Event=apiCC.myWebRTC_Event,this.createRoom=function(Mt){var Ht=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};nt.info("RoomManager:createRoom with roomType : "+Mt);var Ot={type:"createRoom",roomType:Mt,nickname:St.nickname,photoURL:St.photoURL};Ht.convId&&(Ot.data||(Ot.data={}),Ot.data.cloudConvId=Ht.convId),Ht.webconf===!0&&(Ot.data||(Ot.data={}),Ot.data.webconf=!0);var Dt=JSON.stringify(Ot);nt.log("C->S: "+Dt),St.channel.socket.emit("createRoom",Dt)},this.roomCreation=function(Mt){nt.info("RoomManager:roomCreation"),this.myWebRTC_Event.createRoomCreationEvent(Mt.status,Mt.roomId,Mt.roomType),wt(Mt)},this.roomJoin=function(Mt){nt.info("RoomManager:roomJoin"),this.myWebRTC_Event.createRoomJoinedEvent(Mt.status,Mt.roomId,Mt.roomType),wt(Mt)},this.inviteInRoom=function(Mt,Ht,Ot,Dt){var Gt=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{};nt.info("RoomManager:inviteInRoom with roomType:",Ot);var nn={type:"inviteInRoom",roomId:Mt,contactId:Ht,roomType:Ot,nickname:St.nickname,photoURL:St.photoURL,context:Dt};Gt.convId&&(nn.data||(nn.data={}),nn.data.cloudConvId=Gt.convId),Gt.webconf===!0&&(nn.data||(nn.data={}),nn.data.webconf=!0);var zt=JSON.stringify(nn);nt.log("C->S: "+zt),St.channel.socket.emit("inviteInRoom",zt)},this.inviteInRoomStatus=function(Mt){nt.info("inviteInRoomStatus"),wt(Mt)},this.roomInvitation=function(Mt){nt.info("roomInvitation",Mt);var Ht={};Mt.data&&(Mt.data.cloudConvId&&(Ht.cloudConvId=Mt.data.cloudConvId),Mt.data.webconf===!0&&(Ht.webconf=!0)),this.myWebRTC_Event.createRoomInvitationEvent(Mt.roomId,Mt.senderId,Mt.senderNickname,Mt.senderPhotoURL,Mt.contactList,Mt.roomType,Ht),wt(Mt)},this.requestContactListInRoom=function(Mt){nt.info("requestContactListInRoom :"+Mt);var Ht={type:"requestContactListInRoom",roomId:Mt},Ot=JSON.stringify(Ht);St.channel.socket.emit("requestContactListInRoom",Ot)},this.onContactListInRoom=function(Mt){nt.info("onContactListInRoom :"+Mt),this.myWebRTC_Event.createContactListInRoomEvent(Mt.roomId,Mt.contactList,Mt.roomType),wt(Mt)},this.answerToRoomInvitation=function(Mt,Ht,Ot){if(nt.info("answerToRoomInvitation:",Mt,Ht),Ht===!0||Ht===!1){var Dt={type:"roomInvitationAnswer",roomId:Mt,senderId:St.apiCCId,nickname:St.nickname,photoURL:St.photoURL,accept:Ht,roomType:Ot},Gt=JSON.stringify(Dt);nt.log("C->S: "+Gt),St.channel.socket.emit("roomInvitationAnswer",Gt)}else nt.log("accept value is not correct")},this.roomMemberUpdate=function(Mt){nt.info("roomMemberUpdate"),this.myWebRTC_Event.createRoomMemberUpdateEvent(Mt.roomId,Mt.contactList,Mt.status,Mt.roomType),wt(Mt)},this.sendMessageToRoom=function(Mt,Ht,Ot){nt.info("Call sending message to Room .... from :"+St.apiCCId+" message :"+Ot);var Dt={type:"roomMessage",roomId:Mt,senderId:St.apiCCId,nickname:St.nickname,roomType:Ht,data:Ot},Gt=JSON.stringify(Dt);nt.log("C->S: "+Gt),St.channel.socket.emit("roomMessage",Gt)},this.receiveRoomMessage=function(Mt){nt.info("receiveRoomMessage"),this.myWebRTC_Event.createReceiveRoomMessageEvent(Mt.roomId,Mt.senderId,Mt.nickname,Mt.data,Mt.roomType),wt(Mt)},this.joinRoom=function(Mt,Ht){var Ot=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};nt.info("Join Room with Id:",Mt);var Dt={type:"joinRoom",roomId:Mt,nickname:St.nickname,photoURL:St.photoURL,roomType:Ht};Ot.convId&&(Dt.data||(Dt.data={}),Dt.data.cloudConvId=Ot.convId),Ot.webconf===!0&&(Dt.data||(Dt.data={}),Dt.data.webconf=!0);var Gt=JSON.stringify(Dt);nt.log("C->S: "+Gt),St.channel.socket.emit("joinRoom",Gt)},this.leaveRoom=function(Mt,Ht){nt.info("Leave Room with Id:",Mt);var Ot={type:"leaveRoom",roomId:Mt,nickname:St.nickname,photoURL:St.photoURL,roomType:Ht},Dt=JSON.stringify(Ot);nt.log("C->S: "+Dt),St.channel.socket.emit("leaveRoom",Dt)}},ht=(s(2023),s(1038),s(4916),s(9753),s(8765)),dt=s(5945);function ut(St,wt){(wt==null||wt>St.length)&&(wt=St.length);for(var Mt=0,Ht=new Array(wt);Mt"u"&&(lt.log("ApplicationUUID : "+window.location.hostname),Ot+="&applicationUUID="+window.location.hostname),Ot+="&apiLibType=apiRTC_JS",lt.log("requestOptions on connect :"+Ot),lt.log("session.ccsServer :"+St.ccsServer),wt="?channelId="+this.channelId+"&apiKey="+St.apiKey+"&apiVersion="+apiCC.version+"&apiCCSessionId="+St.apiCCSessionId+"&sessionId="+St.sessionId+Mt+Ht+Ot,zt=typeof apiRTC_React<"u"?"https":window.location.protocol==="http:"?"http":"https",dt.ag.name!=="iOS"&&dt.ag.name!=="Android"||(lt.log(dt.ag.name+" detected forcing protocol to https"),zt="https"),lt.info("CCS Connect, socket url is : "+zt+"://"+St.ccsServer+"/"+wt),this.ccsConnectionRetryNb=St.ccsConnectionRetryNb,this.ccsConnectionRetryDelay=St.ccsConnectionRetryDelay,this.socket=window.rtcio.connect(zt+"://"+St.ccsServer+"/"+wt,{forceNew:!0,multiplex:!1,withCredentials:!0,reconnectionAttempts:this.ccsConnectionRetryNb,reconnectionDelay:this.ccsConnectionRetryDelay}),this.socket.on("connect",this.callback(this,"onChannelOpened")).on("connect_error",this.callback(this,"onChannelConnectError")).on("message",this.callbackWithParams(this,"onChannelMessage")).on("disconnect",this.callback(this,"onChannelDisconnect")),this.socket.io.on("error",this.callback(this,"onChannelError")).on("reconnect",this.callback(this,"onChannelReconnect")).on("reconnect_attempt",this.callback(this,"onChannelReconnectAttempt")).on("reconnect_error",this.callback(this,"onChannelReconnectError")).on("reconnect_failed",this.callback(this,"onChannelReconnect_failed"))},this.onWhiteBoardDisconnection=function(){lt.info("onWhiteBoardDisconnection"),apiCC.session.closeWhiteBoardClient("NETWORK_DISCONNECTION")},this.onChannelDisconnect=function(wt){lt.info("onChannelDisconnect");var Mt=Date();lt.debug("date :"+Mt),apiCC.session.connectedUsersList.splice(0,apiCC.session.connectedUsersList.length),this.myWebRTC_Event.createChannelEvent("onChannelDisconnect",wt),this.channelHasBeenDisconnected=!0,apiCC.myApiCCWhiteBoardClient!==null&&(lt.log("apiCC.myApiCCWhiteBoardClient.roomId :"+apiCC.myApiCCWhiteBoardClient.roomId),apiCC.myApiCCWhiteBoardClient.roomId!==null?(lt.log("Disconnection with an ongoing whiteboard"),lt.error("Whiteboard disconnectionTimer is set to:",apiCC.myApiCCWhiteBoardClient.disconnectionTimer),apiCC.myApiCCWhiteBoardClient.whiteBoardDisconnectionTimeoutId=setTimeout(this.callback(this,"onWhiteBoardDisconnection"),apiCC.myApiCCWhiteBoardClient.disconnectionTimer)):lt.log("Disconnection without an ongoing whiteboard")),apiCC.session.JWTApzTokentimeOutId!==-1&&clearTimeout(apiCC.session.JWTApzTokentimeOutId)},this.onChannelReconnect_failed=function(){lt.info("onChannelReconnect_failed"),this.myWebRTC_Event.createChannelEvent("onChannelReconnect_failed")},this.onChannelReconnect=function(wt){lt.error("onChannelReconnect",wt);var Mt,Ht=null,Ot=0,Dt=[],Gt=null,nn=null,zt=null,Ft=!1,un=0,vn=null,yn=null;if(St.conversationSpace!==null&&St.conversationSpace!==void 0?(lt.debug("conversationSpace is set :",St.conversationSpace),St.joinConversationSpace(St.conversationSpace)):lt.debug("no conversationSpace defined"),St.userData!==void 0&&St.userData!==null&&(lt.debug("sending userData :",St.userData),St.setUserData(St.userData,!0)),St.presenceGroup!==null?(lt.debug("presenceGroup is set :",St.presenceGroup),St.sendPresenceGroupManagementCommand("join",St.presenceGroup)):lt.debug("no presenceGroup defined"),St.subscribeToPresenceGroup!==null?(lt.debug("subscribeToPresenceGroup is set :",St.subscribeToPresenceGroup),St.sendPresenceGroupManagementCommand("subscribe",St.subscribeToPresenceGroup)):lt.debug("no subscribeToPresenceGroup defined"),apiCC.session.apiCCIMClient!==null?apiCC.session.apiCCIMClient.userDataSetted===!0?(Ht={photoURL:apiCC.session.apiCCIMClient.photoURL},apiCC.session.apiCCIMClient.setUserData(Ht)):lt.log("apiCC.session.apiCCIMClient.userDataSetted !== true"):lt.log("apiCC.session.apiCCIMClient === null"),apiCC.session.apiCCWebRTCClient!==null){if(apiCC.session.apiCCWebRTCClient.webRTCClient.userMediaTable.length>0)for(Ft=!0,Mt=0;Mt0&&(Ft=!0),Ft===!0){lt.log("Sending reconnectContext to CCS"),nn={type:"reconnectContext",callList:Dt,whiteBoardRoomId:un},vn!==null&&vn.length>0&&(nn.pointerSharingRoomIds=vn);var fn=apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.sessionMCUs;if(fn.length>0){nn.updateSession=apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.createJoinSessionMessage(null),nn.updateSession.type="updateSession",nn.updateSessions=[];var Tn,_n=function(In,Rn){var On=typeof Symbol<"u"&&In[Symbol.iterator]||In["@@iterator"];if(!On){if(Array.isArray(In)||(On=function(on,Hn){if(on){if(typeof on=="string")return ut(on,Hn);var Bn=Object.prototype.toString.call(on).slice(8,-1);return Bn==="Object"&&on.constructor&&(Bn=on.constructor.name),Bn==="Map"||Bn==="Set"?Array.from(on):Bn==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Bn)?ut(on,Hn):void 0}}(In))||Rn&&In&&typeof In.length=="number"){On&&(In=On);var Ln=0,qn=function(){};return{s:qn,n:function(){return Ln>=In.length?{done:!0}:{done:!1,value:In[Ln++]}},e:function(on){throw on},f:qn}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var jn,Fn=!0,Zn=!1;return{s:function(){On=On.call(In)},n:function(){var on=On.next();return Fn=on.done,on},e:function(on){Zn=!0,jn=on},f:function(){try{Fn||On.return==null||On.return()}finally{if(Zn)throw jn}}}}(fn);try{for(_n.s();!(Tn=_n.n()).done;){var Un=Tn.value,Pn=apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.createJoinSessionMessage(null,{sessionMCU:Un});Pn.type="updateSession",nn.updateSessions.push(Pn)}}catch(In){_n.e(In)}finally{_n.f()}}zt=JSON.stringify(nn),lt.log("C->S: "+zt),apiCC.session.channel.socket.emit("reconnectContext",zt)}Dt.splice(0,Dt.length),this.myWebRTC_Event.createChannelEvent("onChannelReconnect",wt)},this.onChannelReconnecting=function(wt){lt.info("onChannelReconnecting",wt);var Mt=Date();lt.debug("date :"+Mt),this.myWebRTC_Event.createChannelEvent("onChannelReconnecting",wt)},this.onChannelOpened=function(){lt.info("Channel opened"),lt.log("this.channelId :"+this.channelId),this.channelReady=!0,this.channelHasBeenDisconnected===!1?St.onChannelOpened():(lt.log("onChannelOpened after a disconnection, no change on session"),this.channelHasBeenDisconnected=!1,St.ApiDBActivated!==!1&&St.ApiDBActivated!==void 0&&St.ApiDBActivated!==null&&(lt.log("apiDB initialisation"),apiDB.init(St.channel.socket))),this.updatePresenceGroupIsNeeded===!0&&(lt.log("Updating presence group"),St.leavePresenceGroup(this.oldPresenceGroup),St.joinPresenceGroup(this.newPresenceGroup)),this.updateSubscribeToPresenceGroupIsNeeded===!0&&(lt.log("Updating subscribe to presence group"),St.unsubscribePresenceGroup(this.oldSubscribeToPresenceGroup),St.subscribePresenceGroup(this.newSubscribeToPresenceGroup)),this.myWebRTC_Event.createChannelEvent("onChannelOpened")},this.onChannelMessage=function(wt,Mt){var Ht,Ot=null,Dt=null;try{Ot=JSON.parse(wt)}catch{return}(Ht=Ot.type==="checkCallStatus"||Ot.type==="apiRTCDataMessage"&&Ot.data&&["activeSpeaker","stopSpeaking"].indexOf(Ot.data.type)>=0)||lt.info("onChannelMessage S->C: "+wt),Ot.type==="IMMessage"&&(lt.log("IMMessage convId :"+Ot.IMId),Dt=Ot.IMId),Mt!==void 0&&(lt.trace("ack on message reception"),lt.trace("convId :"+Dt),Mt({reason:"ack",convId:Dt})),St.processSignalingMessage(Ot,{quiet:Ht})},this.onChannelConnectError=function(wt){lt.error("onChannelConnectError :",wt.message),this.myWebRTC_Event.createChannelEvent("onChannelConnectError",wt),this.checkIfConnectionAttemptNeedToBeStopped(wt)},this.onChannelReconnectError=function(wt){lt.log("onChannelReconnectError :",wt.message),this.myWebRTC_Event.createChannelEvent("onChannelReconnectError",wt),this.checkIfConnectionAttemptNeedToBeStopped(wt)},this.onChannelReconnectAttempt=function(wt){lt.log("onChannelReconnectAttempt :",wt),this.myWebRTC_Event.createChannelEvent("onChannelReconnectAttempt",wt),this.onChannelReconnecting(wt)},this.onChannelError=function(wt){lt.error("Channel error :",wt.message),this.checkIfConnectionAttemptNeedToBeStopped(wt),this.myWebRTC_Event.createChannelEvent("onChannelError",wt)},this.checkIfConnectionAttemptNeedToBeStopped=function(wt){lt.debug("checkIfConnectionAttemptNeedToBeStopped"),(wt.message==="not authorized"||wt.message.includes("access token failure:")||wt.message.includes("DISABLED_ENTERPRISE")||wt.message.includes("An account is needed")||wt.message.includes("ApiRTC update is needed")||wt.message.includes("applicationUUID is not authorized"))&&(lt.error("Stopping connection attempts"),this.socket.disconnect())},this.callback=function(wt,Mt){return this.closureHandler=function(Ht){return wt[Mt](Ht)},this.closureHandler},this.callbackWithParams=function(wt,Mt){return this.closureHandler=function(Ht,Ot,Dt){return wt[Mt](Ht,Ot,Dt)},this.closureHandler}},ot=s(4708),pt=s(940);function ft(St){return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(wt){return typeof wt}:function(wt){return wt&&typeof Symbol=="function"&&wt.constructor===Symbol&&wt!==Symbol.prototype?"symbol":typeof wt},ft(St)}function yt(){yt=function(){return St};var St={},wt=Object.prototype,Mt=wt.hasOwnProperty,Ht=typeof Symbol=="function"?Symbol:{},Ot=Ht.iterator||"@@iterator",Dt=Ht.asyncIterator||"@@asyncIterator",Gt=Ht.toStringTag||"@@toStringTag";function nn(jn,Fn,Zn){return Object.defineProperty(jn,Fn,{value:Zn,enumerable:!0,configurable:!0,writable:!0}),jn[Fn]}try{nn({},"")}catch{nn=function(Fn,Zn,on){return Fn[Zn]=on}}function zt(jn,Fn,Zn,on){var Hn=Fn&&Fn.prototype instanceof vn?Fn:vn,Bn=Object.create(Hn.prototype),zn=new On(on||[]);return Bn._invoke=function($n,Jn,Kn){var An="suspendedStart";return function(Wn,Cn){if(An==="executing")throw new Error("Generator is already running");if(An==="completed"){if(Wn==="throw")throw Cn;return{value:void 0,done:!0}}for(Kn.method=Wn,Kn.arg=Cn;;){var Nn=Kn.delegate;if(Nn){var qt=Pn(Nn,Kn);if(qt){if(qt===un)continue;return qt}}if(Kn.method==="next")Kn.sent=Kn._sent=Kn.arg;else if(Kn.method==="throw"){if(An==="suspendedStart")throw An="completed",Kn.arg;Kn.dispatchException(Kn.arg)}else Kn.method==="return"&&Kn.abrupt("return",Kn.arg);An="executing";var kt=Ft($n,Jn,Kn);if(kt.type==="normal"){if(An=Kn.done?"completed":"suspendedYield",kt.arg===un)continue;return{value:kt.arg,done:Kn.done}}kt.type==="throw"&&(An="completed",Kn.method="throw",Kn.arg=kt.arg)}}}(jn,Zn,zn),Bn}function Ft(jn,Fn,Zn){try{return{type:"normal",arg:jn.call(Fn,Zn)}}catch(on){return{type:"throw",arg:on}}}St.wrap=zt;var un={};function vn(){}function yn(){}function cn(){}var gn={};nn(gn,Ot,function(){return this});var bn=Object.getPrototypeOf,fn=bn&&bn(bn(Ln([])));fn&&fn!==wt&&Mt.call(fn,Ot)&&(gn=fn);var Tn=cn.prototype=vn.prototype=Object.create(gn);function _n(jn){["next","throw","return"].forEach(function(Fn){nn(jn,Fn,function(Zn){return this._invoke(Fn,Zn)})})}function Un(jn,Fn){function Zn(Hn,Bn,zn,$n){var Jn=Ft(jn[Hn],jn,Bn);if(Jn.type!=="throw"){var Kn=Jn.arg,An=Kn.value;return An&&ft(An)=="object"&&Mt.call(An,"__await")?Fn.resolve(An.__await).then(function(Wn){Zn("next",Wn,zn,$n)},function(Wn){Zn("throw",Wn,zn,$n)}):Fn.resolve(An).then(function(Wn){Kn.value=Wn,zn(Kn)},function(Wn){return Zn("throw",Wn,zn,$n)})}$n(Jn.arg)}var on;this._invoke=function(Hn,Bn){function zn(){return new Fn(function($n,Jn){Zn(Hn,Bn,$n,Jn)})}return on=on?on.then(zn,zn):zn()}}function Pn(jn,Fn){var Zn=jn.iterator[Fn.method];if(Zn===void 0){if(Fn.delegate=null,Fn.method==="throw"){if(jn.iterator.return&&(Fn.method="return",Fn.arg=void 0,Pn(jn,Fn),Fn.method==="throw"))return un;Fn.method="throw",Fn.arg=new TypeError("The iterator does not provide a 'throw' method")}return un}var on=Ft(Zn,jn.iterator,Fn.arg);if(on.type==="throw")return Fn.method="throw",Fn.arg=on.arg,Fn.delegate=null,un;var Hn=on.arg;return Hn?Hn.done?(Fn[jn.resultName]=Hn.value,Fn.next=jn.nextLoc,Fn.method!=="return"&&(Fn.method="next",Fn.arg=void 0),Fn.delegate=null,un):Hn:(Fn.method="throw",Fn.arg=new TypeError("iterator result is not an object"),Fn.delegate=null,un)}function In(jn){var Fn={tryLoc:jn[0]};1 in jn&&(Fn.catchLoc=jn[1]),2 in jn&&(Fn.finallyLoc=jn[2],Fn.afterLoc=jn[3]),this.tryEntries.push(Fn)}function Rn(jn){var Fn=jn.completion||{};Fn.type="normal",delete Fn.arg,jn.completion=Fn}function On(jn){this.tryEntries=[{tryLoc:"root"}],jn.forEach(In,this),this.reset(!0)}function Ln(jn){if(jn){var Fn=jn[Ot];if(Fn)return Fn.call(jn);if(typeof jn.next=="function")return jn;if(!isNaN(jn.length)){var Zn=-1,on=function Hn(){for(;++Zn=0;--on){var Hn=this.tryEntries[on],Bn=Hn.completion;if(Hn.tryLoc==="root")return Zn("end");if(Hn.tryLoc<=this.prev){var zn=Mt.call(Hn,"catchLoc"),$n=Mt.call(Hn,"finallyLoc");if(zn&&$n){if(this.prev=0;--Zn){var on=this.tryEntries[Zn];if(on.tryLoc<=this.prev&&Mt.call(on,"finallyLoc")&&this.prev=0;--Fn){var Zn=this.tryEntries[Fn];if(Zn.finallyLoc===jn)return this.complete(Zn.completion,Zn.afterLoc),Rn(Zn),un}},catch:function(jn){for(var Fn=this.tryEntries.length-1;Fn>=0;--Fn){var Zn=this.tryEntries[Fn];if(Zn.tryLoc===jn){var on=Zn.completion;if(on.type==="throw"){var Hn=on.arg;Rn(Zn)}return Hn}}throw new Error("illegal catch attempt")},delegateYield:function(jn,Fn,Zn){return this.delegate={iterator:Ln(jn),resultName:Fn,nextLoc:Zn},this.method==="next"&&(this.arg=void 0),un}},St}function vt(St,wt,Mt,Ht,Ot,Dt,Gt){try{var nn=St[Dt](Gt),zt=nn.value}catch(Ft){return void Mt(Ft)}nn.done?wt(zt):Promise.resolve(zt).then(Ht,Ot)}var bt=et.Y.get("ApiCCSession"),At=apiCC.myWebRTC_Event,Nt=function(St){var wt=this;this.apiCCId=null,this.apiCCSessionId=apiCC.randomString(22),this.apiKey=null,this.nickname=null,this.photoURL=null,this.apiCCWebRTCClient=null,this.apiCCIMClient=null,this.apiCCDataClient=null,this.apiCCIDSessionStorage=null,this.apiKeySessionStorage=null,this.apiCCIdPersistenceTimeout=5e3,this.channel=null,this.recordActivated=St.recordActivated,this.sessionId=null,this.apiCCPointerSharingClient=null,this.apiCCWhiteBoardClient=null,this.ccsServer=St.ccsServer,this.userData=St.userData,this.apiDBActivated=!0,St.ApiDBActivated=!0,this.webRTCPluginActivated=St.webRTCPluginActivated,this.token=St.token,this.JWTApzToken=null,this.JWTApzTokenRefreshTimer=396e5,this.JWTApzTokentimeOutId=-1,this.conversationSpace=St.conversationSpace,this.tryAudioCallAfterUserMediaError=St.tryAudioCallAfterUserMediaError,this.deactivateReloadOnCancel=St.deactivateReloadOnCancel,this.connectedUsersList=[],this.messageTimeOutTable=[],this.ccsConnectionRetryNb=St.ccsConnectionRetryNb,this.ccsConnectionRetryDelay=St.ccsConnectionRetryDelay,this.sequentialMessagesStorage={},this.cloudIsSecured=St.cloudIsSecured,St.messageTimeOutTimer!==void 0?this.messageTimeOutTimer=St.messageTimeOutTimer:this.messageTimeOutTimer=1e4,bt.log("messageTimeOutTimer set to : "+this.messageTimeOutTimer),St.presenceGroup!==void 0?this.presenceGroup=St.presenceGroup:this.presenceGroup=["default"],St.subscribeToPresenceGroup!==void 0?this.subscribeToPresenceGroup=St.subscribeToPresenceGroup:this.subscribeToPresenceGroup=["default"],this.presenceGroupAddedByApiRTC=[],this.subscribeToPresenceGroupAddedByApiRTC=[],this.remoteAccessInvitation=null,this.isDeviceWebRTCCompliant=function(){return apiCC.isWebRTCCompliant()},this.isDeviceDTLSCompliant=function(){var Ot=dt.E2.getBrowser(),Dt=parseInt(Ot.version,10);return!(Ot.name==="Chrome"&&Dt<44&&(bt.log("isDeviceDTLSCompliant FALSE : Chrome V < 44"),1))},this.userData===void 0||this.userData===null?(this.userData={},this.userData.webRtcCompliant=apiCC.webRTCCompliant,this.userData.dtlsCompliant=this.isDeviceDTLSCompliant()):this.userData.webRtcCompliant===void 0||this.userData.webRtcCompliant===null?(this.userData.webRtcCompliant=apiCC.webRTCCompliant,this.userData.dtlsCompliant=this.isDeviceDTLSCompliant()):bt.log("userData webRtcCompliant set to :",this.userData.webRtcCompliant),this.userData.osName=dt.BF,this.userData.browser=dt.Xh,this.userData.deviceType=dt.vO,this.userData.deviceVendor=dt.Cm,this.userData.browser_version=dt.dc,this.userData.browser_major_version=dt.PR,this.userData.apiRTCVersion=apiCC.version,this.userData.cpuArchitecture=dt.Ne,this.userData.engineName=dt.AA,this.userData.engineVersion=dt.TI,apiRTC.userAgentInstance!==void 0&&(this.userData.remoteAccessUserSupport=apiRTC.userAgentInstance.getCapabilities().remoteAccessUser),dt.BF==="Android"&&typeof cordova<"u"&&(this.userData.platform="Android"),typeof apiRTC_React<"u"&&(this.userData.react=!0);var Mt=function(){var Ot,Dt=(Ot=yt().mark(function Gt(){var nn,zt;return yt().wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:return Ft.next=2,(0,dt.Ak)();case 2:return nn=Ft.sent,wt.userData.deviceModel=nn,Ft.next=6,(0,dt.RX)();case 6:zt=Ft.sent,wt.userData.osVersion=zt,apiCC.osVersion=zt,wt.startApiCCSession(St);case 10:case"end":return Ft.stop()}},Gt)}),function(){var Gt=this,nn=arguments;return new Promise(function(zt,Ft){var un=Ot.apply(Gt,nn);function vn(cn){vt(un,zt,Ft,vn,yn,"next",cn)}function yn(cn){vt(un,zt,Ft,vn,yn,"throw",cn)}vn(void 0)})});return function(){return Dt.apply(this,arguments)}}();function Ht(Ot){return Ot instanceof Array?(bt.log("data instanceof Array"),!0):(bt.log("data not instanceof Array"),!1)}Mt(),this.roomManagerEventHandler=function(Ot){if(bt.debug("roomManagerEventHandler, roomId :"+Ot.roomId+", type :"+Ot.type+", roomType :"+Ot.roomType),Ot.roomType==="whiteBoard"){if(apiCC.myApiCCWhiteBoardClient===null||apiCC.myApiCCWhiteBoardClient===void 0)return void bt.log("No whiteBoard created, leaving msg processing");Ot.type==="roomCreation"&&(bt.log("whiteBoard : roomCreation"),apiCC.myApiCCWhiteBoardClient.roomId=Ot.roomId,apiCC.myApiCCWhiteBoardClient.paperSheetId++,apiCC.myApiCCWhiteBoardClient.drawingId=0,apiCC.myApiCCWhiteBoardClient.sendDataToRoom({tool:"void",needCatchUp:"*||-1"})),Ot.type==="roomInvitation"&&(bt.log("whiteBoard : roomInvitation"),apiCC.myApiCCWhiteBoardClient.roomId=Ot.roomId),Ot.type==="roomMessage"&&apiCC.myApiCCWhiteBoardClient.messageProcessing(Ot.data),Ot.type==="roomJoin"&&(bt.log("whiteBoard : roomJoin"),apiCC.myApiCCWhiteBoardClient.roomJoined=!0,apiCC.myApiCCWhiteBoardClient.roomId=Ot.roomId)}else Ot.roomType==="pointerSharing"?apiCC.session.apiCCPointerSharingClient&&Ot.type==="roomJoin"&&apiCC.session.apiCCPointerSharingClient.processMessageRoomJoin(Ot):Ot.roomType==="coBrowsing"?Ot.type==="roomMessage"&&bt.log("coBrowsing : roomMessage :"+Ot):bt.log("roomManagerEventHandler for msg.roomType :"+Ot.roomType)},this.callback=function(Ot,Dt){return this.closureHandler=function(Gt){return Ot[Dt](Gt)},this.closureHandler},this.getSessionStorage=function(Ot){var Dt=sessionStorage.getItem(Ot);if(Dt===null)return null;try{var Gt=JSON.parse(Dt),nn=new Date(Gt.expiresAt);return new Date>=nn?(sessionStorage.removeItem(Ot),null):Gt.value}catch{bt.error("Something went wrong when parsing JSON from session storage values")}},this.generateApiCCID=function(){bt.debug("apiCCId is not defined by user, checking if apiCCId exist in sessionStorage"),typeof apiRTC_React>"u"&&(this.apiCCIDSessionStorage=this.getSessionStorage("apiCCId"),this.apiKeySessionStorage=this.getSessionStorage("apiKey")),this.apiCCIDSessionStorage!==null?(bt.log("apiCCId exist in sessionStorage : "+this.apiCCIDSessionStorage),this.apiKeySessionStorage!==null?(bt.log("apiKey exist in sessionStorage : "+this.apiKeySessionStorage),this.apiKeySessionStorage===this.apiKey?(bt.log("apiKey is the same, keeping apiCCId"),this.apiCCId=this.apiCCIDSessionStorage):(bt.log("apiKey is not the same, generating an apiCCId"),this.apiCCId=Math.floor(1000001*Math.random()).toString(),bt.log("Creation of new ApiRTC session with Id : "+this.apiCCId))):this.apiCCId=this.apiCCIDSessionStorage):(bt.log(" No apiCCId found on sessionStorage : generating an apiCCId"),this.apiCCId=String(1e5+Math.floor(9e5*Math.random())),bt.log("Creation of new ApiRTC session with Id : "+this.apiCCId))},this.getNumericIdFromAlpha=function(Ot){bt.log("getNumericIdFromAlpha new : "+Ot);var Dt,Gt=0;if(Ot.length===0)return Gt;for(Dt=0;Dt>>0)),Gt>>>0},this.startApiCCSession=function(Ot){if(bt.debug("startApiCCSession"),this.roomMgr=new at(this,this.callback(this,"roomManagerEventHandler")),Ot.xhrPolling===!0?this.xhrPolling=!0:this.xhrPolling=!1,Ot.appId!==void 0&&(this.appId=Ot.appId),Ot.siteId!==void 0&&(this.siteId=Ot.siteId),Ot.apiKey===void 0)return bt.error('Error : Initialisation parameters: "apikey" for session creation is not defined'),null;if(bt.log("Session creation with apiKey : "+Ot.apiKey),bt.log("Session creation with apiCCId : "+Ot.apiCCId),this.apiKey=Ot.apiKey,Ot.onReady===void 0&&typeof apiRTC_React>"u")return bt.error('Error : Initialisation parameters: "onReady" for session creation is not defined'),null;if(apiCC.addEventListener("sessionReady",Ot.onReady),typeof apiRTC_React>"u"&&(this.sessionId=this.getSessionStorage("sessionId")),Ot.apiCCId===void 0||Ot.apiCCId===""||Ot.apiCCId===null)this.generateApiCCID();else if(bt.log("Session creation with apiCCId defined by user : "+Ot.apiCCId),bt.debug("params.idConversionActivated : "+Ot.idConversionActivated),Ot.idConversionActivated===void 0||Ot.idConversionActivated===!0)if((0,ot._C)(Ot.apiCCId))this.apiCCId=Ot.apiCCId.toString();else{bt.log("Converting this Id in a numeric one");var Dt=this.getNumericIdFromAlpha(Ot.apiCCId);Dt+="",bt.log("Numeric Id is : "+Dt),(0,ot._C)(Dt)?(bt.warn("Id has been converted to a numeric one"),this.apiCCId=Dt.toString()):(bt.warn("Error : Defined apiCCId :"+Ot.apiCCId+" is not numeric. ApiCCID is generated"),this.generateApiCCID())}else bt.log("String id convertion is deactivated"),this.apiCCId=Ot.apiCCId.toString();Ot.apiCCIdPersistenceTimeout!==null&&typeof Ot.apiCCIdPersistenceTimeout=="number"&&Ot.apiCCIdPersistenceTimeout>=0&&(this.apiCCIdPersistenceTimeout=Ot.apiCCIdPersistenceTimeout),this.channel!==null&&(bt.log("this.channel is defined"),delete this.channel),this.channel=new mt(this),this.channel.initialize(),Ot.nickname!==null&&Ot.nickname!==void 0?(bt.log("Nickname is defined :"+Ot.nickname),this.nickname=Ot.nickname):(bt.log("Nickname is not defined, setting to apiCCId value :"+this.apiCCId),this.nickname=this.apiCCId),Ot.photoURL!==null&&Ot.photoURL!==void 0?(bt.log("photoURL is defined :"+Ot.photoURL),this.photoURL=Ot.photoURL):(bt.log("photoURL is not defined"),this.photoURL=null)},this.reOpenChannel=function(Ot,Dt){bt.info("reOpenChannel"),this.apiCCId=Ot.toString(),this.apiKey=Dt,this.channel.socket!==void 0&&this.channel.socket!==null&&this.channel.socket.disconnect(),this.channel.channelReady=!1,this.channel.socket=null,this.channel.channelId=this.apiCCId,this.channel.initialize(),this.apiCCWebRTCClient!==null&&this.apiCCWebRTCClient.webRTCClient!==null&&(this.apiCCWebRTCClient.webRTCClient.socket=this.channel.socket)},this.onChannelOpened=function(){bt.debug("ApiCCSession onChannelOpened"),St.ApiDBActivated!==!1&&St.ApiDBActivated!==void 0&&St.ApiDBActivated!==null&&(bt.log("apiDB initialisation"),apiDB.init(this.channel.socket)),At.createSessionReadyEvent(apiCC.session.apiCCId)},this.createWebRTCClient=function(Ot){bt.debug("createWebRTCClient");var Dt={};this.apiCCWebRTCClient=new apiCC.ApiCCWebRTCClient(this),apiCC.session.apiCCWebRTCClient.webRTCClient.setGumConfigWithDevicePresent(),Dt.audioDevicePresent=apiCC.mediaDeviceMgr.audioDevicePresent,Dt.videoDevicePresent=apiCC.mediaDeviceMgr.videoDevicePresent,apiCC.session.setUserData(Dt),setTimeout(function(){At.createWebRTCClientCreatedEvent()});var Gt=apiCC.getUserMediaStreamIds(),nn=Gt.length;for(bt.debug("listing accessToLocalMedia "+nn);--nn>=0;)if(apiCC.getUserMediaStream(Gt[nn]).accessToLocalMedia()){bt.debug("setting accessToLocalMedia to true"),this.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0;break}return this.apiCCWebRTCClient},this.createPointerSharingClient=function(){return this.apiCCPointerSharingClient===null&&(this.apiCCPointerSharingClient=new apiCC.ApiCCPointerSharingClient(this)),this.apiCCPointerSharingClient},this.closePointerSharingClient=function(){this.apiCCPointerSharingClient!==null&&this.apiCCPointerSharingClient instanceof apiCC.ApiCCPointerSharingClient&&(this.apiCCPointerSharingClient.stop(),this.apiCCPointerSharingClient=null)},this.createWhiteBoard=function(Ot,Dt,Gt,nn){return bt.info("createWhiteBoard"),this.apiCCWhiteBoardClient=apiCC.createWhiteBoard(Ot,Dt,Gt,nn),this.apiCCWhiteBoardClient},this.closeWhiteBoardClient=function(Ot){bt.info("closeWhiteBoardClient"),apiCC.closeWhiteBoardClient(Ot)},this.createIMClient=function(Ot){return bt.debug("createIMClient"),this.apiCCIMClient=new apiCC.ApiCCIMClient(this,Ot),this.apiCCIMClient},this.createDataClient=function(){return bt.info("createDataClient"),this.apiCCDataClient=new apiCC.ApiCCDataClient(this),this.apiCCDataClient},this.updatingQuery=function(Ot){bt.debug("updatingQuery");var Dt=null,Gt=null,nn=null;return Dt=(0,ot.dD)(Ot),this.userData!==void 0?(Gt=JSON.stringify(this.userData),nn=encodeURIComponent(Gt),Dt.userData=nn,(0,ot.Wc)(Dt)):Ot},this.setUserData=function(Ot,Dt){bt.debug("setUserData in session :",Ot);var Gt,nn,zt,Ft=[],un=this.userData;if(this.userData!==void 0){if(this.userData=(0,ot.S6)(this.userData,Ot),bt.debug("this.userData :",this.userData),bt.debug("actualUserData :",un),bt.debug("forceSendData :",Dt),Dt!==!0&&JSON.stringify(this.userData)===JSON.stringify(un))return void bt.debug("userData is not changed, leaving userData processing")}else this.userData=Ot;for(Gt={type:"setUserData",userData:Ot},nn=JSON.stringify(Gt),bt.log("C->S: "+nn),this.channel.socket.emit("setUserData",nn),bt.log("socket.io 1.X : socket.io.opts.query :"+this.channel.socket.io.opts.query),this.channel.socket.io.opts.query=this.updatingQuery(this.channel.socket.io.opts.query),bt.log("socket.io 1.X : after update : socket.io.opts.query :"+this.channel.socket.io.opts.query),zt=0;ztS: "+nn),this.channel.socket.emit("presenceGroupManagement",nn)):bt.debug("leaving sendPresenceGroupManagementCommand for group deactivated")}else bt.error("group parameter value is not correct, need to be a JSON array")},this.sendConversationSpaceCommand=function(Ot,Dt){var Gt,nn;bt.debug("sendConversationSpaceCommand :"+Ot+" for conversationSpace : "+Dt),Gt={type:"conversationSpaceManagement",command:Ot,conversationSpace:Dt},nn=JSON.stringify(Gt),bt.log("C->S: "+nn),this.channel.socket.emit("conversationSpaceManagement",nn)},this.joinPresenceGroup=function(Ot,Dt){var Gt=this;Dt||((Dt={}).doneByApiRTC=!1),bt.debug("joinPresenceGroup :"+Ot),Ht(Ot)===!0?(this.sendPresenceGroupManagementCommand("join",Ot),Ot.forEach(function(nn){var zt=Gt.presenceGroupAddedByApiRTC.indexOf(nn);Gt.presenceGroup.indexOf(nn)===-1&&(Gt.presenceGroup.push(nn),Dt.doneByApiRTC&&zt===-1&&Gt.presenceGroupAddedByApiRTC.push(nn)),Dt.doneByApiRTC===!1&&zt!==-1&&Gt.presenceGroupAddedByApiRTC.splice(zt,1)})):bt.log("group parameter value is not correct, need to be a JSON array"),bt.debug("this.presenceGroup :"+this.presenceGroup)},this.leavePresenceGroup=function(Ot,Dt){var Gt=this;Dt||((Dt={}).doneByApiRTC=!1),bt.debug("leavePresenceGroup :"+Ot),Ht(Ot)===!0?Ot.forEach(function(nn){var zt=Gt.presenceGroupAddedByApiRTC.indexOf(nn);if(Dt.doneByApiRTC===!1||Dt.doneByApiRTC===!0&&zt!==-1){var Ft=Gt.presenceGroup.indexOf(nn);Ft!==-1&&Gt.presenceGroup.splice(Ft,1),Gt.sendPresenceGroupManagementCommand("leave",[nn])}zt!==-1&&Gt.presenceGroupAddedByApiRTC.splice(zt,1)}):bt.log("group parameter value is not correct, need to be a JSON array"),bt.debug("this.presenceGroup :"+this.presenceGroup)},this.subscribePresenceGroup=function(Ot,Dt){var Gt=this;Dt||((Dt={}).doneByApiRTC=!1),bt.debug("subscribePresenceGroup :"+Ot),Ht(Ot)===!0?(this.sendPresenceGroupManagementCommand("subscribe",Ot),Ot.forEach(function(nn){var zt=Gt.subscribeToPresenceGroupAddedByApiRTC.indexOf(nn);Gt.subscribeToPresenceGroup.indexOf(nn)===-1&&(Gt.subscribeToPresenceGroup.push(nn),Dt.doneByApiRTC&&Gt.subscribeToPresenceGroupAddedByApiRTC.indexOf(nn)===-1&&Gt.subscribeToPresenceGroupAddedByApiRTC.push(nn)),Dt.doneByApiRTC===!1&&zt!==-1&&Gt.subscribeToPresenceGroupAddedByApiRTC.splice(zt,1)})):bt.log("group parameter value is not correct, need to be a JSON array"),bt.debug("this.subscribeToPresenceGroup :"+this.subscribeToPresenceGroup)},this.unsubscribePresenceGroup=function(Ot,Dt){var Gt=this;Dt||((Dt={}).doneByApiRTC=!1),bt.debug("unsubscribePresenceGroup :"+Ot),Ht(Ot)===!0?Ot.forEach(function(nn){var zt=Gt.subscribeToPresenceGroupAddedByApiRTC.indexOf(nn);if(Dt.doneByApiRTC===!1||Dt.doneByApiRTC===!0&&zt!==-1){var Ft=Gt.subscribeToPresenceGroup.indexOf(nn);Ft!==-1&&Gt.subscribeToPresenceGroup.splice(Ft,1),Gt.sendPresenceGroupManagementCommand("unsubscribe",[nn])}zt!==-1&&Gt.subscribeToPresenceGroupAddedByApiRTC.splice(zt,1)}):bt.log("group parameter value is not correct, need to be a JSON array"),bt.debug("this.subscribeToPresenceGroup :"+this.subscribeToPresenceGroup)},this.joinConversationSpace=function(Ot){bt.info("joinConversationSpace :"+Ot),this.sendConversationSpaceCommand("join",Ot),this.conversationSpace=Ot},this.leaveConversationSpace=function(Ot){bt.info("leaveConversationSpace :"+Ot),Ot!=null&&this.conversationSpace===Ot?(this.sendConversationSpaceCommand("leave",Ot),this.conversationSpace=null):bt.debug("socket is not in the conversationSpace, we request to leave")},this.subscribeToCloudEvent=function(Ot,Dt){this.sendCloudEventsCommand("subscribe",Ot,Dt)},this.unsubscribeToCloudEvent=function(Ot,Dt){this.sendCloudEventsCommand("unsubscribe",Ot,Dt)},this.sendCloudEventsCommand=function(Ot,Dt,Gt){if(["subscribe","unsubscribe"].includes(Ot))if(Dt&&typeof Dt=="string"){if(Gt){if(ft(Gt)!=="object")return void bt.error("wrong headers format");for(var nn=0,zt=Object.values(Gt);nnS:",vn),this.channel.socket.emit("cloudEvents",vn)}else bt.error("wrong topic format");else bt.error("wrong command")},this.getConversationList=function(Ot){bt.info("getConversationList request");var Dt,Gt;Gt=Ot!==void 0?{type:"getConversationList",lastConversationNb:Ot}:{type:"getConversationList",lastConversationNb:50},Dt=JSON.stringify(Gt),bt.log("C->S: "+Dt),this.channel.socket.emit("getConversationList",Dt)},this.receiveConversationListAnswer=function(Ot){bt.info("receiveConversationListAnswer"),bt.log("msg.convList.length :"+Ot.convList.length);var Dt,Gt=Ot.convList.length,nn=[],zt=null;for(Dt=0;DtS: "+Dt),this.channel.socket.emit("getContactOccurrencesFromConversationList",Dt)},this.receiveContactOccurrencesFromConversationListAnswer=function(Ot){bt.info("receiveContactOccurrencesFromConversationListAnswer"),bt.log("msg.contactOccurrencesTable.length :"+Ot.contactOccurrencesTable.length),At.createReceiveContactOccurrencesFromConversationListAnswerEvent(Ot.contactOccurrencesTable)},this.getConversationDetailReport=function(Ot){var Dt,Gt;bt.info("getConversationDetailReport for convId :"+Ot),Dt={type:"getConversationDetailReport",convId:Ot},Gt=JSON.stringify(Dt),bt.log("C->S: "+Gt),this.channel.socket.emit("getConversationDetailReport",Gt)},this.receiveConversationDetailReportAnswer=function(Ot){bt.info("receiveConversationDetailReportAnswer"),bt.log("msg.CDR :"+Ot.CDR),At.createReceiveConversationDetailReportAnswerEvent(Ot.CDR)},this.manageConnectedUsersList=function(Ot,Dt,Gt,nn){bt.debug("manageConnectedUsersList");var zt,Ft,un,vn=!1,yn=0,cn=!1,gn="unset";for(bt.trace("manageConnectedUsersList.length :"+Ot.length),bt.trace("this.connectedUsersList.length :"+this.connectedUsersList.length),bt.log("state :"+Dt),bt.log("group :"+Gt),un=0;un1&&arguments[1]!==void 0?arguments[1]:{},Gt=null,nn=null,zt=!1,Ft=null,un=null,vn=!1,yn=null;if(Ot.type==="invite")this.apiCCWebRTCClient?(bt.log("this.webRTCPluginActivated =",this.webRTCPluginActivated),(dt.Xh==="IE"||dt.Xh==="Safari"&&dt.PR<11)&&this.webRTCPluginActivated===!0?(bt.log("managing call with WebRTC Plugin"),apiCC.manageWebRTCPlugin(function(){bt.log("manageWebRTCPlugin cb on Invite"),apiCC.session.apiCCWebRTCClient.webRTCClient.processInvite(Ot)},function(){bt.log("actionOnInstallationNeeded"),bt.log("sending bye to be done"),new pt.S(apiCC.session.channel.socket).sendBye(Ot.callId,Ot.calleeId,Ot.roomId,Ot.callerId,"WebRTC_Plugin_Installation_needed",Ot.data)})):(bt.log("managing call with browser"),this.apiCCWebRTCClient.webRTCClient.processInvite(Ot))):bt.warn("WebRTCClient is not created");else if(Ot.type==="200OK")this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.process200OK(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="candidate")this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.processCandidate(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="bye")this.apiCCWebRTCClient?(bt.log("bye message from:"+Ot.clientId+" for callId : "+Ot.callId),this.apiCCWebRTCClient.webRTCClient.onRemoteHangup(Ot.callId,Ot.clientId,Ot.roomId,Ot.reason,Ot.confId,Ot.data)):bt.warn("WebRTCClient is not created");else if(Ot.type==="update")this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.processUpdate(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="200update")this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.process200Update(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="newConversationCreated")this.apiCCIMClient?this.apiCCIMClient.newConversationCreated(Ot):bt.warn("IMClient is not created");else if(Ot.type==="IMMessage")this.apiCCIMClient?this.apiCCIMClient.receiveMessage(Ot):bt.warn("IMClient is not created");else if(Ot.type==="groupChatCreation")this.apiCCIMClient?this.apiCCIMClient.groupChatCreation(Ot):bt.warn("IMClient is not created");else if(Ot.type==="groupChatInvitation")this.apiCCIMClient?this.apiCCIMClient.groupChatInvitation(Ot):bt.warn("IMClient is not created");else if(Ot.type==="groupChatMemberUpdate")this.apiCCIMClient?this.apiCCIMClient.groupChatMemberUpdate(Ot):bt.warn("IMClient is not created");else if(Ot.type==="addUserInGroupChatAnswer")this.apiCCIMClient?this.apiCCIMClient.addUserInGroupChatAnswer(Ot):bt.warn("IMClient is not created");else if(Ot.type==="groupChatMessage")this.apiCCIMClient?this.apiCCIMClient.receiveGroupChatMessage(Ot):bt.warn("IMClient is not created");else if(Ot.type==="conversationHistoryAnswer")this.apiCCIMClient?this.apiCCIMClient.receiveConversationHistory(Ot):bt.warn("IMClient is not created");else if(Ot.type==="getUserDataAnswer")this.apiCCIMClient?this.apiCCIMClient.receiveUserDataAnswer(Ot):bt.warn("IMClient is not created");else if(Ot.type==="fetchUserDataAnswer")this.apiCCIMClient?this.apiCCIMClient.receiveFetchUserDataAnswer(Ot):bt.warn("IMClient is not created");else if(Ot.type==="dataMessage")this.apiCCDataClient?this.apiCCDataClient.receiveData(Ot):bt.warn("DataClient is not created");else if(Ot.type==="dataAck")this.apiCCWebRTCClient.webRTCClient.processDataAck(Ot);else if(Ot.type==="dataEndAck")this.apiCCWebRTCClient.webRTCClient.processDataEndAck(Ot);else if(Ot.type==="updateVideoQuality")this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processUpdateVideoQuality(Ot.callId,Ot.profile);else if(Ot.type==="apiRTCDataMessage")if(Dt.quiet||bt.debug("apiRTCDataMessage:",Ot),(0,ot.Ym)(Ot.data,"object"))if(Ot.data.type==="joinSessionAnswer")if(this.apiCCWebRTCClient){var cn={roomName:Ot.data.roomId};(0,ot.ki)(Ot.data,"convId","string")&&(cn.convId=Ot.data.convId),(0,ot.ki)(Ot.data,["data","mode"],"string")&&(cn.data={mode:Ot.data.data.mode}),(0,ot.ki)(Ot.data,["data","transition"],"string")&&Ot.data.data.transition==="mesh2janus"?this.apiCCWebRTCClient.webRTCClient.MCUClient.changeSessionMode(cn,"mesh2janus"):this.apiCCWebRTCClient.webRTCClient.MCUClient.updateSessionAnswer(cn,{createSession:!0})}else bt.warn("WebRTCClient is not created");else if(Ot.data.type==="slowLink"){if(this.apiCCWebRTCClient){var gn={};Ot.data.advice&&(gn.advice=Ot.data.advice),this.apiCCWebRTCClient.webRTCClient.processSlowLink(Ot.data.callId,gn)}}else if(Ot.data.type==="videoQualityChanged")At.createVideoQualityChangedEvent(Ot.data.callId,Ot.data.roomId,Ot.data.hint,Ot.data.profile);else if(Ot.data.type==="distantIceError")this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processDistantIceError(Ot.data);else if(Ot.data.type==="streamTrackChanged")this.apiCCWebRTCClient&&Ot.data.hasOwnProperty("mline")&&Ot.data.hasOwnProperty("muted")&&this.apiCCWebRTCClient.webRTCClient.processStreamTrackMuteChanged(Ot.data.callId,Ot.data.mline,Ot.data.muted);else if(Ot.data.type==="streamTrackStatusChanged")this.apiCCWebRTCClient&&Ot.data.hasOwnProperty("mline")&&Ot.data.hasOwnProperty("change")&&Ot.data.hasOwnProperty(Ot.data.change)&&this.apiCCWebRTCClient.webRTCClient.processStreamTrackStatusChanged(Ot.data.callId,Ot.data.mline,Ot.data[Ot.data.change]);else if(Ot.data.type==="configureEncodings")this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processConfigureEncodings(Ot.data);else if(Ot.data.type==="activeSpeaker")this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processAudioAmplitude(Ot.data,!0);else if(Ot.data.type==="stopSpeaking")this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processAudioAmplitude(Ot.data,!1);else if(Ot.data.type==="updateStream")this.apiCCWebRTCClient&&Ot.data.callId&&Ot.data.mline&&Ot.data.direction&&this.apiCCWebRTCClient.webRTCClient.processUpdateStream(Ot.data.callId,Ot.data.mline,Ot.data.direction);else if(Ot.data.type==="startRecording"){if(this.apiCCWebRTCClient)if(Ot.data.callId==="COMPOSITE")this.apiCCWebRTCClient.webRTCClient.MCUClient.startCompositeRecording(Ot.data.mediaType,Ot.data.customIdInFilename,Ot.data.convId,Ot.data.data);else{for(yn=this.apiCCWebRTCClient.webRTCClient.callsTable.length;--yn>=0;)if(this.apiCCWebRTCClient.webRTCClient.callsTable[yn].callId===Ot.data.callId){vn=!0;break}vn?this.apiCCWebRTCClient.webRTCClient.MCUClient.startRecording(Ot.data.mediaType,Ot.data.customIdInFilename,Ot.data.convId,Ot.data.callId,Ot.data.data):bt.info("cannot start recording (call not found)")}}else if(Ot.data.type==="startStreaming"){if(this.apiCCWebRTCClient){for(yn=this.apiCCWebRTCClient.webRTCClient.callsTable.length;--yn>=0;)if(this.apiCCWebRTCClient.webRTCClient.callsTable[yn].callId===Ot.data.callId){vn=!0;break}vn?this.apiCCWebRTCClient.webRTCClient.MCUClient.startStreaming(Ot.data.service,Ot.data.server,Ot.data.streamKey,Ot.data.callId):bt.info("cannot start streaming (call not found)")}}else if(Ot.data.type==="startCallStatsMonitoring"){if(this.apiCCWebRTCClient){for(bt.debug("startCallStatsMonitoring",Ot.data.callId),yn=this.apiCCWebRTCClient.webRTCClient.callsTable.length;--yn>=0;)if(this.apiCCWebRTCClient.webRTCClient.callsTable[yn].callId===Ot.data.callId){nn=this.apiCCWebRTCClient.webRTCClient.callsTable[yn];break}nn?["chrome","firefox"].indexOf(ot.wL.type)>=0?nn.csmIntervalId?bt.debug("call stats monitoring already started"):nn.csmIntervalId=setInterval(nn.callback(nn,"csmHandler"),nn.csmIntervalMs):bt.debug("call stats are only supported on chrome and firefox"):bt.debug("no such call")}}else Ot.data.type==="callOrder"?(bt.log("callOrder received"),this.apiCCWebRTCClient?(this.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector=Ot.senderId,Gt=this.apiCCWebRTCClient.webRTCClient.callWithNumber(Ot.data.caller,!0,{MCUType:"MCU-Callee",confId:Ot.data.confId,convId:Ot.data.convId,remoteMediaStreamId:Ot.data.mediaStreamId},Ft),this.apiCCWebRTCClient.webRTCClient.myWebRTC_Event.createIncomingCallEvent(this.clientId,Ot.data.caller,Ot.data.caller,Gt,!1,1,!1,"video",!0,"web","media")):bt.warn("WebRTCClient is not created")):Ot.data.type==="subscribeOrder"?(bt.log("subscribeOrder received :",Ot.data),this.apiCCWebRTCClient?(this.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector=Ot.senderId,Ot.data.data.subscribeOrder=!0,(un=[]).push(Ot.data.stream),this.apiCCWebRTCClient.webRTCClient.MCUClient.subscribeToStreams(un,"VIDEO",Ot.data.data,Ft,{noStreamCheck:!0})):bt.warn("WebRTCClient is not created")):Ot.data.type==="distantCallEstablished"?this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processDistantCallEstablished(Ot.data):Ot.data.type==="simulcastFeedChanged"?this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processSimulcastFeedChanged(Ot.data):bt.log("msg.data.type is not managed :"+Ot.data.type);else bt.log("msg.data === undefined");else if(Ot.type==="conversationListAnswer")this.receiveConversationListAnswer(Ot);else if(Ot.type==="contactOccurrencesFromConversationListAnswer")this.receiveContactOccurrencesFromConversationListAnswer(Ot);else if(Ot.type==="conversationDetailReport")this.receiveConversationDetailReportAnswer(Ot);else if(Ot.type==="updatePresence")bt.log("updatePresence"),this.updatePresence(Ot);else if(Ot.type==="updateUserStatus")bt.log("updateUserStatus"),this.updateUserStatus(Ot);else if(Ot.type==="receiveMCUSessionId")bt.log("receiveMCUSessionId"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.receiveSessionId(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="joinSessionAnswer")bt.log("joinSessionAnswer"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.joinSessionAnswer(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="updateSessionAnswer")bt.log("updateSessionAnswer"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.updateSessionAnswer(Ot,{updateCalls:!0}):bt.warn("WebRTCClient is not created");else if(Ot.type==="availableStreams")this.apiCCWebRTCClient?(bt.log("message availableStreams received"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.newAvailableStream(Ot.msg,"regular",function(fn,Tn,_n){At.createMCUAvailableStreamEvent([Tn],fn)}):bt.warn("WebRTCClient is not created")):bt.warn("WebRTCClient is not created");else if(Ot.type==="availableReplay")this.apiCCWebRTCClient?(bt.log("message availableReplay received"),this.apiCCWebRTCClient?(zt=this.apiCCWebRTCClient.webRTCClient.MCUClient.newAvailableReplay(Ot.msg),At.createMCUAvailableReplayEvent(Ot.msg,zt)):bt.warn("WebRTCClient is not created")):bt.warn("WebRTCClient is not created");else if(Ot.type==="availableComposite")this.apiCCWebRTCClient?(bt.log("message availableComposite received"),this.apiCCWebRTCClient?(zt=this.apiCCWebRTCClient.webRTCClient.MCUClient.newAvailableStream(Ot.msg,"composite"),At.createMCUAvailableCompositeEvent(Ot.msg,zt)):bt.warn("WebRTCClient is not created")):bt.warn("WebRTCClient is not created");else if(Ot.type==="onRemoveStream")this.apiCCWebRTCClient?(bt.log("message onRemoveStream received:",Ot),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.removeMCUStream(Ot.callId,Ot.msg.id,Ot.msg.reason):bt.warn("WebRTCClient is not created")):bt.warn("WebRTCClient is not created");else if(Ot.type==="availableStreamsUpdate")this.apiCCWebRTCClient?(bt.log("message availableStreamsUpdate received"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.updateAvailableStream(Ot.msg,"regular",function(fn,Tn,_n,Un){At.createMCUAvailableStreamUpdateEvent([Tn],fn)}):bt.warn("WebRTCClient is not created")):bt.warn("WebRTCClient is not created");else if(Ot.type==="checkCallStatus")this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.processCheckCallStatus(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="MCUSessionInvitation")bt.log("MCUSessionInvitation"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.receiveSessionInvitation(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="MCUSessionInvitationToGroupChat")bt.log("MCUSessionInvitationToGroupChat"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.receiveSessionInvitation(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="participantEjected")bt.log("participantEjected"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.participantEjected(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="recordingStarted")bt.log("recordingStarted"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.recordingStarted(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="recordingStopped")bt.log("recordingStopped"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.recordingStopped(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="recordingStreamAvailable")bt.log("recordingStreamAvailable"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.recordingStreamAvailable(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="streamingStarted")bt.log("streamingStarted"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.streamingStarted(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="streamingStopped")bt.log("streamingStopped"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.MCUClient.streamingStopped(Ot):bt.warn("WebRTCClient is not created");else if(Ot.type==="sessionId")bt.log("sessionId :"+Ot.sessionId),this.sessionId=Ot.sessionId,Ot.JWTApzToken!==void 0&&this.handleJWTApzToken(Ot.JWTApzToken);else if(Ot.type==="JWTTokenRefreshAnswer")bt.log("JWTTokenRefreshAnswer"),Ot.JWTApzToken!==void 0&&this.handleJWTApzToken(Ot.JWTApzToken);else if(Ot.type==="roomCreation")bt.log("roomCreation"),this.roomMgr.roomCreation(Ot);else if(Ot.type==="roomJoin")bt.log("roomJoined"),this.roomMgr.roomJoin(Ot);else if(Ot.type==="inviteInRoomStatus")bt.log("inviteInRoomStatus"),this.roomMgr.inviteInRoomStatus(Ot);else if(Ot.type==="contactListInRoom")bt.log("contactListInRoom"),this.roomMgr.onContactListInRoom(Ot);else if(Ot.type==="roomInvitation")bt.log("roomInvitation"),this.roomMgr.roomInvitation(Ot);else if(Ot.type==="roomMessage")bt.log("roomMessage"),this.roomMgr.receiveRoomMessage(Ot);else if(Ot.type==="roomMemberUpdate")bt.log("roomMemberUpdate"),this.roomMgr.roomMemberUpdate(Ot);else if(Ot.type==="agentReconnect"){var bn=this.apiCCWebRTCClient.webRTCClient.findCallWithCallId(Ot.callId);bn!=null&&bn.getUserMediaOnCall()}else Ot.type==="sequence"?(bt.log("Sequential message"),this.handleSequentialMessage(Ot)):Ot.type==="Ack"?bt.log("Ack received"):Ot.type==="receipt"?this.apiCCWebRTCClient&&this.apiCCWebRTCClient.webRTCClient.processReceipt(Ot):Ot.type==="error"?(bt.log("error received"),this.apiCCWebRTCClient?this.apiCCWebRTCClient.webRTCClient.processError(Ot):At.createErrorEvent(Ot.errorInfo,Ot.errorCode,Ot.callId,Ot.roomId,null,null,Ot.convId)):Ot.type==="enterpriseConfig"?(bt.log("enterpriseConfig received"),this.handleEnterpriseConfigMessage(Ot)):Ot.type==="AIEMessage"?(bt.log("AIEMessage received"),this.handleAIEMessage(Ot)):Ot.type==="cloudEventOccurred"?this.processCloudEventOccurred(Ot):bt.log("Error : No type for this message")},this.handleSequentialMessage=function(Ot){if(Ot.id!==void 0&&Ot.packetNum!==void 0&&Ot.totalPacketsNum!==void 0&&Ot.data!==void 0){bt.debug("Handle sequential message packet "+Ot.packetNum+"/"+Ot.totalPacketsNum,Ot);var Dt=[];if(wt.sequentialMessagesStorage[Ot.id]!==void 0&&(Dt=wt.sequentialMessagesStorage[Ot.id]),Dt.push(Ot),wt.sequentialMessagesStorage[Ot.id]=Dt,Dt.length===Ot.totalPacketsNum){Dt.sort(function(zt,Ft){return zt.packetNum-Ft.packetNum});var Gt="";Dt.forEach(function(zt){Gt+=zt.data}),delete wt.sequentialMessagesStorage[Ot.id];var nn=null;try{nn=JSON.parse(Gt)}catch(zt){return void bt.error("Error : can't parse sequential message JSON :",zt)}if(!nn)return void bt.error("Error : can't restore sequential message, it's null");bt.debug("Restored sequential message :",Gt),wt.processSignalingMessage(nn)}}else bt.error("Error : sequential message is inconsistent :",Ot)},this.handleEnterpriseConfigMessage=function(Ot){if(bt.debug("handleEnterpriseConfigMessage :",Ot),(0,ot.ki)(Ot,"sentry","boolean")&&Ot.sentry===!0){var Dt;Dt=window!==void 0&&window.location!==void 0&&window.location.protocol!==void 0&&window.location.protocol!=="https:"?"http":"https",apiCC.loadSentry(apiCC.initApiKey,Dt)}if((0,ot.ki)(Ot,"customJson","string")&&Ot.customJson!=="")try{bt.debug("customJson :",Ot.customJson),Ot.customJson=JSON.parse(Ot.customJson)}catch(Gt){bt.error(Gt)}if((0,ot.ki)(Ot,"iceServers","string")&&Ot.iceServers!=="")try{bt.debug("iceServers :",Ot.iceServers),Ot.iceServers=JSON.parse(Ot.iceServers),wt.apiCCWebRTCClient.setPcConfig(Ot.iceServers)}catch(Gt){bt.error(Gt)}(0,ot.ki)(Ot,"logLevel","string")&&Ot.logLevel!==""&&!isNaN(parseInt(Ot.logLevel))&&apiRTC.setLogLevel(parseInt(Ot.logLevel)),(0,ot.ki)(Ot,"ccs","object")&&(wt.ccsInfo=Object.assign({},Ot.ccs))},this.handleAIEMessage=function(Ot){switch(bt.debug("handleAIEMessage :",Ot),Ot.detail){case"modelLoaded":if(apiCC!==void 0&&Ot.userMediaStreamId!==void 0){var Dt=apiCC.getUserMediaStream(Ot.userMediaStreamId).mediaFilterManager;for(var Gt in Dt.filters)Dt.filters[Gt]!==void 0&&Dt.filters[Gt].streamAIE!==null&&Dt.filters[Gt].streamAIE.modelLoaded(Ot)}break;case"unknownModelName":bt.error("Unknown model name :",Ot.modelName);break;case"loadModelError":bt.error("Error while loading model :",Ot.info);break;default:bt.debug("Unknown detail :",Ot.detail)}},this.handleJWTApzToken=function(Ot){bt.debug("handleJWTApzToken :",Ot),wt.JWTApzToken=Ot,wt.cloudIsSecured===!0?(bt.debug("Setting JWTApzToken on cloudAPI"),apiCC.CloudApi.setJWTApzToken(wt.JWTApzToken)):bt.debug("JWTApzToken is not set on cloudAPI"),wt.JWTApzTokentimeOutId!==-1&&clearTimeout(wt.JWTApzTokentimeOutId),wt.JWTApzTokentimeOutId=setTimeout(function(){var Dt=JSON.stringify({type:"JWTTokenRefreshRequest"});bt.log("C->S: "+Dt),apiCC.session.channel.socket.emit("JWTTokenRefreshRequest",Dt)},wt.JWTApzTokenRefreshTimer)},this.fetchUserData=function(Ot){var Dt,Gt;bt.debug("fetchUserData"),Dt={type:"fetchUserData",id:Ot.id,apiKey:Ot.apiKey,timeout:Ot.timeout},Gt=JSON.stringify(Dt),bt.log("C->S: "+Gt),this.channel.socket.emit("fetchUserData",Gt)}}},7323:(rt,it,s)=>{s.d(it,{q:()=>jt}),s(4363),s(9653),s(3710),s(1539),s(9714),s(561),s(2564),s(4812),s(8309),s(9753),s(9554),s(4747),s(8674),s(7042),s(1038),s(8783),s(4916),s(2526),s(1817),s(2165),s(6992),s(3948);var et=s(1549),nt=s(5945),at=s(4708);function ht(Pt,Vt){for(var Qt=0;QtPt.length)&&(Vt=Pt.length);for(var Qt=0,rn=new Array(Vt);Qt0&&arguments[0]!==void 0&&arguments[0],Jt=0,sn=0,mn=0;if(rn)for(var an=0;an0&&arguments[0]!==void 0&&arguments[0],Jt=this.mean(rn),sn=ut(Jt,3),mn=sn[0],an=sn[1],hn=sn[2],wn=0,Mn=0,xn=0;if(rn)for(var En=0;En0&&arguments[0]!==void 0&&arguments[0],Jt=this.mean(rn),sn=ut(Jt,3),mn=sn[0],an=sn[1],hn=sn[2],wn=0,Mn=0,xn=0;if(rn)for(var En=0;En0&&arguments[0]!==void 0?arguments[0]:5,Jt=new OffscreenCanvas(this.width,this.height),sn=Jt.getContext("2d");Jt.width=this.width,Jt.height=this.height,sn.putImageData(this.image,0,0),sn.filter="blur("+rn+"px)",sn.drawImage(Jt,0,0);var mn=sn.getImageData(0,0,this.width,this.height);return mn}},{key:"threshold",value:function(rn,Jt,sn){var mn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:255,an=arguments.length>4&&arguments[4]!==void 0&&arguments[4],hn=new ImageData(this.image.data,this.width,this.height),wn=0;if(an){var Mn=wn;wn=mn,mn=Mn}for(var xn=0;xn0&&arguments[0]!==void 0)||arguments[0],Jt=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],sn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:3,mn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;yt(this,Pt),this.blurMask=rn,this.smoothBorder=Jt,this.blurFactor=sn,this.smoothingFactor=mn,this.maskImage=null,this.net=null}var Vt,Qt;return Vt=Pt,Qt=[{key:"loadModel",value:function(){var rn=this;return new Promise(function(Jt,sn){bodyPix.load({architecture:"MobileNetV1",outputStride:16,multiplier:.75,quantBytes:2}).then(function(mn){rn.net=mn,Jt()})})}},{key:"computeMask",value:function(rn){var Jt=this;return new Promise(function(sn,mn){Jt.net.segmentPerson(rn).then(function(an){Jt.width=an.width,Jt.height=an.height,Jt.length=Jt.width*Jt.height;for(var hn=new Uint8ClampedArray(4*Jt.length),wn=0;wn1&&arguments[1]!==void 0?arguments[1]:null;Jt===null&&(Jt=this.maskImage);for(var sn=new Uint8ClampedArray(rn.width*rn.height*4),mn=0;mn3&&arguments[3]!==void 0?arguments[3]:null;mn===null&&(mn=this.maskImage);var an=new ft(Jt,rn.width,rn.height),hn=an.weightedSumMask(sn,mn);return hn}},{key:"setBackground",value:function(rn,Jt){var sn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return this.superposeImages(rn,rn,Jt,sn)}},{key:"blurBackground",value:function(rn){var Jt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,sn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,mn=new ft(rn,rn.width,rn.height),an=mn.blur(Jt);return this.setBackground(rn,an,sn)}}],Qt&&vt(Vt.prototype,Qt),Object.defineProperty(Vt,"prototype",{writable:!1}),Pt}();function At(Pt,Vt){if(!(Pt instanceof Vt))throw new TypeError("Cannot call a class as a function")}function Nt(Pt,Vt){for(var Qt=0;Qt1&&arguments[1]!==void 0?arguments[1]:480,sn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:360,mn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;At(this,Pt),this.mediaStream=rn,this.backgroundMode="none",this.backgroundBlurFactor=10,this.canvasWidth=Jt,this.canvasHeight=sn,this.length=this.canvasWidth*this.canvasHeight,this.userMediaStreamId=mn;for(var an=new Uint8ClampedArray(4*this.length),hn=0;hn<4*this.length;hn++)an[hn]=255;this.backgroundImage=new ImageData(an,this.canvasWidth,this.canvasHeight);var wn=!0,Mn=!0,xn=5,En=-1;this.backSub=new bt(wn,Mn,xn,En),this.modelLoaded=!1,this.maskStreamLaunched=!1,this.backgroundSubtractionActivated=!1}var Vt,Qt;return Vt=Pt,Qt=[{key:"setBackgroundMode",value:function(rn){this.backgroundMode=rn}},{key:"setBackgroundImage",value:function(rn){this.backgroundImage=rn}},{key:"setBackgroundBlurFactor",value:function(rn){this.backgroundBlurFactor=rn}},{key:"loadModel",value:function(){St.debug("Loading model");var rn=this;return new Promise(function(Jt,sn){rn.backSub.loadModel().then(function(mn){rn.modelLoaded=!0,St.debug("Model loaded"),Jt()})})}},{key:"getMaskStream",value:function(){var rn=document.createElement("video");rn.srcObject=this.mediaStream;var Jt=document.createElement("canvas"),sn=Jt.getContext("2d");Jt.width=this.canvasWidth,Jt.height=this.canvasHeight;var mn=document.createElement("canvas"),an=mn.getContext("2d");mn.width=this.canvasWidth,mn.height=this.canvasHeight;var hn=this;rn.addEventListener("loadeddata",function(){rn.play(),requestAnimationFrame(cr),hn.modelLoaded?kn=!0:hn.loadModel().then(function(dr){kn=!0})});for(var wn=!0,Mn=new Uint8ClampedArray(4*this.length),xn=0;xn<4*this.length;xn++)Mn[xn]=255;var En=new ImageData(Mn,this.canvasWidth,this.canvasHeight);an.putImageData(En,0,0);var kn=!1,Vn=0,Xn=!0;function cr(){sn.drawImage(rn,0,0,Jt.width,Jt.height);var dr=sn.getImageData(0,0,Jt.width,Jt.height);if(hn.modelLoaded&&wn&&kn&&(Xn||hn.backgroundMode!=="none")){Xn&&(Xn=!1);var ur=new Date;wn=!1,hn.backSub.computeMask(dr).then(function(Cr){wn=!0,1/((new Date-ur)/1e3)<1&&++Vn>=10&&(kn=!1,St.error("The segmentation process cannot be handled"),wt.createBackgroundSubstractionStopComputeTimeEvent(hn.userMediaStreamId))})}hn.modelLoaded&&hn.backSub.maskImage!==null&&kn?an.putImageData(hn.backSub.maskImage,0,0):an.putImageData(En,0,0),hn.continueMaskComputation?requestAnimationFrame(cr):(St.debug("Mask computation stoped"),hn.continueMaskComputation=!0)}return this.continueMaskComputation=!0,this.maskMediaStream=mn.captureStream(),this.maskStreamLaunched=!0,this.maskMediaStream}},{key:"activateBackgroundSubtraction",value:function(){var rn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;if(rn!==null&&this.setBackgroundMode(rn),this.backgroundSubtractionActivated)return this.processedMediaStream;this.maskStreamLaunched||this.getMaskStream();var Jt=document.createElement("video");Jt.srcObject=this.mediaStream;var sn=document.createElement("video");sn.srcObject=this.maskMediaStream;var mn=document.createElement("canvas"),an=mn.getContext("2d");mn.width=this.canvasWidth,mn.height=this.canvasHeight;var hn=document.createElement("canvas"),wn=hn.getContext("2d");hn.width=this.canvasWidth,hn.height=this.canvasHeight,this.continueBackgroundSubtraction=!0;var Mn=this;function xn(){an.drawImage(Jt,0,0,mn.width,mn.height);var En=an.getImageData(0,0,mn.width,mn.height);if(Mn.backgroundMode==="none")wn.putImageData(En,0,0);else{an.drawImage(sn,0,0,mn.width,mn.height);var kn=an.getImageData(0,0,mn.width,mn.height),Vn=null;switch(Mn.backgroundMode){case"image":Vn=Mn.backSub.setBackground(En,Mn.backgroundImage,kn);break;case"blur":default:Vn=Mn.backSub.blurBackground(En,Mn.backgroundBlurFactor,kn);break;case"transparent":Vn=Mn.backSub.applyTransparency(En,kn)}wn.putImageData(Vn,0,0)}Mn.continueBackgroundSubtraction?requestAnimationFrame(xn):(St.debug("Mask application stoped"),Mn.continueBackgroundSubtraction=!0)}return Jt.addEventListener("loadeddata",function(){Jt.play(),sn.play(),requestAnimationFrame(xn)}),this.processedMediaStream=hn.captureStream(30),this.backgroundSubtractionActivated=!0,this.processedMediaStream}},{key:"deactivateBackgroundSubtraction",value:function(){this.setBackgroundMode("none"),this.processedMediaStream=this.mediaStream,this.backgroundSubtractionActivated=!1,this.continueBackgroundSubtraction=!1,this.maskMediaStream=null,this.maskStreamLaunched=!1,this.continueMaskComputation=!1}}],Qt&&Nt(Vt.prototype,Qt),Object.defineProperty(Vt,"prototype",{writable:!1}),Pt}();function Ht(Pt){return Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Vt){return typeof Vt}:function(Vt){return Vt&&typeof Symbol=="function"&&Vt.constructor===Symbol&&Vt!==Symbol.prototype?"symbol":typeof Vt},Ht(Pt)}function Ot(Pt,Vt){for(var Qt=0;Qt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var an,hn=nn(rn);if(Jt){var wn=nn(this).constructor;an=Reflect.construct(hn,arguments,wn)}else an=hn.apply(this,arguments);return Gt(this,an)});function mn(){var an;return function(hn,wn){if(!(hn instanceof wn))throw new TypeError("Cannot call a class as a function")}(this,mn),(an=sn.call(this)).streamSegmentation=null,an.userMediaStreamId=null,an}return Vt=mn,(Qt=[{key:"applyFilter",value:function(an,hn){var wn=this;zt.debug("Apply filter with descriptor:",hn);var Mn=an.getAudioTracks();Mn.length>0&&Mn.forEach(function(kn){an.removeTrack(kn)});var xn=an.getVideoTracks();if(xn.length===0)return Promise.reject("MediaStream has no video tracks");var En=xn[0].getSettings();return hn.options!==void 0&&hn.options.userMediaStreamId!==void 0&&(this.userMediaStreamId=hn.options.userMediaStreamId),this.streamSegmentation=new Mt(an,En.width,En.height,this.userMediaStreamId),this.loadTensorflow().then(function(kn){return wn.loadTensorflowModel()}).then(function(kn){return new Promise(function(Vn,Xn){zt.debug("Model loading..."),wn.streamSegmentation.loadModel().then(function(cr){zt.debug("Model loaded");var dr=null;hn.options!==void 0&&hn.options.backgroundMode!==void 0&&(hn.options.backgroundMode==="image"&&hn.options.image instanceof ImageData&&wn.streamSegmentation.setBackgroundImage(hn.options.image),dr=hn.options.backgroundMode);var ur=wn.streamSegmentation.activateBackgroundSubtraction(dr);Mn.forEach(function(Cr){ur.addTrack(Cr)}),Vn(ur)})})}).catch(function(kn){return Promise.reject(kn)})}},{key:"release",value:function(){this.streamSegmentation.deactivateBackgroundSubtraction(),this.streamSegmentation=null}},{key:"loadTensorflow",value:function(){return zt.debug("Tensorflow script loading..."),new Promise(function(an,hn){var wn={async:!0,numRetries:20,reqdelay:200,success:function(){zt.debug("Tensorflow script loaded"),an()},error:function(Mn){hn("Resources loading failed, depsNotFound: "+Mn)},retrycb:function(Mn,xn){zt.warn("Tensorflow loading retry :"+Mn+" ,delay before retry :"+xn)}};apiCC.resourcesLoader.loadjs(["https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.2"],"tensorflow",wn)})}},{key:"loadTensorflowModel",value:function(){return zt.debug("Tensorflow model script loading..."),new Promise(function(an,hn){var wn={async:!0,numRetries:20,reqdelay:200,success:function(){zt.debug("Tensorflow model script loaded"),an()},error:function(Mn){hn("Resources loading failed, depsNotFound: "+Mn)},retrycb:function(Mn,xn){zt.warn("Tensorflow model loading retry :"+Mn+" ,delay before retry :"+xn)}};apiCC.resourcesLoader.loadjs(["https://cdn.jsdelivr.net/npm/@tensorflow-models/body-pix@2.0"],"tensorflow-model",wn)})}}])&&Ot(Vt.prototype,Qt),Object.defineProperty(Vt,"prototype",{writable:!1}),mn}(dt);function un(Pt,Vt){var Qt=typeof Symbol<"u"&&Pt[Symbol.iterator]||Pt["@@iterator"];if(!Qt){if(Array.isArray(Pt)||(Qt=function(hn,wn){if(hn){if(typeof hn=="string")return vn(hn,wn);var Mn=Object.prototype.toString.call(hn).slice(8,-1);return Mn==="Object"&&hn.constructor&&(Mn=hn.constructor.name),Mn==="Map"||Mn==="Set"?Array.from(hn):Mn==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Mn)?vn(hn,wn):void 0}}(Pt))||Vt&&Pt&&typeof Pt.length=="number"){Qt&&(Pt=Qt);var rn=0,Jt=function(){};return{s:Jt,n:function(){return rn>=Pt.length?{done:!0}:{done:!1,value:Pt[rn++]}},e:function(hn){throw hn},f:Jt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var sn,mn=!0,an=!1;return{s:function(){Qt=Qt.call(Pt)},n:function(){var hn=Qt.next();return mn=hn.done,hn},e:function(hn){an=!0,sn=hn},f:function(){try{mn||Qt.return==null||Qt.return()}finally{if(an)throw sn}}}}function vn(Pt,Vt){(Vt==null||Vt>Pt.length)&&(Vt=Pt.length);for(var Qt=0,rn=new Array(Vt);Qt1&&arguments[1]!==void 0?arguments[1]:.2,rn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Jt=Pt.yolo,sn={yolo:[]},mn=un(Jt);try{for(mn.s();!(Vt=mn.n()).done;){var an=Vt.value,hn=an.objectness;if(hn>Qt)if(rn!==null){var wn,Mn=an.bounding_box,xn=yn(Mn),En=0,kn=null,Vn=0,Xn=un(Jt);try{for(Xn.s();!(wn=Xn.n()).done;){var cr=wn.value,dr=cr.bounding_box,ur=cn(Mn,dr);ur!==1&&ur>En&&(En=ur,kn=cr,Vn=yn(cr.bounding_box))}}catch(Cr){Xn.e(Cr)}finally{Xn.f()}(kn===null||En0&&(xn=Mn+.75*(1-Mn)*Vn*kn.objectness)}}}catch(cr){En.e(cr)}finally{En.f()}var Xn={class:hn,objectness:xn,bounding_box:wn};Jt.yolo.push(Xn)}}catch(cr){sn.e(cr)}finally{sn.f()}return Jt}function fn(Pt,Vt){return function(Qt){if(Array.isArray(Qt))return Qt}(Pt)||function(Qt,rn){var Jt=Qt==null?null:typeof Symbol<"u"&&Qt[Symbol.iterator]||Qt["@@iterator"];if(Jt!=null){var sn,mn,an=[],hn=!0,wn=!1;try{for(Jt=Jt.call(Qt);!(hn=(sn=Jt.next()).done)&&(an.push(sn.value),!rn||an.length!==rn);hn=!0);}catch(Mn){wn=!0,mn=Mn}finally{try{hn||Jt.return==null||Jt.return()}finally{if(wn)throw mn}}return an}}(Pt,Vt)||function(Qt,rn){if(Qt){if(typeof Qt=="string")return Tn(Qt,rn);var Jt=Object.prototype.toString.call(Qt).slice(8,-1);return Jt==="Object"&&Qt.constructor&&(Jt=Qt.constructor.name),Jt==="Map"||Jt==="Set"?Array.from(Qt):Jt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Jt)?Tn(Qt,rn):void 0}}(Pt,Vt)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Tn(Pt,Vt){(Vt==null||Vt>Pt.length)&&(Vt=Pt.length);for(var Qt=0,rn=new Array(Vt);Qt0&&arguments[0]!==void 0?arguments[0]:0;this.memoryTime=rn,this.log=!0}},{key:"stopLogs",value:function(){this.log=!1,this.memoryTime=0}},{key:"activateSnapshots",value:function(){var rn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.snapshot=!0,this.minSnapshotPeriod=rn}},{key:"stopSnapshots",value:function(){this.snapshot=!1,this.minSnapshotPeriod=0}},{key:"activateAnnotations",value:function(){this.lastAnnotations={yolo:[]},this.drawAnnotationsBool=!0,this.getAnnotations()}},{key:"stopAnnotations",value:function(){this.drawAnnotationsBool=!1}},{key:"getAnnotations",value:function(){var rn=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],Jt=document.createElement("video");Jt.srcObject=this.mediaStream;var sn=document.createElement("canvas"),mn=sn.getContext("2d");sn.width=this.canvasWidth,sn.height=this.canvasHeight;var an=document.createElement("canvas"),hn=an.getContext("2d");an.width=this.canvasWidth,an.height=this.canvasHeight;var wn=this;function Mn(br,Ir){for(var kr=br.split(","),Mr=kr[0].match(/:(.*?);/)[1],jr=atob(kr[1]),Wr=jr.length,Qr=new Uint8Array(Wr);Wr--;)Qr[Wr]=jr.charCodeAt(Wr);return new File([Qr],Ir,{type:Mr})}Jt.addEventListener("loadeddata",function(){Jt.play(),requestAnimationFrame(function(){_r(wn.aieUrl,wn.token,wn.loadedModel)})});var xn=!0,En={},kn=null,Vn=new Date;function Xn(br,Ir,kr){var Mr=Mn(sn.toDataURL("image/jpeg")),jr={pipelineCallId:wn.getOrCreatePipeline(),file:Mr,transferType:"plugin",pluginName:"httpPost",pluginData:{url:br,headers:{Authorization:"Token "+Ir},formData:{file:"$DATA",angled:1,model:kr,size:wn.resinzingSize}}};apiCC.session.apiCCWebRTCClient.webRTCClient.pushData(null,jr,null,{success:function(Wr){var Qr=(new Date-kn)/1e3,er=1/Qr;return Un.debug("Computation time:",Qr,"s ,FPS:",er),_r(br,Ir,kr),Wr.data.error!==void 0?Un.error("http post error :",Wr.data.error):Wr.data.result===void 0?Un.error("An error occured when trying to annotate a snapshot"):void cr(Wr.data)},failure:function(Wr,Qr,er){Un.error("## pushData:failure",Qr,er,Wr)}})}function cr(br){var Ir=br.result;wn.isReleased||(wn.lastRawAnnotations=Ir,Ir.yolo!==void 0&&ur(Ir),Ir.ocr===void 0&&Ir.codes===void 0||dr(Ir))}function dr(br){wn.lastAnnotations={ocr:br.ocr,codes:br.codes};var Ir="";if(br.ocr.length>1){Ir+="Words found : ";for(var kr=0;kr1){Ir+="Codes found : ";for(var Mr=0;Mr0&&(rn&&(br=bn(wn.lastRawAnnotations,br)),wn.scoreThresh!==null&&(br=gn(br,wn.scoreThresh)));for(var Ir={yolo:[]},kr={},Mr=wn.classFilter.split(", "),jr=0;jr1e3*wn.memoryTime)&&(En[nr]=Qr)}var Nr=er.sort().join(" ");Nr!==""&&(Cr(Nr),Sr())}}function Cr(br){wn.log&&Pn.createAIELogEvent(wn.userMediaStreamId,br)}function Sr(){if(wn.snapshot){var br=new Date,Ir=mn.getImageData(0,0,sn.width,sn.height);if(br-Vn>1e3*wn.minSnapshotPeriod){hn.putImageData(Ir,0,0),wn.drawAnnotations(wn.lastAnnotations,hn,wn.drawingConfig);var kr=an.toDataURL("image/png"),Mr=new Image;Mr.src=kr,Pn.createAIESnapshotEvent(wn.userMediaStreamId,Mr),Vn=br}}}function _r(br,Ir,kr){mn.drawImage(Jt,0,0,sn.width,sn.height),(xn||wn.drawAnnotationsBool)&&(xn&&(xn=!1),kn=new Date,Xn(br,Ir,kr))}}},{key:"getOrCreatePipeline",value:function(){if(this.callId!==null)return this.callId;var rn=this;return this.callId=apiCC.session.apiCCWebRTCClient.webRTCClient.pushData(null,{transferType:"pipeline"},null,{failure:function(Jt){Jt==="dataChannelClosed"?(Un.debug("dataChannelClosed : no activity on dataChannel timeout"),rn.callId=null):Un.error("dataChannel failure",Jt)}}),this.callId}},{key:"drawAnnotations",value:function(rn,Jt){var sn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},mn=sn.color||"#ED5131",an=sn.textColor||"#FFFFFF",hn=sn.colorMap||null,wn=Object.prototype.hasOwnProperty.call(sn,wn)?sn.lineWidth:3,Mn=sn.font||"15px Arial";if(rn.yolo!==void 0&&rn.yolo.length>0)for(var xn=0;xn0){Mn=sn.font||"25px Arial";for(var br=0;br0){Mn=sn.font||"25px Arial";for(var Tr=0;Tr"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var an,hn=jn(rn);if(Jt){var wn=jn(this).constructor;an=Reflect.construct(hn,arguments,wn)}else an=hn.apply(this,arguments);return qn(this,an)});function mn(){var an;return function(hn,wn){if(!(hn instanceof wn))throw new TypeError("Cannot call a class as a function")}(this,mn),(an=sn.call(this)).userMediaStreamId=null,an.streamAIE=null,an}return Vt=mn,(Qt=[{key:"applyFilter",value:function(an,hn){var wn=this;return new Promise(function(Mn,xn){if(Fn.debug("Apply filter with descriptor :",hn),hn.options===void 0&&xn("Filter options object required"),hn.options.modelName===void 0)xn("modelName options required");else{var En=an.getAudioTracks();En.length>0&&En.forEach(function(kn){an.removeTrack(kn)}),wn.streamAIE=new In(an,hn.options),wn.streamAIE.loadModel().then(function(kn){En.forEach(function(Vn){kn.addTrack(Vn)}),Mn(kn)}).catch(function(kn){xn(kn)})}})}},{key:"release",value:function(){this.streamAIE.release()}}])&&On(Vt.prototype,Qt),Object.defineProperty(Vt,"prototype",{writable:!1}),mn}(dt);function on(Pt){return on=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Vt){return typeof Vt}:function(Vt){return Vt&&typeof Symbol=="function"&&Vt.constructor===Symbol&&Vt!==Symbol.prototype?"symbol":typeof Vt},on(Pt)}function Hn(Pt,Vt){for(var Qt=0;Qt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var an,hn=$n(rn);if(Jt){var wn=$n(this).constructor;an=Reflect.construct(hn,arguments,wn)}else an=hn.apply(this,arguments);return zn(this,an)});function mn(){var an;return function(hn,wn){if(!(hn instanceof wn))throw new TypeError("Cannot call a class as a function")}(this,mn),(an=sn.call(this)).mediaStream=null,an.mediaStreamSettings=null,an.processedMediaStream=null,an.net=null,an.lossRatio=null,an.processBackground=!1,an.bgImageData=null,an.videoElement=document.createElement("video"),an.canvas=document.createElement("canvas"),an.canvasContext=an.canvas.getContext("2d"),an}return Vt=mn,(Qt=[{key:"applyFilter",value:function(an,hn){var wn=this;return new Promise(function(Mn,xn){var En=an.getAudioTracks();En.length>0&&En.forEach(function(kn){an.removeTrack(kn)}),wn.loadTensorflow().then(function(){wn.loadTensorflowModel().then(function(){wn.videoElement.srcObject=an;var kn=wn;wn.videoElement.addEventListener("loadeddata",function(){kn.videoElement.play(),kn.mediaStream=an,kn.descriptors=hn,kn.processedMediaStream=kn.canvas.captureStream(),kn.mediaStreamSettings=kn.mediaStream.getVideoTracks()[0].getSettings(),kn.videoElement.height=240,kn.lossRatio=kn.mediaStreamSettings.height/kn.videoElement.height,kn.videoElement.width=kn.videoElement.height*kn.mediaStreamSettings.aspectRatio,kn.videoElement.onplaying=function(){kn.canvas.height=kn.videoElement.videoHeight,kn.canvas.width=kn.videoElement.videoWidth},kn.loadBodyPix().then(function(){En.forEach(function(Vn){kn.processedMediaStream.addTrack(Vn)}),Mn(kn.processedMediaStream)}).catch(function(Vn){Jn.error(Vn)})})}).catch(function(kn){Jn.error(kn)})}).catch(function(kn){Jn.error(kn)})})}},{key:"loadTensorflow",value:function(){return Jn.debug("Tensorflow script loading..."),new Promise(function(an,hn){var wn={async:!0,numRetries:20,reqdelay:200,success:function(){Jn.debug("Tensorflow script loaded"),an()},error:function(Mn){hn("Resources loading failed, depsNotFound: "+Mn)},retrycb:function(Mn,xn){Jn.warn("Tensorflow loading retry :"+Mn+" ,delay before retry :"+xn)}};apiCC.resourcesLoader.loadjs(["https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.2"],"tensorflow",wn)})}},{key:"loadTensorflowModel",value:function(){return Jn.debug("Tensorflow model script loading..."),new Promise(function(an,hn){var wn={async:!0,numRetries:20,reqdelay:200,success:function(){Jn.debug("Tensorflow model script loaded"),an()},error:function(Mn){hn("Resources loading failed, depsNotFound: "+Mn)},retrycb:function(Mn,xn){Jn.warn("Tensorflow model loading retry :"+Mn+" ,delay before retry :"+xn)}};apiCC.resourcesLoader.loadjs(["https://cdn.jsdelivr.net/npm/@tensorflow-models/body-pix@2.0"],"tensorflow-model",wn)})}},{key:"loadBodyPix",value:function(){var an=this;return new Promise(function(hn,wn){bodyPix.load({multiplier:.75,stride:32,quantBytes:4}).then(function(Mn){an.net=Mn,an.perform(),hn()}).catch(function(Mn){return wn(Mn)})})}},{key:"perform",value:function(){if(this.descriptors.options!==void 0&&this.descriptors.options.backgroundMode!==void 0)switch(this.processBackground=!0,this.descriptors.options.backgroundMode){case"blur":Jn.warn("This method is deprecated, please use Stream#blur method now."),this.videoElement.height=this.mediaStreamSettings.height,this.videoElement.width=this.mediaStreamSettings.width,this.canvas.height=this.videoElement.height,this.canvas.width=this.videoElement.width,this.blurBackground();break;case"transparent":this.noBackground();break;case"image":this.descriptors.options.image!==void 0?(this.resizeImageData(this.descriptors.options.image),this.imageBackground()):Jn.error("image option is required when creating the filter");break;default:Jn.debug("The backgroundMode : ",this.descriptors.options.backgroundMode," is not implemented. Refer to documentation for accepted values."),this.blurBackground()}else Jn.error("backgroundMode option is required")}},{key:"blurBackground",value:function(){var an=this;this.net.segmentPerson(this.videoElement).then(function(hn){an.blurBackground(),bodyPix.drawBokehEffect(an.canvas,an.videoElement,hn,9,2,!1)})}},{key:"noBackground",value:function(){var an=this;this.net.segmentPerson(this.videoElement).then(function(hn){an.canvasContext.drawImage(an.videoElement,0,0,an.videoElement.width,an.videoElement.height);for(var wn=an.canvasContext.getImageData(0,0,an.videoElement.width,an.videoElement.height),Mn=wn.data,xn=0;xn=wn?this.scaleImageData(an,hn):this.scaleImageData(an,wn)}},{key:"noBackgroundWithFullResolution",value:function(){var an=this;this.net.segmentPerson(this.videoElement).then(function(hn){an.canvasContext.drawImage(an.videoElement,0,0,an.canvas.width,an.canvas.height);for(var wn=an.canvasContext.getImageData(0,0,an.canvas.width,an.canvas.height),Mn=new Uint8ClampedArray(4*hn.width*hn.height),xn=0;xn=Pt.length?{done:!0}:{done:!1,value:Pt[rn++]}},e:function(hn){throw hn},f:Jt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var sn,mn=!0,an=!1;return{s:function(){Qt=Qt.call(Pt)},n:function(){var hn=Qt.next();return mn=hn.done,hn},e:function(hn){an=!0,sn=hn},f:function(){try{mn||Qt.return==null||Qt.return()}finally{if(an)throw sn}}}}function Tt(Pt,Vt){(Vt==null||Vt>Pt.length)&&(Vt=Pt.length);for(var Qt=0,rn=new Array(Vt);Qt=15&&apiRTC.browserDetails.type!=="chrome"?this.gum_config={audio:!0,video:!0}:nt.Xh==="Chrome"&&nt.PR<49||nt.Xh==="Firefox"&&nt.PR<50?this.gum_config={audio:{mandatory:{},optional:[]},video:{mandatory:{},optional:[]}}:this.gum_config={audio:{},video:{}},this.inputs={},this.callbacks={},this.callType=null,this.audio=!1,this.audioDeviceLabel=null,this.audioMuted=!1,this.audioSilent=!1,this.video=!1,this.videoDeviceLabel=null,this.videoMuted=!1,this.videoSilent=!1,this.stream=null,this.streamStolen=!1,this.notifyUserMediaSuccess=!0,this.notifyUserMediaStop=!0,apiCC.session!==null&&apiCC.session!==void 0?this.tryAudioCallAfterUserMediaError=apiCC.session.tryAudioCallAfterUserMediaError:this.tryAudioCallAfterUserMediaError=!1,this.callInfoList=[],this.iOSMediaSelectionWorkAroundApplied=!1,this.getUserMediaTimeoutId=null,at.wL.type==="chrome"&&at.wL.version>=72&&at.wL.version<=73?this.displayMediaStreamConstraints={video:!0,audio:!1}:this.displayMediaStreamConstraints={video:!0,audio:!0},this.forceExtensionOnChrome=!1,this.filters=null,this.mediaFilterManager=null,this.videoSettings=!1,this.getVideoTrack=function(){if(!this.stream||typeof this.stream.getVideoTracks!="function")return null;var Pt=this.stream.getVideoTracks();return Pt&&Pt.length===1?Pt[0]:null},this.release=function(){var Pt=0,Vt=null,Qt=null,rn=null;if(Rt.debug("[ApiCCUserMediaStream] release; userMediaStreamId: "+this.userMediaStreamId),this.mediaFilterManager!==null&&(this.mediaFilterManager.release(),this.mediaFilterManager=null),apiCC.audioProcessor.stopAudioNodeCtx(this.nodeCtx),apiRTC.userAgentInstance!==void 0&&apiRTC.userAgentInstance!==null&&apiRTC.userAgentInstance.apiRTCStreamsList!==void 0&&apiRTC.userAgentInstance.apiRTCStreamsList!==null&&apiRTC.userAgentInstance.apiRTCStreamsList.delete(Number(this.userMediaStreamId)),this.stream!==null){if(this.streamStolen!==!0)if(typeof cordova<"u"&&cordova.plugins!==void 0&&cordova.plugins.iosrtc!==void 0)cordova!==void 0&&cordova.plugins!==void 0&&cordova.plugins.iosrtc!==void 0&&(Rt.debug("[ApiCCUserMediaStream] release on iosrtc cordova"),this.stream.onended=null);else if(nt.Xh==="Chrome"&&nt.PR<45||nt.Xh==="Firefox"&&nt.PR<44||nt.Xh==="Opera"&&nt.PR<34||nt.Xh==="Chromium"&&nt.PR<44||nt.Xh==="Chrome WebView"&&nt.PR<45)this.stream.onended=null,this.stream.stop();else for(this.stream.onended=null,Pt=(Vt=this.stream.getTracks()).length;--Pt>=0;)Vt[Pt].onended=null,Vt[Pt].stop();this.stream=null,this.streamStolen=!1,this.notifyUserMediaStop===!0&&((rn=this.getOwnerCallInfo())!==null&&(Qt=rn.callId),Lt.createUserMediaStopEvent(Qt,this.callType,this.userMediaStreamId)),this.callbacks.release(this)}},this.getUserMedia=function(){var Pt=this;if(Rt.debug("[ApiCCUserMediaStream] getUserMedia; userMediaStreamId: "+this.userMediaStreamId),this.stream===null)try{if(this.callType==="media")this.gum_config=apiCC.setAudioSourceIdInConstraint(this.inputs.audioSourceId,this.gum_config),this.gum_config=apiCC.setVideoSourceIdInConstraint(this.inputs.videoSourceId,this.gum_config),this.gum_config=apiCC.setVideoFacingModeInConstraint(this.inputs.facingMode,this.gum_config);else if(this.callType==="audio")this.gum_config=apiCC.setAudioSourceIdInConstraint(this.inputs.audioSourceId,this.gum_config),this.gum_config.video=!1;else{if(this.callType!=="videoOnly")return function(Vt){for(var Qt=apiCC.userMediaStreamTable.length;--Qt>=0;)if(apiCC.userMediaStreamTable[Qt].userMediaStreamId===Vt){apiCC.userMediaStreamTable.splice(Qt,1);break}}(this.userMediaStreamId),void setTimeout(this.callbacks.failure.bind(this,this,"wrong type"));this.gum_config.audio=!1,this.gum_config=apiCC.setVideoSourceIdInConstraint(this.inputs.videoSourceId,this.gum_config),this.gum_config=apiCC.setVideoFacingModeInConstraint(this.inputs.facingMode,this.gum_config)}apiCC.checkConstraintDependingOnDevice(this.gum_config),nt.Xh==="IE"&&nt.dc>8?apiCC.getUserMediaWithCB(this.gum_config,this.callback(this,"onUserMediaSuccess"),this.callback(this,"onUserMediaError")):(nt.Xh!=="Chrome"&&nt.Xh!=="Mobile Chrome"||this.isUserMediaAccessAllowed()===!0&&(this.getUserMediaTimeoutId=setTimeout(function(){Pt.onUserMediaError("timeout")},1e4)),apiCC.getUserMedia(this.gum_config).then(this.callback(this,"onUserMediaSuccess")).catch(this.callback(this,"onUserMediaError")))}catch(Vt){Rt.error("getUserMedia() failed. Is this a WebRTC capable browser?"),Rt.log("getUserMedia failed with exception: "+Vt.message)}},this.listenForMuteEvents=function(){var Pt,Vt=this,Qt=function(mn){var an=null,hn=null;mn.onmute=function(wn){Rt.debug("mute event :",mn),mn.kind==="audio"&&an===null?an=setTimeout(function(){Vt.audioSilent=!0,an=null,Vt.notifyMLineMuted(mn.kind,!0,"muted")},2520):mn.kind==="video"&&hn===null&&(hn=setTimeout(function(){Vt.videoSilent=!0,hn=null,Vt.notifyMLineMuted(mn.kind,!0,"muted")},2520))},mn.onunmute=function(wn){Rt.debug(mn.kind+" unmute event"),mn.kind==="audio"&&an!==null?(clearTimeout(an),an=null):mn.kind==="video"&&hn!==null?(clearTimeout(hn),hn=null):(mn.kind==="audio"?Vt.audioSilent=!1:mn.kind==="video"&&(Vt.videoSilent=!1),Vt.notifyMLineMuted(mn.kind,!1,"muted"))},mn.onended=function(wn){Rt.debug(mn.kind+" ended event"),mn.kind==="audio"&&an!==null?(clearTimeout(an),an=null):mn.kind==="video"&&(hn!==null&&(clearTimeout(hn),hn=null),Vt.callType!=="screenSharing"&&Vt.callType!=="screenSharingWithAudio"||Vt.stopScreenSharing())}},rn=st(this.stream.getVideoTracks());try{for(rn.s();!(Pt=rn.n()).done;)Qt(Pt.value)}catch(mn){rn.e(mn)}finally{rn.f()}var Jt,sn=st(this.stream.getAudioTracks());try{for(sn.s();!(Jt=sn.n()).done;)Qt(Jt.value)}catch(mn){sn.e(mn)}finally{sn.f()}this.callType!=="screenSharing"&&this.callType!=="screenSharingWithAudio"||(this.stream.onended=this.callback(this,"stopScreenSharing"))},this.onUserMediaSuccess=function(Pt){var Vt=this;this.applyFiltersIfNeeded(Pt).then(function(Qt){var rn=null,Jt=null,sn=!1,mn=Vt.getOwnerCallInfo(),an=Vt.getCall(mn);Rt.info("[ApiCCUserMediaStream] onUserMediaSuccess; userMediaStreamId: "+Vt.userMediaStreamId),Vt.getUserMediaTimeoutId!==null&&(clearTimeout(Vt.getUserMediaTimeoutId),Vt.getUserMediaTimeoutId=null),an&&(Rt.debug("call exist"),Jt=an.callee?an.callerId:an.calleeId,sn=an.restarted),Vt.updateMediaProperties(Qt),Vt.stream=Qt,nt.Xh!=="Chrome"&&nt.Xh!=="Mobile Safari"||Vt.setUserMediaAccessAllowed(!0),Vt.notifyUserMediaSuccess===!0&&(mn&&(rn=mn.callId),Lt.createUserMediaSuccessEvent(rn!==null,Vt.audio,Vt.audioDeviceLabel,Vt.video,Vt.videoDeviceLabel,Vt.callType,rn,Qt,Jt,sn,Vt.userMediaStreamId)),Vt.listenForMuteEvents(),Rt.debug("Starting a new getMediaDevices after userMediaSuccess"),apiCC.mediaDeviceMgr.getMediaDevices("updatedAfterGetUserMediaSuccess"),Vt.callbacks.success(Vt)})},this.updateMediaProperties=function(Pt){var Vt=!1,Qt="Unknown",rn="Unknown",Jt=!1,sn="Unknown";Pt.getAudioTracks().length>0&&(Vt=!0,Pt.getAudioTracks()[0].label&&(Qt=Pt.getAudioTracks()[0].label,rn=Pt.getAudioTracks()[0].id,apiCC.audioProcessor.listenToAudio(Pt,this)),Pt.getAudioTracks()[0].enabled===!1&&(this.audioMuted=!0),Pt.getAudioTracks()[0].muted===!0&&(this.audioSilent=!0)),Pt.getVideoTracks().length>0&&(Jt=!0,Pt.getVideoTracks()[0].label&&(sn=Pt.getVideoTracks()[0].label),Pt.getVideoTracks()[0].enabled===!1&&(this.videoMuted=!0),Pt.getVideoTracks()[0].muted===!0&&(this.videoSilent=!0)),this.audio=Vt,this.audioDeviceLabel=Qt,this.audioDeviceId=rn,this.video=Jt,this.videoDeviceLabel=sn},this.manageFailure=function(Pt){var Vt={};kt(Pt)==="object"?(Vt.message=Pt.message,Vt.code=Pt.code,Vt.name=Pt.name):Vt=Pt,this.callbacks.failure(this,Vt)},this.onUserMediaError=function(Pt){var Vt=function(sn){for(var mn=apiCC.userMediaStreamTable.length;--mn>=0;)if(apiCC.userMediaStreamTable[mn].userMediaStreamId===sn){apiCC.userMediaStreamTable.splice(mn,1);break}},Qt=null,rn=this.getOwnerCallInfo();if(Rt.info("[ApiCCUserMediaStream] onUserMediaError; userMediaStreamId: "+this.userMediaStreamId+", error: "+Pt),this.getUserMediaTimeoutId!==null&&(Pt!=="timeout"&&clearTimeout(this.getUserMediaTimeoutId),this.getUserMediaTimeoutId=null),nt.$6!=="electron"&&(nt.Xh==="Chrome"||nt.Xh==="Mobile Chrome")&&nt.PR>47&&window.location.protocol!=="https:"&&Rt.error("HTTPS is now mandatory to use getUserMedia()"),rn!==null&&(Qt=rn.callId),this.callType==="media"&&nt.ag.name==="iOS"&&nt.Xh==="Mobile Safari"&&this.iOSMediaSelectionWorkAroundApplied===!1||Lt.createUserMediaErrorEvent(Qt!==null,this.callType,Pt,this.userMediaStreamId,Qt,this.tryAudioCallAfterUserMediaError,this.gum_config),Pt!=="timeout"&&this.callType==="media")if(nt.ag.name==="iOS"&&nt.Xh==="Mobile Safari"&&this.iOSMediaSelectionWorkAroundApplied===!1){Rt.warn("try mediaDevice selection workaround on iOS / Mobile Safari - after MediaError"),this.iOSMediaSelectionWorkAroundApplied=!0,this.gum_config.video={};var Jt=apiCC.getMediaDeviceLabelFromDeviceid(this.inputs.videoSourceId);Rt.log("getMediaDeviceLabelFromDeviceid :",Jt),Jt==="Caméra arrière"||Jt==="Back Camera"?(Rt.log("Setting FacingMode to environment :",Jt),this.gum_config=apiCC.setVideoFacingModeInConstraint("environment",this.gum_config)):(Rt.log("Setting FacingMode to user :",Jt),this.gum_config=apiCC.setVideoFacingModeInConstraint("user",this.gum_config)),this.inputs.videoSourceId=null,this.getUserMedia()}else this.tryAudioCallAfterUserMediaError===!0?(Rt.warn("try AudioCall after UserMediaError is activated"),this.tryAudioCallAfterUserMediaError=!1,this.gum_config.video!==!1?(Rt.debug("[ApiCCUserMediaStream] Trying to getUserMedia with audioOnly"),this.inputs.videoSourceId=null,this.gum_config.video=!1,this.getUserMedia()):(Vt(this.userMediaStreamId),this.manageFailure(Pt))):(Vt(this.userMediaStreamId),this.manageFailure(Pt));else Vt(this.userMediaStreamId),this.manageFailure(Pt)},this.getDisplayMediaProcess=function(){var Pt=this;Rt.debug("using getDisplayMedia with browser :",nt.Xh),Rt.debug("displayMediaStreamConstraints :",this.displayMediaStreamConstraints),kt(this.displayMediaStreamConstraints)==="object"&&Array.isArray(this.displayMediaStreamConstraints)!==!0||(Rt.warn("Defined displayMediaStreamConstraints format is not correct, reinitialization ..."),at.wL.type==="chrome"&&at.wL.version>=72&&at.wL.version<=73?this.displayMediaStreamConstraints={video:!0,audio:!1}:this.displayMediaStreamConstraints={video:!0,audio:!0},Rt.debug("displayMediaStreamConstraints :",this.displayMediaStreamConstraints)),typeof apiRTC_React<"u"?(Rt.debug("getDisplayMedia - React version"),mediaDevices.getDisplayMedia(this.displayMediaStreamConstraints).then(function(Vt){Rt.info("getDisplayMedia React stream available"),Pt.onUserMediaSuccess(Vt)}).catch(function(Vt){Rt.debug("getDisplayMedia - React version error : ",Vt),Pt.onUserMediaError(Vt)})):navigator.getDisplayMedia?(Rt.debug("navigator.getDisplayMedia defined"),navigator.getDisplayMedia(this.displayMediaStreamConstraints).then(function(Vt){Rt.debug("getDisplayMedia stream available"),Pt.onUserMediaSuccess(Vt)}).catch(function(Vt){Rt.debug("getDisplayMedia error :",Vt),Pt.onUserMediaError(Vt)})):navigator.mediaDevices.getDisplayMedia?(Rt.debug("navigator.mediaDevices.getDisplayMedia defined"),navigator.mediaDevices.getDisplayMedia(this.displayMediaStreamConstraints).then(function(Vt){Rt.debug("getDisplayMedia stream available"),Pt.onUserMediaSuccess(Vt)}).catch(function(Vt){Rt.debug("getDisplayMedia error :",Vt),Pt.onUserMediaError(Vt)})):(Rt.debug("getDisplayMedia not available"),Lt.createDesktopCaptureEvent("Browser_Not_Compatible"))},this.getScreenMedia=function(){if(Rt.debug("[ApiCCUserMediaStream] getScreenMedia; userMediaStreamId: "+this.userMediaStreamId),this.stream===null)if(nt.Xh==="Chrome"||nt.Xh==="Firefox"&&nt.PR>=52)if(nt.Xh==="Chrome")if(Rt.log("shareScreen on Chrome"),nt.PR>=72&&this.forceExtensionOnChrome===!1)this.getDisplayMediaProcess();else{if(Rt.debug("this.captureSourceType :",this.captureSourceType),apiCC.apiRTCExtensionInstalled===!1)return apiCC.waitingShareScreenUserMediaStreamId=this.userMediaStreamId,function(Pt){Rt.debug("[ApiCCUserMediaStream] moveUserMediaEntryInWaitingScreen: "+Pt);for(var Vt=apiCC.userMediaStreamTable.length;--Vt>=0;)if(apiCC.userMediaStreamTable[Vt].userMediaStreamId===Pt){apiCC.waitingShareScreenUserMediaStream=apiCC.userMediaStreamTable.splice(Vt,1);break}}(this.userMediaStreamId),void apiCC.manageNotInstalledExtension("getScreenMedia","getScreenMedia",this.captureSourceType);this.captureSourceType!==void 0&&this.captureSourceType!==null||(this.captureSourceType=["screen","window","tab"]),Array.isArray(this.captureSourceType)===!1&&(Rt.warn("Defined captureSourceType format is not correct, reinitialization ..."),this.captureSourceType=["screen","window","tab"],Rt.debug("this.captureSourceType :",this.captureSourceType)),window.postMessage({command:"getDesktopId",callNumber:this.userMediaStreamId,remoteId:"getScreenMedia",captureSourceType:this.captureSourceType,browser_major_version:nt.PR},"*")}else Rt.log("shareScreen on Firefox"),nt.PR>=67?this.getDisplayMediaProcess():(this.captureSourceType!==void 0&&this.captureSourceType!==null||(this.captureSourceType="screen"),typeof this.captureSourceType=="string"&&(Rt.warn("Defined captureSourceType format is not correct, reinitialization ..."),this.captureSourceType="screen",Rt.debug("this.captureSourceType :",this.captureSourceType)),this.registerScreenMedia(this.captureSourceType));else this.getDisplayMediaProcess()},this.registerScreenMedia=function(Pt,Vt){var Qt=null,rn=this.getOwnerCallInfo(),Jt=this.getCall(rn),sn=null;if(Rt.debug("[ApiCCUserMediaStream] registerScreenMedia; userMediaStreamId: "+this.userMediaStreamId),Vt==="mediaError")Jt!==null?(sn=Jt.callee===!0?Jt.callerId:Jt.calleeId,Jt.callType==="screenSharing"||Jt.callType==="screenSharingWithAudio"?apiCC.session.apiCCWebRTCClient.webRTCClient.removeCallFromTableWithCallIdandRemoteId(Jt.callId,sn,"Media_Error"):Rt.log("switch video / screen : call is not removed"),window.location.protocol!=="https:"&&Rt.log("Please connect to your web page using 'HTTPS'. This is mandatory for desktop capture"),Lt.createDesktopCaptureEvent("UserMediaError",Jt.callId,sn)):(Rt.log("Call not found on message EventListener"),Lt.createDesktopCaptureEvent("UserMediaError")),function(mn){for(var an=apiCC.userMediaStreamTable.length;--an>=0;)if(apiCC.userMediaStreamTable[an].userMediaStreamId===mn){apiCC.userMediaStreamTable.splice(an,1);break}}(this.userMediaStreamId),this.callbacks.failure(this,"UserMediaError");else try{if(nt.Xh==="Chrome")Rt.log("desktopId: "+Vt),Qt={video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:Vt}}};else{if(Rt.log("captureSourceType: "+Pt),Pt!=="screen"&&Pt!=="window"&&Pt!=="application")return void Rt.error("captureSourceType value is not correct");Qt={video:{mediaSource:Pt}}}nt.Xh==="IE"&&nt.dc>8?apiCC.getUserMediaWithCB(Qt,this.callback(this,"onUserMediaSuccess"),this.callback(this,"onUserMediaError")):apiCC.getUserMedia(Qt).then(this.callback(this,"onUserMediaSuccess")).catch(this.callback(this,"onUserMediaError"))}catch(mn){Rt.error("getUserMedia() failed. Is this a WebRTC capable browser?"),Rt.log("getUserMedia failed with exception: "+mn.message)}},this.stopScreenSharing=function(){Rt.debug("[ApiCCUserMediaStream] stopScreenSharing; userMediaStreamId: "+this.userMediaStreamId);var Pt=!0;if(apiRTC.session.remoteAccessInvitation!==null&&this.userMediaStreamId===apiRTC.session.remoteAccessInvitation.screenSharingStreamId&&(Rt.debug("this is a remote access screenSharing, need to stop remote access"),apiRTC.session.remoteAccessInvitation.stop(!0,{code:"SCREEN_SHARING_STOP"})),apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient)for(var Vt=this.callInfoList.length;--Vt>=0;)this.callInfoList[Vt].owner===!0&&(Pt=!1),apiCC.session.apiCCWebRTCClient.webRTCClient.onHangup(this.callInfoList[Vt].callId);Pt===!0&&this.release()},this.getCall=function(Pt){var Vt=null;return Pt&&apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient&&(Pt.flavor==="call"?Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(Pt.callId):Pt.flavor==="userMedia"&&(Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(Pt.callId))),Vt},this.getOwnerCallInfo=function(){for(var Pt=this.callInfoList.length;--Pt>=0;)if(this.callInfoList[Pt].owner===!0)return this.callInfoList[Pt];return null},this.getCallInfo=function(Pt){for(var Vt=this.callInfoList.length;--Vt>=0;)if(this.callInfoList[Vt].callId===Pt)return this.callInfoList[Vt];return null},this.containsCallInfo=function(Pt){for(var Vt=!1,Qt=this.callInfoList.length;--Qt>=0;)if(this.callInfoList[Qt].callId===Pt){Vt=!0;break}return Vt},this.addCallInfo=function(Pt,Vt,Qt){return Pt!==null&&typeof Pt=="string"&&(Vt!=="call"&&Vt!=="userMedia"&&(Vt="call"),Qt!==null&&typeof Qt=="boolean"||(Qt=!1),!this.containsCallInfo(Pt))&&(this.callInfoList.push({callId:Pt,flavor:Vt,owner:Qt}),!0)},this.removeCallInfo=function(Pt){for(var Vt=!1,Qt=this.callInfoList.length;--Qt>=0;)if(this.callInfoList[Qt].callId===Pt){this.callInfoList.splice(Qt,1),Vt=!0;break}return Vt},this.accessToLocalMedia=function(){return this.callType!=="screenSharing"&&this.callType!=="screenSharingWithAudio"&&this.callType!=="data"&&this.stream!==null},this.muteAudioOnStreams=function(){var Pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"enabled";return Rt.debug("[ApiCCUserMediaStream] muteAudioOnStreams; userMediaStreamId: "+this.userMediaStreamId),this.stream.getAudioTracks().forEach(function(Vt){Vt.enabled=!1}),Pt==="enabled"?this.audioMuted=!0:Pt==="muted"&&(this.audioSilent=!0),this.notifyMLineMuted("audio",!0,Pt),{type:"audio",muted:!0}},this.unMuteAudioOnStreams=function(){var Pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"enabled";return Rt.debug("[ApiCCUserMediaStream] unMuteAudioOnStreams; userMediaStreamId: "+this.userMediaStreamId),this.stream.getAudioTracks().forEach(function(Vt){Vt.enabled=!0}),Pt==="enabled"?this.audioMuted=!1:Pt==="muted"&&(this.audioSilent=!1),this.notifyMLineMuted("audio",!1,Pt),{type:"audio",muted:!1}},this.muteVideoOnStreams=function(){var Pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"enabled";return Rt.debug("[ApiCCUserMediaStream] muteVideoOnStreams; userMediaStreamId: "+this.userMediaStreamId),this.stream.getVideoTracks().forEach(function(Vt){Vt.enabled=!1}),Pt==="enabled"?this.videoMuted=!0:Pt==="muted"&&(this.videoSilent=!0),this.notifyMLineMuted("video",!0,Pt),{type:"video",muted:!0}},this.unMuteVideoOnStreams=function(){var Pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"enabled";return Rt.debug("[ApiCCUserMediaStream] unMuteVideoOnStreams; userMediaStreamId: "+this.userMediaStreamId),this.stream.getVideoTracks().forEach(function(Vt){Vt.enabled=!0}),Pt==="enabled"?this.videoMuted=!1:Pt==="muted"&&(this.videoSilent=!1),this.notifyMLineMuted("video",!1,Pt),{type:"video",muted:!1}},this.removeVideoTrackOnStreams=function(){var Pt;return Rt.debug("[ApiCCUserMediaStream] removeVideoTrackOnStreams; userMediaStreamId: "+this.userMediaStreamId),(Pt=this.stream.getVideoTracks()).length>0&&this.stream.removeTrack(Pt[0]),this.video=!1,{type:"video",present:!1}},this.notifyMLineMuted=function(Pt,Vt,Qt){var rn,Jt,sn=!0;if(apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient)for(var mn=this.callInfoList.length;--mn>=0;)this.callInfoList[mn].flavor==="call"?(rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(this.callInfoList[mn].callId),this.notifyMLineMutedCall(Pt,Vt,Qt,rn,null)):this.callInfoList[mn].flavor==="userMedia"&&(Jt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(this.callInfoList[mn].callId),this.notifyMLineMutedCall(Pt,Vt,Qt,null,Jt)),this.callInfoList[mn].owner===!0&&(sn=!1);sn===!0&&this.notifyMLineMutedCall(Pt,Vt,Qt,null,null)},this.notifyMLineMutedCall=function(Pt,Vt,Qt,rn,Jt){Rt.debug("notifyMLineMutedCall; mline: "+Pt+", muted: "+Vt);var sn=[];Qt==="enabled"?sn=[Pt+"IsMuted"]:Qt==="muted"&&(sn=[Pt+"IsSilent"]);var mn={available:this.audio,deviceLabel:this.audioDeviceLabel,active:!0,muted:this.audioMuted,silent:this.audioSilent},an={available:this.video,deviceLabel:this.videoDeviceLabel,active:!0,muted:this.videoMuted,silent:this.videoSilent},hn=null;rn?(Pt==="audio"?rn.isLocalAudioMuted=Vt:Pt==="video"&&(rn.isLocalVideoMuted=Vt),rn.belongsToRoom()?(hn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:rn.callId,roomId:rn.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,mline:Pt},rn.data.mesh&&(hn.mesh=rn.data.mesh),Qt==="muted"?(hn.change="silent",hn.silent=Vt,rn.myWebRTC_Stack.sendInfo("streamTrackStatusChanged",hn)):Qt==="enabled"&&(hn.muted=Vt,rn.myWebRTC_Stack.sendInfo("streamTrackChanged",hn))):(hn={callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,calleeId:rn.callee?rn.callerId:rn.calleeId,callId:rn.callId,mline:Pt},Qt==="muted"?(hn.type="streamTrackStatusChanged",hn.change="silent",hn.silent=Vt):Qt==="enabled"&&(hn.type="streamTrackChanged",hn.muted=Vt),rn.myWebRTC_Stack.sendDataMessage(apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,hn)),mn.active=rn.localCallProfile.audioActive,an.active=rn.localCallProfile.videoActive,Lt.createLocalStreamUpdatedEvent(sn,mn,an,!0,rn.callType,rn.callId,this.stream,this.userMediaStreamId,"userAction")):Jt?(hn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Jt.userMediaId,roomId:Jt.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,mline:Pt},Qt==="muted"?(hn.change="silent",hn.silent=Vt,Jt.myWebRTC_Stack.sendInfo("streamTrackStatusChanged",hn)):Qt==="enabled"&&(hn.muted=Vt,Jt.myWebRTC_Stack.sendInfo("streamTrackChanged",hn)),Jt.audioSdpDirection==="inactive"&&(mn.active=!1),Jt.videoSdpDirection==="inactive"&&(an.active=!1),Lt.createLocalStreamUpdatedEvent(sn,mn,an,!0,Jt.callType,Jt.userMediaId,this.stream,this.userMediaStreamId,"userAction")):Lt.createLocalStreamUpdatedEvent(sn,mn,an,!1,null,null,this.stream,this.userMediaStreamId,"userAction")},this.notifyActiveSpeaker=function(Pt){var Vt,Qt,rn=!0;if(apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient)for(var Jt=this.callInfoList.length;--Jt>=0;)this.callInfoList[Jt].flavor==="call"?(Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(this.callInfoList[Jt].callId),this.notifyActiveSpeakerCall(Pt,Vt,null)):this.callInfoList[Jt].flavor==="userMedia"&&(Qt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(this.callInfoList[Jt].callId),this.notifyActiveSpeakerCall(Pt,null,Qt)),this.callInfoList[Jt].owner===!0&&(rn=!1);rn===!0&&this.notifyActiveSpeakerCall(Pt,null,null)},this.notifyActiveSpeakerCall=function(Pt,Vt,Qt){var rn=null;Vt?(Vt.belongsToRoom()?(rn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Vt.callId,roomId:Vt.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,resolve:!0,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Vt.data.mesh&&(rn.mesh=Vt.data.mesh),Vt.myWebRTC_Stack.sendInfo("activeSpeaker",rn)):(rn={type:"activeSpeaker",callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,calleeId:Vt.callee?Vt.callerId:Vt.calleeId,callId:Vt.callId,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Vt.myWebRTC_Stack.sendDataMessage(apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,rn)),Lt.createAudioAmplitudeEvent(Pt,!0,Vt.callId,this.userMediaStreamId)):Qt?(rn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Qt.userMediaId,roomId:Qt.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,resolve:!0,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Qt.myWebRTC_Stack.sendInfo("activeSpeaker",rn),Lt.createAudioAmplitudeEvent(Pt,!0,Qt.userMediaId,this.userMediaStreamId)):Lt.createAudioAmplitudeEvent(Pt,!0,null,this.userMediaStreamId)},this.notifyNotActiveSpeaker=function(Pt){var Vt,Qt,rn=!0;if(apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient)for(var Jt=this.callInfoList.length;--Jt>=0;)this.callInfoList[Jt].flavor==="call"?(Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(this.callInfoList[Jt].callId),this.notifyNotActiveSpeakerCall(Pt,Vt,null)):this.callInfoList[Jt].flavor==="userMedia"&&(Qt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(this.callInfoList[Jt].callId),this.notifyNotActiveSpeakerCall(Pt,null,Qt)),this.callInfoList[Jt].owner===!0&&(rn=!1);rn===!0&&this.notifyNotActiveSpeakerCall(Pt,null,null)},this.notifyNotActiveSpeakerCall=function(Pt,Vt,Qt){var rn=null;Vt?(Vt.belongsToRoom()?(rn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Vt.callId,roomId:Vt.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,resolve:!0,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Vt.data.mesh&&(rn.mesh=Vt.data.mesh),Vt.myWebRTC_Stack.sendInfo("stopSpeaking",rn)):(rn={type:"stopSpeaking",callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,calleeId:Vt.callee?Vt.callerId:Vt.calleeId,callId:Vt.callId,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Vt.myWebRTC_Stack.sendDataMessage(apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,rn)),Lt.createAudioAmplitudeEvent(Pt,!1,Vt.callId,this.userMediaStreamId)):Qt?(rn={clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Qt.userMediaId,roomId:Qt.sessionMCU.roomName,pubSub:apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector,resolve:!0,descriptor:{audioAmplitude:Pt,streamID:this.userMediaStreamId}},Qt.myWebRTC_Stack.sendInfo("stopSpeaking",rn),Lt.createAudioAmplitudeEvent(Pt,!1,Qt.userMediaId,this.userMediaStreamId)):Lt.createAudioAmplitudeEvent(Pt,!1,null,this.userMediaStreamId)},this.callback=function(Pt,Vt){return this.closureHandler=function(Qt,rn){return Pt[Vt](Qt,rn)},this.closureHandler},this.isUserMediaAccessAllowed=function(){return localStorage!==null&&(typeof localStorage>"u"?"undefined":kt(localStorage))==="object"&&typeof localStorage.getItem=="function"?localStorage.getItem(Et)==="true":null},this.setUserMediaAccessAllowed=function(Pt){return localStorage!==null&&(typeof localStorage>"u"?"undefined":kt(localStorage))==="object"&&typeof localStorage.setItem=="function"?(localStorage.setItem(Et,Pt?"true":"false"),!!Pt):null},this.applyFiltersIfNeeded=function(Pt){return this.filters===null?Promise.resolve(Pt):(this.mediaFilterManager=new qt(Pt,this.filters,this.userMediaStreamId),this.mediaFilterManager.applyFilters())},this.getVideoSettings=function(){if(this.videoSettings!==!1)return this.videoSettings;var Pt=this.getVideoTrack();if(!Pt||typeof Pt.getSettings!="function")return this.videoSettings=null,this.videoSettings;var Vt=Pt.getSettings();return Vt?(this.videoSettings={},Object.prototype.hasOwnProperty.call(Vt,"width")&&(this.videoSettings.width=Vt.width),Object.prototype.hasOwnProperty.call(Vt,"height")&&(this.videoSettings.height=Vt.height),Object.prototype.hasOwnProperty.call(Vt,"frameRate")&&(this.videoSettings.frameRate=Vt.frameRate),this.videoSettings):(this.videoSettings=null,this.videoSettings)},this.isSimulcastCompliant=function(){return!!this.getVideoSettings()},this.getSimulcastProfile=function(){var Pt=this.getVideoSettings();if(!Pt)return null;var Vt={substream:{high:{active:!0,selectable:!0},medium:{active:!0,selectable:!0},low:{active:!0,selectable:!0}},temporal:{high:{active:!0,selectable:!0},medium:{active:!0,selectable:!0},low:{active:!0,selectable:!0}}};return at.wL.type==="chrome"&&((Pt.width<1280||Pt.height<720)&&(Vt.substream.low.selectable=!1),Vt.temporal.high.active=!1,Vt.temporal.high.selectable=!1),Vt}}},1192:(rt,it,s)=>{s.d(it,{D:()=>Nn}),s(3710),s(1539),s(9714),s(2772),s(8674);var et=s(1549),nt=(s(4916),s(5306),s(2564),s(4812),s(561),s(5735),s(3753),s(4603),s(6755),s(9554),s(4747),s(6992),s(8783),s(3948),s(9601),s(8309),s(8264),s(9575),s(2472),s(2990),s(8927),s(3105),s(5035),s(4345),s(7174),s(2846),s(4731),s(7209),s(6319),s(8867),s(7789),s(3739),s(9368),s(4483),s(2056),s(3462),s(678),s(7462),s(3824),s(5021),s(2974),s(5016),s(7042),s(7941),s(2526),s(1817),s(2165),s(5945)),at=s(4708),ht=s(940);function dt(qt){return dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(kt){return typeof kt}:function(kt){return kt&&typeof Symbol=="function"&&kt.constructor===Symbol&&kt!==Symbol.prototype?"symbol":typeof kt},dt(qt)}function ut(){this.sdp={original:null,global:[],mlines:[]},this.mlines=[]}function lt(qt){var kt=new ut,st=qt.split(`\r -`),Tt=0,Rt=null,Lt=null,Et=null,jt=null;for(kt.sdp.original=qt;Tt=0;)kt.mlines[Tt].type!=="audio"||kt.audio?kt.mlines[Tt].type!=="video"||kt.video||(kt.video=kt.mlines[Tt]):kt.audio=kt.mlines[Tt],kt.unifiedPlan===!0&&kt.mlines[Tt].mid!==String(Tt)&&(kt.unifiedPlan=!1);return kt.isAudioActive=mt.bind(null,kt,"audio"),kt.isVideoActive=mt.bind(null,kt,"video"),kt}function mt(qt,kt){return!(kt!=="audio"&&kt!=="video"||qt===null||dt(qt)!=="object"||!Object.prototype.hasOwnProperty.call(qt,kt)||qt[kt]===null||dt(qt[kt])!=="object"||qt[kt].direction!=="sendrecv"&&qt[kt].direction!=="sendonly"&&qt[kt].direction!=="recvonly")}s(3123),s(4765),s(4723),s(9600),s(1058),s(9826),ut.prototype.mungeForSimulcasting=function(){if(this.simulcasting!==!0){this.simulcasting=!0;for(var qt=0;qt=0;){var Pt=Math.floor(4294967295*Math.random());kt.ssrcs.push({original:Pt,ssrc:Pt,content:{cname:st,msid:Tt,mslabel:Rt,label:Lt}});var Vt=Math.floor(4294967295*Math.random());kt.ssrcs.push({original:Vt,ssrc:Vt,content:{cname:st,msid:Tt,mslabel:Rt,label:Lt}}),kt.ssrc_groups.fid.push([Pt,Vt]),Et.push(Pt)}kt.ssrc_groups.sim.push(Et)}}}},ut.prototype.generate=function(){for(var qt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},kt=[],st=0;st0&&(kt.push("a=fmtp:"),kt.push(sn),kt.push(" "),kt.push(wn.join(";")),kt.push(`\r -`))}continue}continue}if(Jt[1]==="rtcp-fb"||Jt[1]==="fmtp")continue;throw new Error("internal error")}if(rn.match(/^a=mid:(\w+)$/))kt.push("a=mid:"),kt.push(jt.mid),kt.push(`\r -`),jt.bandwidth>0&&(kt.push("b=AS:"),kt.push(jt.bandwidth),kt.push(`\r -`),kt.push("b=TIAS:"),kt.push(jt.bandwidth),kt.push("000"),kt.push(`\r -`));else if(rn!=="a=sendrecv"&&rn!=="a=recvonly"&&rn!=="a=sendonly"&&rn!=="a=inactive"){if(!rn.match(/^a=ssrc-group:SIM (.+)$/)){if(!rn.match(/^a=ssrc-group:FID (.+)$/)){if(rn.match(/^a=ssrc:(\d+) (.+)$/)){if(Pt)continue;Pt=!0;for(var xn=0;xn=0;st--)(Rt=this.extractSdp(qt[st],/a=rtpmap:(\d+) CN\/\d+/i))&&((Lt=Tt.indexOf(Rt))!==-1&&Tt.splice(Lt,1),qt.splice(st,1));return qt[kt]=Tt.join(" "),qt},this.extractSdp=function(qt,kt){var st=qt.match(kt);return st&&st.length==2?st[1]:null},this.setDefaultCodec=function(qt,kt){var st=0,Tt=qt.split(" "),Rt=Tt.slice(0,3);for(Rt.push(kt),st=3;stqt.length)&&(kt=qt.length);for(var st=0,Tt=new Array(kt);st=Jt.length?{done:!0}:{done:!1,value:Jt[an++]}},e:function(En){throw En},f:hn}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var wn,Mn=!0,xn=!1;return{s:function(){mn=mn.call(Jt)},n:function(){var En=mn.next();return Mn=En.done,En},e:function(En){xn=!0,wn=En},f:function(){try{Mn||mn.return==null||mn.return()}finally{if(xn)throw wn}}}}(Et);try{for(Pt.s();!(jt=Pt.n()).done;){var Vt=jt.value,Qt=Vt.match,rn=Vt.callback;Qt(this._err)&&rn(this._err,this._data,this._interrupted)}}catch(Jt){Pt.e(Jt)}finally{Pt.f()}}},{key:"clear",value:function(){this.clearTimeout(),this.removeCallback()}},{key:"setTimeout",value:function(Tt){function Rt(Lt,Et,jt){return Tt.apply(this,arguments)}return Rt.toString=function(){return Tt.toString()},Rt}(function(Tt,Rt,Lt){var Et=this;this.clearTimeout(),this._timeout=setTimeout(Rt===null?function(){Et._fulfill(null,Lt,!0)}:function(){Et._fulfill(typeof Rt=="string"?new Error(Rt):Rt,void 0,!0)},Tt)})},{key:"clearTimeout",value:function(Tt){function Rt(){return Tt.apply(this,arguments)}return Rt.toString=function(){return Tt.toString()},Rt}(function(){this._timeout!==null&&(clearTimeout(this._timeout),this._timeout=null)})},{key:"onFulfillment",value:function(Tt){this._callbacks.push({match:vt,callback:Tt})}},{key:"onSuccess",value:function(Tt){this._callbacks.push({match:bt,callback:Tt})}},{key:"onFailure",value:function(Tt){this._callbacks.push({match:At,callback:Tt})}},{key:"removeCallback",value:function(Tt){if(typeof Tt=="function"){var Rt=this._callbacks.findIndex(function(Lt){return Lt.callback===Tt});Rt>=0&&this._callbacks.splice(Rt,1)}else this._callbacks.splice(0,this._callbacks.length)}},{key:"fulfill",value:function(Tt,Rt){Tt===null?this._fulfill(null,Rt,!1):this._fulfill(typeof Tt=="string"?new Error(Tt):Tt,void 0,!1)}}],st&&yt(kt.prototype,st),Object.defineProperty(kt,"prototype",{writable:!1}),qt}(),St=(s(1249),s(7327),s(3843),function(qt,kt,st,Tt,Rt,Lt,Et,jt){this.rawStats={},this.rawStats.connectedPair=[],this.rawStats.audio_send=[],this.rawStats.audio_recv=[],this.rawStats.video_send=[],this.rawStats.video_recv=[],this.instantRTT=0,this.moyRttCP=[0,0,0,0,0,0,0,0,0,0],this.moyRttAS=[0,0,0,0,0,0,0,0,0,0],this.moyRttVS=[0,0,0,0,0,0,0,0,0,0],this.tauxPacketLossAS=[0],this.oldLostAS=this.oldSentAS=0,this.oldLostVS=this.oldLostVS=0,this.cptTaux=0,this.tauxPacketLossVS=[0],this.oldBandwidthAS=0,this.oldBandwidthVS=0,this.oldBandwidthAR=0,this.oldBandwidthVR=0,this.bandwidthAS=[0,0,0,0,0,0,0,0,0,0],this.bandwidthAR=[0,0,0,0,0,0,0,0,0,0],this.bandwidthVS=[0,0,0,0,0,0,0,0,0,0],this.bandwidthVR=[0,0,0,0,0,0,0,0,0,0],this.qosIn=0,this.qosInAverage=0,this.qosInAverageCount=0,this.qosAudioIn=0,this.qosAudioInAverage=0,this.qosAudioInAverageCount=0,this.qosVideoIn=0,this.qosVideoInAverage=0,this.qosVideoInAverageCount=0,this.qosOut=0,this.qosOutAverage=0,this.qosOutAverageCount=0,this.qosAudioOut=0,this.qosAudioOutAverage=0,this.qosAudioOutAverageCount=0,this.qosVideoOut=0,this.qosVideoOutAverage=0,this.qosVideoOutAverageCount=0,this.onQosChange=kt,this.onQosAudioChange=st,this.onQosVideoChange=Tt,this.cpt=0,this.cptRes=5,this.cptDb=60,this.saveStatsFlag=!0,this.tabQosIn=[],this.tabQosAudioIn=[],this.tabQosVideoIn=[],this.tabQosOut=[],this.tabQosAudioOut=[],this.tabQosVideoOut=[],this.tabTimestamp=[],this.tabDelay=[],this.tabJitterBufferAudio=[],this.tabJitterBufferVideo=[],this.tabAudioRtt=[],this.tabVideoRtt=[],this.tabAudioBW=[],this.tabVideoBW=[],this.clientId=Et,this.callId=Rt,this.apiKey=Lt,this.socket=jt,this.interval=qt,this.insertStats=function(Pt,Vt,Qt,rn){var Jt,sn,mn,an=null;for(this.cpt=this.cpt+this.interval,Jt=0;Jt=5&&Xn<10?Jt=2:Xn>=10&&(Jt=3),Vn!==null&&Vn[1]){var cr=8*this.Average(this.bandwidthVS)/1024;cr<240?an=1:cr>=240&&cr<330?an=2:cr>=330&&(an=3)}this.rawStats.audio_recv.googJitterBufferMs<60?sn=3:this.rawStats.audio_recv.googJitterBufferMs>=60&&this.rawStats.audio_recv.googJitterBufferMs<100?sn=2:this.rawStats.audio_recv.googJitterBufferMs>=100&&(sn=1),this.rawStats.audio_recv.googCurrentDelayMs<100?mn=3:this.rawStats.audio_recv.googCurrentDelayMs>=100&&this.rawStats.audio_recv.googCurrentDelayMs<200?mn=2:this.rawStats.audio_recv.googCurrentDelayMs>=200&&(mn=1),Vn!==null&&Vn[1]&&(this.rawStats.video_recv.googJitterBufferMs<100?hn=3:this.rawStats.video_recv.googJitterBufferMs>=100&&this.rawStats.video_recv.googJitterBufferMs<200?hn=2:this.rawStats.video_recv.googJitterBufferMs>=200&&(hn=1));var dr=!1,ur=!1,Cr=!1;Vn!==null&&Vn[1]?(Math.ceil((Jt+2*an+hn+sn+mn)/6)!=this.qosIn&&(dr=!0),this.qosIn=Math.ceil((Jt+2*an+hn+sn+mn)/6),this.qosInAverage=(this.qosInAverage*this.qosInAverageCount+this.qosIn)/(this.qosInAverageCount+1),this.qosInAverageCount++,Math.ceil((Jt+sn+mn)/3)!=this.qosAudioIn&&(ur=!0),this.qosAudioIn=Math.ceil((Jt+sn+mn)/3),this.qosAudioInAverage=(this.qosAudioInAverage*this.qosAudioInAverageCount+this.qosAudioIn)/(this.qosAudioInAverageCount+1),this.qosAudioInAverageCount++,Math.ceil((2*an+hn)/3)!=this.qosVideoIn&&(Cr=!0),this.qosVideoIn=Math.ceil((2*an+hn)/3),this.qosVideoInAverage=(this.qosVideoInAverage*this.qosVideoInAverageCount+this.qosVideoIn)/(this.qosVideoInAverageCount+1),this.qosVideoInAverageCount++):(Math.ceil((Jt+sn+mn)/3)!=this.qosOut&&(dr=!0),this.qosIn=Math.ceil((Jt+sn+mn)/3),this.qosInAverage=(this.qosInAverage*this.qosInAverageCount+this.qosIn)/(this.qosInAverageCount+1),this.qosInAverageCount++,Math.ceil((Jt+sn+mn)/3)!=this.qosAudioIn&&(ur=!0),this.qosAudioIn=Math.ceil((Jt+sn+mn)/3),this.qosAudioInAverage=(this.qosAudioInAverage*this.qosAudioInAverageCount+this.qosAudioIn)/(this.qosAudioInAverageCount+1),this.qosAudioInAverageCount++),this.RttAverage(this.moyRttAS)<80?Mn=3:this.RttAverage(this.moyRttAS)>=80&&this.RttAverage(this.moyRttAS)<150?Mn=2:this.RttAverage(this.moyRttAS)>=150&&(Mn=1),this.tauxPacketLossAS<=5?wn=3:this.tauxPacketLossAS>5&&this.tauxPacketLossAS<10?wn=2:this.tauxPacketLossAS>=10&&(wn=1),this.rawStats.audio_recv.googJitterReceived<80?xn=3:this.rawStats.audio_recv.googJitterReceived>=80&&this.rawStats.audio_recv.googJitterReceived<150?xn=2:this.rawStats.audio_recv.googJitterReceived>=150&&(xn=1),Vn!==null&&Vn[1]&&(this.tauxPacketLossVS<=5?En=3:this.tauxPacketLossVS>5&&this.tauxPacketLossVS<10?En=2:this.tauxPacketLossVS>=10&&(En=1),this.RttAverage(this.moyRttVS)<80?kn=3:this.RttAverage(this.moyRttVS)>=80&&this.RttAverage(this.moyRttVS)<150?kn=2:this.RttAverage(this.moyRttVS)>=150&&(kn=1)),Vn!==null&&Vn[1]?(Math.ceil((Mn+2*wn+xn+2*En+kn)/7)!=this.qosOut&&(dr=!0),this.qosOut=Math.ceil((Mn+2*wn+xn+2*En+kn)/7),this.qosOutAverage=(this.qosOutAverage*this.qosOutAverageCount+this.qosOut)/(this.qosOutAverageCount+1),this.qosOutAverageCount++,Math.ceil((Mn+2*wn+xn)/4)!=this.qosAudioOut&&(ur=!0),this.qosAudioOut=Math.ceil((Mn+2*wn+xn)/4),this.qosAudioOutAverage=(this.qosAudioOutAverage*this.qosAudioOutAverageCount+this.qosAudioOut)/(this.qosAudioOutAverageCount+1),this.qosAudioOutAverageCount++,Math.ceil((2*En+kn)/3)!=this.qosVideoOut&&(Cr=!0),this.qosVideoOut=Math.ceil((2*En+kn)/3),this.qosVideoOutAverage=(this.qosVideoOutAverage*this.qosVideoOutAverageCount+this.qosVideoOut)/(this.qosVideoOutAverageCount+1),this.qosVideoOutAverageCount++):(Math.ceil((Mn+2*wn+xn)/4)!=this.qosOut&&(dr=!0),this.qosOut=Math.ceil((Mn+2*wn+xn)/4),this.qosOutAverage=(this.qosOutAverage*this.qosOutAverageCount+this.qosOut)/(this.qosOutAverageCount+1),this.qosOutAverageCount++,Math.ceil((Mn+2*wn+xn)/4)!=this.qosAudioOut&&(ur=!0),this.qosAudioOut=Math.ceil((Mn+2*wn+xn)/4),this.qosAudioOutAverage=(this.qosAudioOutAverage*this.qosAudioOutAverageCount+this.qosAudioOut)/(this.qosAudioOutAverageCount+1),this.qosAudioOutAverageCount++),dr&&this.onQosChange(this.qosIn,this.qosOut),ur&&this.onQosAudioChange(this.qosAudioIn,this.qosAudioOut),Cr&&this.onQosVideoChange(this.qosVideoIn,this.qosVideoOut)},this.getCodecs=function(Pt){var Vt=!1,Qt=!1,rn=null,Jt=null;if(Pt!=null&&Pt.sdp!==void 0){for(var sn=Pt.sdp.split(` -`),mn=0;mn0&&this.canceled!==!0?setTimeout(this.terminateTransfer.bind(this)):this.terminated!==!0&&(this.terminated=!0,this.recvDataEndAckTimeoutId&&(clearTimeout(this.recvDataEndAckTimeoutId),delete this.recvDataEndAckTimeoutId),delete this.call.dcfs,wt.debug("terminateTransfer; terminating"),this.call.pipelineCallId?(this.call.pipelineCall&&(delete this.call.pipelineCall.clientCall,delete this.call.pipelineCall,this.call.sendDataChannel=null),this.channel=null):setTimeout(function(){kt.channel.close(),kt.channel=null}),setTimeout(function(){if(kt.canceled===!0)Mt.createEvent({eventType:"onFileSended",callId:kt.call.callId,remoteId:kt.call.remoteId,name:kt.call.data.filename,error:"canceled"}),kt.call.callbacks.failure("canceled");else if(kt.call.failure)Mt.createEvent({eventType:"onFileSended",callId:kt.call.callId,remoteId:kt.call.remoteId,name:kt.call.data.filename,error:kt.call.failure}),kt.call.callbacks.failure(kt.call.failure);else{var st={eventType:"onFileSended",callId:kt.call.callId,remoteId:kt.call.remoteId,name:kt.call.data.filename};kt.call.success.data&&(st.data=kt.call.success.data),Mt.createEvent(st),kt.call.callbacks.success(kt.call.success)}apiCC.session.apiCCWebRTCClient.webRTCClient.onHangup(kt.call.callId)})):wt.warn("No data channel to send data, leaving terminateTransfer")},this.recvDataEndAckTimeout=function(){wt.error("recvDataEndAckTimeout"),this.call.failure="ackNotReceived",setTimeout(this.terminateTransfer.bind(this))},this.subsequentTransfer=function(){var kt,st=!1;if(wt.debug("subsequentTransfer; remByteCount: "+this.remByteCount),this.canceled!==!0)if(this.channel!==null)if(this.useBufferedAmount===!0&&this.channel.bufferedAmount>Ht)setTimeout(this.subsequentTransfer.bind(this));else try{for(;;){if(!(this.remByteCount>=this.chunkLength)){kt=this.data.slice(this.offset,this.offset+this.remByteCount),this.channel.send(kt),this.packetsSent+=1,wt.debug("packetSent "+this.packetsSent+" "+this.remByteCount),this.offset+=this.remByteCount,this.remByteCount-=this.remByteCount,st=!0;break}if(kt=this.data.slice(this.offset,this.offset+this.chunkLength),this.channel.send(kt),this.packetsSent+=1,wt.debug("packetSent "+this.packetsSent+" "+this.chunkLength),this.offset+=this.chunkLength,this.remByteCount-=this.chunkLength,this.remByteCount<=0){st=!0;break}if(this.useBufferedAmount!==!0||this.channel.bufferedAmount>Ht)break}st===!0?(Mt.createEvent({eventType:"onFileProgress",name:this.call.data.filename,sendChunkNb:this.packetsSent,fileSize:this.call.data.size,remainingSize:this.remByteCount,callId:this.call.callId,remoteId:this.call.remoteId,percentage:100}),this.call.callbacks.progress({state:"complete",filename:this.call.data.filename,size:this.call.data.size,remBytes:0,progress:100}),this.call.success={state:"complete",filename:this.call.data.filename,size:this.call.data.size,mediaURL:this.call.mediaURL,mediaId:this.call.mediaId},this.recvDataEndAckTimeoutId=setTimeout(this.recvDataEndAckTimeout.bind(this),3e4)):(Mt.createEvent({eventType:"onFileProgress",name:this.call.data.filename,sendChunkNb:this.packetsSent,fileSize:this.call.data.size,remainingSize:this.remByteCount,callId:this.call.callId,remoteId:this.call.remoteId,percentage:Math.floor(100*this.offset/this.call.data.size)}),this.call.callbacks.progress({state:"incomplete",filename:this.call.data.filename,size:this.call.data.size,remBytes:this.remByteCount,progress:Math.floor(100*this.offset/this.call.data.size)}),setTimeout(this.subsequentTransfer.bind(this)))}catch(Tt){return wt.error("transfer: "+Tt),this.call.failure="dataChannelFailed",void setTimeout(this.terminateTransfer.bind(this))}else wt.warn("No data channel to send data, leaving subsequentTransfer");else setTimeout(this.terminateTransfer.bind(this))},this.transfer=function(kt,st,Tt){var Rt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Lt=Rt.hasOwnProperty("delay")?Rt.delay:100;if(wt.info("transfer",st,Lt),this.call.beginTimeoutId&&(clearTimeout(this.call.beginTimeoutId),delete this.call.beginTimeoutId),this.data=kt,this.channel=Tt,this.channel!==null){typeof this.channel.bufferedAmount=="number"&&this.channel.bufferedAmount>=0&&(wt.debug("browserDetails",at.wL),at.wL.type==="chrome"?at.wL.version>=37&&(this.useBufferedAmount=!0,wt.debug("useBufferedAmount enabled")):(this.useBufferedAmount=!0,wt.debug("useBufferedAmount enabled"))),this.chunkLength=8192,st>0?(this.offset=Math.floor(st/this.chunkLength)*this.chunkLength,this.remByteCount=this.data.byteLength-this.offset):(this.offset=0,this.remByteCount=this.data.byteLength),this.packetsSent=0;try{var Et={chunkLength:this.chunkLength,offset:this.offset,remBytes:this.remByteCount};this.call.pipelineCallId&&(Et.pluginName=qt.data.pluginName,Et.pluginData=qt.data.pluginData,qt.data.context&&(Et.context=qt.data.context)),this.channel.send(JSON.stringify(Et))}catch(jt){return wt.error("transfer:",jt),this.call.failure="dataChannelFailed",void setTimeout(this.terminateTransfer.bind(this))}Mt.createEvent({eventType:"onFileSending",callId:this.call.callId,remoteId:this.call.remoteId,name:this.call.data.filename}),setTimeout(this.subsequentTransfer.bind(this),Lt)}else wt.warn("No data channel to send data, leaving transfer")}},Dt=(et.Y.get("CallStatsMonitor"),function(qt,kt,st,Tt){this.interval=qt,this.browserType=kt,this.browserVersion=st,this.flavor=Tt,this.prevData={},this.prevDataThreshold=10/qt,this.prevDataThreshold<2&&(this.prevDataThreshold=2),this.STANDARD_STAT_KEYS={audioReceived:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},videoReceived:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},remoteAudioSent:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},remoteVideoSent:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},audioSent:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},videoSent:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},remoteAudioReceived:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1},remoteVideoReceived:{codecId:!1,id:!1,ssrc:!1,trackId:!1,transportId:!1}},this.refineStats_chrome_proprietary=function(Rt,Lt){var Et,jt;for(Et=0;Et=0){if(Pt.stat("mediaType")==="audio")for(Rt.audioReceived={timestamp:Math.floor(Date.parse(Pt.timestamp))/1e3,type:"inbound-rtp",isRemote:!1,mediaType:"audio",packetsReceived:0,bytesReceived:0},Vt=Pt.names(),jt=0;jt=0){if(Pt.stat("mediaType")==="audio")for(Rt.audioSent={timestamp:Math.floor(Date.parse(Pt.timestamp))/1e3,type:"outbound-rtp",isRemote:!1,mediaType:"audio",packetsSent:0,bytesSent:0},Vt=Pt.names(),jt=0;jt=0){if(jt.mediaType==="audio"){for(Vt in Rt.audioReceived={},Pt=Math.floor(Date.parse(jt.timestamp)/1e3),jt)Vt==="timestamp"?Rt.audioReceived.timestamp=Pt:Rt.audioReceived[Vt]=jt[Vt];Et=!0}else if(jt.mediaType==="video"){for(Vt in Rt.videoReceived={},Pt=Math.floor(Date.parse(jt.timestamp)/1e3),jt)Vt==="timestamp"?Rt.videoReceived.timestamp=Pt:Rt.videoReceived[Vt]=jt[Vt];Et=!0}}else if(jt.type==="ssrc"&&jt.id.indexOf("send")>=0){if(jt.mediaType==="audio"){for(Vt in Rt.audioSent={},Pt=Math.floor(Date.parse(jt.timestamp)/1e3),jt)Vt==="timestamp"?Rt.audioSent.timestamp=Pt:Rt.audioSent[Vt]=jt[Vt];Et=!0}else if(jt.mediaType==="video"){for(Vt in Rt.videoSent={},Pt=Math.floor(Date.parse(jt.timestamp)/1e3),jt)Vt==="timestamp"?Rt.videoSent.timestamp=Pt:Rt.videoSent[Vt]=jt[Vt];Et=!0}}}),Et},this.refineStats_chrome_58=function(Rt,Lt){var Et=this,jt=!1;return Lt.forEach(function(Pt){if(Pt.type!=="inbound-rtp"||Pt.isRemote){if(Pt.type==="outbound-rtp"&&!Pt.isRemote){if(Pt.mediaType==="audio"){Rt.audioSent={};var Vt=Math.floor(Pt.timestamp/1e3);for(var Qt in Pt)Et.STANDARD_STAT_KEYS.audioSent[Qt]!==!1&&(Qt==="timestamp"?Rt.audioSent.timestamp=Vt:Rt.audioSent[Qt]=Pt[Qt]);jt=!0}else if(Pt.mediaType==="video"){Rt.videoSent={};var rn=Math.floor(Pt.timestamp/1e3);for(var Jt in Pt)Et.STANDARD_STAT_KEYS.videoSent[Jt]!==!1&&(Jt==="timestamp"?Rt.videoSent.timestamp=rn:Rt.videoSent[Jt]=Pt[Jt]);jt=!0}}}else if(Pt.mediaType==="audio"||Pt.id.indexOf("Audio")>=0){Rt.audioReceived={};var sn=Math.floor(Pt.timestamp/1e3);for(var mn in Pt)Et.STANDARD_STAT_KEYS.audioReceived[mn]!==!1&&(mn==="timestamp"?Rt.audioReceived.timestamp=sn:Rt.audioReceived[mn]=Pt[mn]);jt=!0}else if(Pt.mediaType==="video"||Pt.id.indexOf("Video")>=0){Rt.videoReceived={};var an=Math.floor(Pt.timestamp/1e3);for(var hn in Pt)Et.STANDARD_STAT_KEYS.videoReceived[hn]!==!1&&(hn==="timestamp"?Rt.videoReceived.timestamp=an:Rt.videoReceived[hn]=Pt[hn]);jt=!0}}),jt},this.refineStats_firefox_legacy=function(Rt,Lt){var Et=!1,jt=this;return Lt.forEach(function(Pt){var Vt=null,Qt=null;if(Pt.type==="inbound-rtp"&&Pt.isRemote===!1){if(Pt.mediaType==="audio"){for(Vt in Rt.audioReceived={packetsReceived:0,bytesReceived:0},Qt=Math.floor(Pt.timestamp/1e3),Pt)jt.STANDARD_STAT_KEYS.audioReceived[Vt]!==!1&&(Vt==="timestamp"?Rt.audioReceived.timestamp=Qt:Rt.audioReceived[Vt]=Pt[Vt]);Et=!0}else if(Pt.mediaType==="video"){for(Vt in Rt.videoReceived={packetsReceived:0,bytesReceived:0,framesDecoded:0},Qt=Math.floor(Pt.timestamp/1e3),Pt)jt.STANDARD_STAT_KEYS.videoReceived[Vt]!==!1&&(Vt==="timestamp"?Rt.videoReceived.timestamp=Qt:Rt.videoReceived[Vt]=Pt[Vt]);Et=!0}}else if(Pt.type==="outbound-rtp"&&Pt.isRemote===!1){if(Pt.mediaType==="audio"){for(Vt in Rt.audioSent={packetsSent:0,bytesSent:0},Qt=Math.floor(Pt.timestamp/1e3),Pt)jt.STANDARD_STAT_KEYS.audioSent[Vt]!==!1&&(Vt==="timestamp"?Rt.audioSent.timestamp=Qt:Rt.audioSent[Vt]=Pt[Vt]);Et=!0}else if(Pt.mediaType==="video"){for(Vt in Rt.videoSent={packetsSent:0,bytesSent:0,framesEncoded:0},Qt=Math.floor(Pt.timestamp/1e3),Pt)jt.STANDARD_STAT_KEYS.videoSent[Vt]!==!1&&(Vt==="timestamp"?Rt.videoSent.timestamp=Qt:Rt.videoSent[Vt]=Pt[Vt]);Et=!0}}}),Et},this.refineStats_firefox_63=function(Rt,Lt){var Et=!1,jt=this;return Lt.forEach(function(Pt){if(Pt.type!=="inbound-rtp"||Pt.isRemote){if(Pt.type==="outbound-rtp"&&!Pt.isRemote){if(Pt.kind==="audio"){Rt.audioSent={packetsSent:0,bytesSent:0};var Vt=Math.floor(Pt.timestamp/1e3);for(var Qt in Pt)jt.STANDARD_STAT_KEYS.audioSent[Qt]!==!1&&(Qt==="timestamp"?Rt.audioSent.timestamp=Vt:Rt.audioSent[Qt]=Pt[Qt]);Et=!0}else if(Pt.kind==="video"){Rt.videoSent={packetsSent:0,bytesSent:0,framesEncoded:0};var rn=Math.floor(Pt.timestamp/1e3);for(var Jt in Pt)jt.STANDARD_STAT_KEYS.videoSent[Jt]!==!1&&(Jt==="timestamp"?Rt.videoSent.timestamp=rn:Rt.videoSent[Jt]=Pt[Jt]);Et=!0}}}else if(Pt.kind==="audio"){Rt.audioReceived={packetsReceived:0,bytesReceived:0};var sn=Math.floor(Pt.timestamp/1e3);for(var mn in Pt)jt.STANDARD_STAT_KEYS.audioReceived[mn]!==!1&&(mn==="timestamp"?Rt.audioReceived.timestamp=sn:Rt.audioReceived[mn]=Pt[mn]);Et=!0}else if(Pt.kind==="video"){Rt.videoReceived={packetsReceived:0,bytesReceived:0,framesDecoded:0};var an=Math.floor(Pt.timestamp/1e3);for(var hn in Pt)jt.STANDARD_STAT_KEYS.videoReceived[hn]!==!1&&(hn==="timestamp"?Rt.videoReceived.timestamp=an:Rt.videoReceived[hn]=Pt[hn]);Et=!0}}),Et},this.addCallStats=function(Rt){var Lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Et={};if(this.refineStats!==void 0){if(this.refineStats(Et,Rt),Et.audioReceived!==void 0){if(this.prevData.audioReceived!==void 0){var jt=Et.audioReceived.timestamp-this.prevData.audioReceived[0].timestamp;jt>0?(Et.audioReceived.packetsReceivedPerSecond===void 0&&(Et.audioReceived.packetsReceivedPerSecond=Math.floor((Et.audioReceived.packetsReceived-this.prevData.audioReceived[0].packetsReceived)/jt)),Et.audioReceived.bitsReceivedPerSecond===void 0&&(Et.audioReceived.bitsReceivedPerSecond=Math.floor(8*(Et.audioReceived.bytesReceived-this.prevData.audioReceived[0].bytesReceived)/jt)),Et.audioReceived.packetsLostPerSecond===void 0&&(Et.audioReceived.packetsLostPerSecond=Math.floor((Et.audioReceived.packetsLost-this.prevData.audioReceived[0].packetsLost)/jt)),Et.audioReceived.packetLossRatio===void 0&&(Et.audioReceived.packetLossRatio=100*(Et.audioReceived.packetsLost-this.prevData.audioReceived[0].packetsLost)/(Et.audioReceived.packetsReceived-this.prevData.audioReceived[0].packetsReceived)),Et.audioReceived.samplingInterval=jt):(Et.audioReceived.packetsReceivedPerSecond===void 0&&(Et.audioReceived.packetsReceivedPerSecond=0),Et.audioReceived.bitsReceivedPerSecond===void 0&&(Et.audioReceived.bitsReceivedPerSecond=0),Et.audioReceived.packetsLostPerSecond===void 0&&(Et.audioReceived.packetsLostPerSecond=0),Et.audioReceived.packetLossRatio===void 0&&(Et.audioReceived.packetLossRatio=0),Et.audioReceived.samplingInterval=0)}else Et.audioReceived.packetsReceivedPerSecond===void 0&&(Et.audioReceived.packetsReceivedPerSecond=0),Et.audioReceived.bitsReceivedPerSecond===void 0&&(Et.audioReceived.bitsReceivedPerSecond=0),Et.audioReceived.packetsLostPerSecond===void 0&&(Et.audioReceived.packetsLostPerSecond=0),Et.audioReceived.packetLossRatio===void 0&&(Et.audioReceived.packetLossRatio=0),Et.audioReceived.samplingInterval=0,this.prevData.audioReceived=[];for(this.prevData.audioReceived.push(Et.audioReceived);this.prevData.audioReceived.length>this.prevDataThreshold;)this.prevData.audioReceived.shift()}if(Et.videoReceived!==void 0){if(this.prevData.videoReceived!==void 0){var Pt=Et.videoReceived.timestamp-this.prevData.videoReceived[0].timestamp;Pt>0?(Et.videoReceived.packetsReceivedPerSecond===void 0&&(Et.videoReceived.packetsReceivedPerSecond=Math.floor((Et.videoReceived.packetsReceived-this.prevData.videoReceived[0].packetsReceived)/Pt)),Et.videoReceived.bitsReceivedPerSecond===void 0&&(Et.videoReceived.bitsReceivedPerSecond=Math.floor(8*(Et.videoReceived.bytesReceived-this.prevData.videoReceived[0].bytesReceived)/Pt)),Et.videoReceived.packetsLostPerSecond===void 0&&(Et.videoReceived.packetsLostPerSecond=Math.floor((Et.videoReceived.packetsLost-this.prevData.videoReceived[0].packetsLost)/Pt)),Et.videoReceived.framesDecodedPerSecond===void 0&&(Et.videoReceived.framesDecodedPerSecond=Math.floor((Et.videoReceived.framesDecoded-this.prevData.videoReceived[0].framesDecoded)/Pt)),Et.videoReceived.packetLossRatio===void 0&&(Et.videoReceived.packetLossRatio=100*(Et.videoReceived.packetsLost-this.prevData.videoReceived[0].packetsLost)/(Et.videoReceived.packetsReceived-this.prevData.videoReceived[0].packetsReceived)),Et.videoReceived.samplingInterval=Pt):(Et.videoReceived.packetsReceivedPerSecond===void 0&&(Et.videoReceived.packetsReceivedPerSecond=0),Et.videoReceived.bitsReceivedPerSecond===void 0&&(Et.videoReceived.bitsReceivedPerSecond=0),Et.videoReceived.packetsLostPerSecond===void 0&&(Et.videoReceived.packetsLostPerSecond=0),Et.videoReceived.framesDecodedPerSecond===void 0&&(Et.videoReceived.framesDecodedPerSecond=0),Et.videoReceived.packetLossRatio===void 0&&(Et.videoReceived.packetLossRatio=0),Et.videoReceived.samplingInterval=0)}else Et.videoReceived.packetsReceivedPerSecond===void 0&&(Et.videoReceived.packetsReceivedPerSecond=0),Et.videoReceived.bitsReceivedPerSecond===void 0&&(Et.videoReceived.bitsReceivedPerSecond=0),Et.videoReceived.packetsLostPerSecond===void 0&&(Et.videoReceived.packetsLostPerSecond=0),Et.videoReceived.framesDecodedPerSecond===void 0&&(Et.videoReceived.framesDecodedPerSecond=0),Et.videoReceived.packetLossRatio===void 0&&(Et.videoReceived.packetLossRatio=0),Et.videoReceived.samplingInterval=0,this.prevData.videoReceived=[];for(this.prevData.videoReceived.push(Et.videoReceived);this.prevData.videoReceived.length>this.prevDataThreshold;)this.prevData.videoReceived.shift()}if(Et.audioSent!==void 0){if(this.prevData.audioSent!==void 0){var Vt=Et.audioSent.timestamp-this.prevData.audioSent[0].timestamp;Vt>0?(Et.audioSent.packetsSentPerSecond===void 0&&(Et.audioSent.packetsSentPerSecond=Math.floor((Et.audioSent.packetsSent-this.prevData.audioSent[0].packetsSent)/Vt)),Et.audioSent.bitsSentPerSecond===void 0&&(Et.audioSent.bitsSentPerSecond=Math.floor(8*(Et.audioSent.bytesSent-this.prevData.audioSent[0].bytesSent)/Vt)),Et.audioSent.samplingInterval=Vt):(Et.audioSent.packetsSentPerSecond===void 0&&(Et.audioSent.packetsSentPerSecond=0),Et.audioSent.bitsSentPerSecond===void 0&&(Et.audioSent.bitsSentPerSecond=0),Et.audioSent.samplingInterval=0)}else Et.audioSent.packetsSentPerSecond===void 0&&(Et.audioSent.packetsSentPerSecond=0),Et.audioSent.bitsSentPerSecond===void 0&&(Et.audioSent.bitsSentPerSecond=0),Et.audioSent.samplingInterval=0,this.prevData.audioSent=[];for(this.prevData.audioSent.push(Et.audioSent);this.prevData.audioSent.length>this.prevDataThreshold;)this.prevData.audioSent.shift()}if(Et.videoSent!==void 0){if(this.prevData.videoSent!==void 0){var Qt=Et.videoSent.timestamp-this.prevData.videoSent[0].timestamp;Qt>0?(Et.videoSent.packetsSentPerSecond===void 0&&(Et.videoSent.packetsSentPerSecond=Math.floor((Et.videoSent.packetsSent-this.prevData.videoSent[0].packetsSent)/Qt)),Et.videoSent.bitsSentPerSecond===void 0&&(Et.videoSent.bitsSentPerSecond=Math.floor(8*(Et.videoSent.bytesSent-this.prevData.videoSent[0].bytesSent)/Qt)),Et.videoSent.framesEncodedPerSecond===void 0&&(Et.videoSent.framesEncodedPerSecond=Math.floor((Et.videoSent.framesEncoded-this.prevData.videoSent[0].framesEncoded)/Qt)),Et.videoSent.samplingInterval=Qt):(Et.videoSent.packetsSentPerSecond===void 0&&(Et.videoSent.packetsSentPerSecond=0),Et.videoSent.bitsSentPerSecond===void 0&&(Et.videoSent.bitsSentPerSecond=0),Et.videoSent.framesEncodedPerSecond===void 0&&(Et.videoSent.framesEncodedPerSecond=0),Et.videoSent.samplingInterval=0)}else Et.videoSent.packetsSentPerSecond===void 0&&(Et.videoSent.packetsSentPerSecond=0),Et.videoSent.bitsSentPerSecond===void 0&&(Et.videoSent.bitsSentPerSecond=0),Et.videoSent.framesEncodedPerSecond===void 0&&(Et.videoSent.framesEncodedPerSecond=0),Et.videoSent.samplingInterval=0,this.prevData.videoSent=[];for(this.prevData.videoSent.push(Et.videoSent);this.prevData.videoSent.length>this.prevDataThreshold;)this.prevData.videoSent.shift()}}return Object.keys(Et).length>0&&typeof Lt.post=="function"&&Lt.post(Et),Et},this.browserType==="chrome"?Tt==="proprietary"?this.refineStats=this.refineStats_chrome_proprietary:this.browserVersion>=58?this.refineStats=this.refineStats_chrome_58:this.refineStats=this.refineStats_chrome_legacy:this.browserType==="firefox"?this.browserVersion>=63?this.refineStats=this.refineStats_firefox_63:this.refineStats=this.refineStats_firefox_legacy:this.browserType==="safari"&&(this.refineStats=this.refineStats_chrome_58)}),Gt=(s(658),function(){this.NarrowBandSpeechQuality=function(qt,kt){var st,Tt,Rt=1,Lt=1+qt/10,Et=1+qt/150,jt=(94.769-(st=80+2.5*(65-40*Math.log10(Lt/Et)+6*Math.exp(qt*qt*-.3)-14)))*(94.769-st)/4+100;return(Tt=93.193-((94.769-st)/2+Math.sqrt(jt)-1)*(1-Math.exp(-qt))-(0+kt/(kt+4.3)*95))<0&&(Rt=1),Tt<100&Tt>0&&(Rt=1+.035*Tt+Tt*(Tt-60)*(100-Tt)*7*1e-6),Tt>100&&(Rt=4.5),Rt},this.WideBandspeechQuality=function(qt,kt){var st,Tt,Rt,Lt=0,Et=1;qt<100&&(Lt=.08-qt+10),qt>=100&&(Lt=18);var jt=1+qt/10,Pt=1+qt/150,Vt=(129-(st=80+3*(65+Lt-40*Math.log10(jt/Pt)+6*Math.exp(qt*qt*-.3)-14)))*(129-st)/4+100;return(Rt=(Tt=129-((129-st)/2+Math.sqrt(Vt)-1)*(1-Math.exp(-qt))-(0+kt/(kt+4.3)*95))/1.29)<=0&&(Et=1),Rt<100&Rt>0&&(Et=1+.035*Tt+Tt*(Tt-60)*(100-Tt)*7*1e-6),Rt>=100&&(Et=4.5),Et},this.videoQuality=function(qt,kt,st,Tt,Rt){var Lt,Et,jt,Pt,Vt,Qt,rn,Jt,sn;return sn=kt>720?[0,2.77,.009,3.95,460,1.28,2.12,32e-5,1.28,262,1.98,22.84,7.999]:kt>576?[0,6.31,.008,3.68,262,1.28,1.97,33e-5,1.24,343,2.76,6.25,6.013]:kt>480?[0,6.96,.007,3.58,214,1.2,1.75,63e-5,1.13,171,4.25,7.98,12.001]:kt>288?[0,5.61,.01,3.38,182,1.31,2.23,75e-5,1.51,136,4.05,20.16,22.332]:[0,3.988,.013,3.625,89.25,1.125,.713,0,1.542,245.5,3.011,39.31,16.67],Qt=1+Math.pow(Tt/sn[4],sn[5]),Lt=sn[3]-sn[3]/Qt,Et=sn[1]+sn[2]*Tt,jt=sn[6]+sn[7]*Tt,rn=Math.pow(Math.log(Rt)-Math.log(Et),2),Jt=2*Math.pow(jt,2),Pt=Lt*Math.exp(-rn/Jt),Vt=sn[10]+sn[11]*Math.exp(-Rt/sn[8])+sn[12]*Math.exp(-Tt/sn[9]),1+Pt*Math.exp(-st/Vt)},this.audiovisualQuality=function(qt,kt,st,Tt){var Rt,Lt,Et,jt,Pt;return qt>0&&kt>0?(Rt=(Pt=[0,-.6966,-.8127,.4562,3.003,-.1638,.3626,.1291,.5457,-1251e-7,3.763,-.001065,.01465,-.001002,0])[9]*(st+Tt)+Pt[10],st>=Tt&&(Lt=Math.min(Pt[11]*(st-Tt)+Pt[12],0)),st=qt.length?{done:!0}:{done:!1,value:qt[Tt++]}},e:function(Pt){throw Pt},f:Rt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Lt,Et=!0,jt=!1;return{s:function(){st=st.call(qt)},n:function(){var Pt=st.next();return Et=Pt.done,Pt},e:function(Pt){jt=!0,Lt=Pt},f:function(){try{Et||st.return==null||st.return()}finally{if(jt)throw Lt}}}}function zt(qt,kt){(kt==null||kt>qt.length)&&(kt=qt.length);for(var st=0,Tt=new Array(kt);st43?(this.mediaConstraintsAudioOnly={offerToReceiveAudio:!0,offerToReceiveVideo:!1},this.mediaConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1}):(this.mediaConstraintsAudioOnly={mandatory:{offerToReceiveAudio:!0,offerToReceiveVideo:!1}},this.mediaConstraints={mandatory:{offerToReceiveAudio:!0,offerToReceiveVideo:!0}}):nt.Xh==="Chrome"?nt.PR<55?(this.mediaConstraintsAudioOnly={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},this.mediaConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}}):(this.mediaConstraintsAudioOnly={offerToReceiveAudio:1,offerToReceiveVideo:1},this.mediaConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1}):nt.Xh==="Edge"&&apiRTC.browserDetails.type!=="chrome"?(this.mediaConstraintsAudioOnly={offerToReceiveAudio:!0,offerToReceiveVideo:!1},this.mediaConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1}):(this.mediaConstraintsAudioOnly={offerToReceiveAudio:1,offerToReceiveVideo:1},this.mediaConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1}),nt.ag.name==="iOS"&&(Ft.log("Defining mediaConstraints for iOS "),this.mediaConstraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0}),this.trickleIce=qt.trickleIce,this.callLocalStream=null,this.generatedLocalStream=!1,this.audioOnly=!1,this.inviteSended=!1,this.sendInviteTrickleIceFalseTimeOutId=0,this.sendInviteTrickleIceFalseTimer=5e3,this.message200OKSended=!1,this.send200OKTrickleIceFalseTimeOutId=0,this.send200OKTrickleIceFalseTimer=5e3,this.message200OKReceived=!1,this.callCancelled=!1,this.screenSharing=!1,this.desktopId=0,this.pc_config=qt.pc_config,this.pc_constraints=qt.pc_constraints,this.audioFileMediaElement=null,this.videoReceivedWidth=640,this.videoReceivedHeight=480,this.videoSendWidth=640,this.videoSendHeight=480,this.videoReceivedDelay=0,this.audioReceivedDelay=0,this.audioSendDelay=0,this.videoSendDelay=0,this.videoSendPacketLossRatio=0,this.audioSendPacketLossRatio=0,this.getStatsInterval=qt.qosInterval,this.qm=null,this.statisticId=null,this.csmIntervalMs=qt.csmIntervalMs,this.csmIntervalId=null,this.remoteId=0,this.callType="media",this.localCallProfile={audio:!1,audioActive:!1,video:!1,videoActive:!1},this.remoteCallProfile={audio:!1,audioActive:!1,video:!1,videoActive:!1},this.disconnectionTimeoutId=0,this.disconnectionTimer=4e4,this.disconnectionWarningDelay=9e3,this.disconnectionWarningInterval=0,this.disconnectionWarningTimeout=0,this.disconnectionWarningCount=0,this.checkCandidateTypesTimer=1e4,this.checkCandidateTypesTimeoutId=0,this.checkCandidateTypesTimeoutTable=[],this.data={},this.screenStream=null,this.screenIsDisplayed=!1,this.addingDataChannelOnCallOngoing=!1,this.sendDataChannel=null,this.receiveDataChannel=null,this.receiveChunkNb={},this.firstDataPacket={},this.receivedSize={},this.receiveArrayToStoreChunks={},this.destCallType="media",this.mcuRemoteStream=null,this.userMediaAccessRequired=!0,this.settingUpMode="normal",this.remoteType="web",this.mediaTypeForIncomingCall=qt.mediaTypeForIncomingCall,this.mediaTypeForOutgoingCall=qt.mediaTypeForOutgoingCall,this.mediaRoutingMode=qt.mediaRoutingMode,this.stripAudioSDPActivated=!1,this.stripVideoSDPActivated=!1,this.iceState="notdefined",this.restarted=!1,this.audioSdpDirection=null,this.videoSdpDirection=null,this.isLocalAudioMuted=!1,this.isLocalVideoMuted=!1,this.isRemoteAudioMuted=!1,this.isRemoteVideoMuted=!1,this.isRemoteAudioSilent=!1,this.isRemoteVideoSilent=!1,this.isAccepted=!1,this.accessToMedia=!1,this.callConfiguration=null,this.captureSourceType=null,this.preferH264Codec=!1,this.preferVP8Codec=!1,this.preferVP9Codec=!1,this.candidateNb=0,this.sessionMCU=null,this.instanceId=0,this.retryUpdateMedia=!1,this.updateMediaOngoing=!1,this.setCallTurnServer=function(kt){Ft.info("setCallTurnServer :",kt);var st=JSON.stringify(this.pc_config);st=st.replace(/mp1.apizee.com/g,kt),this.pc_config=JSON.parse(st)},this.setCallMediaRoutingMode=function(kt){Ft.info("setCallMediaRoutingMode :",kt),kt==="hostOnly"?this.mediaRoutingMode=qt.mediaRoutingModeEnum.hostOnly:kt==="stun"?this.mediaRoutingMode=qt.mediaRoutingModeEnum.stun:kt==="stunOnly"?this.mediaRoutingMode=qt.mediaRoutingModeEnum.stunOnly:kt==="turn"?this.mediaRoutingMode=qt.mediaRoutingModeEnum.turn:kt==="turnOnly"?this.mediaRoutingMode=qt.mediaRoutingModeEnum.turnOnly:(Ft.log("parameter error when calling function : setCallMediaRoutingMode()"),this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setCallMediaRoutingMode()","PARAMETER_ERROR_SETCALLMEDIAROUTINGMODE"))},this.checkDTLSCompliancy=function(){if(Ft.debug("checkDTLSCompliancy"),apiCC.session.isDeviceDTLSCompliant()===!1)Ft.log("Device not DTLS compliant, setting DtlsSrtpKeyAgreement: false"),this.pc_constraints={optional:[{DtlsSrtpKeyAgreement:!1}]};else{var kt=apiCC.session.isClientDTLSCompliant(this.remoteId);kt!==!1&&kt!=="false"||(Ft.log("Remote Device not DTLS compliant, setting DtlsSrtpKeyAgreement: false"),this.pc_constraints={optional:[{DtlsSrtpKeyAgreement:!1}]})}},this.sendData=function(kt,st){Ft.info("datachannel - sendData");var Tt=null,Rt=null;if(kt.file instanceof File)return Ft.log("File"),this.contentType=kt.file.type,this.originalDataType="File",Tt=new FileReader,Rt=this,Tt.onload=function(Lt){var Et=Lt.target.result||Tt.result;Rt.sendData({file:Et,name:kt.name,type:kt.type},st)},void Tt.readAsArrayBuffer(kt.file);new Ot(this).send(kt,this.sendDataChannel,st)},Ft.log("New Call for client with Id :"+qt.clientId),this.generateCallId=function(){this.callId=apiCC.generateCallId(),Ft.info("new call with callId :"+this.callId)},this.sendInviteTrickleIceFalse=function(){Ft.log("sendInviteTrickleIceFalse"),Ft.log("sendInvite on candidate timer reached"),this.myWebRTC_Stack.sendInvite(this.callId,this.callerId,qt.nickname,this.dest_roomId,this.dest_roomId,this.callType,{offer:this.pc.localDescription,data:this.data,stream:this.mcuRemoteStream,volatile:!!this.restarted}),this.inviteSended=!0},this.send200OkTrickleIceFalse=function(){Ft.log("send200OkTrickleIceFalse"),this.myWebRTC_Stack.send200OK(this.callId,this.callerId,this.calleeId,qt.nickname,this.dest_roomId,this.pc.localDescription,this.data),this.message200OKSended=!0},this.onSetLocalDescriptionSuccess=function(){Ft.info("onSetLocalDescriptionSuccess"),this.localDescriptionSetted=!0,this.asyncCallbacks&&this.asyncCallbacks.type==="subscribe"&&delete this.asyncCallbacks,this.trickleIce===!1&&(this.callee===!0?(Ft.info("starting send200OKTrickleIceFalseTimeOutId"),this.send200OKTrickleIceFalseTimeOutId=setTimeout(this.callback(this,"send200OkTrickleIceFalse"),this.send200OKTrickleIceFalseTimer)):(Ft.info("starting sendInviteTrickleIceFalseTimeOutId"),this.sendInviteTrickleIceFalseTimeOutId=setTimeout(this.callback(this,"sendInviteTrickleIceFalse"),this.sendInviteTrickleIceFalseTimer))),qt.rtpSenderSetParamatersCapable&&qt.evaluateVideoCap(this)},this.onSetLocalDescriptionFailure=function(kt){Ft.warn("onSetLocalDescriptionFailure",kt);var st=null,Tt=null;this.callControl&&(st=this.callControl.roomName,Tt=this.callControl.type),un.createErrorEvent("Set local Description Failure","SET_LOCAL_DESCRIPTION_FAILURE",this.callId,st,Tt),qt.onHangup(this.callId,"Local_Description_Failure")},this.onSetRemoteDescriptionSuccess=function(){Ft.info("onSetRemoteDescriptionSuccess");var kt=null;for(this.remoteDescriptionSetted=!0,this.restarting===!0&&delete this.restarting,this.data&&(this.data.mesh||this.data.subscribeOrder)||un.createCallEstablishedEvent(this.calleeId,this.callType,this.callId,this.destCallType);this.incomingcandidatesQueue.length;)kt=this.incomingcandidatesQueue.shift(),this.processCandidateMsg(kt);if(qt.clientIncomingCandidatesQueue[this.callId+"-"+this.instanceId]!==void 0){for(Ft.debug("Restoring candidate from client, this.callId :"+this.callId+" , instanceId :"+this.instanceId);qt.clientIncomingCandidatesQueue[this.callId+"-"+this.instanceId].length;)kt=qt.clientIncomingCandidatesQueue[this.callId+"-"+this.instanceId].shift(),this.processCandidateMsg(kt);delete qt.clientIncomingCandidatesQueue[this.callId+"-"+this.instanceId]}if(this.asyncCallbacks&&(this.asyncCallbacks.type==="addingUserMedia"?(this.asyncCallbacks.resolve(this.callConfiguration.userMediaStreamId),this.asyncCallbacks.timeoutId&&(clearTimeout(this.asyncCallbacks.timeoutId),delete this.asyncCallbacks.timeoutId),delete this.asyncCallbacks):this.asyncCallbacks.type==="updateCallConfiguration"&&(this.asyncCallbacks.resolve(),this.asyncCallbacks.timeoutId&&(clearTimeout(this.asyncCallbacks.timeoutId),delete this.asyncCallbacks.timeoutId),delete this.asyncCallbacks)),this.updateMediaOngoing=!1,this.retryUpdateMedia===!0){Ft.debug("an updateMedia was waiting for sig stable state or an other updateMedia end, updating Media now ..."),this.retryUpdateMedia=!1;var st=this.updateMedia(!1);Ft.debug("Retried updateMediaResult :",st)}},this.processCandidateMsg=function(kt){Ft.info("processCandidateMsg :",kt);var st=null;this.pc!==null?(kt.completeCandidate!==void 0?(Ft.trace("new behavior of 2.13.8"),st=new apiCC.myWebRTC_Adapter.RTCIceCandidate(kt.completeCandidate)):(Ft.log("old behavior < 2.13.8"),st=new apiCC.myWebRTC_Adapter.RTCIceCandidate({sdpMLineIndex:kt.label,candidate:kt.candidate})),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("addIceCandidate"),this.pc.addIceCandidate(st,function(){Ft.trace("addIceCandidate success")},function(Tt){Ft.warn("addIceCandidate failure: "+Tt),Tt=null})):(Ft.log("addIceCandidate - Promise version"),this.pc.addIceCandidate(st).then(function(){Ft.trace("addIceCandidate success")}).catch(function(Tt){Ft.warn("addIceCandidate failure: "+Tt),Tt=null}))):Ft.error("Error, call is not null but pc is null")},this.onSetRemoteDescriptionFailure=function(kt){Ft.warn("onSetRemoteDescriptionFailure :",kt);var st=null,Tt=null;this.callControl&&(st=this.callControl.roomName,Tt=this.callControl.type),un.createErrorEvent("Set remote Description Failure","SET_REMOTE_DESCRIPTION_FAILURE",this.callId,st,Tt),qt.onHangup(this.callId,"Remote_Description_Failure")},this.getUserMediaOnCall=function(){var kt=this,st=!1;if(Ft.info("getUserMediaOnCall, audio Only :"+this.audioOnly),Ft.info("getUserMediaOnCall, screenSharing activated :"+this.screenSharing),Ft.log("webRTCClient.gum_config :",qt.gum_config),this.callerId===qt.clientId){if(Ft.log("outgoing call"),this.mediaTypeForOutgoingCall==="VIDEO"||this.mediaTypeForOutgoingCall==="VIDEOONLY")if(Ft.log("mediaTypeForOutgoingCall :"+this.mediaTypeForOutgoingCall),this.mediaTypeForOutgoingCall==="VIDEOONLY"&&(st=!0),this.screenSharing!==!0){if(apiCC.mediaDeviceMgr.videoDevicePresent===!1){if(apiCC.mediaDeviceMgr.audioDevicePresent===!1)return Ft.log("getUserMediaOnCall without any device, calling without device"),void this.onUserMediaSuccessOnCall();Ft.log("video is not present :"+this.callType),this.callType==="media"&&(Ft.log("callType is media, but no webcam present, forcing callType to audio"),this.callType="audio",this.audioOnly=!0)}}else Ft.log("screenSharing, no device checking");else if(this.mediaTypeForOutgoingCall==="AUDIO")Ft.log("mediaTypeForOutgoingCall is AUDIO, setting call to audioOnly"),this.callType="audio",this.audioOnly=!0;else if(this.mediaTypeForOutgoingCall==="NONE"||this.mediaTypeForOutgoingCall==="DATA")return Ft.log("mediaTypeForOutgoingCall is NONE, call will be recvOnly"),void this.onUserMediaSuccessOnCall()}else if(Ft.log("incoming call"),this.mediaTypeForIncomingCall==="VIDEO"||this.mediaTypeForIncomingCall==="VIDEOONLY"){if(Ft.log("mediaTypeForIncomingCall :"+this.mediaTypeForIncomingCall),this.mediaTypeForIncomingCall==="VIDEOONLY"&&(st=!0),apiCC.mediaDeviceMgr.videoDevicePresent===!1){if(apiCC.mediaDeviceMgr.audioDevicePresent===!1)return Ft.log("getUserMediaOnCall without any device, calling without device"),void this.onUserMediaSuccessOnCall();Ft.log("video is not present :"+this.callType),this.callType==="media"&&(Ft.log("callType is media, but no webcam present, forcing callType to audio"),this.callType="audio",this.audioOnly=!0)}}else if(this.mediaTypeForIncomingCall==="AUDIO")Ft.log("mediaTypeForIncomingCall is AUDIO, setting call to audioOnly"),this.callType="audio",this.audioOnly=!0;else if(this.mediaTypeForIncomingCall==="NONE"||this.mediaTypeForIncomingCall==="DATA")return Ft.log("mediaTypeForIncomingCall is NONE, call will be recvOnly"),void this.onUserMediaSuccessOnCall();qt.getUserMediaOnGoing=!0;var Tt=null,Rt=null;if(Ft.log("this.screenSharing :"+this.screenSharing),Ft.log("this.audioOnly :"+this.audioOnly),this.screenSharing===!0)if(Ft.log("getScreenMedia"),nt.Xh==="Chrome")Ft.log("this.desktopId :"+this.desktopId),Tt={video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:this.desktopId}}};else{if(Ft.log("this.captureSourceType :"+this.captureSourceType),this.captureSourceType!=="screen"&&this.captureSourceType!=="window"&&this.captureSourceType!=="application")return void Ft.error("captureSourceType value is not correct");Tt={video:{mediaSource:this.captureSourceType}}}else this.audioOnly===!0?(Ft.log("this.audioOnly = true"),qt.gum_config=apiCC.setAudioSourceIdInConstraint(qt.audioSourceId,qt.gum_config),Rt=JSON.parse(JSON.stringify(qt.gum_config)),qt.allowAsymetricMediaCalls===!1?Rt.video=!1:Ft.log("allow AsymetricMediaCalls is activated"),Tt=Rt):(Ft.log("audio and video call"),Tt=(0,at.ws)({},qt.gum_config),st?Tt.audio=!1:Tt=apiCC.setAudioSourceIdInConstraint(qt.audioSourceId,Tt),Tt=apiCC.setVideoSourceIdInConstraint(qt.videoSourceId,Tt),Tt=apiCC.setVideoFacingModeInConstraint(qt.facingMode,Tt),typeof apiRTC_React<"u"&&(Tt={audio:!0,video:{mandatory:{minWidth:500,minHeight:300,minFrameRate:30},facingMode:"user"}}));apiCC.createUserMediaStream({callId:this.callId,type:this.callType,gum_config:Tt,success:function(Lt){Ft.debug("[getUserMediaOnCall] success; userMediaStreamId: "+Lt.userMediaStreamId),kt.callConfiguration!==void 0&&kt.callConfiguration!==null||(kt.callConfiguration={}),kt.callConfiguration.userMediaStreamId=Lt.userMediaStreamId,kt.onUserMediaSuccessOnCall(Lt.stream)},failure:function(Lt,Et){Ft.debug("[getUserMediaOnCall] failure; userMediaStreamId: "+Lt.userMediaStreamId),kt.onUserMediaErrorOnCall(Et)}})},this.handleToneChangeEvent=function(kt){Ft.debug("handleToneChangeEvent :",kt.tone),kt.tone!==""?Ft.debug("Tone played: "+kt.tone):Ft.debug("All tones have played.")},this.sendTones=function(kt,st,Tt){Ft.debug("sendTones :"),this.dtmfSender&&(Ft.debug("sendTones : Tones, duration, gap: ",kt,st,Tt),this.dtmfSender.insertDTMF(kt,st,Tt))},this.addStream=function(kt){var st,Tt=null,Rt=null,Lt=0,Et=!1,jt=null,Pt=[];if(nt.Xh==="Firefox"&&nt.PR<51||nt.Xh==="Chrome"&&nt.PR<65||nt.Xh==="Safari"&&nt.dc<12.1||nt.Xh==="Mobile Safari"&&nt.dc<12.1||apiRTC.osName==="iOS"&&typeof cordova<"u"&&cordova.plugins!==void 0&&cordova.plugins.iosrtc!==void 0)Ft.info("using addStream method"),this.pc.addStream(kt),Ft.debug("end addStream method");else{if(!(nt.Xh==="Firefox"&&nt.PR<59||nt.Xh==="Edge"&&apiRTC.browserDetails.type!=="chrome"||typeof apiRTC_React<"u")){for(Ft.info("using addTrack/replaceTrack method"),Tt=kt.getTracks(),st=0;st replaceTrack",Rt[Lt]);else{if(this.simulcast==="RID"&&Tt[st].kind==="video"&&at.wL.type==="chrome"){var Vt=[{rid:"h",active:!0,maxBitrate:9e5},{rid:"m",active:!0,maxBitrate:3e5,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:1e5,scaleResolutionDownBy:4}];this.callControl.callConfiguration.simulcast&&this.callControl.callConfiguration.simulcast.sendEncodings&&(Vt=this.callControl.callConfiguration.simulcast.sendEncodings.slice()),jt=this.pc.addTransceiver(Tt[st],{direction:"sendonly",streams:[kt],sendEncodings:Vt}).sender}else if(jt=this.pc.addTrack(Tt[st],kt),this.simulcast==="RID"&&Tt[st].kind==="video"&&at.wL.type==="firefox"){var Qt=jt.getParameters();Qt||(Qt={}),this.callControl.callConfiguration.simulcast&&this.callControl.callConfiguration.simulcast.sendEncodings?Qt.encodings=this.callControl.callConfiguration.simulcast.sendEncodings.slice():Qt.encodings=[{rid:"h",active:!0,maxBitrate:9e5},{rid:"m",active:!0,maxBitrate:3e5,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:1e5,scaleResolutionDownBy:4}],Pt.push(jt.setParameters(Qt))}Ft.debug("addStream -> addTrack",jt),this.rtpSenders[Tt[st].kind].push(jt)}}return Ft.debug("end addTrack/replaceTrack method"),this.rtpSenders.audio.length>0&&(this.dtmfSender=this.rtpSenders.audio[0].dtmf,this.dtmfSender&&(this.dtmfSender.ontonechange=this.handleToneChangeEvent)),new Promise(function(rn,Jt){Promise.all(Pt).then(function(sn){rn()}).catch(Jt)})}for(Ft.info("using addTrack method"),Tt=kt.getTracks(),st=0;st0&&(kt.getVideoTracks()[0].onended=this.callback(this,"stopScreenSharing")))):this.audioOnly===!0&&(this.callType="audio"),kt!==void 0&&(this.callLocalStream=kt),(0,at.yJ)()?(Ft.log("isHTTP true"),this.establishCall()):(Ft.log("webRTCClient.userAcceptOnIncomingCall :"+qt.userAcceptOnIncomingCall),Ft.log("this.callee :"+this.callee),this.data!==void 0&&Ft.log("this.data.MCUType :"+this.data.MCUType),qt.userAcceptOnIncomingCall!==!0||this.callee!==!0&&this.data.MCUType!=="MCU-Callee"||this.isAccepted!==!1?this.calleeId!=="LOCAL"?this.establishCall():Ft.log("call is not established as this is a LOCAL stream request"):Ft.log("Stand-by :: wait for establishCall"))},this.establishCall=function(){var kt=this;Ft.debug("establishCall()"),this.started!==!0||this.addingUserMedia!==!0||!this.belongsToRoom()||this.settingUpType!=="publish"||this.data&&this.data.hasOwnProperty("MCUType")||!this.sessionMCU||this.sessionMCU.hasOwnProperty("roomMode")||(this.restarting=!0,this.pc.close(),this.pc=null,this.started=!1,this.localDescriptionSetted=!1,this.remoteDescriptionSetted=!1,this.sendedSdpOfferMessage=null,this.receivedSdpOfferMessage=null,this.rtpSenders={audio:[],video:[]},this.addingUserMedia=!1,this.updateUserMedia=!1,this.updateCause=null,this.incomingcandidatesQueue=[],this.message200OKReceived=!1,this.statisticId&&(clearInterval(this.statisticId),this.statisticId=null),this.csmIntervalId&&(clearInterval(this.csmIntervalId),this.csmIntervalId=null),this.instanceId=apiCC.generateInstanceId(),this.data.instanceId=this.instanceId),this.dataCall!==!0&&this.checkingMutingState(),this.maybeStart();var st=null;this.callee&&this.addingUserMedia!==!0&&this.updateUserMedia!==!0?(st=new apiCC.myWebRTC_Adapter.RTCSessionDescription(this.receivedSdpOfferMessage),Ft.log("Avant setRemote pour le callee :",st),this.pc!==null?(qt.preferSendingH264Codec&&(Ft.log("Modification of SDP to set H264 as prefered sending codec"),st.sdp=qt.mySDPManager.maybePreferCodec(st.sdp,"video","H264")),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("establishCall : before setRemoteDescription for callee"),this.pc.setRemoteDescription(st,this.callback(this,"onSetRemoteDescriptionSuccess"),this.callback(this,"onSetRemoteDescriptionFailure"))):(Ft.log("establishCall : before setRemoteDescription for callee - Promise version"),this.pc.setRemoteDescription(st).then(this.callback(this,"onSetRemoteDescriptionSuccess")).catch(this.callback(this,"onSetRemoteDescriptionFailure")))):Ft.log("Error : PC is null"),this.doAnswer()):this.addingUserMedia===!0?(Ft.log("Adding local stream 1."),this.pc!==null?(this.callLocalStream===null&&qt.localStream!==null&&(this.callLocalStream=qt.localStream),this.callLocalStream!==null?(Ft.log("Add Stream of callLocalStream"),this.addStream(this.callLocalStream).then(function(){kt.updateMediaWithRetryManagement(!1)}).catch(function(Tt){Ft.error("failed to add stream",Tt)})):(Ft.log("No Stream to addStream"),this.updateMediaWithRetryManagement(!1))):Ft.error("Error : PC is null")):this.updateUserMedia===!0&&this.updateMediaWithRetryManagement(!1),Ft.log("End of establishCall()")},this.onUserMediaSuccessTestUni=function(){qt.getUserMediaOnGoing=!1,Ft.info("onUserMediaSuccessTestUni : User has not granted access to local media.");var kt=null,st={};qt.userMediaErrorDetected===!0&&(qt.userMediaErrorDetected=!1,st.userMediaErrorDetected=qt.userMediaErrorDetected,apiCC.session.setUserData(st)),qt.accessToLocalMedia=!0,this.maybeStart(),this.callee&&(kt=new apiCC.myWebRTC_Adapter.RTCSessionDescription(this.receivedSdpOfferMessage),qt.preferSendingH264Codec&&(Ft.log("Modification of SDP to set H264 as prefered sending codec"),kt.sdp=qt.mySDPManager.maybePreferCodec(kt.sdp,"video","H264")),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("onUserMediaSuccessTestUni : before setRemoteDescription for callee"),this.pc.setRemoteDescription(kt,this.callback(this,"onSetRemoteDescriptionSuccess"),this.callback(this,"onSetRemoteDescriptionFailure"))):(Ft.log("onUserMediaSuccessTestUni : before setRemoteDescription for callee - Promise version"),this.pc.setRemoteDescription(kt).then(this.callback(this,"onSetRemoteDescriptionSuccess")).catch(this.callback(this,"onSetRemoteDescriptionFailure"))),this.doAnswer())},this.onUserMediaErrorOnCall=function(kt){var st=this;Ft.log("onUserMediaErrorOnCall");var Tt={};qt.getUserMediaOnGoing=!1,setTimeout(function(){un.createErrorEvent(kt,"USER_MEDIA_ERROR",st.callId)}),Ft.error("Failed to get access to local media. Error code was "+kt.code),Ft.error(kt),kt=null,nt.$6!=="electron"&&(nt.Xh==="Chrome"||nt.Xh==="Mobile Chrome")&&nt.PR>47&&(Ft.log("browser_version > 47"),window.location.protocol!=="https:"&&Ft.error("HTTPS is now mandatory to use getUserMedia()")),this.screenSharing===!0&&(this.callType="screenSharing",window.location.protocol!=="https:"?(Ft.log("You need to be connected using HTTPS for screenSharing"),un.createDesktopCaptureEvent("UserMediaError_HTTPS_needed",this.callId,this.remoteId)):(Ft.log("screenSharing UserMediaError"),un.createDesktopCaptureEvent("UserMediaError",this.callId,this.remoteId))),this.callee===!0?(this.myWebRTC_Stack.sendBye(this.callId,this.calleeId,this.dest_roomId,this.callerId,"User_Media_Error",this.data),qt.removeCallFromTableWithCallIdandRemoteId(this.callId,this.callerId,"User_Media_Error")):(this.data!==void 0&&this.data!==null&&this.data.MCUType==="MCU-Callee"&&this.myWebRTC_Stack.sendBye(this.callId,this.callerId,this.dest_roomId,this.calleeId,"User_Media_Error",this.data),qt.removeCallFromTableWithCallIdandRemoteId(this.callId,this.calleeId,"User_Media_Error")),this.screenSharing===!1&&(qt.userMediaErrorDetected=!0,Tt.userMediaErrorDetected=qt.userMediaErrorDetected,apiCC.session.setUserData(Tt))},this.maybeStart=function(){Ft.debug("maybeStart"),!this.started&&qt.channelReady&&(qt.accessToLocalMedia||this.dataCall)&&(Ft.log("Creating PeerConnection."),this.createPeerConnection(),qt.unidirectionelCallOnly||this.screenSharing===!0?this.callee===!1&&(Ft.log("Adding local stream 2."),this.callLocalStream!==null?(Ft.log("Add Stream of callLocalStream"),this.addStream(this.callLocalStream)):qt.localStream!==null?(Ft.log("Add Stream of client.localStream"),this.addStream(qt.localStream),this.callLocalStream=qt.localStream):Ft.log("No Stream to add")):this.dataCall||(Ft.log("Adding local stream 3."),this.callLocalStream!==null?(Ft.log("Add Stream of callLocalStream"),this.addStream(this.callLocalStream)):qt.localStream!==null?(Ft.log("Add Stream of client.localStream"),this.addStream(qt.localStream),this.callLocalStream=qt.localStream):(Ft.log("No Stream to add"),this.belongsToRoom()||at.wL.type!=="safari"||typeof this.pc.addTransceiver!="function"||(Ft.debug("add transceivers"),this.pc.addTransceiver("audio",{direction:"recvonly"}),this.pc.addTransceiver("video",{direction:"recvonly"})))),this.started=!0,this.callee===!1&&(Ft.log("Before doCall()"),this.doCall())),Ft.log("End of maybeStart")},this.createDataChannel=function(){if(Ft.info("createDataChannel"),nt.Xh==="Edge"&&nt.PR<79&&apiRTC.browserDetails.type!=="chrome")Ft.warn("Cannot create DataChannel as it is not supported on Edge");else if(this.sendDataChannel===null)try{this.sendDataChannel=this.pc.createDataChannel("apiRTCDataChannel",{}),this.sendDataChannel.binaryType="arraybuffer",Ft.log("Created data channel"),Ft.log("Subscribing to dc events"),this.sendDataChannel.onopen=this.callback(this,"onSendDataChannelOpen"),this.sendDataChannel.onclose=this.callback(this,"onSendDataChannelClose"),this.sendDataChannel.onmessage=this.callback(this,"onSendDataChannelMessage"),this.sendDataChannel.onerror=this.callback(this,"onSendDataChannelError")}catch(kt){Ft.log("createDataChannel() failed with exception: "+kt.message)}else Ft.log("Datachannel already exist")},this.createPeerConnection=function(){Ft.info("createPeerConnection");try{Ft.log("createPeerConnection with pc_config:",JSON.stringify(this.pc_config)),Ft.log("and pc_constraints:",JSON.stringify(this.pc_constraints)),at.wL.type==="chrome"&&at.wL.version>=72&&at.wL.version<78?(Ft.debug("Chrome 72=+ and 78-, force sdpSemantics plan-b"),this.pc_config.sdpSemantics="plan-b"):apiRTC.osName==="iOS"&&typeof cordova<"u"&&cordova.plugins!==void 0&&cordova.plugins.iosrtc!==void 0?(Ft.debug("Cordova, force sdpSemantics plan-b"),this.pc_config.sdpSemantics="plan-b"):Ft.debug("sdpSemantics unified-plan is being used"),this.pc=new apiCC.myWebRTC_Adapter.RTCPeerConnection(this.pc_config,this.pc_constraints),this.dataCall&&this.createDataChannel(),this.pc.onicecandidate=this.callback(this,"onIceCandidate")}catch(kt){return Ft.log("Failed to create PeerConnection, exception: "+kt.message),void Ft.error("Cannot create RTCPeerConnection object; WebRTC is not supported by this browser.")}(nt.Xh==="Firefox"||nt.Xh==="Mobile Firefox")&&nt.PR>=53||nt.Xh==="Edge"||at.wL.type==="chrome"&&at.wL.version>=64?(this.pc.ontrack=this.callback(this,"onRemoteTrackAdded"),this.pc.onaddstream=this.callback(this,"onRemoteStreamAdded")):nt.Xh==="Safari"&&nt.PR>=12||nt.Xh==="Mobile Safari"&&nt.PR>=12||typeof apiRTC_React<"u"?this.pc.ontrack=this.callback(this,"onRemoteTrackAdded"):this.pc.onaddstream=this.callback(this,"onRemoteStreamAdded"),this.pc.onremovestream=this.callback(this,"onRemoteStreamRemoved"),this.pc.onnegotiationneeded=this.callback(this,"onNegotiationNeeded"),this.pc.onsignalingstatechange=this.callback(this,"onSignalingStateChange"),this.pc.oniceconnectionstatechange=this.callback(this,"onIceConnectionStateChange"),this.pc.ondatachannel=this.callback(this,"onDataChannel"),this.pc.onicegatheringstatechange=this.callback(this,"onIceGatheringStateChange"),this.pc.onconnectionstatechange=this.callback(this,"onConnectionStateChange"),qt.qosEnable&&(this.statisticId=setInterval(this.callback(this,"getStatistics"),this.getStatsInterval)),qt.csmEnable&&(this.csmLastResults={},this.csmIntervalId=setInterval(this.callback(this,"csmHandler"),this.csmIntervalMs))},this.onIceGatheringStateChange=function(kt){Ft.log("onIceGatheringStateChange"),this.pc!==null&&(Ft.info("onIceGatheringStateChange, Ice Gathering State is now : "+this.pc.iceGatheringState),this.pc.iceGatheringState==="complete"&&this.candidateNb===0&&Ft.warn("Warning, no candidate where retrieved for this call on client"))},this.onConnectionStateChange=function(kt){Ft.log("onConnectionStateChange event :",kt)},this.onDataChannel=function(kt){Ft.info("onDataChannel event"),this.receiveDataChannel=kt.channel,this.receiveDataChannel.binaryType="arraybuffer",this.sendDataChannel===null&&(Ft.log("Setting this.sendDataChannel with receivedDataChannel"),this.sendDataChannel=kt.channel,this.sendDataChannel.onopen=this.callback(this,"onSendDataChannelOpen"),this.sendDataChannel.onclose=this.callback(this,"onSendDataChannelClose"),this.sendDataChannel.onmessage=this.callback(this,"onSendDataChannelMessage"),this.sendDataChannel.onerror=this.callback(this,"onSendDataChannelError")),Ft.log("got dataChannel",kt.channel.label),Ft.log("Subscribing to dc events"),this.receiveDataChannel.onopen=this.callback(this,"onReceiveDataChannelOpen"),this.receiveDataChannel.onclose=this.callback(this,"onReceiveDataChannelClose"),this.receiveDataChannel.onmessage=this.callback(this,"onReceiveDataChannelMessage"),this.receiveDataChannel.onerror=this.callback(this,"onReceiveDataChannelError")},this.onSendDataChannelOpen=function(kt){Ft.info("onSendDataChannelOpen"),this.callType==="data"&&this.calleeId==="dataChannelConnector"&&(this.pushDataStatus&&this.pushDataStatus.type==="pipeline"?(this.pushDataStatus.state="ready",setTimeout(function(){qt.startNextPushData()})):this.transferStarted!==!0&&this.startTransfer()),un.createEvent({eventType:"sendDataChannelOpen",callId:this.callId,remoteId:this.remoteId,details:kt})},this.onSendDataChannelClose=function(kt){Ft.info("onSendDataChannelClose"),this.sendDataChannel=null,un!==null&&un.createEvent({eventType:"sendDataChannelClose",callId:this.callId,remoteId:this.remoteId,details:kt})},this.processOnDataChannelMessage=function(kt){var st,Tt,Rt=null,Lt=null,Et="",jt=0;if(Ft.info("processOnDataChannelMessage"),Rt=JSON.parse(kt.data),Ft.log("data.uuid :"+Rt.uuid),Ft.log("data.messageSize :"+Rt.messageSize),Ft.log("data.originalDataType :"+Rt.originalDataType),st=Rt.uuid,Rt.originalDataType==="ArrayBuffer"&&(Ft.log("ArrayBuffer conversion"),Rt.message=at.cw.decode(Rt.message)),Ft.log("data :"+Rt),Ft.log("data.uuid :"+st),Ft.log("receiveChunkNb[uuid] :"+this.receiveChunkNb[st]),this.receiveChunkNb[st]===void 0)Ft.log("receiving first packet for uuid :"+st),Ft.log("evt.data.message :"+kt.data),this.firstDataPacket[st]=Rt,this.receiveChunkNb[st]=1,this.receivedSize[st]=0,this.startingDate=new Date,this.transferDuration=0,un.createEvent({eventType:"onFileReceiving",remoteId:this.remoteId,callId:this.callId,name:Rt.name,uuid:st}),un.createEvent({eventType:"onFileProgress",sendChunkNb:this.receiveChunkNb[st],fileSize:this.firstDataPacket[st].size,remainingSize:this.firstDataPacket[st].size,callId:this.callId,uuid:st,remoteId:this.remoteId,lastPacket:!1,startingDate:this.startingDate,transferDuration:this.transferDuration,percentage:0,transferEnded:!1});else if(Ft.log("new packet for uuid :"+st),this.receiveChunkNb[st]+=1,Ft.log("data.messageSize :"+Rt.messageSize),Ft.log("data.message.length :"+Rt.message.length),jt=Rt.messageSize||Rt.message.length,Ft.log("receivedSize :"+jt),this.receiveArrayToStoreChunks[st]||(this.receiveArrayToStoreChunks[st]=[]),this.receiveArrayToStoreChunks[st].push(Rt.message),this.receivedSize[st]+=jt,this.transferDuration=new Date-this.startingDate,this.receivedSize[st]===this.firstDataPacket[st].size){if(Ft.log("End of data transfert"),Ft.log("this.firstDataPacket.type :"+this.firstDataPacket[st].type),this.firstDataPacket[st].type==="image/png-dataUrl"){for(Ft.log("Photo received from a takeSnapshot"),Tt=0;Tt0&&arguments[0]!==void 0?arguments[0]:{},Tt=st.hasOwnProperty("delay")?st.delay:100;this.transferStarted!==!0&&(Ft.info("startTransfer",Tt),this.transferStarted=!0,setTimeout(function(){kt.dcfs||(kt.dcfs=new Ot(kt),kt.data.offset>0?kt.dcfs.transfer(kt.fileContent.buffer,kt.data.offset,kt.sendDataChannel,{delay:Tt}):kt.dcfs.transfer(kt.fileContent.buffer,0,kt.sendDataChannel,{delay:Tt}))},Tt))},this.statisticsAnswer=function(kt){var st=kt.result(),Tt=null;this.qm||(this.qm=new St(this.getStatsInterval/1e3,this.callback(this,"onQosChange"),this.callback(this,"onQosAudioChange"),this.callback(this,"onQosVideoChange"),this.callId,qt.apiKey,qt.clientId,qt.socket)),st&&(this.qm.insertStats(st,this.sendedSdpOfferMessage,this.receivedSdpOfferMessage,qt.remoteVideo),Tt=this.qm.getAllStats(),qt.qosEnable&&un.createEvent({eventType:"onQosStatsUpdate",callId:this.callId,remoteId:this.remoteId,stats:Tt}),this.videoReceivedWidth=Tt.VideoRecv.FrameWidth,this.videoReceivedHeight=Tt.VideoRecv.FrameHeight,this.videoSendWidth=Tt.VideoSend.FrameWidth,this.videoSendHeight=Tt.VideoSend.FrameHeight,this.videoReceivedDelay=Tt.VideoRecv.delay,this.audioReceivedDelay=Tt.AudioRecv.delay,this.audioSendDelay=Tt.AudioSend.rtt,this.videoSendDelay=Tt.VideoSend.rtt,this.videoSendMoyDelay=Tt.VideoSend.moyRtt,this.videoSendPacketLossRatio=Tt.VideoSend.packetLostRatio,this.audioSendPacketLossRatio=Tt.AudioSend.packetLostRatio,this.videoSendEncodeUsagePercent=Tt.VideoSend.googEncodeUsagePercent,this.videoSendCpuLimitedResolution=Tt.VideoSend.googCpuLimitedResolution,this.videoSendBandwidthLimitedResolution=Tt.VideoSend.googBandwidthLimitedResolution,this.videoSendCpuLimitedResolution!==void 0&&JSON.parse(this.videoSendCpuLimitedResolution)===!0&&un.createEvent({eventType:"cpuLimited",callId:this.callId,encodeUsagePercent:this.videoSendEncodeUsagePercent}),this.videoSendBandwidthLimitedResolution!==void 0&&JSON.parse(this.videoSendBandwidthLimitedResolution)===!0&&un.createEvent({eventType:"bandwidthLimited",callId:this.callId}))},this.csmGetStatsHandler=function(kt){var st,Tt=this,Rt=null,Lt=null,Et={};if(this.csm||(this.csm=new Dt(this.csmIntervalMs/1e3,at.wL.type,at.wL.version,"standard"),this.csm.browserInfo={browserAbout:nt.Xh+" "+nt.dc,browserType:at.wL.type,browserVersion:at.wL.version},(0,at.Ym)(this.mcuRemoteStream,"attributes","object")&&(this.mcuRemoteStream.replay===!0?(0,at.Ym)(this.mcuRemoteStream.attributes.callerId,"string")&&(0,at.Ym)(this.mcuRemoteStream.attributes.callId,"string")&&(0,at.Ym)(this.mcuRemoteStream.attributes.recId,"string")&&(this.csm.callFeed={clientId:this.mcuRemoteStream.attributes.callerId,callId:this.mcuRemoteStream.attributes.callId,modifier:"replay",recId:this.mcuRemoteStream.attributes.recId}):(0,at.Ym)(this.mcuRemoteStream.attributes.callerId,"string")&&(0,at.Ym)(this.mcuRemoteStream.attributes.callId,"string")&&(this.csm.callFeed={clientId:this.mcuRemoteStream.attributes.callerId,callId:this.mcuRemoteStream.attributes.callId}))),Et.post=function(Pt){Tt.mos||(Tt.mos=new Gt),Pt.quality={},Pt.audioReceived?Tt.isRemoteAudioMuted?Pt.quality.mosS="Muted":Pt.audioReceived.bitsReceivedPerSecond!==0?(Pt.audioReceived.delay=parseInt(Tt.audioReceivedDelay,10),Pt.quality.mosS=Tt.mos.NarrowBandSpeechQuality(Pt.audioReceived.delay,Pt.audioReceived.packetLossRatio)):Pt.quality.mosS="NoStream":Pt.quality.mosS="NoStream",Pt.videoReceived?Tt.isRemoteVideoMuted?Pt.quality.mosV="Muted":Pt.videoReceived.bitsReceivedPerSecond!==0?(Pt.videoReceived.width=Tt.videoReceivedWidth,Pt.videoReceived.height=Tt.videoReceivedHeight,Pt.videoReceived.delay=parseInt(Tt.videoReceivedDelay,10),Pt.quality.mosV=Tt.mos.videoQuality(Pt.videoReceived.width,Pt.videoReceived.height,Pt.videoReceived.packetLossRatio,Math.floor(Pt.videoReceived.bitsReceivedPerSecond/1e3),Pt.videoReceived.framesDecodedPerSecond)):Pt.quality.mosV="NoStream":Pt.quality.mosV="NoStream",Pt.audioReceived&&Pt.videoReceived&&(Pt.quality.mosAV=Tt.mos.audiovisualQuality(Pt.quality.mosS,Pt.quality.mosV,Pt.audioReceived.delay,Pt.videoReceived.delay)),Pt.audioSent?Tt.isLocalAudioMuted?Pt.quality.mosSS="Muted":Pt.audioSent.bitsSentPerSecond!==0?(Pt.audioSent.delay=parseInt(Tt.audioSendDelay,10),Pt.audioSent.packetLossRatio=Tt.audioSendPacketLossRatio,Pt.quality.mosSS=Tt.mos.NarrowBandSpeechQuality(Pt.audioSent.delay,Pt.audioSent.packetLossRatio)):Pt.quality.mosSS="NoStream":Pt.quality.mosSS="NoStream",Pt.videoSent?Tt.isLocalVideoMuted?Pt.quality.mosSV="Muted":Pt.videoSent.bitsSentPerSecond!==0?(Pt.videoSent.width=Tt.videoSendWidth,Pt.videoSent.height=Tt.videoSendHeight,Pt.videoSent.delay=parseInt(Tt.videoSendDelay,10),Pt.videoSent.moyDelay=parseInt(Tt.videoSendMoyDelay,10),Pt.videoSent.packetLossRatio=Tt.videoSendPacketLossRatio,Pt.videoSent.encodeUsagePercent=Tt.videoSendEncodeUsagePercent,Pt.videoSent.cpuLimitedResolution=Tt.videoSendCpuLimitedResolution,Pt.videoSent.bandwidthLimitedResolution=Tt.videoSendBandwidthLimitedResolution,Pt.quality.mosSV=Tt.mos.videoQuality(Pt.videoSent.width,Pt.videoSent.height,Pt.videoSent.packetLossRatio,Math.floor(Pt.videoSent.bitsSentPerSecond/1e3),Pt.videoSent.framesEncodedPerSecond)):Pt.quality.mosSV="NoStream":Pt.quality.mosSV="NoStream",Pt.audioSent&&Pt.videoSent&&(Pt.quality.mosSAV=Tt.mos.audiovisualQuality(Pt.quality.mosSS,Pt.quality.mosSV,Pt.audioSent.delay,Pt.videoSent.delay))},st=this.csm.addCallStats(kt,Et),Object.keys(st).length!==0){!st.quality||st.quality.mosS==="Muted"&&st.quality.mosV==="Muted"&&st.quality.mosSS==="Muted"&&st.quality.mosSV==="Muted"||qt.qualityScoreEnable&&un.createEvent({eventType:"onCallScoreUpdate",callId:this.callId,score:st.quality}),this.csmLastResults=st,this.callLocalStream&&typeof this.callLocalStream.getVideoTracks=="function"&&(Rt=this.callLocalStream.getVideoTracks())&&Rt[0]&&typeof Rt[0].getSettings=="function"&&(Lt=Rt[0].getSettings());var jt={save:!0,clientId:qt.clientId,callId:this.callId,instanceId:this.instanceId,browserInfo:this.csm.browserInfo,stats:st};this.sessionMCU&&(jt.roomId=this.sessionMCU.roomName,jt.pubSub=qt.MCUClient.pubConnector),this.csm.callFeed&&(jt.callFeed=this.csm.callFeed),Lt&&(jt.videoSettings=Lt),this.data.mesh&&(jt.mesh=this.data.mesh),this.myWebRTC_Stack.sendInfo("callStats",jt),qt.csmEnable&&(this.data&&this.data.mesh&&(this.data.mesh.calleeCompositeUserId?this.data.mesh.calleeCompositeUserId===qt.compositeClientId:this.data.mesh.calleeId===qt.clientId)?un.createEvent({eventType:"onCallStatsUpdate",callId:this.data.mesh.calleeCallId,userId:this.data.mesh.callerId,stats:st}):un.createEvent({eventType:"onCallStatsUpdate",callId:this.callId,stats:st}))}},this.onQosChange=function(kt,st){un.createEvent({eventType:"onQosChange",callId:this.callId,remoteId:this.remoteId,qosIn:kt,qosOut:st})},this.onQosAudioChange=function(kt,st){un.createEvent({eventType:"onQosAudioChange",callId:this.callId,remoteId:this.remoteId,qosAudioIn:kt,qosAudioOut:st})},this.onQosVideoChange=function(kt,st){un.createEvent({eventType:"onQosVideoChange",callId:this.callId,remoteId:this.remoteId,qosVideoIn:kt,qosVideoOut:st})},this.getStatistics=function(){this.pc&&((nt.Xh==="Chrome"||nt.Xh==="Mobile Chrome")&&nt.PR>112?Ft.debug("getStats with callback in now deprecated on Chrome, getStatistics() / QoSMonitor can no more be used"):!this.pc.getStats||nt.Xh!=="Chrome"&&nt.Xh!=="Mobile Chrome"||this.pc.getStats(this.callback(this,"statisticsAnswer")))},this.csmHandler=function(){this.statisticId||this.getStatistics(),this.pc&&typeof this.pc.getStats=="function"&&this.pc.getStats(null).then(this.callback(this,"csmGetStatsHandler")).catch(function(kt){Ft.warn("failed to get stats",kt)})},this.doCall=function(){var kt=null;Ft.log("Sending offer to peer"),this.audioOnly?(Ft.log("audioOnly call :",this.mediaConstraintsAudioOnly),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOffer"),this.callback(this,"onCreateOfferFailure"),this.mediaConstraintsAudioOnly)):(Ft.log("createOffer - Promise version"),this.pc.createOffer(this.mediaConstraintsAudioOnly).then(this.callback(this,"setLocalAndSendMessageonOffer")).catch(this.callback(this,"onCreateOfferFailure")))):this.screenSharing===!0?(Ft.log("screenSharing call : one way media :",kt),kt={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}},nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOffer"),this.callback(this,"onCreateOfferFailure"),kt)):(Ft.log("createOffer - Promise version"),this.pc.createOffer(kt).then(this.callback(this,"setLocalAndSendMessageonOffer")).catch(this.callback(this,"onCreateOfferFailure")))):this.dataCall===!0?(Ft.log("call is data only :",kt),kt=(nt.Xh==="Firefox"||nt.Xh==="Mobile Firefox")&&nt.PR>43?{offerToReceiveAudio:!1,offerToReceiveVideo:!1}:{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}},nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOffer"),this.callback(this,"onCreateOfferFailure"),kt)):(Ft.log("createOffer - Promise version"),this.pc.createOffer(kt).then(this.callback(this,"setLocalAndSendMessageonOffer")).catch(this.callback(this,"onCreateOfferFailure")))):(Ft.log("call is audio & video :",this.mediaConstraints),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOffer"),this.callback(this,"onCreateOfferFailure"),this.mediaConstraints)):(Ft.log("createOffer - Promise version"),this.pc.createOffer(this.mediaConstraints).then(this.callback(this,"setLocalAndSendMessageonOffer")).catch(this.callback(this,"onCreateOfferFailure"))))},this.doAnswer=function(){Ft.info("doAnswer");var kt=null;this.audioOnly?(Ft.log("audioOnly call"),kt=this.mediaConstraintsAudioOnly):kt=this.mediaConstraints,nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createAnswer"),this.pc.createAnswer(this.callback(this,"setLocalAndSendMessage"),this.callback(this,"onCreateAnswerFailure"),kt)):(Ft.log("createAnswer - Promise version"),this.pc.createAnswer(kt).then(this.callback(this,"setLocalAndSendMessage")).catch(this.callback(this,"onCreateAnswerFailure")))},this.doUpdateAnswer=function(){Ft.info("doUpdateAnswer");var kt=null;this.audioOnly?(Ft.log("audioOnly call"),kt=this.mediaConstraintsAudioOnly):kt=this.mediaConstraints,nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createAnswer"),this.pc.createAnswer(this.callback(this,"setLocalAndSendMessageUpdate"),this.callback(this,"onCreateAnswerFailure"),kt)):(Ft.log("createAnswer - Promise version"),this.pc.createAnswer(kt).then(this.callback(this,"setLocalAndSendMessageUpdate")).catch(this.callback(this,"onCreateAnswerFailure")))},this.updateMediaWithRetryManagement=function(kt){Ft.debug("updateMediaWithRetryManagement");var st=this.updateMedia(kt);Ft.debug("updateMediaResult :",st),st.reason!=="Sig_state_not_stable"&&st.reason!=="Update_already_ongoing"||(Ft.debug("updateMedia will be retried later for reason :",st.reason),this.retryUpdateMedia=!0)},this.updateMedia=function(kt){return Ft.debug("updateMedia, callId :",this.callId),Ft.log("iceRestartActivated :",kt),this.pc===null?(Ft.log("updateMedia, pc no more exist"),{status:"Not_Done",reason:"PC_Not_Exit"}):this.updateMediaOngoing===!0?(Ft.log("updateMedia, already ongoing"),{status:"Not_Done",reason:"Update_already_ongoing"}):(this.updateMediaOngoing=!0,this.pc.signalingState!=="stable"?{status:"Not_Done",reason:"Sig_state_not_stable"}:(Ft.log("Sending Update offer to peer."),this.audioOnly?(Ft.log("audioOnly call :",this.mediaConstraintsAudioOnly),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),this.mediaConstraintsAudioOnly.mandatory!==void 0?this.mediaConstraintsAudioOnly.mandatory.IceRestart=!0:this.mediaConstraintsAudioOnly.iceRestart=!0,Ft.log("this.mediaConstraints :",this.mediaConstraintsAudioOnly),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOfferUpdate"),this.callback(this,"onCreateOfferFailure"),this.mediaConstraintsAudioOnly)):(Ft.log("createOffer - Promise version"),kt===!0&&(this.mediaConstraintsAudioOnly.iceRestart=!0),Ft.log("this.mediaConstraints :",this.mediaConstraintsAudioOnly),this.pc.createOffer(this.mediaConstraintsAudioOnly).then(this.callback(this,"setLocalAndSendMessageonOfferUpdate")).catch(this.callback(this,"onCreateOfferFailure")))):nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("createOffer"),kt===!0&&(this.mediaConstraints.mandatory!==void 0?this.mediaConstraints.mandatory.IceRestart=!0:this.mediaConstraints.iceRestart=!0),Ft.log("this.mediaConstraints :",this.mediaConstraints),this.pc.createOffer(this.callback(this,"setLocalAndSendMessageonOfferUpdate"),this.callback(this,"onCreateOfferFailure"),this.mediaConstraints)):(Ft.log("createOffer - Promise version"),kt===!0&&(this.mediaConstraints.iceRestart=!0),Ft.log("this.mediaConstraints :",this.mediaConstraints),this.pc.createOffer(this.mediaConstraints).then(this.callback(this,"setLocalAndSendMessageonOfferUpdate")).catch(this.callback(this,"onCreateOfferFailure"))),{status:"OnGoing",reason:"OK"}))},this.manipulateSDP=function(kt,st){var Tt=null,Rt=!1;return Ft.log("manipulateSDP with type :",st),qt.receiveMediaDeactivated===!0&&(Ft.log("setting receiveMediaDeactivated in SDP :"+qt.receiveMediaDeactivated),kt.sdp=qt.mySDPManager.setSendOnly(kt.sdp)),qt.RTPMedia===!0&&(kt.sdp=kt.sdp.replace(/RTP\/SAVPF/g,"RTP/SF")),qt.audioBandwidth!==null&&(Ft.log("setting audioBandwidth in SDP :"+qt.audioBandwidth),kt.sdp=qt.mySDPManager.setAudioBandwidth(kt.sdp,qt.audioBandwidth)),qt.videoBandwidth!==null&&(Ft.log("setting videoBandwidth in SDP :"+qt.videoBandwidth),kt.sdp=qt.mySDPManager.setVideoBandwidth(kt.sdp,qt.videoBandwidth)),qt.dataBandwidth!==null&&(Ft.log("setting dataBandwidth in SDP :"+qt.dataBandwidth),kt.sdp=qt.mySDPManager.setDataBandwidth(kt.sdp,qt.dataBandwidth)),qt.preferOpusCodec===!0&&(Ft.log("setting preferOpusCodec"),kt.sdp=qt.mySDPManager.preferOpus(kt.sdp)),qt.preferVP9Codec!==!0&&this.preferVP9Codec!==!0||(Ft.log("Call prefer VP9 Codec"),kt.sdp=qt.mySDPManager.maybePreferCodec(kt.sdp,"video","VP9")),qt.preferH264Codec!==!0&&this.preferH264Codec!==!0||(Ft.log("Call prefer H264 Codec"),kt.sdp=qt.mySDPManager.maybePreferCodec(kt.sdp,"video","H264")),this.preferVP8Codec===!0&&(Ft.log("Call prefer VP8 Codec"),kt.sdp=qt.mySDPManager.maybePreferCodec(kt.sdp,"video","VP8")),qt.setStereo===!0&&(Ft.log("Set Stereo"),kt.sdp=qt.mySDPManager.setCodecParam(kt.sdp,"opus/48000","stereo","1")),kt=qt.mySDPManager.updateSDPcodecs(kt,kt.type,"audio",qt.allowedAudioCodecs),kt=qt.mySDPManager.updateSDPcodecs(kt,kt.type,"video",qt.allowedVideoCodecs),st==="OFFER"?this.settingUpType==="publish"&&this.mediaTypeForIncomingCall==="NONE"?(Tt=qt.mySDPManager.createGuideline(kt.sdp),this.mediaTypeForOutgoingCall==="VIDEO"?((0,at.ki)(Tt,"audio","object")&&Tt.audio.direction!=="sendonly"&&(Tt.audio.direction="sendonly",Rt=!0),(0,at.ki)(Tt,"video","object")&&Tt.video.direction!=="sendonly"&&(Tt.video.direction="sendonly",Rt=!0)):this.mediaTypeForOutgoingCall==="AUDIO"?((0,at.ki)(Tt,"audio","object")&&Tt.audio.direction!=="sendonly"&&(Tt.audio.direction="sendonly",Rt=!0),(0,at.ki)(Tt,"video","object")&&Tt.video.direction!=="inactive"&&(Tt.video.direction="inactive",Rt=!0)):this.mediaTypeForOutgoingCall==="VIDEOONLY"&&((0,at.ki)(Tt,"audio","object")&&Tt.audio.direction!=="inactive"&&(Tt.audio.direction="inactive",Rt=!0),(0,at.ki)(Tt,"video","object")&&Tt.video.direction!=="sendonly"&&(Tt.video.direction="sendonly",Rt=!0)),Rt===!0&&(kt.sdp=Tt.generate())):this.mediaTypeForOutgoingCall==="VIDEO"?Ft.log("mediaTypeForOutgoingCall is VIDEO"):this.mediaTypeForOutgoingCall==="AUDIO"||this.audioOnly===!0?(Ft.log("mediaTypeForOutgoingCall is AUDIO"),kt.sdp=qt.mySDPManager.setRecvOnlyForVideo(kt.sdp)):this.mediaTypeForOutgoingCall==="VIDEOONLY"?(Ft.log("mediaTypeForOutgoingCall is VIDEOONLY"),kt.sdp=qt.mySDPManager.setRecvOnlyForAudio(kt.sdp)):this.mediaTypeForOutgoingCall==="NONE"&&(Ft.log("mediaTypeForOutgoingCall is NONE"),kt.sdp=qt.mySDPManager.setRecvOnly(kt.sdp)):st==="ANSWER"&&(this.mediaTypeForIncomingCall==="VIDEO"?Ft.log("mediaTypeForIncomingCall is VIDEO"):this.mediaTypeForIncomingCall==="AUDIO"||this.audioOnly===!0?(Ft.log("mediaTypeForIncomingCall is AUDIO"),kt.sdp=qt.mySDPManager.setRecvOnlyForVideo(kt.sdp)):this.mediaTypeForIncomingCall==="VIDEOONLY"?(Ft.log("mediaTypeForIncomingCall is VIDEOONLY"),kt.sdp=qt.mySDPManager.setRecvOnlyForAudio(kt.sdp)):this.mediaTypeForIncomingCall==="NONE"&&(Ft.log("mediaTypeForIncomingCall is NONE"),kt.sdp=qt.mySDPManager.setRecvOnly(kt.sdp))),this.simulcast==="SDP"&&st==="OFFER"&&this.settingUpType==="publish"&&((Tt=qt.mySDPManager.createGuideline(kt.sdp)).mungeForSimulcasting(),kt.sdp=Tt.generate()),kt},this.setLocalAndSendMessageonOffer=function(kt){Ft.info("setLocalAndSendMessageonOffer"),Ft.log("sessionDescription = ",kt),Ft.log("sessionDescription.sdp = ",kt.sdp);var st=null;kt.sdp=this.manipulateSDP(kt,"OFFER").sdp,Ft.log("manipulated sessionDescription.sdp = ",kt.sdp),this.stripAudioSDPActivated===!0&&(kt.sdp=qt.mySDPManager.stripAudioMediaDescriptionFromSDP(kt.sdp)),this.stripVideoSDPActivated===!0&&(kt.sdp=qt.mySDPManager.stripVideoMediaDescriptionFromSDP(kt.sdp)),this.setLocalCallProfile(qt.evalCallProfileWithSdp(kt.sdp,"local","send")),this.sendedSdpOfferMessage=kt,this.dataCall===!0&&(Ft.log("setLocalAndSendMessageonOffer : data Call"),this.callType="data"),this.callCancelled===!1?qt.NtoNConf===!1?(Ft.log("Conf N to 1"),this.screenSharing===!0&&(st=qt.mySDPManager.getAudioMediaDescriptionPart(this.sendedSdpOfferMessage.sdp),this.callType=st!=null?"screenSharingWithAudio":"screenSharing"),this.data&&this.data.MCUType==="MCU-Caller"&&(this.data.mediaStreamId=this.callLocalStream.id),this.trickleIce===!0&&(this.myWebRTC_Stack.sendInvite(this.callId,this.callerId,qt.nickname,this.dest_roomId,this.dest_roomId,this.callType,{offer:kt,data:this.data,stream:this.mcuRemoteStream,volatile:!!this.restarted}),this.inviteSended=!0),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessageonOffer : before setLocalDescription"),this.pc.setLocalDescription(this.sendedSdpOfferMessage,this.callback(this,"onSetLocalDescriptionSuccess"),this.callback(this,"onSetLocalDescriptionFailure"))):(Ft.log("setLocalAndSendMessageonOffer : before setLocalDescription - Promise version"),this.pc.setLocalDescription(this.sendedSdpOfferMessage).then(this.callback(this,"onSetLocalDescriptionSuccess")).catch(this.callback(this,"onSetLocalDescriptionFailure")))):(Ft.log("Conf N to N"),this.myWebRTC_Stack.sendInviteBroadcast(this.callId,this.callerId,qt.nickname,this.dest_roomId,this.dest_roomId,kt),this.inviteSended=!0):(Ft.warn("Invite is not sent has call has been canceled"),qt.removeCallFromTableWithCallIdandRemoteId(this.callId,this.calleeId,"Call_Cancelled"),qt.callsTable.length===0&&Ft.log("No more established calls for client"))},this.setLocalAndSendMessageonOfferUpdate=function(kt){var st,Tt=null;Ft.info("setLocalAndSendMessageonOfferUpdate, sessionDescription :"+kt),this.sendedSdpOfferMessage=kt,Ft.log("sessionDescription.sdp = ",kt.sdp),((0,at.Ym)(this.audioSdpDirection,"string")||(0,at.Ym)(this.videoSdpDirection,"string"))&&(Tt=qt.mySDPManager.createGuideline(kt.sdp),(0,at.ki)(Tt,"audio","object")&&(0,at.Ym)(this.audioSdpDirection,"string")&&(Tt.audio.direction=this.audioSdpDirection),(0,at.ki)(Tt,"video","object")&&(0,at.Ym)(this.videoSdpDirection,"string")&&(Tt.video.direction=this.videoSdpDirection),kt.sdp=Tt.generate()),this.setLocalCallProfile(qt.evalCallProfileWithSdp(kt.sdp,"local","send"),!0),st=this.callee?this.callerId:this.calleeId,this.trickleIce===!0?(this.myWebRTC_Stack.sendUpdate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt,this.callType,this.data),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessageonOfferUpdate : before setLocalDescription"),this.pc.setLocalDescription(kt,this.callback(this,"onSetLocalDescriptionSuccess"),this.callback(this,"onSetLocalDescriptionFailure"))):(Ft.log("setLocalAndSendMessageonOfferUpdate : before setLocalDescription - Promise version"),this.pc.setLocalDescription(kt).then(this.callback(this,"onSetLocalDescriptionSuccess")).catch(this.callback(this,"onSetLocalDescriptionFailure")))):(Ft.log("Updating PC offer and answer after switch Stream"),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessageonOfferUpdate : before setLocalDescription"),this.pc.setLocalDescription(kt,this.callback(this,"onSetLocalDescriptionSuccess"),this.callback(this,"onSetLocalDescriptionFailure"))):(Ft.log("setLocalAndSendMessageonOfferUpdate : before setLocalDescription - Promise version"),this.pc.setLocalDescription(kt).then(this.callback(this,"onSetLocalDescriptionSuccess")).catch(this.callback(this,"onSetLocalDescriptionFailure"))),qt.preferSendingH264Codec&&(Ft.log("Modification of SDP to set H264 as prefered sending codec"),this.pc.remoteDescription.sdp=qt.mySDPManager.maybePreferCodec(this.pc.remoteDescription.sdp,"video","H264")),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessageonOfferUpdate : before setRemoteDescription"),this.pc.setRemoteDescription(this.pc.remoteDescription,this.callback(this,"onSetRemoteDescriptionSuccess"),this.callback(this,"onSetRemoteDescriptionFailure"))):(Ft.log("setLocalAndSendMessageonOfferUpdate : before setRemoteDescription - Promise version"),this.pc.setRemoteDescription(this.pc.remoteDescription).then(this.callback(this,"onSetRemoteDescriptionSuccess")).catch(this.callback(this,"onSetRemoteDescriptionFailure"))))},this.onCreateOfferFailure=function(kt){Ft.info("onCreateOfferFailure"+kt),kt=null},this.onCreateAnswerFailure=function(kt){Ft.info("onCreateAnswerFailure"+kt),kt=null},this.setLocalAndSendMessage=function(kt){var st;Ft.info("setLocalAndSendMessage"),Ft.log("sessionDescription.sdp = ",kt.sdp),this.pc!==null?(kt=this.manipulateSDP(kt,"ANSWER"),st=qt.mySDPManager.createGuideline(kt.sdp),this.setLocalCallProfile(qt.evalCallProfileWithSdpGuideline(st,kt.sdp,"local","send")),this.setRemoteCallProfile(qt.evalCallProfileWithSdpGuideline(st,kt.sdp,"local","receive")),Ft.log("manipulated sessionDescription.sdp = ",kt.sdp),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessage : before setLocalDescription"),this.pc.setLocalDescription(kt,this.callback(this,"onSetLocalDescriptionSuccess"),this.callback(this,"onSetLocalDescriptionFailure"))):(Ft.log("setLocalAndSendMessage : before setLocalDescription - Promise version"),this.pc.setLocalDescription(kt).then(this.callback(this,"onSetLocalDescriptionSuccess")).catch(this.callback(this,"onSetLocalDescriptionFailure"))),this.sendedSdpOfferMessage=kt,this.trickleIce===!0&&this.myWebRTC_Stack.send200OK(this.callId,this.callerId,this.calleeId,qt.nickname,this.dest_roomId,kt,this.data)):Ft.log("setLocalAndSendMessage, pc no more exist")},this.setLocalAndSendMessageUpdate=function(kt){var st;if(this.pc!==null){at.wL.type==="safari"&&(kt.sdp=this.manipulateSDP(kt,"OFFER").sdp),st=qt.mySDPManager.createGuideline(kt.sdp),this.mediaType==="AUDIOONLY"?st.hasOwnProperty("video")&&st.video.direction!=="inactive"&&(Ft.debug("Only audio was requested at call setup: deactivating video"),st.video.direction="inactive",kt.sdp=st.generate()):this.mediaType==="VIDEOONLY"&&st.hasOwnProperty("audio")&&st.audio.direction!=="inactive"&&(Ft.debug("Only video was requested at call setup: deactivating audio"),st.audio.direction="inactive",kt.sdp=st.generate()),this.setLocalCallProfile(qt.evalCallProfileWithSdpGuideline(st,kt.sdp,"local","send"),!0),this.setRemoteCallProfile(qt.evalCallProfileWithSdpGuideline(st,kt.sdp,"local","receive"),!0),this.updateOngoingTimeoutId&&(clearTimeout(this.updateOngoingTimeoutId),delete this.updateOngoingTimeoutId),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?(Ft.log("setLocalAndSendMessageUpdate : before setLocalDescription"),this.pc.setLocalDescription(kt,this.callback(this,"onSetLocalDescriptionSuccess"),this.callback(this,"onSetLocalDescriptionFailure"))):(Ft.log("setLocalAndSendMessageUpdate : before setLocalDescription - Promise version"),this.pc.setLocalDescription(kt).then(this.callback(this,"onSetLocalDescriptionSuccess")).catch(this.callback(this,"onSetLocalDescriptionFailure")));var Tt;Tt=this.callee?this.callerId:this.calleeId,this.myWebRTC_Stack.send200Update(this.callId,this.callerId,this.calleeId,this.dest_roomId,Tt,kt,this.data),this.asyncCallbacks&&this.asyncCallbacks.type==="updateMediaType"&&(Ft.debug("asyncCallbacks resolve"),this.asyncCallbacks.resolve(),this.asyncCallbacks.timeoutId&&(clearTimeout(this.asyncCallbacks.timeoutId),delete this.asyncCallbacks.timeoutId),delete this.asyncCallbacks)}else Ft.log("setLocalAndSendMessageUpdate, pc no more exist")},this.onIceCandidate=function(kt){try{Ft.debug("onIceCandidate :",JSON.stringify(kt.candidate))}catch(Lt){Ft.error(Lt)}var st,Tt=0,Rt=0;st=this.callee?this.callerId:this.calleeId,this.pc!==null&&(Ft.debug("Ice Connection State is now : "+this.pc.iceConnectionState),Ft.debug("Ice Gathering State is now : "+this.pc.iceGatheringState)),kt.candidate?(this.candidateNb+=1,this.trickleIce===!0?this.mediaRoutingMode===qt.mediaRoutingModeEnum.hostOnly?(Tt=kt.candidate.candidate.search("host"))!==-1?this.myWebRTC_Stack.sendCandidate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt.candidate.sdpMLineIndex,kt.candidate.sdpMid,kt.candidate.candidate,this.data,kt.candidate,{volatile:!!this.restarted}):Ft.log("Media routing mode is hostOnly and not a HOST Candidate : ignoring message"):this.mediaRoutingMode===qt.mediaRoutingModeEnum.stun?(Tt=kt.candidate.candidate.search("host"),Rt=kt.candidate.candidate.search("srflx"),Tt!==-1||Rt!==-1?this.myWebRTC_Stack.sendCandidate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt.candidate.sdpMLineIndex,kt.candidate.sdpMid,kt.candidate.candidate,this.data,kt.candidate,{volatile:!!this.restarted}):Ft.log("Media routing mode is stun and not a HOST or SRFLX Candidate : ignoring message")):this.mediaRoutingMode===qt.mediaRoutingModeEnum.stunOnly?(Tt=kt.candidate.candidate.search("srflx"))!==-1?this.myWebRTC_Stack.sendCandidate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt.candidate.sdpMLineIndex,kt.candidate.sdpMid,kt.candidate.candidate,this.data,kt.candidate,{volatile:!!this.restarted}):Ft.log("Media routing mode is stunOnly and not a SRFLX Candidate : ignoring message"):this.mediaRoutingMode===qt.mediaRoutingModeEnum.turn?(Ft.log("Media routing mode is turn : all candidates are considered"),this.myWebRTC_Stack.sendCandidate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt.candidate.sdpMLineIndex,kt.candidate.sdpMid,kt.candidate.candidate,this.data,kt.candidate,{volatile:!!this.restarted})):this.mediaRoutingMode===qt.mediaRoutingModeEnum.turnOnly&&((Tt=kt.candidate.candidate.search("relay"))!==-1?this.myWebRTC_Stack.sendCandidate(this.callId,this.callerId,this.calleeId,this.dest_roomId,st,kt.candidate.sdpMLineIndex,kt.candidate.sdpMid,kt.candidate.candidate,this.data,kt.candidate,{volatile:!!this.restarted}):Ft.log("Media routing mode is TurnOnly and not a RELAY Candidate : ignoring message")):Ft.log("trickleIce is deactivated : candidates are not sended")):(Ft.info("End of candidates."),this.trickleIce===!1&&(Ft.log("trickleIce === false"),this.callee===!0?(this.send200OKTrickleIceFalseTimeOutId!==0&&(clearTimeout(this.send200OKTrickleIceFalseTimeOutId),this.send200OKTrickleIceFalseTimeOutId=0),this.message200OKSended===!1?this.myWebRTC_Stack.send200OK(this.callId,this.callerId,this.calleeId,qt.nickname,this.dest_roomId,this.pc.localDescription,this.data):Ft.log("200OK already sended")):this.pc!==null&&(this.sendInviteTrickleIceFalseTimeOutId!==0&&(clearTimeout(this.sendInviteTrickleIceFalseTimeOutId),this.sendInviteTrickleIceFalseTimeOutId=0),this.inviteSended===!1?(Ft.log("sendInvite on end of candidate"),this.myWebRTC_Stack.sendInvite(this.callId,this.callerId,qt.nickname,this.dest_roomId,this.dest_roomId,this.callType,{offer:this.pc.localDescription,data:this.data,stream:this.mcuRemoteStream,volatile:!!this.restarted}),this.inviteSended=!0):Ft.log("Invite already sended"))))},this.combineRemoteStreams=function(kt,st,Tt,Rt){var Lt=kt.getTracks(),Et=Tt.getTracks();if(Lt.length===1&&Et.length===1&&(Lt[0].kind==="audio"&&Et[0].kind==="video"||Lt[0].kind==="video"&&Et[0].kind==="audio")){Ft.debug("combineRemoteStreams");var jt=new MediaStream;return jt.addTrack(Lt[0]),jt.addTrack(Et[0]),Rt==="internal"&&(Tt.removeTrack(Et[0]),this.onRemoteStreamRemoved({stream:Tt})),st==="internal"&&(kt.removeTrack(Lt[0]),this.onRemoteStreamRemoved({stream:kt})),this.onRemoteStreamAdded({stream:jt}),!0}return!1},this.checkRemoteStreamExists=function(kt,st){var Tt=!1,Rt=null,Lt=null,Et=null,jt=null,Pt=null;for(st&&Array.isArray(st)&&(jt=st.slice(0)),Rt=this.remoteMediaStreams.length;--Rt>=0;){if(this.remoteMediaStreams[Rt].id===kt){Tt=!0;break}if(jt)for(Et=(Lt=this.remoteMediaStreams[Rt].getTracks()).length;--Et>=0;)(Pt=st.indexOf(Lt[Et].id))>=0&&(jt[Pt]=!0)}if(!Tt&&jt){for(Pt=0,Et=jt.length;--Et>=0;)jt[Et]===!0&&(Pt+=1);Pt===jt.length&&(Tt=!0)}return Tt},this.onRemoteStreamAdded=function(kt){var st,Tt,Rt=this;if(Ft.info("onRemoteStreamAdded",kt),this.checkRemoteStreamExists(kt.stream.id,kt.stream.getTracks().map(function(Jt){return Jt.id})))Ft.debug("onRemoteStreamAdded: ignoring event; stream/track already known");else if(this.remoteMediaStreams.length!==1||!this.combineRemoteStreams(this.remoteMediaStreams[0],"internal",kt.stream,"event")){Ft.debug("onRemoteStreamAdded adding",kt.stream.id),kt.stream.id==="janus"&&this.data.remoteMediaStreamId&&(Ft.debug("onRemoteStreamAdded adding remoteMediaStreamId on stream :",this.data.remoteMediaStreamId),kt.stream.remoteMediaStreamId=this.data.remoteMediaStreamId),this.remoteMediaStreams.push(kt.stream),Ft.log("CallId is :"+this.callId),Ft.log("ClientId is :"+qt.clientId),this.sessionMCU&&this.sessionMCU.modeChangeKind==="new"&&qt.processRemoteStreamAdded(this,kt.stream),this.screenSharing===!0?this.callType="screenSharing":this.audioOnly===!0&&(this.callType="audio");var Lt,Et=function(Jt){var sn=null,mn=null;Jt.onmute=function(an){Ft.debug(Jt.kind+" mute event");var hn="";Jt.kind==="audio"&&sn===null?sn=setTimeout(function(){Rt.isRemoteAudioSilent=!0,hn="audioIsSilentLocally";var wn={},Mn={},xn=[];xn.push(hn),wn.available=Rt.remoteCallProfile.audio,wn.active=Rt.remoteCallProfile.audioActive,wn.muted=Rt.isRemoteAudioMuted,wn.silent=Rt.isRemoteAudioSilent,Mn.available=Rt.remoteCallProfile.video,Mn.active=Rt.remoteCallProfile.videoActive,Mn.muted=Rt.isRemoteVideoMuted,Mn.silent=Rt.isRemoteVideoSilent,Rt.myWebRTC_Event.createRemoteStreamUpdatedEvent(xn,wn,Mn,Rt.destCallType,Rt.callId,"browserAction"),sn=null},2520):Jt.kind==="video"&&mn===null&&(mn=setTimeout(function(){Rt.isRemoteVideoSilent=!0,hn="videoIsSilentLocally";var wn={},Mn={},xn=[];xn.push(hn),wn.available=Rt.remoteCallProfile.audio,wn.active=Rt.remoteCallProfile.audioActive,wn.muted=Rt.isRemoteAudioMuted,wn.silent=Rt.isRemoteAudioSilent,Mn.available=Rt.remoteCallProfile.video,Mn.active=Rt.remoteCallProfile.videoActive,Mn.muted=Rt.isRemoteVideoMuted,Mn.silent=Rt.isRemoteVideoSilent,Rt.myWebRTC_Event.createRemoteStreamUpdatedEvent(xn,wn,Mn,Rt.destCallType,Rt.callId,"browserAction"),mn=null},2520))},Jt.onunmute=function(an){if(Ft.debug(Jt.kind+" unmute event"),Jt.kind==="audio"&&sn!==null)clearTimeout(sn),sn=null;else if(Jt.kind==="video"&&mn!==null)clearTimeout(mn),mn=null;else{var hn="";Jt.kind==="audio"?(Rt.isRemoteAudioSilent=!1,hn="audioIsSilentLocally"):Jt.kind==="video"&&(Rt.isRemoteVideoSilent=!1,hn="videoIsSilentLocally");var wn={},Mn={},xn=[];xn.push(hn),wn.available=Rt.remoteCallProfile.audio,wn.active=Rt.remoteCallProfile.audioActive,wn.muted=Rt.isRemoteAudioMuted,wn.silent=Rt.isRemoteAudioSilent,Mn.available=Rt.remoteCallProfile.video,Mn.active=Rt.remoteCallProfile.videoActive,Mn.muted=Rt.isRemoteVideoMuted,Mn.silent=Rt.isRemoteVideoSilent,Rt.myWebRTC_Event.createRemoteStreamUpdatedEvent(xn,wn,Mn,Rt.destCallType,Rt.callId,"browserAction")}},Jt.onended=function(an){Ft.debug(Jt.kind+" ended event"),Jt.kind==="audio"&&sn!==null?(clearTimeout(sn),sn=null):Jt.kind==="video"&&mn!==null&&(clearTimeout(mn),mn=null)}},jt=nn(kt.stream.getVideoTracks());try{for(jt.s();!(Lt=jt.n()).done;){var Pt=Lt.value;Et(Pt),this.isRemoteVideoSilent=Pt.muted}}catch(Jt){jt.e(Jt)}finally{jt.f()}var Vt,Qt=nn(kt.stream.getAudioTracks());try{for(Qt.s();!(Vt=Qt.n()).done;){var rn=Vt.value;Et(rn),this.isRemoteAudioSilent=rn.muted}}catch(Jt){Qt.e(Jt)}finally{Qt.f()}st={available:this.remoteCallProfile.audio,active:this.remoteCallProfile.audioActive,muted:this.isRemoteAudioMuted,silent:this.isRemoteAudioSilent},Tt={available:this.remoteCallProfile.video,active:this.remoteCallProfile.videoActive,muted:this.isRemoteVideoMuted,silent:this.isRemoteVideoSilent},this.data!==null?this.data.mesh!==void 0?qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.stream,this.remoteId,this.destCallType,st,Tt):this.data.type==="publish"&&this.data.mode!=="passive"?Ft.warn("Filtering Remote stream added event (behavior on Chrome 44), no remote stream on publish calls"):this.data.subscribeOrder===!0&&this.data.pubCallId!==void 0?(Ft.debug("substitute callId: "+this.callId+" -> "+this.data.pubCallId),qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.data.pubCallId,kt.stream,this.remoteId,this.destCallType,st,Tt)):qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.stream,this.remoteId,this.destCallType,st,Tt):qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.stream,this.remoteId,this.destCallType,st,Tt)}},this.onRemoteTrackAdded=function(kt){var st,Tt;if(Ft.info("onRemoteTrackAdded",kt),kt.streams[0]!==void 0&&kt.track!==void 0){if(this.checkRemoteStreamExists(kt.streams[0].id,[kt.track.id]))Ft.debug("onRemoteTrackAdded: ignoring event; stream/track already known");else if(this.remoteMediaStreams.length!==1||!this.combineRemoteStreams(this.remoteMediaStreams[0],"internal",kt.streams[0],"event")){if(this.belongsToRoom()){if(this.callType==="audio"&&kt.track.kind!=="audio"||this.callType==="videoOnly"&&kt.track.kind!=="video"||this.callType==="media"&&kt.track.kind!=="video"||this.callType==="screenSharing"&&kt.track.kind!=="video"||this.callType==="screenSharingWithAudio"&&kt.track.kind!=="video")return void Ft.debug("onRemoteTrackAdded: ignoring event; callType: "+this.callType+", event.track.kind: "+kt.track.kind)}else if(this.destCallType==="audio"&&kt.track.kind!=="audio"||this.destCallType==="videoOnly"&&kt.track.kind!=="video"||this.destCallType==="media"&&kt.track.kind!=="video"||this.destCallType==="screenSharing"&&kt.track.kind!=="video"||this.destCallType==="screenSharingWithAudio"&&kt.track.kind!=="video")return Ft.debug("onRemoteTrackAdded: ignoring event; destCallType: "+this.destCallType+", event.track.kind: "+kt.track.kind),void(this.remoteMediaStreams.length===2&&this.combineRemoveStreams(this.remoteMediaStreams[0],"internal",this.remoteMediaStreams[1],"internal"));Ft.debug("onRemoteTrackAdded adding; stream.id: "+kt.streams[0].id),this.remoteMediaStreams.push(kt.streams[0]),Ft.log("CallId is :"+this.callId),Ft.log("ClientId is :"+qt.clientId),Ft.log("this.callType :"+this.callType),this.screenSharing===!0?this.callType="screenSharing":this.audioOnly===!0&&(this.callType="audio"),this.sessionMCU&&this.sessionMCU.modeChangeKind==="new"&&qt.processRemoteStreamAdded(this,kt.streams[0]),kt.streams[0].onaddtrack=function(Rt){Ft.debug("onRemoteTrackAdded ontrack.onaddtrack",Rt)},kt.streams[0].onremovetrack=(function(Rt){var Lt=null;if(Ft.debug("onRemoteTrackAdded ontrack.onremovetrack",Rt),this.updateOngoingTimeoutId)return Ft.debug("onRemoteTrackAdded onremovetrack: update ongoing"),void Ft.debug("onRemoteTrackAdded onremovetrack: ignoring event",Rt.track.kind);if(this.callType==="audio"&&Rt.track.kind!=="audio"||this.callType==="videoOnly"&&Rt.track.kind!=="video"||this.callType==="media"&&Rt.track.kind!=="video"||this.callType==="screenSharing"&&Rt.track.kind!=="video"||this.callType==="screenSharingWithAudio"&&Rt.track.kind!=="video")Ft.debug("onRemoteTrackAdded onremovetrack: ignoring event",Rt.track.kind);else if(Rt.target instanceof MediaStream){for(Lt=this.remoteMediaStreams.length;--Lt>=0;)if(this.remoteMediaStreams[Lt].id===Rt.target.id){Ft.debug("onRemoteTrackAdded onremovetrack removing",Rt.target.id),this.remoteMediaStreams.splice(Lt,1);break}qt.myWebRTC_Event.createRemoteStreamRemovedEvent(this.callType,this.callId,Rt.target,this.remoteId,this.destCallType)}else Ft.debug("onRemoteTrackAdded onremovetrack: ignoring event target not MediaStream")}).bind(this),st={available:this.remoteCallProfile.audio,active:this.remoteCallProfile.audioActive,muted:this.isRemoteAudioMuted,silent:this.isRemoteAudioSilent},Tt={available:this.remoteCallProfile.video,active:this.remoteCallProfile.videoActive,muted:this.isRemoteVideoMuted,silent:this.isRemoteVideoSilent},this.data!==null?this.data.mesh!==void 0?(this.callType==="audio"&&kt.track.kind==="audio"||this.callType==="videoOnly"&&kt.track.kind==="video"||this.callType==="media"&&kt.track.kind==="video"||this.callType==="screenSharing"&&kt.track.kind==="video"||this.callType==="screenSharingWithAudio"&&kt.track.kind==="video")&&qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.streams[0],this.remoteId,this.destCallType,st,Tt):this.data.type==="publish"&&this.data.mode!=="passive"?Ft.warn("Filtering Remote stream added event (behavior on Chrome 44), no remote stream on publish calls"):this.belongsToRoom()?(this.callType==="audio"&&kt.track.kind==="audio"||this.callType==="videoOnly"&&kt.track.kind==="video"||this.callType==="media"&&kt.track.kind==="video"||this.callType==="screenSharing"&&kt.track.kind==="video"||this.callType==="screenSharingWithAudio"&&kt.track.kind==="video")&&(this.data.subscribeOrder===!0&&this.data.pubCallId!==void 0?(Ft.debug("substitute callId: "+this.callId+" -> "+this.data.pubCallId),qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.data.pubCallId,kt.streams[0],this.remoteId,this.destCallType,st,Tt)):qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.streams[0],this.remoteId,this.destCallType,st,Tt)):(this.destCallType==="audio"&&kt.track.kind==="audio"||this.destCallType==="videoOnly"&&kt.track.kind==="video"||this.destCallType==="media"&&kt.track.kind==="video"||this.destCallType==="screenSharing"&&kt.track.kind==="video"||this.destCallType==="screenSharingWithAudio"&&kt.track.kind==="video")&&qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.streams[0],this.remoteId,this.destCallType,st,Tt):this.belongsToRoom()?(this.callType==="audio"&&kt.track.kind==="audio"||this.callType==="videoOnly"&&kt.track.kind==="video"||this.callType==="media"&&kt.track.kind==="video"||this.callType==="screenSharing"&&kt.track.kind==="video"||this.callType==="screenSharingWithAudio"&&kt.track.kind==="video")&&qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.streams[0],this.remoteId,this.destCallType,st,Tt):(this.destCallType==="audio"&&kt.track.kind==="audio"||this.destCallType==="videoOnly"&&kt.track.kind==="video"||this.destCallType==="media"&&kt.track.kind==="video"||this.destCallType==="screenSharing"&&kt.track.kind==="video"||this.destCallType==="screenSharingWithAudio"&&kt.track.kind==="video")&&qt.myWebRTC_Event.createRemoteStreamAddedEvent(this.callType,this.callId,kt.streams[0],this.remoteId,this.destCallType,st,Tt)}}else Ft.debug("onRemoteTrackAdded: ignoring event; event data are not correct")},this.onRemoteStreamRemoved=function(kt){var st=null;for(Ft.info("onRemoteStreamRemoved",kt),st=this.remoteMediaStreams.length;--st>=0;)if(this.remoteMediaStreams[st].id===kt.stream.id){Ft.debug("onRemoteStreamRemoved removing",kt.stream.id),this.remoteMediaStreams.splice(st,1);break}qt.myWebRTC_Event.createRemoteStreamRemovedEvent(this.callType,this.callId,kt.stream,this.remoteId,this.destCallType),kt=null},this.onNegotiationNeeded=function(kt){Ft.debug("onNegotiationNeeded",kt),kt=null,this.addingDataChannelOnCallOngoing&&(this.updateMediaWithRetryManagement(!1),this.addingDataChannelOnCallOngoing=!1)},this.onSignalingStateChange=function(kt){Ft.debug("onSignalingStateChange",kt),kt=null},this.onCallDisconnection=function(){Ft.info("onCallDisconnection; callId: "+this.callId);var kt=new Date;Ft.debug("date:",kt),this.disconnectionWarningInterval!==0&&(Ft.debug("date:",kt),Ft.debug("clearing disconnectionWarningInterval"),clearInterval(this.disconnectionWarningInterval),this.disconnectionWarningInterval=0),this.disconnectionWarningTimeout!==0&&(Ft.debug("date:",kt),Ft.debug("clearing disconnectionWarningTimeout"),clearTimeout(this.disconnectionWarningTimeout),this.disconnectionWarningTimeout=0),this.belongsToRoom()?qt.onHangup(this.callId,"disconnected"):qt.onHangup(this.callId,"Ice_disconnected")},this.sendDisconnectionWarning=function(){Ft.log("sendDisconnectionWarning()");var kt=null,st=null;if(this.callControl&&(kt=this.callControl.roomName,st=this.callControl.type),this.disconnectionWarningCount++,un.createEvent({eventType:"disconnectionWarning",callId:this.callId,remoteId:this.remoteId,tries:this.disconnectionWarningCount,roomName:kt,settingUpType:st}),(this.disconnectionWarningCount-1)*this.disconnectionWarningDelay>=this.disconnectionTimer&&this.disconnectionWarningInterval!==0){var Tt=Date();Ft.debug("date :"+Tt),Ft.debug("clearing disconnectionWarningInterval : no more warnings"),clearInterval(this.disconnectionWarningInterval),this.disconnectionWarningInterval=0}},this.createIceErrorDescriptor=function(kt,st){var Tt={};return kt==="disconnected"?Tt.iceState="disconnected":kt==="failed"?(Tt.iceState="failed",st===!0&&(Tt.previousIceState="disconnected")):Tt.iceState="unknown",Tt.callType=this.callType,this.belongsToRoom()?(Tt.context="conf",this.data.mesh?(Tt.mode="mesh",(this.data.mesh.callerCompositeUserId?this.data.mesh.callerCompositeUserId===qt.compositeClientId:this.data.mesh.callerId===qt.clientId)?(Tt.type="subscribe",Tt.clientId=this.data.mesh.callerId,Tt.remoteId=this.data.mesh.calleeId):(this.data.mesh.calleeCompositeUserId?this.data.mesh.calleeCompositeUserId===qt.compositeClientId:this.data.mesh.calleeId===qt.clientId)?(Tt.type="publish",Tt.clientId=this.data.mesh.calleeId,Tt.remoteId=this.data.mesh.callerId):Tt.type="unknown",Tt.mesh=this.data.mesh):(Tt.mode="sfu",this.settingUpType==="publish"||this.settingUpType==="shareScreen"?Tt.type="publish":this.settingUpType==="subscribe"?Tt.type="subscribe":Tt.type="unknown",this.callee?(Tt.clientId=this.calleeId,Tt.remoteId=this.callerId):(Tt.clientId=this.callerId,Tt.remoteId=this.calleeId)),this.mcuRemoteStream&&(Tt.stream=this.mcuRemoteStream)):(Tt.context="call",Tt.mode="p2p",this.callerId===qt.clientId?(Tt.clientId=this.callerId,Tt.remoteId=this.calleeId):this.calleeId===qt.clientId&&(Tt.clientId=this.calleeId,Tt.remoteId=this.callerId)),Tt},this.onIceConnectionStateChange=function(kt){Ft.debug("onIceConnectionStateChange: ",kt),kt=null;var st=0,Tt=null,Rt=null,Lt=null;this.pc!==null?(Ft.info("Ice Connection State is now : "+this.pc.iceConnectionState),this.iceState=this.pc.iceConnectionState,this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed"||this.pc.iceConnectionState==="checking"?(Ft.debug("iceConnectionState === connected or completed or checking"),Ft.debug("this.disconnectionTimeoutId :"+this.disconnectionTimeoutId),this.disconnectionTimeoutId!==0&&(st=Date(),Ft.debug("date:",st),Ft.debug("clearing disconnectionTimeout"),clearTimeout(this.disconnectionTimeoutId),this.disconnectionTimeoutId=0),this.disconnectionWarningInterval!==0&&(st=Date(),Ft.debug("date:",st),Ft.debug("clearing disconnectionWarningInterval"),clearInterval(this.disconnectionWarningInterval),this.disconnectionWarningInterval=0),this.pc.iceConnectionState!=="checking"&&(this.checkCandidateTypesTimeoutId=setTimeout(this.callback(this,"checkCandidateTypes"),this.checkCandidateTypesTimer),this.checkCandidateTypesTimeoutTable.push(this.checkCandidateTypesTimeoutId))):this.pc.iceConnectionState==="disconnected"?(this.callControl&&(Tt=this.callControl.roomName,Rt=this.callControl.type),(Lt=this.createIceErrorDescriptor("disconnected")).context==="conf"&&this.myWebRTC_Stack.sendInfo("iceError",{clientId:qt.clientId,callId:this.callId,roomId:this.sessionMCU.roomName,pubSub:qt.MCUClient.pubConnector,descriptor:Lt}),Ft.warn("disconnection detected"),un.createErrorEvent("iceDisconnection detected","ICE_CONNECTION_STATE_DISCONNECTED",this.callId,Tt,Rt,Lt),st=new Date,Ft.debug("date:",st),this.disconnectionTimeoutId=setTimeout(this.callback(this,"onCallDisconnection"),this.disconnectionTimer),this.disconnectionWarningCount=0,this.disconnectionWarningTimeout=setTimeout(this.callback(this,"sendDisconnectionWarning"),2e3),this.disconnectionWarningInterval=setInterval(this.callback(this,"sendDisconnectionWarning"),this.disconnectionWarningDelay)):this.pc.iceConnectionState==="failed"&&(this.callControl&&(Tt=this.callControl.roomName,Rt=this.callControl.type),(Lt=this.createIceErrorDescriptor("failed",this.disconnectionTimeoutId!==0)).context==="conf"&&this.myWebRTC_Stack.sendInfo("iceError",{clientId:qt.clientId,callId:this.callId,roomId:this.sessionMCU.roomName,pubSub:qt.MCUClient.pubConnector,descriptor:Lt}),Ft.warn("iceConnection failed detected"),un.createErrorEvent("iceConnection failed detected","ICE_CONNECTION_STATE_FAILED",this.callId,Tt,Rt,Lt),this.disconnectionTimeoutId!==0?this.belongsToRoom()&&(clearTimeout(this.disconnectionTimeoutId),this.disconnectionTimeoutId=0,qt.onHangup(this.callId,"disconnected")):this.belongsToRoom()&&(0,at.ki)(this.callControl,["autoRestart","counter"],"number")&&this.callControl.autoRestart.counter>0?qt.onHangup(this.callId,"disconnected"):(Ft.warn("Removing call with callId: "+this.callId),qt.removeCallFromTableWithCallIdAndSendBye(this.callId,"Ice_failed")))):Ft.log("Ice Connection State change with pc is null")},this.callback=function(kt,st){return this.closureHandler=function(Tt,Rt){return kt[st](Tt,Rt)},this.closureHandler},this.onSelectedCandidate=function(kt){if(this.selectedCandidate===void 0||this.selectedCandidate===null||this.selectedCandidate.LocalCandidateType!==kt.LocalCandidateType||this.selectedCandidate.RemoteCandidateType!==kt.RemoteCandidateType||this.selectedCandidate.LocalAddress!==kt.LocalAddress||this.selectedCandidate.RemoteAddress!==kt.RemoteAddress||this.selectedCandidate.TransportType!==kt.TransportType||this.selectedCandidate.LocalTransportType!==kt.LocalTransportType){Ft.debug("WebRTC_Call::onSelectedCandidate() :",kt),this.selectedCandidate=kt,this.callControl&&this.callControl.autoRestart&&(Ft.debug("selectedCandidate, this.callControl.autoRestart.counter:",this.callControl.autoRestart.counter),Ft.debug("selectedCandidate, this.callControl.autoRestart.callIdWhenStartingTimer:",this.callControl.autoRestart.callIdWhenStartingTimer),this.callControl.autoRestart.counter&&(Ft.debug("Reinit of autoRestart.counter"),this.callControl.autoRestart.counter=0,this.callControl.autoRestart.callIdWhenStartingTimer!==void 0&&qt.stopMaxCallRetriesTimer(this.callControl.autoRestart.callIdWhenStartingTimer))),this.myWebRTC_Event.createSelectedICECandidateEvent(this.callId,kt.LocalCandidateType,kt.RemoteCandidateType,kt.LocalAddress,kt.RemoteAddress,kt.TransportType,kt.LocalTransportType);var st=kt;st.callId=this.callId,st.clientId=qt.clientId,st.roomId=this.dest_roomId,this.data.pubSub!==void 0&&(st.pubSub=this.data.pubSub),this.data.confId!==void 0&&(st.confId=this.data.confId),this.data.mesh!==void 0&&(st.mesh=this.data.mesh),this.data.instanceId!==void 0&&(st.instanceId=this.data.instanceId),this.myWebRTC_Stack.sendInfo("callSelectedCandidate",st)}else Ft.debug("filtering duplicate candidate")},this.checkCandidateTypes=function(){Ft.debug("WebRTC_Call::checkCandidatesTypes()");var kt=this,st={LocalCandidateType:"unknow",RemoteCandidateType:"unknow",LocalAddress:"unknow",RemoteAddress:"unknow",TransportType:"unknow",LocalTransportType:"unknow",relayTransportType:"unknow"},Tt=["googLocalAddress","googLocalCandidateType","googRemoteAddress","googRemoteCandidateType","googTransportType"];this.pc===null?(Ft.warn("Peer connection is null : no candidates"),kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st)):typeof apiRTC_React<"u"?(Ft.debug("apiRTC_React : WebRTC_Call::checkCandidatesTypes()"),this.pc.getStats().then(function(Rt){var Lt=null;if(Rt.forEach(function(Pt){Pt.nominated===!0&&(Lt=Pt)}),Lt!==null){var Et=Rt.get(Lt.localCandidateId),jt=Rt.get(Lt.remoteCandidateId);st.LocalCandidateType=Et.candidateType,st.RemoteCandidateType=jt.candidateType,Et.address&&Et.port&&(st.LocalAddress=Et.address+":"+Et.port),jt.address&&jt.port&&(st.RemoteAddress=jt.address+":"+jt.port),st.TransportType=Et.protocol,Et.candidateType==="relay"&&Et.relayProtocol!==void 0&&(st.relayTransportType=Et.relayProtocol),kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st)}}).catch(function(Rt){Ft.error(Rt)})):at.wL.type==="chrome"&&nt.PR<=112?(Ft.debug("WebRTC_Call::checkCandidatesTypes() chrome <= 112"),this.pc.getStats(function(Rt){var Lt=Rt.result().filter(function(Et){return Et.id.indexOf("Conn-")===0&&Et.stat("googActiveConnection")==="true"})[0];Lt?(Tt.forEach(function(Et){st[Et.replace("goog","")]=Lt.stat(Et)}),kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st)):(kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st))})):at.wL.type==="chrome"||at.wL.type==="firefox"||at.wL.type==="safari"?(Ft.debug("WebRTC_Call::checkCandidatesTypes()"),this.pc.getStats(null).then(function(Rt){var Lt=null;if(Rt.forEach(function(Pt){Pt.selected===!0&&at.wL.type==="firefox"?(Lt!==null&&Ft.warn("multiple selected candidate-pairs"),Lt=Pt):Pt.nominated===!0&&(Lt=Pt)}),Lt!==null){var Et=Rt.get(Lt.localCandidateId),jt=Rt.get(Lt.remoteCandidateId);st.LocalCandidateType=Et.candidateType,st.RemoteCandidateType=jt.candidateType,Et.address&&Et.port?st.LocalAddress=Et.address+":"+Et.port:Et.ipAddress&&Et.portNumber&&(st.LocalAddress=Et.ipAddress+":"+Et.portNumber),jt.address&&jt.port?st.RemoteAddress=jt.address+":"+jt.port:jt.ipAddress&&jt.portNumber&&(st.RemoteAddress=jt.ipAddress+":"+jt.portNumber),st.TransportType=Et.protocol,Et.candidateType==="relay"&&Et.relayProtocol!==void 0&&(st.relayTransportType=Et.relayProtocol),kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st)}}).catch(function(Rt){Ft.warn("failed to get stats",Rt)})):(Ft.debug("checkCandidateTypes not Chrome or Firefox"),kt.myWebRTC_Event.createICECandidateTypeUpdateEvent(kt.callId,st.LocalCandidateType,st.RemoteCandidateType),kt.onSelectedCandidate(st))},this.belongsToRoom=function(){return!!(0,at.ki)(this.sessionMCU,"roomName","string")&&((0,at.ki)(this.data,"MCUType","string")&&(this.data.MCUType==="MCU-Caller"||this.data.MCUType==="MCU-Callee")&&(0,at.ki)(this.data,"confId","string")?this.data.confId===this.sessionMCU.roomName:this.dest_roomId===this.sessionMCU.roomName)},this.setLocalCallProfile=function(kt){var st=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Tt=[],Rt={},Lt={},Et=null,jt=null,Pt="adaptation";this.dataCall!==!0&&this.settingUpType!=="subscribe"&&(this.localCallProfile.audioActive!==kt.audioActive&&Tt.push("audioIsActive"),this.localCallProfile.videoActive!==kt.videoActive&&Tt.push("videoIsActive"),this.localCallProfile=kt,this.screenSharing===!0?this.localCallProfile.audioActive===!0&&this.localCallProfile.videoActive===!0?this.callType!=="screenSharingWithAudio"&&(this.callType="screenSharingWithAudio",Tt.push("callType")):this.localCallProfile.audioActive===!0?this.callType!=="audio"&&(this.callType="audio",Tt.push("callType")):this.localCallProfile.videoActive===!0?this.callType!=="screenSharing"&&(this.callType="screenSharing",Tt.push("callType")):this.callType!=="inactive"&&(this.callType="inactive",Tt.push("callType")):this.localCallProfile.audioActive===!0&&this.localCallProfile.videoActive===!0?this.callType!=="media"&&(this.callType="media",Tt.push("callType")):this.localCallProfile.audioActive===!0?this.callType!=="audio"&&(this.callType="audio",Tt.push("callType")):this.localCallProfile.videoActive===!0?this.callType!=="videoOnly"&&(this.callType="videoOnly",Tt.push("callType")):this.callType!=="inactive"&&(this.callType="inactive",Tt.push("callType")),st===!0&&Tt.length>0&&(Rt.available=this.localCallProfile.audio,Rt.active=this.localCallProfile.audioActive,Rt.muted=this.isLocalAudioMuted,Rt.silent=this.isRemoteAudioSilent,Lt.available=this.localCallProfile.video,Lt.active=this.localCallProfile.videoActive,Lt.muted=this.isLocalVideoMuted,Lt.silent=this.isRemoteVideoSilent,this.callConfiguration&&this.callConfiguration.userMediaStreamId&&(Et=this.callConfiguration.userMediaStreamId,(jt=apiCC.getUserMediaStream(Et))&&(Rt.deviceLabel=jt.audioDeviceLabel,Lt.deviceLabel=jt.videoDeviceLabel)),this.updateCause&&(Pt=this.updateCause),this.myWebRTC_Event.createLocalStreamUpdatedEvent(Tt,Rt,Lt,!0,this.callType,this.callId,this.callLocalStream,Et,Pt)))},this.setRemoteCallProfile=function(kt){var st=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Tt=[],Rt={},Lt={},Et="adaptation";this.dataCall!==!0&&(this.remoteCallProfile.audioActive!==kt.audioActive&&Tt.push("audioIsActive"),this.remoteCallProfile.videoActive!==kt.videoActive&&Tt.push("videoIsActive"),this.remoteCallProfile=kt,this.settingUpType==="subscribe"?(this.screenSharing===!0?this.remoteCallProfile.audioActive===!0&&this.remoteCallProfile.videoActive===!0?this.callType!=="screenSharingWithAudio"&&(this.callType="screenSharingWithAudio",Tt.push("callType")):this.remoteCallProfile.audioActive===!0?this.callType!=="audio"&&(this.callType="audio",Tt.push("callType")):this.remoteCallProfile.videoActive===!0?this.callType!=="screenSharing"&&(this.callType="screenSharing",Tt.push("callType")):this.callType!=="inactive"&&(this.callType="inactive",Tt.push("callType")):this.remoteCallProfile.audioActive===!0&&this.remoteCallProfile.videoActive===!0?this.callType!=="media"&&(this.callType="media",Tt.push("callType")):this.remoteCallProfile.audioActive===!0?this.callType!=="audio"&&(this.callType="audio",Tt.push("callType")):this.remoteCallProfile.videoActive===!0?this.callType!=="videoOnly"&&(this.callType="videoOnly",Tt.push("callType")):this.callType!=="inactive"&&(this.callType="inactive",Tt.push("callType")),st===!0&&Tt.length>0&&(Rt.available=this.remoteCallProfile.audio,Rt.active=this.remoteCallProfile.audioActive,Rt.muted=this.isRemoteAudioMuted,Rt.silent=this.isRemoteAudioSilent,Lt.available=this.remoteCallProfile.video,Lt.active=this.remoteCallProfile.videoActive,Lt.muted=this.isRemoteVideoMuted,Lt.silent=this.isRemoteVideoSilent,this.updateCause&&(Et=this.updateCause),this.myWebRTC_Event.createRemoteStreamUpdatedEvent(Tt,Rt,Lt,this.callType,this.callId,Et))):(this.screenSharing===!0?this.remoteCallProfile.audioActive===!0&&this.remoteCallProfile.videoActive===!0?this.destCallType!=="screenSharingWithAudio"&&(this.destCallType="screenSharingWithAudio",Tt.push("callType")):this.remoteCallProfile.audioActive===!0?this.destCallType!=="audio"&&(this.destCallType="audio",Tt.push("callType")):this.remoteCallProfile.videoActive===!0?this.destCallType!=="screenSharing"&&(this.destCallType="screenSharing",Tt.push("callType")):this.destCallType!=="inactive"&&(this.destCallType="inactive",Tt.push("callType")):this.settingUpType!=="publish"&&this.settingUpType!=="shareScreen"||(this.remoteCallProfile.audioActive===!0&&this.remoteCallProfile.videoActive===!0?this.destCallType!=="media"&&(this.destCallType="media",Tt.push("callType")):this.remoteCallProfile.audioActive===!0?this.destCallType!=="audio"&&(this.destCallType="audio",Tt.push("callType")):this.remoteCallProfile.videoActive===!0?this.destCallType!=="videoOnly"&&(this.destCallType="videoOnly",Tt.push("callType")):this.destCallType!=="inactive"&&(this.destCallType="inactive",Tt.push("callType"))),st===!0&&Tt.length>0&&(Rt.available=this.remoteCallProfile.audio,Rt.active=this.remoteCallProfile.audioActive,Rt.muted=this.isRemoteAudioMuted,Rt.silent=this.isRemoteAudioSilent,Lt.available=this.remoteCallProfile.video,Lt.active=this.remoteCallProfile.videoActive,Lt.muted=this.isRemoteVideoMuted,Lt.silent=this.isRemoteVideoSilent,this.updateCause&&(Et=this.updateCause),this.myWebRTC_Event.createRemoteStreamUpdatedEvent(Tt,Rt,Lt,this.destCallType,this.callId,Et))))},this.setMediaConstraintsToSendOnlyOffer=function(){at.wL.type==="firefox"?nt.PR>43?this.mediaConstraints={offerToReceiveAudio:!1,offerToReceiveVideo:!1}:this.mediaConstraints={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}}:at.wL.type==="edge"?this.mediaConstraints={offerToReceiveAudio:0,offerToReceiveVideo:0}:at.wL.type==="chrome"&&at.wL.version<55?this.mediaConstraints={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}}:this.mediaConstraints={offerToReceiveAudio:!1,offerToReceiveVideo:!1,mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}},this.mediaConstraintsAudioOnly=this.mediaConstraints},this.applyOutgoingBitrate=function(kt){var st=this;Ft.debug("applyOutgoingBitrate",this.callId,kt);for(var Tt=null,Rt=0;Rt1&&arguments[1]!==void 0?arguments[1]:{};if(Ft.debug("configureSimulcastEncodings",this.callId,kt,Tt.maxBitrate),this.simulcast==="RID"){for(var Rt=null,Lt=0;Lt=0;){var rn=Et.encodings[Qt];jt||rn.rid!=="h"?Pt||rn.rid!=="m"?Vt||rn.rid!=="l"||(Vt=rn):Pt=rn:jt=rn}if(jt&&Object.prototype.hasOwnProperty.call(jt,"maxBitrate")&&Pt&&Object.prototype.hasOwnProperty.call(Pt,"maxBitrate")&&Vt&&Object.prototype.hasOwnProperty.call(Vt,"maxBitrate")){var Jt=!1,sn=Math.floor(Vt.maxBitrate/1e3),mn=!1,an=!1;if(jt.active&&jt.maxBitrate>1&&(sn+=Math.floor(jt.maxBitrate/1e3),mn=!0),Pt.active&&Pt.maxBitrate>1&&(sn+=Math.floor(Pt.maxBitrate/1e3),an=!0),Ft.debug("currentStatus",sn,mn,an),kt==="changeMaxBitrate"){if(!(0,at.ki)(Tt,"maxBitrate","number"))return;var hn=Tt.maxBitrate;sn<=hn?(an||sn+this.callConfiguration.simulcast.encodings.medium.maxBitrate<=hn&&(at.wL.type==="chrome"?Pt.active=!0:at.wL.type==="firefox"&&(Pt.maxBitrate=1e3*this.callConfiguration.simulcast.encodings.medium.maxBitrate),this.callConfiguration.simulcast.encodings.medium.active=!0,an=!0,sn+=this.callConfiguration.simulcast.encodings.medium.maxBitrate,Jt=!0),mn||sn+this.callConfiguration.simulcast.encodings.high.maxBitrate<=hn&&(at.wL.type==="chrome"?jt.active=!0:at.wL.type==="firefox"&&(jt.maxBitrate=1e3*this.callConfiguration.simulcast.encodings.high.maxBitrate),this.callConfiguration.simulcast.encodings.high.active=!0,mn=!0,sn+=this.callConfiguration.simulcast.encodings.high.maxBitrate,Jt=!0)):(mn&&(mn=!1,this.callConfiguration.simulcast.encodings.high.active=!1,sn-=Math.floor(jt.maxBitrate/1e3),at.wL.type==="chrome"?jt.active=!1:at.wL.type==="firefox"&&(jt.maxBitrate=1),Jt=!0),sn>hn&&an&&(an=!1,this.callConfiguration.simulcast.encodings.medium.active=!1,sn-=Math.floor(Pt.maxBitrate/1e3),at.wL.type==="chrome"?Pt.active=!1:at.wL.type==="firefox"&&(Pt.maxBitrate=1),Jt=!0))}else kt==="disableEncoding"&&(mn?(mn=!1,this.callConfiguration.simulcast.encodings.high.active=!1,sn-=Math.floor(jt.maxBitrate/1e3),at.wL.type==="chrome"?jt.active=!1:at.wL.type==="firefox"&&(jt.maxBitrate=1),Jt=!0):an&&(an=!1,this.callConfiguration.simulcast.encodings.medium.active=!1,sn-=Math.floor(Pt.maxBitrate/1e3),at.wL.type==="chrome"?Pt.active=!1:at.wL.type==="firefox"&&(Pt.maxBitrate=1),Jt=!0));Ft.debug("applyChanges",sn,mn,an,Jt),Jt&&(Rt.setParameters(Et).catch(function(wn){Ft.error("configureEncodings - setParameters",st.callId,wn)}),this.myWebRTC_Stack.sendInfo("configureEncodings",{pubSub:qt.MCUClient.pubConnector,clientId:qt.clientId,roomId:this.sessionMCU.roomName,callId:this.callId,instanceId:this.instanceId,hint:"simulcast",encodings:this.callConfiguration.simulcast.encodings}))}else Ft.warn("cannot find h/m/l encodings",this.callId)}else Ft.warn("wrong encodings",this.callId,Et.encodings.length);else Ft.warn("no encodings configured",this.callId)}else Ft.warn("no such functions: getParameters/setParameters",this.callId);else Ft.warn("no such video rtpSender",this.callId)}}},yn=(s(4363),s(9653),function(qt){this.disconnectionTimer=15e3,Number.MAX_SAFE_INTEGER!==void 0?this.userMediaId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString():this.userMediaId=Math.floor(1000001*Math.random()).toString(),this.callType="media",this.audio=!1,this.video=!1,this.audioSdpDirection=null,this.videoSdpDirection=null,this.callConfiguration={},this.sessionMCU=null,this.myWebRTC_Stack=new ht.S(qt.socket),this.getUserMediaStream=function(){return this.callConfiguration&&this.callConfiguration.userMediaStreamId?apiCC.getUserMediaStream(this.callConfiguration.userMediaStreamId):null},this.releaseUserMediaStream=function(){if(this.callConfiguration&&this.callConfiguration.userMediaStreamId){var kt=this.callConfiguration.userMediaStreamId;return delete this.callConfiguration.userMediaStreamId,apiCC.releaseUserMediaStream(kt,this.userMediaId)}return!1},this.close=function(){(this.addAck||this.addTimeoutId)&&(delete this.addAck,clearTimeout(this.addTimeoutId),delete this.addTimeoutId)}});function cn(qt){return cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(kt){return typeof kt}:function(kt){return kt&&typeof Symbol=="function"&&kt.constructor===Symbol&&kt!==Symbol.prototype?"symbol":typeof kt},cn(qt)}function gn(qt,kt){var st=typeof Symbol<"u"&&qt[Symbol.iterator]||qt["@@iterator"];if(!st){if(Array.isArray(qt)||(st=function(Pt,Vt){if(Pt){if(typeof Pt=="string")return bn(Pt,Vt);var Qt=Object.prototype.toString.call(Pt).slice(8,-1);return Qt==="Object"&&Pt.constructor&&(Qt=Pt.constructor.name),Qt==="Map"||Qt==="Set"?Array.from(Pt):Qt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Qt)?bn(Pt,Vt):void 0}}(qt))||kt&&qt&&typeof qt.length=="number"){st&&(qt=st);var Tt=0,Rt=function(){};return{s:Rt,n:function(){return Tt>=qt.length?{done:!0}:{done:!1,value:qt[Tt++]}},e:function(Pt){throw Pt},f:Rt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Lt,Et=!0,jt=!1;return{s:function(){st=st.call(qt)},n:function(){var Pt=st.next();return Et=Pt.done,Pt},e:function(Pt){jt=!0,Lt=Pt},f:function(){try{Et||st.return==null||st.return()}finally{if(jt)throw Lt}}}}function bn(qt,kt){(kt==null||kt>qt.length)&&(kt=qt.length);for(var st=0,Tt=new Array(kt);stS: "+Et),apiCC.session.channel.socket.emit("MCUSessionInvitation",Et)):fn.log("Session is null or undefined, MCU Session invitation is not sended")},this.sendSessionInvitationToGroupChat=function(st,Tt){if(fn.debug("sendSessionInvitationToGroupChat()"),st!=null)if(Tt!=null){var Rt,Lt;Rt={type:"MCUSessionInvitationToGroupChat",srcId:kt,groupChatId:st,sessionId:Tt},Lt=JSON.stringify(Rt),fn.log("C->S: "+Lt),apiCC.session.channel.socket.emit("MCUSessionInvitationToGroupChat",Lt)}else fn.log("Session is null or undefined, MCU Session invitation is not sended");else fn.log("groupChatId is null or undefined, MCU Session invitation is not sended")},this.receiveSessionInvitation=function(st){fn.debug("receiveSessionInvitation()"),fn.log("msg.sessionId :"+st.sessionId),fn.log("msg.token :"+st.token),fn.log("msg.groupChatId :"+st.groupChatId),Tn.createReceiveMCUSessionInvitationEvent(st.sessionId,st.token,st.groupChatId,st.srcId)},this.acceptSessionInvitation=function(st,Tt){fn.debug("acceptSessionInvitation()"),fn.log("sessionId :"+st),fn.log("token :"+Tt),this.publish(st,Tt)},this.leaveSession=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};fn.info("leaveSession()");var Rt=null,Lt=null,Et=null;if(!(Et=st?this.getSessionMCU(st):this.getSessionMCU(null,{first:!0})))return new Error("leaveSession: session not set");Tt.noHangup!==!0&&(apiCC.session.apiCCWebRTCClient.webRTCClient.removeAllCallsFromRoom(Et.roomName,"leaveSession"),this.meshOnHangup(null,null,{roomId:Et.roomName}));var jt=[],Pt={};jt.push(Et.roomName),Pt.doneByApiRTC=!0,apiCC.session.leavePresenceGroup(jt,Pt),apiCC.session.unsubscribePresenceGroup(jt,Pt),Rt={type:"leaveSession",roomId:Et.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,data:{pubSub:this.pubConnector}},Lt=JSON.stringify(Rt),fn.log("C->S: "+Lt),apiCC.session.channel.socket.emit("leaveSession",Lt),fn.debug("leaveSession: distant call clean up");for(var Vt=this.distantCalls.length;--Vt>=0;)this.distantCalls[Vt].roomId===Et.roomName&&(fn.debug("leaveSession: remove distant call descriptor",this.distantCalls[Vt]),this.distantCalls.splice(Vt,1));apiCC.session.apiCCWebRTCClient.webRTCClient.destroyCallControl({multi:!0,roomName:Et.roomName});for(var Qt=this.streamList.length;--Qt>=0;)this.streamList[Qt].roomId===Et.roomName&&this.streamList.splice(Qt,1);return this.removeSessionMCU(Et),"OK"},this.createJoinSessionMessage=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=null;st||(Rt=Tt.hasOwnProperty("sessionMCU")?Tt.sessionMCU:this.getSessionMCU(null,{first:!0}))&&(st=Rt.roomName);var Lt=Rt&&Rt.roomMode==="mesh"||this.meshModeEnabled===!0||Tt.meshModeEnabled===!0,Et=Rt&&Rt.meshOnly===!0||Tt.meshOnlyEnabled===!0,jt={type:"joinSession",roomId:st,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,data:{pubSub:this.pubConnector,meshModeEnabled:Lt,meshOnlyEnabled:Et,videoBandwidthSettings:apiCC.session.apiCCWebRTCClient.webRTCClient.videoBandwidthSettings,browserInfo:{browserAbout:nt.Xh+" "+nt.dc,browserType:at.wL.type,browserVersion:at.wL.version,osName:nt.BF,osVersion:apiCC.osVersion,deviceType:nt.vO}}};if(Tt.hasOwnProperty("transactionId")&&(jt.transactionId=Tt.transactionId),Tt.hasOwnProperty("convId")?jt.data.convId=Tt.convId:Rt&&Rt.hasOwnProperty("convId")&&(jt.data.convId=Rt.convId),Tt.moderationEnabled&&(jt.data.moderationEnabled=!0),Tt.moderator&&(jt.data.moderator=!0),Tt.qualityAdaptationEnabled&&(jt.data.qualityAdaptationEnabled=!0),Array.isArray(Tt.supportedVideoCodecs)){jt.data.supportedVideoCodecs=[];var Pt,Vt=gn(Tt.supportedVideoCodecs);try{for(Vt.s();!(Pt=Vt.n()).done;){var Qt=Pt.value;Qt==="h264"?jt.data.supportedVideoCodecs.push({codec:"h264",profilelevelid:"42e01f"}):typeof Qt=="string"?jt.data.supportedVideoCodecs.push({codec:Qt}):jt.data.supportedVideoCodecs.push(Qt)}}catch(rn){Vt.e(rn)}finally{Vt.f()}}else at.wL.type==="safari"&&(nt.Xh==="Safari"&&nt.dc<12.1||nt.Xh==="Mobile Safari"&&nt.dc<12.1)&&(jt.data.supportedVideoCodecs=[{codec:"h264",profilelevelid:"42e01f"}]);return jt.data.capabilities=this.browserCapabilities,jt},this.createSessionDescriptor=function(st){var Tt={roomId:st.roomName};return st.convId&&(Tt.convId=st.convId),st.roomMode&&(Tt.roomMode=st.roomMode),st.modeChangeKind&&(Tt.modeChangeKind=st.modeChangeKind),Tt},this.joinSession=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.getSessionMCU(st))return fn.warn("joinSession: session already set"),new Error("joinSession: session already set");if(this.getJoinSessionReq(st))return fn.warn("joinSession: session already requested"),new Error("joinSession: session already requested");var Rt={};Rt.roomId=st,Rt.transactionId=apiCC.randomString(12),this.joinSessionReqs.push(Rt);var Lt=Object.assign({},Tt);Lt.transactionId=Rt.transactionId,fn.info("joinSession() on ApiRTC MCU with roomId:",st);var Et=this.createJoinSessionMessage(st,Lt),jt=JSON.stringify(Et);return fn.log("C->S: "+jt),apiCC.session.channel.socket.emit("joinSession",jt),"OK"},this.joinSessionAnswer=function(st){if(fn.debug("joinSessionAnswer()"),this.getSessionMCU(st.roomName))fn.warn("joinSessionAnswer: session already set");else{var Tt=null;if(st.hasOwnProperty("transactionId")&&(Tt=this.getJoinSessionReq(null,{transactionId:st.transactionId})),Tt||(Tt=this.getJoinSessionReq(st.roomName)),Tt){this.removeJoinSessionReq(Tt);var Rt={};if(Rt.roomID=st.sessionId,Rt.roomName=st.roomName,st.hasOwnProperty("convId")&&(Rt.convId=st.convId),Rt.joinSessionAnswer={},(0,at.ki)(st,"data","object")?(st.data.failed===!0?(Rt.joinSessionAnswer.failed=!0,Rt.joinSessionAnswer.reason=st.data.reason):Rt.joinSessionAnswer.failed=!1,st.data.mode&&typeof st.data.mode=="string"&&(Rt.roomMode=st.data.mode,fn.debug("session joined with mode; roomMode: "+Rt.roomMode)),Rt.roomMode==="mesh"&&st.data.meshOnly===!0&&(Rt.meshOnly=!0,fn.debug("meshOnly"))):Rt.joinSessionAnswer.failed=!1,this.sessionMCUs.push(Rt),!Rt.joinSessionAnswer.failed){var Lt=[],Et={};Lt.push(st.roomName),Et.doneByApiRTC=!0,apiCC.session.joinPresenceGroup(Lt,Et),apiCC.session.subscribePresenceGroup(Lt,Et)}Tn.createJoinMCUSessionAnswerEvent(st.sessionId,st.token,st.groupChatId,st.initiator,Rt)}else fn.debug("joinSessionAnswer: no joinSession requested")}},this.changeSessionMode=function(st,Tt){var Rt=this.getSessionMCU(st.roomName);if(Rt)if(Rt.roomMode==="mesh"){for(var Lt=0,Et=qt.userMediaTable.length;--Et>=0;)if(qt.userMediaTable[Et].sessionMCU===Rt){fn.debug("changeSessionMode: userMedia",qt.userMediaTable[Et]),qt.userMediaTable[Et].distantCalls=[],Lt+=1;for(var jt=this.distantCalls.length;--jt>=0;)fn.debug("changeSessionMode: distantCall",this.distantCalls[jt]),this.distantCalls[jt].callMode==="mesh"&&this.distantCalls[jt].callFeed.callId===qt.userMediaTable[Et].userMediaId&&(fn.debug("changeSessionMode: match"),qt.userMediaTable[Et].distantCalls.push(this.distantCalls[jt]))}for(var Pt=0,Vt=qt.callControlTable.length;--Vt>=0;)qt.callControlTable[Vt].type==="subscribe"&&qt.callControlTable[Vt].roomName===Rt.roomName&&(Pt+=1,qt.callControlTable[Vt].autoRestart.force=!0);if(Tn.createMCURoomModeChangedEvent(Rt.roomName,"mesh","sfu","ongoing"),Lt===0&&Pt===0)delete Rt.roomMode,Tn.createMCURoomModeChangedEvent(Rt.roomName,"mesh","sfu","complete");else{Rt.modeChangeKind="old";var Qt={};Qt.roomID=st.roomName,Qt.roomName=st.roomName,st.hasOwnProperty("convId")&&(Qt.convId=st.convId),Qt.joinSessionAnswer={failed:!1},Qt.modeChangeKind="new",Qt.transitionTimeoutId=setTimeout((function(rn,Jt){delete Jt.transitionTimeoutId,qt.finalizeMeshToJanusTransition(rn,Jt,{force:!0})}).bind(this,Rt,Qt),3e4),this.sessionMCUs.push(Qt),this.transitionCount+=1}}else fn.warn("changeSessionMode: session not using mesh mode");else fn.warn("changeSessionMode: no session")},this.updateSessionAnswer=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};fn.debug("updateSessionAnswer");var Rt=this.getSessionMCU(st.roomName);if(!Rt){if(!Tt.createSession)return void fn.warn("updateSessionAnswer: no such session",st.roomName);fn.debug("force session creation; roomName: "+st.roomName),(Rt={}).roomID=st.roomName,Rt.roomName=st.roomName,st.hasOwnProperty("convId")&&(Rt.convId=st.convId),Rt.joinSessionAnswer={failed:!1},this.sessionMCUs.push(Rt);for(var Lt=apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.length;--Lt>=0;){var Et=apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable[Lt];!Et.data||Et.data.MCUType!=="MCU-Caller"&&Et.data.MCUType!=="MCU-Callee"||Et.data.confId!==Rt.roomName||(Et.sessionMCU=Rt)}}var jt=!1;if(st.data&&st.data.mode==="mesh"?(Rt.roomMode="mesh",st.data.meshOnly===!0&&(Rt.meshOnly=!0)):(Rt.roomMode==="mesh"&&(jt=!0),delete Rt.roomMode),Rt.modeChangeKind==="new"){fn.debug("transition already ongoing");var Pt=this.getSessionMCU(null,{callback:function(hn){return hn.roomName===Rt.roomName&&hn.modeChangeKind==="old"}});Pt&&qt.finalizeMeshToJanusTransition(Pt,Rt,{force:!0})}else if(jt){fn.debug("transition NOT ongoing but should be"),Tn.createMCURoomModeChangedEvent(Rt.roomName,"mesh","sfu","ongoing"),Rt.modeChangeKind="old";var Vt={};Vt.roomID=Rt.roomID,Vt.roomName=Rt.roomName,Rt.hasOwnProperty("convId")&&(Vt.convId=Rt.convId),Vt.joinSessionAnswer={failed:!1},Vt.modeChangeKind="new",this.sessionMCUs.push(Vt),this.transitionCount+=1,qt.finalizeMeshToJanusTransition(Rt,Vt,{force:!0})}if(Tt.updateCalls)if(fn.debug("update stream list (prune)"),this.updateStreamList(st,{prune:!0}),Rt.roomMode==="mesh"){fn.debug("restart publish/shareScreen calls");for(var Qt=qt.userMediaTable.slice(),rn=Qt.length;--rn>=0;){var Jt=Qt[rn];Jt.sessionMCU===Rt&&qt.onHangup(Jt.userMediaId,"disconnected")}}else{fn.debug("roomMode is SFU, checking calls");for(var sn=qt.callsTable.slice(),mn=sn.length;--mn>=0;){var an=sn[mn];an.sessionMCU===Rt&&(an.settingUpType!=="publish"&&an.settingUpType!=="shareScreen"||an.data&&an.data.mesh||an.pc?an.message200OKReceived===!1&&(fn.debug("restart call without 200OK received"),qt.onHangup(an.callId,"disconnected")):(fn.debug("restart publish/shareScreen calls with no PeerConnection"),qt.onHangup(an.callId,"disconnected")))}}},this.processCheckCallStatus=function(st){this.updateStreamList(st)},this.updateStreamList=function(st){for(var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=(0,at.ki)(st,"availableStreams","array")?st.availableStreams.slice():null,Lt=(0,at.ki)(st,"availableComposite","array")?st.availableComposite.slice():null,Et=(0,at.ki)(st,"availableReplay","array")?st.availableReplay.slice():null,jt=this.streamList.length;--jt>=0;){var Pt=this.streamList[jt];if(Pt.type==="regular"){if(!Rt)continue;for(var Vt=Rt.length;--Vt>=0&&Rt[Vt].id!==Pt.streamInfo.id;);if(Vt>=0){(0,at.ki)(Pt,"clearDisputableEntry","function")&&Pt.clearDisputableEntry(),Rt.splice(Vt,1);continue}Tt.prune===!0?((0,at.ki)(Pt,"clearDisputableEntry","function")&&Pt.clearDisputableEntry(),apiCC.session.apiCCWebRTCClient.webRTCClient.destroyCallControl({type:"subscribe",stream:Pt.streamInfo}),Tn.createMCURemovedStreamEvent(Pt.streamInfo.id),this.streamList.splice(jt,1)):Pt.disputableTimeoutId||(Pt.disputableTimeoutId=setTimeout(Pn.bind(this,Pt.streamInfo.id),_n),Pt.clearDisputableEntry=In.bind(this,Pt.streamInfo.id),this.disputableStreamList.push(Pt))}else if(Pt.type==="composite"){if(!Lt)continue;for(var Qt=Lt.length;--Qt>=0&&Lt[Qt].id!==Pt.streamInfo.id;);if(Qt>=0){Lt.splice(Qt,1);continue}apiCC.session.apiCCWebRTCClient.webRTCClient.destroyCallControl({type:"subscribe",stream:Pt.streamInfo}),Tn.createMCURemovedStreamEvent(Pt.streamInfo.id),this.streamList.splice(jt,1)}else if(Pt.type==="replay"){if(!Et)continue;for(var rn=Et.length;--rn>=0&&Et[rn].id!==Pt.streamInfo.id;);rn>=0&&Et.splice(rn,1)}}if(Rt)for(var Jt=0;Jt2&&arguments[2]!==void 0?arguments[2]:{},Lt=this.streamList.length,Et=!1;for((0,at.ki)(Rt,"replay","boolean")&&Rt.replay===!0&&(Et=!0);--Lt>=0;){if(Et===!0){if(this.streamList[Lt].type!=="replay")continue}else if(this.streamList[Lt].type==="replay")continue;if(this.streamList[Lt].userId===st&&this.streamList[Lt].streamInfo.attributes.callId===Tt)return this.streamList[Lt].streamInfo}return null},this.newAvailableStream=function(st,Tt,Rt){fn.debug("newAvailableStream():",st);var Lt=!1,Et=!1,jt=this.getSessionMCU(st[0].room);if(jt){st[0].attributes.callerId!==kt&&(Lt=!0);for(var Pt=qt.getCallControls(["publish","shareScreen"],{addUserMedia:!0}),Vt=0;Vt=0&&(this.streamList[Qt].type!=="regular"||st[Vt].id!==this.streamList[Qt].streamInfo.id););Qt>=0?(Et=!0,(0,at.ki)(this.streamList[Qt],"clearDisputableEntry","function")?this.streamList[Qt].clearDisputableEntry():fn.debug("clearDisputableEntry is not set")):fn.debug("streamList is empty"),Lt=!Object.prototype.hasOwnProperty.call(Pt,st[Vt].attributes.callId);var rn={type:Tt,userId:st[Vt].attributes.callerId,roomId:jt.roomName,isRemoteStream:Lt,streamInfo:st[Vt]};if(Et===!0?this.streamList[Qt]=rn:this.streamList.push(rn),fn.log("this.streamList :",this.streamList),Lt!==!0)if(jt.roomMode==="mesh"){var Jt=qt.findUserMediaById(st[Vt].attributes.callId);Jt&&Jt.addAck===!0&&(delete Jt.addAck,clearTimeout(Jt.addTimeoutId),delete Jt.addTimeoutId,Tn.createCallEstablishedEvent(jt.roomName,Jt.callType,Jt.userMediaId,"none"))}else{var sn=qt.findCallWithCallId(st[Vt].attributes.callId),mn=apiCC.getUserMediaStream(sn.callConfiguration.userMediaStreamId);if(sn&&mn)for(var an=0,hn=["audioMuted","videoMuted"];an=0;)if(this.streamList[jt].streamInfo.id===st[Et].id){for(var Pt=[],Vt=0,Qt=["audio","audioMuted","video","videoMuted"];Vt0&&(0,at.Ym)(Rt,"function")&&Rt(Lt,st[Et],Tt,Pt);break}return Lt}fn.log("updateAvailableStream() but client is not in session")},this.newAvailableReplay=function(st){fn.info("newAvailableReplay() :",st);var Tt=!1,Rt=this.getSessionMCU(st[0].room);if(Rt){st[0].attributes.callerId!==kt&&(Tt=!0);for(var Lt=0;Lt4&&arguments[4]!==void 0?arguments[4]:{};fn.info("subscribeToStreams():",st);var jt,Pt,Vt=[],Qt=null,rn=null,Jt=null,sn=function(an){return setTimeout(function(){fn.warn("invite + SDP offer not received -> restart call"),qt.onHangup(an,"disconnected")},15e3)};for(Jt in st){if(jt=st[Jt],apiCC.session===null||apiCC.session===void 0)return fn.debug("no session, leaving subscribeToStreams()"),Vt;if((Qt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithStreamId(jt.id,{ignoreModeChangeKindOld:!0}))!==null){if(fn.debug("call already exists"),Et.force!==!0){Vt[Jt]=Qt.callId;continue}fn.debug("Force is true")}else fn.debug("call does not exist");for(Pt=this.streamList.length;--Pt>=0&&this.streamList[Pt].streamInfo.id!==jt.id;);if(Pt>=0){if(fn.debug("stream exists"),this.streamList[Pt].disputableTimeoutId){fn.debug("stream temporarily not available"),Vt[Jt]=null,Et.autoSub===!0&&((rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallControl({type:"subscribe",stream:jt}))||apiCC.session.apiCCWebRTCClient.webRTCClient.createCallControl({type:"subscribe",roomName:jt.room,mediaType:Tt,callConfiguration:Lt,data:Rt,stream:jt}));continue}}else if(fn.debug("stream does not exist"),Et.noStreamCheck!==!0){Vt[Jt]=null,Tn.createErrorEvent("stream not available","STREAM_NOT_AVAILABLE",null,jt.room,null,{stream:jt});continue}fn.info("stream:",jt);var mn=this.getSessionMCU(jt.room);mn&&((rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallControl({type:"subscribe",stream:jt}))||(rn=apiCC.session.apiCCWebRTCClient.webRTCClient.createCallControl({type:"subscribe",roomName:mn.roomName,mediaType:Tt,callConfiguration:Lt,data:Rt,stream:jt})),jt.attributes.callType!=="COMPOSITE"&&this.pubConnector==="janusConnector"?(Rt===void 0&&(Rt={}),Rt.mesh&&delete Rt.mesh,(0,at.Ym)(Lt,"qos","object")?(Rt.qos={},Lt.qos.videoForbidInactive===!1?Rt.qos.videoForbidInactive=!1:Rt.qos.videoForbidInactive=!0):(Rt.qos={},Rt.qos.videoForbidInactive=!0),(0,at.Ym)(Lt,"simulcast","object")&&(Rt.simulcast={},Lt.simulcast.streamQuality&&(Lt.simulcast.streamQuality==="high"?Rt.simulcast.substream=2:Lt.simulcast.streamQuality==="medium"?Rt.simulcast.substream=1:Lt.simulcast.streamQuality==="low"&&(Rt.simulcast.substream=0)),Lt.simulcast.streamFrameRate&&(Lt.simulcast.streamFrameRate==="high"?Rt.simulcast.temporal=2:Lt.simulcast.streamFrameRate==="medium"?Rt.simulcast.temporal=1:Lt.simulcast.streamFrameRate==="low"&&(Rt.simulcast.temporal=0))),(Qt=new vn(apiCC.session.apiCCWebRTCClient.webRTCClient)).instanceId=apiCC.generateInstanceId(),Qt.callControl=rn,(0,at.ki)(Qt.callControl.autoRestart,"counter","number")?(Qt.callControl.autoRestart.counter+=1,Qt.restarted=!0):Qt.callControl.autoRestart.counter=0,Qt.settingUpType="subscribe",Lt!=null&&Lt.turnServerAddress!==void 0&&Lt.turnServerAddress!==null&&Qt.setCallTurnServer(Lt.turnServerAddress),Qt.generateCallId(),rn.callId=Qt.callId,Qt.setupTimeoutId=sn(Qt.callId),Qt.callerId=mn.roomName,Qt.calleeId=apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,Qt.callee=!0,Qt.mcuRemoteStream=jt,Qt.dest_roomId=mn.roomName,Qt.callType=jt.attributes.callType,Qt.callControl.callType=jt.attributes.callType,jt.attributes.callType!=="audio"&&Tt!=="AUDIOONLY"||(Qt.audioOnly=!0,Qt.callControl.audioOnly=!0),Qt.remoteId=jt.attributes.callerId,Qt.remoteMailAddress=jt.attributes.mailAddress,Qt.streamId=jt.id,Qt.mediaType=Tt,Qt.sessionMCU=mn,fn.log("call.streamId: "+Qt.streamId),(0,at.Ym)(Rt,"object")?Qt.data=(0,at.ws)({},Rt):Qt.data={},Qt.data.pubSub="janusConnector",Qt.data.type="subscribe",Qt.data.mode="passive",Qt.data.mediaType=Tt,Qt.data.capabilities=this.browserCapabilities,Qt.data.cloudConvId=mn.convId,Qt.data.instanceId=Qt.instanceId,apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.push(Qt),Vt[Jt]=Qt.callId,Qt.myWebRTC_Stack.sendInvite(Qt.callId,apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,mn.roomName,mn.roomName,jt.attributes.callType,{mode:"passive",data:Qt.data,stream:jt,volatile:!!Qt.restarted})):((Qt=new vn(apiCC.session.apiCCWebRTCClient.webRTCClient)).instanceId=apiCC.generateInstanceId(),Qt.callControl=rn,(0,at.ki)(Qt.callControl.autoRestart,"counter","number")?(Qt.callControl.autoRestart.counter+=1,Qt.restarted=!0):Qt.callControl.autoRestart.counter=0,Qt.settingUpType="subscribe",Lt!=null&&Lt.turnServerAddress!==void 0&&Lt.turnServerAddress!==null&&Qt.setCallTurnServer(Lt.turnServerAddress),Rt===void 0&&(Rt={}),Qt.data=Rt,Qt.data.pubSub=this.pubConnector,Qt.data.type="subscribe",Qt.data.capabilities=this.browserCapabilities,Qt.data.cloudConvId=mn.convId,Qt.data.instanceId=Qt.instanceId,fn.log("mediaType: ",Tt),fn.log("stream.attributes.callType: ",jt.attributes.callType),Qt.callType=jt.attributes.callType,Qt.callControl.callType=jt.attributes.callType,jt.attributes.callType==="COMPOSITE"&&this.pubConnector==="janusConnector"||jt.attributes.callType==="audio"||Tt==="AUDIOONLY"?(fn.log("Setting call as audioOnly"),Qt.audioOnly=!0,Qt.callControl.audioOnly=!0,Qt.stripVideoSDPActivated=!0):Tt==="VIDEOONLY"&&(Qt.stripAudioSDPActivated=!0,Qt.callType="videoOnly",Qt.callControl.callType="videoOnly"),Qt.mcuRemoteStream=jt,Qt.dest_roomId=mn.roomName,Qt.calleeId=mn.roomName,Qt.generateCallId(),rn.callId=Qt.callId,Qt.callerId=apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,Qt.sessionMCU=mn,apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.push(Qt),Qt.createPeerConnection(),Qt.doCall(),Qt.started=!0,Qt.callType=jt.attributes.callType,Qt.remoteId=jt.attributes.callerId,Qt.remoteMailAddress=jt.attributes.mailAddress,jt.audio===!0?jt.video===!0?Qt.destCallType="media":Qt.destCallType="audio":jt.video===!0&&(Qt.destCallType="videoOnly"),jt.id===void 0&&fn.log("stream.id is undefined :",jt),Qt.streamId=jt.id,Qt.mediaType=Tt,fn.log("stream.attributes.callType: ",jt.attributes.callType),Vt[Jt]=Qt.callId),Qt.asyncCallbacks={},Qt.asyncCallbacks.type="subscribe")}return Vt},this.unsubscribe=function(st){fn.info("unsubscribe() :",st);var Tt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithStreamId(st);Tt===null?fn.log("error call not found on unsubscribe"):Tt.callId!==void 0&&apiCC.session.apiCCWebRTCClient.webRTCClient.onHangup(Tt.callId)},this.publish=function(st,Tt,Rt,Lt,Et,jt){fn.info("publish roomName :",st),fn.log("publish sessionId :",Tt),fn.log("publish token :",Rt),fn.log("publish callConfiguration :",Lt);var Pt=null,Vt=!1,Qt=!1,rn=null,Jt=null,sn=this.getSessionMCU(st);if(!sn)return fn.error("roomName does not match any sessionMCU"),null;if(Et!==null&&cn(Et)==="object"||(Et={}),this.pubConnector==="janusConnector"&&!Et.mesh&&jt&&jt.callControl&&jt.callControl.callId&&apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(jt.callControl.callId))return fn.debug("call already exists",jt.callControl.callId),jt.callControl.callId;if(Lt===!0||Lt==="true"?(fn.log("DEPRECATED ... please use callConfiguration JSON parameter : callConfiguration.audioOnly instead of audioOnly"),Vt=!0,Lt={}):Lt===!1||Lt==="false"?(fn.log("DEPRECATED ... please use callConfiguration JSON parameter : callConfiguration.audioOnly instead of audioOnly"),Lt={}):Lt!==null&&cn(Lt)==="object"||(Lt={}),Lt.audioOnly===!0&&Lt.videoOnly===!0)return Tn.createErrorEvent("Cannot publish without audio nor video","PUBLISH_FAILURE",null,st),null;if(Lt.audioOnly===!0&&(Vt=!0),Lt.videoOnly===!0&&(Qt=!0),["audioOnly","videoOnly","record","private"].forEach(function(an){Lt.hasOwnProperty(an)&&((0,at.ki)(Et,"callConfiguration","object")||(Et.callConfiguration={}),Et.callConfiguration[an]=Lt[an])}),sn.convId&&(Et.cloudConvId=sn.convId),(0,at.Ym)(Lt,"qos","object")?(Et.qos={},Lt.qos.videoMinBitrate?Et.qos.videoMinBitrate=Lt.qos.videoMinBitrate:Lt.qos.videoMinQuality&&["excellent","good","medium","bad"].indexOf(Lt.qos.videoMinQuality)>=0?Et.qos.videoMinQuality=Lt.qos.videoMinQuality:Et.qos.videoMinQuality="bad",Lt.qos.videoStartBitrate?Et.qos.videoStartBitrate=Lt.qos.videoStartBitrate:Lt.qos.videoStartQuality&&["upper","excellent","good","medium","bad"].indexOf(Lt.qos.videoStartQuality)>=0&&(Et.qos.videoStartQuality=Lt.qos.videoStartQuality),Lt.qos.videoForbidInactive===!1?Et.qos.videoForbidInactive=!1:Et.qos.videoForbidInactive=!0):Et.qos={videoMinQuality:"bad",videoForbidInactive:!0},Lt.simulcast&&(Lt.userMediaStreamId&&(Jt=apiCC.getUserMediaStream(Lt.userMediaStreamId))&&Jt.isSimulcastCompliant()||delete Lt.simulcast),function(an){if(!(0,at.ki)(an,"simulcast","object")||at.wL.type==="safari"&&an.simulcast.mode!=="SDP")return delete an.simulcast,!1;delete an.simulcast.sendEncodings,(0,at.ki)(an.simulcast,"maxBitrate","number")?at.wL.type==="chrome"&&at.wL.version>=78&&an.simulcast.mode!=="SDP"?(fn.debug("configure simulcast RID chrome maxBitrate"),!Ln(an.simulcast,an.simulcast.maxBitrate)&&(fn.warn("cannot configure simulcast"),delete an.simulcast)):at.wL.type==="firefox"?(fn.debug("configure simulcast RID firefox maxBitrate"),!Ln(an.simulcast,an.simulcast.maxBitrate)&&(fn.warn("cannot configure simulcast"),delete an.simulcast)):delete an.simulcast.encodings:(0,at.ki)(an.simulcast,"encodings","object")?at.wL.type==="chrome"&&at.wL.version>=78&&an.simulcast.mode!=="SDP"?(fn.debug("configure simulcast RID chrome encodings"),!On(an.simulcast)&&(fn.warn("cannot configure simulcast"),delete an.simulcast)):at.wL.type==="firefox"?(fn.debug("configure simulcast RID firefox encodings"),!On(an.simulcast)&&(fn.warn("cannot configure simulcast"),delete an.simulcast)):delete an.simulcast.encodings:at.wL.type==="chrome"&&at.wL.version>=78&&an.simulcast.mode!=="SDP"?(fn.debug("configure simulcast RID chrome default"),an.simulcast.encodings={high:{maxBitrate:900},medium:{maxBitrate:300,scaleResolutionDownBy:2},low:{maxBitrate:100,scaleResolutionDownBy:4}},!On(an.simulcast)&&delete an.simulcast):at.wL.type==="firefox"&&(fn.debug("configure simulcast RID firefox default"),an.simulcast.encodings={high:{maxBitrate:900},medium:{maxBitrate:300,scaleResolutionDownBy:2},low:{maxBitrate:100,scaleResolutionDownBy:4}},!On(an.simulcast))&&delete an.simulcast}(Lt),Lt.distributedBroadcastEnabled&&!Lt.simulcast&&(Et.distributedBroadcastEnabled=!0),["audioLabels","videoLabels"].forEach(function(an){(0,at.Ym)(Lt[an],"array")&&(Et[an]=[],Lt[an].forEach(function(hn){(0,at.Ym)(hn,"string")&&Et[an].push(hn)}))}),(0,at.Ym)(Lt,"context","object"))try{JSON.stringify(Lt.context),Et.context=Lt.context}catch{}if((0,at.Ym)(Lt,"profileType","string")&&(Et.profileType=Lt.profileType),(0,at.Ym)(Lt,"priority","number")&&Lt.priority>=0&&(Et.priority=Lt.priority),(0,at.Ym)(Lt,"downgradeProfileList","array")&&(Et.downgradeProfileList=Lt.downgradeProfileList),fn.debug("callConfiguration; audioOnly: "+Vt+", videoOnly: "+Qt),jt&&jt.forceScreenSharingCallType===!0)fn.debug("publish screenSharing");else if(apiCC.mediaDeviceMgr.videoDevicePresent===!1){if(apiCC.mediaDeviceMgr.audioDevicePresent===!1)return fn.debug("publish without any device, leaving publish ..."),Et.publishWithoutMediaDeviceDetected=!0,apiCC.session.setUserData(Et),Tn.createErrorEvent("Cannot publish without audio nor video","PUBLISH_FAILURE",null,st),null;Vt!==!0&&(fn.debug("publish video, but no webcam present, forcing callType to audio"),Vt=!0)}else apiCC.mediaDeviceMgr.audioDevicePresent===!1&&Qt!==!0&&(fn.debug("publish video, but no microphone present, forcing callType to videoOnly"),Qt=!0);if(Pt=new vn(apiCC.session.apiCCWebRTCClient.webRTCClient),Et.mesh!==void 0&&Et.instanceId!==void 0?(fn.debug("keeping instanceId "),Pt.instanceId=Et.instanceId):Pt.instanceId=apiCC.generateInstanceId(),this.pubConnector!=="janusConnector"||Et.mesh?(Pt.settingUpType="publish",Pt.generateCallId()):(Pt.settingUpType="publish",jt&&jt.callControl?(Pt.callControl=jt.callControl,Pt.callControl.autoRestart.counter+=1,Pt.callId=Pt.callControl.callId,Pt.restarted=!0):(Pt.callControl=apiCC.session.apiCCWebRTCClient.webRTCClient.createCallControl({type:"publish",roomName:st,callConfiguration:Lt,data:Et}),Pt.callControl.sessionId=Tt,Pt.callControl.token=Rt,Pt.callControl.autoRestart.counter=0,Pt.generateCallId(),Pt.callControl.callId=Pt.callId)),Lt!=null&&Lt.turnServerAddress!==void 0&&Lt.turnServerAddress!==null&&Pt.setCallTurnServer(Lt.turnServerAddress),Lt.userMediaStreamId&&((Jt=apiCC.getUserMediaStream(Lt.userMediaStreamId))?(Pt.callType=Jt.callType,fn.debug("Setting callType to "+Pt.callType),Pt.callType==="screenSharing"&&(Pt.screenSharing=!0)):(fn.debug("callConfiguration.userMediaStreamId is setted but stream is not present"),delete Lt.userMediaStreamId)),Pt.data=Et,Pt.data.instanceId=Pt.instanceId,Tt==="restarted"&&(Pt.restarted=!0),Pt.mediaTypeForIncomingCall="NONE",Vt===!0?(fn.log("Setting call as audioOnly"),Pt.audioOnly=!0,Pt.callType="audio",Pt.mediaTypeForOutgoingCall="AUDIO"):Qt===!0?(fn.log("Setting call as videoOnly"),Pt.callType="videoOnly",Pt.mediaTypeForOutgoingCall="VIDEOONLY"):fn.log("Not Setting call as audioOnly nor videoOnly"),Pt.dest_roomId=sn.roomName,Pt.calleeId=sn.roomName,Pt.data.pubSub=this.pubConnector,Pt.data.type="publish",Pt.data.capabilities=this.browserCapabilities,Pt.data.cloudConvId=sn.convId,Pt.callConfiguration=Lt,Pt.sessionMCU=sn,Pt.setMediaConstraintsToSendOnlyOffer(),Pt.callerId=apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,(0,at.Ym)(Lt,"simulcast","object")){var mn=null;Jt&&(mn=Jt.getSimulcastProfile()),at.wL.type==="chrome"&&at.wL.version>=78&&Lt.simulcast.mode!=="SDP"?(fn.debug("simulcast chrome 78+ -> RID",Lt.simulcast),Pt.simulcast="RID",Pt.data.simulcast={enabled:!0,mode:"RID"},Pt.data.simulcast.encodings=Object.assign({},Lt.simulcast.encodings),mn&&(Pt.data.simulcast.profile=mn)):at.wL.type==="chrome"?(fn.debug("simulcast chrome -> SDP",Lt.simulcast),Pt.simulcast="SDP",Pt.data.simulcast={enabled:!0,mode:"SDP"}):at.wL.type==="firefox"?(fn.debug("simulcast firefox -> RID",Lt.simulcast),Pt.simulcast="RID",Pt.data.simulcast={enabled:!0,mode:"RID"},Pt.data.simulcast.encodings=Object.assign({},Lt.simulcast.encodings),mn&&(Pt.data.simulcast.profile=mn)):at.wL.type==="safari"&&(fn.debug("simulcast safari -> SDP",Lt.simulcast),Pt.simulcast="SDP",Pt.data.simulcast={enabled:!0,mode:"SDP"})}return fn.log("webRTCClient.accessToLocalMedia :",qt.accessToLocalMedia),apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.push(Pt),this.publishCallId=Pt.callId,Pt.callControl&&Pt.callControl.autoRestart.stream&&fn.debug("call.callControl.autoRestart.stream.active :",Pt.callControl.autoRestart.stream.active),this.pubConnector==="janusConnector"&&Pt.callControl&&Pt.callControl.autoRestart.stream&&Pt.callControl.autoRestart.stream.active?(apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,Pt.callLocalStream=Pt.callControl.autoRestart.stream,Pt.establishCall(),Pt.callId):(Et.mesh!==void 0&&(rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(Et.mesh.calleeCallId))!==null&&rn.callConfiguration&&rn.callConfiguration.userMediaStreamId&&(Pt.callType=rn.callType,Lt.userMediaStreamId=rn.callConfiguration.userMediaStreamId),Lt.userMediaStreamId?((Jt=apiCC.getUserMediaStream(Lt.userMediaStreamId)).addCallInfo(Pt.callId),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,this.pubConnector==="janusConnector"&&Pt.callControl&&(Pt.callControl.autoRestart.stream=Jt.stream),Pt.callConfiguration.userMediaStreamId=Jt.userMediaStreamId,Pt.callLocalStream=Jt.stream,Pt.establishCall(),Pt.callId):apiCC.userMediaStreamTable.length>0?((Jt=apiCC.userMediaStreamTable[0]).addCallInfo(Pt.callId),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,this.pubConnector==="janusConnector"&&Pt.callControl&&(Pt.callControl.autoRestart.stream=Jt.stream),Pt.callConfiguration.userMediaStreamId=Jt.userMediaStreamId,Pt.callLocalStream=Jt.stream,Pt.establishCall(),Pt.callId):(apiCC.createUserMediaStream({callId:Pt.callId,type:Pt.callType,audioSourceId:qt.audioSourceId,videoSourceId:qt.videoSourceId,success:function(an){fn.debug("[publish] success; userMediaStreamId: "+an.userMediaStreamId),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector==="janusConnector"&&Pt.callControl&&(Pt.callControl.autoRestart.stream=an.stream),Pt.callConfiguration.userMediaStreamId=an.userMediaStreamId,Pt.callLocalStream=an.stream,Pt.establishCall()}}),Pt.callId))},this.publishScreen=function(st,Tt,Rt,Lt){fn.info("publishScreen()");var Et=this.getSessionMCU(st);return Et?(Tt==null&&(Tt={}),Rt==null&&(Rt={}),Rt.record!==void 0&&(Tt.callConfiguration!==void 0||(Tt.callConfiguration={}),Tt.callConfiguration.record=Rt.record),Rt.private!==void 0&&(Tt.callConfiguration!==void 0||(Tt.callConfiguration={}),Tt.callConfiguration.private=Rt.private),Tt.pubSub=this.pubConnector,Tt.type="publish",apiCC.session.apiCCWebRTCClient.webRTCClient.shareScreen(Et.roomName,Tt,Lt,Rt)):(fn.error("roomId does not match any sessionMCU"),null)},this.unpublish=function(st){fn.info("unpublish call with callId :",st),apiCC.session.apiCCWebRTCClient.webRTCClient.onHangup(st),this.publishCallId=null},this.removeMCUStream=function(st,Tt,Rt){var Lt,Et=!1;for(Rt!=="Broken_by_MCU"&&Rt!=="disconnected"||(Et=!0),fn.debug("streamId:",Tt),fn.debug("reason:",Rt),fn.debug("quiet:",Et),Lt=0;Lt0,Vt=Tt!=null&&Tt.length>0,Qt={};if(!Pt&&!Vt||Rt==null||Rt.length===0)return!1;if(Lt===void 0){if(this.publishCallId===null)return fn.log("Cannot start streaming as no stream is published"),!1;Lt=this.publishCallId}var rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(Lt);return rn||(rn=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(Lt))?rn.sessionMCU?(Pt||(st="custom"),Qt.pubSub=this.pubConnector,Qt.service=st,Vt&&(Qt.server=Tt),Qt.streamKey=Rt,fn.log("startStreaming() on ApiRTC MCU with roomId:",rn.sessionMCU.roomName),Et={type:"startStreaming",roomId:rn.sessionMCU.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Lt,data:Qt},jt=JSON.stringify(Et),fn.log("C->S: "+jt),apiCC.session.channel.socket.emit("startStreaming",jt),!0):(fn.error("no such sessionMCU"),!1):(fn.error("callIdToStream does not match any call"),!1)},this.stopStreaming=function(st){var Tt,Rt;if(fn.info("stopStreaming"),st===void 0){if(this.publishCallId===null)return fn.log("Cannot stop streaming as no stream is published"),!1;st=this.publishCallId}var Lt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(st);if(!Lt)return fn.error("callIdToStream does not match any call"),!1;var Et=this.getSessionMCU(Lt.dest_roomId);return Et?(fn.log("stopStreaming() on ApiRTC MCU with roomId:",Et.roomName),Tt={type:"stopStreaming",roomId:Et.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:st,data:{pubSub:this.pubConnector}},Rt=JSON.stringify(Tt),fn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("stopStreaming",Rt),!0):(fn.error("dest_roomId does not match any sessionMCU"),!1)},this.startRecording=function(st,Tt,Rt,Lt,Et){var jt,Pt;if(fn.info("startRecording"),Lt==null){if(this.publishCallId===null)return void fn.log("Call recording can not start as stream is not published");Lt=this.publishCallId}var Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(Lt);return Vt||(Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(Lt))?Vt.sessionMCU?(st!=="AUDIO-ONLY"&&st!=="VIDEO-ONLY"&&(st="AUDIO-VIDEO"),Et==null&&(Et={}),Et.pubSub=this.pubConnector,fn.log("startRecording() on ApiRTC MCU with roomId :",Vt.sessionMCU.roomName),jt={type:"startRecording",roomId:Vt.sessionMCU.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:Lt,data:Et,customIdInFilename:Tt,mediaType:st,convId:Rt},Pt=JSON.stringify(jt),fn.log("C->S: "+Pt),void apiCC.session.channel.socket.emit("startRecording",Pt)):(fn.error("no such sessionMCU"),!1):(fn.error("callIdToRecord does not match any call"),!1)},this.stopRecording=function(st){var Tt,Rt;if(fn.info("stopRecording"),st===void 0){if(this.publishCallId===null)return void fn.log("Call recording can not stop as stream is not published");st=this.publishCallId}var Lt=apiCC.session.apiCCWebRTCClient.webRTCClient.findCallWithCallId(st);if(!Lt)return fn.error("callIdToRecord does not match any call"),!1;var Et=this.getSessionMCU(Lt.dest_roomId);if(!Et)return fn.error("dest_roomId does not match any sessionMCU"),!1;fn.log("stopRecording() on ApiRTC MCU with roomId :",Et.roomName),Tt={type:"stopRecording",roomId:Et.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:st,data:{pubSub:this.pubConnector}},Rt=JSON.stringify(Tt),fn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("stopRecording",Rt)},this.recordingStarted=function(st){fn.info("recordingStarted:",st),Tn.createMCURecordingStartedEvent(st.roomName,st.callId,st.clientId,st.recordType,st.time,st.convId,st.mediaId,st.mediaURL,st.remoteId,st.recordedFileName,st.mediaType,st.descriptor)},this.recordingStopped=function(st){fn.info("recordingStopped:",st),Tn.createMCURecordingStoppedEvent(st.roomName,st.callId,st.clientId,st.recordType,st.time,st.convId,st.mediaId,st.mediaURL,st.remoteId,st.recordedFileName,st.mediaType,st.descriptor)},this.recordingStreamAvailable=function(st){fn.info("recordingStreamAvailable :",st),Tn.createMCURecordedStreamsAvailableEvent(st.roomName,st.callId,st.clientId,st.recordedFileName,st.convId,st.mediaId,st.mediaURL,st.recordType,st.remoteId,st.mediaType,st.descriptor),this.pubConnector==="janusConnector"&&st.hasOwnProperty("confId")&&st.hasOwnProperty("remoteId")&&Tn.createRecordedStreamsAvailableEvent(st.confId,st.clientId,st.remoteId,st.callId,st.convId,st.mediaId,st.mediaURL)},this.streamingStarted=function(st){fn.info("streamingStarted: ",st),Tn.createMCUStreamingStartedEvent(st.roomName,st.callId,st.clientId,st.time)},this.streamingStopped=function(st){fn.info("streamingStopped: ",st),Tn.createMCUStreamingStoppedEvent(st.roomName,st.callId,st.clientId,st.time)},this.startComposite=function(st){var Tt,Rt,Lt;(Lt=st?this.getSessionMCU(st):this.getSessionMCU(null,{first:!0}))?(fn.log("startComposite() on ApiRTC MCU with roomId :",Lt.roomName),Tt={type:"startComposite",roomId:Lt.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,data:{pubSub:this.pubConnector}},Rt=JSON.stringify(Tt),fn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("startComposite",Rt)):fn.log("startComposite() but client is not in session")},this.stopComposite=function(st){var Tt,Rt,Lt;(Lt=st?this.getSessionMCU(st):this.getSessionMCU(null,{first:!0}))?(fn.log("stopComposite() on ApiRTC MCU with roomId :",Lt.roomName),Tt={type:"stopComposite",roomId:Lt.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,data:{pubSub:this.pubConnector}},Rt=JSON.stringify(Tt),fn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("stopComposite",Rt)):fn.log("stopComposite() but client is not in session")},this.startCompositeRecording=function(st,Tt,Rt,Lt,Et){fn.info("startCompositeRecording with convId :",Rt);var jt,Pt,Vt;(Vt=Et?this.getSessionMCU(Et):this.getSessionMCU(null,{first:!0}))?(st!=="AUDIO-ONLY"&&st!=="VIDEO-ONLY"&&(st="AUDIO-VIDEO"),(Lt=(0,at.Ym)(Lt,"object")?(0,at.ws)({},Lt):{}).pubSub=this.pubConnector,["complete","efficient","audioOnly"].indexOf(Lt.mode)<0&&(Lt.mode="complete"),Lt.labelEnabled=Lt.labelEnabled===!0,(0,at.Ym)(Lt,"labels","array")||(Lt.labels=["microphone","camera","screenSharing","sip"]),fn.log("startRecording() on ApiRTC MCU with roomId :",Vt.roomName),jt={type:"startRecording",roomId:Vt.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:"COMPOSITE",data:Lt,customIdInFilename:Tt,mediaType:st,convId:Rt},Pt=JSON.stringify(jt),fn.log("C->S: "+Pt),apiCC.session.channel.socket.emit("startRecording",Pt)):fn.log("startCompositeRecording() but client is not in session")},this.stopCompositeRecording=function(st){fn.info("stopCompositeRecording");var Tt,Rt,Lt;(Lt=st?this.getSessionMCU(st):this.getSessionMCU(null,{first:!0}))?(fn.log("stopRecording() on ApiRTC MCU with roomId :",Lt.roomName),Tt={type:"stopRecording",roomId:Lt.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:"COMPOSITE",data:{pubSub:this.pubConnector}},Rt=JSON.stringify(Tt),fn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("stopRecording",Rt)):fn.log("stopCompositeRecording() but client is not in session")},this.inviteVoIP=function(st,Tt,Rt){var Lt=this;return new Promise(function(Et,jt){if(!st||typeof st!="string")return jt(new Error("wrong roomId"));if(!Lt.getSessionMCU(st))return jt(new Error("no such session"));if(!Tt||typeof Tt!="string")return jt(new Error("wrong convId"));if(!Rt||typeof Rt!="string")return jt(new Error("wrong phoneNumber"));var Pt="inviteVoIP-"+Rt;try{if(qt.hasReceiptHook(Pt))return jt(new Error("busy"));var Vt=new Nt;Vt.onSuccess(function(){return Et()}),Vt.onFailure(function(Jt){return jt(Jt)}),Vt.setTimeout(1e4,"timeout"),qt.createReceiptHook(Pt,Vt)}catch(Jt){return fn.debug("inviteVoIP: createReceiptHook",Jt),jt(new Error("internal error"))}var Qt={type:"inviteVoIP",clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,roomId:st,convId:Tt,phoneNumber:Rt,receiptId:Pt,data:{pubSub:"sipConnector"}},rn=JSON.stringify(Qt);fn.debug("C->S:",rn),apiCC.session.channel.socket.emit("inviteVoIP",rn)})},this.enforceMCU=function(st){var Tt;if(Tt=st?this.getSessionMCU(st):this.getSessionMCU(null,{first:!0})){var Rt={type:"info",infoType:"enforceMCU",data:{clientId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,roomId:Tt.roomName,pubSub:this.pubConnector}},Lt=JSON.stringify(Rt);fn.log("C->S: "+Lt),apiCC.session.channel.socket.emit("info",Lt)}else fn.log("enforceMCU() but client is not in session")},this.meshPublish=function(st,Tt,Rt,Lt,Et,jt){var Pt=!1,Vt=null,Qt=null,rn=this.getSessionMCU(st);if(!rn)return fn.error("meshPublish() - missing sessionMCU"),null;if(Lt===!0||Lt===!1||Lt==="true"||Lt==="false"?(fn.log("DEPRECATED ... please use callConfiguration JSON parameter : callConfiguration.audioOnly instead of audioOnly"),Pt=Lt,Lt={}):Lt!==null&&cn(Lt)==="object"||(Lt={}),Et!==null&&cn(Et)==="object"||(Et={}),(0,at.Ym)(Lt,"profileType","string")&&(Et.profileType=Lt.profileType),(0,at.Ym)(Lt,"priority","number")&&Lt.priority>=0&&(Et.priority=Lt.priority),(0,at.Ym)(Lt,"downgradeProfileList","array")&&(Et.downgradeProfileList=Lt.downgradeProfileList),Lt.audioOnly!==void 0&&(Pt=Lt.audioOnly,Et.callConfiguration!==void 0||(Et.callConfiguration={}),Et.callConfiguration.audioOnly=Lt.audioOnly),(0,at.Ym)(Lt,"context","object"))try{JSON.stringify(Lt.context),Et.context=Lt.context}catch{}return Vt=new yn(apiCC.session.apiCCWebRTCClient.webRTCClient),Pt!==!0&&Pt!=="true"||(fn.log("Setting call as audioOnly"),Vt.callType="audio"),Vt.roomId=st,Vt.sessionId=Tt,Vt.token=Rt,Vt.callConfiguration=Lt,Vt.data=Et,Vt.options=jt,Vt.sessionMCU=rn,apiCC.session.apiCCWebRTCClient.webRTCClient.userMediaTable.push(Vt),Lt.userMediaStreamId?((Qt=apiCC.getUserMediaStream(Lt.userMediaStreamId)).addCallInfo(Vt.userMediaId,"userMedia"),Vt.callConfiguration.userMediaStreamId=Qt.userMediaStreamId,Vt.callType=Qt.callType,Vt.audio=Qt.audio,Vt.video=Qt.video,Vt.audioMuted=Qt.audioMuted,Vt.videoMuted=Qt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Vt),apiCC.checkMutingStateForUserMedia(Lt,Qt)):apiCC.createUserMediaStream({callId:Vt.userMediaId,callFlavor:"userMedia",type:Vt.callType,audioSourceId:apiCC.session.apiCCWebRTCClient.webRTCClient.audioSourceId,videoSourceId:apiCC.session.apiCCWebRTCClient.webRTCClient.videoSourceId,success:function(Jt){fn.debug("[meshPublish] success; userMediaStreamId: "+Jt.userMediaStreamId),Vt.callConfiguration.userMediaStreamId=Jt.userMediaStreamId,Vt.callType=Jt.callType,Vt.audio=Jt.audio,Vt.video=Jt.video,Vt.audioMuted=Jt.audioMuted,Vt.videoMuted=Jt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Vt),apiCC.checkMutingStateForUserMedia(Lt,Jt)}}),Vt.userMediaId},this.meshOnUserMediaSuccess=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Rt=null,Lt=null;Tt===!0?((Rt={}).type="streamStatusChanged",Rt.callerId=qt.clientId,Rt.roomId=st.roomId,Rt.streams={},Rt.streams[st.userMediaId]={eventType:"modify",callId:st.userMediaId,callType:st.callType,audio:st.audio,video:st.video,audioMuted:st.audioMuted,videoMuted:st.videoMuted},Rt.data={},Rt.data.meshPublish=!0,Rt.data.pubSub=this.pubConnector,Lt=JSON.stringify(Rt),fn.log("C->S: "+Lt),apiCC.session.channel.socket.emit("streamStatusChanged",Lt)):(this.publishCallId=st.userMediaId,st.addAck=!0,st.addTimeoutId=setTimeout(function(){qt.onRemoteHangup(st.userMediaId,qt.clientId,st.roomId,"Unable_to_establish",null,null)},st.disconnectionTimer),(Rt={}).type="streamStatusChanged",Rt.callerId=qt.clientId,Rt.roomId=st.roomId,Rt.streams={},Rt.streams[st.userMediaId]={eventType:"add",callId:st.userMediaId,callType:st.callType,audio:st.audio,video:st.video,audioMuted:st.audioMuted,videoMuted:st.videoMuted},Rt.data=st.data,Rt.data.meshPublish=!0,Rt.data.pubSub=this.pubConnector,Lt=JSON.stringify(Rt),fn.log("C->S: "+Lt),apiCC.session.channel.socket.emit("streamStatusChanged",Lt))},this.meshPublishScreen=function(st,Tt,Rt,Lt,Et){var jt=null,Pt=null,Vt=this.getSessionMCU(st);return Vt?(Rt!==null&&cn(Rt)==="object"||(Rt={}),(jt=new yn(apiCC.session.apiCCWebRTCClient.webRTCClient)).roomId=st,jt.data=Tt,jt.callConfiguration=Rt,jt.captureSourceType=Lt,jt.sessionMCU=Vt,apiCC.session.apiCCWebRTCClient.webRTCClient.userMediaTable.push(jt),Rt.userMediaStreamId?((Pt=apiCC.getUserMediaStream(Rt.userMediaStreamId)).addCallInfo(jt.userMediaId,"userMedia"),jt.callConfiguration.userMediaStreamId=Pt.userMediaStreamId,jt.callType=Pt.callType,jt.audio=Pt.audio,jt.video=Pt.video,jt.audioMuted=Pt.audioMuted,jt.videoMuted=Pt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(jt)):apiCC.createUserMediaStream({callId:jt.userMediaId,callFlavor:"userMedia",type:"screenSharing",captureSourceType:Lt,success:function(Qt){fn.debug("[meshPublishScreen] success; userMediaStreamId: "+Qt.userMediaStreamId),jt.callConfiguration.userMediaStreamId=Qt.userMediaStreamId,jt.callType=Qt.callType,jt.audio=Qt.audio,jt.video=Qt.video,jt.audioMuted=Qt.audioMuted,jt.videoMuted=Qt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnScreenMediaSuccess(jt)}}),jt.userMediaId):(fn.error("meshPublishScreen() - missing sessionMCU"),null)},this.meshOnScreenMediaSuccess=function(st){var Tt,Rt=null;st.addAck=!0,st.addTimeoutId=setTimeout(function(){qt.onRemoteHangup(st.userMediaId,qt.clientId,st.roomId,"Unable_to_establish",null,null)},st.disconnectionTimer),(Rt={}).type="streamStatusChanged",Rt.callerId=qt.clientId,Rt.roomId=st.roomId,Rt.streams={},Rt.streams[st.userMediaId]={eventType:"add",callId:st.userMediaId,callType:st.callType,audio:st.audio,video:st.video,audioMuted:st.audioMuted,videoMuted:st.videoMuted},Rt.data={},Rt.data.pubSub=this.pubConnector,Tt=JSON.stringify(Rt),fn.log("C->S: "+Tt),apiCC.session.channel.socket.emit("streamStatusChanged",Tt)},this.meshOnHangup=function(st,Tt){var Rt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Lt=0,Et=null,jt=null,Pt=null;if(Tt!==null&&cn(Tt)==="object"||(Tt={}),st){if((Et=qt.findUserMediaById(st))!==null){for(Et.close(),Et.streamStolen!==!0&&(qt.myWebRTC_Event.createHangupEvent("local",qt.clientId,0,!0,null,Et.userMediaId,Et.callType),Et.releaseUserMediaStream()),(jt={}).type="streamStatusChanged",jt.callerId=qt.clientId,jt.roomId=Et.roomId,jt.streams={},jt.streams[Et.userMediaId]={eventType:"remove",callId:Et.userMediaId,callType:Et.callType},Rt.restart&&(jt.streams[Et.userMediaId].restart=!0),jt.data={},jt.data.pubSub=this.pubConnector,Pt=JSON.stringify(jt),fn.log("C->S: "+Pt),apiCC.session.channel.socket.emit("streamStatusChanged",Pt),Lt=qt.userMediaTable.length;--Lt>=0;)if(qt.userMediaTable[Lt]===Et){qt.userMediaTable.splice(Lt,1);break}}}else for(Lt=qt.userMediaTable.length;--Lt>=0;)Et=qt.userMediaTable[Lt],Rt.hasOwnProperty("roomId")&&Et.sessionMCU.roomName!==Rt.roomId||(qt.myWebRTC_Event.createHangupEvent("local",qt.clientId,0,!0,null,Et.userMediaId,Et.callType),Et.close(),Et.releaseUserMediaStream(),(jt={}).type="streamStatusChanged",jt.callerId=qt.clientId,jt.roomId=Et.roomId,jt.streams={},jt.streams[Et.userMediaId]={eventType:"remove",callId:Et.userMediaId,callType:Et.callType},jt.data={},jt.data.pubSub=this.pubConnector,Pt=JSON.stringify(jt),fn.log("C->S: "+Pt),apiCC.session.channel.socket.emit("streamStatusChanged",Pt),qt.userMediaTable.splice(Lt,1))},this.participantEjected=function(st){(0,at.Ym)(st.data,"clientId","string")&&qt.myWebRTC_Event.createMCUParticipantEjectedEvent(st.roomId,st.data.clientId,st.data.info)},this.ejectParticipant=function(st,Tt,Rt){var Lt;if(Lt=Rt?this.getSessionMCU(Rt):this.getSessionMCU(null,{first:!0})){var Et={type:"ejectParticipant",roomId:Lt.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,data:{pubSub:this.pubConnector,clientId:st}};Tt&&(Et.data.info=Tt);var jt=JSON.stringify(Et);fn.log("C->S: "+jt),apiCC.session.channel.socket.emit("ejectParticipant",jt)}else fn.debug("ejectParticipant() - missing sessionMCU")},this.getJoinSessionReq=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=null;if(!st){if(Tt.hasOwnProperty("transactionId")){for(var Lt=this.joinSessionReqs.length;--Lt>=0;)if(this.joinSessionReqs[Lt].transactionId===Tt.transactionId){Rt=this.joinSessionReqs[Lt];break}return Rt}return null}for(var Et=this.joinSessionReqs.length;--Et>=0;)if(this.joinSessionReqs[Et].roomId===st){Rt=this.joinSessionReqs[Et];break}return Rt},this.removeJoinSessionReq=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!st){if(Tt.all===!0)return this.joinSessionReqs.splice(0,this.joinSessionReqs.length),!0;Tt.hasOwnProperty("roomId")&&(st=this.getJoinSessionReq(Tt.roomId))}if(!st)return!1;for(var Rt=this.joinSessionReqs.length;--Rt>=0&&this.joinSessionReqs[Rt]!==st;);return Rt>=0&&(this.joinSessionReqs.splice(Rt,1),!0)},this.getSessionMCU=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=null;if(!st){if(Tt.first===!0)return this.sessionMCUs[0];if((0,at.Ym)(Tt.callback,"function")){fn.debug("getSessionMCU callback");for(var Lt=this.sessionMCUs.length;--Lt>=0;)if(Tt.callback(this.sessionMCUs[Lt])){Rt=this.sessionMCUs[Lt];break}}return Rt}for(var Et=this.sessionMCUs.length;--Et>=0;)if(this.sessionMCUs[Et].roomName===st){Rt=this.sessionMCUs[Et];break}return Rt},this.removeSessionMCU=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!st&&Tt.all===!0)return this.sessionMCUs.splice(0,this.sessionMCUs.length),!0;if(!st)return!1;for(var Rt=this.sessionMCUs.length;--Rt>=0&&this.sessionMCUs[Rt]!==st;);return Rt>=0&&(this.sessionMCUs.splice(Rt,1),!0)},this.callback=function(st,Tt){return this.closureHandler=function(Rt){return st[Tt](Rt)},this.closureHandler}};function Pn(qt){fn.debug("disputableEntryTimeout",qt);for(var kt=apiCC.session.apiCCWebRTCClient.webRTCClient,st=this.disputableStreamList.length;--st>=0;)if(this.disputableStreamList[st].streamInfo.id===qt){this.disputableStreamList.splice(st,1);break}for(var Tt=null,Rt=this.streamList.length;--Rt>=0;)if(this.streamList[Rt].streamInfo.id===qt){Tt=kt.destroyCallControl({type:"subscribe",stream:this.streamList[Rt].streamInfo}),this.streamList.splice(Rt,1);break}Tt&&Tt.callId&&Tn.createHangupEvent("remote",kt.clientId,Tt.roomName,!1,"Hangup_From_Callee",Tt.callId,Tt.callType),Tn.createMCURemovedStreamEvent(qt)}function In(qt){fn.debug("clearDisputableEntry",qt);for(var kt=this.disputableStreamList.length;--kt>=0;)if(this.disputableStreamList[kt].streamInfo.id===qt){this.disputableStreamList.splice(kt,1);break}for(var st=this.streamList.length;--st>=0;)if(this.streamList[st].streamInfo.id===qt){this.streamList[st].disputableTimeoutId&&(clearTimeout(this.streamList[st].disputableTimeoutId),delete this.streamList[st].disputableTimeoutId),delete this.streamList[st].clearDisputableEntry;break}}function Rn(qt){var kt={};return(0,at.ki)(qt,"maxBitrate","number")&&(kt.maxBitrate=qt.maxBitrate),(0,at.ki)(qt,"scaleResolutionDownBy","number")&&(kt.scaleResolutionDownBy=qt.scaleResolutionDownBy),kt}function On(qt){return(0,at.Ym)(qt.encodings,"object")?(0,at.ki)(qt.encodings.high,"maxBitrate","number")&&(0,at.ki)(qt.encodings.medium,"maxBitrate","number")&&(0,at.ki)(qt.encodings.low,"maxBitrate","number")?(qt.encodings.high=Object.assign({active:!0},Rn(qt.encodings.high)),qt.encodings.medium=Object.assign({active:!0},Rn(qt.encodings.medium)),qt.encodings.low=Object.assign({active:!0},Rn(qt.encodings.low)),qt.sendEncodings=[{rid:"h",active:!0},{rid:"m",active:!0},{rid:"l",active:!0}],qt.sendEncodings[0].maxBitrate=1e3*qt.encodings.high.maxBitrate,qt.sendEncodings[1].maxBitrate=1e3*qt.encodings.medium.maxBitrate,qt.sendEncodings[2].maxBitrate=1e3*qt.encodings.low.maxBitrate,(0,at.ki)(qt.encodings.medium,"scaleResolutionDownBy","number")&&(qt.sendEncodings[1].scaleResolutionDownBy=qt.encodings.medium.scaleResolutionDownBy),(0,at.ki)(qt.encodings.low,"scaleResolutionDownBy","number")&&(qt.sendEncodings[2].scaleResolutionDownBy=qt.encodings.low.scaleResolutionDownBy),!0):(fn.warn("no such maxBitrate"),!1):(fn.warn("no such encodings"),!1)}function Ln(qt,kt){if(kt<650)return!1;var st=Math.floor(9*kt/13),Tt=Math.floor(3*kt/13),Rt=kt-st-Tt;return qt.encodings={high:{maxBitrate:st},medium:{maxBitrate:Tt,scaleResolutionDownBy:2},low:{maxBitrate:Rt,scaleResolutionDownBy:4}},On(qt)}et.Y.get("CallControl");var qn=function(qt){this.type=qt.type,qt.callId&&(this.callId=qt.callId),qt.callType?this.callType=qt.callType:this.callType="media",Object.prototype.hasOwnProperty.call(qt,"audioOnly")&&(this.audioOnly=!!qt.audioOnly),qt.roomName&&(this.roomName=qt.roomName),qt.mediaType&&(this.mediaType=qt.mediaType),qt.callConfiguration&&(this.callConfiguration=qt.callConfiguration),qt.data&&(this.data=qt.data),qt.stream&&(this.stream=qt.stream),this.autoRestart={}},jn=function(){var qt=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];this.a=1,this.b=0,this.c=7,this.d=0,this.update=function(kt,st,Tt){var Rt=0;for(st==null&&(st=0),Tt==null&&(Tt=kt.length);Rt>12&15]+qt[this.d>>8&15]+qt[this.d>>4&15]+qt[15&this.d]+qt[this.c>>12&15]+qt[this.c>>8&15]+qt[this.c>>4&15]+qt[15&this.c]+qt[this.b>>12&15]+qt[this.b>>8&15]+qt[this.b>>4&15]+qt[15&this.b]+qt[this.a>>12&15]+qt[this.a>>8&15]+qt[this.a>>4&15]+qt[15&this.a]}};function Fn(qt,kt){return qt==="checksum64"?new jn:null}function Zn(qt){return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(kt){return typeof kt}:function(kt){return kt&&typeof Symbol=="function"&&kt.constructor===Symbol&&kt!==Symbol.prototype?"symbol":typeof kt},Zn(qt)}var on=et.Y.get("WebRTC_Client"),Hn=apiCC.myWebRTC_Event,Bn=4e4,zn=function(qt){function kt(st,Tt,Rt){var Lt,Et=st.width,jt=Et<<2,Pt=st.height,Vt=null,Qt=0,rn=0,Jt=0,sn=0,mn=0,an=0,hn=0,wn=0,Mn=0,xn=0,En=0,kn=0,Vn=0,Xn=0,cr=0,dr=0;if(Tt){for(Vt=Tt.data,Rt<0&&(Rt=0),wn=1-((mn=(2.44413*(Qt=Rt>=2.5?.98711*Rt-.9633:Rt>=.5?3.97156-4.14554*Math.sqrt(1-.26891*Rt):2*Rt*(3.97156-4.14554*Math.sqrt(.865545)))+2.85619*(rn=Qt*Qt)+1.26661*(Jt=rn*Qt))/(sn=1.57825+2.44413*Qt+1.4281*rn+.422205*Jt))+(an=-(1.4281*rn+1.26661*Jt)/sn)+(hn=.422205*Jt/sn)),Lt=0;Lt<3;Lt++)for(Mn=0;Mn=En;xn-=4)kn=wn*Vt[xn]+mn*Vn+an*Xn+hn*cr,Vt[xn]=kn,cr=Xn,Xn=Vn,Vn=kn}for(Lt=0;Lt<3;Lt++)for(dr=0;dr=En;xn-=jt)kn=wn*Vt[xn]+mn*Vn+an*Xn+hn*cr,Vt[xn]=kn,cr=Xn,Xn=Vn,Vn=kn}return Tt}}this.localStream=null,this.remoteStream=null,this.channelReady=!1,this.socket=qt.channel.socket,this.clientId=qt.apiCCId,this.compositeClientId=qt.apiCCId+"@"+qt.apiCCSessionId,this.apiKey=qt.apiKey,this.isVideoMuted=!1,this.isAudioMuted=!1,this.receiptHooks={},this.callControlTable=[],this.userMediaTable=[],this.callsTable=[],this.callsRetriesTable={},this.restartCallDelay=1e3,this.maxCallsRetriesDuration=15e4,this.accessToLocalMedia=!1,this.unidirectionelCallOnly=!1,this.NtoNConf=!1,this.autoAnswer=!1,this.RTPMedia=!1,this.logoAdded=!1,this.preferOpusCodec=!1,this.preferVP9Codec=!1,typeof apiRTC_React<"u"&&nt.BF==="iOS"?(on.log("React and iOS : Setting H264 as preferred codec"),this.preferH264Codec=!0):this.preferH264Codec=!1,this.preferSendingH264Codec=!1,this.setStereo=!1,this.allowedAudioCodecs="",this.allowedVideoCodecs="",this.mediaRoutingModeEnum={hostOnly:1,stun:2,stunOnly:3,turn:4,turnOnly:5},this.mediaRoutingMode=this.mediaRoutingModeEnum.turn,this.myWebRTC_Event=apiCC.myWebRTC_Event,this.getUserMediaOnGoing=!1,this.userAcceptOnIncomingCall=!1,this.userAcceptOnIncomingCallBeforeGetUserMedia=!1,this.userAcceptOnIncomingDataCall=!1,this.userAcceptOnIncomingScreenSharingCall=!1,this.maxWidthRemoteVideo=0,this.maxHeightRemoteVideo=0,this.nickname=qt.nickname,this.allowMultipleCalls=!1,this.mySDPManager=new pt,this.MCUClient=new Un(this,this.clientId),this.audioSourceId=null,this.audioOutputId=null,this.videoSourceId=null,this.facingMode=null,this.apiRTCExtensionInstalled=!1,this.trickleIce=!0,this.waitingShareScreenCallId=0,this.waitingShareScreenDestNumber=0,this.waitingCaptureSourceType=null,this.qosEnable=!1,this.qosInterval=5e3,this.csmEnable=!1,this.qualityScoreEnable=!1,this.qualityScoreIntervalMs=5e3,this.csmIntervalMs=5e3,this.recordedCall=!1,this.audioBandwidth=null,this.videoBandwidth=null,this.videoRemoteBandwidth=null,this.videoBandwidthSettings={},this.dataBandwidth=null,this.pc_config="",this.clientIncomingCandidatesQueue=[],this.cleanStoredCallCandidateTimer=6e4,this.initializeGumConfig=function(){nt.Xh==="Edge"&&nt.PR>=15&&apiRTC.browserDetails.type!=="chrome"?this.gum_config={audio:!0,video:!0}:nt.Xh==="Chrome"&&nt.PR<49||nt.Xh==="Firefox"&&nt.PR<50?this.gum_config={audio:{mandatory:{},optional:[]},video:{mandatory:{},optional:[]}}:this.gum_config={audio:{},video:{}}},this.initializeGumConfig(),this.setGumConfigWithDevicePresent=function(){apiCC.mediaDeviceMgr.audioDevicePresent===!1&&(this.gum_config.audio=!1),apiCC.mediaDeviceMgr.videoDevicePresent===!1&&(this.gum_config.video=!1),apiCC.mediaDeviceMgr.audioDevicePresent===!1&&apiCC.mediaDeviceMgr.videoDevicePresent===!1&&(this.unidirectionelCallOnly=!0),on.log("this.gum_config:",this.gum_config)},this.userMediaErrorDetected=!1,this.lastUsedUserMediaConstraint=null,this.mediaTypeForIncomingCall="VIDEO",this.mediaTypeForOutgoingCall="VIDEO",this.allowAsymetricMediaCalls=!1,this.receiveMediaDeactivated=!1,this.configTurnServer=null,apiCC.myWebRTC_Adapter.adaptForIoSCordova(),this.pc_config={iceServers:[{urls:["turns:mp1.apizee.com:443?transport=udp","turns:mp1.apizee.com:443?transport=tcp","turn:mp1.apizee.com:443?transport=udp","turn:mp1.apizee.com:443?transport=tcp","turns:mp2.apizee.com:443?transport=udp","turns:mp2.apizee.com:443?transport=tcp","turn:mp2.apizee.com:443?transport=udp","turn:mp2.apizee.com:443?transport=tcp"],credential:"password",username:"anonymous"}]},nt.Xh==="Firefox"&&nt.PR<53?(on.log("createPeerConnection FIREFOX"),on.log("webrtcDetectedVersion : "+apiCC.myWebRTC_Adapter.webrtcDetectedVersion),nt.PR<38?this.pc_config={iceServers:[{url:"stun:mp1.apizee.com:443",credential:"password",username:"anonymous"},{url:"turn:mp1.apizee.com:443",credential:"password",username:"anonymous"}]}:nt.PR>=42?this.pc_config={iceServers:[{urls:["turn:mp1.apizee.com:443?transport=udp","turn:mp1.apizee.com:443?transport=tcp"],credential:"password",username:"anonymous"}]}:this.pc_config={iceServers:[{urls:"turn:mp1.apizee.com:443?transport=tcp",credential:"password",username:"anonymous"},{url:"turn:mp1.apizee.com:443?transport=tcp",credential:"password",username:"anonymous"}]}):nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11?(on.log("Browser is :"+nt.Xh+" - using Plugin"),this.pc_config={iceServers:[{url:"stun:mp1.apizee.com:443",credential:"password",username:"anonymous"},{url:"turn:mp1.apizee.com:443",credential:"password",username:"anonymous"}]}):nt.Xh==="Edge"&&nt.PR<45&&apiRTC.browserDetails.type!=="chrome"?(on.log("Browser is Edge < 45 - removing Turns config"),this.pc_config={iceServers:[{urls:["turn:mp1.apizee.com:443?transport=udp","turn:mp1.apizee.com:443?transport=tcp","turn:mp2.apizee.com:443?transport=udp","turn:mp2.apizee.com:443?transport=tcp"],credential:"password",username:"anonymous"}]}):on.log("default this.pc_config configuration"),this.pc_constraints={optional:[]},at.wL.type==="edge"?on.debug("not data channel capable"):at.wL.type==="safari"?at.wL.version>=11?this.dataChannelCapable=!0:on.debug("not data channel capable"):this.dataChannelCapable=!0,at.wL.type==="chrome"&&at.wL.version>=68||at.wL.type==="firefox"&&at.wL.version>=64||at.wL.type==="safari"&&at.wL.version>=12?(on.debug("RTCRtpSender#setParameters is available"),this.rtpSenderSetParamatersCapable=!0):(on.debug("RTCRtpSender#setParameters is NOT available"),this.rtpSenderSetParamatersCapable=!1),this.setClientTurnServer=function(st){on.info("setClientTurnServer :",st);var Tt=JSON.stringify(this.pc_config);Tt=Tt.replace(/mp1.apizee.com/g,st),this.pc_config=JSON.parse(Tt)},this.activateScreenSharing=function(st){apiCC.activateScreenSharing(st)},this.setGetUserMediaConfig=function(st){if(on.log("setGetUserMediaConfig :",st),navigator.mediaDevices!==null&&navigator.mediaDevices!==void 0&&navigator.mediaDevices.getSupportedConstraints!==null&&navigator.mediaDevices.getSupportedConstraints!==void 0){var Tt=navigator.mediaDevices.getSupportedConstraints();on.log("Supported Constraints :",Tt)}st.video!==void 0&&(st.video.height===void 0&&st.video.width===void 0||st.optional!==void 0&&(on.warn("contraints with both optional/mandatory and specific or advanced constraints usage : this may failed depending of browsers"),on.log("setGetUserMediaConfig : contraints modification to avoid both optional/mandatory and specific or advanced constraints usage"),st.optional.sourceId!==void 0&&(on.log("sourceId contraints modification to deviceId"),st.video.deviceId===void 0&&(st.video.deviceId={}),st.video.deviceId.ideal=st.optional.sourceId),delete st.optional)),on.log("this.gum_config :",this.gum_config),this.gum_config=st},this.getUserMedia=function(){try{this.gum_config=apiCC.setAudioSourceIdInConstraint(this.audioSourceId,this.gum_config),this.gum_config=apiCC.setVideoSourceIdInConstraint(this.videoSourceId,this.gum_config),this.lastUsedUserMediaConstraint=this.gum_config,nt.Xh==="IE"&&nt.dc>8?apiCC.getUserMediaWithCB(this.gum_config,this.callback(this,"onUserMediaSuccess"),this.callback(this,"onUserMediaError")):apiCC.getUserMedia(this.gum_config).then(this.callback(this,"onUserMediaSuccess")).catch(this.callback(this,"onUserMediaError"))}catch(st){on.error("getUserMedia() failed. Is this a WebRTC capable browser?"),on.log("getUserMedia failed with exception: "+st.message)}},this.onUserMediaSuccess=function(st){on.info("onUserMediaSuccess : User has granted access to local media."),this.accessToLocalMedia=!0;var Tt=!1,Rt="Unknown",Lt=!1,Et="Unknown";this.localStream=st,st.getAudioTracks().length>0&&(Tt=!0,st.getAudioTracks()[0].label&&(Rt=st.getAudioTracks()[0].label),on.log("Using audio device: "+Rt)),st.getVideoTracks().length>0&&(Lt=!0,st.getVideoTracks()[0].label&&(Et=st.getVideoTracks()[0].label),on.log("Using video device: "+Et)),this.myWebRTC_Event.createUserMediaSuccessEvent(!1,Tt,Rt,Lt,Et,"media",null,st,null,!1)},this.onUserMediaError=function(st){on.info("onUserMediaError : Failed to get access to local media. Error : ",st),on.error(st),this.accessToLocalMedia=!1,nt.$6!=="electron"&&(nt.Xh==="Chrome"||nt.Xh==="Mobile Chrome")&&nt.PR>47&&(on.log("browser_version > 47"),window.location.protocol!=="https:"&&on.error("HTTPS is now mandatory to use getUserMedia()")),this.myWebRTC_Event.createUserMediaErrorEvent(!1,"media",st,null,null,null,this.gum_config),st=null,apiCC.session.tryAudioCallAfterUserMediaError===!0?(on.log("this.lastUsedUserMediaConstraint :",this.lastUsedUserMediaConstraint),on.log("this.lastUsedUserMediaConstraint.video :",this.lastUsedUserMediaConstraint.video),this.lastUsedUserMediaConstraint.video!==!1?(on.log("this.lastUsedUserMediaConstraint.audio :",this.lastUsedUserMediaConstraint.audio),on.log("UserMediaError, Trying to getUserMedia with audioOnly"),this.videoSourceId=null,this.gum_config.video=!1,this.getUserMedia()):on.log("onUserMediaError without video")):on.log("try AudioCall after UserMediaError is not activated")},this.evalCallProfileWithSdp=function(st,Tt,Rt){return this.evalCallProfileWithSdpGuideline(this.mySDPManager.createGuideline(st),st,Tt,Rt)},this.evalCallProfileWithSdpGuideline=function(st,Tt,Rt,Lt){var Et={};return st.hasOwnProperty("audio")?(Et.audio=!0,Et.audioActive=Rt==="local"&&Lt==="send"?st.audio.direction==="sendrecv"||st.audio.direction==="sendonly":Rt==="local"&&Lt==="receive"||Rt==="remote"&&Lt==="send"?st.audio.direction==="sendrecv"||st.audio.direction==="recvonly":Rt==="remote"&&Lt==="receive"&&(st.audio.direction==="sendrecv"||st.audio.direction==="sendonly")):(Et.audio=!1,Et.audioActive=!1),st.hasOwnProperty("video")?(Et.video=!0,Et.videoActive=Rt==="local"&&Lt==="send"?st.video.direction==="sendrecv"||st.video.direction==="sendonly":Rt==="local"&&Lt==="receive"||Rt==="remote"&&Lt==="send"?st.video.direction==="sendrecv"||st.video.direction==="recvonly":Rt==="remote"&&Lt==="receive"&&(st.video.direction==="sendrecv"||st.video.direction==="sendonly")):(Et.video=!1,Et.videoActive=!1),Et},this.checkDestCallTypeWithSDP=function(st,Tt){on.debug("checkDestCallTypeWithSDP");var Rt=this.mySDPManager.createGuideline(st),Lt=!1,Et=!1;!Rt.audio||Rt.audio.direction!=="sendrecv"&&Rt.audio.direction!=="sendonly"||(Lt=!0),!Rt.video||Rt.video.direction!=="sendrecv"&&Rt.video.direction!=="sendonly"||(Et=!0),Tt.destCallType=Lt===!0?Et===!0?"media":"audio":Et===!0?"videoOnly":"inactive",on.debug("call.destCallType: "+Tt.destCallType),Tt.callee!==!0||Rt.audio&&Rt.audio.direction!=="sendonly"||Rt.video&&Rt.video.direction!=="sendonly"||(Tt.userMediaAccessRequired=!1,Tt.mediaTypeForOutgoingCall="NONE",on.debug("access to user media not required"))},this.evaluateVideoCap=function(st){delete st.videoCap,st.belongsToRoom()?st.settingUpType!=="publish"&&st.settingUpType!=="shareScreen"||st.localCallProfile&&st.localCallProfile.video&&st.localCallProfile.videoActive&&this.evalOutgoingVideoBandwithCap(st):(this.rtpSenderSetParamatersCapable||!st.callee)&&st.localCallProfile&&st.localCallProfile.video&&st.localCallProfile.videoActive&&this.evalOutgoingVideoBandwithCap(st)},this.processInvite=function(st){on.info("processInvite() - invite received from :"+st.callerId);var Tt,Rt=0,Lt=null,Et=null,jt=null,Pt=null,Vt=!1,Qt=null,rn=null,Jt=null,sn={};if(st.data!==void 0&&st.data.type==="publish"&&st.data.mesh!==void 0){if(on.info("received invite publish mesh; mesh: "+JSON.stringify(st.data.mesh)),(Lt=this.findCallWithCallIdAndInstanceId(st.data.mesh.callerCallId,st.data.instanceId))==null)return void on.error("cannot find call; callId: "+st.data.mesh.callerCallId);Lt.userMediaAccessRequired=!1,Lt.data.mesh=st.data.mesh,Lt.setupTimeoutId&&(clearTimeout(Lt.setupTimeoutId),delete Lt.setupTimeoutId),Vt=!0}else{if(st.data!==void 0&&st.data.type==="subscribe"&&st.data.mesh!==void 0){if(on.debug("received invite subscribe mesh; mesh: ",st.data.mesh),(Et=this.findUserMediaById(st.data.mesh.calleeCallId))!==null)if(this.MCUClient.distantCalls.push({early:!0,roomId:st.roomId,clientId:st.data.mesh.callerId,callId:st.data.mesh.callerCallId,callMode:"mesh",callDirection:"recvonly",callFeed:{clientId:st.data.mesh.calleeId,callId:st.data.mesh.calleeCallId}}),setTimeout((function(hn,wn,Mn){on.debug("early distant call descriptor timeout");for(var xn=this.MCUClient.distantCalls.length;--xn>=0;)if(this.MCUClient.distantCalls[xn].early&&this.MCUClient.distantCalls[xn].roomId===hn&&this.MCUClient.distantCalls[xn].clientId===wn&&this.MCUClient.distantCalls[xn].callId===Mn){on.debug("remove early distant call descriptor: timeout"),this.MCUClient.distantCalls.splice(xn,1);break}}).bind(this,st.roomId,st.data.callerId,st.data.callerCallId),3e4),Et.callType==="screenSharing"||Et.callType==="screenSharingWithAudio")sn.type="publish",sn.mesh=st.data.mesh,sn.instanceId=st.data.instanceId,this.MCUClient.publishScreen(st.roomId,sn,null,Et.captureSourceType);else{var mn=(0,at.ws)({},Et.callConfiguration);st.data.mediaType==="AUDIOONLY"?mn.audioOnly=!0:st.data.mediaType==="VIDEOONLY"&&(mn.videoOnly=!0),(jt=apiCC.getUserMediaStream(mn.userMediaStreamId))&&(jt.audioMuted&&jt.videoMuted?mn.muted="VIDEO":jt.audioMuted?mn.muted="AUDIOONLY":jt.videoMuted?mn.muted="VIDEOONLY":delete mn.muted),delete mn.distributedBroadcastEnabled,delete mn.simulcast,sn.type="publish",sn.mesh=st.data.mesh,sn.instanceId=st.data.instanceId,this.MCUClient.publish(st.roomId,null,null,mn,sn,null)}else on.debug("media not found: sending bye : Call_not_found"),new ht.S(apiCC.session.channel.socket).sendBye(st.callId,st.calleeId,st.roomId,st.callerId,"Call_not_found",st.data);return}if(st.data!==void 0&&st.data.type==="publish"&&st.data.mode==="passive"){if((Lt=this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.callerId,st.data.instanceId))==null)return void on.debug("cannot find call; callId: "+st.callId+", callerId: "+st.callerId+", instanceId: "+st.data.instanceId);Lt.userMediaAccessRequired=!1,Lt.setupTimeoutId&&(clearTimeout(Lt.setupTimeoutId),delete Lt.setupTimeoutId),Vt=!0}else(Lt=new vn(this)).callId=st.callId,Lt.instanceId=st.data.instanceId,Lt.callerId=st.callerId,Lt.calleeId=this.clientId,Lt.callee=!0,Lt.remoteId=st.callerId}if(Lt.dest_roomId=st.roomId,Lt.data!==void 0&&Vt===!0)for(Jt in st.data)st.data.hasOwnProperty(Jt)&&(Lt.data[Jt]=st.data[Jt]);else Lt.data=st.data;if(Lt.data.instanceId=Lt.instanceId,st.data!==void 0&&st.data.pubSub==="sipConnector"&&(Lt.trickleIce=!1,Lt.remoteType="sip"),Lt.checkDTLSCompliancy(),nt.Xh==="Edge"&&apiRTC.browserDetails.type!=="chrome"&&(Qt=apiCC.session.getConnectedUserInfo(st.callerId,"userData"),on.log("destUserInfo :",Qt),Qt!=="User_Not_Found"&&Qt!==void 0&&((rn=JSON.parse(Qt)).browser!=="Chrome"&&rn.browser!=="Mobile Chrome"||rn.osName!=="Android"||(on.log("Browser is Edge and caller is Chrome on Android, setting VP8 as prefered codec for the call"),Lt.preferVP8Codec=!0))),st.data!==void 0&&st.data.type==="publish"&&st.data.mode==="passive"&&st.stream!==void 0&&st.stream.id!==void 0&&(Lt.streamId=st.stream.id,on.log("call.streamId: "+Lt.streamId)),Rt=this.callsTable.length,on.log("processInvite() - Actual call Number is :"+Rt),st.callType==="screenSharing"||st.callType==="screenSharingWithAudio")Lt.screenSharing=!0,Lt.callType=st.callType;else if(st.callType!=="data"){if(this.allowMultipleCalls===!1){for(on.log("processInvite() - Refusing double call checking ..."),Tt=0;Tt0&&(Pt=apiCC.userMediaStreamTable[0].userMediaStreamId),this.accessToLocalMedia!==!0&&!Pt||this.autoAnswer!==!0?(Lt.audioOnly===!0&&apiCC.mediaDeviceMgr.audioDevicePresent===!1?(on.log("processInvite() - audio and video media are not transmitted"),Lt.onUserMediaSuccessTestUni()):this.userAcceptOnIncomingCallBeforeGetUserMedia===!0?on.log("Stand-by :: wait for getUserMediaOnCall && establishCall"):(on.debug("processInvite() - call.getUserMediaOnCall()"),on.log("processInvite() - this.autoAnswer :"+this.autoAnswer),Lt.getUserMediaOnCall()),Vt===!1&&this.myWebRTC_Event.createIncomingCallEvent(this.clientId,st.callerId,st.callerNickname,Lt.callId,!1,Rt,Lt.audioOnly,st.callType,!1,Lt.remoteType,Lt.destCallType)):(on.log("processInvite() :: User has already granted access to local media and AutoAnswer activated : establishing call"),this.userAcceptOnIncomingCall===!0||this.userAcceptOnIncomingCallBeforeGetUserMedia===!0?on.log("processInvite() - Waiting for call accept or refuse from user - 2"):Pt?(on.log("using First available stream on apiRTC"),(jt=apiCC.getUserMediaStream(Pt)).addCallInfo(Lt.callId),Lt.callConfiguration!==void 0&&Lt.callConfiguration!==null||(Lt.callConfiguration={}),Lt.callConfiguration.userMediaStreamId=jt.userMediaStreamId,Lt.onUserMediaSuccessOnCall(jt.stream)):Lt.establishCall(),Vt===!1&&this.myWebRTC_Event.createIncomingCallEvent(this.clientId,st.callerId,st.callerNickname,Lt.callId,!0,Rt,Lt.audioOnly,st.callType,!1,Lt.remoteType,Lt.destCallType)))},this.setRemoteDescriptionProcess=function(st,Tt){this.preferSendingH264Codec&&(on.log("Modification of SDP to set H264 as prefered sending codec"),Tt.sdp=this.mySDPManager.maybePreferCodec(Tt.sdp,"video","H264")),nt.Xh==="Chrome"&&nt.PR<55||nt.Xh==="Firefox"&&nt.PR<50||nt.Xh==="IE"?st.pc!==null?st.pc.setRemoteDescription(Tt,st.callback(st,"onSetRemoteDescriptionSuccess"),st.callback(st,"onSetRemoteDescriptionFailure")):on.debug("setRemoteDescriptionProcess - pc is null"):(on.log("before setRemoteDescription - Promise version"),st.pc!==null?st.pc.setRemoteDescription(Tt).then(st.callback(st,"onSetRemoteDescriptionSuccess")).catch(st.callback(st,"onSetRemoteDescriptionFailure")):on.debug("setRemoteDescriptionProcess - pc is null"))},this.process200OK=function(st){var Tt,Rt=null,Lt=null;if(st.data!==void 0&&st.data.instanceId!==void 0?(on.info("200OK received from callId :"+st.calleeId+", intanceId is :"+st.data.instanceId),Rt=this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.calleeId,st.data.instanceId)):(on.info("200OK received from callId :"+st.calleeId),Rt=this.findCallWithCallIdAndRemoteId(st.callId,st.calleeId)),Rt===null)return on.warn("200OK received but callId and instanceId are not matching, no process"),void this.myWebRTC_Event.createErrorEvent("200OK received but callId is not matching, no process","NOT_MATCHING_CALLID_ON_200OK");Rt.calleeId=st.calleeId,st.sdpanswer&&st.sdpanswer.type!=="no-answer"?Rt.message200OKReceived===!1?(on.debug("first 200OK for the call"),Rt.message200OKReceived=!0,Rt.data.type!=="subscribe"&&this.checkDestCallTypeWithSDP(st.sdpanswer.sdp,Rt),Tt=this.mySDPManager.createGuideline(st.sdpanswer.sdp),Rt.setLocalCallProfile(this.evalCallProfileWithSdpGuideline(Tt,st.sdpanswer.sdp,"remote","send")),Rt.setRemoteCallProfile(this.evalCallProfileWithSdpGuideline(Tt,st.sdpanswer.sdp,"remote","receive")),this.evaluateVideoCap(Rt),!this.rtpSenderSetParamatersCapable&&Rt.videoCap&&(Tt.video.bandwidth=Rt.videoCap,st.sdpanswer.sdp=Tt.generate()),Rt.receivedSdpOfferMessage=st.sdpanswer,on.log("process200OK : before setRemoteDescription"),Lt=new apiCC.myWebRTC_Adapter.RTCSessionDescription(st.sdpanswer),this.videoRemoteBandwidth&&(on.log("Modification of SDP to set remote video bandwidth"),Lt.sdp=this.mySDPManager.setVideoBandwidth(Lt.sdp,this.videoRemoteBandwidth)),this.setRemoteDescriptionProcess(Rt,Lt),st.data!==null&&st.data!==void 0&&(Rt.data!==null&&Rt.data!==void 0?Rt.data=(0,at.S6)(Rt.data,st.data):Rt.data=st.data)):on.debug("200OK has already been received for this call, leaving process200OK"):Hn.createCallEstablishedEvent(Rt.calleeId,Rt.callType,Rt.callId,Rt.destCallType)},this.cleanStoredCallCandidate=function(st,Tt){on.debug("cleanStoredCallCandidate from callId :"+st+", instanceId is :"+Tt),this.clientIncomingCandidatesQueue[st+"-"+Tt]!==void 0&&this.clientIncomingCandidatesQueue[st+"-"+Tt].length!==0&&(this.clientIncomingCandidatesQueue[st+"-"+Tt].splice(0,this.clientIncomingCandidatesQueue[st+"-"+Tt].length),delete this.clientIncomingCandidatesQueue[st+"-"+Tt])},this.processCandidate=function(st){var Tt=null,Rt=st.data&&st.data.instanceId?st.data.instanceId:null;on.debug("Candidate received from callId :"+st.callId+", instanceId is :"+Rt),Tt=st.callerId===this.clientId?Rt?this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.calleeId,Rt):this.findCallWithCallIdAndRemoteId(st.callId,st.calleeId):Rt?this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.callerId,Rt):this.findCallWithCallIdAndRemoteId(st.callId,st.callerId),on.trace("msg.label :"+st.label),on.log("msg.candidate :"+st.candidate),Tt!==null?Tt.started&&Tt.remoteDescriptionSetted?Tt.processCandidateMsg(st):(on.log("Call not started or remoteDescription is not yet setted"),Tt.incomingcandidatesQueue.push(st)):Rt&&(on.debug("Call not found, Candidate message is not handled, storing candidate message in client"),this.clientIncomingCandidatesQueue[st.callId+"-"+Rt]!==null&&this.clientIncomingCandidatesQueue[st.callId+"-"+Rt]!==void 0||(this.clientIncomingCandidatesQueue[st.callId+"-"+Rt]=[],on.debug("First candidate for this call, starting a timeout before candidate storage cleaning"),setTimeout(this.cleanStoredCallCandidate.bind(this),this.cleanStoredCallCandidateTimer,st.callId,Rt)),this.clientIncomingCandidatesQueue[st.callId+"-"+Rt].push(st))},this.processUpdate=function(st){on.info("Update message on:"+st.roomId);var Tt,Rt=null;if((Rt=st.callerId===this.clientId?this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.calleeId,st.data.instanceId):this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.callerId,st.data.instanceId))!==null)if(st.hasOwnProperty("sdpoffer")&&st.sdpoffer.hasOwnProperty("sdp"))Rt.setRemoteCallProfile(this.evalCallProfileWithSdp(st.sdpoffer.sdp,"remote","receive"),!0),Rt.updateOngoingTimeoutId=setTimeout(function(){delete Rt.updateOngoingTimeoutId},Bn),this.checkDestCallTypeWithSDP(st.sdpoffer.sdp,Rt),on.log("processUpdate : before setRemoteDescription"),Tt=new apiCC.myWebRTC_Adapter.RTCSessionDescription(st.sdpoffer),this.setRemoteDescriptionProcess(Rt,Tt),Rt.doUpdateAnswer();else if((0,at.ki)(st.data,"mesh","object")&&(st.data.mesh.calleeCompositeUserId?st.data.mesh.calleeCompositeUserId===this.compositeClientId:st.data.mesh.calleeId===this.clientId)){on.debug("mesh update from subscriber");var Lt={};st.data.mediaType==="AUDIOONLY"?Lt.audioOnly=!0:st.data.mediaType==="VIDEOONLY"&&(Lt.videoOnly=!0),this.updateCallConfigurationOnCall(st.callId,Lt).then(function(){on.debug("updateCallConfigurationOnCall OK")}).catch(function(Et){on.error("updateCallConfigurationOnCall failed",Et)})}else on.error("update without SDP offer");else this.myWebRTC_Event.createErrorEvent("Cannot find call to process Update","CALL_NOT_FOUND_ON_UPDATE")},this.process200Update=function(st){on.info("200 Update received from :"+st.calleeId);var Tt,Rt=null,Lt=null;if((Rt=st.callerId===this.clientId?this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.calleeId,st.data.instanceId):this.findCallWithCallIdAndRemoteIdAndInstanceId(st.callId,st.callerId,st.data.instanceId))===null)return on.info("Call not found on 200 Update"),void this.myWebRTC_Event.createErrorEvent("Cannot find call to process 200 Update","CALL_NOT_FOUND_ON_200UPDATE");Rt.calleeId=st.calleeId,Tt=this.mySDPManager.createGuideline(st.sdpanswer.sdp),Rt.setLocalCallProfile(this.evalCallProfileWithSdpGuideline(Tt,st.sdpanswer.sdp,"remote","send"),!0),Rt.setRemoteCallProfile(this.evalCallProfileWithSdpGuideline(Tt,st.sdpanswer.sdp,"remote","receive"),!0),this.evaluateVideoCap(Rt),!this.rtpSenderSetParamatersCapable&&Rt.videoCap&&(Tt.video.bandwidth=Rt.videoCap,st.sdpanswer.sdp=Tt.generate()),on.log("process200Update : before setRemoteDescription"),Lt=new apiCC.myWebRTC_Adapter.RTCSessionDescription(st.sdpanswer),this.videoBandwidth&&(on.log("Modification of SDP to set remote video bandwidth"),Lt.sdp=this.mySDPManager.setVideoBandwidth(Lt.sdp,this.videoBandwidth)),this.setRemoteDescriptionProcess(Rt,Lt),on.log("msg.sdpanswer.sdp :",st.sdpanswer.sdp),Rt.addingUserMedia===!0&&(Rt.addingUserMedia=!1),Rt.updateUserMedia===!0&&(Rt.updateUserMedia=!1),Rt.updateCause&&(Rt.updateCause=null)},this.processSlowLink=function(st,Tt){for(var Rt=this.callsTable.length,Lt=null;--Rt>=0;)if(this.callsTable[Rt].callId===st){Lt=this.callsTable[Rt];break}if(Lt!==null){var Et=null;Tt&&Tt.advice&&(Et=Tt.advice),this.myWebRTC_Event.createSlowLinkEvent(Lt.callId,Et)}},this.processAudioAmplitude=function(st,Tt){Hn.createAudioAmplitudeEvent(st.descriptor.audioAmplitude,Tt,st.callId,st.descriptor.streamID)},this.processDistantIceError=function(st){st.descriptor.iceState==="disconnected"?this.myWebRTC_Event.createErrorEvent("distant iceDisconnection detected","DISTANT_ICE_CONNECTION_STATE_DISCONNECTED",null,st.roomId,null,st.descriptor):st.descriptor.iceState==="failed"&&Hn.createErrorEvent("distant iceConnection failed detected","DISTANT_ICE_CONNECTION_STATE_FAILED",null,st.roomId,null,st.descriptor)},this.processStreamTrackMuteChanged=function(st,Tt,Rt){for(var Lt=this.callsTable.length,Et=null,jt=[],Pt={},Vt={};--Lt>=0;)if(this.callsTable[Lt].callId===st){Et=this.callsTable[Lt];break}Et!==null&&(Tt==="audio"?(Et.isRemoteAudioMuted=Rt,jt.push("audioIsMuted"),Pt.available=Et.remoteCallProfile.audio,Pt.active=Et.remoteCallProfile.audioActive,Pt.muted=Et.isRemoteAudioMuted,Pt.silent=Et.isRemoteAudioSilent,Vt.available=Et.remoteCallProfile.video,Vt.active=Et.remoteCallProfile.videoActive,Vt.muted=Et.isRemoteVideoMuted,Vt.silent=Et.isRemoteVideoSilent):Tt==="video"&&(Et.isRemoteVideoMuted=Rt,jt.push("videoIsMuted"),Pt.available=Et.remoteCallProfile.audio,Pt.active=Et.remoteCallProfile.audioActive,Pt.muted=Et.isRemoteAudioMuted,Pt.silent=Et.isRemoteAudioSilent,Vt.available=Et.remoteCallProfile.video,Vt.active=Et.remoteCallProfile.videoActive,Vt.muted=Et.isRemoteVideoMuted,Vt.silent=Et.isRemoteVideoSilent),jt.length>0&&this.myWebRTC_Event.createRemoteStreamUpdatedEvent(jt,Pt,Vt,Et.destCallType,Et.callId,"userAction"))},this.processStreamTrackStatusChanged=function(st,Tt,Rt){for(var Lt=this.callsTable.length,Et=null,jt=[],Pt={},Vt={};--Lt>=0;)if(this.callsTable[Lt].callId===st){Et=this.callsTable[Lt];break}Et!==null&&(Tt==="audio"?(Et.isRemoteAudioSilent=Rt,jt.push("audioIsSilent"),Pt.available=Et.remoteCallProfile.audio,Pt.active=Et.remoteCallProfile.audioActive,Pt.muted=Et.isRemoteAudioMuted,Pt.silent=Et.isRemoteAudioSilent,Vt.available=Et.remoteCallProfile.video,Vt.active=Et.remoteCallProfile.videoActive,Vt.muted=Et.isRemoteVideoMuted,Vt.silent=Et.isRemoteVideoSilent):Tt==="video"&&(Et.isRemoteVideoSilent=Rt,jt.push("videoIsSilent"),Pt.available=Et.remoteCallProfile.audio,Pt.active=Et.remoteCallProfile.audioActive,Pt.muted=Et.isRemoteAudioMuted,Pt.silent=Et.isRemoteAudioSilent,Vt.available=Et.remoteCallProfile.video,Vt.active=Et.remoteCallProfile.videoActive,Vt.muted=Et.isRemoteVideoMuted,Vt.silent=Et.isRemoteVideoSilent),jt.length>0&&this.myWebRTC_Event.createRemoteStreamUpdatedEvent(jt,Pt,Vt,Et.destCallType,Et.callId,"userAction"))},this.processUpdateStream=function(st,Tt,Rt){for(var Lt=this.callsTable.length,Et=null;--Lt>=0;)if((0,at.ki)(this.callsTable[Lt].data,"mesh","object")&&this.callsTable[Lt].data.mesh.calleeCallId===st||this.callsTable[Lt].callId===st){Et=this.callsTable[Lt];break}if(!Et)return!1;var jt=!1;return Tt==="audio"?Rt==="inactive"?Et.callType==="media"&&(Et.callType="videoOnly",Et.updateUserMedia=!0,Et.updateCause="adaptation",Et.audioSdpDirection="inactive",Et.establishCall(),jt=!0):Et.callType==="videoOnly"&&(Et.callType="media",Et.updateUserMedia=!0,Et.updateCause="adaptation",Et.audioSdpDirection=null,Et.establishCall(),jt=!0):Tt==="video"&&(Rt==="inactive"?Et.callType==="media"&&(this.evalOutgoingVideoBandwithCap(Et),Et.callType="audio",Et.updateUserMedia=!0,Et.updateCause="adaptation",Et.videoSdpDirection="inactive",Et.establishCall(),jt=!0):Et.callType==="audio"&&(this.evalOutgoingVideoBandwithCap(Et),Et.callType="media",Et.updateUserMedia=!0,Et.updateCause="adaptation",Et.videoSdpDirection=null,Et.establishCall(),jt=!0)),jt},this.processUpdateVideoQuality=function(st,Tt){on.debug("processUpdateVideoQuality",st,Tt);var Rt=this.findCallWithCallId(st);if(Rt)if(Rt.sessionMCU&&Rt.sessionMCU.roomMode!=="mesh"){var Lt=apiCC.getUserMediaStream(Rt.callConfiguration.userMediaStreamId);if(Lt){var Et=Lt.getVideoTrack();if(Et){var jt={};Tt.width&&Tt.height&&(jt.width=Tt.width,jt.height=Tt.height),Tt.frameRate&&(jt.frameRate=Tt.frameRate),Et.applyConstraints(jt).then(function(Pt){on.debug("processUpdateVideoQuality - applyConstraints; OK")}).catch(function(Pt){on.error("processUpdateVideoQuality - applyConstraints",Pt)})}else on.warn("processUpdateVideoQuality - no such video track; callId:",st)}else on.warn("processUpdateVideoQuality - no such userMediaStream; callId:",st)}else on.warn("processUpdateVideoQuality - wrong roomMode; callId:",st);else on.warn("processUpdateVideoQuality - no such call; callId:",st)},this.removeAllCallsFromRoom=function(st,Tt){on.info("removeAllCallsFromRoom :"+st+" with reason :"+Tt);var Rt,Lt,Et=this.callsTable.length,jt=[],Pt={};for(Rt=0;Rt=0;)(0,at.Ym)(this.callsTable[jt].data,"object")&&(0,at.Ym)(this.callsTable[jt].data.mesh,"object")&&this.callsTable[jt].data.mesh.calleeCallId===st&&Pt.push(this.callsTable[jt].callId);for(jt=Pt.length;--jt>=0;)this.removeCallFromTableWithCallIdAndSendBye(Pt[jt],Tt);this.MCUClient.meshOnHangup(st,null,{restart:Vt})}else(Rt=this.findCallWithCallId(st))!==null&&(this.MCUClient.pubConnector!=="janusConnector"||Tt!=="RTC_Setup_Timeout"&&Tt!=="disconnected"||(Rt.settingUpType==="publish"||Rt.settingUpType==="shareScreen"?Rt.data&&Rt.data.mesh||(Vt=!0,Rt.streamStolen=!0):Rt.settingUpType==="subscribe"&&(Vt=!0)),on.log("Leaving call with callId :"+st),this.removeCallFromTableWithCallIdAndSendBye(st,Tt));Vt===!0?Rt!==null?this.restartCall(Rt):Lt&&(Qt===!0?this.restartCall(Lt,{userMedia:!0,mesh:!0}):this.restartCall(Lt,{userMedia:!0,stream:rn})):(Rt&&Rt.callControl&&this.destroyCallControl(Rt.callControl),this.stopMaxCallRetriesTimer(st),this.stopRestartCallTimer(st),delete this.callsRetriesTable[st])},this.stopStream=function(st){on.info("stopStream in client");var Tt,Rt=null;if(nt.Xh==="Chrome"&&nt.PR<45||nt.Xh==="Firefox"&&nt.PR<44||nt.Xh==="Opera"&&nt.PR<34||nt.Xh==="Chromium"&&nt.PR<44||nt.Xh==="Chrome WebView"&&nt.PR<45)st.onended=null,st.stop();else{for(st.onended=null,on.log("MediaStream.stop is now deprecated, using MediaStreamTrack.stop"),Rt=st.getTracks(),Tt=0;Tt0&&(an=!0),(wn=Jt.getCallInfo(rn.userMediaId))&&(wn.flavor="call")):rn.sessionMCU!==null&&rn.sessionMCU.roomMode==="mesh"?(sn=!0,mn=!0,hn=Jt.stream,rn.streamStolen=!0):(sn=!0,hn=Jt.stream,rn.streamStolen=!0,(wn=Jt.getCallInfo(rn.userMediaId))&&(wn.flavor="call")))):on.debug("No call and no userMedia found");else(Qt=jt==null?this.findCallWithCallId(st):this.findCallWithCallIdAndInstanceId(st,jt.instanceId))?(Qt.setupTimeoutId&&(clearTimeout(Qt.setupTimeoutId),delete Qt.setupTimeoutId),Qt.settingUpType==="subscribe"&&Lt!=="Ejected"&&(sn=!0)):(rn=this.findUserMediaById(st))&&rn.close();if(!an)if(rn!==null){var Mn=null,xn=[];for(Mn=this.callsTable.length;--Mn>=0;)(0,at.ki)(this.callsTable[Mn].data,"mesh","object")&&this.callsTable[Mn].data.mesh.calleeCallId===st&&this.callsTable[Mn].settingUpType!=="subscribe"&&xn.push(this.callsTable[Mn].callId);for(Mn=xn.length;--Mn>=0;)this.removeCallFromTableWithCallIdAndSendBye(xn[Mn],Lt);if(this.MCUClient.meshOnHangup(st),rn.sessionMCU.modeChangeKind==="old"){var En=this.MCUClient.getSessionMCU(null,{callback:function(kn){return kn.roomName===rn.sessionMCU.roomName&&kn.modeChangeKind==="new"}});En&&this.finalizeMeshToJanusTransition(rn.sessionMCU,En)}}else st!==void 0?Vt=jt==null?this.removeCallFromTableWithCallIdandRemoteId(st,Tt,Lt):this.removeCallFromTableWithCallIdandInstanceId(st,jt.instanceId,Lt):Et!==void 0&&(Vt=this.removeCallFromTableWithConfIdandRemoteId(Et,Tt,Lt));on.log("Reason : "+Lt),Qt&&sn!==!0?this.callsTable.length===0&&this.userMediaTable.length===0?(on.log("No more established calls for client"),this.myWebRTC_Event.createRemoteHangupEvent(this.clientId,Tt,!0,Lt),this.myWebRTC_Event.createHangupEvent("remote",this.clientId,Tt,!0,Lt,st,Vt),this.getUserMediaOnGoing===!0&&qt.deactivateReloadOnCancel!==!0&&(on.log("Cancel from Remote"),typeof apiRTC_React>"u"&&location.reload(),this.getUserMediaOnGoing=!1)):(on.log("Other calls are still established"),this.myWebRTC_Event.createRemoteHangupEvent(this.clientId,Tt,!1,Lt),this.myWebRTC_Event.createHangupEvent("remote",this.clientId,Tt,!1,Lt,st,Vt)):Qt&&Qt.settingUpType==="subscribe"&&(this.myWebRTC_Event.createRemoteHangupEvent(this.clientId,Tt,!1,"restarted"),this.myWebRTC_Event.createHangupEvent("remote",this.clientId,Tt,!1,"restarted",st,Vt)),jt!=null&&(this.MCUClient.pubConnector==="janusConnector"||jt.MCUType!=="MCU-Caller"&&jt.MCUType!=="MCU-Callee"||this.myWebRTC_Event.createRecordedStreamsAvailableEvent(Et,this.clientId,Tt,st)),sn===!0?Qt!==null?this.restartCall(Qt):rn&&(mn===!0?this.restartCall(rn,{userMedia:!0,mesh:!0}):this.randomDelayOnRestart?(on.debug("onRemoteHangup - randomDelayOnRestart"),setTimeout(function(){Pt.restartCall(rn,{userMedia:!0,stream:hn})},5e3*Math.random())):this.restartCall(rn,{userMedia:!0,stream:hn})):(Qt&&Qt.callControl&&this.destroyCallControl(Qt.callControl),(Qt||rn)&&(this.stopMaxCallRetriesTimer(st),this.stopRestartCallTimer(st),delete this.callsRetriesTable[st]))},this.startMaxCallRetriesTimer=function(st){var Tt=this;on.debug("startMaxCallRetriesTimer for callIdWhenStartingTimer :",st);var Rt=setTimeout(function(){on.debug("[restartCall] MaxCallRetriesTimer reached for callIdWhenStartingTimer :",st),Tt.callsRetriesTable[st].allowedStatus=!1,delete Tt.callsRetriesTable[st].maxCallsRetriesDurationTimeOutId},this.maxCallsRetriesDuration);this.callsRetriesTable[st]={},this.callsRetriesTable[st].maxCallsRetriesDurationTimeOutId=Rt},this.stopMaxCallRetriesTimer=function(st){on.debug("stopMaxCallRetriesTimer for callId :",st),this.callsRetriesTable[st]!==void 0&&this.callsRetriesTable[st].maxCallsRetriesDurationTimeOutId!==void 0&&(clearTimeout(this.callsRetriesTable[st].maxCallsRetriesDurationTimeOutId),on.debug("[restartCall] MaxCallRetriesTimer cleared for callId :",st),delete this.callsRetriesTable[st])},this.stopRestartCallTimer=function(st){on.debug("stopRestartCallTimer for callId :",st),this.callsRetriesTable[st]!==void 0&&this.callsRetriesTable[st].restartCallTimeOutId!==void 0&&(clearTimeout(this.callsRetriesTable[st].restartCallTimeOutId),on.error("[restartCall] RestartCallTimer cleared for callId :",st),delete this.callsRetriesTable[st].restartCallTimeOutId)},this.restartCall=function(st){var Tt=this,Rt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};on.debug("[restartCall] restartCall for callId :",st.callId);var Lt=-1;if(Rt.userMedia!==!0)if(st.callControl&&st.callControl.autoRestart)if((Lt=st.callControl.autoRestart.counter)===0&&(st.callControl.autoRestart.callIdWhenStartingTimer=st.callId,this.startMaxCallRetriesTimer(st.callId)),this.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer]!==void 0&&this.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer].allowedStatus===void 0){on.debug("[restartCall] ... for callIdWhenStartingTimer :",st.callControl.autoRestart.callIdWhenStartingTimer),on.debug("AutoRestartCounter :",Lt),on.debug("Calling restartCallProcess in :",this.restartCallDelay*Math.pow(2,Lt));var Et=setTimeout(function(){on.debug("Timer reached for restartCall"),delete st.callControl.autoRestart.pending,Tt.restartCallProcess(st,Rt),Tt.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer]!==void 0&&Tt.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer].restartCallTimeOutId!==void 0&&delete Tt.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer].restartCallTimeOutId},this.restartCallDelay*Math.pow(2,Lt));st.callControl.autoRestart.pending=!0,this.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer].restartCallTimeOutId=Et}else on.warn("CALL_ABORTED, retries not allowed (maxCallsRetriesDuration reached) for callIdWhenStartingTimer :",st.callControl.autoRestart.callIdWhenStartingTimer),this.destroyCallControl(st.callControl),Hn.createErrorEvent("call aborted after calls retries (maxCallsRetriesDuration reached)","CALL_ABORTED",st.callId,st.callControl.roomName),this.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer]!==void 0&&delete this.callsRetriesTable[st.callControl.autoRestart.callIdWhenStartingTimer];else on.debug("[restartCall] autoRestart options not defined");else this.restartCallProcess(st,Rt)},this.restartCallProcess=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};on.debug("restartCallProcess ");var Rt=!1,Lt=!1,Et=null;if(st.restarting!==!0){if(st.restarting=!0,Tt.userMedia===!0&&(Rt=!0),Tt.mesh===!0&&(Lt=!0),Rt===!0)if(Lt===!0)st.callType==="screenSharing"||st.callType==="screenSharingWithAudio"?(st.restarting=!1,this.userMediaTable.push(st),this.MCUClient.meshOnScreenMediaSuccess(st)):(st.restarting=!1,this.userMediaTable.push(st),this.MCUClient.meshOnUserMediaSuccess(st));else if(st.callType==="screenSharing"||st.callType==="screenSharingWithAudio"){delete st.data.meshPublish,st.data.type="publish";var jt=this.createCallControl({type:"shareScreen",callId:st.userMediaId,roomName:st.roomId,callConfiguration:st.callConfiguration,data:st.data});jt.captureSourceType=st.captureSourceType,jt.autoRestart.counter=0,jt.autoRestart.stream=Tt.stream,this.shareScreen(st.roomId,st.data,st.captureSourceType,st.callConfiguration,{callControl:jt}),this.myWebRTC_Event.createCallRestartingEvent(st.callType,st.audioOnly,st.userMediaId,st.userMediaId,"publish",this.clientId,st.roomId,st.roomId,null)}else{delete st.data.meshPublish;var Pt=this.createCallControl({type:"publish",callId:st.userMediaId,callType:st.callType,roomName:st.roomId,callConfiguration:st.callConfiguration,data:st.data});Pt.audioOnly=st.callType==="audio",Pt.sessionId=st.sessionId,Pt.token=st.token,Pt.autoRestart.counter=0,Pt.autoRestart.stream=Tt.stream,this.MCUClient.publish(st.roomId,st.sessionId,st.token,st.callConfiguration,st.data,{callControl:Pt}),this.myWebRTC_Event.createCallRestartingEvent(st.callType,st.callType==="audio",st.userMediaId,st.userMediaId,"publish",this.clientId,st.roomId,st.roomId,null)}else if(st.settingUpType==="publish")(0,at.Ym)(st.callControl,"object")?(on.debug("[restartCall] restarting call publish"),this.MCUClient.publish(st.callControl.roomName,st.callControl.sessionId,st.callControl.token,st.callControl.callConfiguration,st.callControl.data,{callControl:st.callControl}),this.myWebRTC_Event.createCallRestartingEvent(st.callType,st.audioOnly,st.callId,st.callId,"publish",this.clientId,st.callControl.roomName,st.callControl.roomName,null)):on.warn("[restartCall] cannot auto restart; missing info");else if(st.settingUpType==="shareScreen")(0,at.Ym)(st.callControl,"object")?(on.debug("[restartCall] restarting call shareScreen"),this.shareScreen(st.callControl.roomName,st.callControl.data,st.callControl.captureSourceType,st.callControl.callConfiguration,{callControl:st.callControl}),this.myWebRTC_Event.createCallRestartingEvent(st.callType,st.audioOnly,st.callId,st.callId,"publish",this.clientId,st.callControl.roomName,st.callControl.roomName,null)):on.warn("[restartCall] cannot auto restart; missing info");else if(st.settingUpType==="subscribe"&&(on.debug("[restartCall] restarting call subscribe"),Et=st.mcuRemoteStream.replay===!0?this.MCUClient.getStreamOfUserCall(st.mcuRemoteStream.attributes.callerId,st.mcuRemoteStream.attributes.callId,{replay:!0}):this.MCUClient.getStreamOfUserCall(st.mcuRemoteStream.attributes.callerId,st.mcuRemoteStream.attributes.callId),(0,at.Ym)(st.callControl,"object")&&Et)){on.debug("[restartCall] stream exists, subscribing to it");var Vt=!!st.callControl.autoRestart.force;delete st.callControl.autoRestart.force;var Qt=st.callControl.callId,rn=this.MCUClient.subscribeToStreams([Et],st.callControl.mediaType,st.callControl.data,st.callControl.callConfiguration,{noStreamCheck:!0,autoSub:!0,force:Vt});Qt&&rn[0]&&this.myWebRTC_Event.createCallRestartingEvent(st.callType,st.audioOnly,Qt,rn[0],"subscribe",this.clientId,st.callControl.roomName,st.callControl.roomName,Et.id)}}else on.debug("[restartCall] call already restarting")},this.closingCallProcess=function(st,Tt){on.log("Session terminated.");var Rt=null;(0,at.ki)(this.callsTable[st].sessionMCU,"roomName","string")&&(0,at.ki)(this.callsTable[st].data,"MCUType","string")&&(this.callsTable[st].data.MCUType==="MCU-Caller"||this.callsTable[st].data.MCUType==="MCU-Callee")&&this.MCUClient.leaveSession(this.callsTable[st].sessionMCU.roomName),this.callsTable[st].callConfiguration&&this.callsTable[st].callConfiguration.userMediaStreamId&&this.callsTable[st].streamStolen!==!0&&(Rt=apiCC.getUserMediaStream(this.callsTable[st].callConfiguration.userMediaStreamId))&&apiCC.releaseUserMediaStream(Rt.userMediaStreamId,this.callsTable[st].callId),this.callsTable[st].screenStream!==null&&(on.log("stopping screenStream"),this.stopStream(this.callsTable[st].screenStream),Hn.createUserMediaStopEvent(this.callsTable[st].callId,"screen")),this.callsTable[st].pc!==null&&(on.log("Closing PC"),this.qosEnable&&this.callsTable[st].qm!==void 0&&this.callsTable[st].qm!==null&&typeof this.callsTable[st].qm.saveStatsToDb=="function"&&(this.callsTable[st].qm.saveStatsToDb(!0),clearInterval(this.callsTable[st].statisticId)),this.callsTable[st].csmIntervalId&&clearInterval(this.callsTable[st].csmIntervalId),this.callsTable[st].beginTimeoutId&&(clearTimeout(this.callsTable[st].beginTimeoutId),delete this.callsTable[st].beginTimeoutId),this.callsTable[st].dcfs?Tt==="Ice_failed"?this.callsTable[st].dcfs.failure="iceFailed":this.callsTable[st].dcfs.canceled=!0:this.callsTable[st].callType==="data"&&this.callsTable[st].calleeId==="dataChannelConnector"&&(this.callsTable[st].failure||this.callsTable[st].success||setTimeout(function(Lt,Et){Hn.createEvent({eventType:"onFileSended",callId:Lt.callId,remoteId:Lt.remoteId,name:Lt.data.filename,error:Et}),Lt.callbacks&&Lt.callbacks.failure&&Lt.callbacks.failure(Et)},0,this.callsTable[st],Tt==="Ice_failed"?"iceFailed":"canceled")),this.callsTable[st].pc.close(),this.callsTable[st].pc=null)},this.removeCallProcess=function(st){var Tt=this,Rt=this.callsTable[st];this.clearCallTimeouts(Rt),Rt.incomingcandidatesQueue.length!==0&&Rt.incomingcandidatesQueue.splice(0,Rt.incomingcandidatesQueue.length),this.clientIncomingCandidatesQueue[Rt.callId+"-"+Rt.instanceId]!==void 0&&this.clientIncomingCandidatesQueue[Rt.callId+"-"+Rt.instanceId].length!==0&&this.clientIncomingCandidatesQueue[Rt.callId+"-"+Rt.instanceId].splice(0,this.clientIncomingCandidatesQueue[Rt.callId+"-"+Rt.instanceId].length),on.log("Removing call from table"),this.callsTable.splice(st,1),on.log("this.callsTable.length :",this.callsTable.length),on.log("Call is terminated"),setTimeout(function(){Tt.startNextPushData()}),this.evalOutgoingVideoBandwithCap()},this.removeCallFromTableWithCallIdAndSendBye=function(st,Tt){on.debug("removeCallFromTableWithCallIdAndSendBye()",st);var Rt,Lt=null;if((Rt=this.findCallIndexWithCallId(st))!==-1){if(this.closingCallProcess(Rt,Tt),this.callsTable[Rt].callId,this.callsTable[Rt].calleeId,this.callsTable[Rt].callee?(Lt=this.callsTable[Rt].callerId,Tt===null&&(Tt="Hangup_From_Callee")):(Lt=this.callsTable[Rt].calleeId,Tt===null&&(Tt="Hangup_From_Caller")),on.log("reason is :"+Tt),this.callsTable[Rt].calleeId!=="LOCAL"&&apiCC.session!==null){var Et=apiCC.session.getConnectedUserInfo(this.callsTable[Rt].calleeId,"userData"),jt=null;if(Et!=="User_Not_Found")try{jt=JSON.parse(Et)}catch{on.error("userInfo parse fail",Et)}jt!=null&&jt.isSimulated==="true"?apiCC.session.channel.socket.emit("simulatedAgentCancelCallRequest",{number:this.callsTable[Rt].calleeId,callId:st}):this.callsTable[Rt].myWebRTC_Stack.sendBye(this.callsTable[Rt].callId,this.clientId,this.callsTable[Rt].dest_roomId,Lt,Tt,this.callsTable[Rt].data)}Tt!=="Broken_by_MCU"&&this.myWebRTC_Event.createHangupEvent("local",this.clientId,this.callsTable[Rt].remoteId,!0,Tt,this.callsTable[Rt].callId,this.callsTable[Rt].callType),this.callsTable[Rt].data!==void 0&&this.callsTable[Rt].data!==null&&(this.callsTable[Rt].data.pubSub==="janusConnector"||this.callsTable[Rt].data.MCUType!=="MCU-Caller"&&this.callsTable[Rt].data.MCUType!=="MCU-Callee"||this.myWebRTC_Event.createRecordedStreamsAvailableEvent(this.callsTable[Rt].data.confId,this.callsTable[Rt].callerId,this.callsTable[Rt].calleeId,this.callsTable[Rt].callId)),this.removeCallProcess(Rt)}else on.log("No call removed");this.MCUClient.publishCallId===st&&(this.publishCallId=null)},this.removeCall=function(st){on.info("removeCall");var Tt=null;return st!==-1?(this.closingCallProcess(st,null),this.callsTable[st].disconnectionWarningTimeout!==0&&(on.debug("clearing disconnectionWarningTimeout"),clearTimeout(this.callsTable[st].disconnectionWarningTimeout),this.callsTable[st].disconnectionWarningTimeout=0),Tt=this.callsTable[st].callType,this.removeCallProcess(st)):on.debug("No call removed"),Tt},this.removeCallFromTableWithConfIdandRemoteId=function(st,Tt,Rt){var Lt;return on.debug("removeCallFromTableWithConfIdandRemoteId() with reason :"+Rt),Rt=null,Lt=this.findCallIndexWithConfIdAndRemoteId(st,Tt),this.removeCall(Lt)},this.removeCallFromTableWithCallIdandRemoteId=function(st,Tt,Rt){var Lt;return on.debug("removeCallFromTableWithCallIdandRemoteId() with reason :"+Rt),on.log("callId :"+st),on.log("remoteId :"+Tt),Rt=null,Lt=this.findCallIndexWithCallIdAndRemoteId(st,Tt),this.removeCall(Lt)},this.removeCallFromTableWithCallIdandInstanceId=function(st,Tt,Rt){var Lt;return on.debug("removeCallFromTableWithCallIdandInstanceId() with reason :"+Rt),on.log("callId :"+st),on.log("instanceId :"+Tt),Rt=null,Lt=this.findCallIndexWithCallIdAndInstanceId(st,Tt),this.removeCall(Lt)},this.toggleVideoMute=function(st){on.debug("toggleVideoMute");var Tt,Rt,Lt=this.callsTable.length,Et=null,jt=null;if(st==null){for(on.debug("no callId defined, toggleVideoMute all local video"),this.isVideoMuted?this.localStream!==null&&(on.debug("localStream unMuteTracks"),this.unMuteTracks(this.localStream.getVideoTracks())):this.localStream!==null&&(on.debug("localStream muteTracks"),this.muteTracks(this.localStream.getVideoTracks())),this.isVideoMuted=!this.isVideoMuted,Tt=0;Tt=0?(this.callsTable[Rt].callConfiguration&&(jt=apiCC.getUserMediaStream(this.callsTable[Rt].callConfiguration.userMediaStreamId)),jt?(jt.videoMuted?jt.unMuteVideoOnStreams("enabled"):jt.muteVideoOnStreams("enabled"),{muteState:jt.videoMuted,callId:st}):this.callsTable[Rt].callLocalStream!==null?(this.callsTable[Rt].isLocalVideoMuted?(on.debug("unmuting call :",this.callsTable[Rt].callId),this.unMuteTracks(this.callsTable[Rt].callLocalStream.getVideoTracks())):(on.debug("muting call :",this.callsTable[Rt].callId),this.muteTracks(this.callsTable[Rt].callLocalStream.getVideoTracks())),this.callsTable[Rt].isLocalVideoMuted=!this.callsTable[Rt].isLocalVideoMuted,{muteState:this.callsTable[Rt].isLocalVideoMuted,callId:st}):{muteState:"STREAM_NOT_FOUND",callId:st}):(Et=this.findUserMediaById(st))&&(Et.callConfiguration&&(jt=apiCC.getUserMediaStream(Et.callConfiguration.userMediaStreamId)),jt)?(jt.videoMuted?jt.unMuteVideoOnStreams("enabled"):jt.muteVideoOnStreams("enabled"),{muteState:jt.videoMuted,callId:st}):{muteState:"CALL_NOT_FOUND",callId:st}},this.unMuteTracks=function(st){var Tt;if(st.length!==0){for(Tt=0;Tt=0?(this.callsTable[Rt].callConfiguration&&(jt=apiCC.getUserMediaStream(this.callsTable[Rt].callConfiguration.userMediaStreamId)),jt?(jt.audioMuted?jt.unMuteAudioOnStreams("enabled"):jt.muteAudioOnStreams("enabled"),{muteState:jt.audioMuted,callId:st}):this.callsTable[Rt].callLocalStream!==null?(this.callsTable[Rt].isLocalAudioMuted?(on.debug("unmuting call :",this.callsTable[Rt].callId),this.unMuteTracks(this.callsTable[Rt].callLocalStream.getAudioTracks())):(on.debug("muting call :",this.callsTable[Rt].callId),this.muteTracks(this.callsTable[Rt].callLocalStream.getAudioTracks())),this.callsTable[Rt].isLocalAudioMuted=!this.callsTable[Rt].isLocalAudioMuted,{muteState:this.callsTable[Rt].isLocalAudioMuted,callId:st}):{muteState:"STREAM_NOT_FOUND",callId:st}):(Et=this.findUserMediaById(st))&&(Et.callConfiguration&&(jt=apiCC.getUserMediaStream(Et.callConfiguration.userMediaStreamId)),jt)?(jt.audioMuted?jt.unMuteAudioOnStreams("enabled"):jt.muteAudioOnStreams("enabled"),{muteState:jt.audioMuted,callId:st}):{muteState:"CALL_NOT_FOUND",callId:st}},this.sendDTMF=function(st,Tt,Rt,Lt){on.debug("sendDTMF");var Et=0;st!=null?(on.debug("callId is defined :",st),Et=this.findCallIndexWithCallId(st),on.debug("index :",Et),Et>=0&&(on.debug("index :",Et),this.callsTable[Et].sendTones(Tt,Rt,Lt))):on.debug("no callId defined, leaving sendDTMF")},this.xhr=function(st,Tt,Rt,Lt,Et){var jt=new XMLHttpRequest;jt.onreadystatechange=function(){jt.readyState===4&&jt.status===200&&Rt(jt.responseText)},Lt!==void 0&&(jt.upload.onprogress=Lt),jt.open("POST",st),Et!=null&&jt.setRequestHeader("Authorization","Bearer "+Et),jt.send(Tt)},this.takeSnapshot=function(st,Tt,Rt,Lt,Et,jt,Pt){var Vt=arguments.length>7&&arguments[7]!==void 0?arguments[7]:{};on.info("takeSnapshot");var Qt,rn=null,Jt=null,sn=document.createElement("canvas"),mn=null,an=null,hn=new Date,wn=hn.toJSON(),Mn=wn.replace(new RegExp(":","g"),"-"),xn=null,En=Vt.token;switch(Lt){case"Desactivated":Qt=0;break;case"Low":Qt=2;break;case"Medium":Qt=4;break;case"High":Qt=6;break;default:on.log("blurLevel not defined switch case : "+Lt),Qt=0}return Pt===void 0?(on.warn("ApiRTC DEPRECATED : Please add videoId for TakeSnapshot"),on.log("Leaving takeSnapshot"),void this.myWebRTC_Event.createErrorEvent("Deprecated - localVideo Div Name is not correct for takeSnapshot","INCORRECT_VIDEOID_FOR_SNAPSHOT")):(on.log("takeSnapshot of defined video Id :"+Pt),(xn=document.getElementById(Pt))===null?(on.log("Cannot find video with Id :"+Pt),on.log("Leaving takeSnapshot"),void this.myWebRTC_Event.createErrorEvent("localVideo Div Name is not correct for takeSnapshot","INCORRECT_VIDEOID_FOR_SNAPSHOT")):(sn.width=xn.videoWidth,sn.height=xn.videoHeight,Vt.hasOwnProperty("width")&&(on.debug("options.width is set :"+Vt.width),sn.width=Vt.width),Vt.hasOwnProperty("height")&&(on.debug("options.height is set :"+Vt.height),sn.height=Vt.height),on.log("snapshot.width : "+sn.width),on.log("snapshot.height :"+sn.height),(rn=sn.getContext("2d")).drawImage(xn,0,0,sn.width,sn.height),(Jt=document.createElement("img")).src=sn.toDataURL("image/png"),Jt.style.padding=5,Jt.width=sn.width,Jt.height=sn.height,Qt!==0?(on.log("Adding Blur on Photo"),mn=rn.getImageData(0,0,sn.width,sn.height),on.log("av pixels data : "+mn.data),mn=kt(Jt,mn,Qt),on.log("ap pixels data : "+mn.data),rn.putImageData(mn,0,0),Jt.src=sn.toDataURL("image/png")):on.log("blur on photo is desactivated"),Zn(Tt)==="object"?Tt!==null?Tt.src=Jt.src:on.log("localPhotoIdOrDiv is null"):document.getElementById(Tt)!==null?document.getElementById(Tt).src=Jt.src:on.log("localPhotoId is not defined"),an=new FormData,Et!==void 0?(on.log("sessionId !== undefined :"+Et),an.append("destFileName",this.clientId+"-"+Mn+".png"),an.append("data",sn.toDataURL("image/png")),an.append("sessionId",Et)):(on.log("Upload on data1"),an.append("photo",sn.toDataURL("image/png")),an.append("clientId",this.clientId),an.append("apiKey",apiCC.session.apiKey)),void this.xhr(st,an,function(kn){if(on.log("fileName :",kn),kn!==null)try{var Vn=JSON.parse(kn);Vn.resultCode==="OK"&&(on.log("files loaded, filename :"+Vn.fileUrl),Hn.createSnapShotPhotoUploaded(Vn.fileUrl))}catch(Xn){on.log("Parsing error:",Xn)}kn!=="Photo received"&&kn!=="An error occurred."&&kn.substring(0,6)!=="Photo-"||Hn.createSnapShotPhotoUploaded(kn)},jt,En)))},this.takeSnapshotAndSendOnDataChannel=function(st,Tt,Rt,Lt){on.info("takeSnapshotAndSendOnDataChannel");var Et,jt=null,Pt=document.createElement("canvas"),Vt=null;if(Tt!==void 0){if(on.log("takeSnapshot of defined video Id :"+Tt),(Vt=document.getElementById(Tt))===null)return on.log("Cannot find video with Id :"+Tt),on.log("Leaving takeSnapshot"),void this.myWebRTC_Event.createErrorEvent("localVideo Div Name is not correct for takeSnapshot","INCORRECT_VIDEOID_FOR_SNAPSHOT")}else on.warn("ApiRTC DEPRECATED : Please add videoId for TakeSnapshot");Vt!=null&&(Pt.width=Vt.clientWidth,Pt.height=Vt.clientHeight),on.log("snapshot.width : "+Pt.width),on.log("snapshot.height :"+Pt.height),Pt.getContext("2d").drawImage(Vt,0,0,Pt.width,Pt.height),(jt=document.createElement("img")).src=Pt.toDataURL("image/png"),jt.style.padding=5,jt.width=Pt.width,jt.height=Pt.height,Zn(st)==="object"?st!==null?st.src=jt.src:on.log("localPhotoIdOrDiv is null"):document.getElementById(st)!==null?document.getElementById(st).src=jt.src:on.log("localPhotoId is not defined"),Et=Pt.toDataURL("image/png"),this.sendDataWithCallId(Rt,{file:Et,name:"nomFichier",type:"image/png-dataUrl"},Lt)},this.callWithNumber=function(st,Tt,Rt,Lt){on.info("Click on Call Button, video activated : "+Tt),on.log("callConfiguration : ",Lt);var Et=null,jt=0,Pt=null,Vt=null,Qt=null,rn=null,Jt=null;if(typeof st=="number"&&(on.log("called number type is number, converting to string"),st=st.toString()),st!==""&&st!==this.clientId){if((Et=new vn(this)).instanceId=apiCC.generateInstanceId(),on.log("Calling destination number :"+st),Lt==null||Lt.apzcallId===void 0||Lt.apzcallId===null?Et.generateCallId():Et.callId=Lt.apzcallId,apiCC.isSIPNumber(st)===!0?(on.log("Prefix 0 , + , or 'sip:' detected, calling a SIP device"),st.toString().startsWith("sip:")===!0&&(st=st.toString().replace("sip:",""),on.log("called SIP number is :",st)),Rt!=null?Rt.pubSub="sipConnector":(Rt={}).pubSub="sipConnector",Et.trickleIce=!1):on.log("Establishing Web call"),Et.callerId=this.clientId,Et.calleeId=st,Et.dest_roomId=st,Et.audioOnly=!Tt,Et.remoteId=st,Et.callConfiguration=Lt,Lt!=null?(Lt.mediaTypeForOutgoingCall==="VIDEO"||Lt.mediaTypeForOutgoingCall==="AUDIO"||Lt.mediaTypeForOutgoingCall==="VIDEOONLY"||Lt.mediaTypeForOutgoingCall==="NONE"?(on.log("Setting mediaTypeForOutgoingCall :"+Lt.mediaTypeForOutgoingCall),Et.mediaTypeForOutgoingCall=Lt.mediaTypeForOutgoingCall):(on.log("mediaTypeForOutgoingCall is not set"),Tt===!1&&(on.log("videoActivated is false, setting mediaTypeForOutgoingCall to AUDIO"),Et.mediaTypeForOutgoingCall="AUDIO")),Lt.mediaRoutingMode!==void 0&&Lt.mediaRoutingMode!==null&&Et.setCallMediaRoutingMode(Lt.mediaRoutingMode),Lt.turnServerAddress!==void 0&&Lt.turnServerAddress!==null&&Et.setCallTurnServer(Lt.turnServerAddress),Lt.preferVP9Codec!==!0&&Lt.preferVP9Codec!==!1||(Et.preferVP9Codec=Lt.preferVP9Codec),Lt.hasOwnProperty("forceCallType")&&(Et.callType=Lt.forceCallType,Et.callType!=="screenSharing"&&Et.callType!=="screenSharingWithAudio"||(Et.screenSharing=!0))):on.log("callConfiguration is not set"),Rt!==void 0&&Rt.MCUType!==void 0&&(Rt.MCUType!=="MCU-Caller"&&Rt.MCUType!=="MCU-Callee"||(this.MCUClient.pubConnector==="janusConnector"&&(nt.Xh!=="Firefox"&&nt.Xh!=="Mobile Firefox"||(nt.PR>43?Et.mediaConstraints={offerToReceiveAudio:!1,offerToReceiveVideo:!1}:Et.mediaConstraints={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}})),Rt.remoteMediaStreamId&&(Et.remoteMediaStreamId=Rt.remoteMediaStreamId),Rt.pubSub=this.MCUClient.pubConnector,Rt.videoBandwidthSettings=this.videoBandwidthSettings,Rt.pubSub==="groupKurentoConnector"&&(Rt.pubSub="kurentoConnector"))),Et.checkDTLSCompliancy(),Pt=Et.callId,Vt=apiCC.session.getConnectedUserInfo(st,"userData"),on.log("userInfo :",Vt),Vt!=="User_Not_Found"&&Vt!==void 0&&(Qt=JSON.parse(Vt))!==void 0&&Qt.react==="true"&&(on.log("userInfoJson.react :",JSON.stringify(Qt.react)),on.log("userInfoJson.osName :",JSON.stringify(Qt.osName)),Qt.osName==="iOS"&&(on.log("Callee : React and iOS detected, setting H264 as preferred codec for the call"),Et.preferH264Codec=!0)),Et.audioOnly===!0&&(Et.callType="audio"),Rt!==void 0?Et.data=Rt:Rt={},Rt.convId&&(Rt.cloudConvId||(Rt.cloudConvId=Rt.convId),delete Rt.convId),Rt.dataCall===!0&&(Et.dataCall=!0),Et.data.instanceId=Et.instanceId,jt=this.callsTable.push(Et),on.log("Call Number is :"+jt),Et.data&&Et.data.MCUType==="MCU-Caller"&&Et.mediaTypeForOutgoingCall==="NONE")return Et.inviteSended=!0,Et.myWebRTC_Stack.sendInvite(Et.callId,Et.callerId,this.nickname,Et.dest_roomId,Et.dest_roomId,"none",{offer:{type:"no-offer"},data:Et.data}),Et.callId;Et.data&&Et.data.MCUType==="MCU-Caller"&&(Et.settingUpType="publish",Et.callControl=this.createCallControl({type:"publish",callId:Et.callId,roomName:Et.data.confId,callConfiguration:Et.callConfiguration,data:Et.data}),Et.callControl.sessionId=Et.data.confId,Et.callControl.token=Et.data.confId,Et.callControl.autoRestart.counter=0,Et.setMediaConstraintsToSendOnlyOffer()),(0,at.ki)(Lt,"userMediaStreamId","string")&&(Jt=Lt.userMediaStreamId),Qt!=null&&Qt.isSimulated==="true"?apiCC.session.channel.socket.emit("simulatedAgentCallRequest",{number:st,call:Et,videoActivated:Tt,data:Rt,callConfiguration:{apzcallId:Et.callId}}):this.accessToLocalMedia===!0&&this.autoAnswer===!0||Et.dataCall||Jt?Et.dataCall?(on.log("Datachannel call"),Et.establishCall()):(on.log("callWithNumber :: User has already granted access to local media and AutoAnswer activated : establishing call"),Jt?((rn=apiCC.getUserMediaStream(Jt)).addCallInfo(Et.callId),Et.callConfiguration!==void 0&&Et.callConfiguration!==null||(Et.callConfiguration={}),Et.callConfiguration.userMediaStreamId=rn.userMediaStreamId,Et.onUserMediaSuccessOnCall(rn.stream)):Et.establishCall()):Rt.MCUType==="MCU-Callee"&&this.userAcceptOnIncomingCallBeforeGetUserMedia===!0?on.log("Stand-by :: wait for AcceptCall on recorded 1to1 call"):Et.getUserMediaOnCall()}else on.log("Call Number is incorrect");return Pt},this.startTestCall=function(st,Tt){on.info("startTestCall : video activated : "+st);var Rt,Lt,Et=null,jt=null,Pt={};return(Et=new vn(this)).generateCallId(),Et.instanceId=apiCC.generateInstanceId(),Et.callerId=this.clientId,Et.calleeId=12345,Et.dest_roomId=12345,Et.audioOnly=!st,Et.remoteId=12345,Et.callConfiguration=Tt,Tt!=null?(Tt.mediaTypeForOutgoingCall==="VIDEO"||Tt.mediaTypeForOutgoingCall==="AUDIO"||Tt.mediaTypeForOutgoingCall==="VIDEOONLY"||Tt.mediaTypeForOutgoingCall==="NONE"?(on.log("Setting mediaTypeForOutgoingCall :"+Tt.mediaTypeForOutgoingCall),Et.mediaTypeForOutgoingCall=Tt.mediaTypeForOutgoingCall):on.log("mediaTypeForOutgoingCall is not set"),Tt.mediaRoutingMode!==void 0&&Tt.mediaRoutingMode!==null&&Et.setCallMediaRoutingMode(Tt.mediaRoutingMode),Tt.turnServerAddress!==void 0&&Tt.turnServerAddress!==null&&Et.setCallTurnServer(Tt.turnServerAddress),Tt.preferVP9Codec!==!0&&Tt.preferVP9Codec!==!1||(Et.preferVP9Codec=Tt.preferVP9Codec)):(on.log("callConfiguration is not set"),Tt={}),Et.checkDTLSCompliancy(),Lt=Et.callId,Pt.pubSub="testCallKurentoConnector",Et.data=Pt,Et.data.instanceId=Et.instanceId,Et.audioOnly===!0&&(Et.callType="audio"),Rt=this.callsTable.push(Et),on.log("Call Number is :"+Rt),this.accessToLocalMedia===!0&&this.autoAnswer===!0||Et.dataCall||Tt.userMediaStreamId||apiCC.userMediaStreamTable.length>0?Et.dataCall?(on.log("Datachannel call"),Et.establishCall()):(on.log("startTestCall :: User has already granted access to local media and AutoAnswer activated : establishing call"),Tt.userMediaStreamId?((jt=apiCC.getUserMediaStream(Tt.userMediaStreamId)).addCallInfo(Et.callId),Et.callConfiguration!==void 0&&Et.callConfiguration!==null||(Et.callConfiguration={}),Et.callConfiguration.userMediaStreamId=jt.userMediaStreamId,Et.callLocalStream=jt.stream,Et.establishCall()):(apiCC.userMediaStreamTable.length>0&&((jt=apiCC.userMediaStreamTable[0]).addCallInfo(Et.callId),Et.callConfiguration!==void 0&&Et.callConfiguration!==null||(Et.callConfiguration={}),Et.callConfiguration.userMediaStreamId=jt.userMediaStreamId,Et.callLocalStream=jt.stream),Et.establishCall())):Et.getUserMediaOnCall(),Lt},this.extensionInstallationSuccessCallback=function(){on.debug("extensionInstallationSuccessCallback"),apiCC.session.apiCCWebRTCClient.webRTCClient.apiRTCExtensionInstalled=!0},this.extensionInstallationFailureCallback=function(st,Tt){on.debug("extensionInstallationFailureCallback : Error :"+st+", "+Tt),st=null,Tt=null,Hn.createDesktopCaptureEvent("Extension_installation_Error",this.waitingShareScreenCallId,this.waitingShareScreenDestNumber,this.waitingCaptureSourceType)},this.manageNotInstalledExtension=function(st,Tt,Rt){on.debug("manageNotInstalledExtension"),on.warn("apiRTC extension not installed"),Hn.createDesktopCaptureEvent("Extension_not_installed",st,Tt),on.warn("Starting apiRTC extension installation"),this.waitingShareScreenDestNumber=Tt,this.waitingShareScreenCallId=st,this.waitingCaptureSourceType=Rt,chrome.webstore.install("https://chrome.google.com/webstore/detail/mjjnofoemoepfididplbfimokpnpcoeg",this.callback(this,"extensionInstallationSuccessCallback"),this.callback(this,"extensionInstallationFailureCallback"))},this.shareScreen=function(st,Tt,Rt,Lt,Et){on.info("shareScreen");var jt=null,Pt=null,Vt=null,Qt=null;if(apiCC.isScreenSharingCompliant()===!0)if(st!==""&&st!==this.clientId){if(Tt!==null&&Zn(Tt)==="object"||(Tt={}),this.MCUClient.pubConnector==="janusConnector"&&!Tt.mesh&&Et&&Et.callControl&&Et.callControl.callId&&this.findCallWithCallId(Et.callControl.callId))return on.debug("call already exists",Et.callControl.callId),Et.callControl.callId;if(Lt!==null&&Zn(Lt)==="object"||(Lt={}),Lt.qos!==null&&Zn(Lt.qos)==="object"?(Tt.qos={},Lt.qos.videoMinQuality==="excellent"?Tt.qos.videoMinQuality="excellent":Lt.qos.videoMinQuality==="good"?Tt.qos.videoMinQuality="good":Lt.qos.videoMinQuality==="medium"?Tt.qos.videoMinQuality="medium":(Lt.qos.videoMinQuality,Tt.qos.videoMinQuality="bad"),Lt.qos.videoForbidInactive===!0&&(Tt.qos.videoForbidInactive=!0)):Tt.qos={videoMinQuality:"bad"},["audioLabels","videoLabels"].forEach(function(Jt){(0,at.Ym)(Lt[Jt],"array")&&(Tt[Jt]=[],Lt[Jt].forEach(function(sn){(0,at.Ym)(sn,"string")&&Tt[Jt].push(sn)}))}),(0,at.Ym)(Lt,"context","object"))try{JSON.stringify(Lt.context),Tt.context=Lt.context}catch{}on.log("shareScreen; callConfiguration: "+JSON.stringify(Lt)),Pt=new vn(apiCC.session.apiCCWebRTCClient.webRTCClient),Tt.mesh!==void 0&&Tt.instanceId!==void 0?(on.debug("keeping instanceId "),Pt.instanceId=Tt.instanceId):Pt.instanceId=apiCC.generateInstanceId(),on.log("Calling destination number :"+st);var rn=this.MCUClient.getSessionMCU(st);if(rn&&(Pt.sessionMCU=rn),Pt.sessionMCU&&this.MCUClient.pubConnector==="janusConnector"&&!Tt.mesh?(Pt.settingUpType="shareScreen",Et&&Et.callControl?(Pt.callControl=Et.callControl,Pt.callControl.autoRestart.counter+=1,Pt.callId=Pt.callControl.callId,Pt.restarted=!0):(Pt.callControl=this.createCallControl({type:"shareScreen",roomName:st,callConfiguration:Lt,data:Tt}),Pt.callControl.captureSourceType=Rt,Pt.callControl.autoRestart.counter=0,Pt.generateCallId(),Pt.callControl.callId=Pt.callId)):(Pt.settingUpType="shareScreen",Pt.generateCallId()),jt=Pt.callId,Pt.callerId=this.clientId,Pt.calleeId=st,Pt.dest_roomId=st,Pt.audioOnly=!1,Pt.screenSharing=!0,Pt.remoteId=st,Pt.callType="screenSharing",Pt.captureSourceType=Rt,Pt.callConfiguration=Lt,Pt.data=Tt,Pt.data.instanceId=Pt.instanceId,rn&&rn.convId&&(Pt.data.cloudConvId=rn.convId),Lt!=null&&Lt.turnServerAddress!==void 0&&Lt.turnServerAddress!==null&&Pt.setCallTurnServer(Lt.turnServerAddress),Pt.checkDTLSCompliancy(),apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.push(Pt),Pt.sessionMCU&&this.MCUClient.pubConnector==="janusConnector"&&Pt.callControl&&Pt.callControl.autoRestart.stream)return on.debug("shareScreen; autoRestart"),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,Pt.callLocalStream=Pt.callControl.autoRestart.stream,Pt.establishCall(),Pt.callId;if(Tt!==void 0&&Tt.mesh!==void 0&&(Vt=apiCC.session.apiCCWebRTCClient.webRTCClient.findUserMediaById(Tt.mesh.calleeCallId))!==null&&Vt.callConfiguration&&Vt.callConfiguration.userMediaStreamId)return(Qt=apiCC.getUserMediaStream(Vt.callConfiguration.userMediaStreamId)).addCallInfo(Pt.callId),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,Pt.sessionMCU&&apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector==="janusConnector"&&Pt.callControl&&(Pt.callControl.autoRestart.stream=Qt.stream),Pt.callConfiguration.userMediaStreamId=Qt.userMediaStreamId,Pt.callLocalStream=Qt.stream,Pt.establishCall(),Pt.callId;apiCC.createUserMediaStream({callId:Pt.callId,type:Pt.callType,captureSourceType:Rt,success:function(Jt){on.debug("[shareScreen] success; userMediaStreamId: "+Jt.userMediaStreamId),apiCC.session.apiCCWebRTCClient.webRTCClient.accessToLocalMedia=!0,Pt.sessionMCU&&apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.pubConnector==="janusConnector"&&Pt.callControl&&(Pt.callControl.autoRestart.stream=Jt.stream),Pt.callConfiguration.userMediaStreamId=Jt.userMediaStreamId,Pt.callLocalStream=Jt.stream,Pt.establishCall()}})}else on.log("Call Number is incorrect");else on.log("shareScreen is not supported on this browser"),Hn.createDesktopCaptureEvent("Browser_Not_Compatible",jt,st);return on.info("shareScreen, callId :",jt),jt},this.startScreenSharingOnCall=function(st,Tt){on.info("getScreenMedia for callId :"+st);var Rt=null;if(nt.Xh==="Chrome")if((Rt=this.findCallWithCallId(st))!==null){if(this.apiRTCExtensionInstalled===!1)return void this.manageNotInstalledExtension(Rt.callId,Rt.remoteId,Tt);Tt==null&&(Tt=["screen","window","tab"]),window.postMessage({command:"getDesktopId",callNumber:Rt.callId,remoteId:Rt.remoteId,captureSourceType:Tt,browser_major_version:nt.PR},"*")}else on.log("call not found");else on.log("shareScreen is only available for chrome Browser"),Hn.createDesktopCaptureEvent("Browser_Not_Compatible",st,null)},this.toggleVideoScreen=function(st){on.info("toggleVideoScreen for callId :"+st);var Tt=this.findCallWithCallId(st);Tt!==null?Tt.toggleVideoScreen():on.log("call not found")},this.addVideoMedia=function(st){on.info("webRTCClient::addVideoMedia for callId :"+st);var Tt=this.findCallWithCallId(st);Tt!==null?Tt.addVideoMedia():on.log("call not found")},this.callbymail=function(st){var Tt;on.info("Click on Call per mail Button"),Tt=st,new RegExp("^[0-9a-z._-]+@{1}[0-9a-z.-]{2,}[.]{1}[a-z]{2,5}$","i").test(Tt)?(on.log("Calling Destination mail :"+st),this.socket.emit("webrtc_invite_permail",st),qt.channel.socket.emit("webrtc_invite_permail",st)):on.log("Mail address is not correct :"+st)},this.callperURL=function(st){on.info("Call per URL");var Tt,Rt=null;(Rt=new vn(this)).instanceId=apiCC.generateInstanceId(),on.log("Calling Destination number :"+st),Rt.generateCallId(),Rt.callerId=this.clientId,Rt.calleeId=st,Rt.dest_roomId=st,Rt.audioOnly=!1,Rt.getUserMediaOnCall(),Rt.remoteId=st,Rt.checkDTLSCompliancy(),Tt=this.callsTable.push(Rt),on.log("Call Number is :"+Tt)},this.acceptCall=function(st,Tt){on.info("acceptCall for callId :"+st),on.log("acceptCall() - callConfiguration : ",Tt);var Rt=null,Lt=null;if((Rt=this.findCallWithCallId(st))!==null){if(on.log("acceptCall() - Call found"),Rt.isAccepted=!0,Tt!=null?(Tt.mediaTypeForIncomingCall==="VIDEO"||Tt.mediaTypeForIncomingCall==="AUDIO"||Tt.mediaTypeForIncomingCall==="VIDEOONLY"||Tt.mediaTypeForIncomingCall==="NONE"||Tt.mediaTypeForIncomingCall==="DATA"?(on.log("acceptCall() - Setting mediaTypeForIncomingCall :"+Tt.mediaTypeForIncomingCall),Rt.mediaTypeForIncomingCall=Tt.mediaTypeForIncomingCall):on.log("acceptCall() - mediaTypeForIncomingCall is not set"),Tt.mediaRoutingMode!==void 0&&Tt.mediaRoutingMode!==null&&Rt.setCallMediaRoutingMode(Tt.mediaRoutingMode),Tt.turnServerAddress!==void 0&&Tt.turnServerAddress!==null&&Rt.setCallTurnServer(Tt.turnServerAddress),Tt.preferVP9Codec!==!0&&Tt.preferVP9Codec!==!1||(Rt.preferVP9Codec=Tt.preferVP9Codec)):(on.log("acceptCall() - callConfiguration is not set"),Tt={}),Rt.screenSharing===!0&&(on.log("acceptCall() for screenSharing : forcing mediaTypeForIncomingCall to NONE"),Tt.mediaTypeForIncomingCall="NONE",Rt.mediaTypeForIncomingCall="NONE"),Rt.callConfiguration=(0,at.S6)(Rt.callConfiguration,Tt),Rt.mediaTypeForIncomingCall==="VIDEO"?Rt.setLocalCallProfile({audio:!0,audioActive:!0,video:!0,videoActive:!0}):Rt.mediaTypeForIncomingCall==="AUDIO"?Rt.setLocalCallProfile({audio:!0,audioActive:!0,video:!1,videoActive:!1}):Rt.mediaTypeForIncomingCall==="VIDEOONLY"?Rt.setLocalCallProfile({audio:!1,audioActive:!1,video:!0,videoActive:!0}):Rt.mediaTypeForIncomingCall==="NONE"&&Rt.setLocalCallProfile({audio:!1,audioActive:!1,video:!1,videoActive:!1}),Rt.data&&Rt.data.MCUType==="MCU-Callee"&&Rt.mediaTypeForIncomingCall==="NONE")return void Rt.myWebRTC_Stack.sendInvite(Rt.callId,Rt.callerId,this.nickname,Rt.dest_roomId,Rt.dest_roomId,"none",{offer:{type:"no-offer"},data:Rt.data});Rt.data&&Rt.data.MCUType==="MCU-Callee"&&(Rt.mediaTypeForOutgoingCall=Rt.mediaTypeForIncomingCall,Rt.settingUpType="publish",Rt.callControl=this.createCallControl({type:"publish",callId:Rt.callId,roomName:Rt.data.confId,callConfiguration:Rt.callConfiguration,data:Rt.data}),Rt.callControl.sessionId=Rt.data.confId,Rt.callControl.token=Rt.data.confId,Rt.callControl.autoRestart.counter=0,Rt.setMediaConstraintsToSendOnlyOffer()),this.unidirectionelCallOnly?(on.log("acceptCall() - unidirectional call"),Rt.onUserMediaSuccessTestUni()):this.userAcceptOnIncomingCallBeforeGetUserMedia===!0?(on.log("acceptCall with userAcceptOnIncomingCallBeforeGetUserMedia"),Tt.userMediaStreamId?((Lt=apiCC.getUserMediaStream(Tt.userMediaStreamId)).addCallInfo(Rt.callId),Rt.callConfiguration!==void 0&&Rt.callConfiguration!==null||(Rt.callConfiguration={}),Rt.callConfiguration.userMediaStreamId=Lt.userMediaStreamId,Rt.onUserMediaSuccessOnCall(Lt.stream)):Rt.getUserMediaOnCall()):Rt.accessToMedia===!0||Tt.userMediaStreamId||Rt.dataCall?(on.log("acceptCall() :: User has already granted access to local media and AutoAnswer activated : establishing call"),Rt.dataCall||Tt.userMediaStreamId&&((Lt=apiCC.getUserMediaStream(Tt.userMediaStreamId)).addCallInfo(Rt.callId),Rt.callConfiguration!==void 0&&Rt.callConfiguration!==null||(Rt.callConfiguration={}),Rt.callConfiguration.userMediaStreamId=Lt.userMediaStreamId,Rt.callLocalStream=Lt.stream),Rt.establishCall()):on.log("acceptCall() - call will be established when user accept his media")}else on.log("Call not found")},this.refuseCall=function(st,Tt){on.info("refuseCall for callId :"+st);var Rt,Lt=null;Rt=Tt!==void 0?Tt:"User_Refused_Call",(Lt=this.findCallWithCallId(st))!==null?(on.log("Call found"),Lt.data.MCUType==="MCU-Callee"?(Lt.myWebRTC_Stack.sendBye(Lt.callId,Lt.callerId,Lt.dest_roomId,Lt.calleeId,"User_Media_Error",Lt.data),this.removeCallFromTableWithCallIdandRemoteId(Lt.callId,Lt.calleeId,Rt)):(Lt.myWebRTC_Stack.sendBye(Lt.callId,Lt.calleeId,Lt.dest_roomId,Lt.callerId,Rt,Lt.data),this.removeCallFromTableWithCallIdandRemoteId(Lt.callId,Lt.callerId,Rt)),this.callsTable.length===0&&on.log("No more established calls for client")):on.log("Call not found")},this.stopMedia=function(st){var Tt=this,Rt=null,Lt=null;return new Promise(function(Et,jt){var Pt=null,Vt=null;return(Pt=Tt.findCallWithCallId(st))?Pt.callLocalStream?void Pt.removeStream(Pt.callLocalStream).then(function(){return Lt=Pt.callLocalStream.id,Pt.callLocalStream=null,(0,at.ki)(Pt.callConfiguration,"userMediaStreamId","string")&&(Rt=Pt.callConfiguration.userMediaStreamId,apiCC.releaseUserMediaStream(Pt.callConfiguration.userMediaStreamId,Pt.callId),delete Pt.callConfiguration.userMediaStreamId),Et({oldUserMediaStreamId:Rt,oldMediaStreamId:Lt})}).catch(jt):Et({oldUserMediaStreamId:Rt,oldMediaStreamId:Lt}):((Vt=Tt.findUserMediaById(st))&&(Rt=st,Vt.releaseUserMediaStream()),Et({oldUserMediaStreamId:Rt,oldMediaStreamId:Lt}))})},this.addMedia=function(st,Tt,Rt,Lt){var Et=this;on.info("addMedia for callId :"+st);var jt=null,Pt=null,Vt=null,Qt=function(){return Promise.resolve()},rn=function(){return Promise.resolve()};Tt===!0&&(Qt=function(){return Et.stopMedia(st)}),(0,at.Ym)(Rt,"string")&&(Vt=apiCC.getUserMediaStream(Rt),Rt=null);var Jt=function(){on.error("[addMedia] success; userMediaStreamId: "+Vt.userMediaStreamId),Pt.callConfiguration!==void 0&&Pt.callConfiguration!==null||(Pt.callConfiguration={}),Pt.callConfiguration.userMediaStreamId=Vt.userMediaStreamId,Pt.callType=Vt.callType,Pt.audio=Vt.audio,Pt.video=Vt.video,Pt.audioMuted=Vt.audioMuted,Pt.videoMuted=Vt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Pt,!0)},sn=function(hn){hn.callConfiguration!==void 0&&hn.callConfiguration!==null||(hn.callConfiguration={}),hn.isLocalAudioMuted&&hn.isLocalVideoMuted?hn.callConfiguration.muted="VIDEO":hn.isLocalAudioMuted?hn.callConfiguration.muted="AUDIOONLY":hn.isLocalVideoMuted&&(hn.callConfiguration.muted="VIDEOONLY")},mn=function(hn,wn,Mn){wn==="audio"?Mn?hn.audioSdpDirection=null:(0,at.ki)(hn.remoteCallProfile,"audio","boolean")&&hn.remoteCallProfile.audio===!0&&hn.remoteCallProfile.audioActive===!0?hn.audioSdpDirection="recvonly":hn.audioSdpDirection="inactive":wn==="video"&&(Mn?hn.videoSdpDirection=null:(0,at.ki)(hn.remoteCallProfile,"video","boolean")&&hn.remoteCallProfile.video===!0&&hn.remoteCallProfile.videoActive===!0?hn.videoSdpDirection="recvonly":hn.videoSdpDirection="inactive")},an=function(hn,wn,Mn,xn){hn.callConfiguration!==void 0&&hn.callConfiguration!==null||(hn.callConfiguration={}),hn.callConfiguration.userMediaStreamId=wn.userMediaStreamId,mn(hn,"audio",wn.audio),mn(hn,"video",wn.video),sn(hn),function(En,kn,Vn){kn&&Vn?(En.audioOnly=!1,En.mediaTypeForIncomingCall="VIDEO",En.mediaTypeForOutgoingCall="VIDEO"):kn?(En.audioOnly=!1,En.mediaTypeForIncomingCall="AUDIO",En.mediaTypeForOutgoingCall="AUDIO"):Vn?(En.audioOnly=!1,En.mediaTypeForIncomingCall="VIDEOONLY",En.mediaTypeForOutgoingCall="VIDEOONLY"):(En.audioOnly=!1,En.mediaTypeForIncomingCall="NONE",En.mediaTypeForOutgoingCall="NONE")}(hn,wn.audio,wn.video),hn.callLocalStream=wn.stream,hn.started?hn.addingUserMedia=!0:Et.accessToLocalMedia=!0,hn.asyncCallbacks={},hn.asyncCallbacks.type="addingUserMedia",hn.asyncCallbacks.resolve=Mn,hn.asyncCallbacks.reject=xn,hn.asyncCallbacks.timeoutId=setTimeout(function(){hn.asyncCallbacks&&typeof hn.asyncCallbacks.reject=="function"&&(hn.asyncCallbacks.reject("addMedia timeout"),delete hn.asyncCallbacks)},Bn),hn.establishCall()};if((jt=this.findCallWithCallId(st))!==null){if(jt.asyncCallbacks)return Promise.reject("job already ongoing");rn=function(){return new Promise(function(hn,wn){Vt?(Vt.addCallInfo(jt.callId),an(jt,Vt,hn,wn)):Rt?apiCC.createUserMediaStream({type:"media",callId:jt.callId,stream:Rt,sync:!0,success:function(Mn){on.debug("[addMedia] success; userMediaStreamId: "+Mn.userMediaStreamId),an(jt,Mn,hn,wn)},failure:function(Mn,xn){return wn(xn)}}):(0,at.ki)(Lt,"getUserMediaStreamId","function")?Lt.getUserMediaStreamId().then(function(Mn){if(!(Vt=apiCC.getUserMediaStream(Mn)))return wn("wrong userMediaStreamId");Vt.addCallInfo(jt.callId),an(jt,Vt,hn,wn)}).catch(wn):apiCC.userMediaStreamTable.length>0?((Vt=apiCC.userMediaStreamTable[0]).addCallInfo(jt.callId),an(jt,Vt,hn,wn)):(sn(jt),jt.addingUserMedia=!0,jt.asyncCallbacks={},jt.asyncCallbacks.type="addingUserMedia",jt.asyncCallbacks.resolve=hn,jt.asyncCallbacks.reject=wn,jt.asyncCallbacks.timeoutId=setTimeout(function(){jt.asyncCallbacks&&typeof jt.asyncCallbacks.reject=="function"&&(jt.asyncCallbacks.reject("addMedia timeout"),delete jt.asyncCallbacks)},Bn),jt.getUserMediaOnCall())})}}else if(Pt=this.findUserMediaById(st)){if(Pt.addingUserMedia===!0)return Promise.reject("addMedia already ongoing");rn=function(){return new Promise(function(hn,wn){Pt.addingUserMedia=!0,new Promise(function(Mn,xn){if(Vt)return Vt.addCallInfo(Pt.userMediaId,"userMedia"),Pt.callConfiguration!==void 0&&Pt.callConfiguration!==null||(Pt.callConfiguration={}),Pt.callConfiguration.userMediaStreamId=Vt.userMediaStreamId,Pt.callType=Vt.callType,Pt.audio=Vt.audio,Pt.video=Vt.video,Pt.audioMuted=Vt.audioMuted,Pt.videoMuted=Vt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Pt,!0),Mn(Vt.userMediaStreamId);if(Rt)apiCC.createUserMediaStream({callId:Pt.userMediaId,callFlavor:"userMedia",type:Pt.callType,stream:Rt,sync:!0,success:function(){return Jt(),Mn(Vt.userMediaStreamId)},failure:function(En,kn){return xn(kn)}});else if((0,at.ki)(Lt,"getUserMediaStreamId","function"))Lt.getUserMediaStreamId().then(function(En){return(Vt=apiCC.getUserMediaStream(En))?(Vt.addCallInfo(Pt.userMediaId,"userMedia"),Pt.callConfiguration!==void 0&&Pt.callConfiguration!==null||(Pt.callConfiguration={}),Pt.callConfiguration.userMediaStreamId=Vt.userMediaStreamId,Pt.callType=Vt.callType,Pt.audio=Vt.audio,Pt.video=Vt.video,Pt.audioMuted=Vt.audioMuted,Pt.videoMuted=Vt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Pt,!0),Mn(Vt.userMediaStreamId)):xn("wrong userMediaStreamId")}).catch(xn);else{if(apiCC.userMediaStreamTable.length>0)return(Vt=apiCC.userMediaStreamTable[0]).addCallInfo(Pt.userMediaId,"userMedia"),Pt.callConfiguration!==void 0&&Pt.callConfiguration!==null||(Pt.callConfiguration={}),Pt.callConfiguration.userMediaStreamId=Vt.userMediaStreamId,Pt.callType=Vt.callType,Pt.audio=Vt.audio,Pt.video=Vt.video,Pt.audioMuted=Vt.audioMuted,Pt.videoMuted=Vt.videoMuted,apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshOnUserMediaSuccess(Pt,!0),Mn(Vt.userMediaStreamId);apiCC.createUserMediaStream({callId:Pt.userMediaId,callFlavor:"userMedia",type:Pt.callType,audioSourceId:apiCC.session.apiCCWebRTCClient.webRTCClient.audioSourceId,videoSourceId:apiCC.session.apiCCWebRTCClient.webRTCClient.videoSourceId,success:function(){return Jt(),Mn(Vt.userMediaStreamId)},failure:function(En,kn){return xn(kn)}})}}).then(function(Mn){return function(xn){return new Promise(function(En,kn){for(var Vn=[],Xn=0;XnS: "+Jt),apiCC.session.apiCCWebRTCClient.webRTCClient.socket.emit("update",Jt),jt.asyncCallbacks={},jt.asyncCallbacks.type="updateMediaType",jt.asyncCallbacks.resolve=Qt,jt.asyncCallbacks.reject=rn,jt.asyncCallbacks.timeoutId=setTimeout(function(){jt.asyncCallbacks&&typeof jt.asyncCallbacks.reject=="function"&&(jt.asyncCallbacks.reject("timeout"),delete jt.asyncCallbacks)},2e4)})},Lt=this.findCallWithCallId(st);if(!Lt)return Promise.reject("call not found");if(Lt.settingUpType!=="subscribe")return Promise.reject("wrong call type");if(Lt.asyncCallbacks)return Promise.reject("job already ongoing");var Et=this.MCUClient.getStreamFromList(Lt.streamId);if(!Et)return Promise.reject("wrong streamId");if(Lt.callControl.mediaType==="VIDEO"){if(Tt==="AUDIOONLY"&&Et.audio||Tt==="VIDEOONLY"&&Et.video)return Rt(Lt,Et,Tt)}else if(Lt.callControl.mediaType==="AUDIOONLY"){if(Tt==="VIDEO"&&Et.video||Tt==="VIDEOONLY"&&Et.video)return Rt(Lt,Et,Tt)}else if(Lt.callControl.mediaType==="VIDEOONLY"&&(Tt==="VIDEO"&&Et.video||Tt==="AUDIOONLY"&&Et.audio))return Rt(Lt,Et,Tt);return Promise.reject("wrong mediaType")},this.updateSimulcastFeedOnCall=function(st,Tt){var Rt=this.findCallWithCallId(st);if(!Rt)return Promise.reject("call not found");if(Rt.settingUpType!=="subscribe")return Promise.reject("wrong call type");if(Rt.asyncCallbacks)return Promise.reject("job already ongoing");var Lt=this.MCUClient.getStreamFromList(Rt.streamId);if(!Lt)return Promise.reject("wrong streamId");if(!Tt)return Promise.reject("wrong simulcast");Rt.callControl.callConfiguration.simulcast||(Rt.callControl.callConfiguration.simulcast={}),Rt.data.simulcast||(Rt.data.simulcast={}),Tt.streamQuality&&(Tt.streamQuality==="high"?(Rt.callControl.callConfiguration.simulcast.substream=2,Rt.data.simulcast.substream=2):Tt.streamQuality==="medium"?(Rt.callControl.callConfiguration.simulcast.substream=1,Rt.data.simulcast.substream=1):Tt.streamQuality==="low"?(Rt.callControl.callConfiguration.simulcast.substream=0,Rt.data.simulcast.substream=0):(Rt.callControl.callConfiguration.simulcast.substream=-1,Rt.data.simulcast.substream=-1)),Tt.streamFrameRate&&(Tt.streamFrameRate==="high"?(Rt.callControl.callConfiguration.simulcast.temporal=2,Rt.data.simulcast.temporal=2):Tt.streamFrameRate==="medium"?(Rt.callControl.callConfiguration.simulcast.temporal=1,Rt.data.simulcast.temporal=1):Tt.streamFrameRate==="low"?(Rt.callControl.callConfiguration.simulcast.temporal=0,Rt.data.simulcast.temporal=0):(Rt.callControl.callConfiguration.simulcast.temporal=-1,Rt.data.simulcast.temporal=-1));var Et={type:"updateSimulcastFeed"};Et.callId=Rt.callId,Et.callerId=apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,Et.callerNickname=apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,Et.calleeId=Rt.sessionMCU.roomName,Et.roomId=Rt.sessionMCU.roomName,Et.callType=Lt.attributes.callType,Et.data=(0,at.S6)(Rt.data),Et.stream=Lt;var jt=JSON.stringify(Et);return on.log("C->S: "+jt),apiCC.session.apiCCWebRTCClient.webRTCClient.socket.emit("updateSimulcastFeed",jt),Promise.resolve()},this.updateCallConfigurationOnCall=function(st,Tt){var Rt=function(Et,jt,Pt){jt==="audio"?Et.audioSdpDirection=Pt?null:"inactive":jt==="video"&&(Et.videoSdpDirection=Pt?null:"inactive")},Lt=this.findCallWithCallId(st);return Lt?Lt.settingUpType!=="publish"?Promise.reject("wrong call type"):Lt.asyncCallbacks?Promise.reject("job already ongoing"):((0,at.Ym)(Tt,"object")||(Tt={}),(0,at.ki)(Tt,"audioOnly","boolean")||(Tt.audioOnly=!1),(0,at.ki)(Tt,"videoOnly","boolean")||(Tt.videoOnly=!1),function(Et,jt){return new Promise(function(Pt,Vt){Et.mediaTypeForIncomingCall="NONE",jt.audioOnly===!0?(on.log("Setting call as audioOnly"),Et.audioOnly=!0,Et.callType="audio",Et.mediaTypeForOutgoingCall="AUDIO",Rt(Et,"audio",!0),Rt(Et,"video",!1)):jt.videoOnly===!0?(on.log("Setting call as videoOnly"),Et.audioOnly=!1,Et.callType="videoOnly",Et.mediaTypeForOutgoingCall="VIDEOONLY",Rt(Et,"audio",!1),Rt(Et,"video",!0)):(on.log("Setting call as media"),Et.audioOnly=!1,Et.callType="media",Et.mediaTypeForOutgoingCall="VIDEO",Rt(Et,"audio",!0),Rt(Et,"video",!0)),Et.updateUserMedia=!0,Et.updateCause="userAction",Et.establishCall(),Et.asyncCallbacks={},Et.asyncCallbacks.type="updateCallConfiguration",Et.asyncCallbacks.resolve=Pt,Et.asyncCallbacks.reject=Vt,Et.asyncCallbacks.timeoutId=setTimeout(function(){Et.asyncCallbacks&&typeof Et.asyncCallbacks.reject=="function"&&(Et.asyncCallbacks.reject("timeout"),delete Et.asyncCallbacks)},2e4)})}(Lt,Tt)):Promise.reject("call not found")},this.findUserMediaById=function(st){for(var Tt=this.userMediaTable.length;--Tt>=0;)if(this.userMediaTable[Tt].userMediaId===st)return this.userMediaTable[Tt];return null},this.findCallIndexWithCallIdAndRemoteId=function(st,Tt){on.debug("findCallIndexWithCallIdAndRemoteId");var Rt,Lt=this.callsTable.length;for(on.trace("callsNumber : "+Lt),Rt=0;Rt0&&((Lt=Fn("checksum64")).update(Tt.fileContent,Pt*Et,Vt),jt.push(Lt.digest("hex"))),on.debug(JSON.stringify(jt)),st.checksums.length===jt.length){for(Rt=0;Rt0&&(jt.data.ttl=Tt.ttl),jt.data.instanceId=jt.instanceId,st&&(jt.data.cloudConvId=st),jt.callbacks=Lt,Rt!=null&&Rt.turnServerAddress!==void 0&&Rt.turnServerAddress!==null&&jt.setCallTurnServer(Rt.turnServerAddress),jt.data.transferType==="pipeline")jt.data.size=0,jt.pushDataStatus={type:"pipeline",state:"pending",data:Tt},this.callsTable.push(jt),setTimeout(function(){Et.startNextPushData()});else if((0,at.Ym)(Tt,"file","object")&&(Tt.file instanceof File||Tt.file.constructor===File||Tt.asFile===!0))(0,at.Ym)(Tt,"filename","string")?jt.data.filename=Tt.filename:jt.data.filename=Tt.file.name,(0,at.Ym)(Tt,"filetype","string")?jt.data.contentType=Tt.filetype:jt.data.contentType=Tt.file.type,(0,at.Ym)(Tt,"sourceType","string")&&Tt.sourceType.length>0&&(jt.data.sourceType=Tt.sourceType),jt.data.size=Tt.file.size,jt.data.metadata=Tt.metadata,jt.pushDataStatus={type:"file",state:"pending",convId:String(st),data:Tt},this.callsTable.push(jt),setTimeout(function(){Et.startNextPushData()});else{if(!(0,at.Ym)(Tt,"buffer","object")||!(Tt.buffer instanceof ArrayBuffer||Tt.buffer.constructor===ArrayBuffer||Tt.asBuffer===!0)||!(0,at.Ym)(Tt,"filename","string")||!(0,at.Ym)(Tt,"filetype","string"))return null;jt.data.filename=Tt.filename,jt.data.contentType=Tt.filetype,(0,at.Ym)(Tt,"sourceType","string")&&Tt.sourceType.length>0&&(jt.data.sourceType=Tt.sourceType),jt.data.size=Tt.buffer.byteLength,jt.data.metadata=Tt.metadata,jt.pushDataStatus={type:"buffer",state:"pending",convId:String(st),data:Tt},this.callsTable.push(jt),setTimeout(function(){Et.startNextPushData()})}return jt.callId},this.startNextPushData=function(){for(var st=this,Tt=[],Rt=0;RtS: "+rn),apiCC.session.channel.socket.emit("pushData",rn),!0}if(Et.pushDataStatus.type==="file"){Et.pushDataStatus.state="active";var Jt=new FileReader;Jt.onload=function(sn){apiCC.session.apiCCWebRTCClient.webRTCClient.startPushData(Et,Vt,sn.target.result)},Jt.readAsArrayBuffer(Vt.file)}else{if(Et.pushDataStatus.type!=="buffer")return on.error("startNextPushData - wrong type"),Et.callbacks.failure("start",Et.callId),this.onHangup(Et.callId),!1;Et.pushDataStatus.state="active",this.startPushData(Et,Vt,Vt.buffer)}return Et.beginTimeoutId=setTimeout(function(){delete Et.beginTimeoutId,Et.callbacks.failure("timeout",Et.callId),st.onHangup(Et.callId)},2e4),!0},this.startPushData=function(st,Tt,Rt){if(st.fileContent=new Uint8Array(Rt),st.pipelineCallId){var Lt=this.findCallWithCallId(st.pipelineCallId);if(!Lt)return on.error("no such pipeline call"),void this.onHangup(st.callId);st.pipelineCall=Lt,Lt.clientCall=st,st.sendDataChannel=Lt.sendDataChannel;var Et=Lt.transferCount===0?100:0;st.startTransfer({delay:Et}),Lt.transferCount+=1}else{if(!Object.prototype.hasOwnProperty.call(Tt,"checksumEnabled")||Tt.checksumEnabled){var jt=Fn("checksum64");jt.update(st.fileContent),st.data.checksum=jt.digest("hex")}else st.data.checksumEnabled=!1;var Pt={type:"pushData",callerId:apiCC.session.apiCCId,convId:st.pushDataStatus.convId,callId:st.callId,data:st.data},Vt=JSON.stringify(Pt);on.debug("C->S: "+Vt),apiCC.session.channel.socket.emit("pushData",Vt)}},this.cancelPushData=function(st){for(var Tt=null,Rt=this.callsTable.length;--Rt>=0;){var Lt=this.callsTable[Rt];if(Lt.callId===st&&Lt.callType==="data"&&Lt.dataCall&&Lt.remoteId==="dataChannelConnector"&&Lt.pushDataStatus){Tt=Lt;break}}if(!Tt)return on.error("cancelPushData - no such call",st),"no such call";if(Tt.pushDataStatus.state==="pending")Hn.createEvent({eventType:"onFileSended",callId:Tt.callId,remoteId:Tt.remoteId,name:Tt.data.filename,error:"canceled"}),Tt.callbacks.failure("canceled"),this.onHangup(Tt.callId);else if(Tt.pushDataStatus.state==="active")this.onHangup(Tt.callId);else{if(Tt.pushDataStatus.state!=="ready")return on.error("cancelPushData - wrong state"),"wrong state";Tt.clientCall&&this.cancelPushData(Tt.clientCall.callId),Tt.success={state:"complete"},Hn.createEvent({eventType:"onFileSended",callId:Tt.callId,remoteId:Tt.remoteId}),Tt.callbacks.success(Tt.success),this.onHangup(Tt.callId)}return null},this.setVideoBandwidth=function(st,Tt,Rt){if(typeof st=="number"){var Lt=!1,Et=!1;if(Tt==="overall"?Rt==="incoming"?st>0?(this.videoBandwidthSettings.overallIncoming=st,Lt=!0):(delete this.videoBandwidthSettings.overallIncoming,Lt=!0):Rt==="outgoing"&&(st>0?(this.videoBandwidthSettings.overallOutgoing=st,Lt=!0,Et=!0):(delete this.videoBandwidthSettings.overallOutgoing,Lt=!0,Et=!0)):Tt==="perCall"?Rt==="incoming"?st>0?(this.videoBandwidthSettings.perCallIncoming=st,Lt=!0):(delete this.videoBandwidthSettings.perCallIncoming,Lt=!0):Rt==="outgoing"&&(st>0?(this.videoBandwidthSettings.perCallOutgoing=st,Lt=!0,Et=!0):(delete this.videoBandwidthSettings.perCallOutgoing,Lt=!0,Et=!0)):Tt==="remote"&&(this.videoRemoteBandwidth=st),Lt)for(var jt=this.MCUClient.sessionMCUs.length;--jt>=0;){var Pt={type:"info",infoType:"setVideoBandwidthSettings",data:{clientId:this.clientId,roomId:this.MCUClient.sessionMCUs[jt].roomName,pubSub:this.MCUClient.pubConnector,videoBandwidthSettings:this.videoBandwidthSettings}},Vt=JSON.stringify(Pt);on.log("C->S: "+Vt),apiCC.session.channel.socket.emit("info",Vt)}Et&&this.evalOutgoingVideoBandwithCap()}else on.error("Unvalid target bandwidth usage value needs to be a number :",st)},this.setAudioBandwidth=function(st){this.audioBandwidth=st},this.setDataBandwidth=function(st){this.dataBandwidth=st},this.processCheckCallStatus=function(st){this.MCUClient.processCheckCallStatus(st);var Tt={type:"updateCallStatus",clientId:this.clientId,data:{}};st.data.pubSub&&(Tt.data.pubSub=st.data.pubSub),Tt.sessions=[];for(var Rt=0;Rt=0;)if(this.callsTable[Lt].sessionMCU===Rt&&(0,at.ki)(this.callsTable[Lt],["mcuRemoteStream","attributes","callId"],"string")&&this.callsTable[Lt].mcuRemoteStream.attributes.callId===st.mcuRemoteStream.attributes.callId){on.debug("processRemoteStreamAdded: bye",this.callsTable[Lt]),this.removeCallFromTableWithCallIdAndSendBye(this.callsTable[Lt].callId);break}}},this.processDistantCallEstablished=function(st){if(on.debug("processDistantCallEstablished",st),(0,at.ki)(st,["descriptor","callFeed","callId"],"string"))if(st.descriptor.callFeed.clientId===this.clientId){var Tt=null;if(st.descriptor.callMode==="mesh"?Tt=this.MCUClient.getSessionMCU(null,{callback:function(xn){return xn.roomName===st.descriptor.roomId&&xn.roomMode==="mesh"}}):st.descriptor.callMode==="sfu"&&(Tt=this.MCUClient.getSessionMCU(null,{callback:function(xn){return xn.roomName===st.descriptor.roomId&&!xn.hasOwnProperty("roomMode")}})),Tt){on.debug("sessionMCU",Tt);var Rt=null,Lt=null;if(st.descriptor.callMode==="mesh"?(Rt=this.findUserMediaById(st.descriptor.callFeed.callId),on.debug("userMedia",Rt)):(Lt=this.findCallWithCallId(st.descriptor.callFeed.callId),on.debug("call",Lt)),st.active){if(!Rt&&!Lt)return void on.debug("wrong callId: no such call");for(var Et=this.MCUClient.distantCalls.length;--Et>=0&&(this.MCUClient.distantCalls[Et].roomId!==st.descriptor.roomId||this.MCUClient.distantCalls[Et].clientId!==st.descriptor.clientId||this.MCUClient.distantCalls[Et].callId!==st.descriptor.callId););if(Et>=0){if(!this.MCUClient.distantCalls[Et].early)return void on.debug("processDistantCallEstablished: descriptor already exists");on.debug("processDistantCallEstablished: replace early descriptor",this.MCUClient.distantCalls[Et],st.descriptor),this.MCUClient.distantCalls[Et]=st.descriptor}else on.debug("processDistantCallEstablished: add descriptor",st.descriptor),this.MCUClient.distantCalls.push(st.descriptor)}else if(Tt.modeChangeKind==="old"){for(var jt=this.MCUClient.distantCalls.length;--jt>=0;)if(this.MCUClient.distantCalls[jt].roomId===st.descriptor.roomId&&this.MCUClient.distantCalls[jt].clientId===st.descriptor.clientId&&this.MCUClient.distantCalls[jt].callId===st.descriptor.callId){on.debug("processDistantCallEstablished: set descriptor to removed",this.MCUClient.distantCalls[jt]),this.MCUClient.distantCalls[jt].removed=!0;break}}else for(var Pt=this.MCUClient.distantCalls.length;--Pt>=0;)if(this.MCUClient.distantCalls[Pt].roomId===st.descriptor.roomId&&this.MCUClient.distantCalls[Pt].clientId===st.descriptor.clientId&&this.MCUClient.distantCalls[Pt].callId===st.descriptor.callId){on.debug("processDistantCallEstablished: remove descriptor",this.MCUClient.distantCalls[Pt]),this.MCUClient.distantCalls.splice(Pt,1);break}if(Tt.modeChangeKind==="new"){var Vt=this.MCUClient.getSessionMCU(null,{callback:function(xn){return xn.roomName===st.descriptor.roomId&&xn.modeChangeKind==="old"}});if(!Vt)return void on.error("wrong roomId: no such old session");on.debug("oldSessionMCU",Vt),on.debug("processDistantCallEstablished: replacement");for(var Qt=!1,rn=this.userMediaTable.length;--rn>=0;){var Jt=this.userMediaTable[rn];if(Jt.sessionMCU===Vt){var sn=!1,mn=0;on.debug("processDistantCallEstablished: userMedia",Jt);for(var an=Jt.distantCalls.length;--an>=0;)Jt.distantCalls[an].replaced?mn+=1:Jt.distantCalls[an].callFeed.callId===st.descriptor.callFeed.callId&&(on.debug("processDistantCallEstablished: distantCall",Jt.distantCalls[an]),sn=!0,Jt.distantCalls[an].replaced=!0,mn+=1);if(sn){if(mn===Jt.distantCalls.length){on.debug("processDistantCallEstablished: remove replaced distant call descriptors");for(var hn=this.MCUClient.distantCalls.length;--hn>=0;)this.MCUClient.distantCalls[hn].callMode==="mesh"&&this.MCUClient.distantCalls[hn].callFeed.callId===Jt.userMediaId&&this.MCUClient.distantCalls[hn].replaced&&(on.debug("processDistantCallEstablished: remove distantCall",this.MCUClient.distantCalls[hn]),this.MCUClient.distantCalls.splice(hn,1));on.debug("processDistantCallEstablished: close old calls");for(var wn=this.callsTable.slice(),Mn=wn.length;--Mn>=0;)(0,at.ki)(wn[Mn].data,"mesh","object")&&wn[Mn].data.mesh.calleeCallId===Jt.userMediaId&&wn[Mn].settingUpType!=="subscribe"&&this.removeCallFromTableWithCallIdAndSendBye(wn[Mn].callId);this.MCUClient.meshOnHangup(Jt.userMediaId),Qt=!0}break}}}Qt&&this.finalizeMeshToJanusTransition(Vt,Tt)}}else on.debug("wrong roomId: no such session")}else on.debug("wrong clientId: message not intended for self");else on.debug("wrong format: missing callFeed")},this.finalizeMeshToJanusTransition=function(st,Tt){var Rt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};on.debug("finalizeMeshToJanusTransition");var Lt=0,Et=0;if(Rt.force===!0){for(var jt=this.callsTable.slice(),Pt=jt.length;--Pt>=0;){var Vt=jt[Pt];Vt.sessionMCU===st&&((Vt.settingUpType==="publish"||Vt.settingUpType==="shareScreen")&&Vt.data&&Vt.data.mesh?this.onHangup(Vt.callId):this.onHangup(Vt.callId,"disconnected"))}for(var Qt=this.userMediaTable.slice(),rn=Qt.length;--rn>=0;){var Jt=Qt[rn];Jt.sessionMCU===st&&this.onHangup(Jt.userMediaId,"disconnected")}}else for(var sn=this.userMediaTable.length;--sn>=0;){var mn=this.userMediaTable[sn];if(mn.sessionMCU===st){Lt+=1;for(var an=0,hn=mn.distantCalls.length;--hn>=0;)on.debug("finalizeMeshToJanusTransition: distantCall",mn.distantCalls[hn]),mn.distantCalls[hn].replaced&&(an+=1);an===mn.distantCalls.length&&(Et+=1)}}Lt===Et&&(on.debug("finalizeMeshToJanusTransition: finalize transition"),Tt.transitionTimeoutId&&(clearTimeout(Tt.transitionTimeoutId),delete Tt.transitionTimeoutId),this.MCUClient.removeSessionMCU(st),delete Tt.modeChangeKind,this.MCUClient.transitionCount-=1,this.MCUClient.transitionCount<=0&&this.evalOutgoingVideoBandwithCap(),Hn.createMCURoomModeChangedEvent(Tt.roomName,"mesh","sfu","complete"))},this.processConfigureEncodings=function(st){var Tt=this.findCallWithCallId(st.callId);if(Tt&&Object.prototype.hasOwnProperty.call(st,"command")&&Tt.simulcast==="RID"){var Rt={};Object.prototype.hasOwnProperty.call(st,"maxBitrate")&&(Rt.maxBitrate=st.maxBitrate),Tt.configureSimulcastEncodings(st.command,Rt)}},this.processSimulcastFeedChanged=function(st){var Tt=this.findCallWithCallId(st.callId);if(Tt){var Rt={};st.substream===2?Rt.streamQuality="high":st.substream===1?Rt.streamQuality="medium":st.substream===0&&(Rt.streamQuality="low"),st.temporal===2?Rt.streamFrameRate="high":st.temporal===1?Rt.streamFrameRate="medium":st.temporal===0&&(Rt.streamFrameRate="low"),Object.keys(Rt).length>0&&Hn.createSimulcastFeedChanged(Tt.callId,Rt)}},this.hasReceiptHook=function(st){if(!st||typeof st!="string")throw new Error("wrong receiptId");return Object.prototype.hasOwnProperty.call(this.receiptHooks,st)},this.createReceiptHook=function(st,Tt){var Rt=this;if(this.hasReceiptHook(st))throw new Error("receiptHook already exists");if(!Tt||Tt.fulfilled!==!1)throw new Error("wrong future");Tt.onFulfillment(function(){delete Rt.receiptHooks[st]}),this.receiptHooks[st]=Tt},this.finalizeReceiptHookFailure=function(st,Tt){if(on.debug("finalizeReceiptHookFailure",st,Tt),!st||typeof st!="string")throw new Error("wrong receiptId");if(!Object.prototype.hasOwnProperty.call(this.receiptHooks,st))throw new Error("receiptHook does not exist");this.receiptHooks[st].fulfill(Tt)},this.finalizeReceiptHookSuccess=function(st,Tt){if(on.debug("finalizeReceiptHookSuccess",st,Tt),!st||typeof st!="string")throw new Error("wrong receiptId");if(!Object.prototype.hasOwnProperty.call(this.receiptHooks,st))throw new Error("receiptHook does not exist");this.receiptHooks[st].fulfill(null,Tt)},this.processReceipt=function(st){if(st&&Zn(st)==="object"){var Tt=st.receiptId,Rt=st.result;if(Tt&&typeof Tt=="string")try{this.finalizeReceiptHookSuccess(Tt,Rt)}catch(Lt){on.debug("processReceipt: finalizeReceiptHookSuccess",Lt)}else on.warn("processReceipt: wrong receiptId")}else on.warn("processReceipt: wrong msg")},this.processError=function(st){var Tt=st.receiptId,Rt=st.errorInfo,Lt=st.errorCode,Et=st.callId,jt=st.roomId,Pt=st.convId;if(Tt&&typeof Tt=="string")try{this.finalizeReceiptHookFailure(Tt,new Error(Rt))}catch(Vt){on.debug("processError: finalizeReceiptHookFailure",Vt)}Hn.createErrorEvent(Rt,Lt,Et,jt,null,null,Pt)},this.createCallControl=function(st){var Tt=new qn(st);return this.callControlTable.push(Tt),Tt},this.destroyCallControl=function(st){if(st.multi){if(!st.roomName)return on.warn("findCallControl: cannot destroy without roomName"),null;for(var Tt=[],Rt=this.callControlTable.length;--Rt>=0;)this.callControlTable[Rt].roomName===st.roomName&&(Tt.push(this.callControlTable[Rt]),this.callControlTable.splice(Rt,1));return Tt}var Lt=this.findCallControl(st,{accept:"index"});if(Lt!==null&&Lt>=0){var Et=this.callControlTable[Lt];return this.callControlTable.splice(Lt,1),Et}return null},this.findCallControl=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt=Tt.accept==="index";if(st.type==="publish"||st.type==="shareScreen"){if(!st.callId)return on.warn("findCallControl: cannot search without callId"),null;for(var Lt=null,Et=null,jt=this.callControlTable.length;--jt>=0;)if((this.callControlTable[jt].type==="publish"||this.callControlTable[jt].type==="shareScreen")&&this.callControlTable[jt].callId===st.callId){Lt=this.callControlTable[jt],Et=jt;break}return Lt?Rt?Et:Lt:null}if(st.type==="subscribe"){if(!(0,at.ki)(st,"stream","object")||!Object.prototype.hasOwnProperty.call(st.stream,"id")||!(0,at.ki)(st.stream,"attributes","object"))return on.warn("findCallControl: cannot search without stream"),null;for(var Pt=null,Vt=null,Qt=this.callControlTable.length;--Qt>=0;)if(this.callControlTable[Qt].type==="subscribe"&&(this.callControlTable[Qt].stream.id===st.stream.id||this.callControlTable[Qt].stream.attributes.callerId===st.stream.attributes.callerId&&this.callControlTable[Qt].stream.attributes.callId===st.stream.attributes.callId)){Pt=this.callControlTable[Qt],Vt=Qt;break}return Pt?Rt?Vt:Pt:null}return on.warn("findCallControl: wrong type",st.type),null},this.getCallControls=function(st){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Rt={};if(Tt.addUserMedia)for(var Lt=this.userMediaTable.length;--Lt>=0;){var Et=this.userMediaTable[Lt];Rt[Et.userMediaId]=Et}if(st){for(var jt=this.callControlTable.length;--jt>=0;){var Pt=this.callControlTable[jt];st.indexOf(Pt.type)>=0&&(Rt[Pt.callId]=Pt)}return Rt}for(var Vt=this.callControlTable.length;--Vt>=0;){var Qt=this.callControlTable[Vt];Rt[Qt.callId]=Qt}return Rt},this.getCallIds=function(st){for(var Tt=[],Rt=this.callControlTable.length;--Rt>=0;){var Lt=this.callControlTable[Rt];st.indexOf(Lt.type)>=0&&Tt.push(Lt.callId)}return Tt},this.evalOutgoingVideoBandwithCap=function(st){if(on.debug("evalOutgoingVideoBandwithCap"),!(this.MCUClient.transitionCount>0)){var Tt=null;this.videoBandwidthSettings.perCallOutgoing&&(Tt=this.videoBandwidthSettings.perCallOutgoing);for(var Rt=[],Lt=this.callsTable.length;--Lt>=0;)this.callsTable[Lt].belongsToRoom()&&this.callsTable[Lt].settingUpType!=="publish"&&this.callsTable[Lt].settingUpType!=="shareScreen"||this.callsTable[Lt].localCallProfile&&this.callsTable[Lt].localCallProfile.video&&this.callsTable[Lt].localCallProfile.videoActive&&Rt.push(this.callsTable[Lt]);if(Rt.length===0)return Tt;if(this.videoBandwidthSettings.overallOutgoing){var Et=Math.floor(this.videoBandwidthSettings.overallOutgoing/Rt.length);Tt=Tt?Math.min(Tt,Et):Et}for(var jt=Rt.length;--jt>=0;)st&&Rt[jt]===st?Tt&&Rt[jt].videoCap!==Tt?(Rt[jt].videoCap=Tt,this.rtpSenderSetParamatersCapable&&Rt[jt].applyOutgoingBitrate(Rt[jt].videoCap)):!Tt&&Rt[jt].videoCap&&(delete Rt[jt].videoCap,this.rtpSenderSetParamatersCapable&&Rt[jt].applyOutgoingBitrate(null)):Tt&&Rt[jt].videoCap!==Tt?(Rt[jt].videoCap=Tt,this.rtpSenderSetParamatersCapable?Rt[jt].applyOutgoingBitrate(Rt[jt].videoCap):setTimeout(function(Pt){Pt.belongsToRoom()||!Pt.callee?(Pt.updateUserMedia=!0,Pt.establishCall()):on.debug("Call is not to be updated")},0,Rt[jt])):!Tt&&Rt[jt].videoCap&&(delete Rt[jt].videoCap,this.rtpSenderSetParamatersCapable?Rt[jt].applyOutgoingBitrate(null):setTimeout(function(Pt){Pt.belongsToRoom()||!Pt.callee?(Pt.updateUserMedia=!0,Pt.establishCall()):on.debug("Call is not to be updated")},0,Rt[jt]));return Tt}on.debug("evalOutgoingVideoBandwithCap - transition ongoing")},this.callback=function(st,Tt){return this.closureHandler=function(Rt){return st[Tt](Rt)},this.closureHandler},this.callbackWithParams=function(st,Tt){return this.closureHandler=function(Rt,Lt,Et){return st[Tt](Rt,Lt,Et)},this.closureHandler},this.simulatedAgentLaunchWaitingCall=function(){this.socket.emit("simulatedAgentLaunchWaitingCall",{type:"simulatedAgentLaunchWaitingCall"})}},$n=(s(2707),et.Y.get("PreCallTest")),Jn=125e3,Kn=2e4,An=apiCC.myWebRTC_Event,Wn=function(qt,kt,st,Tt,Rt){var Lt=this;this.webRTCClient=qt.webRTCClient,this.notifyTerminated=qt.notifyTerminated,this.audioSourceId=Tt,this.videoSourceId=Rt,this.testId="initial",this.stepId="initial",this.report={tests:[],resolutions:[],failurCause:""},this.maxHeight=240,this.maxWidth=320,this.resolutions=[[320,240,"QVGA"],[640,480,"VGA"],[1024,576,"SD"],[1280,720,"HD 720p"],[1920,1080,"HD 1080p"]],this.currentResolution=0,this.userMediastreamId=null,st==="simpleVideoRecordTest"&&($n.warn("Simple video record test is activated"),this.simpleVideoRecordTest=!0),apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshModeEnabled===!0&&($n.debug("Forcing meshModeEnabled to false for precall test"),apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshModeEnabled=!1,this.modifyMeshModeEnabledValueBeforePreCall=!0),this.generateId=function(Et){for(var jt="",Pt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Vt=0;Vt=1e3*this.videoBandwidth?this.recordThenTerminate():jt.bitsReceivedPerSecond.max>=15e5?this.startTestAudioNlVideo(1500):jt.bitsReceivedPerSecond.max>=1e6?this.startTestAudioNlVideo(1e3):jt.bitsReceivedPerSecond.max>=6e5?this.startTestAudioNlVideo(600):jt.bitsReceivedPerSecond.max>=25e4?this.startTestAudioNlVideo(250):this.startTestAudioNlOnly()}else this.startTestAudioNlOnly();else if(this.testId==="audio-and-video-1500")if(this.report[this.testId].status==="success"){var Pt=this.report[this.testId].subscribeCallIds[0],Vt=this.stats[Pt].videoReceived;Vt.bitsReceivedPerSecond.max!==void 0&&Vt.bitsReceivedPerSecond.max+.15*this.videoBandwidth*1e3>=1e3*this.videoBandwidth?this.recordThenTerminate():Vt.bitsReceivedPerSecond.max>=1e6?this.startTestAudioNlVideo(1e3):Vt.bitsReceivedPerSecond.max>=6e5?this.startTestAudioNlVideo(600):Vt.bitsReceivedPerSecond.max>=25e4?this.startTestAudioNlVideo(250):this.startTestAudioNlOnly()}else this.startTestAudioNlOnly();else if(this.testId==="audio-and-video-1000")if(this.report[this.testId].status==="success"){var Qt=this.report[this.testId].subscribeCallIds[0],rn=this.stats[Qt].videoReceived;rn.bitsReceivedPerSecond.max!==void 0&&rn.bitsReceivedPerSecond.max+.15*this.videoBandwidth*1e3>=1e3*this.videoBandwidth?this.recordThenTerminate():rn.bitsReceivedPerSecond.max>=6e5?this.startTestAudioNlVideo(600):rn.bitsReceivedPerSecond.max>=25e4?this.startTestAudioNlVideo(250):this.startTestAudioNlOnly()}else this.startTestAudioNlOnly();else if(this.testId==="audio-and-video-600")if(this.report[this.testId].status==="success"){var Jt=this.report[this.testId].subscribeCallIds[0],sn=this.stats[Jt].videoReceived;sn.bitsReceivedPerSecond.max!==void 0&&sn.bitsReceivedPerSecond.max+.15*this.videoBandwidth*1e3>=1e3*this.videoBandwidth?this.recordThenTerminate():sn.bitsReceivedPerSecond.max>=25e4?this.startTestAudioNlVideo(250):this.startTestAudioNlOnly()}else this.startTestAudioNlOnly();else if(this.testId==="audio-and-video-250")if(this.report[this.testId].status==="success"){var mn=this.report[this.testId].subscribeCallIds[0],an=this.stats[mn].videoReceived;an.bitsReceivedPerSecond.max!==void 0&&an.bitsReceivedPerSecond.max+.15*this.videoBandwidth*1e3>=1e3*this.videoBandwidth?this.recordThenTerminate():this.startTestAudioNlOnly()}else this.startTestAudioNlOnly();else this.recordThenTerminate()},this.startTestAudioNlVideo=function(Et){this.prepareEnvForNewTest(),$n.debug("%ctestAudioNlVideo"+Et),this.testId="audio-and-video-"+Et,this.report.tests.push(this.testId),this.audioEnabled=!0,this.videoEnabled=!0,this.videoBandwidth=Et,this.webRTCClient.setRemoteVideoBandwidth(this.videoBandwidth),this.stats={},this.report[this.testId]={audioEnabled:!0,audioLimited:!1,videoEnabled:!0,videoLimited:!0,videoBandwidth:this.videoBandwidth,stats:this.stats},this.mcuSession={},this.mcuSession.roomId=this.generateRoomId(),this.report[this.testId].roomId=this.mcuSession.roomId,this.webRTCClient.joinMCUSession(this.mcuSession.roomId),this.stepId="joining-mcu-session",this.timeoutId=setTimeout(this.abortJoinMCUSession.bind(this),Kn)},this.startTestAudioNlOnly=function(){this.prepareEnvForNewTest(),$n.debug("%cstartTestAudioNlOnly"),this.testId="audio-only",this.report.tests.push(this.testId),this.audioEnabled=!0,this.videoEnabled=!1,this.webRTCClient.setRemoteVideoBandwidth(null),this.stats={},this.report[this.testId]={audioEnabled:!0,audioLimited:!1,videoEnabled:!1,stats:this.stats},this.mcuSession={},this.mcuSession.roomId=this.generateRoomId(),this.report[this.testId].roomId=this.mcuSession.roomId,this.webRTCClient.joinMCUSession(this.mcuSession.roomId),this.stepId="joining-mcu-session",this.timeoutId=setTimeout(this.abortJoinMCUSession.bind(this),Kn)},this.startTestVideoNlOnly=function(){this.prepareEnvForNewTest(),$n.debug("%cstartTestVideoNlOnly"),this.testId="video-only",this.report.tests.push(this.testId),this.audioEnabled=!1,this.videoEnabled=!0,this.videoBandwidth=600,this.webRTCClient.setRemoteVideoBandwidth(this.videoBandwidth),this.stats={},this.report[this.testId]={audioEnabled:!1,audioLimited:!1,videoEnabled:!0,stats:this.stats},this.mcuSession={},this.mcuSession.roomId=this.generateRoomId(),this.report[this.testId].roomId=this.mcuSession.roomId,this.webRTCClient.joinMCUSession(this.mcuSession.roomId),this.stepId="joining-mcu-session",this.timeoutId=setTimeout(this.abortJoinMCUSession.bind(this),Kn)},this.recordThenTerminate=function(){Lt.modifyMeshModeEnabledValueBeforePreCall===!0&&($n.debug("Restoring meshModeEnabled to true, as it was modified for precall test"),apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.meshModeEnabled=!0);var Et=null;if(Lt.videoEnabled&&Lt.audioEnabled?Et="AUDIO-VIDEO":Lt.audioEnabled?Et="AUDIO-ONLY":Lt.videoEnabled&&(Et="VIDEO-ONLY"),!Et)return $n.error("Can't define record type"),void Lt.terminate();$n.debug("Start recording with type:",Et),Lt.webRTCClient.startRecording(Et,"recordPreCall",null,null,{ttl:900}),setTimeout(function(){$n.debug("Stop recording"),Lt.webRTCClient.stopRecording()},1e4)},this.terminate=function(){$n.debug("Terminate"),this.testId="terminated",this.handlers&&this.handlers.forEach(function(Et){apiRTC.removeEventListener(Et.type,Et.callback)}),this.notifyTerminated(this.report),this.leaveSession()},this.succeed=function(){An.createEvent({eventType:"preCallTestStatus",testId:this.testId,status:"success",stepId:this.stepId}),this.report[this.testId].status="success",this.startNextTest()},this.fail=function(){$n.debug("fail"),An.createEvent({eventType:"preCallTestStatus",testId:this.testId,status:"failure",stepId:this.stepId}),this.report[this.testId].status="failure",this.report[this.testId].stepId=this.stepId,this.leaveSession(),this.startNextTest()},this.prepareEnvForNewTest=function(){Lt.mcuSession!==void 0&&Lt.leaveSession()},this.abortJoinMCUSession=function(){$n.debug("abortJoinMCUSession"),this.fail()},this.abortStreamPublishing=function(){$n.debug("abortStreamPublishing"),this.fail()},this.abortStreamSubscribing=function(){$n.debug("abortStreamSubscribing"),this.fail()},this.observeStreamPublished=function(){if($n.debug("observeStreamPublished"),apiRTC.browser==="Safari"||apiRTC.browser==="Mobile Safari")return $n.info("Safari"),$n.error("observeStreamPublished not supported on Safari"),clearInterval(this.intervalId),void this.fail();if(this.intervalCounter+=1,this.intervalCounter>30)return clearInterval(this.intervalId),void this.fail();if(this.audioEnabled&&this.videoEnabled){var Et=0;if(this.stats[this.publishCallId]!==void 0&&(this.stats[this.publishCallId].audioSent!==void 0&&this.stats[this.publishCallId].audioSent.bitsSentPerSecond!==void 0&&this.stats[this.publishCallId].audioSent.bitsSentPerSecond.thirdQuartile>=2e4&&(Et+=1),this.stats[this.publishCallId].videoSent!==void 0&&this.stats[this.publishCallId].videoSent.bitsSentPerSecond!==void 0&&this.stats[this.publishCallId].videoSent.bitsSentPerSecond.thirdQuartile>=Jn&&(Et+=1)),Et===2){clearInterval(this.intervalId);var jt=this.streams[0];this.subscribeToUserStream(jt.attributes.callerId,jt.id,"VIDEO"),this.stepId="stream-subscribing",this.timeoutId=setTimeout(this.abortStreamSubscribing.bind(this),Kn)}else $n.debug("okCnt !== 2")}else if(this.audioEnabled)if(this.stats[this.publishCallId]!==void 0)if(this.stats[this.publishCallId].audioSent!==void 0&&this.stats[this.publishCallId].audioSent.bitsSentPerSecond!==void 0)if(this.stats[this.publishCallId].audioSent.bitsSentPerSecond.thirdQuartile>=2e4){clearInterval(this.intervalId);var Pt=this.streams[0];this.subscribeToUserStream(Pt.attributes.callerId,Pt.id,"AUDIOONLY"),this.stepId="stream-subscribing",this.timeoutId=setTimeout(this.abortStreamSubscribing.bind(this),Kn)}else $n.debug("no stats audio 1 ");else $n.debug("no stats audio 2");else $n.debug("no stats audio 3");else if(this.videoEnabled)if(this.stats[this.publishCallId]!==void 0)if(this.stats[this.publishCallId].videoSent!==void 0&&this.stats[this.publishCallId].videoSent.bitsSentPerSecond!==void 0)if(this.stats[this.publishCallId].videoSent.bitsSentPerSecond.thirdQuartile>=Jn){clearInterval(this.intervalId);var Vt=this.streams[0];this.subscribeToUserStream(Vt.attributes.callerId,Vt.id,"VIDEOONLY"),this.stepId="stream-subscribing",this.timeoutId=setTimeout(this.abortStreamSubscribing.bind(this),Kn)}else $n.debug("no stats video 1 ");else $n.debug("no stats video 2");else $n.debug("no stats video 3");else $n.debug("no audio or video"),clearInterval(this.intervalId),this.fail()},this.observeStreamSubscribed=function(){if(this.intervalCounter+=1,this.intervalCounter>30)return clearInterval(this.intervalId),void this.succeed();var Et=null,jt=null,Pt=0,Vt=0;this.audioEnabled&&(Et=this.stats[this.publishCallId].audioSent),this.videoEnabled&&(jt=this.stats[this.publishCallId].videoSent);for(var Qt=0;Qt=Et.bitsSentPerSecond.firstQuartile-2e3&&(Jt+=1),this.stats[rn].videoReceived!==void 0&&this.stats[rn].videoReceived.bitsReceivedPerSecond!==void 0&&jt!=null&&jt.bitsSentPerSecond!==void 0&&this.stats[rn].videoReceived.bitsReceivedPerSecond.thirdQuartile>=jt.bitsSentPerSecond.firstQuartile&&(Jt+=1)),Jt===2&&(Pt+=1)}else this.audioEnabled?this.stats[rn]!==void 0&&this.stats[rn].audioReceived!==void 0&&this.stats[rn].audioReceived.bitsReceivedPerSecond!==void 0&&Et!=null&&Et.bitsSentPerSecond!==void 0&&this.stats[rn].audioReceived.bitsReceivedPerSecond.thirdQuartile>=Et.bitsSentPerSecond.firstQuartile&&(Pt+=1):Vt+=1}Vt>0?(clearInterval(this.intervalId),this.fail()):Pt===this.subscribeCallIds.length&&(clearInterval(this.intervalId),this.succeed())},this.handleJoinMCUSessionAnswer=function(Et){if(this.stepId==="joining-mcu-session"){if(An.createEvent({eventType:"preCallTestStatus",testId:this.testId,status:"start",stepId:this.stepId}),clearTimeout(this.timeoutId),this.mcuSession.sessionId=Et.detail.sessionId,this.mcuSession.token=Et.detail.token,this.audioEnabled&&this.videoEnabled){var jt=this,Pt={audio:{},video:{}};Pt=apiCC.setResolutionInConstraint(this.maxWidth,this.maxHeight,Pt),$n.debug("constraints :",Pt),apiRTC.createUserMediaStream({type:"media",audioSourceId:this.audioSourceId,videoSourceId:this.videoSourceId,gum_config:Pt,release:function(Vt){$n.debug("createUserMediaStream release",Vt.userMediaStreamId)},success:function(Vt){$n.debug("createUserMediaStream success",Vt.userMediaStreamId),$n.debug("audioSourceId",Tt),$n.debug("videoSourceId",Rt)},failure:function(Vt,Qt){$n.error("createUserMediaStream failure",Vt.userMediaStreamId),$n.error("failure; userMediaStreamId: "+Vt.userMediaStreamId),$n.error("failure; error: "+Qt),An.createEvent({eventType:"preCallTestStatus",testId:this.testId,status:"failure",stepId:this.stepId,createUserMediaStreamError:Qt}),jt.terminate()}})}else if(this.audioEnabled)this.publishCallId=this.webRTCClient.publish(this.mcuSession.roomId,this.mcuSession.sessionId,this.mcuSession.token,{audioOnly:!0});else{if(!this.videoEnabled)return void this.fail();this.publishCallId=this.webRTCClient.publish(this.mcuSession.roomId,this.mcuSession.sessionId,this.mcuSession.token,{videoOnly:!0,qos:{videoStartQuality:"upper"}})}this.subscribeCallIds=[],this.report[this.testId].publishCallId=this.publishCallId,this.report[this.testId].subscribeCallIds=[],this.streams=[],this.stepId="stream-publishing",this.timeoutId=setTimeout(this.abortStreamPublishing.bind(this),Kn)}},this.handleuserMediaSuccess=function(Et){var jt={userMediaStreamId:Et.detail.userMediaStreamId,qos:{videoStartQuality:"upper"}};this.userMediastreamId=Et.detail.userMediaStreamId,this.publishCallId=this.webRTCClient.publish(this.mcuSession.roomId,this.mcuSession.sessionId,this.mcuSession.token,jt),this.report[this.testId].publishCallId=this.publishCallId},this.handleRecordingStreamAvailable=function(Et){$n.debug("handleRecordingStreamAvailable"),this.terminate()},this.handleMCUAvailableStream=function(Et){if(this.stepId==="stream-publishing"&&Et.detail.isRemoteStream===!1)for(var jt=0;jt=5&&["bitsSentPerSecond","packetsSentPerSecond"].forEach(function(rn){var Jt=jt.evalQuartiles(jt.stats[jt.publishCallId].audioSent.data,rn);Jt.sampleCount=jt.stats[jt.publishCallId].audioSent.data.length,Jt.time=Et.detail.stats.audioSent.timestamp-jt.stats[jt.publishCallId].audioSent.startTime,jt.stats[jt.publishCallId].audioSent[rn]=Jt}):$n.debug("audio stats not pushed for :",this.publishCallId)),Et.detail.stats.videoSent!==void 0&&(this.stats[this.publishCallId].videoSent===void 0&&(this.stats[this.publishCallId].videoSent={startTime:Et.detail.stats.videoSent.timestamp,data:[]}),this.pushStats(this.stats[this.publishCallId].videoSent,Et.detail.stats.videoSent)?this.stats[this.publishCallId].videoSent.data.length>=5&&(["bitsSentPerSecond","packetsSentPerSecond","framesEncodedPerSecond"].forEach(function(rn){var Jt=jt.evalQuartiles(jt.stats[jt.publishCallId].videoSent.data,rn);Jt.sampleCount=jt.stats[jt.publishCallId].videoSent.data.length,Jt.time=Et.detail.stats.videoSent.timestamp-jt.stats[jt.publishCallId].videoSent.startTime,jt.stats[jt.publishCallId].videoSent[rn]=Jt}),this.stats[this.publishCallId].videoSent.width=Et.detail.stats.videoSent.width,this.stats[this.publishCallId].videoSent.height=Et.detail.stats.videoSent.height):$n.debug("video stats not pushed for :",this.publishCallId))),this.stepId==="stream-subscribed")for(var Pt=function(rn){Qt=0;var Jt=jt.subscribeCallIds[rn];jt.stats[Jt]===void 0&&(jt.stats[Jt]={}),Et.detail.stats.audioReceived!==void 0&&(jt.stats[Jt].audioReceived===void 0&&(jt.stats[Jt].audioReceived={startTime:Et.detail.stats.audioReceived.timestamp,data:[]}),jt.pushStats(jt.stats[Jt].audioReceived,Et.detail.stats.audioReceived)?(Qt=jt.stats[Jt].audioReceived.data.length,jt.stats[Jt].audioReceived.data[Qt-1].mosS===void 0&&(jt.stats[Jt].audioReceived.data[Qt-1].mosS={}),jt.stats[Jt].audioReceived.data[Qt-1].mosS=Et.detail.stats.quality.mosS,jt.stats[Jt].audioReceived.data.length>=15&&(["bitsReceivedPerSecond","packetsReceivedPerSecond","delay"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].audioReceived.data,sn);mn.sampleCount=jt.stats[Jt].audioReceived.data.length,mn.time=Et.detail.stats.audioReceived.timestamp-jt.stats[Jt].audioReceived.startTime,jt.stats[Jt].audioReceived[sn]=mn}),jt.stats[Jt].audioReceived.data[0].jitter!==void 0&&["jitter"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].audioReceived.data,sn,function(an){return Math.floor(1e3*an)});mn.sampleCount=jt.stats[Jt].audioReceived.data.length,mn.time=Et.detail.stats.audioReceived.timestamp-jt.stats[Jt].audioReceived.startTime,jt.stats[Jt].audioReceived[sn]=mn}),jt.stats[Jt].audioReceived.packetsLost={max:Et.detail.stats.audioReceived.packetsLost,sampleCount:jt.stats[Jt].audioReceived.data.length,time:Et.detail.stats.audioReceived.timestamp-jt.stats[Jt].audioReceived.startTime},["packetsLostRatio"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].audioReceived.data,sn);mn.sampleCount=jt.stats[Jt].audioReceived.data.length,mn.time=Et.detail.stats.audioReceived.timestamp-jt.stats[Jt].audioReceived.startTime,jt.stats[Jt].audioReceived[sn]=mn}),jt.stats[Jt].audioReceived.mosS===void 0&&(jt.stats[Jt].audioReceived.mosS={}),["mosS"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].audioReceived.data,sn);mn.sampleCount=jt.stats[Jt].audioReceived.data.length,jt.stats[Jt].audioReceived[sn]=mn}))):$n.error("audio stats not pushed for callId :",Jt)),Et.detail.stats.videoReceived!==void 0&&(jt.stats[Jt].videoReceived===void 0&&(jt.stats[Jt].videoReceived={startTime:Et.detail.stats.videoReceived.timestamp,data:[]}),jt.pushStats(jt.stats[Jt].videoReceived,Et.detail.stats.videoReceived)?(Qt=jt.stats[Jt].videoReceived.data.length,jt.stats[Jt].videoReceived.data[Qt-1].mosV===void 0&&(jt.stats[Jt].videoReceived.data[Qt-1].mosV={}),jt.stats[Jt].videoReceived.data[Qt-1].mosAV===void 0&&(jt.stats[Jt].videoReceived.data[Qt-1].mosAV={}),jt.stats[Jt].videoReceived.data[Qt-1].mosV=Et.detail.stats.quality.mosV,jt.stats[Jt].videoReceived.data[Qt-1].mosAV=Et.detail.stats.quality.mosAV,jt.stats[Jt].videoReceived.data.length>=15&&(["bitsReceivedPerSecond","packetsReceivedPerSecond","framesDecodedPerSecond"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].videoReceived.data,sn);mn.sampleCount=jt.stats[Jt].videoReceived.data.length,mn.time=Et.detail.stats.videoReceived.timestamp-jt.stats[Jt].videoReceived.startTime,jt.stats[Jt].videoReceived[sn]=mn}),jt.stats[Jt].videoReceived.data[0].jitter!==void 0&&["jitter"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].videoReceived.data,sn,function(an){return Math.floor(1e3*an)});mn.sampleCount=jt.stats[Jt].videoReceived.data.length,mn.time=Et.detail.stats.videoReceived.timestamp-jt.stats[Jt].videoReceived.startTime,jt.stats[Jt].videoReceived[sn]=mn}),jt.stats[Jt].videoReceived.packetsLost={max:Et.detail.stats.videoReceived.packetsLost,sampleCount:jt.stats[Jt].videoReceived.data.length,time:Et.detail.stats.videoReceived.timestamp-jt.stats[Jt].videoReceived.startTime},["packetsLostRatio"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].videoReceived.data,sn);mn.sampleCount=jt.stats[Jt].videoReceived.data.length,mn.time=Et.detail.stats.videoReceived.timestamp-jt.stats[Jt].videoReceived.startTime,jt.stats[Jt].videoReceived[sn]=mn}),jt.stats[Jt].videoReceived.mosV===void 0&&(jt.stats[Jt].videoReceived.mosV={}),["mosV"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].videoReceived.data,sn);mn.sampleCount=jt.stats[Jt].videoReceived.data.length,jt.stats[Jt].videoReceived[sn]=mn}),jt.stats[Jt].videoReceived.mosAV===void 0&&(jt.stats[Jt].videoReceived.mosAV={}),["mosAV"].forEach(function(sn){var mn=jt.evalQuartiles(jt.stats[Jt].videoReceived.data,sn);mn.sampleCount=jt.stats[Jt].videoReceived.data.length,jt.stats[Jt].videoReceived[sn]=mn}),jt.stats[Jt].videoReceived.width=Et.detail.stats.videoReceived.width,jt.stats[Jt].videoReceived.height=Et.detail.stats.videoReceived.height)):$n.error("video stats not pushed for callId :",Jt))},Vt=0;Vt1?(this.report.resolutions.push(Et[2]+": "+Et[0]+"x"+Et[1]),this.maxWidth=Et[0],this.maxHeight=Et[1],Pt.getTracks().forEach(function(Vt){Vt.stop()}),this.maybeContinueGetUserMedia()):$n.debug("No video track in returned stream.")}).bind(this)).catch((function(Pt){$n.debug("startGetUserMedia catch error:",Pt),this.resolutions.length>1?$n.debug(Et[0]+"x"+Et[1]+" not supported"):$n.error("getUserMedia failed with error: "+Pt.name),this.maybeContinueGetUserMedia()}).bind(this))},this.maybeContinueGetUserMedia=function(){this.currentResolution!==this.resolutions.length-1?(this.currentResolution++,this.startGetUserMedia(this.resolutions[this.currentResolution])):this.startNextTest()}},Cn=et.Y.get("ApiCCWebRTCClient"),Nn=function(qt){Cn.debug("apiCC.ApiCCWebRTCClient"),this.myWebRTC_Event=apiCC.myWebRTC_Event,this.webRTCClient=new zn(qt),this.webRTCClient.channelReady=!0,this.callTest=null,this.call=function(kt,st,Tt){return st==="RECORD"&&Cn.warn("DEPRECATED : usage of data parameter on call() as a string with 'RECORD' value will be deprecated in a next version of apiRTC. Please consider using a JSON Data parameter instead : data = {isRecorded : true}"),this.webRTCClient.recordedCall===!0&&(Cn.log("recordedCall option is activated"),st!==void 0&&st!=="RECORD"||(st={}),st.MCUType="MCU-Caller",st.confId=Math.floor(1000001*Math.random()).toString()),st!==void 0&&(st!=="RECORD"&&st.isRecorded!==!0||(Cn.log("recordedCall option is activated"),st==="RECORD"&&(st={}),st.MCUType="MCU-Caller",st.confId=Math.floor(1000001*Math.random()).toString())),Tt!=null&&Tt.record===!0&&(Cn.log("callConfiguration record option is activated"),st!==void 0&&st!=="RECORD"||(st={}),st.MCUType="MCU-Caller",st.confId=Math.floor(1000001*Math.random()).toString()),Cn.log("session.webRTCPluginActivated =",qt.webRTCPluginActivated),(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&qt.webRTCPluginActivated===!0?(Cn.log("managing call with WebRTC Plugin"),Tt==null&&(Tt={}),Tt.apzcallId=apiCC.generateCallId(),apiCC.manageWebRTCPlugin(function(){Cn.log("manageWebRTCPlugin cb in call"),apiCC.session.apiCCWebRTCClient.webRTCClient.callWithNumber(kt,!0,st,Tt)},function(){Cn.log("actionOnInstallationNeeded")}),Tt.apzcallId):(Cn.log("managing call with browser"),this.webRTCClient.callWithNumber(kt,!0,st,Tt))},this.getStatsFromCall=function(kt,st){var Tt=this.webRTCClient.findCallWithCallId(kt);Tt===null?st(new Error("Call was not found"),null):Tt.pc===null?st(new Error("Call has no peerconnection"),null):this.webRTCClient.csmEnable===!0?st(null,this.webRTCClient.csmLastResults):st(new Error("Call stats monitoring not activated"),null)},this.testCall=function(kt){return Cn.log("session.webRTCPluginActivated =",qt.webRTCPluginActivated),(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&qt.webRTCPluginActivated===!0?(Cn.log("managing call with WebRTC Plugin"),kt==null&&(kt={}),kt.apzcallId=apiCC.generateCallId(),apiCC.manageWebRTCPlugin(function(){Cn.log("manageWebRTCPlugin cb in call"),apiCC.session.apiCCWebRTCClient.webRTCClient.startTestCall(!0,kt)},function(){Cn.log("actionOnInstallationNeeded")}),kt.apzcallId):(Cn.log("managing call with browser"),this.webRTCClient.startTestCall(!0,kt))},this.setClientTurnServer=function(kt){this.webRTCClient.setClientTurnServer(kt)},this.activateScreenSharing=function(kt){this.webRTCClient.activateScreenSharing(kt)},this.shareScreen=function(kt,st,Tt){return Cn.info("shareScreen"),this.webRTCClient.shareScreen(kt,st,Tt)},this.startScreenSharingOnCall=function(kt,st){Cn.info("startScreenSharingOnCall"),this.webRTCClient.startScreenSharingOnCall(kt,st)},this.startDataChannel=function(kt,st){if(Cn.info("startDataChannel"),!(nt.Xh==="Edge"&&nt.PR<79&&apiRTC.browserDetails.type!=="chrome"))return st!==void 0?st.dataCall=!0:(st={}).dataCall=!0,this.webRTCClient.callWithNumber(kt,!0,st,null);Cn.warn("Cannot startDataChannel as it is not supported on Edge")},this.startDataChannelOnCall=function(kt){this.webRTCClient.startDataChannelOnCall(kt)},this.sendDataWithCallId=function(kt,st,Tt){this.webRTCClient.sendDataWithCallId(kt,st,Tt)},this.callAudio=function(kt,st,Tt){return Cn.info("callAudio"),this.webRTCClient.callWithNumber(kt,!1,st,Tt)},this.callbymail=function(kt){this.webRTCClient.callbymail(kt)},this.addMedia=function(kt){return this.webRTCClient.addMedia(kt),kt},this.hangUp=function(kt){this.webRTCClient.onHangup(kt)},this.getMyMedia=function(kt,st){Cn.info("getMyMedia : ",kt),kt==="screen"?this.webRTCClient.shareScreen("LOCAL",{},st):this.webRTCClient.getUserMedia()},this.releaseStream=function(kt){Cn.info("releaseStream : ",kt),Cn.info("releaseStream.callId : ",kt.callId),kt.callId!==void 0?this.webRTCClient.removeCallFromTableWithCallIdAndSendBye(kt.callId,"stop_ScreenSharing"):this.webRTCClient.stopStream(kt)},this.autoAnswerUserMediaSuccessHandler=function(kt){Cn.info("autoAnswerUserMediaSuccessHandler :"+kt),kt=null,this.webRTCClient.autoAnswer=!0},this.autoAnswerUserMediaErrorHandler=function(kt){Cn.info("autoAnswerUserMediaErrorHandler :"+kt),kt=null,this.webRTCClient.autoAnswer=!1},this.activateAutoAnswer=function(){apiCC.addEventListener("userMediaSuccess",this.callback(this,"autoAnswerUserMediaSuccessHandler")),apiCC.addEventListener("userMediaError",this.callback(this,"autoAnswerUserMediaErrorHandler")),this.webRTCClient.getUserMedia()},this.getAutoAnswer=function(){return this.webRTCClient.autoAnswer},this.setUnidirectionalCall=function(kt){kt===!0||kt===!1?this.webRTCClient.unidirectionelCallOnly=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setUnidirectionalCall()","PARAMETER_ERROR_SETUNIDIRCALL")},this.setReceiveMediaDeactivated=function(kt){kt===!0||kt===!1?this.webRTCClient.receiveMediaDeactivated=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setReceiveMediaDeactivated()","PARAMETER_ERROR_SETRECVMEDIADEACTIVATED")},this.setPreferVP9Codec=function(kt){kt===!0||kt===!1?this.webRTCClient.preferVP9Codec=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setPreferVP9Codec()","PARAMETER_ERROR_SETPREFERVP9CODEC")},this.setPreferH264Codec=function(kt){kt===!0||kt===!1?this.webRTCClient.preferH264Codec=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setPreferH264Codec()","PARAMETER_ERROR_SETPREFERH264CODEC")},this.getUnidirectionalCall=function(){return this.webRTCClient.unidirectionelCallOnly},this.toggleVideoMute=function(kt){return this.webRTCClient.toggleVideoMute(kt)},this.isVideoMuted=function(kt){var st;return Cn.debug("isVideoMuted :",kt),kt==null?this.webRTCClient.isVideoMuted:(Cn.debug("callId is defined :",kt),(st=this.webRTCClient.findCallIndexWithCallId(kt))!==-1?this.webRTCClient.callsTable[st].isLocalVideoMuted:void 0)},this.toggleAudioMute=function(kt){return this.webRTCClient.toggleAudioMute(kt)},this.sendDTMF=function(kt,st,Tt,Rt){return this.webRTCClient.sendDTMF(kt,st,Tt,Rt)},this.isAudioMuted=function(kt){var st;return Cn.debug("isAudioMuted :",kt),kt==null?this.webRTCClient.isAudioMuted:(Cn.debug("callId is defined :",kt),(st=this.webRTCClient.findCallIndexWithCallId(kt))!==-1?this.webRTCClient.callsTable[st].isLocalAudioMuted:void 0)},this.setNtoNConf=function(kt){kt===!0||kt===!1?this.webRTCClient.NtoNConf=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setNtoNConf()","PARAMETER_ERROR_SETNTONCONF")},this.getNtoNConf=function(){return this.webRTCClient.NtoNConf},this.setRTPMedia=function(kt){kt===!0||kt===!1?this.webRTCClient.RTPMedia=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setRTPMedia()","PARAMETER_ERROR_SETRTPMEDIA")},this.getRTPMedia=function(){return this.webRTCClient.RTPMedia},this.setMediaRoutingMode=function(kt){kt==="hostOnly"?this.webRTCClient.mediaRoutingMode=this.webRTCClient.mediaRoutingModeEnum.hostOnly:kt==="stun"?this.webRTCClient.mediaRoutingMode=this.webRTCClient.mediaRoutingModeEnum.stun:kt==="stunOnly"?this.webRTCClient.mediaRoutingMode=this.webRTCClient.mediaRoutingModeEnum.stunOnly:kt==="turn"?this.webRTCClient.mediaRoutingMode=this.webRTCClient.mediaRoutingModeEnum.turn:kt==="turnOnly"?this.webRTCClient.mediaRoutingMode=this.webRTCClient.mediaRoutingModeEnum.turnOnly:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setMediaRoutingMode()","PARAMETER_ERROR_SETMEDIAROUTINGMODE")},this.enableQos=function(kt,st){apiCC.browser!=="Chrome"&&apiCC.browser!=="Firefox"&&(Cn.warn("enableQos() is only supported on Chrome and Firefox, support on other browsers will be added soon"),kt=!1),Cn.info("this.enableQos="+kt),this.webRTCClient.qosEnable=kt,this.webRTCClient.qosInterval=st||this.webRTCClient.qosInterval},this.enableCallStatsMonitoring=function(kt,st){["chrome","firefox","safari"].indexOf(at.wL.type)<0?Cn.warn("enableCallStatsMonitoring() is only supported on Chrome, Firefox and Safari, support on other browsers will be added soon"):(this.webRTCClient.csmEnable=kt,st&&(this.webRTCClient.csmIntervalMs=st))},this.enableQualityEvaluating=function(kt,st){["chrome","firefox"].indexOf(at.wL.type)<0?Cn.warn("enableQualityEvaluating() is only supported on Chrome and Firefox, support on other browsers will be added soon"):(this.webRTCClient.qualityScoreEnable=kt,st&&(this.webRTCClient.qualityScoreIntervalMs=st))},this.getMediaRoutingMode=function(){var kt=null;return this.webRTCClient.mediaRoutingMode===this.webRTCClient.mediaRoutingModeEnum.hostOnly?kt="hostOnly":this.webRTCClient.mediaRoutingMode===this.webRTCClient.mediaRoutingModeEnum.stun?kt="stun":this.webRTCClient.mediaRoutingMode===this.webRTCClient.mediaRoutingModeEnum.stunOnly?kt="stunOnly":this.webRTCClient.mediaRoutingMode===this.webRTCClient.mediaRoutingModeEnum.turn?kt="turn":this.webRTCClient.mediaRoutingMode===this.webRTCClient.mediaRoutingModeEnum.turnOnly&&(kt="turnOnly"),kt},this.setMediaTypeForIncomingCall=function(kt){Cn.debug("setMediaTypeForIncomingCall :",kt),kt==="VIDEO"||kt==="AUDIO"||kt==="VIDEOONLY"||kt==="NONE"?this.webRTCClient.mediaTypeForIncomingCall=kt:Cn.log("setMediaTypeForIncomingCall, value is not correct",kt)},this.setMediaTypeForOutgoingCall=function(kt){Cn.debug("setMediaTypeForOutgoingCall :",kt),kt==="VIDEO"||kt==="AUDIO"||kt==="VIDEOONLY"||kt==="NONE"?this.webRTCClient.mediaTypeForOutgoingCall=kt:Cn.log("setMediaTypeForOutgoingCall, value is not correct",kt)},this.setStereo=function(kt){Cn.info("setStereo :",kt),kt===!0?(this.webRTCClient.setStereo=kt,this.webRTCClient.gum_config={audio:{mandatory:{echoCancellation:!1,googEchoCancellation:!1},optional:[]},video:{mandatory:{},optional:[]}}):kt===!1?this.webRTCClient.setStereo=kt:Cn.log("setStereo, value is not correct",kt)},this.setMCUConnector=function(kt){Cn.info("setMCUConnector :",kt),Cn.log("setting value :",kt),kt==="mcu4.apizee.com"?this.webRTCClient.MCUClient.pubConnector="janusConnector":kt==="mcu3.apizee.com"?this.webRTCClient.MCUClient.pubConnector="groupKurentoConnector":Cn.log("value is incorrect :",kt)},this.enableMeshRoomMode=function(kt){Cn.info("enableMeshRoomMode :",kt),nt.Xh==="IE"?(Cn.log("IE detected, MeshRoomMode is not supported"),this.webRTCClient.MCUClient.meshModeEnabled=!1):this.webRTCClient.MCUClient.meshModeEnabled=kt},this.setAllowAsymetricMediaCalls=function(kt){Cn.info("setAllowAsymetricMediaCalls :",kt),kt===!0||kt===!1?this.webRTCClient.allowAsymetricMediaCalls=kt:Cn.log("setAllowAsymetricMediaCalls, value is not correct",kt)},this.takeSnapshot=function(kt,st,Tt,Rt,Lt,Et,jt){this.webRTCClient.takeSnapshot(kt,st,qt.apiKey,Tt,Rt,Lt,Et,jt)},this.takeSnapshotAndSendOnDataChannel=function(kt,st,Tt,Rt){this.webRTCClient.takeSnapshotAndSendOnDataChannel(kt,st,Tt,Rt)},this.setUserAcceptOnIncomingCall=function(kt){Cn.info("setUserAcceptOnIncomingCall :",kt),kt===!0||kt===!1?this.webRTCClient.userAcceptOnIncomingCall=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setUserAcceptOnIncomingCall()","PARAMETER_ERROR_SETUSERACCEPTONINCOCALL")},this.setUserAcceptOnIncomingCallBeforeGetUserMedia=function(kt){Cn.info("setUserAcceptOnIncomingCallBeforeGetUserMedia :",kt),kt===!0||kt===!1?this.webRTCClient.userAcceptOnIncomingCallBeforeGetUserMedia=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setUserAcceptOnIncomingCallBeforeGetUserMedia()","PARAMETER_ERROR_SETUSERACCEPTONINCOCALLBEFOREGUM")},this.setUserAcceptOnIncomingDataCall=function(kt){kt===!0||kt===!1?this.webRTCClient.userAcceptOnIncomingDataCall=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setUserAcceptOnIncomingDataCall()","PARAMETER_ERROR_SETUSERACCEPTONINCOCALL")},this.setUserAcceptOnIncomingScreenSharingCall=function(kt){kt===!0||kt===!1?this.webRTCClient.userAcceptOnIncomingScreenSharingCall=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setUserAcceptOnIncomingScreenSharingCall()","PARAMETER_ERROR_SETUSERACCEPTONINCOSCREENSHARINGCALL")},this.setAllowMultipleCalls=function(kt){kt===!0||kt===!1?this.webRTCClient.allowMultipleCalls=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setAllowMultipleCalls()","PARAMETER_ERROR_SETALLOWMULTIPLECALLS")},this.setPcConfig=function(kt){Cn.info("Setting PC_config to :",kt),this.webRTCClient.pc_config=kt},this.setPcConstraints=function(kt){Cn.info("Setting PC_constraints to :"+kt),this.webRTCClient.pc_constraints=kt},this.setGetUserMediaConfig=function(kt){this.webRTCClient.setGetUserMediaConfig(kt)},this.setTrickleIce=function(kt){Cn.info("Setting trickleIce to :"+kt),kt===!0||kt===!1?this.webRTCClient.trickleIce=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setTrickleIce()","PARAMETER_ERROR_SETTRICKLEICE")},this.setRecordedCall=function(kt){kt===!0||kt===!1?this.webRTCClient.recordedCall=kt:this.myWebRTC_Event.createErrorEvent("parameter error when calling function : setRecordedCall()","PARAMETER_ERROR_SETRECORDEDCALL")},this.getRecordedCall=function(){return this.webRTCClient.recordedCall},this.acceptCall=function(kt,st){this.webRTCClient.acceptCall(kt,st)},this.refuseCall=function(kt){Cn.info("refuseCall"),this.webRTCClient.refuseCall(kt)},this.addVideoMedia=function(kt){Cn.info("addVideoMedia"),this.webRTCClient.addVideoMedia(kt)},this.updateMediaDeviceOnCall=function(kt,st){return Cn.info("updateMediaDeviceOnCall"),this.webRTCClient.updateMediaDeviceOnCall(kt,st)},this.updateMediaTypeOnCall=function(kt,st){return!(0,at.Ym)(kt,"string")||st!=="VIDEO"&&st!=="AUDIOONLY"&&st!=="VIDEOONLY"?Promise.reject("wrong arguments"):this.webRTCClient.updateMediaTypeOnCall(kt,st)},this.releaseUserMedia=function(){this.webRTCClient.releaseUserMedia()},this.setAllowedAudioCodecs=function(kt){this.webRTCClient.allowedAudioCodecs=kt},this.setAllowedVideoCodecs=function(kt){this.webRTCClient.allowedVideoCodecs=kt},this.setAudioBandwidth=function(kt){this.webRTCClient.setAudioBandwidth(kt)},this.setVideoBandwidth=function(kt){},this.setRemoteVideoBandwidth=function(kt){typeof kt=="number"?this.webRTCClient.setVideoBandwidth(kt,"remote"):Cn.error("Unvalid target bandwidth usage value needs to be a number :",kt)},this.setOverallIncomingVideoBandwidth=function(kt){typeof kt=="number"?this.webRTCClient.setVideoBandwidth(kt,"overall","incoming"):Cn.error("Unvalid target bandwidth usage value needs to be a number :",kt)},this.setOverallOutgoingVideoBandwidth=function(kt){typeof kt=="number"?this.webRTCClient.setVideoBandwidth(kt,"overall","outgoing"):Cn.error("Unvalid target bandwidth usage value needs to be a number :",kt)},this.setPerCallIncomingVideoBandwidth=function(kt){typeof kt=="number"?this.webRTCClient.setVideoBandwidth(kt,"perCall","incoming"):Cn.error("Unvalid target bandwidth usage value needs to be a number :",kt)},this.setPerCallOutgoingVideoBandwidth=function(kt){typeof kt=="number"?this.webRTCClient.setVideoBandwidth(kt,"perCall","outgoing"):Cn.error("Unvalid target bandwidth usage value needs to be a number :",kt)},this.setDataBandwidth=function(kt){this.webRTCClient.setDataBandwidth(kt)},this.createMCUSession=function(kt,st){Cn.info("createMCUSession"),this.webRTCClient.MCUClient.initDivElements(kt,st),this.webRTCClient.MCUClient.createSession()},this.joinMCUSession=function(kt){var st=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Cn.debug("joinMCUSession"),kt?this.webRTCClient.MCUClient.joinSession(kt,st):new Error("wrong roomId")},this.getMCUStreamList=function(){return Cn.debug("getMCUStreamList"),this.webRTCClient.MCUClient.getStreamList()},this.getStreamFromList=function(kt){return Cn.debug("getStreamFromList"),this.webRTCClient.MCUClient.getStreamFromList(kt)},this.getStreamIdOfUser=function(kt){return Cn.debug("getStreamIdOfUser"),this.webRTCClient.MCUClient.getStreamIdOfUser(kt)},this.getCallIdFromStreamId=function(kt){Cn.debug("getCallIdFromStreamId");var st=this.webRTCClient.findCallWithStreamId(kt);return st===null?(Cn.log("call not found in getCallIdFromStreamId"),null):st.callId},this.getCallIdFromRemoteMCUUser=function(kt){var st,Tt;return Cn.debug("getCallIdFromRemoteMCUUser"),st=this.webRTCClient.MCUClient.getStreamIdOfUser(kt),(Tt=this.webRTCClient.findCallWithStreamId(st))===null?(Cn.log("call not found in getCallIdFromRemoteMCUUser"),null):Tt.callId},this.ejectParticipantFromMCUSession=function(kt,st,Tt){this.webRTCClient.MCUClient.ejectParticipant(kt,st,Tt)},this.publish=function(kt,st,Tt,Rt,Lt,Et){if(nt.Xh==="IE"&&(Cn.log("apiCC.session.webRTCPluginActivated ="+apiCC.session.webRTCPluginActivated),Cn.log("apiCC.webRTCPluginInstalled ="+apiCC.webRTCPluginInstalled)),(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&apiCC.session.webRTCPluginActivated===!0&&apiCC.webRTCPluginInstalled===!1)return Cn.log("managing call with WebRTC Plugin"),Rt==null&&(Rt={}),Rt.apzcallId=apiCC.generateCallId(),apiCC.manageWebRTCPlugin(function(){apiCC.webRTCPluginInstalled=!0,Cn.info("manageWebRTCPlugin cb in call");var Pt=this.webRTCClient.MCUClient.getSessionMCU(kt);return Pt&&Pt.roomMode==="mesh"?this.webRTCClient.MCUClient.meshPublish(kt,st,Tt,Rt,Lt,Et):(Cn.debug("publish"),this.webRTCClient.MCUClient.publish(kt,st,Tt,Rt,Lt,Et))},function(){Cn.log("actionOnInstallationNeeded")}),Rt.apzcallId;var jt=this.webRTCClient.MCUClient.getSessionMCU(kt);return jt&&jt.roomMode==="mesh"?this.webRTCClient.MCUClient.meshPublish(kt,st,Tt,Rt,Lt,Et):(Cn.debug("publish"),this.webRTCClient.MCUClient.publish(kt,st,Tt,Rt,Lt,Et))},this.unpublish=function(kt){Cn.info("unpublish"),this.webRTCClient.MCUClient.unpublish(kt)},this.publishScreen=function(kt,st,Tt,Rt){var Lt=this.webRTCClient.MCUClient.getSessionMCU(kt);return Lt&&Lt.roomMode==="mesh"?(Cn.info("publishScreen"),this.webRTCClient.MCUClient.meshPublishScreen(kt,st,Tt,Rt)):(Cn.info("publishScreen"),this.webRTCClient.MCUClient.publishScreen(kt,st,Tt,Rt))},this.subscribe=function(kt,st,Tt,Rt,Lt){return Cn.info("subscribe :",kt),nt.Xh==="IE"&&(Cn.log("apiCC.session.webRTCPluginActivated ="+apiCC.session.webRTCPluginActivated),Cn.log("apiCC.webRTCPluginInstalled ="+apiCC.webRTCPluginInstalled)),(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&apiCC.session.webRTCPluginActivated===!0&&apiCC.webRTCPluginInstalled===!1?(Cn.log("managing call with WebRTC Plugin"),apiCC.manageWebRTCPlugin(function(){return apiCC.webRTCPluginInstalled=!0,Cn.log("manageWebRTCPlugin cb in subscribe"),typeof st=="boolean"&&(Cn.warn("DEPRECATED : usage of audioOnly parameter on subscribe() is now replaced by mediatype with value VIDEO, AUDIOONLY or VIDEOONLY and will be deprecated in a next version of apiRTC"),st=st===!0?"AUDIOONLY":"VIDEO"),apiCC.session.apiCCWebRTCClient.subscribe(kt,st,Tt,Rt)},function(){Cn.log("actionOnInstallationNeeded")}),"WebRTC_Plugin"):(typeof st=="boolean"&&(Cn.warn("DEPRECATED : usage of audioOnly parameter on subscribe() is now replaced by mediatype with value VIDEO, AUDIOONLY or VIDEOONLY and will be deprecated in a next version of apiRTC"),st=st===!0?"AUDIOONLY":"VIDEO"),this.webRTCClient.MCUClient.subscribeToStreams(kt,st,Tt,Rt,Lt))},this.unsubscribe=function(kt){Cn.info("unsubscribe :",kt),this.webRTCClient!==null&&this.webRTCClient.MCUClient!==null&&this.webRTCClient.MCUClient.unsubscribe(kt)},this.startStreaming=function(kt,st,Tt,Rt){return Cn.info("startStreaming"),this.webRTCClient.MCUClient.startStreaming(kt,st,Tt,Rt)},this.stopStreaming=function(kt){return Cn.info("stopStreaming"),this.webRTCClient.MCUClient.stopStreaming(kt)},this.startRecording=function(kt,st,Tt,Rt,Lt){Cn.info("startRecording"),this.webRTCClient.MCUClient.startRecording(kt,st,Tt,Rt,Lt)},this.stopRecording=function(kt){Cn.info("stopRecording"),this.webRTCClient.MCUClient.stopRecording(kt)},this.changeStreamPriority=function(kt,st){var Tt=this.webRTCClient.findCallWithCallId(kt);if(!Tt&&!(Tt=this.webRTCClient.findUserMediaById(kt)))return Cn.error("changeStreamPriority - no such call",kt),!1;if(!Tt.sessionMCU)return Cn.error("changeStreamPriority - no such sessionMCU"),!1;if(!(0,at.Ym)(st,"number")||st<0)return Cn.error("changeStreamPriority - wrong priority",st),!1;var Rt=JSON.stringify({type:"changeStreamPriority",roomId:Tt.sessionMCU.roomName,callerId:apiCC.session.apiCCWebRTCClient.webRTCClient.clientId,callId:kt,data:{pubSub:this.webRTCClient.MCUClient.pubConnector,priority:st}});return Cn.log("C->S: "+Rt),apiCC.session.channel.socket.emit("changeStreamPriority",Rt),!0},this.startComposite=function(kt){Cn.info("startComposite"),this.webRTCClient.MCUClient.startComposite(kt)},this.stopComposite=function(kt){Cn.info("stopComposite"),this.webRTCClient.MCUClient.stopComposite(kt)},this.startCompositeRecording=function(kt,st,Tt,Rt,Lt){Cn.info("startCompositeRecording"),this.webRTCClient.MCUClient.startCompositeRecording(kt,st,Tt,Rt,Lt)},this.stopCompositeRecording=function(kt){Cn.info("stopCompositeRecording"),this.webRTCClient.MCUClient.stopCompositeRecording(kt)},this.checkCallExist=function(kt){for(var st=null,Tt=this.webRTCClient.callsTable.length;--Tt>=0;){var Rt=this.webRTCClient.callsTable[Tt];if(Rt.callId===kt&&Rt.data&&Rt.sessionMCU&&(Rt.data.MCUType==="MCU-Caller"||Rt.data.MCUType==="MCU-Callee")&&Rt.data.confId===Rt.sessionMCU.roomName){st=Rt;break}}return st||Cn.error("startCallRecording: no such call"),st},this.startCallRecording=function(kt){var st;if(st=this.checkCallExist(kt)){var Tt=(0,at.ws)({},st.data);this.webRTCClient.MCUClient.startCompositeRecording("AUDIO-VIDEO",null,st.sessionMCU.convId,Tt,st.sessionMCU.roomName)}},this.stopCallRecording=function(kt){var st;(st=this.checkCallExist(kt))&&this.webRTCClient.MCUClient.stopCompositeRecording(st.sessionMCU.roomName)},this.enforceMCU=function(kt){this.webRTCClient.MCUClient.enforceMCU(kt)},this.takeSnapshotOnMCUSession=function(kt){return Cn.info("takeSnapshotOnMCUSession"),this.webRTCClient.MCUClient.takeSnapshot(kt)},this.sendMCUSessionInvitation=function(kt,st,Tt){this.webRTCClient.MCUClient.sendSessionInvitation(kt,st,Tt)},this.sendMCUSessionInvitationToGroupChat=function(kt,st){this.webRTCClient.MCUClient.sendSessionInvitationToGroupChat(kt,st)},this.acceptMCUSessionInvitation=function(kt,st,Tt,Rt){this.webRTCClient.MCUClient.initDivElements(Tt,Rt),this.webRTCClient.MCUClient.acceptSessionInvitation(kt,st)},this.leaveMCUSession=function(kt){this.webRTCClient.MCUClient.leaveSession(kt)},this.recordStream=function(kt){Cn.info("recordStream :",kt),MediaRecorder!==void 0?apiCC.recordMgr.record(kt).then(function(){Cn.log("Recording started")}).catch(function(st){Cn.error("startRecord failed :",st)}):Cn.debug("MediaRecorder is not supported on this browser, leaving recordStream process")},this.stopRecordStream=function(kt){Cn.info("stopRecordStream"),MediaRecorder!==void 0?apiCC.recordMgr.stop().then(function(st){Cn.log("Recording stopped"),kt(st)}).catch(function(st){Cn.error("stopRecord failed :",st)}):Cn.debug("MediaRecorder is not supported on this browser, leaving recordStream process")},this.getMediaDevices=function(kt){Cn.debug("getMediaDevices 2"),apiCC.getMediaDevices().then(function(st){kt(st),apiCC.mediaDeviceMgr.gotSources(st)}).catch(function(st){kt(null),apiCC.mediaDeviceMgr.gotSources(null)})},this.setAudioSourceId=function(kt){Cn.info("setAudioSourceId :"+kt),this.webRTCClient.audioSourceId=kt},this.setAudioOutputId=function(kt){Cn.info("setaudioOutputId :"+kt),this.webRTCClient.audioOutputId=kt},this.setVideoSourceId=function(kt){Cn.info("setVideoSourceId :"+kt),this.webRTCClient.videoSourceId=kt},this.setVideoFacingMode=function(kt){Cn.info("setVideoFacingMode :"+kt),kt==="user"||kt==="environment"||kt==="left"||kt==="right"||kt==="deactivated"?this.webRTCClient.facingMode=kt==="deactivated"?null:kt:Cn.log("facingMode value is not correct")},this.attachMediaStream=function(kt,st){Cn.debug("attachMediaStream"),apiCC.attachMediaStream(kt,st)},this.addStreamInDiv=function(kt,st,Tt,Rt,Lt,Et){Cn.debug("addStreamInDiv"),apiCC.addStreamInDiv(kt,st,Tt,Rt,Lt,Et)},this.removeElementFromDiv=function(kt,st){Cn.debug("removeElementFromDiv"),apiCC.removeElementFromDiv(kt,st)},this.setSelectedStream=function(kt){Cn.warn("setSelectedStream() is now deprecated")},this.callback=function(kt,st){return this.closureHandler=function(Tt){return kt[st](Tt)},this.closureHandler},this.startPrecallTest=function(kt,st,Tt,Rt,Lt){var Et={webRTCClient:this,notifyTerminated:kt};this.callTest=new Wn(Et,st,Tt,Rt,Lt),this.callTest.runBitRateTest()}}},6527:(rt,it,s)=>{s.d(it,{p:()=>nt}),s(3843),s(3710),s(7941),s(4916),s(2772),s(2564),s(561),s(1058),s(9653),s(3290),s(6755),s(3123),s(2222),s(4812);var et=s(1549).Y.get("ApiCCWhiteBoardClient"),nt=function(at,ht,dt,ut,lt){function mt(ot){ot.style.display="none"}et.debug("Loading apiCC.ApiCCWhiteBoardClient"),this.roomId=null,this.whiteBoardDisconnectionTimeoutId=0,this.sessionStarted=!1,this.prev={},this.lastEmit=Date.now(),this.clients={},this.listenedPeers={},this.touchScreenActivated=!1,this.touchControlPoint={},this.drawElements=[],this.ghostElements={},this.redoStack=[],this.undoIndex=0,this.userCursorColor=null,this.cursors={},this.cursorStyle="cross",this.CURSOR_STYLES=["circle","cross"],this.currentScale=1,this.dx=0,this.dy=0,this.instructionsFaded=!1,this.canvas=null,this.ctx=null,this.currentTool="pen",this.currentColor="rgba(0, 0, 0, 1)",this.currentBrushWidth=1,this.readOnly=!1,this.isDrawing=!1,this.focusOnDrawing=!1,this.paperSheetId=0,this.drawingId=0,this.offline=!1,this.roomJoined=!1,this.laserModeActivated=!1,this.AVAILABLE_TOOLS=["pen","ellipse","rectangle","erase","void","arrow"],this.GEOMETRY_TOOLS=["arrow","rectangle","ellipse"],this.disconnectionTimer=lt!==void 0?lt:3e4,et.log("Setting Whiteboard disconnectionTimer to : "+this.disconnectionTimer),this.setCanvas=function(ot){et.debug("[Whiteboard] setCanvas() :",ot),this.canvas!==null&&(et.log("Unsetting old canvas events"),this.sessionStarted&&!this.readOnly&&(this.canvas.onmousedown=null,this.canvas.onmouseup=null,this.canvas.onmouseleave=null,this.canvas.onmousemove=null,this.touchScreenActivated&&(this.canvas.removeEventListener("touchstart",this.onTouchStart,!1),this.canvas.removeEventListener("touchend",this.onTouchEnd,!1),this.canvas.removeEventListener("touchcancel",this.onTouchCancel,!1),this.canvas.removeEventListener("touchleave",this.onTouchEnd,!1),this.canvas.removeEventListener("touchmove",this.onTouchMove,!1)))),ot!==null&&document.getElementById(ot)!==null?(this.canvas=document.getElementById(ot),this.ctx=this.canvas.getContext("2d"),this.sessionStarted&&!this.readOnly&&(this.canvas.onmousedown=this.onmousedown,this.canvas.onmouseup=this.onmouseup,this.canvas.onmouseleave=this.onmouseleave,this.canvas.onmousemove=this.onmousemove,this.touchScreenActivated&&(this.canvas.addEventListener("touchstart",this.onTouchStart,!1),this.canvas.addEventListener("touchend",this.onTouchEnd,!1),this.canvas.addEventListener("touchcancel",this.onTouchCancel,!1),this.canvas.addEventListener("touchleave",this.onTouchEnd,!1),this.canvas.addEventListener("touchmove",this.onTouchMove,!1)))):(ot!==null&&document.getElementById(ot)===null&&et.warn("No such element whose id is : "+ot),this.canvas=null,this.ctx=null)},this.setCanvas(ht),this.sendDataToRoom=function(ot){if(et.info("[Whiteboard] sendDataToRoom()"),this.offline===!1&&this.roomId!==null){if(apiCC.session===null||apiCC.session===void 0)return void et.info("apiCC.session does not exist, leaving process");et.debug("this.drawElements :",this.drawElements),et.debug("data.tool :",ot.tool);var pt=[];et.debug("drawElementsToSend :",pt);var ft,yt={x:0,y:0,drawing:!1,tool:this.currentTool,cursorColor:this.userCursorColor,color:this.currentColor,width:this.currentBrushWidth,paperSheetId:this.paperSheetId,drawElements:pt,id:apiCC.session.apiCCId},vt=Object.keys(ot);for(ft=0;ft-1?(this.userCursorColor="invisible",this.cursorStyle=ot):et.error("[Whiteboard] setCursorStyle() style "+ot+" is invalid")},this.setFocusOnDrawing=function(ot){et.debug("[Whiteboard] setFocusOnDrawing()"),this.focusOnDrawing=ot},this.createRoom=function(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et.debug("[Whiteboard] createRoom()"),apiCC.session.roomMgr.createRoom("whiteBoard",ot)},this.requestContactListInRoom=function(ot){et.log("[Whiteboard] requestContactListInRoom :"+ot),apiCC.session.roomMgr.requestContactListInRoom(ot)},this.setDrawingTool=function(ot){et.debug("[Whiteboard] setDrawingTool()");var pt=0;apiCC.session!==null&&(pt=apiCC.session.apiCCId),this.AVAILABLE_TOOLS.indexOf(ot)>-1&&(this.currentTool=ot,this.ghostElements[pt]=null)},this.setReadOnly=function(ot){et.debug("[Whiteboard] setReadOnly()");var pt=0;apiCC.session!==null&&(pt=apiCC.session.apiCCId),this.ghostElements[pt]=null,this.readOnly=ot===!0,this.readOnly&&this.canvas!==null?(this.canvas.onmousedown=null,this.canvas.onmouseup=null,this.canvas.onmouseleave=null,this.canvas.onmousemove=null,this.touchScreenActivated&&(this.canvas.removeEventListener("touchstart",this.onTouchStart,!1),this.canvas.removeEventListener("touchend",this.onTouchEnd,!1),this.canvas.removeEventListener("touchcancel",this.onTouchCancel,!1),this.canvas.removeEventListener("touchleave",this.onTouchEnd,!1),this.canvas.removeEventListener("touchmove",this.onTouchMove,!1))):this.canvas!==null&&(this.canvas.onmousedown=this.onmousedown,this.canvas.onmouseup=this.onmouseup,this.canvas.onmouseleave=this.onmouseleave,this.canvas.onmousemove=this.onmousemove,this.touchScreenActivated&&(this.canvas.addEventListener("touchstart",this.onTouchStart,!1),this.canvas.addEventListener("touchend",this.onTouchEnd,!1),this.canvas.addEventListener("touchcancel",this.onTouchCancel,!1),this.canvas.addEventListener("touchleave",this.onTouchEnd,!1),this.canvas.addEventListener("touchmove",this.onTouchMove,!1)))},this.laserModeProcess=function(ot){var pt=this;setTimeout(function(){return pt.undo(ot)},5e3)},this.undo=function(ot){et.debug("[Whiteboard] undo()");var pt=this.drawElements.length-1,ft=null,yt=[],vt=[],bt=null,At=0;if(apiCC.session!==null&&(At=apiCC.session.apiCCId),ot===void 0)for(;pt>=0;)this.drawElements[pt].userId==At&&(ft===null&&(ft=this.drawElements[pt].undoIndex),ft===this.drawElements[pt].undoIndex&&(bt=this.drawElements.splice(pt,1)[0],yt.push(bt),vt.push(bt.drawingId))),pt--;else for(pt=0;pt0&&(this.redraw(),this.sendDataToRoom({tool:"void",delete:vt,undoneElements:yt}),this.redoStack.push(yt))},this.redo=function(){et.debug("[Whiteboard] redo()");var ot,pt=[];if(this.redoStack.length>0){for(pt=this.redoStack.pop(),ot=0;ot0&&(this.currentBrushWidth=ot)},this.setBrushColor=function(ot){et.debug("[Whiteboard] setBrushColor()"),this.currentColor=ot},this.setScale=function(ot){et.debug("[Whiteboard] setScale()"),ot>0?(this.currentScale=ot,this.redraw()):et.warn("Scale factor must be > 0!")},this.getScale=function(){return et.debug("[Whiteboard] getScale()"),this.currentScale},this.setOffset=function(ot,pt){et.debug("[Whiteboard] setOffset()");var ft=parseInt(ot,10),yt=parseInt(pt,10);isNaN(ft)||isNaN(yt)||(this.dx=Number(ft),this.dy=Number(yt),this.redraw())},this.getOffset=function(){return et.debug("[Whiteboard] getOffset()"),{x:this.dx,y:this.dy}},this.printSharedText=function(ot,pt,ft,yt,vt,bt){et.debug("[Whiteboard] printSharedText()"),this.setBrushStyle(this.currentColor,this.currentBrushWidth),this.undoIndex++,this.redoStack=[];var At=0;apiCC.session!==null&&(At=apiCC.session.apiCCId);var Nt={type:"text",x:ot,y:pt,text:ft,size:yt,font:vt,border:bt,userId:At,drawingId:this.drawingId,color:this.currentColor,width:this.currentBrushWidth,undoIndex:this.undoIndex,time:Date.now()};this.sendDataToRoom({x:ot,y:pt,tool:"void",drawObject:Nt}),this.drawingId++,this.addNewDrawing(Nt)},this.addPeerListener=function(ot,pt){et.debug("[Whiteboard] addPeerListener()"),this.listenedPeers.hasOwnProperty(ot)||(this.listenedPeers[ot]=[]),this.listenedPeers[ot].push(pt)},this.inviteInRoom=function(ot,pt,ft){var yt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};et.debug("[Whiteboard] inviteInRoom()"),ot!==null?pt!==null?apiCC.session.roomMgr.inviteInRoom(ot,pt,"whiteBoard",ft,yt):et.debug("wrong destId"):et.debug("wrong roomId")},this.answerToRoomInvitation=function(ot,pt){et.info("[Whiteboard] answerToRoomInvitation()");var ft=pt&&!this.isInRoom();return this.isInRoom()?et.error("[Whiteboard] cannot answer room invitation : user is already in a room"):apiCC.session.roomMgr.answerToRoomInvitation(ot,pt,"whiteBoard"),ft&&(et.log("[Whiteboard] user joining room"),this.paperSheetId=0,this.drawingId=0,this.roomId=ot,this.sendDataToRoom({tool:"void",needCatchUp:"*||-1"})),ft},this.joinRoom=function(ot){var pt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};et.info("[Whiteboard] joinRoom() roomId :",ot),ot==null?et.error("[Whiteboard] cannot join room : room is null or undefined"):this.isInRoom()&&this.roomJoined===!0?et.error("[Whiteboard] cannot join room : user is already in a room"):apiCC.session.roomMgr.joinRoom(ot,"whiteBoard",pt)},this.leaveRoom=function(){et.info("[Whiteboard] leaveRoom()"),this.isInRoom()&&(apiCC.session.roomMgr.leaveRoom(this.roomId,"whiteBoard"),this.roomId=null,this.paperSheetId=0,this.drawingId=0,this.listenedPeers={},this.roomJoined=!1)},this.isInRoom=function(){return this.roomId!==null},this.clearPaper=function(){et.debug("[Whiteboard] clearPaper()"),this.deleteHistory()},this.refreshCanvas=function(){if(this.canvas!==null&&this.ctx!==null){var ot=this.canvas.width;this.canvas.width=ot}},this.deleteHistory=function(){et.info("[Whiteboard] deleteHistory()");var ot=0;apiCC.session!==null&&(ot=apiCC.session.apiCCId),this.refreshCanvas(),this.drawElements=[],this.ghostElements[ot]=null,this.paperSheetId++,this.drawingId=0,this.sendDataToRoom({tool:"void",deleteHistory:!0})},this.setBrushStyle=function(ot,pt){this.ctx!==null&&(this.ctx.strokeStyle=ot,this.ctx.fillStyle=ot,this.ctx.lineWidth=pt)},this.redraw=function(){var ot,pt,ft;for(et.debug("[Whiteboard] redraw()"),this.refreshCanvas(),ot=0;otft&&(vt=ft),pt>yt&&(bt=yt),this.ctx.rect(vt,bt,Math.abs(ot-ft),Math.abs(pt-yt)),this.ctx.stroke()}},this.getContext=function(){return this.ctx},this.loadPhotoInBackground=function(ot){et.debug("[Whiteboard] loadPhotoInBackground :"+ot);var pt=document.getElementsByTagName("body")[0];pt.style.backgroundImage="url("+ot+")",pt.style.backgroundPosition="50% 50%",pt.style.backgroundRepeat="no-repeat"},this.messageProcessing=function(ot){et.debug("[Whiteboard] messageProcessing");var pt,ft=null,yt=null,vt=!1,bt=null,At=null,Nt=null,St=null,wt=null;if(this.cursors[ot.id]||(et.log("[Whiteboard] messageProcessing - creating cursor for new user : "+ot.id),this.cursors[ot.id]={id:ot.id},this.clients[ot.id]={}),this.cursors[ot.id].x=ot.x,this.cursors[ot.id].y=ot.y,this.cursors[ot.id].lastUpdate=Date.now(),ot.cursorColor&&ot.cursorColor!==null?this.cursors[ot.id].color=ot.cursorColor:this.cursors[ot.id].color="invisible",apiRTC.userAgentInstance===void 0||apiRTC.userAgentInstance.capabilities.whiteboardCursor==="ON"?this.cursors[ot.id].color!=="invisible"&&(vt=!0):(et.debug("[Whiteboard] - cursor is not supported on userAgent"),this.cursors[ot.id].color="invisible"),this.ghostElements[ot.id]!==null&&(this.ghostElements[ot.id]=null,vt=!0),this.listenedPeers.hasOwnProperty(ot.id))for(bt={id:ot.id,x:ot.x,y:ot.y,tool:ot.tool,drawing:ot.drawing},pt=0;pt-1?ot.prevX&&ot.prevY&&(this.ghostElements[ot.id]=yt,vt=!0):this.addNewDrawing(yt),this.focusOnDrawing&&((ft=this.canvas.parentNode).scrollLeft=this.currentScale*(ot.x-this.dx)-ft.clientWidth/2,ft.scrollTop=this.currentScale*(ot.y-this.dy)-ft.clientHeight/2)),ot.drawObject&&((yt=ot.drawObject).color=ot.color,yt.width=ot.width,this.ghostElements[ot.id]=null,this.addNewDrawing(yt),this.focusOnDrawing&&((ft=this.canvas.parentNode).scrollLeft=this.currentScale*(ot.x-this.dx)-ft.clientWidth/2,ft.scrollTop=this.currentScale*(ot.y-this.dy)-ft.clientHeight/2)),ot.hasOwnProperty("drawObjectsArray"))for(pt=0;pt=0;)ot.delete.indexOf(this.drawElements[pt].drawingId)>-1&&this.drawElements[pt].userId==ot.id&&this.drawElements.splice(pt,1),pt--;if(ot.hasOwnProperty("paperSheetId")){if(ot.paperSheetIdthis.paperSheetId){if(et.debug("[Whiteboard] - messageProcessing : peer has a more recent version : "+this.paperSheetId+" vs "+ot.paperSheetId),ot.hasOwnProperty("deleteHistory")&&et.debug("User : "+ot.id+" ,has deleted the history"),ot.hasOwnProperty("drawElements")){for(et.debug("[Whiteboard] - messageProcessing : receiving update from peer"),ot.drawElements!==null?this.drawElements=ot.drawElements:this.drawElements=[],pt=0;pt1)et.log("[Whiteboard] - messageProcessing : catchup from peer required : "+ot.drawingId),St=ot.id+"||-1",this.clients[ot.id]!==void 0&&this.clients[ot.id].hasOwnProperty("drawingId")&&(St=ot.id+"||"+this.clients[ot.id].drawingId),this.sendDataToRoom({tool:"void",needCatchUp:St});else if(ot.hasOwnProperty("needCatchUp")&&(ot.needCatchUp.startsWith(apiCC.session.apiCCId+"||")||ot.needCatchUp.startsWith("*||"))){for(et.debug("[Whiteboard] - messageProcessing : letting peer catchup: "+ot.id),At=ot.needCatchUp.split("||")[1],Nt=[],pt=0;ptparseInt(At,10)&&Nt.push(wt);this.sendDataToRoom({tool:"void",catchUpData:Nt,catchupIndex:At})}else et.debug("[Whiteboard] - else - drawingId");else if(ot.hasOwnProperty("needCatchUp")){for(et.debug("[Whiteboard] - messageProcessing : needCatchUp"+ot.id),At=ot.needCatchUp.split("||")[1],Nt=[],pt=0;pt-1&&(yt=(ft=ot.target||ot.srcElement).currentStyle||window.getComputedStyle(ft,null),vt=parseInt(yt.borderLeftWidth,10)||0,bt=parseInt(yt.borderTopWidth,10)||0,At=ft.getBoundingClientRect(),Nt.offsetX=this.dx+1/this.currentScale*(ot.clientX-vt-At.left),Nt.offsetY=this.dy+1/this.currentScale*(ot.clientY-bt-At.top),apiCC.session!==null&&(St=apiCC.session.apiCCId),pt={type:this.currentTool,fromx:this.prev.x,fromy:this.prev.y,tox:Nt.offsetX,toy:Nt.offsetY,color:this.currentColor,width:this.currentBrushWidth,userId:St,undoIndex:this.undoIndex,time:Date.now()},this.sendDrawingData(Nt,this.isDrawing,pt),this.ghostElements[St]=null,this.redraw(),this.addNewDrawing(pt),this.prev.x=Nt.offsetX,this.prev.y=Nt.offsetY),this.isDrawing=!1,this.ghostElements[St]=null}).bind(this),this.onmouseleave=(function(){var ot=0;apiCC.session!==null&&(ot=apiCC.session.apiCCId),this.isDrawing=!1,this.sendDrawingData({offsetX:0,offsetY:0},this.isDrawing,null),this.ghostElements[ot]=null}).bind(this),this.onmousemove=(function(ot){var pt,ft,yt,vt,bt,At=null,Nt={};if(pt=(At=ot.target||ot.srcElement).currentStyle||window.getComputedStyle(At,null),ft=parseInt(pt.borderLeftWidth,10)||0,yt=parseInt(pt.borderTopWidth,10)||0,vt=At.getBoundingClientRect(),Nt.offsetX=this.dx+1/this.currentScale*(ot.clientX-ft-vt.left),Nt.offsetY=this.dy+1/this.currentScale*(ot.clientY-yt-vt.top),Date.now()-this.lastEmit>30)if(this.sendDrawingData(Nt,this.isDrawing,null),this.lastEmit=Date.now(),this.isDrawing){var St=0;apiCC.session!==null&&(St=apiCC.session.apiCCId),bt={type:this.currentTool,fromx:this.prev.x,fromy:this.prev.y,color:this.currentColor,width:this.currentBrushWidth,userId:St,undoIndex:this.undoIndex,time:Date.now()},this.currentTool==="pen"||this.currentTool==="erase"?(this.currentTool==="pen"&&(bt.tox=Nt.offsetX,bt.toy=Nt.offsetY),bt.drawingId=this.drawingId,this.drawingId++,this.addNewDrawing(bt),this.prev.x=Nt.offsetX,this.prev.y=Nt.offsetY):this.GEOMETRY_TOOLS.indexOf(this.currentTool)>-1&&(bt.tox=Nt.offsetX,bt.toy=Nt.offsetY,this.ghostElements[St]=bt),this.currentTool!=="pen"&&this.redraw()}else this.currentTool==="erase"&&(this.redraw(),bt={type:"rectangle",fromx:Nt.offsetX-this.currentBrushWidth,fromy:Nt.offsetY-this.currentBrushWidth,tox:parseInt(Nt.offsetX,10)+parseInt(this.currentBrushWidth,10),toy:parseInt(Nt.offsetY,10)+parseInt(this.currentBrushWidth,10),color:"#444444",width:1},this.drawSingleObject(bt),bt.color="#DDDDDD",bt.fromx=bt.fromx-1,bt.fromy=bt.fromy-1,bt.tox=bt.tox+1,bt.toy=bt.toy+1,this.drawSingleObject(bt))}).bind(this),this.onTouchStart=(function(ot){et.debug("[Whiteboard] handleStart"),ot.preventDefault();var pt,ft=ot.changedTouches,yt={};this.isDrawing=!0,this.undoIndex++,this.redoStack=[],(yt=this.getTouchOffSet(ft[0])).offsetX=this.dx+1/this.currentScale*yt.offsetX,yt.offsetY=this.dy+1/this.currentScale*yt.offsetY,this.prev.x=yt.offsetX,this.prev.y=yt.offsetY,this.sendDrawingData(yt,!1,null),(pt=document.getElementById(ut))!==null&&mt(pt)}).bind(this),this.onTouchEnd=(function(ot){et.debug("[Whiteboard] handleEnd :"+ot);var pt,ft={},yt=ot.changedTouches,vt=0;this.isDrawing&&this.GEOMETRY_TOOLS.indexOf(this.currentTool)>-1&&((ft=this.getTouchOffSet(yt[0])).offsetX=this.dx+1/this.currentScale*ft.offsetX,ft.offsetY=this.dy+1/this.currentScale*ft.offsetY,apiCC.session!==null&&(vt=apiCC.session.apiCCId),pt={type:this.currentTool,fromx:this.prev.x,fromy:this.prev.y,tox:ft.offsetX,toy:ft.offsetY,color:this.currentColor,width:this.currentBrushWidth,userId:vt,undoIndex:this.undoIndex,time:Date.now()},this.sendDrawingData(ft,this.isDrawing,pt),this.addNewDrawing(pt),this.prev.x=ft.offsetX,this.prev.y=ft.offsetY),this.isDrawing=!1,this.ghostElements[vt]=null,ot=null}).bind(this),this.onTouchCancel=(function(ot){et.debug("[Whiteboard] handleCancel :"+ot);var pt=0;apiCC.session!==null&&(pt=apiCC.session.apiCCId),this.isDrawing=!1,this.ghostElements[pt]=null,ot=null}).bind(this),this.onTouchMove=(function(ot){et.debug("[Whiteboard] handleMove :"+ot);var pt,ft=ot.changedTouches,yt={};if(Date.now()-this.lastEmit>30&&((yt=this.getTouchOffSet(ft[0])).offsetX=this.dx+1/this.currentScale*yt.offsetX,yt.offsetY=this.dy+1/this.currentScale*yt.offsetY,this.sendDrawingData(yt,this.isDrawing,null),this.lastEmit=Date.now(),this.isDrawing)){(yt=this.getTouchOffSet(ft[0])).offsetX=this.dx+1/this.currentScale*yt.offsetX,yt.offsetY=this.dy+1/this.currentScale*yt.offsetY;var vt=0;apiCC.session!==null&&(vt=apiCC.session.apiCCId),pt={type:this.currentTool,fromx:this.prev.x,fromy:this.prev.y,color:this.currentColor,width:this.currentBrushWidth,userId:vt,undoIndex:this.undoIndex,time:Date.now()},this.currentTool==="pen"||this.currentTool==="erase"?(this.currentTool==="pen"&&(pt.tox=yt.offsetX,pt.toy=yt.offsetY),pt.drawingId=this.drawingId,this.drawingId++,this.addNewDrawing(pt),this.prev.x=yt.offsetX,this.prev.y=yt.offsetY):this.GEOMETRY_TOOLS.indexOf(this.currentTool)>-1&&(pt.tox=yt.offsetX,pt.toy=yt.offsetY,this.ghostElements[vt]=pt,this.redraw())}}).bind(this)}},8560:(rt,it,s)=>{s.r(it),s(2772),s(3710),s(9554),s(1539),s(8674),s(561),s(2564),s(8309),s(4916),s(3123),s(1058),s(6992),s(8783),s(3948),s(285),s(1637),s(4363),s(9653),s(9714),s(3843),s(7941),s(4812),s(9575),s(2472),s(2990),s(8927),s(3105),s(5035),s(4345),s(7174),s(2846),s(4731),s(7209),s(6319),s(8867),s(7789),s(3739),s(9368),s(4483),s(2056),s(3462),s(678),s(7462),s(3824),s(5021),s(2974),s(5016),s(2222),s(9600),s(6755),s(4747),s(2526),s(1817),s(2165);var et=s(1549),nt=s(5945),at=s(8765),ht=s(1215),dt=s(3173),ut=et.Y.get("RecordManager"),lt=s(4708);function mt(St,wt){for(var Mt=0;Mt255*apiCC.activeSpeakerThreshold&&(Gt||(Gt=!0,Ot.notifyActiveSpeaker(zt),ot.debug("notifyActiveSpeaker this.userMediaStreamId :",Ot.userMediaStreamId)),Dt!==null&&clearTimeout(Dt),Dt=setTimeout(function(){Ot.notifyNotActiveSpeaker(zt),ot.debug("notifyNotActiveSpeaker this.userMediaStreamId :",Ot.userMediaStreamId),Gt=!1},1e3))},100)):ot.error("listenToAudio() - Unable to create audio context")}else ot.debug("activeSpeakerDetecting is not activated or stream type is noiseReduction")}},{key:"checkstopAudioNodeCtxConditions",value:function(Ht){return apiCC.userAgentInstance!==void 0&&apiCC.userAgentInstance.getCapabilities().noiseReduction==="OFF"?"Navigator not compatible with this function":Ht===void 0?"nodeCtx undefined":"OK"}},{key:"stopAudioNodeCtx",value:function(Ht){ot.debug("stopAudioNodeCtx :",Ht);var Ot=this.checkstopAudioNodeCtxConditions(Ht);if(Ot!=="OK")return Ot;Ht.sourceNode!==void 0&&Ht.sourceNode!==null&&(Ht.sourceNode.disconnect(),Ht.sourceNode=null),Ht.analyserNode!==void 0&&Ht.analyserNode!==null&&(Ht.analyserNode.disconnect(),Ht.analyserNode=null),Ht.audioDestination!==void 0&&Ht.audioDestination!==null&&(Ht.audioDestination.disconnect(),Ht.audioDestination=null),Ht.originalMediaTrack!==void 0&&Ht.originalMediaTrack!==null&&(Ht.originalMediaTrack=null),Ht.outputMediaTrack!==void 0&&Ht.outputMediaTrack!==null&&(Ht.outputMediaTrack=null),Ht.listenToAudioIntervalId!==void 0&&Ht.listenToAudioIntervalId!==null&&(clearInterval(Ht.listenToAudioIntervalId),Ht.listenToAudioIntervalId=null),Ht.noiseSuppressorNode!==void 0&&Ht.noiseSuppressorNode!==null&&(Ht.noiseSuppressorNode.port.onmessage=null,Ht.noiseSuppressorNode.port.close(),Ht.noiseSuppressorNode=null)}},{key:"checkChildTypeConditions",value:function(Ht){return apiCC.userAgentInstance!==void 0&&apiCC.userAgentInstance.getCapabilities().noiseReduction==="OFF"?"Navigator not compatible with this function":Ht.childType!==void 0&&Ht.childType==="noiseReduction"?"This stream has already a noiseReduction effect applied : "+Ht.childType:Ht.childrenTypeExists("noiseReduction")?"This stream has already has a noiseReduction sub instance running":"OK"}},{key:"startNoiseReduction",value:function(Ht){var Ot=this,Dt=null,Gt=!1;return new Promise(function(nn,zt){ot.debug("startNoiseReduction");var Ft=Ot.checkChildTypeConditions(Ht);if(Ft!=="OK")return zt(Ft);Ht.nodeCtx={},Ht.nodeCtx.originalMediaTrack=Ht.data.getAudioTracks()[0];var un=apiCC.audioProcessor.getOrCreateAudioContext();Ht.nodeCtx.sourceNode=un.createMediaStreamSource(Ht.data);var vn={channelCount:Ht.data.getAudioTracks()[0].getSettings().channelCount,channelCountMode:"explicit"};Ht.nodeCtx.audioDestination=new MediaStreamAudioDestinationNode(un,vn),Ht.nodeCtx.outputMediaTrack=Ht.nodeCtx.audioDestination.stream.getAudioTracks()[0],un.audioWorklet.addModule("https://cdn.apizee.com/apiRTC/lib/noiseReduction/ApiRTC_NR_Worklet_1.0.1.js").then(function(){Ht.nodeCtx.noiseSuppressorNode=new AudioWorkletNode(un,"NoiseSuppressorWorklet",{parameterData:{activeSpeakerDetect:apiCC.activeSpeakerDetect}}),Ht.nodeCtx.sourceNode.connect(Ht.nodeCtx.noiseSuppressorNode).connect(Ht.nodeCtx.audioDestination);var yn={audioFilterIsApplied:Ht.audioFilterIsApplied,audioAppliedFilter:Ht.audioAppliedFilter,videoFilterIsApplied:Ht.videoFilterIsApplied,videoAppliedFilter:Ht.videoAppliedFilter,childType:Ht.childType},cn=Ht.nodeCtx.audioDestination.stream;Ht.data.getVideoTracks().forEach(function(gn){cn.addTrack(gn.clone())}),Ht.createChildStreamFromStream(cn,"noiseReduction",yn).then(function(gn){Ht.addChildren(gn,"noiseReduction"),gn.applyMuteStatusFromParent();var bn=apiCC.getUserMediaStream(Ht.userMediaStreamId);apiCC.audioProcessor.stopAudioNodeCtx(bn.nodeCtx);var fn=apiCC.getUserMediaStream(gn.userMediaStreamId);return Ht.nodeCtx.noiseSuppressorNode.port.onmessage=function(Tn){Tn.data.vadScore>apiCC.activeSpeakerThreshold&&(Gt||(Gt=!0,fn.notifyActiveSpeaker(Tn.data.vadScore),ot.debug("notifyActiveSpeaker this.userMediaStreamId :",fn.userMediaStreamId)),Dt!==null&&clearTimeout(Dt),Dt=setTimeout(function(){fn.notifyNotActiveSpeaker(Tn.data.vadScore),ot.debug("notifyNotActiveSpeaker this.userMediaStreamId :",fn.userMediaStreamId),Gt=!1},1e3))},nn(gn)}).catch(zt)}).catch(function(yn){console.error("Error while adding audio worklet module: ",yn)})})}}])&&mt(wt.prototype,Mt),Object.defineProperty(wt,"prototype",{writable:!1}),St}();function yt(St){return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(wt){return typeof wt}:function(wt){return wt&&typeof Symbol=="function"&&wt.constructor===Symbol&&wt!==Symbol.prototype?"symbol":typeof wt},yt(St)}var vt=et.Y.get("ApiCC_Methods"),bt=s(6075).F;apiCC.myWebRTC_Adapter=new bt,apiCC.myWebRTC_Event=new at.K;var At=apiCC.myWebRTC_Event;apiCC.myEventTable=[],apiCC.ApiCCSession=s(3720).K,apiCC.ApiCCWebRTCClient=s(1192).D,apiCC.ApiCCUserMediaStream=s(7323).q,apiCC.ApiCCPointerSharingClient=s(9213).X,apiCC.ApiCCWhiteBoardClient=s(6527).p,apiCC.ApiCCDataClient=s(128)._,apiCC.ApiCCIMClient=s(6844).U,apiCC.recordMgr=new function(){ut.debug("RecordManager creation"),this.mediaRecorder=null,this.recordedBlobs=[],this.mimeType=null,this.record=function(St,wt){var Mt=this;return ut.info("record"),ut.log("stream :"+St),ut.log("stream :",St),new Promise(function(Ht,Ot){var Dt=null;if(MediaRecorder===void 0)return ut.debug("MediaRecorder is not supported on this browser, leaving recordStream process"),void Ot(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"MediaRecorder is not supported on this browser, leaving recordStream process",ut));if(St===null)return ut.debug("Stream has no data, cannot record"),void Ot(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"Stream has no data, cannot record",ut));if(Mt.mediaRecorder!==null&&(ut.log("this.mediaRecorder.state :"+Mt.mediaRecorder.state),Mt.mediaRecorder.state==="recording"||Mt.mediaRecorder.state==="paused"))return ut.log("mediaRecorder is already ongoing, use stopRecordStream before trying another record"),void Ot(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is already ongoing, use stopRecordStream before trying another record",ut));if(ut.debug("checking MediaRecorderOptions mimeType support"),wt!=null?(ut.debug("options is defined :",wt),wt.mimeType!==null&&wt.mimeType!==void 0&&(ut.debug("contentType is defined :",wt.mimeType),MediaRecorder.isTypeSupported(wt.mimeType)&&(Dt=wt.mimeType))):wt={},Dt===null){var Gt="video/webm;codecs=vp8,opus";MediaRecorder.isTypeSupported(Gt)||(ut.debug(Gt+" is not Supported"),Gt="video/webm;codecs=vp9,opus",MediaRecorder.isTypeSupported(Gt)||(ut.debug(Gt+" is not Supported"),Gt="video/webm",MediaRecorder.isTypeSupported(Gt)||(ut.debug(Gt+" is not Supported"),Gt=""))),wt.mimeType=Gt}Mt.mimeType=wt.mimeType,ut.debug("Start record with MediaRecorderOptions :",wt);try{Mt.recordedBlobs=[],Mt.mediaRecorder=new MediaRecorder(St,wt)}catch(nn){return ut.error("Exception while creating MediaRecorder: "+nn+". mimeType: "+wt.mimeType),void Ot(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"Exception while creating MediaRecorder: "+nn+". mimeType: "+wt.mimeType,ut))}Mt.mediaRecorder.onstart=function(nn){ut.log("onstart :"+nn),this.onerror=null,Ht()},Mt.mediaRecorder.ondataavailable=function(nn){nn.data&&nn.data.size>0&&apiCC.recordMgr.recordedBlobs.push(nn.data)},Mt.mediaRecorder.onerror=function(nn){ut.log("onerror :"+nn),Ot(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder error :"+nn,ut)),this.onerror=null},Mt.mediaRecorder.start(10),ut.log("MediaRecorder started",Mt.mediaRecorder)})},this.stop=function(){var St=this;return ut.info("stop"),new Promise(function(wt,Mt){return St.mediaRecorder.onstop=function(Ht){ut.log("mediaRecorder onstop :"+Ht),this.onstart=null,this.onstop=null,this.onerror=null,this.onpause=null,this.onresume=null,this.ondataavailable=null;var Ot=new Blob(apiCC.recordMgr.recordedBlobs,{type:this.mimeType});wt(Ot)},MediaRecorder===void 0?(ut.debug("MediaRecorder is not supported on this browser, leaving recordStream process"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"MediaRecorder is not supported on this browser, leaving recordStream process",ut))):St.mediaRecorder===null?(ut.log("mediaRecorder is not running, use startRecordStream before trying to stop"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is not running, use startRecordStream before trying to stop",ut))):(ut.log("this.mediaRecorder.state :"+St.mediaRecorder.state),St.mediaRecorder.state==="inactive"?(ut.log("mediaRecorder is already inactive"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is already inactive",ut))):void St.mediaRecorder.stop())})},this.pause=function(){var St=this;return ut.info("pause"),new Promise(function(wt,Mt){return St.mediaRecorder===null?(ut.log("mediaRecorder is not running, use startRecordStream before trying to pause"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is not running, use startRecordStream before trying to pause",ut))):(ut.log("this.mediaRecorder.state :"+St.mediaRecorder.state),St.mediaRecorder.state==="paused"?(ut.log("mediaRecorder is already paused"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is already paused",ut))):St.mediaRecorder.state==="inactive"?(ut.log("mediaRecorder is inactive"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is inactive",ut))):(St.mediaRecorder.onerror=function(Ht){ut.log("onerror :"+Ht),Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder error :"+Ht,ut)),this.onerror=null},St.mediaRecorder.onpause=function(Ht){ut.log("onpause :"+Ht),this.onerror=null,wt()},void St.mediaRecorder.pause()))})},this.resume=function(){var St=this;return ut.info("resume"),new Promise(function(wt,Mt){return St.mediaRecorder===null?(ut.log("mediaRecorder is not running, use startRecordStream before trying to resume"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is not running, use startRecordStream before trying to resume",ut))):(ut.log("this.mediaRecorder.state :"+St.mediaRecorder.state),St.mediaRecorder.state==="recording"?(ut.log("mediaRecorder is already recording"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is already recording",ut))):St.mediaRecorder.state==="inactive"?(ut.log("mediaRecorder is inactive"),void Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder is inactive",ut))):(St.mediaRecorder.onerror=function(Ht){ut.log("onerror :"+Ht),Mt(ht.g.createError(dt.g.ERROR_STREAM_RECORD,"mediaRecorder error :"+Ht,ut)),this.onerror=null},St.mediaRecorder.onresume=function(Ht){ut.log("onresume :"+Ht),this.onerror=null,wt()},void St.mediaRecorder.resume()))})}},apiCC.audioProcessor=new ft,apiCC.pendingPromises=[],apiCC.pendingPromisesId=0,nt.$6!=="electron"?s(2746):vt.debug("Electron detected, not loading onbeforeunload"),apiCC.addEventListener=function(St,wt,Mt){var Ht={},Ot=null;["sessionReady","incomingCall","callEstablished","remoteHangup","userMediaSuccess","userMediaError","userMediaStop","error","receiveIMMessage","updatePresence","webRTCClientCreated","updateUserStatus","channelEvent","groupChatCreation","groupChatInvitation","groupChatMemberUpdate","addUserInGroupChatAnswer","receiveGroupChatMessage","userDataAnswer","fetchUserDataAnswer","receiveConversationList","receiveConversationHistory","receiveConversationDetailReport","receiveContactOccurrencesFromConversationList","receiveMCUSessionInvitation","MCUSessionCreation","MCUAvailableStream","MCUAvailableStreamUpdate","MCUAvailableReplay","MCURemoveStream","canPlayRemoteVideo","recordedFileAvailable","receiveData","roomCreation","roomJoined","roomInvitation","roomMemberUpdate","receiveRoomMessage","contactListInRoom","snapShotPhotoUploaded","stopRecord","callAttempt","joinMCUSessionAnswer","hangup","desktopCapture","remoteStreamAdded","localStreamRemoved","remoteStreamRemoved","switchStream","sendDataChannelOpen","sendDataChannelClose","sendDataChannelError","receiveDataChannelOpen","receiveDataChannelClose","receiveDataChannelError","connectedUsersListUpdate","onFileSended","onFileSending","onFileReceiving","onFileReceived","onFileProgress","onFilePending","recordedStreamsAvailable","closingWhiteBoard","webRTCPluginInstallation","onQosStatsUpdate","onQosChange","onQosAudioChange","onCallScoreUpdate","activeSpeaker","stopSpeaking","audioAmplitude","preCallTestStatus","onQosVideoChange","onCallStatsUpdate","cpuLimited","bandwidthLimited","MCURecordedStreamsAvailable","MCURecordingStarted","MCURecordingStopped","ICECandidateTypeUpdate","disconnectionWarning","MCUAvailableComposite","callRestarting","selectedICECandidate","MCUParticipantEjected","MCURoomModeChanged","MCUStreamingStarted","MCUStreamingStopped","mediaDeviceChanged","externalJsLoadingStatus","slowLink","localStreamUpdated","remoteStreamUpdated","simulcastFeedChanged","videoQualityChanged","bandwidthResourceManagement","backgroundSubstractionStopVisibilityChange","backgroundSubstractionStopComputeTime","AIESnapshot","AIELog","cloudEventOccurred"].indexOf(St)>-1?(St==="remoteHangup"&&vt.warn("DEPRECATED : ApiRTC : remoteHangup event is now deprecated, please use hangup event instead"),vt.log("Adding listener on type :"+St),typeof apiRTC_React<"u"?eventManager.addEventListener(St,wt):document.addEventListener?document.addEventListener(St,wt,!1):typeof $jqApz<"u"?(vt.log("using $jqApz"),$jqApz(document).on(St,wt)):typeof jQuery<"u"?(vt.log("using jQuery"),jQuery(document).on(St,wt)):vt.warn("Custom Events not supported on this browser : addEventListener()"),Ht={type:St,listener:wt,setBy:Mt},Ot=apiCC.myEventTable.push(Ht),vt.trace("number of myEventTable:"+Ot)):(At.createErrorEvent("ERROR: Trying to add a listener on an unknow event","UNKNOWN_EVENT_ON_ADDLISTENER"),vt.log("ERROR: Trying to add a listener on an unknow event :"+St))},apiCC.removeEventListener=function(St,wt){vt.debug("Removing listener on type :"+St),document.removeEventListener?document.removeEventListener(St,wt,!1):typeof jQuery<"u"?jQuery(document).off(St,wt):vt.log("Custom Events not supported on this browser")},apiCC.setSessionStorage=function(St,wt,Mt){vt.debug("setSessionStorage"),Mt=Mt||36e5;var Ht=new Date,Ot=new Date;Ot.setTime(Ht.getTime()+Mt);try{var Dt=JSON.stringify({value:wt,expiresAt:Ot});sessionStorage.setItem(St,Dt)}catch{vt.error("Sotheming went wrong during json strigify to set session storage values")}},apiCC.isWebRTCCompliant=function(){vt.debug("isWebRTCCompliant");var St=!1,wt=!1;return["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCIceGatherer"].forEach(function(Mt){St||Mt in window&&(St=!0)}),St===!1?(vt.debug("isWebRTCCompliant::isWebRTCSupported false"),!1):(["getUserMedia","webkitGetUserMedia","mozGetUserMedia","msGetUserMedia"].forEach(function(Mt){wt||Mt in navigator&&(wt=!0)}),wt===!1?(vt.debug("isWebRTCCompliant::isWebRTCGUMSupported false or you are connected with HTTP"),!1):nt.Xh==="MIUI Browser"?(vt.debug("isWebRTCCompliant::MIUI Browser detected false"),!1):nt.Xh==="UCBrowser"?(vt.debug("isWebRTCCompliant::UCBrowser detected false"),!1):nt.Xh==="QQ"||nt.Xh==="QQBrowser"||nt.Xh==="QQBrowserLite"?(vt.debug("isWebRTCCompliant::QQ or QQBrowser or QQBrowserLite detected false"),!1):nt.Xh==="Baidu"||nt.Xh==="baidu"?(vt.debug("isWebRTCCompliant::Baidu or baidu detected false"),!1):(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&this.webRTCPluginActivated!==!0?(vt.debug("isWebRTCCompliant FALSE : IE or Safari"),!1):(vt.debug("isWebRTCCompliant:: WebRTC is supported"),!0))},apiCC.isQoSStatCompliant=function(){var St=!1;return["chrome","firefox","safari"].indexOf(apiCC.browserDetails.type)<0?(vt.debug("QoS Statistics is only supported on Chrome, Firefox and Safari"),St):St=!0},apiCC.isScreenSharingCompliant=function(){var St=!1;return typeof apiRTC_React<"u"?St=!0:(nt.Xh==="IE"||nt.BF==="Android"||apiRTC.osName==="iOS"&&typeof cordova<"u"||(nt.Xh==="Chrome"||nt.Xh==="Firefox"&&nt.PR>=52||navigator.getDisplayMedia||navigator.mediaDevices.getDisplayMedia?St=!0:vt.debug("ScreenSharing is not supported")),St)},apiCC.getMediaDevices=function(){return vt.debug("getMediaDevices"),new Promise(function(St,wt){if(typeof apiRTC_React<"u")vt.log("enumerateDevices() is supported - React Native"),mediaDevices.enumerateDevices().then(function(Mt){vt.log("enumerateDevices(), sources :",Mt),apiCC.mediaDeviceMgr.mediaSourceInfos=Mt,St(Mt)}).catch(function(Mt){vt.log("enumerateDevices(), error :",Mt),wt(Mt)});else if(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)vt.log("enumerateDevices() is supported."),navigator.mediaDevices.enumerateDevices().then(function(Mt){vt.log("enumerateDevices(), sources :",Mt),apiCC.mediaDeviceMgr.mediaSourceInfos=Mt,St(Mt)}).catch(function(Mt){vt.log("enumerateDevices(), error :",Mt),wt(Mt)});else if(vt.log("enumerateDevices() not supported."),typeof MediaStreamTrack>"u")vt.warn("This browser does not support MediaStreamTrack"),wt(new Error("getMediaDevices() - MediaStreamTrack undefined"));else try{MediaStreamTrack.getSources(St)}catch(Mt){vt.debug("catch MediaStreamTrack.getSources :"+Mt),wt(new Error("getMediaDevices() - Error on MediaStreamTrack.getSources :"+Mt))}})},apiCC.getMediaDevicesWithCB=function(St){if(vt.debug("getMediaDevicesWithCB"),navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)vt.log("enumerateDevices() is supported."),navigator.mediaDevices.enumerateDevices().then(St).catch(function(wt){vt.log("navigator.mediaDevices.enumerateDevices error: ",wt),wt=null});else if(vt.log("enumerateDevices() not supported."),typeof MediaStreamTrack>"u")St(null),vt.warn("This browser does not support MediaStreamTrack");else try{MediaStreamTrack.getSources(St)}catch(wt){vt.debug("catch MediaStreamTrack.getSources :"+wt),St(null)}},apiCC.getUserMedia=function(St){return vt.info("getUserMedia"),vt.debug("with constraints :",St),new Promise(function(wt,Mt){navigator.mediaDevices!==void 0&&navigator.mediaDevices.getUserMedia!==void 0?(vt.debug("webRTC getUserMedia with promises"),navigator.mediaDevices.getUserMedia(St).then(wt).catch(Mt)):typeof apiRTC_React<"u"?(vt.debug("webRTC getUserMedia with promises on React Native"),mediaDevices.getUserMedia(St).then(wt).catch(Mt)):(vt.debug("webRTC getUserMedia without promises"),apiCC.myWebRTC_Adapter.getUserMedia(St,wt,Mt))})},apiCC.getUserMediaWithCB=function(St,wt,Mt){vt.info("getUserMediaWithCB"),vt.debug("with constraints :"+JSON.stringify(St)),navigator.mediaDevices!==void 0&&navigator.mediaDevices.getUserMedia!==void 0?(vt.log("getUserMedia with promises"),navigator.mediaDevices.getUserMedia(St).then(wt).catch(Mt)):(vt.log("getUserMedia without promises"),apiCC.myWebRTC_Adapter.getUserMedia(St,wt,Mt))},apiCC.userMediaStreamTable=[],apiCC.getUserMediaStreamIds=function(){for(var St=[],wt=apiCC.userMediaStreamTable.length;--wt>=0;)St.push(apiCC.userMediaStreamTable[wt].userMediaStreamId);return St},apiCC.getUserMediaStream=function(St,wt){var Mt=null,Ht=apiCC.userMediaStreamTable.length;if(St==null){if(wt&&typeof wt.accept=="function"){for(;--Ht>=0;)if(wt.accept(apiCC.userMediaStreamTable[Ht])===!0){Mt=apiCC.userMediaStreamTable[Ht];break}}}else for(;--Ht>=0;)if(apiCC.userMediaStreamTable[Ht].userMediaStreamId===St){Mt=apiCC.userMediaStreamTable[Ht];break}return Mt},apiCC.getFirstUserMediaStream=function(){return apiCC.userMediaStreamTable.length>0?apiCC.userMediaStreamTable[0]:null},apiCC.createUserMediaStream=function(St){var wt=function(Ot){for(var Dt=apiCC.userMediaStreamTable.length;--Dt>=0;)if(apiCC.userMediaStreamTable[Dt].userMediaStreamId===Ot){apiCC.userMediaStreamTable.splice(Dt,1);break}},Mt=new apiCC.ApiCCUserMediaStream,Ht="call";return vt.debug("[createUserMediaStream] userMediaStreamId: "+Mt.userMediaStreamId),St==null&&(St={}),St.type&&(Mt.callType=St.type),St.stream?(Mt.stream=St.stream,Mt.streamStolen=!0,Mt.notifyUserMediaStop=!1,Mt.listenForMuteEvents()):St.gum_config&&(Mt.gum_config=(0,lt.S6)(St.gum_config)),St.audioSourceId&&(Mt.inputs.audioSourceId=St.audioSourceId),St.videoSourceId&&(Mt.inputs.videoSourceId=St.videoSourceId),St.facingMode&&(Mt.inputs.facingMode=St.facingMode),St.captureSourceType&&(Mt.captureSourceType=St.captureSourceType),St.notifyUserMediaSuccess&&(Mt.notifyUserMediaSuccess=St.notifyUserMediaSuccess),St.notifyUserMediaError&&(Mt.notifyUserMediaError=St.notifyUserMediaError),St.tryAudioCallAfterUserMediaError&&(Mt.tryAudioCallAfterUserMediaError=St.tryAudioCallAfterUserMediaError),St.displayMediaStreamConstraints&&(Mt.displayMediaStreamConstraints=St.displayMediaStreamConstraints),St.forceExtensionOnChrome&&(Mt.forceExtensionOnChrome=St.forceExtensionOnChrome),St.filters&&(Mt.filters=St.filters),St.callId&&(St.callFlavor!=="call"&&St.callFlavor!=="userMedia"||(Ht=St.callFlavor),Mt.stream===null?Mt.addCallInfo(St.callId,Ht,!0):Mt.addCallInfo(St.callId,Ht,!1)),St.childStreamType&&(Mt.childStreamType=St.childStreamType),Mt.callbacks.release=typeof St.release=="function"?St.release:function(){},Mt.callbacks.success=typeof St.success=="function"?St.success:function(){},Mt.callbacks.failure=typeof St.failure=="function"?St.failure:function(){},apiCC.userMediaStreamTable.push(Mt),Mt.stream===null?Mt.callType==="screenSharing"||Mt.callType==="screenSharingWithAudio"?Mt.getScreenMedia():Mt.callType!=="data"?Mt.getUserMedia():St.sync===!0?(wt(Mt.userMediaStreamId),Mt.callbacks.failure(Mt,"wrong type")):setTimeout(function(){wt(Mt.userMediaStreamId),Mt.callbacks.failure(Mt,"wrong type")},0):(Mt.updateMediaProperties(Mt.stream),St.sync===!0?Mt.callbacks.success(Mt):setTimeout(function(){Mt.callbacks.success(Mt)},0)),Mt},apiCC.releaseUserMediaStream=function(St,wt,Mt){var Ht=!1,Ot=apiCC.userMediaStreamTable.length,Dt=null;if(wt!==null&&typeof wt!="string"&&(wt=null),St==null){if(Mt&&typeof Mt.accept=="function"){for(;--Ot>=0;)if(Mt.accept(apiCC.userMediaStreamTable[Ot])===!0){if(wt){if((Dt=apiCC.userMediaStreamTable[Ot].getOwnerCallInfo())===null||Dt.callId!==wt){apiCC.userMediaStreamTable[Ot].removeCallInfo(wt);break}}else if((Dt=apiCC.userMediaStreamTable[Ot].getOwnerCallInfo())!==null)break;vt.debug("[releaseUserMediaStream] match; userMediaStreamId: "+apiCC.userMediaStreamTable[Ot].userMediaStreamId),apiCC.userMediaStreamTable[Ot].release(),wt&&apiCC.userMediaStreamTable[Ot].removeCallInfo(wt),apiCC.userMediaStreamTable.splice(Ot,1),Ht=!0;break}}}else for(;--Ot>=0;)if(apiCC.userMediaStreamTable[Ot].userMediaStreamId===St){if(wt){if((Dt=apiCC.userMediaStreamTable[Ot].getOwnerCallInfo())===null||Dt.callId!==wt){apiCC.userMediaStreamTable[Ot].removeCallInfo(wt);break}}else if((Dt=apiCC.userMediaStreamTable[Ot].getOwnerCallInfo())!==null)break;vt.debug("[releaseUserMediaStream] id; userMediaStreamId: "+apiCC.userMediaStreamTable[Ot].userMediaStreamId),apiCC.userMediaStreamTable[Ot].release(),wt&&apiCC.userMediaStreamTable[Ot].removeCallInfo(wt),apiCC.userMediaStreamTable.splice(Ot,1),Ht=!0;break}return Ht},apiCC.activeSpeakerDetect=!1,apiCC.activeSpeakerThreshold=.4,apiCC.enableActiveSpeakerDetecting=function(St,wt){apiCC.activeSpeakerDetect=St,wt&&(apiCC.activeSpeakerThreshold=wt)},apiCC.apiRTCExtensionInstalled=!1,apiCC.extensionInstallationSuccessCallback=function(){vt.debug("extensionInstallationSuccessCallback"),apiCC.apiRTCExtensionInstalled=!0},apiCC.extensionInstallationFailureCallback=function(St,wt){vt.debug("extensionInstallationFailureCallback : Error :"+St+", "+wt),St=null,wt=null,At.createDesktopCaptureEvent("Extension_installation_Error",apiRTC.waitingShareScreenCallId,apiRTC.waitingShareScreenDestNumber,apiRTC.waitingCaptureSourceType)},apiCC.manageNotInstalledExtension=function(St,wt,Mt){vt.debug("manageNotInstalledExtension"),vt.warn("apiRTC extension not installed"),At.createDesktopCaptureEvent("Extension_not_installed",St,wt),vt.warn("Starting apiRTC extension installation"),apiRTC.waitingShareScreenDestNumber=wt,apiRTC.waitingShareScreenCallId=St,apiRTC.waitingCaptureSourceType=Mt,nt.PR>=71?(vt.debug("Chrome >= 71, opening Chrome web Store"),apiRTC.extensionInstallationFailureCallback("Chrome71 : chrome.webstore.install() no more supported","Chrome71-screenShare"),window.open("https://chrome.google.com/webstore/detail/apizee-desktop-capture/mjjnofoemoepfididplbfimokpnpcoeg")):chrome.webstore.install("https://chrome.google.com/webstore/detail/mjjnofoemoepfididplbfimokpnpcoeg",apiRTC.extensionInstallationSuccessCallback,apiRTC.extensionInstallationFailureCallback)},apiCC.activateScreenSharing=function(St){vt.debug("activateScreenSharing");var wt=null;St!==void 0?vt.log("extensionId is defined :"+St):(vt.log("using apirtc extension's Id"),St="mjjnofoemoepfididplbfimokpnpcoeg"),nt.Xh==="Chrome"?document.getElementById(St)!==null?(vt.log("extensionLink is present, screenSharing is already activated"),window.postMessage("apiRTC-extension","*")):(vt.log("screenSharing is not yet activated"),(wt=document.createElement("link")).href="https://chrome.google.com/webstore/detail/"+St,wt.rel="chrome-webstore-item",wt.id=St,document.getElementsByTagName("head")[0].appendChild(wt),window.addEventListener("message",function(Mt){var Ht=null;if(vt.log("message: event: "+JSON.stringify(Mt.data)),Mt.origin==window.location.origin){if(Mt.data!=="apiRTC-DeskstopCapture-loaded")return Mt.data==="extensionInstalledAndLoaded"?(apiCC.apiRTCExtensionInstalled=!0,apiCC.waitingShareScreenUserMediaStream!==null&&apiCC.waitingShareScreenUserMediaStream!==void 0&&(apiCC.userMediaStreamTable.push(apiCC.waitingShareScreenUserMediaStream[0]),delete apiCC.waitingShareScreenUserMediaStream),void(apiCC.waitingShareScreenUserMediaStreamId&&(Ht=apiCC.getUserMediaStream(apiCC.waitingShareScreenUserMediaStreamId),delete apiCC.waitingShareScreenUserMediaStreamId,Ht&&Ht.getScreenMedia()))):void(yt(Mt.data)==="object"&&Mt.data.desktopId!==void 0&&(Mt.data.remoteId!=="getScreenMedia"||(Ht=apiCC.getUserMediaStream(Mt.data.callNumber))===null||Ht.registerScreenMedia(Mt.data.captureSourceType,Mt.data.desktopId)));apiCC.apiRTCExtensionInstalled=!0}}),window.postMessage("apiRTC-extension","*")):(vt.log("activateScreenSharing is only available for chrome Browser"),At.createDesktopCaptureEvent("Browser_Not_Compatible",null,null))},apiCC.checkIfAudioSourceIdExistOnDevice=function(St){vt.log("checkIfAudioSourceIdExistOnDevice :",St);var wt,Mt=!1,Ht=null;if(apiCC.mediaDeviceMgr.mediaSourceInfos!==null)for(wt=0;wt=50?wt.audio.deviceId=St:nt.Xh==="Chrome"&&nt.PR<48||nt.Xh==="Safari"&&nt.PR<11?wt.audio.optional=[{sourceId:St}]:wt.audio.deviceId=St?{ideal:St}:void 0),vt.debug("constraints =",wt),wt},apiCC.checkIfVideoSourceIdExistOnDevice=function(St){vt.log("checkIfVideoSourceIdExistOnDevice :",St);var wt,Mt=!1,Ht=null;if(vt.debug("apiCC.mediaDeviceMgr.mediaSourceInfos :",apiCC.mediaDeviceMgr.mediaSourceInfos),apiCC.mediaDeviceMgr.mediaSourceInfos!==null)for(wt=0;wt0&&parseInt(Ht[0])<13&&(Mt=!0),wt.video.deviceId=Mt?{exact:St}:{ideal:St}}}else wt.video.deviceId=St;else(nt.Xh==="Firefox"||nt.Xh==="Mobile Firefox")&&nt.PR>=50?(nt.Xh==="Firefox"||nt.Xh==="Mobile Firefox")&&nt.PR>=77?(vt.debug("FX > 77 using exact to set deviceId"),wt.video.deviceId={exact:St}):wt.video.deviceId=St:nt.Xh==="Chrome"&&nt.PR<48||nt.Xh==="Safari"&&nt.PR<11?wt.video.optional=[{sourceId:St}]:wt.video.deviceId=St?{ideal:St}:void 0;return vt.log("constraints =",wt),wt},apiCC.setVideoFacingModeInConstraint=function(St,wt){vt.log("setVideoFacingModeInConstraint");var Mt={};return wt.video===!1?(vt.log("facingMode value is not setted, constraints.video is false"),wt):St==null?(vt.log("facingMode value is not setted"),wt):St!=="user"&&St!=="environment"&&St!=="left"&&St!=="right"?(vt.log("facingMode value is not correct"),wt):(navigator.mediaDevices!==null&&navigator.mediaDevices!==void 0&&navigator.mediaDevices.getSupportedConstraints!==null&&navigator.mediaDevices.getSupportedConstraints!==void 0&&(Mt=navigator.mediaDevices.getSupportedConstraints()),Mt.hasOwnProperty("facingMode")?(vt.log("Setting FacingMode in constraint"),wt.video===!0&&(wt.video={}),wt.video.facingMode={ideal:St}):vt.log("FacingMode not supported by device"),vt.debug("constraints =",wt),wt)},apiCC.setResolutionInConstraint=function(St,wt,Mt){return vt.log("setResolutionInConstraint"),St<=0||wt<=0?(vt.log("Resolution value must be positif non null"),Mt):(Mt.video===!0||Mt.video!==void 0?nt.ag.name==="iOS"?nt.Xh==="Mobile Safari"?(Mt.video.width=St?{exact:St}:void 0,Mt.video.height=wt?{exact:wt}:void 0):(Mt.video.width=St,Mt.video.height=wt):(nt.Xh==="Firefox"||nt.Xh==="Mobile Firefox")&&nt.PR>=50?(Mt.video.width=St,Mt.video.height=wt):nt.Xh==="Safari"&&nt.PR>=11||nt.Xh==="Mobile Safari"||nt.Xh==="Edge"&&apiRTC.browserDetails.type!=="chrome"||nt.Xh==="Chrome"&&nt.PR>=49||nt.Xh==="Firefox"&&nt.PR>=50||nt.Xh==="Mobile Chrome"||nt.Xh==="Mobile Firefox"?(Mt.video.width=St?{exact:St}:void 0,Mt.video.height=wt?{exact:wt}:void 0):Mt.video.mandatory=[{width:St,height:wt}]:vt.error("setResolutionInConstraint : contraint.video must be true or defined"),vt.debug("constraints =",Mt),Mt)},apiCC.checkConstraintDependingOnDevice=function(St){vt.debug("checkConstraintDependingOnDevice :",St),nt.Xh==="Mobile Safari"&&nt.PR>=13&&St.video!==void 0&&St.video.height!==void 0&&St.video.width!==void 0&&St.video.height.ideal===1080&&St.video.width.ideal===1920&&(vt.debug("Downgrading selected height and width resolution on iOS, to avoid stream issue"),St.video.height.ideal=720,St.video.width.ideal=1280)},apiCC.attachMediaStream=function(St,wt){vt.debug("attachMediaStream"),St!==null?(St.srcObject!==void 0?St.srcObject=wt:St.mozSrcObject!==void 0?St.mozSrcObject=wt:St.src!==void 0?nt.Xh==="Chrome"&&nt.PR<46?(vt.log("Attaching media stream for Chrome < 46"),St.src=webkitURL.createObjectURL(wt)):St.src=URL.createObjectURL(wt):vt.error("Error attaching stream to element."),nt.ag.name==="iOS"&&(vt.log("iOS detected"),St.setAttribute("playsinline",!0))):vt.log("videoElt is null")},apiCC.addStreamInDiv=function(St,wt,Mt,Ht,Ot,Dt,Gt){vt.debug("addStreamInDiv");var nn,zt=null,Ft=null,un=!1,vn=null;(0,lt.Ym)(Gt,"object")&&Gt.type!=null&&(wt=Gt.type),(0,lt.Ym)(Gt,"object")&&Gt.forceAudioAndVideoMediaElementSeparation!==void 0&&(vt.debug("forceAudioAndVideoMediaElementSeparation is set"),un=!0),wt==="audio"?zt=document.createElement("audio"):(nt.BF==="iOS"&&nt.Xh==="Mobile Safari"&&(vt.debug("iOS && Mobile Safari"),un=!0),zt=document.createElement("video")),zt.id=Ht,zt.autoplay=!0,un===!0&&Dt===!1?(vt.debug("before adding separated MediaEltAudio"),(vn=document.createElement("audio")).id=Ht+"_sepAudio",vn.muted=Dt,vn.autoplay=!0,zt.muted=!0):zt.muted=Dt,zt.style.width=Ot.width,zt.style.height=Ot.height,Ot.controls===!0&&(zt.controls=!0),nn=function(yn){var cn=null,gn=yn.play();cn=function(){var bn=yn.play();vt.log("funcFixIoS"),bn!==void 0&&bn.then(function(){vt.log("Autoplay started"),document.removeEventListener("touchstart",cn)}).catch(function(fn){vt.error("Autoplay was prevented")})},gn!==void 0&&gn.then(function(){vt.log("Autoplay started")}).catch(function(bn){nt.ag.name==="iOS"?(vt.warn("iOS : Autoplay was prevented, activating touch event to start media play"),apiCC.myWebRTC_Event.createErrorEvent("ERROR: iOS : Autoplay was prevented","IOS_AUTOPLAY_PREVENTED"),document.addEventListener("touchstart",cn)):vt.warn("Autoplay was prevented")})},nt.Xh!=="Chrome"&&nt.Xh!=="Mobile Chrome"||nt.PR!=="61"||nt.BF!=="Android"||(zt.style.borderRadius="1px",vt.log("Patch for video display on Chrome 61 Android")),apiCC.session&&apiCC.session.apiCCWebRTCClient&&apiCC.session.apiCCWebRTCClient.webRTCClient.audioOutputId!==void 0&&apiCC.session.apiCCWebRTCClient.webRTCClient.audioOutputId!==null?(vt.log("audioOutputId set to: "+apiCC.session.apiCCWebRTCClient.webRTCClient.audioOutputId),zt.setSinkId(apiCC.session.apiCCWebRTCClient.webRTCClient.audioOutputId).then(function(){vt.log("Success, audio output device attached")})):vt.log("No audioOutputId set"),nt.BF!=="iOS"&&(Ft=document.getElementById(Mt)).appendChild(zt),St!==void 0&&(apiCC.attachMediaStream(zt,St),un===!0&&Dt===!1&&apiCC.attachMediaStream(vn,St)),nt.BF==="iOS"&&(Ft=document.getElementById(Mt)).appendChild(zt),un===!0&&Dt===!1&&Ft!==null&&Ft.appendChild(vn),nn(zt),un===!0&&Dt===!1&&nn(vn)},apiCC.removeElementFromDiv=function(St,wt){vt.debug("removeElementFromDiv");var Mt,Ht,Ot=null;Mt=document.getElementById(wt),Ot=document.getElementById(St),Mt!==null&&(vt.log("Removing video element with Id : "+wt),Ot!==null&&Ot.removeChild(Mt)),(Ht=document.getElementById(wt+"_sepAudio"))!==null&&(vt.log("iOS : Removing audio element with Id : "+wt+"_sepAudio"),Ot!==null&&Ot.removeChild(Ht))},apiCC.randomString=function(St,wt){for(var Mt=typeof wt=="string"&&wt.length>0?wt:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ht="";--St>=0;)Ht+=Mt.charAt(Math.floor(Math.random()*Mt.length));return Ht},apiCC.generateCallId=function(){var St;return St=Number.MAX_SAFE_INTEGER!==void 0?Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString():Math.floor(1000001*Math.random()).toString(),vt.debug("new callId :"+St),St},apiCC.generateInstanceId=function(){var St;return St=Number.MAX_SAFE_INTEGER!==void 0?Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString():Math.floor(1000001*Math.random()).toString(),vt.debug("new instanceId :"+St),St},apiCC.myApiCCWhiteBoardClient=null,apiCC.createWhiteBoard=function(St,wt,Mt,Ht){return vt.debug("createWhiteBoard"),apiCC.myApiCCWhiteBoardClient=new apiCC.ApiCCWhiteBoardClient(apiCC.session,St,wt,Mt,Ht),apiCC.myApiCCWhiteBoardClient},apiCC.closeWhiteBoardClient=function(St){vt.info("closeWhiteBoardClient"),At.createClosingWhiteBoardEvent(apiCC.myApiCCWhiteBoardClient.roomId,St),apiCC.myApiCCWhiteBoardClient.isInRoom()&&apiCC.myApiCCWhiteBoardClient.leaveRoom(),apiCC.myApiCCWhiteBoardClient.stop()},apiCC.registerIOsDevice=function(St){vt.debug("call registerIOsDevice 1");var wt={type:"registerIOsDevice",senderId:apiCC.session.apiCCId,token:St},Mt=JSON.stringify(wt);vt.debug("call registerIOsDevice "+Mt),apiCC.session.channel.socket.emit("registerIOsDevice",Mt),vt.debug("call registerIOsDevice done")},apiCC.registerAndroidDevice=function(St){vt.debug("registerAndroidDevice");var wt={type:"registerAndroidDevice",senderId:apiCC.session.apiCCId,token:St},Mt=JSON.stringify(wt);apiCC.session.channel.socket.emit("registerAndroidDevice",Mt)},apiCC.unRegisterIOsDevice=function(St){vt.debug("unRegisterIOsDevice");var wt={type:"unRegisterIOsDevice",senderId:apiCC.session.apiCCId,token:St},Mt=JSON.stringify(wt);apiCC.session.channel.socket.emit("unRegisterIOsDevice",Mt)},apiCC.unRegisterAndroidDevice=function(St){vt.debug("unRegisterAndroidDevice");var wt={type:"unRegisterAndroidDevice",senderId:apiCC.session.apiCCId,token:St},Mt=JSON.stringify(wt);apiCC.session.channel.socket.emit("unRegisterAndroidDevice",Mt)},apiCC.storeSessionInfoInSessionStorage=function(){var St=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(vt.info("storeSessionInfoInSessionStorage",St),apiCC.session){var wt=5e3;(0,lt.ki)(apiCC.session,"apiCCIdPersistenceTimeout","number")&&apiCC.session.apiCCIdPersistenceTimeout>=0&&(wt=apiCC.session.apiCCIdPersistenceTimeout),(0,lt.Ym)(St.apiCCIdPersistenceTimeout,"number")&&St.apiCCIdPersistenceTimeout>=0&&(wt=St.apiCCIdPersistenceTimeout),apiCC.setSessionStorage("apiCCId",apiCC.session.apiCCId,wt),apiCC.setSessionStorage("apiKey",apiCC.session.apiKey,wt),apiCC.session.sessionId!==null&&apiCC.setSessionStorage("sessionId",apiCC.session.sessionId,wt)}},apiCC.disconnect=function(){var St=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt.info("disconnect",St),apiCC!==null&&apiCC.cleanAllEventListener(St),apiCC.session!==null&&apiCC.session!==void 0&&(typeof apiRTC_React>"u"&&St.invalidateApiCCId!==!0&&apiCC.storeSessionInfoInSessionStorage(St),apiCC.myApiCCWhiteBoardClient!==null&&(vt.log("apiCC.myApiCCWhiteBoardClient.roomId :"+apiCC.myApiCCWhiteBoardClient.roomId),apiCC.myApiCCWhiteBoardClient.roomId!==null&&apiCC.closeWhiteBoardClient("USER_DISCONNECTION")),vt.log("Disconnecting from Server"),apiCC.session.channel.socket!==void 0&&apiCC.session.channel.socket!==null&&apiCC.session.channel.socket.disconnect(),apiCC.session.channel.channelHasBeenDisconnected=!1,apiCC.session.connectedUsersList.splice(0,apiCC.session.connectedUsersList.length)),apiCC&&(apiCC.session=null,apiCC.jsLoaded=!1)},apiCC.reconnect=function(){vt.log("Reconnect"),vt.log("apiCC.session.channel.socket:",apiCC.session.channel.socket),apiCC.session.channel.socket.socket.connect()},apiCC.cleanApiRTCContext=function(){apiCC.session!==null&&apiCC.session!==void 0&&(apiCC.session.apiCCWebRTCClient!==null&&apiCC.session.apiCCWebRTCClient!==void 0&&(apiCC.session.apiCCWebRTCClient.webRTCClient.callsTable.length!==0&&vt.warn("Call is still established and will be disconnected"),apiCC.session.apiCCWebRTCClient.webRTCClient.MCUClient.sessionMCUs.length>0&&vt.log("MCU session is still established and will be disconnected"),apiCC.session.apiCCWebRTCClient.hangUp(),apiCC.session.apiCCWebRTCClient.webRTCClient.localStream!==null&&(apiCC.session.apiCCWebRTCClient.webRTCClient.stopStream(apiCC.session.apiCCWebRTCClient.webRTCClient.localStream),At.createUserMediaStopEvent(null,"media")),apiCC.session.apiCCWebRTCClient=null),apiCC.session.apiCCIMClient!==null&&apiCC.session.apiCCIMClient!==void 0&&(apiCC.session.apiCCIMClient=null),apiCC.session.apiCCDataClient!==null&&apiCC.session.apiCCDataClient!==void 0&&(apiCC.session.apiCCDataClient=null),apiCC.myApiCCWhiteBoardClient!==null&&apiCC.myApiCCWhiteBoardClient!==void 0&&(apiCC.myApiCCWhiteBoardClient=null))},apiCC.cleanAllEventListener=function(){var St,wt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Mt=0;if(apiCC!==null&&apiCC.myEventTable!==null&&(Mt=apiCC.myEventTable.length),Mt!==0){for(vt.trace("number of myEventTable:"+Mt),St=0;St10&&(Ht-=gn),Ot=Ft/(Ht/1e3),Dt=Math.round(Ot/1e3),nn={type:"download",kBPerSec:Dt},Gt=0;Gt=apiCC.bandwidthRatingThresholds[Gt]&&vn++;nn.rating=vn+"/"+apiCC.bandwidthRatingThresholds.length,wt(null,nn)},un.onerror=function(bn,fn){wt({label:"Error when downloading",err:bn,msg:fn},null)},Mt=new Date().getTime(),un.src=zt})},apiCC.testUserUpload=function(St,wt){vt.debug("testUserUpload()");var Mt,Ht,Ot,Dt,Gt,nn,zt,Ft=apiCC.bandwidthTestServer+"/upload-test",un=new XMLHttpRequest,vn=new FormData,yn="",cn=0;for(("withCredentials"in un)?un.open("POST",Ft,!0):typeof XDomainRequest<"u"?(un=new XDomainRequest).open("POST",Ft):un=null,Ht=0;Ht=apiCC.bandwidthRatingThresholds[Ht]&&cn++;Ot.rating=cn+"/"+apiCC.bandwidthRatingThresholds.length,wt(null,Ot)}else wt({err:"An error occured during XMLHttpRequest",msg:un.status},null)},un.onerror=function(gn){vt.log("testUserUpload onerror status :",gn.target.status),wt({err:"An error occured during XMLHttpRequest",msg:gn.target.status},null)},un.send(vn),Dt=Date.now()):wt({err:"XMLHttpRequest is not defined",msg:"XMLHttpRequest is not defined"},null)},apiCC.testUserUploadLoop=function(St,wt,Mt){var Ht={type:"upload",kBPerSec:wt.kbps/8,kbps:wt.kbps,rating:wt.rating},Ot=0;wt.kbps>1e3?apiCC.testUserUpload(St,function(Dt,Gt){Dt!==null?Mt({err:"An error occured during XMLHttpRequest"},null):(Ht.kBPerSec=Gt.kBPerSec,Ht.kbps=8*Gt.kBPerSec,Ht.rating=Gt.rating,Ot=Ht.kbps-wt.kbps,vt.debug("upload "+St+" "+JSON.stringify(Ht)+"; diff "+Ot),Ot>=2e4&&St<12e6?apiCC.testUserUploadLoop(St+8e6,Ht,Mt):Ot>=1e4&&St<14e6?apiCC.testUserUploadLoop(St+6e6,Ht,Mt):Ot>=5e3&&St<16e6?apiCC.testUserUploadLoop(St+4e6,Ht,Mt):Ot>=1e3&&St<18e6?apiCC.testUserUploadLoop(St+2e6,Ht,Mt):Ot>=200&&St<19e6?apiCC.testUserUploadLoop(St+1e6,Ht,Mt):Mt(null,Ht))}):Mt(null,Ht)},apiCC.testUserDownloadLoop=function(St,wt,Mt){var Ht={type:"download",kBPerSec:wt.kbps/8,kbps:wt.kbps,rating:wt.rating},Ot=0;wt.kbps>=3500?apiCC.testUserDownload(St,function(Dt,Gt){Dt!==null?Mt({err:"Error when downloading"},null):(Ht.kBPerSec=Gt.kBPerSec,Ht.kbps=8*Gt.kBPerSec,Ht.rating=Gt.rating,Ot=Ht.kbps-wt.kbps,vt.debug("download "+St+" "+JSON.stringify(Ht)+"; diff "+Ot),Ot>=2e4?apiCC.testUserDownloadLoop(3e4,Ht,Mt):Ot>=1e4&&St<=2e4?apiCC.testUserDownloadLoop(St+1e4,Ht,Mt):Ot>=5e3&&St<=25e3?apiCC.testUserDownloadLoop(St+5e3,Ht,Mt):Ot>=1e3&&St<=27e3?apiCC.testUserDownloadLoop(St+3e3,Ht,Mt):Ot>=200&&St<=29e3?apiCC.testUserDownloadLoop(St+1e3,Ht,Mt):Mt(null,Ht))}):Mt(null,Ht)},apiCC.listenedAudioSources={};var Nt=window.AudioContext||window.webkitAudioContext||!1;apiCC.audioContext=null,apiCC.getAudioContext=function(){return apiRTC.osName==="iOS"&&typeof cordova<"u"?vt.debug("No audioContext for iOS cordova"):Nt&&apiCC.audioContext===null&&(apiCC.audioContext=new Nt),apiCC.audioContext},apiCC.listenToAudioSources=function(St){vt.debug("listenToAudioSources()");var wt,Mt=apiCC.getAudioContext();Mt!=null?(Object.keys(apiCC.listenedAudioSources).length>0&&apiCC.stopAudioSourceListening(),apiCC.getMediaDevices().then(function(Ht){for(vt.log(Ht),wt=0;wt0&&Sentry.withScope(function(Ot){Ht.forEach(function(Dt){Ot.setTag(Dt,Mt[Dt])}),Sentry.captureMessage(wt)})}else vt.debug("Sentry not activated")},apiCC.addPendingPromise=function(St,wt,Mt){var Ht=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5e3;vt.debug("addPendingPromise"),apiCC.pendingPromisesId++;var Ot=function(Gt){apiCC.cleanPendingPromiseTable(Gt),Mt("Timeout problem during ".concat(St," process on a remote stream"))},Dt=setTimeout(function(){Ot(apiCC.pendingPromisesId)},Ht);return apiCC.pendingPromises.push({timeout:Dt,resolve:wt,reject:Mt,pendingPromisesId:apiCC.pendingPromisesId}),Dt},apiCC.resolvePendingPromise=function(St,wt){vt.debug("resolvePendingPromise"),apiCC.pendingPromises.forEach(function(Mt){St===Mt.timeout&&(clearTimeout(St),Mt.resolve(wt),apiCC.cleanPendingPromiseTable(Mt.pendingPromisesId))})},apiCC.rejectPendingPromise=function(St,wt){vt.debug("rejectPendingPromise"),apiCC.pendingPromises.forEach(function(Mt){St===Mt.timeout&&(clearTimeout(St),Mt.reject(wt),apiCC.cleanPendingPromiseTable(Mt.pendingPromisesId))})},apiCC.cleanPendingPromiseTable=function(St){apiCC.pendingPromises.forEach(function(wt,Mt){St===wt.pendingPromisesId&&apiCC.pendingPromises.splice(Mt,1)})}},5945:(rt,it,s)=>{function et(Dt){return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Gt){return typeof Gt}:function(Gt){return Gt&&typeof Symbol=="function"&&Gt.constructor===Symbol&&Gt!==Symbol.prototype?"symbol":typeof Gt},et(Dt)}function nt(){nt=function(){return Dt};var Dt={},Gt=Object.prototype,nn=Gt.hasOwnProperty,zt=typeof Symbol=="function"?Symbol:{},Ft=zt.iterator||"@@iterator",un=zt.asyncIterator||"@@asyncIterator",vn=zt.toStringTag||"@@toStringTag";function yn(Bn,zn,$n){return Object.defineProperty(Bn,zn,{value:$n,enumerable:!0,configurable:!0,writable:!0}),Bn[zn]}try{yn({},"")}catch{yn=function(zn,$n,Jn){return zn[$n]=Jn}}function cn(Bn,zn,$n,Jn){var Kn=zn&&zn.prototype instanceof fn?zn:fn,An=Object.create(Kn.prototype),Wn=new Zn(Jn||[]);return An._invoke=function(Cn,Nn,qt){var kt="suspendedStart";return function(st,Tt){if(kt==="executing")throw new Error("Generator is already running");if(kt==="completed"){if(st==="throw")throw Tt;return{value:void 0,done:!0}}for(qt.method=st,qt.arg=Tt;;){var Rt=qt.delegate;if(Rt){var Lt=qn(Rt,qt);if(Lt){if(Lt===bn)continue;return Lt}}if(qt.method==="next")qt.sent=qt._sent=qt.arg;else if(qt.method==="throw"){if(kt==="suspendedStart")throw kt="completed",qt.arg;qt.dispatchException(qt.arg)}else qt.method==="return"&&qt.abrupt("return",qt.arg);kt="executing";var Et=gn(Cn,Nn,qt);if(Et.type==="normal"){if(kt=qt.done?"completed":"suspendedYield",Et.arg===bn)continue;return{value:Et.arg,done:qt.done}}Et.type==="throw"&&(kt="completed",qt.method="throw",qt.arg=Et.arg)}}}(Bn,$n,Wn),An}function gn(Bn,zn,$n){try{return{type:"normal",arg:Bn.call(zn,$n)}}catch(Jn){return{type:"throw",arg:Jn}}}Dt.wrap=cn;var bn={};function fn(){}function Tn(){}function _n(){}var Un={};yn(Un,Ft,function(){return this});var Pn=Object.getPrototypeOf,In=Pn&&Pn(Pn(on([])));In&&In!==Gt&&nn.call(In,Ft)&&(Un=In);var Rn=_n.prototype=fn.prototype=Object.create(Un);function On(Bn){["next","throw","return"].forEach(function(zn){yn(Bn,zn,function($n){return this._invoke(zn,$n)})})}function Ln(Bn,zn){function $n(Kn,An,Wn,Cn){var Nn=gn(Bn[Kn],Bn,An);if(Nn.type!=="throw"){var qt=Nn.arg,kt=qt.value;return kt&&et(kt)=="object"&&nn.call(kt,"__await")?zn.resolve(kt.__await).then(function(st){$n("next",st,Wn,Cn)},function(st){$n("throw",st,Wn,Cn)}):zn.resolve(kt).then(function(st){qt.value=st,Wn(qt)},function(st){return $n("throw",st,Wn,Cn)})}Cn(Nn.arg)}var Jn;this._invoke=function(Kn,An){function Wn(){return new zn(function(Cn,Nn){$n(Kn,An,Cn,Nn)})}return Jn=Jn?Jn.then(Wn,Wn):Wn()}}function qn(Bn,zn){var $n=Bn.iterator[zn.method];if($n===void 0){if(zn.delegate=null,zn.method==="throw"){if(Bn.iterator.return&&(zn.method="return",zn.arg=void 0,qn(Bn,zn),zn.method==="throw"))return bn;zn.method="throw",zn.arg=new TypeError("The iterator does not provide a 'throw' method")}return bn}var Jn=gn($n,Bn.iterator,zn.arg);if(Jn.type==="throw")return zn.method="throw",zn.arg=Jn.arg,zn.delegate=null,bn;var Kn=Jn.arg;return Kn?Kn.done?(zn[Bn.resultName]=Kn.value,zn.next=Bn.nextLoc,zn.method!=="return"&&(zn.method="next",zn.arg=void 0),zn.delegate=null,bn):Kn:(zn.method="throw",zn.arg=new TypeError("iterator result is not an object"),zn.delegate=null,bn)}function jn(Bn){var zn={tryLoc:Bn[0]};1 in Bn&&(zn.catchLoc=Bn[1]),2 in Bn&&(zn.finallyLoc=Bn[2],zn.afterLoc=Bn[3]),this.tryEntries.push(zn)}function Fn(Bn){var zn=Bn.completion||{};zn.type="normal",delete zn.arg,Bn.completion=zn}function Zn(Bn){this.tryEntries=[{tryLoc:"root"}],Bn.forEach(jn,this),this.reset(!0)}function on(Bn){if(Bn){var zn=Bn[Ft];if(zn)return zn.call(Bn);if(typeof Bn.next=="function")return Bn;if(!isNaN(Bn.length)){var $n=-1,Jn=function Kn(){for(;++$n=0;--Jn){var Kn=this.tryEntries[Jn],An=Kn.completion;if(Kn.tryLoc==="root")return $n("end");if(Kn.tryLoc<=this.prev){var Wn=nn.call(Kn,"catchLoc"),Cn=nn.call(Kn,"finallyLoc");if(Wn&&Cn){if(this.prev=0;--$n){var Jn=this.tryEntries[$n];if(Jn.tryLoc<=this.prev&&nn.call(Jn,"finallyLoc")&&this.prev=0;--zn){var $n=this.tryEntries[zn];if($n.finallyLoc===Bn)return this.complete($n.completion,$n.afterLoc),Fn($n),bn}},catch:function(Bn){for(var zn=this.tryEntries.length-1;zn>=0;--zn){var $n=this.tryEntries[zn];if($n.tryLoc===Bn){var Jn=$n.completion;if(Jn.type==="throw"){var Kn=Jn.arg;Fn($n)}return Kn}}throw new Error("illegal catch attempt")},delegateYield:function(Bn,zn,$n){return this.delegate={iterator:on(Bn),resultName:zn,nextLoc:$n},this.method==="next"&&(this.arg=void 0),bn}},Dt}function at(Dt,Gt,nn,zt,Ft,un,vn){try{var yn=Dt[un](vn),cn=yn.value}catch(gn){return void nn(gn)}yn.done?Gt(cn):Promise.resolve(cn).then(zt,Ft)}function ht(Dt){return function(){var Gt=this,nn=arguments;return new Promise(function(zt,Ft){var un=Dt.apply(Gt,nn);function vn(cn){at(un,zt,Ft,vn,yn,"next",cn)}function yn(cn){at(un,zt,Ft,vn,yn,"throw",cn)}vn(void 0)})}}s.d(it,{$6:()=>St,AA:()=>Ht,Ak:()=>Nt,BF:()=>ft,Cm:()=>At,E2:()=>ut,MM:()=>yt,Ne:()=>Mt,PR:()=>ot,RX:()=>vt,TI:()=>Ot,Xh:()=>lt,ag:()=>pt,cf:()=>wt,dc:()=>mt,vO:()=>bt}),s(8309),s(2772),s(1539),s(8674),s(2526),s(1817),s(2165),s(6992),s(8783),s(3948),s(2443),s(3680),s(3706),s(2703),s(9070),s(8011),s(489),s(9554),s(4747),s(8304),s(7042),s(9064);var dt,ut=null,lt=null,mt=null,ot=null,pt=null,ft=null,yt=null,vt=null,bt=null,At=null,Nt=null,St=null,wt=null,Mt=null,Ht=null,Ot=null;dt=(ut=new UAParser).getBrowser(),pt=ut.getOS(),wt=ut.getBrowser(),typeof apiRTC_React<"u"?(mt=DeviceInfo.getSystemVersion(),ft=DeviceInfo.getSystemName(),lt=DeviceInfo.getUserAgent(),bt=DeviceInfo.getModel()):(mt=dt.version||"Unknown",ft=ut.getOS().name||"Unknown",yt=ut.getOS().version||"Unknown",vt=function(){var Dt=ht(nt().mark(function Gt(){var nn;return nt().wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,ut.getOS().withClientHints();case 2:return nn=zt.sent,zt.abrupt("return",nn.version);case 4:case"end":return zt.stop()}},Gt)}));return function(){return Dt.apply(this,arguments)}}(),lt=dt.name||"Unknown",Mt=ut.getCPU().architecture||"Unknown",bt=ut.getDevice().type||"Unknown",At=ut.getDevice().vendor||"Unknown",Nt=function(){var Dt=ht(nt().mark(function Gt(){var nn;return nt().wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,ut.getDevice().withClientHints();case 2:return nn=zt.sent,zt.abrupt("return",nn.model);case 4:case"end":return zt.stop()}},Gt)}));return function(){return Dt.apply(this,arguments)}}(),Ht=ut.getEngine().name||"Unknown",Ot=ut.getEngine().version||"Unknown"),ot=mt!==void 0?dt.major:99,window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.toLowerCase().indexOf(" electron/")>=0&&(St="electron")},4708:(rt,it,s)=>{function et(Nt){return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(St){return typeof St}:function(St){return St&&typeof Symbol=="function"&&St.constructor===Symbol&&St!==Symbol.prototype?"symbol":typeof St},et(Nt)}s.d(it,{Pj:()=>ht,S6:()=>mt,Wc:()=>lt,Ym:()=>vt,_C:()=>at,cw:()=>yt,dD:()=>ut,fS:()=>At,ki:()=>bt,wL:()=>pt,ws:()=>ot,yJ:()=>dt}),s(4603),s(4916),s(9714),s(3123),s(9600),s(1249),s(7941),s(4723),s(1058),s(6992),s(9575),s(1539),s(2472),s(2990),s(8927),s(3105),s(5035),s(4345),s(7174),s(2846),s(4731),s(7209),s(6319),s(8867),s(7789),s(3739),s(9368),s(4483),s(2056),s(3462),s(678),s(7462),s(3824),s(5021),s(2974),s(5016),s(9753),s(7042),s(2526),s(1817),s(2165),s(8783),s(3948);var nt=s(1549).Y.get("Utils");function at(Nt){return new RegExp("^[0-9-.]*$","g").test(Nt)}function ht(){return typeof apiRTC_React<"u"||window.location.protocol==="https:"}function dt(){return typeof apiRTC_React>"u"&&window.location.protocol==="http:"}function ut(Nt){var St,wt,Mt,Ht,Ot={};for(Mt=0,Ht=(St=Nt.split("&")).length;Mt=Ht&&parseInt(Ot[Ht],10)},St={};if(typeof apiRTC_React<"u")return St.type="react-native",St;if(window!==void 0&&window.navigator!==void 0)if(window.navigator.mozGetUserMedia)St.type="firefox",St.version=Nt(window.navigator.userAgent,/Firefox\/(\d+)\./,1);else if(window.navigator.webkitGetUserMedia)if(window.webkitRTCPeerConnection)St.type="chrome",St.version=Nt(window.navigator.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!window.navigator.userAgent.match(/Version\/(\d+).(\d+)/))return St;St.type="safari",St.version=Nt(window.navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}else if(window.navigator.mediaDevices&&window.navigator.userAgent.match(/Edge\/(\d+).(\d+)$/))St.type="edge",St.version=Nt(window.navigator.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!window.navigator.mediaDevices||!window.navigator.userAgent.match(/AppleWebKit\/(\d+)\./))return St;St.type="safari",St.version=Nt(window.navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}return St}(),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-/=",yt={decode:function(Nt){var St,wt=ft.indexOf(Nt.charAt(Nt.length-1)),Mt=ft.indexOf(Nt.charAt(Nt.length-2)),Ht=Nt.length/4*3,Ot=null,Dt=null,Gt=null,nn=null,zt=null,Ft=null,un=0,vn=null;for(wt===64&&Ht--,Mt===64&&Ht--,vn=new Uint8Array(Ht),St=0;St>4,Dt=(15&nn)<<4|(zt=ft.indexOf(Nt.charAt(un++)))>>2,Gt=(3&zt)<<6|(Ft=ft.indexOf(Nt.charAt(un++))),vn[St]=Ot,zt!==64&&(vn[St+1]=Dt),Ft!==64&&(vn[St+2]=Gt);return vn},encode:function(Nt){var St,wt="",Mt=new Uint8Array(Nt),Ht=Mt.byteLength,Ot=Ht%3,Dt=Ht-Ot,Gt=null;for(St=0;St>18]+ft[(258048&Gt)>>12]+ft[(4032&Gt)>>6]+ft[63&Gt];return Ot===1?(Gt=Mt[Dt],wt+=ft[(252&Gt)>>2]+ft[(3&Gt)<<4]+"=="):Ot===2&&(Gt=Mt[Dt]<<8|Mt[Dt+1],wt+=ft[(64512&Gt)>>10]+ft[(1008&Gt)>>4]+ft[(15&Gt)<<2]+"="),wt}};function vt(Nt,St){return arguments.length===3?bt(arguments[0],arguments[1],arguments[2]):St==="null"?Nt===null:St==="array"?Nt!==null&&et(Nt)==="object"&&Array.isArray(Nt):Nt!==null&&et(Nt)===St}function bt(Nt,St,wt){if(St!==null&&et(St)==="object"&&Array.isArray(St)&&St.length>=1){var Mt=St[0];if(St.length>1)return vt(Nt,"object")&&vt(Mt,"string")&&Nt.hasOwnProperty(Mt)&&vt(Nt[Mt],"object")&&bt(Nt[Mt],St.slice(1),wt);St=Mt}return wt==="undefined"?vt(Nt,"object")&&vt(St,"string")&&!Nt.hasOwnProperty(St)&&vt(Nt[St],wt):vt(Nt,"object")&&vt(St,"string")&&Nt.hasOwnProperty(St)&&vt(Nt[St],wt)}function At(Nt,St){if(Nt===St)return!0;if(!(Nt instanceof Object&&St instanceof Object)||Nt.constructor!==St.constructor)return!1;for(var wt in Nt)if(Nt.hasOwnProperty(wt)){if(!St.hasOwnProperty(wt))return!1;if(Nt[wt]===St[wt])continue;if(et(Nt[wt])!=="object"||!At(Nt[wt],St[wt]))return!1}for(wt in St)if(St.hasOwnProperty(wt)&&!Nt.hasOwnProperty(wt))return!1;return!0}},6075:(rt,it,s)=>{s.d(it,{F:()=>nt});var et=s(1549).Y.get("WebRTC_Stack"),nt=function(){this.adaptForIoSCordova=function(){if(apiRTC.osName==="iOS"&&typeof cordova<"u"){if(et.log("Modification for iOS cordova"),cordova.plugins===void 0)return void et.log("cordova.plugins not defined");if(cordova.plugins.iosrtc===void 0)return void et.log("cordova.plugins.iosrtc not defined");this.RTCPeerConnection=cordova.plugins.iosrtc.RTCPeerConnection,this.RTCSessionDescription=cordova.plugins.iosrtc.RTCSessionDescription,this.RTCIceCandidate=cordova.plugins.iosrtc.RTCIceCandidate}},typeof RTCSessionDescription<"u"?this.RTCSessionDescription=RTCSessionDescription:et.log("RTCSessionDescription is undefined"),typeof RTCIceCandidate<"u"?this.RTCIceCandidate=RTCIceCandidate:et.log("RTCIceCandidate is undefined"),typeof RTCPeerConnection<"u"?this.RTCPeerConnection=RTCPeerConnection:et.log("RTCPeerConnection is undefined"),navigator.getUserMedia!==void 0?this.getUserMedia=navigator.getUserMedia:typeof getUserMedia<"u"?this.getUserMedia=getUserMedia:et.log("getUserMedia is undefined")}},8765:(rt,it,s)=>{s.d(it,{K:()=>ut}),s(6755),s(2772),s(3710),s(8309),s(9601),s(2526),s(1817),s(1539),s(2165),s(6992),s(8783),s(3948);var et=s(1549),nt=s(5945),at=s(4708);function ht(lt){return ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(mt){return typeof mt}:function(mt){return mt&&typeof Symbol=="function"&&mt.constructor===Symbol&&mt!==Symbol.prototype?"symbol":typeof mt},ht(lt)}var dt=et.Y.get("WebRTC_Event"),ut=function(){if(dt.debug("WebRTC_Event"),this.customEventIsDefined="notTested",this.customEventIsDefined==="notTested")try{new CustomEvent("test",{detail:"test",bubbles:!0,cancelable:!0}),this.customEventIsDefined=!0}catch(lt){this.customEventIsDefined=!1,dt.log("customEvent error :"+lt)}(nt.Xh==="IE"&&nt.dc>8||nt.Xh==="Netscape")&&(dt.log("polyfill the CustomEvent()"),function(){function lt(mt,ot){ot=ot||{bubbles:!1,cancelable:!1,detail:void 0};var pt=document.createEvent("CustomEvent");return pt.initCustomEvent(mt,ot.bubbles,ot.cancelable,ot.detail),pt}lt.prototype=window.CustomEvent.prototype,window.CustomEvent=lt}(),this.customEventIsDefined=!0),nt.Xh==="IE"&&nt.dc>8&&(dt.log("polyfill startsWith()"),String.prototype.startsWith||(String.prototype.startsWith=function(lt,mt){return mt=mt||0,this.indexOf(lt,mt)===mt})),this.eventDispatchMgr=function(lt,mt){if(typeof apiRTC_React<"u"){var ot={type:lt,detail:mt};eventManager.dispatchEvent(ot)}else if(this.customEventIsDefined===!1)typeof $jqApz<"u"?(dt.log("CustomEvent not supported by Browser, using $jqApz "),$jqApz.event.trigger({type:lt,detail:mt})):typeof jQuery<"u"?(dt.log("CustomEvent not supported by Browser, using jQuery "),jQuery.event.trigger({type:lt,detail:mt})):dt.warn("Custom Events not supported on this browser : eventDispatchMgr()");else{var pt=new CustomEvent(lt,{detail:mt,bubbles:!0,cancelable:!0});document.dispatchEvent(pt)}},this.createIncomingCallEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At,Nt,St){var wt={eventType:"incomingCall",time:new Date,clientId:lt,callerId:mt,callId:pt,autoAnswerActivated:ft,callNumber:yt,callerNickname:ot,audioOnly:vt,callType:bt,destCallType:St,recordedCall:At,remoteType:Nt};this.eventDispatchMgr("incomingCall",wt)},this.createCallAttemptEvent=function(lt,mt,ot,pt){var ft={eventType:"callAttempt",time:new Date,clientId:lt,callerId:mt,callId:pt,callerNickname:ot};this.eventDispatchMgr("callAttempt",ft)},this.createCallEstablishedEvent=function(lt,mt,ot,pt){dt.debug("createCallEstablishedEvent with callType : "+mt),dt.debug("destCallType : "+pt);var ft={eventType:"callEstablished",time:new Date,calleeId:lt,callType:mt,callId:ot,destCallType:pt};this.eventDispatchMgr("callEstablished",ft)},this.createHangupEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"hangup",time:new Date,hangupType:lt,clientId:mt,remoteId:ot,lastEstablishedCall:pt,reason:ft,callId:yt,callType:vt};this.eventDispatchMgr("hangup",bt)},this.createRemoteHangupEvent=function(lt,mt,ot,pt){var ft={eventType:"remoteHangup",time:new Date,clientId:lt,remoteId:mt,lastEstablishedCall:ot,reason:pt};this.eventDispatchMgr("remoteHangup",ft)},this.createCallRestartingEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At){var Nt={eventType:"callRestarting",time:new Date,callType:lt,audioOnly:mt,oldCallId:ot,newCallId:pt,dataType:ft,clientId:yt,remoteId:vt,destRoom:bt,streamId:At};this.eventDispatchMgr("callRestarting",Nt)},this.createUserMediaSuccessEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At,Nt,St){var wt={eventType:"userMediaSuccess",time:new Date,onCallEstablishment:lt,audioIsAvailable:mt,audioDeviceLabel:ot,videoIsAvailable:pt,videoDeviceLabel:ft,callType:yt,callId:vt,stream:bt,remoteId:At,restarted:Nt,userMediaStreamId:St};this.eventDispatchMgr("userMediaSuccess",wt)},this.createUserMediaErrorEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"userMediaError",time:new Date,onCallEstablishment:lt,callType:mt,userMediaStreamId:pt,callId:ft,tryAudioCallActivated:yt,gumConfig:vt};ht(ot)==="object"?(bt.error={},bt.error.message=ot.message,bt.error.code=ot.code,bt.error.name=ot.name):bt.error=ot,this.eventDispatchMgr("userMediaError",bt)},this.createUserMediaStopEvent=function(lt,mt,ot){var pt={eventType:"userMediaStop",time:new Date,callId:lt,mediaType:mt,userMediaStreamId:ot};this.eventDispatchMgr("userMediaStop",pt)},this.createICECandidateTypeUpdateEvent=function(lt,mt,ot){var pt={eventType:"ICECandidateTypeUpdate",time:new Date,callId:lt,localCandidate:mt,remoteCandidate:ot};this.eventDispatchMgr("ICECandidateTypeUpdate",pt)},this.createSelectedICECandidateEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"selectedICECandidate",time:new Date,callId:lt,localCandidateType:mt,remoteCandidateType:ot,localAddress:pt,remoteAdress:ft,transportType:yt,localTransportType:vt};this.eventDispatchMgr("selectedICECandidate",bt)},this.createErrorEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"error",time:new Date,errorInfo:lt,errorCode:mt,callId:ot,roomName:pt,roomCallType:ft};(0,at.Ym)(yt,"object")&&(bt.data=yt),(0,at.Ym)(vt,"string")&&(bt.convId=vt),this.eventDispatchMgr("error",bt)},this.createReceiveIMMessageEvent=function(lt,mt,ot,pt,ft,yt){var vt={eventType:"receiveIMMessage",time:new Date,senderId:lt,senderNickname:mt,senderPhotoURL:ot,message:pt,UUCSeq:ft,convId:yt};this.eventDispatchMgr("receiveIMMessage",vt)},this.createChannelEvent=function(lt,mt){var ot={eventType:"channelEvent",time:new Date,channelEvent:lt,event:mt};this.eventDispatchMgr("channelEvent",ot)},this.createSessionReadyEvent=function(lt){dt.debug("createSessionReadyEvent");var mt={eventType:"sessionReady",time:new Date,apiCCId:lt};this.eventDispatchMgr("sessionReady",mt)},this.createWebRTCClientCreatedEvent=function(){var lt={eventType:"webRTCClientCreated",time:new Date};this.eventDispatchMgr("webRTCClientCreated",lt)},this.createUpdatePresenceEvent=function(lt,mt,ot){var pt={eventType:"updatePresence",time:new Date,connectedUsersList:lt,connectedUsersListWithStatus:ot,state:mt};this.eventDispatchMgr("updatePresence",pt)},this.createCloudEventOccurredEvent=function(lt,mt){var ot={eventType:"cloudEventOccurred",time:new Date,topic:lt,target:mt};this.eventDispatchMgr("cloudEventOccurred",ot)},this.createUpdateUserStatusEvent=function(lt){var mt={eventType:"updateUserStatus",time:new Date,message:lt};this.eventDispatchMgr("updateUserStatus",mt)},this.createGroupChatCreationEvent=function(lt,mt,ot,pt,ft,yt){var vt={eventType:"groupChatCreation",time:new Date,status:lt,groupChatId:mt,initialDestId:ot,invitationSendedToInitialDestId:pt,newContactId:ft,invitationSendedToNewContactId:yt};this.eventDispatchMgr("groupChatCreation",vt)},this.createGroupChatInvitationEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"groupChatInvitation",time:new Date,groupChatId:lt,contactList:ft,senderId:mt,senderNickname:ot,senderPhotoURL:pt};this.eventDispatchMgr("groupChatInvitation",yt)},this.createGroupChatMemberUpdateEvent=function(lt,mt,ot){var pt={eventType:"groupChatMemberUpdate",time:new Date,groupChatId:lt,contactList:mt,status:ot};this.eventDispatchMgr("groupChatMemberUpdate",pt)},this.createAddUserInGroupChatEvent=function(lt,mt,ot){var pt={eventType:"addUserInGroupChatAnswer",time:new Date,invitationSended:lt,groupChatId:mt,contactId:ot};this.eventDispatchMgr("addUserInGroupChatAnswer",pt)},this.createReceiveGroupChatMessageEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"receiveGroupChatMessage",time:new Date,groupChatId:lt,senderId:mt,senderNickname:ot,message:pt};(0,at.Ym)(ft,"object")&&(yt.metadata=ft),this.eventDispatchMgr("receiveGroupChatMessage",yt)},this.createReceiveConversationListAnswerEvent=function(lt){var mt={eventType:"receiveConversationList",time:new Date,convList:lt};this.eventDispatchMgr("receiveConversationList",mt)},this.createReceiveContactOccurrencesFromConversationListAnswerEvent=function(lt){var mt={eventType:"receiveContactOccurrencesFromConversationList",time:new Date,occurrencesList:lt};this.eventDispatchMgr("receiveContactOccurrencesFromConversationList",mt)},this.createReceiveConversationDetailReportAnswerEvent=function(lt){var mt={eventType:"receiveConversationDetailReport",time:new Date,CDR:lt};this.eventDispatchMgr("receiveConversationDetailReport",mt)},this.createReceiveConversationHistoryEvent=function(lt,mt,ot){var pt={eventType:"receiveConversationHistory",time:new Date,convId:lt,convHistory:mt,status:ot};this.eventDispatchMgr("receiveConversationHistory",pt)},this.createUserDataAnswerEvent=function(lt,mt,ot,pt){var ft={eventType:"userDataAnswer",time:new Date,userFound:lt,contactId:mt,nickname:ot,photoURL:pt};this.eventDispatchMgr("userDataAnswer",ft)},this.createFetchUserDataAnswerEvent=function(lt){var mt="fetchUserDataAnswer",ot={eventType:mt,timeout:lt.timeout,userData:lt.userData,id:lt.id};this.eventDispatchMgr(mt,ot)},this.createReceiveDataEvent=function(lt,mt,ot){var pt={eventType:"receiveData",time:new Date,senderId:lt,dstRoomId:mt,data:ot};this.eventDispatchMgr("receiveData",pt)},this.createMCUSessionCreationEvent=function(lt,mt){var ot={eventType:"MCUSessionCreation",time:new Date,sessionId:lt,token:mt};this.eventDispatchMgr("MCUSessionCreation",ot)},this.createJoinMCUSessionAnswerEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"joinMCUSessionAnswer",time:new Date,sessionId:lt,token:mt,groupChatId:ot,initiator:pt,roomId:ft.roomName};ft.roomMode&&(yt.mode=ft.roomMode),ft.meshOnly===!0&&(yt.meshOnly=!0),ft.joinSessionAnswer&&(yt.result=Object.assign({},ft.joinSessionAnswer)),this.eventDispatchMgr("joinMCUSessionAnswer",yt)},this.createMCUAvailableStreamEvent=function(lt,mt){var ot={eventType:"MCUAvailableStream",time:new Date,streams:lt,isRemoteStream:mt};this.eventDispatchMgr("MCUAvailableStream",ot)},this.createMCUAvailableReplayEvent=function(lt,mt){var ot={eventType:"MCUAvailableReplay",time:new Date,streams:lt,isRemoteStream:mt};this.eventDispatchMgr("MCUAvailableReplay",ot)},this.createMCUAvailableCompositeEvent=function(lt,mt){var ot={eventType:"MCUAvailableComposite",time:new Date,streams:lt,isRemoteStream:mt};this.eventDispatchMgr("MCUAvailableComposite",ot)},this.createMCURemovedStreamEvent=function(lt){var mt={eventType:"MCURemoveStream",time:new Date,streamId:lt};this.eventDispatchMgr("MCURemoveStream",mt)},this.createMCUAvailableStreamUpdateEvent=function(lt,mt){var ot={eventType:"MCUAvailableStreamUpdate",time:new Date,streams:lt,isRemoteStream:mt};this.eventDispatchMgr("MCUAvailableStreamUpdate",ot)},this.createMCUParticipantEjectedEvent=function(lt,mt,ot){var pt={eventType:"MCUParticipantEjected",time:new Date,roomId:lt,clientId:mt};ot&&(pt.data=ot),this.eventDispatchMgr("MCUParticipantEjected",pt)},this.createReceiveMCUSessionInvitationEvent=function(lt,mt,ot,pt){ot===void 0&&(ot=0);var ft={eventType:"receiveMCUSessionInvitation",time:new Date,sessionId:lt,token:mt,groupChatId:ot,initiatorId:pt};this.eventDispatchMgr("receiveMCUSessionInvitation",ft)},this.createRemoteStreamAddedEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"remoteStreamAdded",time:new Date,callId:mt,callType:lt,stream:ot,remoteId:pt,destCallType:ft,audioIsAvailable:yt.available,audioIsActive:yt.active,audioIsMuted:yt.muted,videoIsAvailable:vt.available,videoIsActive:vt.active,videoIsMuted:vt.muted};this.eventDispatchMgr("remoteStreamAdded",bt)},this.createRemoteStreamRemovedEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"remoteStreamRemoved",time:new Date,callId:mt,callType:lt,stream:ot,remoteId:pt,destCallType:ft};this.eventDispatchMgr("remoteStreamRemoved",yt)},this.createSimulcastFeedChanged=function(lt,mt){var ot={eventType:"simulcastFeedChanged",time:new Date,callId:lt,simulcast:mt};this.eventDispatchMgr("simulcastFeedChanged",ot)},this.createLocalStreamRemovedEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"localStreamRemoved",time:new Date,callId:mt,callType:lt,stream:ot,remoteId:pt,destCallType:ft};this.eventDispatchMgr("localStreamRemoved",yt)},this.createSlowLinkEvent=function(lt,mt){var ot={eventType:"slowLink",time:new Date,callId:lt};mt&&(ot.advice=mt),this.eventDispatchMgr("slowLink",ot)},this.createVideoQualityChangedEvent=function(lt,mt,ot,pt){var ft={eventType:"videoQualityChanged",time:new Date,roomname:mt,callId:lt,hint:ot,profileType:pt.name};pt.bitrate&&(ft.bitrate=pt.bitrate),pt.width&&pt.height&&(ft.width=pt.width,ft.height=pt.height),pt.frameRate&&(ft.frameRate=pt.frameRate),this.eventDispatchMgr("videoQualityChanged",ft)},this.createAudioAmplitudeEvent=function(lt,mt,ot,pt){var ft={eventType:"audioAmplitude",time:new Date,callId:ot,userMediaStreamId:pt,descriptor:{amplitude:lt,isSpeaking:mt}};this.eventDispatchMgr("audioAmplitude",ft)},this.createLocalStreamUpdatedEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At){var Nt={eventType:"localStreamUpdated",time:new Date,changeList:lt,audioIsAvailable:mt.available,audioDeviceLabel:mt.deviceLabel,audioIsActive:mt.active,audioIsMuted:mt.muted,audioIsSilent:mt.silent,videoIsAvailable:ot.available,videoDeviceLabel:ot.deviceLabel,videoIsActive:ot.active,videoIsMuted:ot.muted,videoIsSilent:ot.silent,onCall:pt,callType:ft,callId:yt,stream:vt,userMediaStreamId:bt,cause:At};this.eventDispatchMgr("localStreamUpdated",Nt)},this.createRemoteStreamUpdatedEvent=function(lt,mt,ot,pt,ft,yt){var vt={eventType:"remoteStreamUpdated",time:new Date,changeList:lt,audioIsAvailable:mt.available,audioIsActive:mt.active,audioIsMuted:mt.muted,audioIsSilent:mt.silent,videoIsAvailable:ot.available,videoIsActive:ot.active,videoIsMuted:ot.muted,videoIsSilent:ot.silent,callType:pt,callId:ft,cause:yt};this.eventDispatchMgr("remoteStreamUpdated",vt)},this.createCanPlayRemoteVideoEvent=function(lt,mt,ot){var pt={eventType:"canPlayRemoteVideo",time:new Date,videoDivId:lt,callType:mt,remoteId:ot};this.eventDispatchMgr("canPlayRemoteVideo",pt)},this.createRecordedFileAvailableEvent=function(lt){var mt={eventType:"recordedFileAvailable",time:new Date,fileName:lt};this.eventDispatchMgr("recordedFileAvailable",mt)},this.createRecordedStreamsAvailableEvent=function(lt,mt,ot,pt,ft,yt,vt){var bt={eventType:"recordedStreamsAvailable",time:new Date,confId:lt,userId1:mt,userId2:ot,callId:pt,apiKey:apiCC.session.apiKey};ft&&(bt.convId=ft),yt&&(bt.mediaId=yt),vt&&(bt.mediaURL=vt),this.eventDispatchMgr("recordedStreamsAvailable",bt)},this.createMCURecordedStreamsAvailableEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At,Nt,St){var wt={eventType:"MCURecordedStreamsAvailable",time:new Date,roomName:lt,callId:mt,clientId:ot,convId:ft,mediaId:yt,mediaURL:vt,recordType:bt};At&&(wt.remoteId=At),pt&&(wt.recordedFileName=pt),Nt&&(wt.mediaType=Nt),(0,at.Ym)(St,"object")?(wt.descriptor={},(0,at.Ym)(St,"mode","string")&&(wt.descriptor.mode=St.mode),(0,at.Ym)(St,"labelEnabled","boolean")&&(wt.descriptor.labelEnabled=St.labelEnabled),wt.descriptor.labelEnabled===!0&&(0,at.Ym)(St,"labels","array")&&(wt.descriptor.labels=St.labels)):wt.descriptor={mode:"complete",labelEnabled:!1},this.eventDispatchMgr("MCURecordedStreamsAvailable",wt)},this.createMCURecordingStartedEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At,Nt,St,wt){var Mt={eventType:"MCURecordingStarted",time:new Date,roomName:lt,callId:mt,clientId:ot,recordType:pt,recordStartTime:ft};yt&&(Mt.convId=yt),vt&&(Mt.mediaId=vt),bt&&(Mt.mediaURL=bt),At&&(Mt.remoteId=At),Nt&&(Mt.recordedFileName=Nt),St&&(Mt.mediaType=St),(0,at.Ym)(wt,"object")&&(Mt.descriptor={},(0,at.Ym)(wt,"mode","string")&&(Mt.descriptor.mode=wt.mode),(0,at.Ym)(wt,"labelEnabled","boolean")&&(Mt.descriptor.labelEnabled=wt.labelEnabled),Mt.descriptor.labelEnabled===!0&&(0,at.Ym)(wt,"labels","array")&&(Mt.descriptor.labels=wt.labels)),this.eventDispatchMgr("MCURecordingStarted",Mt)},this.createMCURecordingStoppedEvent=function(lt,mt,ot,pt,ft,yt,vt,bt,At,Nt,St,wt){var Mt={eventType:"MCURecordingStopped",time:new Date,roomName:lt,callId:mt,clientId:ot,recordType:pt,recordStartTime:ft};yt&&(Mt.convId=yt),vt&&(Mt.mediaId=vt),bt&&(Mt.mediaURL=bt),At&&(Mt.remoteId=At),Nt&&(Mt.recordedFileName=Nt),St&&(Mt.mediaType=St),(0,at.Ym)(wt,"object")&&(Mt.descriptor={},(0,at.Ym)(wt,"mode","string")&&(Mt.descriptor.mode=wt.mode),(0,at.Ym)(wt,"labelEnabled","boolean")&&(Mt.descriptor.labelEnabled=wt.labelEnabled),Mt.descriptor.labelEnabled===!0&&(0,at.Ym)(wt,"labels","array")&&(Mt.descriptor.labels=wt.labels)),this.eventDispatchMgr("MCURecordingStopped",Mt)},this.createStopRecordEvent=function(){var lt={eventType:"stopRecord",time:new Date};this.eventDispatchMgr("stopRecord",lt)},this.createMCUStreamingStartedEvent=function(lt,mt,ot,pt){var ft={eventType:"MCUStreamingStarted",time:new Date,roomName:lt,callId:mt,clientId:ot,streamingStartTime:pt};this.eventDispatchMgr("MCUStreamingStarted",ft)},this.createMCUStreamingStoppedEvent=function(lt,mt,ot,pt){var ft={eventType:"MCUStreamingStopped",time:new Date,roomName:lt,callId:mt,clientId:ot,streamingEndTime:pt};this.eventDispatchMgr("MCUStreamingStopped",ft)},this.createMCURoomModeChangedEvent=function(lt,mt,ot,pt){var ft={eventType:"MCURoomModeChanged",time:new Date,roomId:lt,oldMode:mt,newMode:ot,state:pt};this.eventDispatchMgr("MCURoomModeChanged",ft)},this.createSnapShotPhotoUploaded=function(lt){var mt={eventType:"snapShotPhotoUploaded",time:new Date,fileName:lt};this.eventDispatchMgr("snapShotPhotoUploaded",mt)},this.createRoomCreationEvent=function(lt,mt,ot){var pt={eventType:"roomCreation",time:new Date,status:lt,roomId:mt,roomType:ot};this.eventDispatchMgr("roomCreation",pt)},this.createRoomJoinedEvent=function(lt,mt,ot){var pt={eventType:"roomJoined",time:new Date,status:lt,roomId:mt,roomType:ot};this.eventDispatchMgr("roomJoined",pt)},this.createRoomInvitationEvent=function(lt,mt,ot,pt,ft,yt){var vt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{},bt="roomInvitation",At={eventType:"roomInvitation",time:new Date,roomId:lt,contactList:ft,senderId:mt,senderNickname:ot,senderPhotoURL:pt,roomType:yt};vt.cloudConvId&&(At.cloudConvId=vt.cloudConvId),vt.webconf===!0&&(At.webconf=!0),this.eventDispatchMgr(bt,At)},this.createRoomMemberUpdateEvent=function(lt,mt,ot,pt){var ft={eventType:"roomMemberUpdate",time:new Date,roomId:lt,contactList:mt,status:ot,roomType:pt};this.eventDispatchMgr("roomMemberUpdate",ft)},this.createContactListInRoomEvent=function(lt,mt,ot){var pt={eventType:"contactListInRoom",time:new Date,roomId:lt,contactList:mt,roomType:ot};this.eventDispatchMgr("contactListInRoom",pt)},this.createReceiveRoomMessageEvent=function(lt,mt,ot,pt,ft){var yt={eventType:"receiveRoomMessage",time:new Date,roomId:lt,senderId:mt,senderNickname:ot,message:pt,roomType:ft};this.eventDispatchMgr("receiveRoomMessage",yt)},this.createDesktopCaptureEvent=function(lt,mt,ot){var pt={eventType:"desktopCapture",time:new Date,event:lt,callId:mt,remoteId:ot};this.eventDispatchMgr("desktopCapture",pt)},this.createMediaDeviceChangedEvent=function(lt,mt,ot){var pt="NotDefined";mt!=null&&(pt=mt);var ft={eventType:"mediaDeviceChanged",time:new Date,diff:lt,updateReason:pt,firstMediaDeviceListInitialization:ot};this.eventDispatchMgr("mediaDeviceChanged",ft)},this.createSwitchStreamEvent=function(lt,mt){var ot={eventType:"switchStream",time:new Date,callId:lt,stream:mt};this.eventDispatchMgr("switchStream",ot)},this.createConnectedUsersListUpdateEvent=function(lt,mt,ot,pt){var ft={eventType:"ConnectedUsersListUpdate",time:new Date,group:lt,usersList:mt,status:ot,updateReason:pt};this.eventDispatchMgr("connectedUsersListUpdate",ft)},this.createClosingWhiteBoardEvent=function(lt,mt){var ot={eventType:"closingWhiteBoard",time:new Date,roomId:lt,reason:mt};this.eventDispatchMgr("closingWhiteBoard",ot)},this.createExternalJsLoadingStatusEvent=function(lt,mt){var ot={eventType:"externalJsLoadingStatus",extjs:lt,status:mt,time:new Date};this.eventDispatchMgr("externalJsLoadingStatus",ot)},this.createBackgroundSubstractionStopVisibilityChangeEvent=function(lt){var mt={userMediaStreamId:lt};this.eventDispatchMgr("backgroundSubstractionStopVisibilityChange",mt)},this.createBackgroundSubstractionStopComputeTimeEvent=function(lt){var mt={userMediaStreamId:lt};this.eventDispatchMgr("backgroundSubstractionStopComputeTime",mt)},this.createAIESnapshotEvent=function(lt,mt){var ot={userMediaStreamId:lt,image:mt};this.eventDispatchMgr("AIESnapshot",ot)},this.createAIELogEvent=function(lt,mt){var ot={userMediaStreamId:lt,log:mt};this.eventDispatchMgr("AIELog",ot)},this.createEvent=function(lt){if(!lt.eventType)throw new Error("The event json must have an eventType"+lt);lt.time=new Date,this.eventDispatchMgr(lt.eventType,lt)}}},940:(rt,it,s)=>{s.d(it,{S:()=>ht}),s(2772);var et=s(1549),nt=s(5945),at=et.Y.get("WebRTC_Stack"),ht=function(dt){this.sendInvite=function(ut,lt,mt,ot,pt,ft){var yt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{};at.debug("WebRTC_Stack::sendInvite()"),ft||(ft="media");var vt={type:"invite",callId:ut,callerId:lt,callerNickname:mt,calleeId:ot,roomId:pt,callType:ft};yt.mode&&(vt.mode=yt.mode);var bt=yt.offer;if(bt){if(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11){var At=bt.type,Nt=bt.sdp;at.log("JSON.stringify(type):",JSON.stringify(At)),at.log("JSON.stringify(sdp):",JSON.stringify(Nt)),bt={type:At,sdp:Nt}}vt.sdpoffer=bt}yt.data&&(vt.data=yt.data),yt.stream&&(vt.stream=yt.stream);var St=JSON.stringify(vt);at.info("C->S:",St),dt.emit("invite",St)},this.sendInviteBroadcast=function(ut,lt,mt,ot,pt,ft){var yt,vt;at.debug("WebRTC_Stack::sendInviteBroadcast()"),yt={type:"invite",callId:ut,callerId:lt,callerNickname:mt,calleeId:ot,roomId:pt,sdpoffer:ft},vt=JSON.stringify(yt),at.debug("C->S: "+vt),dt.emit("invite_broadcast",vt)},this.send200OK=function(ut,lt,mt,ot,pt,ft,yt){at.debug("WebRTC_Stack::send200OK()");var vt,bt,At=null;(nt.Xh==="IE"||nt.Xh==="Safari"&&nt.PR<11)&&(at.log("JSON.stringify(offer.sdp) :"+JSON.stringify(ft.sdp)),at.log("JSON.stringify(offer.type) :"+JSON.stringify(ft.type)),(At={}).sdp=ft.sdp,At.type=ft.type,ft=At),vt={type:"200OK",callId:ut,callerId:lt,calleeId:mt,calleeNickname:ot,roomId:pt,sdpanswer:ft,data:yt},bt=JSON.stringify(vt),at.info("C->S: "+bt),dt.emit("200OK",bt)},this.sendCandidate=function(ut,lt,mt,ot,pt,ft,yt,vt,bt,At){at.debug("WebRTC_Stack::sendCandidate()");var Nt=null,St={};at.debug("completeCandidate :",At),nt.Xh==="IE"?(at.log("Browser is IE, adapting completeCandidate"),St.sdpMLineIndex=At.sdpMLineIndex,St.candidate=At.candidate,St.sdpMid=At.sdpMid):St=At,bt!==null?(at.log("call data is defined :",bt),Nt={type:"candidate",callId:ut,callerId:lt,calleeId:mt,roomId:ot,dst:pt,label:ft,id:yt,candidate:vt,data:bt,completeCandidate:St}):(at.log("call data is undefined"),Nt={type:"candidate",callId:ut,callerId:lt,calleeId:mt,roomId:ot,dst:pt,label:ft,id:yt,candidate:vt,completeCandidate:St});var wt=JSON.stringify(Nt);at.info("C->S:",wt),dt.emit("candidate",wt)},this.sendBye=function(ut,lt,mt,ot,pt,ft){at.debug("WebRTC_Stack::sendBye()");var yt,vt=null;ft!==null?(at.log("call data is defined :"+ft),vt={type:"bye",callId:ut,clientId:lt,roomId:mt,dst:ot,reason:pt,data:ft}):(at.log("call data is undefined"),vt={type:"bye",callId:ut,clientId:lt,roomId:mt,dst:ot,reason:pt}),yt=JSON.stringify(vt),at.info("C->S: "+yt),dt.emit("bye",yt)},this.sendUpdate=function(ut,lt,mt,ot,pt,ft,yt,vt){at.debug("WebRTC_Stack::sendUpdate()");var bt,At=null;At={type:"update",callId:ut,callerId:lt,calleeId:mt,roomId:ot,dst:pt,sdpoffer:ft,callType:yt},vt!=null&&(at.log("call data is defined: "+vt),At.data=vt),bt=JSON.stringify(At),at.info("C->S: "+bt),dt.emit("update",bt)},this.send200Update=function(ut,lt,mt,ot,pt,ft,yt){at.debug("WebRTC_Stack::send200Update()");var vt,bt=null;yt!==null?(at.log("call data is defined :"+yt),bt={type:"200update",callId:ut,callerId:lt,calleeId:mt,roomId:ot,dst:pt,sdpanswer:ft,data:yt}):(at.log("call data is undefined"),bt={type:"200update",callId:ut,callerId:lt,calleeId:mt,roomId:ot,dst:pt,sdpanswer:ft}),vt=JSON.stringify(bt),at.info("C->S: "+vt),dt.emit("200update",vt)},this.sendDebugCommand=function(ut,lt,mt){var ot,pt;at.debug("WebRTC_Stack::sendDebugCommand :"+ut),ot={type:"debugCommand",command:ut,apiKey:lt,clientId:mt},pt=JSON.stringify(ot),at.info("C->S: "+pt),dt.emit("debugCommand",pt)},this.sendAck=function(ut,lt,mt){var ot,pt;at.debug("WebRTC_Stack::sendAck()"),ot={type:"Ack",AckMessageType:ut,cSeq:lt,dst:mt},pt=JSON.stringify(ot),at.info("C->S: "+pt),dt.emit("Ack",pt)},this.sendInfo=function(ut,lt){var mt,ot,pt=["activeSpeaker","callStats","stopSpeaking"];pt.indexOf(ut)<0&&at.debug("WebRTC_Stack::sendInfo()"),mt={type:"info",infoType:ut,data:lt},ot=JSON.stringify(mt),pt.indexOf(ut)<0&&at.info("C->S: "+ot),dt.emit("info",ot)},this.sendDataMessage=function(ut,lt){at.debug("WebRTC_Stack::sendDataMessage()");var mt={type:"apiRTCDataMessage",senderId:ut,data:lt},ot=JSON.stringify(mt);at.info("C->S: "+ot),dt.emit("apiRTCDataMessage",ot)}}},4170:(rt,it,s)=>{s.r(it),s(4916),s(4723),s(3710),s(1539),s(9714),s(561),function(et){var nt,at,ht=null,dt=null,ut=[];function lt(){return Math.random().toString(36).substr(2)}nt=function(){if(typeof apiRTC_React<"u")return"react-native";var mt,ot=navigator.appName,pt=navigator.userAgent,ft=pt.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);return ft&&(mt=pt.match(/version\/([\.\d]+)/i))!==null&&(ft[2]=mt[1]),(ft=ft?[ft[1],ft[2]]:[ot,navigator.appVersion,"-?"])[0]}(),at=function(){if(typeof apiRTC_React<"u")return 1;var mt,ot=navigator.appName,pt=navigator.userAgent,ft=pt.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);return ft&&(mt=pt.match(/version\/([\.\d]+)/i))!==null&&(ft[2]=mt[1]),(ft=ft?[ft[1],ft[2]]:[ot,navigator.appVersion,"-?"])[1]}(),dt=new function(){(nt==="MSIE"&&at>8||nt==="Netscape")&&function(){function mt(ot,pt){pt=pt||{bubbles:!1,cancelable:!1,detail:void 0};var ft=document.createEvent("CustomEvent");return ft.initCustomEvent(ot,pt.bubbles,pt.cancelable,pt.detail),ft}mt.prototype=et.CustomEvent.prototype,et.CustomEvent=mt}(),this.eventDispatchMgr=function(mt,ot){if(typeof apiRTC_React<"u"){var pt={type:mt,detail:ot};eventManager.dispatchEvent(pt)}else if(nt==="MSIE"&&at<=8)typeof $jqApz<"u"?$jqApz.event.trigger({type:mt,detail:ot}):typeof jQuery<"u"&&jQuery.event.trigger({type:mt,detail:ot});else{var ft=new CustomEvent(mt,{detail:ot,bubbles:!0,cancelable:!0});document.dispatchEvent(ft)}},this.createGetUserFromIdAnswerEvent=function(mt){var ot={eventType:"getUserFromIdAnswer",time:new Date,message:mt};this.eventDispatchMgr("getUserFromIdAnswer",ot)},this.createGetAllUsersAnswerEvent=function(mt){var ot={eventType:"getAllUsersAnswer",time:new Date,message:mt};this.eventDispatchMgr("getAllUsersAnswer",ot)},this.createErrorEvent=function(mt){var ot={eventType:"error :",time:new Date,errorInfo:mt};this.eventDispatchMgr("error",ot)},this.createSearchUserAnswerEvent=function(mt,ot,pt){var ft={eventType:"searchUserAnswer :",time:new Date,searchStr:mt,searchAnswerList:ot,group:pt};this.eventDispatchMgr("searchUserAnswer",ft)}},(ht={version:"1.0.4",description:"ApiRTC DataBase Library"}).init=function(mt){this.socket=mt,this.socket.on("getUserFromIdAnswer",this.callback(this,"onGetUserFromIdAnswer")).on("getAllUsersAnswer",this.callback(this,"onGetAllUsersAnswer")).on("searchUserAnswer",this.callback(this,"onSearchUserAnswer"))},ht.createUser=function(mt){if(mt!==null&&mt.mail!==null&&mt.id!==null){var ot=JSON.stringify(mt);this.socket.emit("createUser",ot)}},ht.searchUserInGroup=function(mt,ot,pt,ft){var yt=null,vt=null,bt=lt();(ot===void 0||ot!=="all"&&ot!=="connected"&&ot!=="disconnected")&&(ot="all"),mt!==null&&(yt={searchStr:mt,presenceState:ot,group:pt},ft!==void 0&&(yt.callbackId=bt,ut[bt]=ft),vt=JSON.stringify(yt),this.socket.emit("searchUser",vt))},ht.searchUser=function(mt,ot,pt,ft){var yt=null;typeof pt=="function"?(yt=pt,ht.searchUserInGroup(mt,ot,void 0,yt)):ht.searchUserInGroup(mt,ot,pt,ft)},ht.onSearchUserAnswer=function(mt){var ot=JSON.parse(mt);ot.callbackId!==void 0&&ot.callbackId in ut?(ut[ot.callbackId](ot.searchStr,ot.searchAnswerList),ut.splice(ot.callbackId,1)):dt.createSearchUserAnswerEvent(ot.searchStr,ot.searchAnswerList,ot.group)},ht.getUserFromId=function(mt,ot){var pt=null,ft=null,yt=lt();mt!==null&&(pt={id:mt},ot!==void 0&&(pt.callbackId=yt,ut[yt]=ot),ft=JSON.stringify(pt),this.socket.emit("getUserFromId",ft))},ht.onGetUserFromIdAnswer=function(mt){mt!==null&&mt.callbackId!==void 0&&mt.callbackId in ut?(ut[mt.callbackId](mt),ut.splice(mt.callbackId,1)):dt.createGetUserFromIdAnswerEvent(mt)},ht.getAllUsers=function(){var mt,ot;mt={},ot=JSON.stringify(mt),this.socket.emit("getAllUsers",ot)},ht.onGetAllUsersAnswer=function(mt){dt.createGetAllUsersAnswerEvent(mt)},ht.setPresenceStatus=function(mt,ot,pt){var ft,yt;ft={id:mt,presenceStatus:ot,commentStatus:pt},yt=JSON.stringify(ft),this.socket.emit("setPresenceStatus",yt)},ht.setUserStatus=function(mt,ot){var pt;ot.id=mt,pt=JSON.stringify(ot),this.socket.emit("setUserStatus",pt)},ht.setUserInfos=function(mt){var ot,pt;ot=mt,pt=JSON.stringify(ot),this.socket.emit("setUserInfos",pt)},ht.addEventListener=function(mt,ot){typeof apiRTC_React<"u"?eventManager.addEventListener(mt,ot):mt!=="getUserFromIdAnswer"||mt!=="error"||mt!=="getAllUsersAnswer"||mt!=="searchUserAnswer"?document.addEventListener(mt,ot,!1):dt.createErrorEvent("ERROR: Trying to add a listener on an unknow event")},ht.callback=function(mt,ot){return this.closureHandler=function(pt){return mt[ot](pt)},this.closureHandler},et.apiDB=ht}(window)},2746:(rt,it,s)=>{s.r(it);var et=s(1549).Y.get("onbeforeunload");apiCC.beforeUnloadFct=function(nt){et.debug("User has refreshed or left the page, eventType :",nt);try{if(typeof mailClicked<"u"&&mailClicked!==null&&(et.log("mailClicked variable is defined"),mailClicked===!0))return et.log("mailClicked is true : leaving onbeforeunload"),void(mailClicked=!1)}catch(ht){et.log("Catch error on PATCH/WORKAROUND to avoid reload of page in chrome when mailto :"+ht)}try{if(apiCC.iePluginInstallationPreventUnload!==void 0&&apiCC.iePluginInstallationPreventUnload!==null&&apiCC.iePluginInstallationPreventUnload===!0)return void et.log("iePluginInstallationPreventUnload is true : leaving onbeforeunload")}catch(ht){et.log("Catch error on PATCH/WORKAROUND to avoid reload of page in IE when installing webRTC plugin :"+ht)}if(apiCC!=null){if(apiRTC.session!==null&&apiRTC.session.remoteAccessInvitation!==null){var at;at=apiRTC.session.remoteAccessInvitation.invitationType==="sent"?{code:"AGENT_LEFT"}:{code:"USER_LEFT"},et.debug("Stopping remote access on refresh"),apiRTC.session.remoteAccessInvitation.stop(!0,at)}apiCC.storeSessionInfoInSessionStorage(),apiCC.cleanApiRTCContext(),apiCC.disconnect({invalidateApiCCId:!0}),apiCC.cleanAllEventListener(),apiCC.myEventTable=[]}apiCC!=null&&(apiCC.session=null,apiCC.jsLoaded=!1)},apiRTC.browser==="Mobile Safari"?window.addEventListener("pagehide",function(){apiCC.beforeUnloadFct("unload_MobileSafari")}):window.onbeforeunload=function(){apiCC.beforeUnloadFct("unload")}},9064:(rt,it,s)=>{function et(nt){return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(at){return typeof at}:function(at){return at&&typeof Symbol=="function"&&at.constructor===Symbol&&at!==Symbol.prototype?"symbol":typeof at},et(nt)}s(2222),s(2772),s(4916),s(3123),s(5306),s(1539),s(3710),s(9714),s(1058),s(2526),s(1817),s(2165),s(6992),s(8783),s(3948),rt=s.hmd(rt),function(nt){var at,ht="",dt="function",ut="undefined",lt="object",mt="string",ot="major",pt="model",ft="name",yt="type",vt="vendor",bt="version",At="architecture",Nt="console",St="mobile",wt="tablet",Mt="smarttv",Ht="wearable",Ot="embedded",Dt="user-agent",Gt="brands",nn="formFactor",zt="fullVersionList",Ft="platform",un="platformVersion",vn="bitness",yn=[Gt,zt,St,pt,Ft,un,At,nn,vn],cn="browser",gn="cpu",bn="device",fn="engine",Tn="os",_n="result",Un="Amazon",Pn="Apple",In="ASUS",Rn="BlackBerry",On="Google",Ln="Huawei",qn="LG",jn="Microsoft",Fn="Motorola",Zn="Samsung",on="Sharp",Hn="Sony",Bn="Xiaomi",zn="Zebra",$n="Facebook",Jn="Windows",Kn=et(nt)!==ut,An=Kn&&nt.navigator?nt.navigator:void 0,Wn=An&&An.userAgentData?An.userAgentData:void 0,Cn=function(kn){for(var Vn={},Xn=0;Xn0){for(var Xn in kn)if(Tt(kn[Xn])==Tt(Vn))return!0;return!1}return!!kt(kn)&&Tt(Vn).indexOf(Tt(kn))!==-1},qt=function(kn){for(var Vn in kn)return/^(browser|cpu|device|engine|os)$/.test(Vn)},kt=function(kn){return et(kn)===mt},st=function(kn){if(kn){for(var Vn=[],Xn=Et(/\\?\"/g,kn).split(","),cr=0;cr-1){var dr=Pt(Xn[cr]).split(";v=");Vn[cr]={brand:dr[0],version:dr[1]}}else Vn[cr]=Xn[cr];return Vn}},Tt=function(kn){return kt(kn)?kn.toLowerCase():kn},Rt=function(kn){return kt(kn)?Et(/[^\d\.]/g,kn).split(".")[0]:void 0},Lt=function(kn){for(var Vn in kn){var Xn=kn[Vn];et(Xn)==lt&&Xn.length==2?this[Xn[0]]=Xn[1]:this[Xn]=void 0}return this},Et=function(kn,Vn){return kt(Vn)?Vn.replace(kn,ht):Vn},jt=function(kn){return Et(/\\?\"/g,kn)},Pt=function(kn,Vn){if(kt(kn))return kn=Et(/^\s\s*/,kn),et(Vn)===ut?kn:kn.substring(0,500)},Vt=function(kn,Vn){if(kn&&Vn)for(var Xn,cr,dr,ur,Cr,Sr,_r=0;_r0?ur.length===2?et(ur[1])==dt?this[ur[0]]=ur[1].call(this,Sr):this[ur[0]]=ur[1]:ur.length===3?et(ur[1])!==dt||ur[1].exec&&ur[1].test?this[ur[0]]=Sr?Sr.replace(ur[1],ur[2]):void 0:this[ur[0]]=Sr?ur[1].call(this,Sr,ur[2]):void 0:ur.length===4&&(this[ur[0]]=Sr?ur[3].call(this,Sr.replace(ur[1],ur[2])):void 0):this[ur]=Sr||void 0;_r+=2}},Qt=function(kn,Vn){for(var Xn in Vn)if(et(Vn[Xn])===lt&&Vn[Xn].length>0){for(var cr=0;cr2&&this.set(pt,"iPad").set(yt,wt);break;case Tn:!this.get(ft)&&Wn&&Wn.platform&&this.set(ft,Wn.platform);break;case _n:var dr=this.data,ur=function(Cr){return dr[Cr].getItem().detectFeature().get()};this.set(cn,ur(cn)).set(gn,ur(gn)).set(bn,ur(bn)).set(fn,ur(fn)).set(Tn,ur(Tn))}return this},this.parseUA=function(){return this.itemType!=_n&&Vt.call(this.data,this.ua,this.rgxMap),this.itemType==cn&&this.set(ot,Rt(this.get(bt))),this},this.parseCH=function(){var dr=this.uaCH,ur=this.rgxMap;switch(this.itemType){case cn:var Cr=dr[zt]||dr.brands;if(Cr)for(var Sr in Cr){var _r=Cr[Sr].brand||Cr[Sr],br=Cr[Sr].version;!/not.a.brand/i.test(_r)&&(Sr<1||/chromi/i.test(this.get(ft)))&&this.set(ft,Et("Google ",_r)).set(bt,br).set(ot,Rt(br))}break;case gn:var Ir=dr.architecture;Ir&&(Ir&&dr.bitness=="64"&&(Ir+="64"),Vt.call(this.data,Ir+";",ur));break;case bn:if(dr.mobile&&this.set(yt,St),dr.model&&this.set(pt,dr.model),dr.formFactor){var kr;if(typeof dr.formFactor!="string")for(var Mr=0;!kr&&Mr=13?"11":"10"),this.set(ft,jr).set(bt,Wr)}break;case _n:var Qr=this.data,er=function(lr){return Qr[lr].getItem().setCH(dr).parseCH().get()};this.set(cn,er(cn)).set(gn,er(gn)).set(bn,er(bn)).set(fn,er(fn)).set(Tn,er(Tn))}return this},Lt.call(this,[["itemType",kn],["ua",Vn],["uaCH",cr],["rgxMap",Xn],["data",an(this,kn)]]),this}function Mn(kn,Vn,Xn){if(et(kn)===lt?(qt(kn)?(et(Vn)===lt&&(Xn=Vn),Vn=kn):(Xn=kn,Vn=void 0),kn=void 0):et(kn)!==mt||qt(Vn)||(Xn=Vn,Vn=void 0),!(this instanceof Mn))return new Mn(kn,Vn,Xn).getResult();var cr=et(kn)===mt?kn:An&&An.userAgent?An.userAgent:Xn&&Xn[Dt]?Xn[Dt]:ht,dr=new hn(Xn,!0),ur=Vn?function(Sr,_r){var br={};for(var Ir in Sr)br[Ir]=_r[Ir]&&_r[Ir].length%2==0?_r[Ir].concat(Sr[Ir]):Sr[Ir];return br}(sn,Vn):sn,Cr=function(Sr){return Sr==_n?function(){return new wn(Sr,cr,ur,dr).set("ua",cr).set(cn,this.getBrowser()).set(gn,this.getCPU()).set(bn,this.getDevice()).set(fn,this.getEngine()).set(Tn,this.getOS()).get()}:function(){return new wn(Sr,cr,ur[Sr],dr).parseUA().get()}};return Lt.call(this,[["getBrowser",Cr(cn)],["getCPU",Cr(gn)],["getDevice",Cr(bn)],["getEngine",Cr(fn)],["getOS",Cr(Tn)],["getResult",Cr(_n)],["getUA",function(){return cr}],["setUA",function(Sr){return kt(Sr)&&(cr=Sr.length>500?Pt(Sr,500):Sr),this}]]).setUA(cr),this}Mn.VERSION="2.0.0-beta.1",Mn.BROWSER=Cn([ft,bt,ot]),Mn.CPU=Cn([At]),Mn.DEVICE=Cn([pt,vt,yt,Nt,St,Mt,wt,Ht,Ot]),Mn.ENGINE=Mn.OS=Cn([ft,bt]),et(o)!==ut?(et(rt)!==ut&&rt.exports&&(o=rt.exports=Mn),o.UAParser=Mn,nt.UAParser=Mn):Kn&&(nt.UAParser=Mn);var xn=Kn&&(nt.jQuery||nt.Zepto);if(xn&&!xn.ua){var En=new Mn;xn.ua=En.getResult(),xn.ua.get=function(){return En.getUA()},xn.ua.set=function(kn){En.setUA(kn);var Vn=En.getResult();for(var Xn in Vn)xn.ua[Xn]=Vn[Xn]}}}((typeof window>"u"?"undefined":et(window))==="object"?window:void 0)},1256:(rt,it,s)=>{s.r(it),s.d(it,{Call:()=>Sr,CloudApi:()=>cp,Conference:()=>Fs,Contact:()=>No,Conversation:()=>$o,ConversationCall:()=>Gl,DataChannel:()=>ys,Enterprise:()=>Xs,EventCenter:()=>wt,EventEmitter:()=>dt,MediaDevice:()=>Ot,Observable:()=>un,PointerSharingRoom:()=>ru,ReceivedCallInvitation:()=>Ar,ReceivedConversationInvitation:()=>Vt,ReceivedConversationJoinRequest:()=>zo,ReceivedDataChannelInvitation:()=>Ho,ReceivedFileTransferInvitation:()=>eo,ReceivedInvitation:()=>Nn,ReceivedPointerSharingInvitation:()=>Ml,ReceivedWhiteboardInvitation:()=>vs,SentInvitation:()=>Do,Session:()=>zr,Stream:()=>so,UserAgent:()=>sp,UserData:()=>Io,default:()=>Em}),s(7941),s(2526),s(1817),s(1539),s(2165),s(6992),s(8783),s(3948);var et=s(3173);function nt(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function at(Wt){return at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},at(Wt)}function ht(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}s(4603),s(4916),s(9714),s(7042),s(561),s(9070),s(8309),s(1038),s(9753);var dt=function(){function Wt(){(function(xt,Bt){if(!(xt instanceof Bt))throw new TypeError("Cannot call a class as a function")})(this,Wt)}var $t,Zt;return $t=Wt,Zt=[{key:"getListeners",value:function(xt){var Bt,dn,pn=this._getEvents();if(xt instanceof RegExp)for(dn in Bt={},pn)pn.hasOwnProperty(dn)&&xt.test(dn)&&(Bt[dn]=pn[dn]);else Bt=pn[xt]||(pn[xt]=[]);return Bt}},{key:"flattenListeners",value:function(xt){var Bt,dn=[];for(Bt=0;Bt=Yt.length?{done:!0}:{done:!1,value:Yt[ln++]}},e:function(hr){throw hr},f:Sn}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Dn,rr=!0,ar=!1;return{s:function(){tn=tn.call(Yt)},n:function(){var hr=tn.next();return rr=hr.done,hr},e:function(hr){ar=!0,Dn=hr},f:function(){try{rr||tn.return==null||tn.return()}finally{if(ar)throw Dn}}}}(apiRTC.userAgentInstance.currentSession.waitingContactListUpdateEvent);try{for(It.s();!(Ct=It.n()).done;){var Ut=Ct.value;this.emit("contactListUpdate",Ut)}}catch(Yt){It.e(Yt)}finally{It.f()}apiRTC.userAgentInstance.currentSession.waitingContactListUpdateEvent=[]}else if(xt==="mediaDeviceChanged"&&apiRTC.mediaDeviceMgr.mediaDeviceChangedDetected===!0){var Kt=apiRTC.mediaDeviceMgr.getMediaDeviceListsDiff(apiRTC.mediaDeviceMgr.mediaDeviceSourceInfosArray,apiRTC.mediaDeviceMgr.mediaDeviceSourceInfosArrayBeforeGotSources);apiRTC.myWebRTC_Event.createMediaDeviceChangedEvent(Kt,"updatedOnDeviceChange",apiRTC.mediaDeviceMgr.realMediaDevicesListInitializationWasAlreadyDone)}return this}},{key:"addOnceListener",value:function(xt,Bt){return this.addListener(xt,{listener:Bt,once:!0})}},{key:"defineEvent",value:function(xt){return this.getListeners(xt),this}},{key:"defineEvents",value:function(xt){for(var Bt=0;Bt"u"&&(document.addEventListener("error",function(Bt){xt.handleErrorEvent(Bt)}),document.addEventListener("userMediaError",function(Bt){xt.handleErrorEvent(Bt)}))}var $t,Zt;return $t=Wt,Zt=[{key:"handleErrorEvent",value:function(xt){var Bt=xt.detail;if(this.storageDisabled!==!0)if(Bt!==void 0){var dn={},pn={},Xt="UNKNOWN";dn.type=xt.type;for(var Ct=0,It=Object.keys(Bt);Ct100&&Kt.splice(100,Kt.length-100),localStorage.setItem(Nt,JSON.stringify(Kt)),this.consoleOutputEnabled&&At.error("[EVENTCENTER]",dn),typeof Sentry<"u"&&(xt.detail.errorCode!=="USER_MEDIA_ERROR"?(pn.type=xt.type,xt.detail.error&&(pn.error=xt.detail.error),xt.detail.errorInfo&&(pn.errorInfo=xt.detail.errorInfo),xt.detail.errorCode&&(pn.errorCode=xt.detail.errorCode),xt.detail.callId&&(pn.callId=xt.detail.callId),xt.detail.convId&&(pn.convId=xt.detail.convId),xt.detail.gumConfig&&(xt.detail.gumConfig.video===!1?pn.gumConfigVideo=!1:pn.gumConfigVideo=!0),Sentry.withScope(function(Yt){Yt.setTag("event-center",!0),Yt.setTag("userId",vt.session.apiCCId),Sentry.captureException(new Error(JSON.stringify(pn)))})):At.debug("Filtering error event for USER_MEDIA_ERROR for Sentry"))}else At.error("Can't handle error event: data is undefined");else At.debug("Event Center is disabled")}},{key:"handleDataAnswer",value:function(xt){xt?xt.map(function(Bt){At.debug(St+": ",Bt)}):At.debug(St+": "+this.getUsername()+" has no event records")}},{key:"getStoredData",value:function(){var xt=localStorage.getItem(Nt);return xt===void 0?(At.warn("No data was stored by event center"),null):JSON.parse(xt)}},{key:"clearStoredData",value:function(){localStorage.removeItem(Nt)}},{key:"enableConsoleOutput",value:function(xt){this.consoleOutputEnabled=xt}},{key:"disableStorage",value:function(xt){this.storageDisabled=xt}}],Zt&&bt($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function Mt(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}s(3710);var Ht=ft.Y.get("MediaDevice"),Ot=function(){function Wt(xt,Bt,dn,pn){(function(Xt,Ct){if(!(Xt instanceof Ct))throw new TypeError("Cannot call a class as a function")})(this,Wt),Ht.trace("Create "+Bt+" MediaDevice"),this.id=xt,this.type=Bt,this.label=dn,this.capabilities=pn}var $t,Zt;return $t=Wt,(Zt=[{key:"getId",value:function(){return this.id.toString()}},{key:"getType",value:function(){return this.type}},{key:"getLabel",value:function(){return this.label}},{key:"isCamera",value:function(){return this.type==="videoinput"}},{key:"isMicrophone",value:function(){return this.type==="audioinput"}},{key:"isAudioOutput",value:function(){return this.type==="audiooutput"}},{key:"getCapabilities",value:function(){return this.capabilities}}])&&Mt($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}(),Dt=(s(1532),s(4129),s(9653),s(4363),s(2772),s(9554),s(4747),s(8674),s(9575),s(2472),s(2990),s(8927),s(3105),s(5035),s(4345),s(7174),s(2846),s(4731),s(7209),s(6319),s(8867),s(7789),s(3739),s(9368),s(4483),s(2056),s(3462),s(678),s(7462),s(3824),s(5021),s(2974),s(5016),s(2707),s(2564),s(7327),s(9600),s(285),s(1637),s(2479),s(4812),s(2222),s(1058),s(6755),s(4986),s(8304),s(489),s(2419),s(8011),s(2443),s(3680),s(3706),s(2703),s(4819),s(5003),s(1215));function Gt(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function nn(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}var zt=new WeakMap,Ft=new WeakMap,un=function(){function Wt(Bt){(function(dn,pn){if(!(dn instanceof pn))throw new TypeError("Cannot call a class as a function")})(this,Wt),Ft.set(this,Bt),zt.set(this,new dt)}var $t,Zt,xt;return $t=Wt,xt=[{key:"getAvailableEvents",value:function(){return[]}}],(Zt=[{key:"on",value:function(Bt,dn){return this.constructor.getAvailableEvents().indexOf(Bt)>-1?zt.get(this).on(Bt,dn):Ft.get(this).error("No such event "+Bt),this}},{key:"removeListener",value:function(Bt,dn){if(this.constructor.getAvailableEvents().indexOf(Bt)>-1){var pn,Xt=!1,Ct=function(It,Ut){var Kt=typeof Symbol<"u"&&It[Symbol.iterator]||It["@@iterator"];if(!Kt){if(Array.isArray(It)||(Kt=function(Dn,rr){if(Dn){if(typeof Dn=="string")return Gt(Dn,rr);var ar=Object.prototype.toString.call(Dn).slice(8,-1);return ar==="Object"&&Dn.constructor&&(ar=Dn.constructor.name),ar==="Map"||ar==="Set"?Array.from(Dn):ar==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ar)?Gt(Dn,rr):void 0}}(It))||Ut&&It&&typeof It.length=="number"){Kt&&(It=Kt);var Yt=0,en=function(){};return{s:en,n:function(){return Yt>=It.length?{done:!0}:{done:!1,value:It[Yt++]}},e:function(Dn){throw Dn},f:en}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var tn,ln=!0,Sn=!1;return{s:function(){Kt=Kt.call(It)},n:function(){var Dn=Kt.next();return ln=Dn.done,Dn},e:function(Dn){Sn=!0,tn=Dn},f:function(){try{ln||Kt.return==null||Kt.return()}finally{if(Sn)throw tn}}}}(zt.get(this).getListeners(Bt));try{for(Ct.s();!(pn=Ct.n()).done;)if(pn.value.listener===dn){Xt=!0;break}}catch(It){Ct.e(It)}finally{Ct.f()}Xt?zt.get(this).off(Bt,dn):Ft.get(this).trace("removeListener() - No such listener for event "+Bt)}else Ft.get(this).error("No such event "+Bt);return this}}])&&nn($t.prototype,Zt),xt&&nn($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function vn(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return yn(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?yn(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function yn(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function cn(Wt){return cn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},cn(Wt)}function gn(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}s(6699),s(2023),s(3843);var bn=ft.Y.get("ApiRTCManager"),fn=["sessionReady","incomingCall","callEstablished","userMediaSuccess","userMediaStop","userMediaError","callRestarting","error","receiveIMMessage","updatePresence","webRTCClientCreated","updateUserStatus","channelEvent","groupChatCreation","groupChatInvitation","groupChatMemberUpdate","addUserInGroupChatAnswer","receiveGroupChatMessage","userDataAnswer","fetchUserDataAnswer","receiveConversationList","receiveConversationHistory","receiveConversationDetailReport","receiveContactOccurrencesFromConversationList","receiveMCUSessionInvitation","MCUSessionCreation","MCUAvailableStream","MCUAvailableStreamUpdate","MCURemoveStream","canPlayRemoteVideo","recordedFileAvailable","receiveData","roomCreation","roomJoined","roomInvitation","roomMemberUpdate","receiveRoomMessage","contactListInRoom","snapShotPhotoUploaded","stopRecord","callAttempt","joinMCUSessionAnswer","hangup","desktopCapture","remoteStreamAdded","remoteStreamRemoved","switchStream","sendDataChannelOpen","sendDataChannelClose","sendDataChannelError","receiveDataChannelOpen","receiveDataChannelClose","receiveDataChannelError","connectedUsersListUpdate","onFileSended","onFileSending","onFileReceiving","onFileReceived","onFileProgress","onFilePending","recordedStreamsAvailable","closingWhiteBoard","webRTCPluginInstallation","onQosStatsUpdate","onQosChange","onQosAudioChange","onQosVideoChange","MCURecordedStreamsAvailable","MCURecordingStarted","MCURecordingStopped","ICECandidateTypeUpdate","disconnectionWarning","MCUAvailableComposite","MCUParticipantEjected","MCUStreamingStarted","MCUStreamingStopped","MCUAvailableReplay","MCURoomModeChanged","onCallStatsUpdate","slowLink","localStreamUpdated","remoteStreamUpdated","audioAmplitude","videoQualityChanged","cpuLimited","bandwidthLimited","simulcastFeedChanged","cloudEventOccurred","groupUnsubscribed","transferBegun","transferProgress","transferEnded"],Tn=null,_n=!1,Un=!1,Pn=function(Wt){if(Tn!==null&&Tn.isInitialized()){if(Wt==="groupUnsubscribed"||Wt==="transferBegun"||Wt==="transferProgress"||Wt==="transferEnded")return;apiRTC.addEventListener(Wt,function($t){bn.trace("Emiting "+Wt,$t),Tn.eventEmitter.emit(Wt,$t)})}},In=function(Wt){Tn!==null&&Tn.isInitialized()&&apiRTC.removeEventListener(Wt,function($t){bn.trace("Emiting "+Wt,$t),Tn.eventEmitter.emit(Wt,$t)})},Rn=function(){function Wt(){if(function(Bt,dn){if(!(Bt instanceof dn))throw new TypeError("Cannot call a class as a function")}(this,Wt),Tn!==null)throw"Cannot construct singleton ApiRTCManager";this.eventEmitter=new dt,this.apiRTCSession=null,this.whiteBoardClient=null,this.pointerSharingClient=null,this.webRTCClient=null,this.dataClient=null,this.IMClient=null,this.contactDisconnectionDelay=et.g.CONTACT_DISCONNECTION_DELAY,Tn=this}var $t,Zt,xt;return $t=Wt,Zt=[{key:"onEvent",value:function(Bt,dn){return fn.indexOf(Bt)>-1?this.eventEmitter.on(Bt,dn):bn.error("No such apiRTC event "+Bt),this}},{key:"onceEvent",value:function(Bt,dn){fn.indexOf(Bt)>-1?this.eventEmitter.once(Bt,dn):bn.error("No such apiRTC event "+Bt)}},{key:"sendData",value:function(Bt,dn){var pn=this;return new Promise(function(Xt,Ct){pn.dataClient===null?Ct(et.g.ERROR_APIRTC_INITIALISATION_FAILED):pn.dataClient.sendData(Bt,dn,function(It){var Ut=et.g.ERROR_OTHER;It!=null?It.reason!=="timeoutReached"&&It.reason!=="destNotFound"?Xt():(It.reason==="timerReached"?Ut=et.g.ERROR_TIMED_OUT:It.reason==="destNotFound"&&(Ut=et.g.ERROR_NOT_FOUND),Ct(Ut)):Ct(Ut)})})}},{key:"sendMessage",value:function(Bt,dn){var pn=this,Xt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise(function(Ct,It){pn.IMClient===null?It(et.g.ERROR_APIRTC_INITIALISATION_FAILED):pn.IMClient.sendMessage(Bt,dn,function(Ut){var Kt=et.g.ERROR_OTHER;Ut!=null?Ut.reason!=="timeoutReached"&&Ut.reason!=="destNotFound"?Ct(Ut.UUCSeq):(Ut.reason==="timerReached"?Kt=et.g.ERROR_TIMED_OUT:Ut.reason==="destNotFound"&&(Kt=et.g.ERROR_NOT_FOUND),It(Kt)):It(Kt)},Xt)})}},{key:"joinGroupChat",value:function(Bt){var dn=this;return new Promise(function(pn,Xt){if(dn.IMClient===null)return Xt(Dt.g.createError(et.g.ERROR_WRONG_STATE,"joinGroupChat() - cannot join group chat"));dn.IMClient.joinGroupChat(Bt),pn()})}},{key:"leaveGroupChat",value:function(Bt){var dn=this;return new Promise(function(pn,Xt){if(dn.IMClient===null)return Xt(Dt.g.createError(et.g.ERROR_WRONG_STATE,"leaveGroupChat() - cannot leave group chat"));dn.IMClient.leaveGroupChat(Bt),pn()})}},{key:"sendMessageToGroupChat",value:function(Bt,dn){var pn=this,Xt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise(function(Ct,It){if(pn.IMClient===null)It(et.g.ERROR_APIRTC_INITIALISATION_FAILED);else{var Ut={};Dt.g.isTypeof(Xt,"metadata","object")&&(Ut.metadata=Xt.metadata),pn.IMClient.sendMessageToGroupChat(Bt,dn,function(Kt){return Kt!==null&&cn(Kt)==="object"?Kt.reason==="ack"?Ct(Kt.UUCSeq):Kt.reason==="timeoutReached"?It(et.g.ERROR_TIMED_OUT):Kt.reason==="destNotFound"?It(et.g.ERROR_NOT_FOUND):It(et.g.ERROR_OTHER):It(et.g.ERROR_OTHER)},Ut)}})}},{key:"removeEventListener",value:function(Bt,dn){dn!=null&&(fn.indexOf(Bt)>-1?this.eventEmitter.off(Bt,dn):bn.error("No such apiRTC event "+Bt))}},{key:"isInitialized",value:function(){return _n}},{key:"unsubscribeToPresenceGroup",value:function(Bt){this.apiRTCSession!==null?(this.apiRTCSession.unsubscribePresenceGroup([Bt]),Tn.eventEmitter.emit("groupUnsubscribed",Bt)):bn.error("apiRTC session is not initialized")}},{key:"joinAndSubscribeToPresenceGroup",value:function(Bt){this.apiRTCSession!==null?(this.apiRTCSession.joinPresenceGroup([Bt]),this.apiRTCSession.subscribePresenceGroup([Bt])):bn.error("apiRTC session is not initialized")}},{key:"leaveAndUnsubscribeToPresenceGroup",value:function(Bt){this.apiRTCSession!==null?(this.apiRTCSession.leavePresenceGroup([Bt]),this.unsubscribeToPresenceGroup(Bt)):bn.error("apiRTC session is not initialized")}},{key:"subscribeToCloudEvent",value:function(Bt,dn){this.apiRTCSession?this.apiRTCSession.subscribeToCloudEvent(Bt,dn):bn.error("apiRTC session is not initialized")}},{key:"unsubscribeToCloudEvent",value:function(Bt,dn){this.apiRTCSession?this.apiRTCSession.unsubscribeToCloudEvent(Bt,dn):bn.error("apiRTC session is not initialized")}},{key:"disconnect",value:function(){var Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(apiRTC.disconnect(Bt),_n=!1,this.apiRTCSession=null,this.webRTCClient=null,this.dataClient=null,this.IMClient=null,Un){var dn,pn=vn(fn);try{for(pn.s();!(dn=pn.n()).done;){var Xt=dn.value;In(Xt)}}catch(Ct){pn.e(Ct)}finally{pn.f()}Un=!1}}},{key:"initializeApiRTC",value:function(Bt){return bn.info("initializeApiRTC()"),new Promise(function(dn,pn){if(Bt===void 0||Bt.apiKey===void 0)pn("Invalid apiRTC initialization params");else{var Xt=function(Ct){switch(bn.debug("onChannelEventDuringInit()",Ct.detail),Ct.detail.channelEvent){case"onChannelError":pn("Channel Error : "+Ct.detail.event);break;case"onChannelConnectError":pn("Channel Connect Error : "+Ct.detail.event);break;case"onChannelOpened":bn.debug("onChannelOpened");break;default:bn.debug("Unhandle case in onChannelEventDuringInit :",Ct.detail.channelEvent)}};apiRTC.addEventListener("channelEvent",Xt),Bt.onReady=function(){if(_n=!0,Tn.webRTCClient=apiRTC.session.createWebRTCClient({}),Tn.webRTCClient.setMCUConnector(Bt.hasOwnProperty("mcu")?Bt.mcu:et.g.DEFAULT_MCU),Dt.g.isPropertyTypeof(Bt,"turnServerAddress","string")&&Tn.webRTCClient.setClientTurnServer(Bt.turnServerAddress),Tn.webRTCClient.setUserAcceptOnIncomingCallBeforeGetUserMedia(!0),Dt.g.isPropertyTypeof(Bt,"userAcceptOnIncomingDataCall","boolean")?Tn.webRTCClient.setUserAcceptOnIncomingDataCall(Bt.userAcceptOnIncomingDataCall):Tn.webRTCClient.setUserAcceptOnIncomingDataCall(!0),Dt.g.isPropertyTypeof(Bt,"userAcceptOnIncomingScreenSharingCall","boolean")?Tn.webRTCClient.setUserAcceptOnIncomingScreenSharingCall(Bt.userAcceptOnIncomingScreenSharingCall):Tn.webRTCClient.setUserAcceptOnIncomingScreenSharingCall(!1),Tn.dataClient=apiRTC.session.createDataClient(),Tn.IMClient=apiRTC.session.createIMClient(),Tn.pointerSharingClient=apiRTC.session.createPointerSharingClient(),Tn.webRTCClient.setAllowMultipleCalls(!0),Tn.apiRTCSession=apiRTC.session,!Un){var Ct,It=vn(fn);try{for(It.s();!(Ct=It.n()).done;){var Ut=Ct.value;Pn(Ut)}}catch(Kt){It.e(Kt)}finally{It.f()}Un=!0}apiRTC.removeEventListener("channelEvent",Xt),dn(apiRTC.session.apiCCId)},_n=!1,Tn.apiRTCSession=null,Tn.webRTCClient=null,Tn.dataClient=null,Tn.IMClient=null,apiRTC.init(Bt)}})}},{key:"createWhiteBoard",value:function(){bn.debug("createWhiteBoard()"),Tn.whiteBoardClient=apiRTC.createWhiteBoard(null,"invisible",null,6e4)}},{key:"getMediaDevices",value:function(){return bn.debug("ApiRTCManager::getMediaDevices()"),new Promise(function(Bt,dn){apiRTC.getMediaDevices().then(function(pn){bn.debug("ApiRTCManager::getMediaDevices(), sources :",pn),Bt(pn)}).catch(function(pn){var Xt="getMediaDevices() - error";bn.error(Xt,pn),dn(new Error(Xt))})})}},{key:"getUserMedia",value:function(Bt){return new Promise(function(dn,pn){apiRTC.getUserMedia(Bt).then(function(Xt){bn.debug("ApiRTCManager::getUserMedia() success"),dn(Xt)}).catch(function(Xt){bn.error("ApiRTCManager::getUserMedia() - Could not get user media :",Xt),pn(new Error("ApiRTCManager::getUserMedia() - Could not get user media :"+Xt))})})}},{key:"setAudioSourceIdInConstraint",value:function(Bt,dn){return apiRTC.setAudioSourceIdInConstraint(Bt,dn)}},{key:"setVideoSourceIdInConstraint",value:function(Bt,dn){return apiRTC.setVideoSourceIdInConstraint(Bt,dn)}},{key:"attachMediaStream",value:function(Bt,dn){apiRTC.attachMediaStream(Bt,dn)}},{key:"addStreamInDiv",value:function(Bt,dn,pn,Xt,Ct,It,Ut){apiRTC.addStreamInDiv(Bt,dn,pn,Xt,Ct,It,Ut)}},{key:"removeElementFromDiv",value:function(Bt,dn){bn.debug("removeElementFromDiv"),apiRTC.removeElementFromDiv(Bt,dn)}},{key:"getClientId",value:function(){return this.apiRTCSession!==null&&this.apiRTCSession.apiCCWebRTCClient!==null?this.apiRTCSession.apiCCWebRTCClient.webRTCClient.clientId:null}},{key:"getActiveApiKey",value:function(){return apiRTC.session!==void 0&&apiRTC.session!==null?apiRTC.session.apiKey:null}}],xt=[{key:"get",value:function(){return Tn===null&&(Tn=new Wt),Tn}}],Zt&&gn($t.prototype,Zt),xt&&gn($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function On(Wt){return On=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},On(Wt)}function Ln(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function qn(Wt,$t){return qn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},qn(Wt,$t)}function jn(Wt,$t){if($t&&(On($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fn(Wt)}function Fn(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Zn(Wt){return Zn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Zn(Wt)}var on=ft.Y.get("Invitation"),Hn=new WeakMap,Bn=["statusChange"],zn=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&qn(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Zn(Bt);if(dn){var Ut=Zn(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return jn(this,Ct)});function Xt(){var Ct;return function(It,Ut){if(!(It instanceof Ut))throw new TypeError("Cannot call a class as a function")}(this,Xt),(Ct=pn.call(this,on)).id=null,Hn.set(Fn(Ct),et.g.INVITATION_STATUS_STANDBY),Ct.apiRTCManager=Rn.get(),Ct.type="not_defined",Ct}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return Bn}}],(Zt=[{key:"setStatus",value:function(Ct){Hn.set(this,Ct),zt.get(this).emit("statusChange",{status:Ct,id:this.id})}},{key:"getStatus",value:function(){return Hn.get(this)}}])&&Ln($t.prototype,Zt),xt&&Ln($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(un);function $n(Wt){return $n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},$n(Wt)}function Jn(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Kn(Wt,$t){return Kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Kn(Wt,$t)}function An(Wt,$t){if($t&&($n($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Wn(Wt){return Wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Wn(Wt)}ft.Y.get("ReceivedInvitation");var Cn=["statusChange","messageDelivered","messageNotDelivered"],Nn=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Kn(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Wn(Bt);if(dn){var Ut=Wn(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return An(this,Ct)});function Xt(Ct,It){var Ut;return function(Kt,Yt){if(!(Kt instanceof Yt))throw new TypeError("Cannot call a class as a function")}(this,Xt),(Ut=pn.call(this)).invitationType="received",Ut.id=It,Ut.sender=Ct,Ut.receiveTime=Date.now(),Ut}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return Cn}}],(Zt=[{key:"accept",value:function(){return new Promise}},{key:"decline",value:function(Ct){}},{key:"getSender",value:function(){return this.sender}},{key:"getReceiveTime",value:function(){return this.receiveTime}},{key:"getId",value:function(){return this.id}}])&&Jn($t.prototype,Zt),xt&&Jn($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(zn);function qt(Wt){return qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},qt(Wt)}function kt(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function st(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Tt(Wt,$t){return Tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Tt(Wt,$t)}function Rt(Wt,$t){if($t&&(qt($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lt(Wt)}function Lt(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Et(Wt){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Et(Wt)}var jt=ft.Y.get("ReceivedInvitation"),Pt=new WeakMap,Vt=function(Wt){(function(Xt,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");Xt.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:Xt,writable:!0,configurable:!0}}),Object.defineProperty(Xt,"prototype",{writable:!1}),Ct&&Tt(Xt,Ct)})(pn,Wt);var $t,Zt,xt,Bt,dn=(xt=pn,Bt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Xt,Ct=Et(xt);if(Bt){var It=Et(this).constructor;Xt=Reflect.construct(Ct,arguments,It)}else Xt=Ct.apply(this,arguments);return Rt(this,Xt)});function pn(Xt,Ct,It){var Ut,Kt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return kt(this,pn),Ut=dn.call(this,Xt,Ct.invitationId),jt.info("Create ReceivedConversationInvitation"),Ut.conversation=It,Ut.type="conversation",Ut.invitationData=Ct,Pt.set(Lt(Ut),Kt),Ut}return $t=pn,Zt=[{key:"accept",value:function(Xt){var Ct=this,It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ut=function(){return new Promise(function(Yt,en){var tn=Pt.get(Ct);It.hasOwnProperty("password")&&(tn.password=It.password),It.hasOwnProperty("session")&&(tn.session=It.session),Ct.conversation.join(tn).then(function(){Xt!=null&&Ct.conversation.publish(Xt),Yt(Ct.conversation)}).catch(function(ln){en(Dt.g.createError(et.g.ERROR_OTHER,"accept() - cannot join webconf",jt,{fromError:ln}))})})},Kt=function(){return new Promise(function(Yt,en){Ct.conversation.joinGroupChat().then(function(){Yt(Ct.conversation)}).catch(function(tn){en(Dt.g.createError(et.g.ERROR_OTHER,"accept() - cannot join groupChat",jt,{fromError:tn}))})})};return new Promise(function(Yt,en){return Ct.getStatus()!==et.g.INVITATION_STATUS_STANDBY?en(Dt.g.createError(et.g.ERROR_WRONG_STATE,"accept() - cannot accept invitation",jt)):(Ct.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Ct.apiRTCManager.sendData(Ct.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:Ct.id,answer:"accept"}),Ct.invitationData&&Ct.invitationData.conversationTypes?Ct.invitationData.conversationTypes.indexOf("WEBCONF")>=0?Ut().then(Yt).catch(en):Ct.invitationData.conversationTypes.indexOf("GROUP_CHAT")>=0?Kt().then(Yt).catch(en):void 0:Ut().then(Yt).catch(en))})}},{key:"decline",value:function(Xt){this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(this.setStatus(et.g.INVITATION_STATUS_DECLINED),this.apiRTCManager.sendData(this.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:this.id,reason:Xt,answer:"decline"}))}},{key:"getConversation",value:function(){return this.conversation}}],Zt&&st($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),pn}(Nn);function Qt(Wt){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Qt(Wt)}function rn(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Jt(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Jt(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Jt(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function sn(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function mn(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function an(Wt,$t){return an=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},an(Wt,$t)}function hn(Wt,$t){if($t&&(Qt($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wn(Wt)}function wn(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Mn(Wt){return Mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Mn(Wt)}s(189);var xn=ft.Y.get("Call"),En=Rn.get(),kn=["streamAdded","streamRemoved","response","accepted","declined","hangup","localStreamAvailable","recordAvailable","statsUpdate","error","disconnectionWarning","userMediaError","desktopCapture","remoteStreamUpdated","recordingStarted","recordingStopped","recordingAvailable","remoteStreamIdUpdated"],Vn=new Set(["audioSent","videoSent","audioReceived","videoReceived","quality"]),Xn=new WeakMap,cr=new WeakMap,dr=new WeakMap,ur=new WeakMap,Cr=new WeakMap,Sr=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&an(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Mn(Bt);if(dn){var Ut=Mn(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return hn(this,Ct)});function Xt(Ct,It){var Ut,Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(sn(this,Xt),Ut=pn.call(this,xn),xn.debug("Create Call with id "+Ct),Xn.set(wn(Ut),Ct),cr.set(wn(Ut),It),Ut.publishedStreams=new Map,Ut.receivedStreams=new Map,Ut.stats={},dr.set(wn(Ut),Kt.hasOwnProperty("started")&&Kt.started?et.g.CALL_STATUS_ONGOING:et.g.CALL_STATUS_WAITING_FOR_CALLEE),ur.set(wn(Ut),!!Kt.hasOwnProperty("isRecorded")&&Kt.isRecorded),Kt.isRecorded){Ut.confId=null,Ut.recordingStatus=null;for(var Yt=En.webRTCClient.webRTCClient.callsTable.length;--Yt>=0;){var en=En.webRTCClient.webRTCClient.callsTable[Yt];if(en.callId===Ct&&en.data){Ut.confId=en.data.confId;break}}ur.set(wn(Ut),!0)}else ur.set(wn(Ut),!1);var tn={hangup:function(Sn){Ut.getId()===Sn.detail.callId&&Ut.destroy()},receiveData:function(Sn){if(Sn.detail.data.info!==void 0)Sn.detail.data.info===et.g.INVITATION_ANSWER_IDENTIFIER&&Sn.detail.data.invitationId.toString()===Ut.getId()&&Ut.getStatus()===et.g.CALL_STATUS_WAITING_FOR_CALLEE&&(xn.info("Call answer from "+Ut.getContact().getUsername()+" for "+Ut.getId()),Sn.detail.data.answer==="accept"?(dr.set(wn(Ut),et.g.CALL_STATUS_ONGOING),zt.get(wn(Ut)).emit("accepted"),zt.get(wn(Ut)).emit("response","accepted")):(dr.set(wn(Ut),et.g.CALL_STATUS_ENDED),zt.get(wn(Ut)).emit("declined",{reason:"User_Refused_Call"}),zt.get(wn(Ut)).emit("response","declined")));else if(Ut.getId()===Sn.detail.data.callId&&Sn.detail.data.event===et.g.CONTACT_STREAM_UPDATED_INFO){var Dn={callId:Sn.detail.data.callId,newStreamId:Sn.detail.data.newStreamId,oldStreamId:Sn.detail.data.oldStreamId};zt.get(wn(Ut)).emit("remoteStreamIdUpdated",Dn)}},remoteStreamUpdated:function(Sn){if(Ut.getId()===Sn.detail.callId){var Dn={callId:Sn.detail.callId,audio:Sn.detail.audioIsAvailable&&Sn.detail.audioIsActive,audioMuted:Sn.detail.audioIsMuted,audioSilent:Sn.detail.audioIsSilent,video:Sn.detail.videoIsAvailable&&Sn.detail.videoIsActive,videoMuted:Sn.detail.videoIsMuted,videoSilent:Sn.detail.videoIsSilent};zt.get(wn(Ut)).emit("remoteStreamUpdated",Dn)}},MCURecordingStarted:function(Sn){if(ur.get(wn(Ut))&&Sn.detail.roomName===Ut.confId){var Dn=Dt.g.parseRecordingEvent("MCURecordingStarted",Sn.detail);Dn.callId==="COMPOSITE"&&(Ut.recordingStatus=Dn,zt.get(wn(Ut)).emit("recordingStarted",Dn))}},MCURecordingStopped:function(Sn){if(ur.get(wn(Ut))&&Sn.detail.roomName===Ut.confId){var Dn=Dt.g.parseRecordingEvent("MCURecordingStopped",Sn.detail);Dn.callId==="COMPOSITE"&&(delete Ut.recordingStatus,zt.get(wn(Ut)).emit("recordingStopped",Dn))}},MCURecordedStreamsAvailable:function(Sn){if(ur.get(wn(Ut))&&Sn.detail.roomName===Ut.confId){var Dn=Dt.g.parseRecordingEvent("MCURecordedStreamsAvailable",Sn.detail);zt.get(wn(Ut)).emit("recordingAvailable",Dn)}}};for(var ln in tn)En.onEvent(ln,tn[ln]);return Cr.set(wn(Ut),tn),Ut}return $t=Xt,Zt=[{key:"destroy",value:function(){var Ct=Cr.get(this);if(Ct){for(var It in Ct)En.removeEventListener(It,Ct[It]);Cr.delete(this)}}},{key:"getId",value:function(){return Xn.get(this).toString()}},{key:"isRecorded",value:function(){return ur.get(this)}},{key:"getContact",value:function(){return cr.get(this)}},{key:"getStatus",value:function(){return dr.get(this)}},{key:"setStatus",value:function(Ct){dr.set(this,Ct)}},{key:"getPublishedStreams",value:function(){var Ct,It=[],Ut=rn(this.publishedStreams.values());try{for(Ut.s();!(Ct=Ut.n()).done;){var Kt=Ct.value;It.push(Kt)}}catch(Yt){Ut.e(Yt)}finally{Ut.f()}return It}},{key:"getReceivedStreams",value:function(){var Ct,It=[],Ut=rn(this.receivedStreams.values());try{for(Ut.s();!(Ct=Ut.n()).done;){var Kt=Ct.value;It.push(Kt)}}catch(Yt){Ut.e(Yt)}finally{Ut.f()}return It}},{key:"hangUp",value:function(){this.getStatus()===et.g.CALL_STATUS_ENDED?xn.error("hangUp() - Call has already ended"):En.webRTCClient.hangUp(this.getId())}},{key:"getStats",value:function(){return Dt.g.assignObject({},this.stats)}},{key:"stopPublishedStreams",value:function(){return En.webRTCClient.webRTCClient.stopMedia(this.getId())}},{key:"replacePublishedStreams",value:function(Ct,It){var Ut=this,Kt=function(Yt){if(yo.has(Yt))return yo.get(Yt);var en=apiCC.getUserMediaStream(Yt);if(en){var tn="audio";return en.video===!0&&(tn="video"),new so(en.stream,{type:tn,constructor:!0,userMediaStreamId:en.userMediaStreamId})}return null};return new Promise(function(Yt,en){if(Ut.getStatus()!==et.g.CALL_STATUS_ONGOING)return en(new Error("replacePublishedStreams() - Cannot replace stream as call is not ongoing"));if(Ct===null)if(Dt.g.isPropertyTypeof(It,"getStream","function")){var tn={getUserMediaStreamId:function(){return It.getStream().then(function(ln){return ln.userMediaStreamId}).catch(en)}};En.webRTCClient.webRTCClient.addMedia(Ut.getId(),!0,null,tn).then(function(ln){var Sn=Kt(ln.userMediaStreamId);return Sn!==null&&Ut.getContact().sendCustomEvent(et.g.CONTACT_STREAM_UPDATED_INFO,{callId:Ut.getId(),newStreamId:Sn.data.id,oldStreamId:ln.oldMediaStreamId}),Yt(Sn)}).catch(function(ln){return en(new Error("replacePublishedStreams() - "+ln))})}else En.webRTCClient.webRTCClient.addMedia(Ut.getId(),!0,null,null).then(function(ln){var Sn=Kt(ln.userMediaStreamId);return Sn!==null&&Ut.getContact().sendCustomEvent(et.g.CONTACT_STREAM_UPDATED_INFO,{callId:Ut.getId(),newStreamId:Sn.data.id,oldStreamId:ln.oldMediaStreamId}),Yt(Sn)}).catch(function(ln){return en(new Error("replacePublishedStreams() - "+ln))});else En.webRTCClient.webRTCClient.addMedia(Ut.getId(),!0,Ct.userMediaStreamId).then(function(ln){return Ut.getContact().sendCustomEvent(et.g.CONTACT_STREAM_UPDATED_INFO,{callId:Ut.getId(),newStreamId:Ct.data.id,oldStreamId:ln.oldMediaStreamId}),Yt(Ct)}).catch(function(ln){return en(new Error("replacePublishedStreams() - "+ln))})})}},{key:"getRecordingInfo",value:function(){return ur.get(this)?this.recordingStatus:null}},{key:"startRecording",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.asyncCallbacks)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - busy",xn));Ct.asyncCallbacks={},Ct.asyncCallbacks.timeoutId=setTimeout(function(){return Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - timeout",xn))},et.g.CONVERSATION_RECORDING_STARTED_DELAY),Ct.asyncCallbacks.error=function(Kt){if(Ct.confId===Kt.detail.roomName&&Kt.detail.callId==="COMPOSITE"&&Kt.detail.errorCode.indexOf("START_RECORD")>=0)return Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - "+Kt.detail.errorInfo,xn))},Ct.asyncCallbacks.recordingStarted=function(Kt){if(Ct.confId===Kt.detail.roomName&&Kt.detail.callId==="COMPOSITE"){Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks);var Yt=Dt.g.parseRecordingEvent("MCURecordingStarted",Kt.detail);return It(Yt)}},En.onEvent("error",Ct.asyncCallbacks.error),En.onEvent("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),En.webRTCClient.startCallRecording(Xn.get(Ct))})}},{key:"stopRecording",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.asyncCallbacks)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopRecording() - busy",xn));Ct.asyncCallbacks={},Ct.asyncCallbacks.timeoutId=setTimeout(function(){return Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopRecording() - timeout",xn))},et.g.CONVERSATION_RECORDING_STOPPED_DELAY),Ct.asyncCallbacks.error=function(Kt){if(Ct.confId===Kt.detail.roomName&&Kt.detail.callId==="COMPOSITE"&&Kt.detail.errorCode.indexOf("STOP_RECORD")>=0)return Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopRecording() - "+Kt.detail.errorInfo,xn))},Ct.asyncCallbacks.recordingStopped=function(Kt){if(Ct.confId===Kt.detail.roomName&&Kt.detail.callId==="COMPOSITE"){Ct.asyncCallbacks&&(En.removeEventListener("error",Ct.asyncCallbacks.error),En.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks);var Yt=Dt.g.parseRecordingEvent("MCURecordingStopped",Kt.detail);return It(Yt)}},En.onEvent("error",Ct.asyncCallbacks.error),En.onEvent("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),En.webRTCClient.stopCallRecording(Xn.get(Ct))})}},{key:"manageCallEstablishedEvent",value:function(Ct){xn.debug("callEstablished",Ct.detail,this.getId());var It=Ct.detail.callId.toString();this.getId()===It&&(xn.info("callEstablished from "+this.getContact().getUsername(),Ct),this.getStatus()!==et.g.CALL_STATUS_ONGOING&&this.getStatus()!==et.g.CALL_STATUS_ENDED&&(zt.get(this).emit("accepted"),zt.get(this).emit("response","accepted"),dr.set(this,et.g.CALL_STATUS_ONGOING)))}},{key:"manageRemoteStreamAddedEvent",value:function(Ct){xn.debug("remoteStreamAdded",Ct.detail,this.getId());var It=Ct.detail.callId.toString();if(this.getId()===It){var Ut=Ct.detail.destCallType==="audio"?"audio":"video",Kt=Ct.detail.callType==="screenSharing",Yt=new so(Ct.detail.stream,{screensharing:Kt,type:Ut,contact:this.getContact(),streamId:Ct.detail.stream.id,callId:Ct.detail.callId,callAudioAvailable:Ct.detail.audioIsAvailable,callAudioActive:Ct.detail.audioIsActive,callAudioMuted:Ct.detail.audioIsMuted,callVideoAvailable:Ct.detail.videoIsAvailable,callVideoActive:Ct.detail.videoIsActive,callVideoMuted:Ct.detail.videoIsMuted,constructor:!0});this.receivedStreams.set(Ct.detail.stream.id,Yt),zt.get(this).emit("streamAdded",Yt)}}},{key:"manageRemoteStreamRemovedEvent",value:function(Ct){xn.debug("remoteStreamRemoved",Ct.detail,this.getId());var It=Ct.detail.callId.toString();if(this.getId()===It){var Ut=this.receivedStreams.get(Ct.detail.stream.id);this.receivedStreams.delete(Ct.detail.stream.id),zt.get(this).emit("streamRemoved",Ut)}}},{key:"manageUserMediaSuccessEvent",value:function(Ct){xn.debug("UserMediaSuccess",Ct.detail,this.getId());var It,Ut=null;if(It=Ct.detail.videoIsAvailable===!0?"video":"audio",Ct.detail.callId!==null&&(Ut=Ct.detail.callId.toString()),this.getId()===Ut){xn.info("localStreamAvailable",Ct.detail);var Kt=yo.get(Ct.detail.userMediaStreamId);Kt||(Kt=new so(Ct.detail.stream,{type:It,constructor:!0,userMediaStreamId:Ct.detail.userMediaStreamId,callId:this.getId()})),this.publishedStreams.set(Dt.g.guid(),Kt),zt.get(this).emit("localStreamAvailable",Kt)}}},{key:"manageCallStatsUpdateEvent",value:function(Ct){if(this.getId()===Ct.detail.callId){for(var It=0,Ut=Object.keys(Ct.detail.stats);ItWt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function br(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}var Ir=ft.Y.get("ConversationCatalog"),kr=null,Mr=function(){function Wt(){if(function(Bt,dn){if(!(Bt instanceof dn))throw new TypeError("Cannot call a class as a function")}(this,Wt),kr!==null)throw"Cannot construct singleton CallCatalog";this.callList=new Map,kr=this}var $t,Zt,xt;return $t=Wt,xt=[{key:"get",value:function(){return kr===null&&(kr=new Wt),kr}}],(Zt=[{key:"getOrCreateCall",value:function(Bt,dn,pn){var Xt=null;return Bt!=null&&(this.callList.has(Bt.toString())?Xt=this.callList.get(Bt.toString()):(Xt=new Sr(Bt.toString(),dn,pn),this.callList.set(Bt.toString(),Xt))),Xt}},{key:"getCall",value:function(Bt,dn){var pn=null;if(Bt!=null){if(!this.callList.has(Bt.toString()))return null;pn=this.callList.get(Bt.toString())}else if(dn){var Xt,Ct=function(Kt,Yt){var en=typeof Symbol<"u"&&Kt[Symbol.iterator]||Kt["@@iterator"];if(!en){if(Array.isArray(Kt)||(en=function(ar,hr){if(ar){if(typeof ar=="string")return _r(ar,hr);var vr=Object.prototype.toString.call(ar).slice(8,-1);return vr==="Object"&&ar.constructor&&(vr=ar.constructor.name),vr==="Map"||vr==="Set"?Array.from(ar):vr==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(vr)?_r(ar,hr):void 0}}(Kt))||Yt&&Kt&&typeof Kt.length=="number"){en&&(Kt=en);var tn=0,ln=function(){};return{s:ln,n:function(){return tn>=Kt.length?{done:!0}:{done:!1,value:Kt[tn++]}},e:function(ar){throw ar},f:ln}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Sn,Dn=!0,rr=!1;return{s:function(){en=en.call(Kt)},n:function(){var ar=en.next();return Dn=ar.done,ar},e:function(ar){rr=!0,Sn=ar},f:function(){try{Dn||en.return==null||en.return()}finally{if(rr)throw Sn}}}}(this.callList.values());try{for(Ct.s();!(Xt=Ct.n()).done;){var It=Xt.value,Ut=It.getContact();if(Ut&&Ut.getId()===dn.getId()){pn=It;break}}}catch(Kt){Ct.e(Kt)}finally{Ct.f()}}return pn}},{key:"removeCallFromList",value:function(Bt){Ir.log("removeCallFromList : av instance.callList :",kr.callList),kr.callList.has(Bt)&&kr.callList.delete(Bt),Ir.log("removeCallFromList : ap instance.callList :",kr.callList)}},{key:"getCalls",value:function(){return this.callList}}])&&br($t.prototype,Zt),xt&&br($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function jr(Wt){return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},jr(Wt)}function Wr(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Qr(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function er(Wt,$t){return er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},er(Wt,$t)}function lr(Wt,$t){if($t&&(jr($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tr(Wt)}function tr(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Tr(Wt){return Tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Tr(Wt)}var nr=ft.Y.get("ReceivedInvitation"),Br=Mr.get(),Nr=["expired","statusChange"],Ar=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&er(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Tr(Bt);if(dn){var Ut=Tr(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return lr(this,Ct)});function Xt(Ct,It,Ut){var Kt,Yt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Wr(this,Xt),Kt=pn.call(this,Ct,It),nr.info("Create ReceivedCallInvitation with call type "+Ut),Kt.type="call",Kt.callType=Ut,Kt.isRecordedCall=!!Yt.hasOwnProperty("isRecorded")&&Yt.isRecorded,Kt.call=Br.getOrCreateCall(Kt.id,Kt.sender,{isRecorded:Kt.isRecorded()}),Kt.apiRTCManager.onEvent("hangup",function(en){var tn=en.detail.callId.toString();Kt.id.toString()===tn&&Kt.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(Kt.setStatus(et.g.INVITATION_STATUS_EXPIRED),zt.get(tr(Kt)).emit("expired"))}),Kt}return $t=Xt,Zt=[{key:"getCallType",value:function(){return this.callType}},{key:"isRecorded",value:function(){return this.isRecordedCall}},{key:"accept",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){var en=It.getCallType()==="audio",tn=!0,ln=Ut;Ut.hasOwnProperty("audioOnly")&&(en=Ut.audioOnly,delete Ut.audioOnly,ln.mediaTypeForIncomingCall!==void 0&&ln.mediaTypeForIncomingCall!==null||Ut.audioOnly===!0&&(ln.mediaTypeForIncomingCall="AUDIO")),Ut.hasOwnProperty("noStream")&&(ln.mediaTypeForIncomingCall="NONE",tn=!1),ln.mediaTypeForIncomingCall==="NONE"&&(tn=!1),It.getStatus()===et.g.INVITATION_STATUS_STANDBY?(It.setStatus(et.g.INVITATION_STATUS_ACCEPTED),It.apiRTCManager.sendData(It.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:It.id,answer:"accept"}),It.call.setStatus(et.g.CALL_STATUS_ONGOING),tn&&Ct!==null&&Ct instanceof so&&(nr.debug("accept() - A stream was preselected; audio only : ",en),ln.userMediaStreamId=Ct.userMediaStreamId),It.apiRTCManager.webRTCClient.acceptCall(It.id,ln),Kt(It.call)):Yt(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot join this call, invitation state invalid",nr))})}},{key:"decline",value:function(Ct){this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(this.setStatus(et.g.INVITATION_STATUS_DECLINED),this.apiRTCManager.sendData(this.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:this.id,reason:Ct,answer:"decline"}),this.apiRTCManager.webRTCClient.refuseCall(this.id))}},{key:"getCall",value:function(){return this.call}}],xt=[{key:"getAvailableEvents",value:function(){return Nr}}],Zt&&Qr($t.prototype,Zt),xt&&Qr($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(Nn);function Qn(Wt){return Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Qn(Wt)}function mr(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Lr(Wt,$t){return Lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Lr(Wt,$t)}function wr(Wt,$t){if($t&&(Qn($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function qr(Wt){return qr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},qr(Wt)}var Fr=ft.Y.get("ReceivedInvitation"),Co=["error","progress","statusChange"],eo=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Lr(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=qr(Bt);if(dn){var Ut=qr(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return wr(this,Ct)});function Xt(Ct,It,Ut){var Kt;return function(Yt,en){if(!(Yt instanceof en))throw new TypeError("Cannot call a class as a function")}(this,Xt),Kt=pn.call(this,Ct,It),Fr.debug("Create ReceivedFileTransferInvitation"),Kt.type="sendFile",Kt.fileInfo=Ut,Kt.apiRTCManager.onEvent("hangup",function(Yt){Fr.debug("hangup");var en=Yt.detail.callId.toString();Kt.getId()===en&&(Fr.debug("hangup for ReceivedFileTransferInvitation"),Kt.getStatus()===et.g.INVITATION_STATUS_ENDED?Fr.debug("invitation ended"):(Fr.debug("invitation is cancelled"),Kt.setStatus(et.g.INVITATION_STATUS_CANCELLED)),apiRTC.userAgentInstance.currentSession.invitationsMap.has(Yt.detail.remoteId+"-sendfile-"+en)&&apiRTC.userAgentInstance.currentSession.invitationsMap.delete(Yt.detail.remoteId+"-sendfile-"+en))}),Kt}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return Co}}],(Zt=[{key:"accept",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.getStatus()!==et.g.INVITATION_STATUS_STANDBY)Ut(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot join this file transfer session, invitation state invalid",Fr));else{Ct.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Ct.apiRTCManager.sendData(Ct.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:Ct.id,answer:"accept"});var Kt=Ct;Ct.apiRTCManager.onEvent("onFileReceived",function Yt(en){if(en.detail.callId.toString()===Kt.id.toString()){if(Fr.debug("typeof(e.detail.data.file) :",Qn(en.detail.data.file)),typeof en.detail.data.file=="string")It({file:en.detail.data.file,name:en.detail.data.name,type:en.detail.data.type});else{var tn=new FileReader;tn.addEventListener("loadend",function(){Ct.setStatus(et.g.INVITATION_STATUS_ENDED),Ct.apiRTCManager.webRTCClient.hangUp(Kt.id.toString());try{Fr.info("accept() - file received from "+Kt.sender.getUsername()+" !"),It({file:en.detail.data.file,name:en.detail.data.name,type:en.detail.data.type})}catch(ln){Fr.error("File Error",ln),Ut(Dt.g.createError(et.g.ERROR_OTHER,"accept() - Could not read file received",Fr))}}),tn.readAsArrayBuffer(en.detail.data.file)}Ct.apiRTCManager.removeEventListener("onFileReceived",Yt)}}),Ct.apiRTCManager.onEvent("onFileProgress",function(Yt){Yt.detail.callId.toString()===Kt.id.toString()&&(Fr.trace("file transfering",Yt.detail),zt.get(Kt).emit("progress",{uuid:Yt.detail.uuid,fileSize:Yt.detail.fileSize,remainingSize:Yt.detail.remainingSize,percentage:Yt.detail.percentage,sendChunkNb:Yt.detail.sendChunkNb,transferDuration:Yt.detail.transferDuration,lastPacket:Yt.detail.lastPacket}))}),Ct.apiRTCManager.onEvent("receiveDataChannelError",function(Yt){Yt.detail.callId.toString()===Kt.id.toString()&&(Fr.warn("receiveDataChannelError",Yt.detail),zt.get(Kt).emit("error","receiveDataChannelError"))}),Ct.apiRTCManager.webRTCClient.acceptCall(Ct.id,{mediaTypeForIncomingCall:"DATA"})}})}},{key:"getFileInfo",value:function(){return this.fileInfo}},{key:"decline",value:function(Ct){Fr.log("decline"),this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(this.setStatus(et.g.INVITATION_STATUS_DECLINED),this.apiRTCManager.sendData(this.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:this.id,reason:Ct,answer:"decline"}),this.apiRTCManager.webRTCClient.refuseCall(this.id))}}])&&mr($t.prototype,Zt),xt&&mr($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(Nn);function ga(Wt){return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},ga(Wt)}function gs(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Qo(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Zs(Wt,$t){return Zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Zs(Wt,$t)}function fp(Wt,$t){if($t&&(ga($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function ms(Wt){return ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},ms(Wt)}var mu=ft.Y.get("ReceivedInvitation"),vs=function(Wt){(function(Xt,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");Xt.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:Xt,writable:!0,configurable:!0}}),Object.defineProperty(Xt,"prototype",{writable:!1}),Ct&&Zs(Xt,Ct)})(pn,Wt);var $t,Zt,xt,Bt,dn=(xt=pn,Bt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Xt,Ct=ms(xt);if(Bt){var It=ms(this).constructor;Xt=Reflect.construct(Ct,arguments,It)}else Xt=Ct.apply(this,arguments);return fp(this,Xt)});function pn(Xt,Ct){var It,Ut=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return gs(this,pn),It=dn.call(this,Xt,Ct),mu.info("Create ReceivedWhiteboardInvitation"),It.type="whiteboard",Ut.cloudConvId&&(It.cloudConvId=Ut.cloudConvId),Ut.webconf===!0&&(It.webconf=!0),It}return $t=pn,(Zt=[{key:"accept",value:function(){var Xt=this;return new Promise(function(Ct,It){if(Xt.getStatus()===et.g.INVITATION_STATUS_STANDBY){Xt.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Xt.apiRTCManager.sendData(Xt.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:"wb-"+Xt.id,answer:"accept"}),Xt.apiRTCManager.whiteBoardClient.leaveRoom(),Xt.apiRTCManager.whiteBoardClient.start();var Ut={};Xt.cloudConvId&&(Ut.convId=Xt.cloudConvId),Xt.webconf===!0&&(Ut.webconf=!0),Xt.apiRTCManager.whiteBoardClient.joinRoom(Xt.id,Ut),Ct(Xt.id)}else It(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot join this whiteboard session, invitation state invalid",mu))})}},{key:"decline",value:function(Xt){this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(this.setStatus(et.g.INVITATION_STATUS_DECLINED),this.apiRTCManager.sendData(this.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:"wb-"+this.id,reason:Xt,answer:"decline"}))}}])&&Qo($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),pn}(Nn);function Cl(Wt){return Cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Cl(Wt)}function hp(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function vu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function yl(Wt,$t){return yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},yl(Wt,$t)}function gp(Wt,$t){if($t&&(Cl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xr(Wt)}function Xr(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Cs(Wt){return Cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Cs(Wt)}var To=ft.Y.get("DataChannel"),Sl=Rn.get(),mp=["response","accepted","declined","error","opened","closed","error","transferProgress","transferComplete","dataReceived","ended"],Cu=new WeakMap,bu=new WeakMap,Zo=new WeakMap,bs=new WeakMap,ys=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&yl(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Cs(Bt);if(dn){var Ut=Cs(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return gp(this,Ct)});function Xt(Ct,It){var Ut,Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return hp(this,Xt),Ut=pn.call(this,To),To.debug("Create DataChannel with id "+Ct),Cu.set(Xr(Ut),Ct),bu.set(Xr(Ut),It),bs.set(Xr(Ut),et.g.DATACHANNEL_TYPE_RECEIVE),Kt.hasOwnProperty("type")&&(Kt.type===et.g.DATACHANNEL_TYPE_RECEIVE?bs.set(Xr(Ut),et.g.DATACHANNEL_TYPE_RECEIVE):Kt.type===et.g.DATACHANNEL_TYPE_SEND&&bs.set(Xr(Ut),et.g.DATACHANNEL_TYPE_SEND)),Zo.set(Xr(Ut),et.g.DATACHANNEL_STATUS_WAITING),Sl.onEvent("receiveData",function(Yt){Yt.detail.data.info!==void 0&&Yt.detail.data.info===et.g.INVITATION_ANSWER_IDENTIFIER&&Yt.detail.data.invitationId.toString()===Ut.getId()&&Ut.getStatus()===et.g.DATACHANNEL_STATUS_WAITING&&(To.info("DataChannel answer from "+Ut.getContact().getUsername()+" for "+Ut.getId()),Yt.detail.data.answer==="accept"?zt.get(Xr(Ut)).emit("accepted"):(Zo.set(Xr(Ut),et.g.DATACHANNEL_STATUS_ENDED),zt.get(Xr(Ut)).emit("declined")),zt.get(Xr(Ut)).emit("response"))}).onEvent("callEstablished",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&(To.info("callEstablished from "+Ut.getContact().getUsername(),Yt),Ut.getStatus()!==et.g.DATACHANNEL_STATUS_ONGOING&&Ut.getStatus()!==et.g.DATACHANNEL_STATUS_ENDED&&zt.get(Xr(Ut)).emit("accepted"))}).onEvent("hangup",function(Yt){var en=Yt.detail.callId.toString(),tn=Ut.getStatus()===et.g.DATACHANNEL_STATUS_WAITING&&Yt.detail.hangupType==="remote";Ut.getId()===en&&Ut.getStatus()!==et.g.DATACHANNEL_STATUS_ENDED&&(Zo.set(Xr(Ut),et.g.DATACHANNEL_STATUS_ENDED),To.info("Hangup from "+Ut.getContact().getUsername(),Yt),zt.get(Xr(Ut)).emit("ended",{from:Yt.detail.hangupType}),tn&&zt.get(Xr(Ut)).emit("declined"))}).onEvent("onFileReceived",function(Yt){if(Yt.detail.callId.toString()===Ut.getId()){var en=Yt.detail.data,tn=new FileReader;tn.addEventListener("loadend",function(){try{var ln=Dt.g.arrayBuffertoString(tn.result);To.info("dataReceived !"),zt.get(Xr(Ut)).emit("dataReceived",{uuid:en.uuid,data:ln})}catch(Sn){To.error("dataReceived Error",Sn)}}),tn.readAsArrayBuffer(en.file)}}).onEvent("onFileProgress",function(Yt){if(Yt.detail.callId.toString()===Ut.getId()){var en=Yt.detail;To.trace("file transfering",en);var tn={uuid:en.uuid,fileSize:en.fileSize,remainingSize:en.remainingSize,percentage:en.percentage,sendChunkNb:en.sendChunkNb,transferDuration:en.transferDuration,lastPacket:en.lastPacket};zt.get(Xr(Ut)).emit("transferProgress",tn),en.transferEnded&&zt.get(Xr(Ut)).emit("transferComplete",tn)}}).onEvent("receiveDataChannelError",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&zt.get(Xr(Ut)).emit("error","receiveDataChannelError")}).onEvent("sendDataChannelError",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&zt.get(Xr(Ut)).emit("error","sendDataChannelError")}).onEvent("receiveDataChannelClose",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&zt.get(Xr(Ut)).emit("closed")}).onEvent("sendDataChannelClose",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&zt.get(Xr(Ut)).emit("closed")}).onEvent("receiveDataChannelOpen",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&(Zo.set(Xr(Ut),et.g.DATACHANNEL_STATUS_ONGOING),zt.get(Xr(Ut)).emit("opened"))}).onEvent("sendDataChannelOpen",function(Yt){var en=Yt.detail.callId.toString();Ut.getId()===en&&zt.get(Xr(Ut)).emit("opened")}),Ut}return $t=Xt,Zt=[{key:"getId",value:function(){return Cu.get(this).toString()}},{key:"getContact",value:function(){return bu.get(this)}},{key:"getType",value:function(){return bs.get(this)}},{key:"getStatus",value:function(){return Zo.get(this)}},{key:"sendData",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){var en=!1;It.getStatus()!==et.g.DATACHANNEL_STATUS_ONGOING?Yt(Dt.g.createError(et.g.ERROR_OTHER,"Cannot send data as datachannel session is not ongoing",To)):It.getType()!==et.g.DATACHANNEL_TYPE_SEND?Yt(Dt.g.createError(et.g.ERROR_OTHER,"Cannot send data as datachannel session is receiving only",To)):Sl.webRTCClient.sendDataWithCallId(It.getId(),{file:Ct,name:Ut.name,type:Ut.type},function(tn){en||(en=!0,Kt(tn.uuid)),To.trace("sendData() - progress : ",tn);var ln={uuid:tn.uuid,fileSize:tn.fileSize,remainingSize:tn.remainingSize,percentage:tn.percentage,sendChunkNb:tn.sendChunkNb,transferDuration:tn.transferDuration,lastPacket:tn.lastPacket};zt.get(It).emit("transferProgress",ln),tn.transferEnded&&zt.get(It).emit("transferComplete",ln)})})}},{key:"close",value:function(){this.getStatus()===et.g.DATACHANNEL_STATUS_ENDED?To.error("close() - DataChannel session has already ended"):Sl.webRTCClient.hangUp(this.getId())}}],xt=[{key:"getAvailableEvents",value:function(){return mp}}],Zt&&vu($t.prototype,Zt),xt&&vu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(un);function Tl(Wt){return Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Tl(Wt)}function yu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Il(Wt,$t){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Il(Wt,$t)}function vp(Wt,$t){if($t&&(Tl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Su(Wt)}function Su(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Ss(Wt){return Ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Ss(Wt)}var Tu=ft.Y.get("ReceivedInvitation"),Cp=["expired","statusChange"],Ho=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Il(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Ss(Bt);if(dn){var Ut=Ss(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return vp(this,Ct)});function Xt(Ct,It){var Ut;return function(Kt,Yt){if(!(Kt instanceof Yt))throw new TypeError("Cannot call a class as a function")}(this,Xt),Ut=pn.call(this,Ct,It),Tu.info("Create ReceivedDataChannelInvitation "),Ut.type="dataChannel",Ut.apiRTCManager.onEvent("hangup",function(Kt){var Yt=Kt.detail.callId.toString();Ut.id.toString()===Yt&&Ut.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(Ut.setStatus(et.g.INVITATION_STATUS_EXPIRED),zt.get(Su(Ut)).emit("expired"))}),Ut}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return Cp}}],(Zt=[{key:"accept",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.getStatus()===et.g.INVITATION_STATUS_STANDBY){Ct.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Ct.apiRTCManager.sendData(Ct.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:Ct.id,answer:"accept"});var Kt=new ys(Ct.id,Ct.sender,{started:!0,type:et.g.DATACHANNEL_TYPE_SEND});Ct.apiRTCManager.webRTCClient.acceptCall(Ct.id,{mediaTypeForIncomingCall:"DATA"}),It(Kt)}else Ut(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot join this datachannel session, invitation state invalid",Tu))})}},{key:"decline",value:function(Ct){this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(this.setStatus(et.g.INVITATION_STATUS_DECLINED),this.apiRTCManager.sendData(this.sender.getId(),{event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:this.id,reason:Ct,answer:"decline"}),this.apiRTCManager.webRTCClient.refuseCall(this.id))}}])&&yu($t.prototype,Zt),xt&&yu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(Nn);function Rl(Wt){return Rl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Rl(Wt)}function bp(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function El(Wt,$t){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},El(Wt,$t)}function yp(Wt,$t){if($t&&(Rl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Ts(Wt){return Ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Ts(Wt)}var Ol=ft.Y.get("ReceivedInvitation"),zo=function(Wt){(function(Xt,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");Xt.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:Xt,writable:!0,configurable:!0}}),Object.defineProperty(Xt,"prototype",{writable:!1}),Ct&&El(Xt,Ct)})(pn,Wt);var $t,Zt,xt,Bt,dn=(xt=pn,Bt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Xt,Ct=Ts(xt);if(Bt){var It=Ts(this).constructor;Xt=Reflect.construct(Ct,arguments,It)}else Xt=Ct.apply(this,arguments);return yp(this,Xt)});function pn(Xt,Ct,It){var Ut;return function(Kt,Yt){if(!(Kt instanceof Yt))throw new TypeError("Cannot call a class as a function")}(this,pn),Ut=dn.call(this,Xt,It),Ol.info("Create ReceivedConversationJoinRequest"),Ut.type="conversationJoinRequest",Ut.conversation=Ct||null,Ut}return $t=pn,(Zt=[{key:"getConversation",value:function(){return this.conversation}},{key:"accept",value:function(){var Xt=this;return new Promise(function(Ct,It){Xt.getStatus()===et.g.INVITATION_STATUS_STANDBY?(Xt.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Xt.conversation?Xt.conversation.allowEntry(Xt.sender,{invitationId:Xt.id,answer:"accept",ackEnabled:!0}).then(Ct).catch(It):(Xt.apiRTCManager.sendData(Xt.sender.getId(),{roomname:Xt.id,event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:Xt.id,answer:"accept",command:"access",value:{access:!0}}),Ct())):It(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot accept request, invitation state invalid",Ol))})}},{key:"decline",value:function(Xt){var Ct=this;return new Promise(function(It,Ut){Ct.getStatus()===et.g.INVITATION_STATUS_STANDBY?(Ct.setStatus(et.g.INVITATION_STATUS_DECLINED),Ct.conversation?Ct.conversation.denyEntry(Ct.sender,{invitationId:Ct.id,answer:"decline",reason:Xt}).then(It).catch(Ut):(Ct.apiRTCManager.sendData(Ct.sender.getId(),{roomname:Ct.id,event:et.g.INVITATION_ANSWER_IDENTIFIER,invitationId:Ct.id,reason:Xt,answer:"decline",command:"access",value:{access:!1}}),It())):Ut(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"decline() - Cannot decline request, invitation state invalid",Ol))})}}])&&bp($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),pn}(Nn);function _l(Wt){return _l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},_l(Wt)}function Sp(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Al(Wt,$t){return Al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Al(Wt,$t)}function Tp(Wt,$t){if($t&&(_l($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Is(Wt){return Is=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Is(Wt)}var Iu=ft.Y.get("ReceivedInvitation"),Ml=function(Wt){(function(Xt,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");Xt.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:Xt,writable:!0,configurable:!0}}),Object.defineProperty(Xt,"prototype",{writable:!1}),Ct&&Al(Xt,Ct)})(pn,Wt);var $t,Zt,xt,Bt,dn=(xt=pn,Bt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Xt,Ct=Is(xt);if(Bt){var It=Is(this).constructor;Xt=Reflect.construct(Ct,arguments,It)}else Xt=Ct.apply(this,arguments);return Tp(this,Xt)});function pn(Xt,Ct,It){var Ut;return function(Kt,Yt){if(!(Kt instanceof Yt))throw new TypeError("Cannot call a class as a function")}(this,pn),(Ut=dn.call(this,Xt,Ct)).session=It,Ut.type="pointerSharing",Ut}return $t=pn,(Zt=[{key:"accept",value:function(){var Xt=this;return new Promise(function(Ct,It){Xt.getStatus()===et.g.INVITATION_STATUS_STANDBY?(Xt.setStatus(et.g.INVITATION_STATUS_ACCEPTED),Xt.session.joinPointerSharingRoom(Xt.id).then(Ct).catch(function(Ut){It(Dt.g.createError(et.g.ERROR_OTHER,"accept() - cannot accept invitation",Iu))})):It(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - cannot accept invitation",Iu))})}},{key:"decline",value:function(Xt){this.getStatus()===et.g.INVITATION_STATUS_STANDBY&&this.setStatus(et.g.INVITATION_STATUS_DECLINED)}}])&&Sp($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),pn}(Nn);function Ip(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}s(4723);var $r=ft.Y.get("AicConsoleManager"),Ru=function(){function Wt(){var xt=this;(function(Bt,dn){if(!(Bt instanceof dn))throw new TypeError("Cannot call a class as a function")})(this,Wt),$r.info("Create AicConsoleManager"),this.ws=null,this.connectedToapplication=!1,this.domStream=null,this.keyboard_mode=0,this.ports=[4545,5858,37371,41793,42803],this.port_index=0,this.aic_agent_running=0,this.ip="127.0.0.1",this.aic_agent_handshake_done=0,this.controlActivated=!1,this.handshakeTimeoutId=0,this.kd=function(Bt){xt.key_down(Bt)},this.ku=function(Bt){xt.key_up(Bt)},this.wfl=function(Bt){xt.window_focus_lost(Bt)},this.mm=function(Bt){xt.mouse_move(Bt)},this.dc=function(Bt){xt.mouse_doubleclick(Bt)},this.md=function(Bt){xt.mouse_down(Bt)},this.mu=function(Bt){xt.mouse_up(Bt)},this.mw=function(Bt){xt.mouse_wheel(Bt)}}var $t,Zt;return $t=Wt,Zt=[{key:"aic_control_onmessage",value:function(xt){if($r.debug("Message to send to remote app :",xt),apiRTC.session.remoteAccessInvitation!==null){var Bt={event:et.g.CONTACT_REMOTEACCESS_APP_MESSAGE,invitationId:apiRTC.session.remoteAccessInvitation.id,roomname:apiRTC.session.remoteAccessInvitation.conversation._getTechnicalName(),message:xt};apiRTC.session.remoteAccessInvitation.send(Bt).then(function(){}).catch(function(dn){$r.warn("Contact#send CONTACT_REMOTEACCESS_APP_MESSAGE message error:",dn)})}else $r.error("Error on aic_control_onmessage, remoteAccessInvitation is not initialized")}},{key:"aic_keyboard_keydown",value:function(xt,Bt){this.aic_control_onmessage('aic_keyboard_keypress("'+xt+'","KEY_DOWN,'+Bt+'")')}},{key:"aic_keyboard_keyup",value:function(xt,Bt){this.aic_control_onmessage('aic_keyboard_keypress("'+xt+'","KEY_UP,'+Bt+'")')}},{key:"key_down",value:function(xt){if($r.debug("key_down"),xt.target===document.body)if(xt.preventDefault(),xt.isComposing||xt.keyCode===229)$r.debug("Ignoring event "+xt);else if(this.keyboard_mode===0){var Bt=(xt.altKey?"MOD_ALT,":"")+(xt.ctrlKey?"MOD_CONTROL,":"")+(xt.metaKey?"MOD_META,":"")+(xt.shiftKey?"MOD_SHIFT,":"");this.aic_keyboard_keydown(xt.key,Bt)}else this.keyboard_mode===1&&this.aic_control_onmessage("aic_keyboard_keydown("+xt.keyCode+")");else $r.debug("this is not document body, ignoring this event")}},{key:"key_up",value:function(xt){if($r.debug("key_up"),xt.target===document.body)if(xt.preventDefault(),xt.isComposing||xt.keyCode===229)console.log("Ignoring event "+xt);else if(this.keyboard_mode===0){var Bt=(xt.altKey?"MOD_ALT,":"")+(xt.ctrlKey?"MOD_CONTROL,":"")+(xt.metaKey?"MOD_META,":"")+(xt.shiftKey?"MOD_SHIFT,":"");this.aic_keyboard_keyup(xt.key,Bt)}else this.keyboard_mode===1&&this.aic_control_onmessage("aic_keyboard_keyup("+xt.keyCode+")");else $r.debug("this is not document body, ignoring this event")}},{key:"window_focus_lost",value:function(xt){$r.debug("window_focus_lost"),this.aic_keyboard_keyup("Shift","MOD_ALT,MOD_CONTROL,MOD_META,MOD_SHIFT")}},{key:"mouse_doubleclick",value:function(xt){this.mouse_move(xt),this.aic_control_onmessage("aic_mouse_doubleclick("+xt.which+")")}},{key:"mouse_down",value:function(xt){this.mouse_move(xt),this.aic_control_onmessage("aic_mouse_down("+xt.which+")")}},{key:"mouse_up",value:function(xt){this.mouse_move(xt),this.aic_control_onmessage("aic_mouse_up("+xt.which+")")}},{key:"mouse_wheel",value:function(xt){xt.preventDefault(),this.aic_control_onmessage("aic_mouse_scroll("+xt.deltaX+","+-1*xt.deltaY+")")}},{key:"mouse_move",value:function(xt){var Bt=window.screen.width,dn=window.screen.height;apiRTC.session.remoteAccessInvitation!==null&&(Bt=apiRTC.session.remoteAccessInvitation.screenWidth,dn=apiRTC.session.remoteAccessInvitation.screenHeight);var pn=getComputedStyle(xt.target),Xt=parseInt(pn.getPropertyValue("width"),10),Ct=parseInt(pn.getPropertyValue("height"),10),It=0,Ut=0,Kt=!1;Xt/parseInt(xt.target.videoWidth,10)<=Ct/parseInt(xt.target.videoHeight,10)&&(Kt=!0),Kt===!0?($r.debug("Keeping width"),Ut=Xt*xt.target.videoHeight/xt.target.videoWidth,It=Xt):($r.debug("Keeping height"),It=Ct*xt.target.videoWidth/xt.target.videoHeight,Ut=Ct);var Yt=xt.target.getBoundingClientRect(),en=xt.clientX-Yt.left-(Xt-It)/2,tn=xt.clientY-Yt.top-(Ct-Ut)/2,ln=Math.floor(en/It*Bt),Sn=Math.floor(tn/Ut*dn);this.aic_control_onmessage("aic_mouse_move("+ln+","+Sn+")")}},{key:"searchDOMElement",value:function(xt){var Bt=this;return new Promise(function(dn,pn){if(Bt.domStream=document.getElementById(xt),Bt.domStream)dn();else{var Xt="Dom element not found in searchDOMElement";$r.debug(Xt),pn(new Error(Xt))}})}},{key:"aic_control_start",value:function(){var xt=this;return new Promise(function(Bt,dn){$r.debug("aic_control_start"),window.oncontextmenu=function(){return!1};var pn=apiRTC.session.remoteAccessInvitation.screenSharingStreamDOMElementId;$r.debug("domSearchFilter :",pn),xt.searchDOMElement(pn).then(function(){if(xt.domStream)$r.debug("Adding mouse and keyboard events listeners"),document.addEventListener("keydown",xt.kd,{passive:!1}),document.addEventListener("keyup",xt.ku,{passive:!1}),document.addEventListener("blur",xt.wfl,{passive:!1}),xt.domStream.addEventListener("mousemove",xt.mm,!0),xt.domStream.addEventListener("mousedown",xt.md,!0),xt.domStream.addEventListener("mouseup",xt.mu,!0),xt.domStream.addEventListener("wheel",xt.mw,{passive:!1}),xt.controlActivated=!0,Bt();else{var Xt="Dom element not found";$r.debug(Xt),dn(new Error(Xt))}}).catch(function(Xt){dn(Xt)})})}},{key:"aic_control_stop",value:function(){var xt=this;return $r.debug("aic_control_stop"),new Promise(function(Bt,dn){if(window.oncontextmenu=function(){return!0},xt.domStream)$r.debug("Removing mouse and keyboard events listeners"),document.removeEventListener("keydown",xt.kd,{passive:!1}),document.removeEventListener("keyup",xt.ku,{passive:!1}),document.removeEventListener("blur",xt.wfl,{passive:!1}),xt.domStream.removeEventListener("mousemove",xt.mm,!0),xt.domStream.removeEventListener("dblclick",xt.dc,!0),xt.domStream.removeEventListener("mousedown",xt.md,!0),xt.domStream.removeEventListener("mouseup",xt.mu,!0),xt.domStream.removeEventListener("wheel",xt.mw,{passive:!1}),xt.controlActivated=!1,Bt();else{var pn="Dom element not found";$r.debug(pn),dn(new Error(pn))}})}},{key:"aic_agent_send_message",value:function(xt){this.ws!==void 0?this.ws.readyState===1?this.ws.send(xt):$r.info("aic_agent_send_message : ws in not in readyState"):$r.info("aic_agent_send_message : ws in not defined")}},{key:"ws_onopen",value:function(){var xt=this;$r.debug("ws_onopen : Connected"),this.aic_agent_handshake_done=0,this.aic_agent_send_message("aic_agent_start()"),this.handshakeTimeoutId=setTimeout(function(){$r.error("Timeout reached on handshake"),xt.ws.close(1e3,"HANDSHAKE_NOK")},1e3)}},{key:"ws_onmessage",value:function(xt){var Bt=xt.data;$r.debug("received_msg :",Bt);var dn=Bt.match(/^aic_notify\(\"([^\"]*)\",\"([^\"]*)\"\)$/);dn&&dn[1]==="aic_agent_version"&&($r.debug("aic_agent_version is :",dn[2]),clearTimeout(this.handshakeTimeoutId),this.aic_agent_handshake_done=1,this.connectedToapplication=!0,this.send_application_status("APP_CONNECTION_OK"),apiRTC.session.remoteAccessInvitation!=null&&apiRTC.session.remoteAccessInvitation.fireEvent("application_connection_ok"))}},{key:"ws_onclose",value:function(xt){var Bt=this;$r.debug("ws_onclose : Closed - event :",xt),this.connectedToapplication===!0?(apiRTC.session.remoteAccessInvitation!==null&&apiRTC.session.remoteAccessInvitation.stop(!0),this.connectedToapplication=!1):this.ws_reconnect()===2&&setTimeout(function(){Bt.ws_reconnect()},3e3)}},{key:"ws_onerror",value:function(xt){$r.debug("ws_onerror : "+xt)}},{key:"ws_connect",value:function(xt){var Bt=this;$r.debug("ws_connect : Connecting ");var dn="ws://"+this.ip+":"+xt+"/ws";$r.debug("... on url :",dn),this.ws=new WebSocket(dn,"ws-server-aic"),this.ws.addEventListener("open",function(pn){Bt.ws_onopen(pn)}),this.ws.addEventListener("message",function(pn){Bt.ws_onmessage(pn)}),this.ws.addEventListener("close",function(pn){Bt.ws_onclose(pn)}),this.ws.addEventListener("error",function(pn){Bt.ws_onerror(pn)})}},{key:"ws_reconnect",value:function(){return this.aic_agent_running===0?0:this.port_index>=this.ports.length?(this.port_index=0,2):(this.ws_connect(this.ports[this.port_index]),this.port_index++,0)}},{key:"send_application_status",value:function(xt){if($r.debug("send_application_status"),apiRTC.session.remoteAccessInvitation!==null){var Bt={event:et.g.CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE,invitationId:apiRTC.session.remoteAccessInvitation.id,roomname:apiRTC.session.remoteAccessInvitation.conversation._getTechnicalName(),status:xt};apiRTC.session.remoteAccessInvitation.sendMessageToSender(et.g.CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE,Bt).then(function(){}).catch(function(dn){$r.warn("Contact#send send_application_status message error:",dn)})}else $r.warn("send_application_status but not linked to a remoteAccessInvitation")}},{key:"aic_agent_start",value:function(){$r.debug("aic_agent_start"),"WebSocket"in window?(this.aic_agent_running=1,this.send_application_status("APP_CONNECTION_ONGOING"),apiRTC.session.remoteAccessInvitation!=null&&apiRTC.session.remoteAccessInvitation.fireEvent("application_connection_ongoing"),this.ws_reconnect(this.ip)):$r.error("WebSocket NOT supported by your Browser!")}},{key:"aic_agent_stop",value:function(){$r.debug("aic_agent_stop"),this.aic_agent_running=0,this.ws.close()}},{key:"aic_agent_exit",value:function(){this.aic_agent_send_message("aic_agent_exit()")}}],Zt&&Ip($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function xl(Wt){return xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},xl(Wt)}function Rp(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Eu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Pl(Wt,$t){return Pl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Pl(Wt,$t)}function Ep(Wt,$t){if($t&&(xl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Rs(Wt){return Rs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Rs(Wt)}var _a=ft.Y.get("ReceivedInvitation"),wp=["stop","messageDelivered","messageNotDelivered","application_connection_ongoing","application_connection_ok"],kp=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Pl(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Rs(Bt);if(dn){var Ut=Rs(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return Ep(this,Ct)});function Xt(Ct,It,Ut){var Kt,Yt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Rp(this,Xt),_a.debug("Create ReceivedRemoteAccessInvitation"),(Kt=pn.call(this,Ct,It.invitationId)).type="remoteAccess",Kt.conversation=Ut,Yt.cloudConvId&&(Kt.cloudConvId=Yt.cloudConvId),Yt.webconf===!0&&(Kt.webconf=!0),Kt.aicConsoleManager=null,Kt.screenSharingStreamId=null,Kt.screenSharingStream=null,Kt.apiRTCManager.onEvent("receiveData",function(en){_a.debug("ReceivedRemoteAccessInvitation receiveData "),en.detail.data.event!==void 0&&en.detail.data.event===et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER&&en.detail.data.invitationId.toString()===Kt.id.toString()?(_a.debug("Received stop for "+Kt.id,en.detail.data),Kt.stop(!1,en.detail.data.reason)):en.detail.data.event===et.g.CONTACT_REMOTEACCESS_APP_MESSAGE&&en.detail.data.invitationId.toString()===Kt.id.toString()&&(_a.debug("Received CONTACT_REMOTEACCESS_APP_MESSAGE for "+Kt.id,en.detail.data),Kt.aicConsoleManager!==null?Kt.aicConsoleManager.aic_agent_send_message(en.detail.data.message):_a.debug("aicConsoleManager is not initialized"))}),Kt.conversation.on("contactLeft",function(en){en.id===Kt.sender.id&&(_a.debug("Remote user has left, stopping remoteAccess"),Kt.stop(!1,{code:"AGENT_LEFT"}))}),Kt}return $t=Xt,Zt=[{key:"accept",value:function(){var Ct=this;return new Promise(function(It,Ut){if(_a.debug("ReceivedRemoteAccessInvitation accept"),Ct.getStatus()===et.g.INVITATION_STATUS_STANDBY){Ct.setStatus(et.g.INVITATION_STATUS_ACCEPTED);var Kt={event:et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER,invitationId:Ct.id,roomname:Ct.conversation._getTechnicalName(),answer:"accept"};Ct.sendMessageToSender(et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER,Kt).then(function(){It(Ct.id)}).catch(function(Yt){Ut(Yt)})}else Ut(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot accept remote access, invitation state invalid",_a))})}},{key:"decline",value:function(){var Ct=this;return new Promise(function(It,Ut){if(_a.debug("ReceivedRemoteAccessInvitation decline"),Ct.getStatus()===et.g.INVITATION_STATUS_STANDBY){Ct.setStatus(et.g.INVITATION_STATUS_DECLINED);var Kt={event:et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER,invitationId:Ct.id,roomname:Ct.conversation._getTechnicalName(),answer:"decline"};Ct.sendMessageToSender(et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER,Kt).then(function(){It(Ct.id)}).catch(function(Yt){Ut(Yt)}),Ct.stop(!0,{code:"USER_DECLINE"})}else Ut(Dt.g.createError(et.g.ERROR_INVITATION_STATE_INVALID,"accept() - Cannot decline remote access, invitation state invalid",_a))})}},{key:"sendMessageToSender",value:function(Ct,It){var Ut=this;return _a.debug("sendMessageToSender :",It),new Promise(function(Kt,Yt){Ut.apiRTCManager.sendData(Ut.sender.getId(),It).then(function(){zt.get(Ut).emit("messageDelivered",{event:Ct,contact:Ut.sender,messageData:It}),Kt()}).catch(function(en){var tn=Dt.g.createError(en,"Invitation not delivered",_a);zt.get(Ut).emit("messageNotDelivered",{error:tn,contact:Ut.sender,event:Ct,messageData:It}),Yt(tn)})})}},{key:"fireEvent",value:function(Ct,It){zt.get(this).emit(Ct,It)}},{key:"startScreenSharingAndPublish",value:function(){var Ct=this;return _a.debug("startScreenSharingAndPublish"),new Promise(function(It,Ut){apiRTC.Stream.createDisplayMediaStream({video:{cursor:"always",displaySurface:"monitor"},surfaceSwitching:"exclude",selfBrowserSurface:"exclude",systemAudio:"exclude"}).then(function(Kt){Kt.screensharingRemoteAccessStream=!0;var Yt={},en={};en.invitationId=Ct.id,en.screenWidth=window.screen.width,en.screenHeight=window.screen.height,Yt.context={remoteAccessCtx:en},Ct.screenSharingStreamId=Kt.getId(),Ct.screenSharingStream=Kt,_a.debug("setting screenSharingStreamId :",Ct.screenSharingStreamId),Ct.conversation.publish(Kt,Yt).then(function(tn){Ct.aicConsoleManager=new Ru,Ct.aicConsoleManager.aic_agent_start(),It(tn)}).catch(function(tn){var ln={code:"DISPLAY_MEDIA_PUBLISH_ERROR",error:tn};Ct.stop(!0,ln),Ut(tn)})}).catch(function(Kt){_a.error("error on createDisplayMediaStream :",Kt);var Yt={code:"CREATE_DISPLAY_MEDIA_ERROR",error:Kt};Ct.stop(!0,Yt),Ut(Kt)})})}},{key:"downloadApplication",value:function(){return _a.debug("downloadApplication"),new Promise(function(Ct,It){fetch("https://dev.cdn.apizee.com/apiRTC/app/remoteAccess.exe").then(function(Ut){return Ut.blob()}).then(function(Ut){var Kt=window.URL.createObjectURL(Ut),Yt=document.createElement("a");Yt.href=Kt,Yt.download="remoteAccess.exe",document.body.appendChild(Yt),Yt.click(),Yt.remove(),Ct()}).catch(function(Ut){_a.error("Something went wrong during remote access application loading.. toString :",Ut.toString()),It(new Error("error on application fetch :"+Ut.toString()))})})}},{key:"stop",value:function(){var Ct=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;_a.debug("stop with sendMessage :",Ct),It==null&&(It={code:"USER_STOP"});var Ut=this.conversation.conversationPublishedStreams.get(this.screenSharingStreamId);if(Ut!=null&&(_a.debug("streamInfo :",Ut),apiCC.session.apiCCWebRTCClient.webRTCClient.onHangup(Ut.callId)),this.screenSharingStream!==null&&(this.screenSharingStream.release(),this.screenSharingStream=null),this.aicConsoleManager!==null&&(this.aicConsoleManager.aic_agent_exit(),this.aicConsoleManager.aic_agent_stop(),this.aicConsoleManager=null),apiRTC.session.remoteAccessInvitation=null,Ct){var Kt={event:et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER,invitationId:this.id,roomname:this.conversation._getTechnicalName(),reason:It};this.sendMessageToSender(et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER,Kt).then(function(){}).catch(function(Yt){_a.warn("Contact#send stop message error:",Yt)})}zt.get(this).emit("stop",It)}}],xt=[{key:"getAvailableEvents",value:function(){return wp}}],Zt&&Eu($t.prototype,Zt),xt&&Eu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(Nn),Op=s(8364),Go=s.n(Op);function Es(Wt){return Es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Es(Wt)}function _p(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function wu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}s(9601),s(5306);var Ap=ft.Y.get("UserData"),Mp=Rn.get(),Io=function(){function Wt(){var Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};for(var dn in _p(this,Wt),Bt)Bt.hasOwnProperty(dn)&&(this[dn]=Bt[dn])}var $t,Zt,xt;return $t=Wt,xt=[{key:"equals",value:function(Bt,dn){if(!(Bt instanceof Object&&dn instanceof Object))return!1;for(var pn in Bt)if(dn[pn]===void 0||Es(dn[pn])==="object"&&!this.equals(dn[pn],Bt[pn])||dn[pn]!==Bt[pn])return!1;for(var Xt in dn)if(Bt[Xt]===void 0||Es(Bt[Xt])==="object"&&!this.equals(Bt[Xt],dn[Xt])||Bt[Xt]!==dn[Xt])return!1;return!0}}],(Zt=[{key:"get",value:function(Bt){return this.hasOwnProperty(Bt)&&this[Bt]!==void 0&&this[Bt]!=="null"&&this[Bt]!==null?this[Bt]:null}},{key:"setToSession",value:function(){try{var Bt={};for(var dn in this)this.hasOwnProperty(dn)&&typeof this[dn]!="function"&&(Bt[dn]=this[dn]);Mp.apiRTCSession.setUserData(Bt)}catch{Ap.error("setUserData() - could not set userData")}}},{key:"setProp",value:function(Bt,dn){return this[Bt]=dn,this}},{key:"setProps",value:function(Bt){for(var dn in Bt)Bt.hasOwnProperty(dn)&&(this[dn]=Bt[dn]);return this}}])&&wu($t.prototype,Zt),xt&&wu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function Dl(Wt){return Dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Dl(Wt)}function xp(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function ku(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Nl(Wt,$t){return Nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Nl(Wt,$t)}function Pp(Wt,$t){if($t&&(Dl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ws(Wt)}function ws(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function ks(Wt){return ks=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},ks(Wt)}var _o=ft.Y.get("SentInvitation"),Dp=["response","receive","statusChange"],Do=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Nl(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=ks(Bt);if(dn){var Ut=ks(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return Pp(this,Ct)});function Xt(Ct,It){var Ut,Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return xp(this,Xt),(Ut=pn.call(this)).conversation=It,_o.info("Create SentInvitation"),Ut.invitationType="sent",Ut.contact=Ct,Ut.id=Dt.g.guid(),Ut.sendTime=Date.now(),Ut.expirationTime=null,Ut.expirationTimeout=null,Kt.hasOwnProperty("expirationTime")&&(Ut.expirationTime=Kt.expirationTime,Ut.expirationTimeout=setTimeout(function(){Ut.getStatus()===et.g.INVITATION_STATUS_STANDBY&&(_o.info("Conversation invitation expired"),Ut.setStatus(et.g.INVITATION_STATUS_EXPIRED),zt.get(ws(Ut)).emit("response",Ut.getStatus()))},Kt.expirationTime)),Kt.hasOwnProperty("receiveNotifier")&&Kt.receiveNotifier.on("receive",function(){zt.get(ws(Ut)).emit("receive")}),Ut.apiRTCManager.onEvent("receiveData",function(Yt){_o.debug("SentInvitation receiveData "),Yt.detail.data.event!==void 0&&(Yt.detail.data.event!==et.g.INVITATION_ANSWER_IDENTIFIER&&Yt.detail.data.event!==et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER||Yt.detail.data.invitationId.toString()!==Ut.id.toString()||Ut.getStatus()!==et.g.INVITATION_STATUS_STANDBY||(_o.debug("Received invitation answer for "+Ut.id,Yt.detail.data),Ut.expirationTimeout!==null&&clearTimeout(Ut.expirationTimeout),Yt.detail.data.answer==="accept"?Ut.setStatus(et.g.INVITATION_STATUS_ACCEPTED):Ut.setStatus(et.g.INVITATION_STATUS_DECLINED),zt.get(ws(Ut)).emit("response",Ut.getStatus())))}),Ut.apiRTCManager.onEvent("hangup",function(Yt){_o.debug("hangup");var en=Yt.detail.callId.toString();Ut.getId()===en&&(_o.debug("hangup for sentInvitation"),Ut.setStatus(et.g.INVITATION_STATUS_ENDED))}),Ut}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return Dp}}],(Zt=[{key:"getId",value:function(){return this.id}},{key:"onResponse",value:function(Ct){this.on("response",Ct)}},{key:"cancel",value:function(){_o.info("cancel"),this.type==="sendFile"?(_o.info("cancel sendfile"),this.apiRTCManager.webRTCClient.hangUp(this.id)):_o.warn("cancel is not managed for invitation with type :",this.type)}},{key:"send",value:function(Ct){var It=this;return _o.debug("SentInvitation#send"),new Promise(function(Ut,Kt){It.apiRTCManager.sendData(It.contact.getId(),Ct).then(function(){return Ut()}).catch(function(Yt){var en=Dt.g.createError(Yt,"Invitation not delivered",_o);return Kt(en)})})}}])&&ku($t.prototype,Zt),xt&&ku($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(zn);function Ll(Wt){return Ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Ll(Wt)}function Np(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Ou(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Ul(Wt,$t){return Ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Ul(Wt,$t)}function Lp(Wt,$t){if($t&&(Ll($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Os(Wt)}function Os(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function _s(Wt){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},_s(Wt)}var go=ft.Y.get("SentRemoteAccessInvitation"),Up=["response","receive","remoteAccessStreamAdded","stop","application_connection_ongoing","application_connection_ok"],jp=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Ul(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=_s(Bt);if(dn){var Ut=_s(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return Lp(this,Ct)});function Xt(Ct,It){var Ut,Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Np(this,Xt),Ut=pn.call(this,Ct,It,Kt),go.debug("Create sentRemoteAccessInvitation"),Ut.type="remoteAccess",Ut.screenSharingStreamId=null,Ut.screenSharingStream=null,Ut.aicConsoleManager=null,Ut.screenSharingStreamDOMElementId=null,Ut.apiRTCManager.onEvent("receiveData",function(Yt){go.debug("SentRemoteAccessInvitation receiveData "),Yt.detail.data.event!==void 0&&(Yt.detail.data.event===et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER&&Yt.detail.data.invitationId.toString()===Ut.id.toString()?(go.debug("SentRemoteAccessInvitation Received stop for "+Ut.id,Yt.detail.data),Ut.stop(!1,Yt.detail.data.reason)):Yt.detail.data.event===et.g.CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE&&Yt.detail.data.invitationId.toString()===Ut.id.toString()&&(go.debug("CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE : "+Ut.id,Yt.detail.data.status),Yt.detail.data.status==="APP_CONNECTION_ONGOING"?(zt.get(Os(Ut)).emit("application_connection_ongoing"),Ut.aicConsoleManager=new Ru,Ut.aicConsoleManager.controlActivated===!0&&Ut.aicConsoleManager.aic_control_stop().then(function(){zt.get(Os(Ut)).emit("controlStop")}).catch(function(en){go.debug("aic_control_stop error:",en)})):Yt.detail.data.status==="APP_CONNECTION_OK"&&zt.get(Os(Ut)).emit("application_connection_ok")))}),Ut.conversation.on("contactLeft",function(Yt){Yt.id===Ut.contact.id&&(go.debug("Remote user has left, stopping remoteAccess"),Ut.stop(!1,{code:"USER_LEFT"}))}),Ut}return $t=Xt,Zt=[{key:"setRemoteAccessStream",value:function(Ct){go.debug("setRemoteAccessStream"),this.screenSharingStream=Ct,zt.get(this).emit("remoteAccessStreamAdded",this.screenSharingStream)}},{key:"setScreenSharingStreamDOMElementId",value:function(Ct){var It=this;this.screenSharingStreamDOMElementId=Ct,this.aicConsoleManager!==null?this.aicConsoleManager.aic_control_start().then(function(){zt.get(It).emit("controlStart")}).catch(function(Ut){go.warn("aic_control_start error:",Ut)}):go.debug("aicConsoleManager is not activated")}},{key:"toggleMouseAndKeyboardAccess",value:function(){var Ct=this;return go.debug("toggleMouseAndKeyboardAccess"),new Promise(function(It,Ut){if(Ct.aicConsoleManager!==null)Ct.aicConsoleManager.controlActivated===!0?Ct.aicConsoleManager.aic_control_stop().then(function(){zt.get(Ct).emit("controlStop"),It()}).catch(function(Yt){Ut(Yt)}):Ct.aicConsoleManager.aic_control_start().then(function(){zt.get(Ct).emit("controlStart"),It()}).catch(function(Yt){Ut(Yt)});else{var Kt="aicConsoleManager is not activated";go.debug(Kt),Ut(new Error(Kt))}})}},{key:"getMouseAndKeyboardAccessStatus",value:function(){return this.aicConsoleManager.controlActivated}},{key:"stop",value:function(){var Ct=this,It=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(go.debug("stop"),Ut==null&&(Ut={code:"AGENT_STOP"}),this.aicConsoleManager!==null&&(this.aicConsoleManager.controlActivated===!0&&this.aicConsoleManager.aic_control_stop().then(function(){zt.get(Ct).emit("controlStop")}).catch(function(Yt){go.warn("aic_control_stop error:",Yt)}),this.aicConsoleManager=null),It){var Kt={event:et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER,invitationId:this.id,roomname:this.conversation._getTechnicalName(),reason:Ut};this.send(Kt).then(function(){}).catch(function(Yt){go.warn("Contact#send stop message error:",Yt)})}apiRTC.session.remoteAccessInvitation!==null&&(zt.get(this).emit("stop",Ut),apiRTC.session.remoteAccessInvitation=null)}}],xt=[{key:"getAvailableEvents",value:function(){return Up}}],Zt&&Ou($t.prototype,Zt),xt&&Ou($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(Do);function $l(Wt){return $l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},$l(Wt)}function _u(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Au(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Au(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Au(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function $p(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Mu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Fl(Wt,$t){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Fl(Wt,$t)}function Fp(Wt,$t){if($t&&($l($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jr(Wt)}function Jr(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function As(Wt){return As=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},As(Wt)}var or=ft.Y.get("Contact"),Gr=Rn.get(),es=new(Go()),Wl=Mr.get(),Wp=["message","conversationInvitation","data","joinGroup","leaveGroup","whiteboardInvitation","fileSentSuccessfully","fileTransferInvitation","fileTransferProgress","dataChannelInvitation","incomingCall","newMediaAvailable","customEvent","fileTransferError","incomingScreenSharingCall","incomingScreenSharingCallInvitation"],Bl=new WeakMap,xu=new WeakMap,Vl=new Map,No=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Fl(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=As(Bt);if(dn){var Ut=As(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return Fp(this,Ct)});function Xt(Ct){var It,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return $p(this,Xt),It=pn.call(this,or),or.debug("Create Contact with id "+Ct),or.debug("Create Contact with userData :",Ut),xu.set(Jr(It),Ct.toString()),It.groups=[],It.previousMessages=[],It.userData=new Io(Ut),It.enterprise=null,It.streams=new Map,It.profile=null,It.fileTransfers=[],It.promises=[],Bl.set(Jr(It),[]),Gr.onEvent("roomInvitation",function(Kt){if(Kt.detail.senderId!==null&&Kt.detail.senderId!==void 0&&Kt.detail.roomType==="whiteBoard"&&Kt.detail.senderId.toString()===It.getId()){or.info("Received whiteboard invitation from "+It.getUsername());var Yt={};Kt.detail.cloudConvId&&(Yt.cloudConvId=Kt.detail.cloudConvId),Kt.detail.webconf===!0&&(Yt.webconf=!0),zt.get(Jr(It)).emit("whiteboardInvitation",new vs(Jr(It),Kt.detail.roomId,Yt))}}).onEvent("receiveIMMessage",function(Kt){Kt.detail.senderId.toString()===It.getId()&&(zt.get(Jr(It)).emit("message",{content:Kt.detail.message,uuid:Kt.detail.UUCSeq,time:Kt.detail.time}),It.addMessageToHistory(Kt.detail.message,Math.round(Kt.detail.time.getTime()/1e3),Kt.detail.UUCSeq,!0))}).onEvent("receiveData",function(Kt){if(Kt.detail.senderId.toString()===It.getId()){or.debug("Received data e.detail.data : ",Kt.detail.data);var Yt=Kt.detail.data,en=null,tn=po.get();if(Yt.roomname!==void 0&&(en=tn.isConference(Yt.roomname)?tn.getOrCreateConference(tn.getNameFromTechnicalName(Yt.roomname)):tn.getOrCreateConversation(tn.getNameFromTechnicalName(Yt.roomname))),Yt.apiRTCRequest===!0&&It.manageApiRTCRequest(Kt.detail,en),Yt.event!==void 0)switch(Yt.event){case et.g.CONVERSATION_PERSISTENT_DATA_UPDATE_IDENTIFIER:case et.g.INVITATION_ANSWER_IDENTIFIER:break;case et.g.CONTACT_SEND_DATA_IDENTIFIER:or.trace("Received data from "+It.getUsername(),Yt.content),zt.get(Jr(It)).emit("data",Yt.content);break;case et.g.CONVERSATION_INVITATION_IDENTIFIER:if(en!==null){or.debug("Received conversation invitation from "+It.getId());var ln={};Yt.hasOwnProperty("password")&&(ln.password=Yt.password),zt.get(Jr(It)).emit("conversationInvitation",new Vt(Jr(It),Yt,en,ln))}break;case et.g.CONTACT_SEND_FILEINFO_IDENTIFIER:or.debug("Received file info from "+It.getUsername(),Yt.fileInfo);var Sn=Yt.callId.toString();if(Dt.g._private.dataCallsFileInfo.set(Sn,Yt.fileInfo),Dt.g._private.dataCallsOnHold.has(Sn)){var Dn=null;apiRTC.userAgentInstance.currentSession.invitationsMap.has(It.getId()+"-sendfile-"+Sn)?(Dn=apiRTC.userAgentInstance.currentSession.invitationsMap.get(It.getId()+"-sendfile-"+Sn),or.debug("invitation already exist :",Dn)):(Dn=new eo(Jr(It),Sn,Yt.fileInfo),apiRTC.userAgentInstance.currentSession.invitationsMap.set(It.getId()+"-sendfile-"+Sn,Dn)),zt.get(Jr(It)).emit("fileTransferInvitation",Dn)}break;case et.g.CONTACT_DATACHANNEL_INVITATION:or.debug("Received datachannel invitation from "+It.getUsername()),Dt.g._private.dataChannelInvitations.set(Yt.callId.toString(),!0),Dt.g._private.dataCallsOnHold.has(Yt.callId.toString())&&zt.get(Jr(It)).emit("dataChannelInvitation",new Ho(Jr(It),Yt.callId.toString()));break;case et.g.CONTACT_NEW_MEDIA_IDENTIFIER:or.debug("New media available from "+It.getUsername(),Yt.fileinfo),zt.get(Jr(It)).emit("newMediaAvailable",{media:Yt.media});break;case et.g.CONTACT_EVENTCENTER_DATA_REQUEST:or.debug("New request for event center data from "+It.getUsername());var rr=apiRTC.eventCenter.getStoredData();if(rr===void 0)return void or.error("Can't send event center stored data, it's undefined");or.debug("Sending requested event center data"),It.sendCustomEvent(et.g.CONTACT_EVENTCENTER_DATA_ANSWER,{data:rr});break;case et.g.CONTACT_EVENTCENTER_DATA_ANSWER:if(or.debug("New event center data from "+It.getUsername()),Yt.data===void 0)return void or.error("Can't handle remote event center data, it's undefined");apiRTC.eventCenter.handleDataAnswer(Yt.data);break;case et.g.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_IDENTIFIER:or.debug("New getAudioFlowStatus from "+Yt.requesterId+" on stream "+Yt.streamId);var ar=It.getContact(Yt.requesterId),hr=It.getLocalStreamPublished();if(hr===null)return It.sendToContactRemoteStreamError("No stream found on remote",ar,Yt);ar.sendCustomEvent(et.g.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout,audioFlowStatus:hr.getAudioFlowStatus()});break;case et.g.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_IDENTIFIER:or.debug("New getVideoFlowStatus from "+Yt.requesterId+" on stream "+Yt.streamId);var vr=It.getContact(Yt.requesterId),Pr=It.getLocalStreamPublished();if(Pr===null)return It.sendToContactRemoteStreamError("No stream found on remote",vr,Yt);vr.sendCustomEvent(et.g.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout,videoFlowStatus:Pr.getVideoFlowStatus()});break;case et.g.CONTACT_GET_SETTINGS_IDENTIFIER:or.debug("CONTACT_GET_SETTINGS_IDENTIFIER");var Zr,na=It.getContact(Yt.requesterId);if((Zr=Yt.mediaStreamId!==void 0?It.getLocalStreamWithMediaStreamId(Yt.mediaStreamId):It.getLocalStreamWithCallId(Yt.streamId))===null)return It.sendToContactRemoteStreamError("No stream found on remote",na,Yt);Zr.getSettings().then(function(lo){na.sendCustomEvent(et.g.CONTACT_GET_SETTINGS_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout,settings:lo})}).catch(function(lo){It.sendToContactRemoteStreamError(lo.message,na,Yt)});break;case et.g.CONTACT_GET_CAPABILITIES_IDENTIFIER:or.debug("CONTACT_GET_CAPABILITIES_IDENTIFIER");var Vo,pr=It.getContact(Yt.requesterId);if((Vo=Yt.mediaStreamId!==void 0?It.getLocalStreamWithMediaStreamId(Yt.mediaStreamId):It.getLocalStreamWithCallId(Yt.streamId))===null)return It.sendToContactRemoteStreamError("No stream found on remote",pr,Yt);Vo.getCapabilities().then(function(lo){pr.sendCustomEvent(et.g.CONTACT_GET_CAPABILITIES_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout,capabilities:lo})}).catch(function(lo){It.sendToContactRemoteStreamError(lo.message,pr,Yt)});break;case et.g.CONTACT_GET_CONSTRAINTS_IDENTIFIER:or.debug("New getConstraints from "+Yt.requesterId);var sr=It.getContact(Yt.requesterId),Or=It.getLocalStreamPublished();if(Or===null)return It.sendToContactRemoteStreamError("No stream found on remote",sr,Yt);Or.getConstraints().then(function(lo){sr.sendCustomEvent(et.g.CONTACT_GET_CONSTRAINTS_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout,constraints:lo})}).catch(function(lo){It.sendToContactRemoteStreamError(lo.message,sr,Yt)});break;case et.g.CONTACT_APPLY_CONSTRAINTS_IDENTIFIER:var xr;or.debug("CONTACT_APPLY_CONSTRAINTS_IDENTIFIER"),xr=Yt.mediaStreamId!==void 0?It.getLocalStreamWithMediaStreamId(Yt.mediaStreamId):It.getLocalStreamWithCallId(Yt.streamId);var Er=It.getContact(Yt.requesterId);if(xr===null)return It.sendToContactRemoteStreamError("No stream found on remote",Er,Yt);xr.applyConstraints(Yt.constraints).then(function(){Er.sendCustomEvent(et.g.CONTACT_APPLY_CONSTRAINTS_RESULT_IDENTIFIER,{callId:Yt.callId,streamId:Yt.streamId,timeout:Yt.timeout}),xr.emitConstraintsChanged(Yt.constraints)}).catch(function(lo){It.sendToContactRemoteStreamError(lo.message,Er,Yt)});break;case et.g.CONTACT_CHANGED_CONSTRAINTS_IDENTIFIER:var $a;or.debug("CONTACT_CHANGED_CONSTRAINTS_IDENTIFIER from :"+Yt.requesterId),($a=apiRTC.userAgentInstance.getStreamWithMediaStreamId(Yt.mediaStreamId))!=="NOT_FOUND"&&$a.emitConstraintsChanged(Yt.constraints);break;case et.g.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_RESULT_IDENTIFIER:or.debug("getRemoteAudioFlowStatus result :",Yt);var to=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);to===null?or.error("Can't find the local stream to resolve the request.."):to.resolvePendingPromise(Yt.timeout,Yt.audioFlowStatus);break;case et.g.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_RESULT_IDENTIFIER:or.debug("getRemoteVideoFlowStatus result :",Yt);var vo=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);vo===null?or.error("Can't find the local stream to resolve the request.."):vo.resolvePendingPromise(Yt.timeout,Yt.videoFlowStatus);break;case et.g.CONTACT_GET_SETTINGS_RESULT_IDENTIFIER:or.debug("remote getSettings result :",Yt);var Oo=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);Oo===null?or.error("Can't find the local stream to resolve the request.."):Oo.resolvePendingPromise(Yt.timeout,Yt.settings);break;case et.g.CONTACT_GET_CAPABILITIES_RESULT_IDENTIFIER:or.debug("remote getCapabilities result :",Yt);var Hr=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);Hr===null?or.error("Can't find the local stream to resolve the request.."):Hr.resolvePendingPromise(Yt.timeout,Yt.capabilities);break;case et.g.CONTACT_GET_CONSTRAINTS_RESULT_IDENTIFIER:or.debug("remote getConstraints result :",Yt);var fo=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);fo===null?or.error("Can't find the local stream to resolve the request.."):fo.resolvePendingPromise(Yt.timeout,Yt.constraints);break;case et.g.CONTACT_GET_REMOTE_ERROR:or.debug("remote stream request error:",Yt);var So=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);So===null?or.error("Can't find the local stream to reject the request.."):So.rejectPendingPromise(Yt.timeout,Yt.message);break;case et.g.CONTACT_APPLY_CONSTRAINTS_RESULT_IDENTIFIER:or.debug("remote applyConstraints result :",Yt);var ps=It.getRemoteStreamSubscribed(Yt.callId,Yt.streamId);ps===null?or.error("Can't find the local stream to resolve the request.."):ps.resolvePendingPromise(Yt.timeout,Yt.constraints);break;default:var fs={event:Yt.event,content:Yt};en!==null&&(fs.conversation=en),zt.get(Jr(It)).emit("customEvent",fs)}}}).onEvent("incomingCall",function(Kt){if(Kt.detail.callerId.toString()===It.getId()){var Yt=Kt.detail.callId.toString();if(Kt.detail.callType==="data")if(or.debug("Received file transfer invitation from "+It.getUsername()),Dt.g._private.dataCallsFileInfo.has(Yt)){var en=Dt.g._private.dataCallsFileInfo.get(Yt),tn=null;apiRTC.userAgentInstance.currentSession.invitationsMap.has(It.getId()+"-sendfile-"+Yt)?(tn=apiRTC.userAgentInstance.currentSession.invitationsMap.get(It.getId()+"-sendfile-"+Yt),or.debug("invitation already exist :",tn)):(tn=new eo(Jr(It),Yt,en),apiRTC.userAgentInstance.currentSession.invitationsMap.set(It.getId()+"-sendfile-"+Yt,tn)),zt.get(Jr(It)).emit("fileTransferInvitation",tn)}else Dt.g._private.dataChannelInvitations.has(Yt)?zt.get(Jr(It)).emit("dataChannelInvitation",new Ho(Jr(It),Yt)):(or.info("File information has not been received yet, putting invitation on hold"),Dt.g._private.dataCallsOnHold.set(Yt));else if(Kt.detail.callType==="screenSharing"||Kt.detail.callType==="screenSharingWithAudio")if(apiRTC.session.apiCCWebRTCClient.webRTCClient.userAcceptOnIncomingScreenSharingCall===!0){or.debug("Received screenSharingCallInvitation from "+It.getUsername());var ln=new Ar(Jr(It),Yt,Kt.detail.callType,{isRecorded:!!Kt.detail.hasOwnProperty("recordedCall")&&Kt.detail.recordedCall});zt.get(Jr(It)).emit("incomingScreenSharingCallInvitation",ln)}else{or.debug("Received screenSharingCall from "+It.getUsername());var Sn=Wl.getOrCreateCall(Yt,Jr(It),{started:!0,isRecorded:!!Kt.detail.hasOwnProperty("recordedCall")&&Kt.detail.recordedCall});zt.get(Jr(It)).emit("incomingScreenSharingCall",Sn)}else or.info("Received call invitation from "+It.getUsername()),zt.get(Jr(It)).emit("incomingCall",new Ar(Jr(It),Yt,Kt.detail.callType,{isRecorded:!!Kt.detail.hasOwnProperty("recordedCall")&&Kt.detail.recordedCall}))}}).onEvent("hangup",function(Kt){var Yt=Kt.detail.callId.toString();It.getId()===Kt.detail.remoteId.toString()&&(or.debug("hangup event :",Kt.detail),It.fileTransfers.includes(Yt)&&(or.info("File transfer finished from "+It.getUsername()),It.fileTransfers.splice(It.fileTransfers.indexOf(Yt),1)))}).onEvent("sendDataChannelError",function(Kt){var Yt=Kt.detail.callId.toString();It.getId()===Kt.detail.remoteId.toString()&&It.fileTransfers.includes(Yt)&&(or.info("File transfer error from "+It.getUsername()),zt.get(Jr(It)).emit("fileTransferError",{error:"sendDataChannelError",invitationId:Yt}))}).onEvent("fetchUserDataAnswer",function(Kt){It.getId()===Kt.detail.id.toString()&&(It.userData=new Io(Kt.detail.userData),It.promises.forEach(function(Yt){Kt.detail.timeout===Yt.timeout&&(clearTimeout(Yt.timeout),Yt.resolve(Kt.detail.userData))}))}),It}return $t=Xt,Zt=[{key:"getId",value:function(){return xu.get(this)}},{key:"id",get:function(){return or.warn("contact.id is deprecated, please use contact.getId() instead"),this.getId()}},{key:"fetchProfileInformation",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return new Promise(function(Kt,Yt){It.profile===null||Ut?es.getUserProfile(Gr.getActiveApiKey(),It.getId(),Ct).then(function(en){It.profile=en,Kt(en)}).catch(Yt):Kt(It.profile)})}},{key:"getActiveStreams",value:function(){return this.streams.values()}},{key:"getLocalStreamWithCallId",value:function(Ct){for(var It=null,Ut=so.getLocalStreams(),Kt=Ut.next();!Kt.done;){for(var Yt=Kt.value,en=Yt.publishedInConversations.values(),tn=en.next();!tn.done;)tn.value===Ct&&(or.debug("Finding Stream in a conversation"),It=Yt),tn=en.next();Yt.callId===Ct&&(or.debug("Finding Stream in a call"),It=Yt),Kt=Ut.next()}return It}},{key:"getLocalStreamPublished",value:function(){var Ct=so.getLocalStreams().next();return Ct.value===void 0?null:Ct.value}},{key:"getLocalStreamWithMediaStreamId",value:function(Ct){for(var It=null,Ut=so.getLocalStreams(),Kt=Ut.next();!Kt.done;){var Yt=Kt.value;if(Yt.data.id===Ct)return Yt;Kt=Ut.next()}return It}},{key:"getRemoteStreamSubscribed",value:function(Ct,It){var Ut=zr.getActiveSession().getCall(Ct);if(Ut){or.debug("remote stream is associated to a call");var Kt,Yt=_u(Ut.getReceivedStreams());try{for(Yt.s();!(Kt=Yt.n()).done;){var en=Kt.value;if(en.getId()===It)return en}}catch(hr){Yt.e(hr)}finally{Yt.f()}}else{var tn=zr.getActiveSession().getActiveConversations(),ln=zr.getActiveSession().getActiveConferences();for(var Sn in tn){var Dn=tn[Sn].getSubscribedStream(It);if(Dn!==void 0)return or.debug("remote stream is associated to a conversation"),Dn}for(var rr in ln){var ar=ln[rr].getSubscribedStream(It);if(ar!==void 0)return or.debug("remote stream is associated to a conference"),ar}}return null}},{key:"addMessageToHistory",value:function(Ct,It,Ut,Kt){Bl.get(this).indexOf(Ut.toString())===-1&&(this.previousMessages.push({content:Ct,timestamp:It,uuid:Ut,fromContact:Kt}),Bl.get(this).push(Ut.toString()))}},{key:"getPreviousMessages",value:function(){return this.previousMessages.sort(function(Ct,It){return new Date(It.timestamp)-new Date(Ct.timestamp)}),this.previousMessages}},{key:"getUserData",value:function(){return this.userData}},{key:"getRemoteAccessSupport",value:function(){var Ct=!1;return this.userData.remoteAccessUserSupport==="ON"&&(Ct=!0),Ct}},{key:"fetchUserData",value:function(){var Ct=this;return new Promise(function(It,Ut){var Kt=setTimeout(function(){Ut("Timeout error during fetchUserData() process")},5e3);Ct.promises.push({timeout:Kt,resolve:It}),apiRTC.session.fetchUserData({apiKey:Gr.getActiveApiKey(),id:Ct.getId(),timeout:Kt})})}},{key:"getUsername",value:function(){return this.userData.get("username")!==null?this.userData.get("username"):this.userData.get("nickname")!==null?this.userData.get("nickname"):this.getId()}},{key:"getPhotoUrl",value:function(){return this.userData.get("photo_url")!==null?this.userData.get("photo_url"):this.userData.get("photoUrl")!==null?this.userData.get("photoUrl"):null}},{key:"fetchWebSessionInformation",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){Ct instanceof zr?Vl.has(It.getId()+":"+Ct.getId())?Ut(Vl.get(It.getId()+":"+Ct.getId())):es.getWebSession(Ct,It,Gr.getActiveApiKey()).then(function(Yt){Vl.set(It.getId()+":"+Ct.getId(),Yt),Ut(Yt)}).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_OTHER,"fetchWebSessionInformation() - could not fetch web session information",or))}):Kt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"fetchWebSessionInformation() - parameter is not an instance of apiRTC.Session",or))})}},{key:"loadMessageHistory",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){It.fetchWebSessionInformation(Ct).then(function(en){return es.getSessionHistory(en.webSessionId,Ct.getToken(),Ut)}).then(function(en){or.debug("loadMessageHistory() - got messages",en.messages);var tn,ln=_u(en.messages);try{for(ln.s();!(tn=ln.n()).done;){var Sn=tn.value;It.addMessageToHistory(Sn.value,Sn.timestamp,Sn.uuid,Sn.destId.toString()!==It.getId())}}catch(Dn){ln.e(Dn)}finally{ln.f()}Kt()}).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"loadMessageHistory() - could not load session history",or))})})}},{key:"addToGroup",value:function(Ct){this.inGroup(Ct)||(this.groups.push(Ct),zt.get(this).emit("joinGroup",Ct))}},{key:"removeFromGroup",value:function(Ct){this.inGroup(Ct)&&(this.groups.splice(this.groups.indexOf(Ct),1),zt.get(this).emit("leaveGroup",Ct))}},{key:"inGroup",value:function(Ct){return this.groups.includes(Ct)}},{key:"isOnline",value:function(){return this.groups.length!==0}},{key:"sendData",value:function(Ct){var It=this;return this.isOnline()||or.warn("sendData() - contact "+this.getUsername()+" does not seem to be connected."),new Promise(function(Ut,Kt){Gr.sendData(It.getId(),{event:et.g.CONTACT_SEND_DATA_IDENTIFIER,content:Ct}).then(Ut).catch(function(Yt){switch(Yt){case et.g.ERROR_TIMED_OUT:Kt(Dt.g.createError(et.g.ERROR_TIMED_OUT,"sendData() - Data transmission timed out ",or));break;case et.g.ERROR_NOT_FOUND:Kt(Dt.g.createError(et.g.ERROR_NOT_FOUND,"sendData() - Contact was not found ",or));break;default:Kt(Dt.g.createError(et.g.ERROR_OTHER,"sendData() - Data default error ",or))}})})}},{key:"sendCustomEvent",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isOnline()||or.warn("sendCustomEvent() - contact "+this.getUsername()+" does not seem to be connected."),new Promise(function(Kt,Yt){var en=Ut;en.event=Ct,Gr.sendData(It.getId(),en).then(Kt).catch(function(tn){switch(tn){case et.g.ERROR_TIMED_OUT:Yt(Dt.g.createError(et.g.ERROR_TIMED_OUT,"sendCustomEvent() - Data transmission timed out ",or));break;case et.g.ERROR_NOT_FOUND:Yt(Dt.g.createError(et.g.ERROR_NOT_FOUND,"sendCustomEvent() - Contact was not found ",or));break;default:Yt(Dt.g.createError(et.g.ERROR_OTHER,"sendCustomEvent() - Data transmission timed out ",or))}})})}},{key:"sendRequest",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isOnline()||or.warn("sendRequest() - contact "+this.getUsername()+" does not seem to be connected."),new Promise(function(Kt,Yt){var en=(Math.random()*new Date().getTime()).toString(36).replace(/\./g,"-");Gr.onceEvent("receiveData",function(ln){or.debug("Received data e.detail.data : ",ln.detail.data),ln.detail.data.apiRTCAnswer===!0&&(ln.detail.data.requestUUID===en?Kt():or.error("uuid is not correct"))});var tn=Ut;tn.apiRTCRequest=!0,tn.requestType=Ct,tn.uuid=en,Gr.sendData(It.getId(),tn).then(function(){or.debug("sendData ok")}).catch(function(ln){or.error("Error on sendData",ln),Yt()})})}},{key:"sendAnswer",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isOnline()||or.warn("sendRequest() - contact "+this.getUsername()+" does not seem to be connected."),new Promise(function(Kt,Yt){var en=Ut;en.apiRTCAnswer=!0,en.answerType=Ct,Gr.sendData(It.getId(),en).then(function(){Kt()}).catch(function(tn){or.error("Error on sendData",tn),Yt()})})}},{key:"sendDataAnswer",value:function(Ct,It,Ut){this.getContact(Ct.senderId).sendAnswer(It,Ut).then(function(){or.debug("sendAnswer OK")}).catch(function(Kt){or.error("Error on sendAnswer",Kt)})}},{key:"manageApiRTCStreamRequest",value:function(Ct,It){var Ut=this;or.debug("manageApiRTCStreamRequest : ",Ct);var Kt=Ct.data.requestType,Yt={};Yt.requestUUID=Ct.data.uuid,Yt.result="NOK";var en=null;if((en=apiRTC.userAgentInstance.getStreamWithRoomNameAndCallId(It.getName(),Ct.data.streamId))==="NOT_FOUND")Yt.reason="STREAM_NOT_FOUND",this.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Yt);else if(Kt!==void 0)switch(Kt){case et.g.CONTACT_DISABLE_AUDIO_REQUEST:en.disableAudio().then(function(){Yt.result="OK",Ut.sendDataAnswer(Ct,et.g.CONTACT_DISABLE_AUDIO_ANSWER,Yt)}).catch(function(){Yt.reason="ERROR_ON_DISABLE_AUDIO",Ut.sendDataAnswer(Ct,et.g.CONTACT_DISABLE_AUDIO_ANSWER,Yt)});break;case et.g.CONTACT_ENABLE_AUDIO_REQUEST:en.enableAudio().then(function(){Yt.result="OK",Ut.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_AUDIO_ANSWER,Yt)}).catch(function(){Yt.reason="ERROR_ON_ENABLE_AUDIO",Ut.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_AUDIO_ANSWER,Yt)});break;case et.g.CONTACT_DISABLE_VIDEO_REQUEST:en.disableVideo().then(function(){Yt.result="OK",Ut.sendDataAnswer(Ct,et.g.CONTACT_DISABLE_VIDEO_ANSWER,Yt)}).catch(function(){Yt.reason="ERROR_ON_DISABLE_VIDEO",Ut.sendDataAnswer(Ct,et.g.CONTACT_DISABLE_VIDEO_ANSWER,Yt)});break;case et.g.CONTACT_ENABLE_VIDEO_REQUEST:en.enableVideo().then(function(){Yt.result="OK",Ut.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Yt)}).catch(function(){Yt.reason="ERROR_ON_ENABLE_VIDEO",Ut.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Yt)});break;default:or.error("not a defined apiRTC request :",Kt),Yt.reason="ERROR_ON_REQUESTTYPE",this.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Yt)}else or.error("requestType is undefined :",Kt),Yt.reason="ERROR_ON_REQUESTTYPE",this.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Yt)}},{key:"manageApiRTCRequest",value:function(Ct,It){or.debug("manageApiRTCRequest : ",Ct);var Ut=Ct.data.requestType,Kt={};if(Kt.requestUUID=Ct.data.uuid,Kt.result="NOK",Ut!==void 0)switch(Ut){case et.g.CONTACT_DISABLE_AUDIO_REQUEST:case et.g.CONTACT_ENABLE_AUDIO_REQUEST:case et.g.CONTACT_DISABLE_VIDEO_REQUEST:case et.g.CONTACT_ENABLE_VIDEO_REQUEST:this.manageApiRTCStreamRequest(Ct,It);break;default:or.error("not a defined apiRTC request :",Ut),Kt.reason="ERROR_ON_REQUESTTYPE",this.sendDataAnswer(Ct,et.g.CONTACT_ENABLE_VIDEO_ANSWER,Kt)}}},{key:"sendMessage",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.isOnline()||or.warn("sendMessage() - contact "+this.getUsername()+" does not seem to be connected.");var Kt=null,Yt=function(){return new Promise(function(en,tn){Ut.hasOwnProperty("session")?It.fetchWebSessionInformation(Ut.session).then(function(ln){en({save:!0,cloudSessionId:ln.webSessionId,apiRTCId:Ut.session.getId()})}).catch(tn):en({})})};return new Promise(function(en,tn){return typeof Ct!="string"?tn(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"sendMessage() - message parameter is not instance of string",or)):Ct===""?tn(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"sendMessage() - message parameter is empty",or)):void Yt().then(function(ln){Kt=ln,or.info("sendMessage() - with options :",Kt),Gr.sendMessage(It.getId(),Ct,Kt).then(function(Sn){It.addMessageToHistory(Ct,Math.floor(Date.now()/1e3),Sn,!1),en(Sn)}).catch(function(Sn){switch(Sn){case et.g.ERROR_TIMED_OUT:tn(Dt.g.createError(et.g.ERROR_TIMED_OUT,"sendMessage() - Data transmission timed out ",or));break;case et.g.ERROR_NOT_FOUND:tn(Dt.g.createError(et.g.ERROR_NOT_FOUND,"sendMessage() - Contact was not found ",or));break;default:tn(Dt.g.createError(et.g.ERROR_OTHER,"sendMessage() - Data transmission timed out ",or))}})},function(ln){tn(Dt.g.createError(et.g.ERROR_OTHER,"sendMessage() - Error occured when fetching options for sending message",or))})})}},{key:"inviteTo",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.sendConversationInvitation(Ct,It)}},{key:"sendConversationInvitation",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ct instanceof $o?Ct.sendInvitation(this,It):(or.error("sendConversationInvitation() - Parameter is not a conversation"),null)}},{key:"sendWhiteboardInvitation",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Gr.whiteBoardClient.roomId!==Ct&&(Gr.whiteBoardClient.leaveRoom(),Gr.whiteBoardClient.start(),Gr.whiteBoardClient.joinRoom(Ct));var Ut=It.context?It.context:null,Kt={};It.cloudConversationId&&(Kt.convId=It.cloudConversationId),Gr.whiteBoardClient.inviteInRoom(Ct,this.getId(),Ut,Kt);var Yt=new Do(this,null);return Yt.id="wb-"+Ct,Yt.type="whiteboard",Yt}},{key:"call",value:function(Ct){var It,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{mediaTypeForOutgoingCall:"VIDEO",record:!1};or.debug("call()"),this.isOnline()||or.warn("call() - contact "+this.getUsername()+" does not seem to be connected.");var Kt={},Yt=Dt.g.assignObject({},Ut),en=!!Ut.hasOwnProperty("audioOnly")&&Ut.audioOnly;Ut.hasOwnProperty("record")&&(Yt.record!==void 0&&Yt.record!==null||(Yt.record=Ut.record)),Ct!==null&&Ct instanceof so&&(Yt.userMediaStreamId=Ct.userMediaStreamId,Ct.isScreensharing()&&(Yt.forceCallType="screenSharing")),Yt.cloudConversationId&&(Kt.cloudConvId=Yt.cloudConversationId,delete Yt.cloudConversationId),It=en?Gr.webRTCClient.callAudio(this.getId(),Kt,Yt):Gr.webRTCClient.call(this.getId(),Kt,Yt);var tn=Wl.getOrCreateCall(It,this,{isRecorded:Yt.record});return tn}},{key:"shareScreen",value:function(){var Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.isOnline()||or.warn("call() - contact "+this.getUsername()+" does not seem to be connected.");var It={},Ut=null,Kt=Ct,Yt=Ct.captureSourceType;or.warn("call() - contact "+this.getUsername()+" does not seem to be connected."),Ut=Gr.webRTCClient.shareScreen(this.getId(),It,Yt);var en=Wl.getOrCreateCall(Ut,this,{isRecorded:Kt.record});return en}},{key:"startDataChannel",value:function(){if(this.isOnline()||or.warn("startDataChannel() - contact "+this.getUsername()+" does not seem to be connected."),!(pt.Xh==="Edge"&&pt.PR<79&&apiRTC.browserDetails.type!=="chrome")){var Ct=Gr.webRTCClient.startDataChannel(this.getId());return Gr.sendData(this.getId(),{callId:Ct,event:et.g.CONTACT_DATACHANNEL_INVITATION}),new ys(Ct,this,{type:et.g.DATACHANNEL_TYPE_SEND})}or.warn("Cannot startDataChannel as it is not supported on Edge")}},{key:"sendFile",value:function(Ct,It){if(this.isOnline()||or.warn("sendFile() - contact "+this.getUsername()+" does not seem to be connected."),pt.Xh==="Edge"&&pt.PR<79&&apiRTC.browserDetails.type!=="chrome")return or.warn("Cannot sendFile as Datachannel is not supported on Edge"),null;var Ut=Gr.webRTCClient.startDataChannel(this.getId()),Kt=this;if(Ut===void 0)return or.warn("Error on startDataChannel"),null;Gr.sendData(this.getId(),{fileInfo:Ct,callId:Ut,event:et.g.CONTACT_SEND_FILEINFO_IDENTIFIER}),Gr.onEvent("sendDataChannelOpen",function en(tn){or.debug("sendFile() - DataChannel open",tn.detail),tn.detail.callId.toString()===Ut.toString()&&(Gr.webRTCClient.sendDataWithCallId(Ut,{file:It,name:Ct.name,type:Ct.type},function(ln){or.trace("sendFile() - progress : ",ln);var Sn={uuid:ln.uuid,fileSize:ln.fileSize,remainingSize:ln.remainingSize,percentage:ln.percentage,sendChunkNb:ln.sendChunkNb,transferDuration:ln.transferDuration,lastPacket:ln.lastPacket};zt.get(Kt).emit("fileTransferProgress",{fileInfo:Ct,transferInformation:Sn}),ln.transferEnded&&zt.get(Kt).emit("fileSentSuccessfully",{fileInfo:Ct,transferInformation:Sn})}),Gr.removeEventListener("sendDataChannelOpen",en))}),this.fileTransfers.push(Ut.toString());var Yt=new Do(this,null);return Yt.id=Ut.toString(),Yt.type="sendFile",Yt.on("response",function(){Yt.getStatus()!==et.g.INVITATION_STATUS_ACCEPTED&&or.log("sendFile() - invitation has not been accepted, cleaning listeners")}),Yt}},{key:"pushMedia",value:function(Ct,It){var Ut=this,Kt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise(function(Yt,en){Ut.fetchWebSessionInformation(It).then(function(tn){return Kt.token=It.token,es.pushConversationMedia(tn.conversationId,Ct,Gr.getActiveApiKey(),Kt)}).then(function(tn){Gr.sendData(Ut.getId(),{event:et.g.CONTACT_NEW_MEDIA_IDENTIFIER,media:{url:tn.url,id:tn.id}}),Yt({url:tn.url,id:tn.id})}).catch(function(tn){en(Dt.g.createError(et.g.ERROR_OTHER,"pushMedia() - failed to push media",or))})})}},{key:"fetchMediaList",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return or.debug("fetchMediaList()"),new Promise(function(Kt,Yt){It.fetchWebSessionInformation(Ct).then(function(en){return Ut.token=Ct.getToken(),es.getConversationMediaList(en.conversationId,Gr.getActiveApiKey(),Ut)}).then(Kt).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"getMediaList() - failed to get media list",or))})})}},{key:"sendEventCenterDataRequest",value:function(){return this.sendCustomEvent(et.g.CONTACT_EVENTCENTER_DATA_REQUEST)}},{key:"getContact",value:function(Ct){return zr.getActiveSession().getOrCreateContact(Ct)}},{key:"sendToContactRemoteStreamError",value:function(Ct,It,Ut){or.debug("sendToContactRemoteStreamError",Ct,It,Ut),It.sendCustomEvent(et.g.CONTACT_GET_REMOTE_ERROR,{callId:Ut.callId,streamId:Ut.streamId,timeout:Ut.timeout,message:Ct})}},{key:"sendRemoteAccessInvitation",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){if(It.isOnline()||or.warn("sendRemoteAccessInvitation() - contact "+It.getUsername()+" does not seem to be connected."),apiRTC.session.remoteAccessInvitation!==null)return or.warn("sendRemoteAccessInvitation() already ongoing"),Yt(new Error("sendRemoteAccessInvitation() already ongoing"));var en=new jp(It,Ct,Ut);apiRTC.session.remoteAccessInvitation=en,en.type=et.g.CONTACT_REMOTEACCESS_INVITATION_IDENTIFIER;var tn={event:et.g.CONTACT_REMOTEACCESS_INVITATION_IDENTIFIER,invitationId:en.id,roomname:en.conversation._getTechnicalName(),sendTime:en.sendTime};en.send(tn).then(function(){Kt(en)}).catch(function(ln){return or.error("Contact#sendRemoteAccessInvitation send error:",ln),Yt(new Error(ln))})})}}],xt=[{key:"getAvailableEvents",value:function(){return Wp}}],Zt&&Mu($t.prototype,Zt),xt&&Mu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(un);function Hl(Wt){return Hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Hl(Wt)}function Bp(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function zl(Wt,$t){return zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},zl(Wt,$t)}function Vp(Wt,$t){if($t&&(Hl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Ms(Wt){return Ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Ms(Wt)}var co=ft.Y.get("ConversationCall"),Vr=Rn.get(),Gl=function(Wt){(function(Xt,Ct){if(typeof Ct!="function"&&Ct!==null)throw new TypeError("Super expression must either be null or a function");Xt.prototype=Object.create(Ct&&Ct.prototype,{constructor:{value:Xt,writable:!0,configurable:!0}}),Object.defineProperty(Xt,"prototype",{writable:!1}),Ct&&zl(Xt,Ct)})(pn,Wt);var $t,Zt,xt,Bt,dn=(xt=pn,Bt=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Xt,Ct=Ms(xt);if(Bt){var It=Ms(this).constructor;Xt=Reflect.construct(Ct,arguments,It)}else Xt=Ct.apply(this,arguments);return Vp(this,Xt)});function pn(Xt,Ct,It){var Ut;return function(Kt,Yt){if(!(Kt instanceof Yt))throw new TypeError("Cannot call a class as a function")}(this,pn),(Ut=dn.call(this,co)).conversation=Xt,Ut.callId=Ct,Ut.stream=It,Ut}return $t=pn,Zt=[{key:"getConversation",value:function(){return this.conversation}},{key:"getCallId",value:function(){return this.callId}},{key:"getStream",value:function(){return this.stream}},{key:"isRecorded",value:function(){return!!this.recordingStatus}},{key:"getRecordingInfo",value:function(){return this.isRecorded()?this.recordingStatus:null}},{key:"isStreamed",value:function(){return!!this.streamingStatus}},{key:"getStreamingInfo",value:function(){return this.isStreamed()?this.streamingStatus:null}},{key:"startRecordingPublishedStream",value:function(Xt){var Ct=this;return Xt||(Xt={}),new Promise(function(It,Ut){if(Ct.asyncCallbacks)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecordingPublishedStream() - busy",co));Ct.asyncCallbacks={},Ct.asyncCallbacks.timeoutId=setTimeout(function(){return Ct.asyncCallbacks&&(Vr.removeEventListener("error",Ct.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecordingPublishedStream() - timeout",co))},et.g.CONVERSATION_RECORDING_STARTED_DELAY),Ct.asyncCallbacks.error=function(tn){if(String(tn.detail.convId)===Ct.conversation.getCloudConversationId()&&tn.detail.callId===Ct.callId&&tn.detail.errorCode.indexOf("START_RECORD")>=0)return Ct.asyncCallbacks&&(Vr.removeEventListener("error",Ct.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"startRecordingPublishedStream() - "+tn.detail.errorInfo,co))},Ct.asyncCallbacks.recordingStarted=function(tn){if(String(tn.detail.convId)===Ct.conversation.getCloudConversationId()&&tn.detail.callId===Ct.callId){Ct.asyncCallbacks&&(Vr.removeEventListener("error",Ct.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks);var ln=Dt.g.parseRecordingEvent("MCURecordingStarted",tn.detail);return It(ln)}},Vr.onEvent("error",Ct.asyncCallbacks.error),Vr.onEvent("MCURecordingStarted",Ct.asyncCallbacks.recordingStarted);var Kt="AUDIO-VIDEO";Xt.audioOnly===!0?Kt="AUDIO-ONLY":Xt.videoOnly===!0&&(Kt="VIDEO-ONLY");var Yt="userStream";Dt.g.isPropertyTypeof(Xt,"customIdInFilename","string")&&(Yt=Xt.customIdInFilename);var en={};Dt.g.isPropertyTypeof(Xt,"data","object")&&(en=Object.assign({},Xt.data)),Dt.g.isPropertyTypeof(Xt,"ttl","number")&&Xt.ttl>0&&(en.ttl=Xt.ttl),Vr.webRTCClient.startRecording(Kt,Yt,Ct.conversation.getCloudConversationId(),Ct.callId,en)})}},{key:"stopRecordingPublishedStream",value:function(){var Xt=this;return new Promise(function(Ct,It){if(Xt.asyncCallbacks)return It(Dt.g.createError(et.g.ERROR_OTHER,"stopRecordingPublishedStream() - busy",co));Xt.asyncCallbacks={},Xt.asyncCallbacks.timeoutId=setTimeout(function(){return Xt.asyncCallbacks&&(Vr.removeEventListener("error",Xt.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStopped",Xt.asyncCallbacks.recordingStopped),delete Xt.asyncCallbacks),Ct(Xt.recordingStatus)},et.g.CONVERSATION_RECORDING_STOPPED_DELAY),Xt.asyncCallbacks.error=function(Ut){if(String(Ut.detail.convId)===Xt.conversation.getCloudConversationId()&&Ut.detail.callId===Xt.callId&&Ut.detail.errorCode.indexOf("STOP_RECORD")>=0)return Xt.asyncCallbacks&&(Vr.removeEventListener("error",Xt.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStopped",Xt.asyncCallbacks.recordingStopped),clearTimeout(Xt.asyncCallbacks.timeoutId),delete Xt.asyncCallbacks),It(Dt.g.createError(et.g.ERROR_OTHER,"stopRecordingPublishedStream() - "+Ut.detail.errorInfo,co))},Xt.asyncCallbacks.recordingStopped=function(Ut){if(String(Ut.detail.convId)===Xt.conversation.getCloudConversationId()&&Ut.detail.callId===Xt.callId){Xt.asyncCallbacks&&(Vr.removeEventListener("error",Xt.asyncCallbacks.error),Vr.removeEventListener("MCURecordingStopped",Xt.asyncCallbacks.recordingStopped),clearTimeout(Xt.asyncCallbacks.timeoutId),delete Xt.asyncCallbacks);var Kt=Dt.g.parseRecordingEvent("MCURecordingStopped",Ut.detail);return Ct(Kt)}},Vr.onEvent("error",Xt.asyncCallbacks.error),Vr.onEvent("MCURecordingStopped",Xt.asyncCallbacks.recordingStopped),Vr.webRTCClient.stopRecording(Xt.callId)})}},{key:"replacePublishedStream",value:function(Xt,Ct){var It=this;return co.debug("replacePublishedStream"),new Promise(function(Ut,Kt){if(Xt===null){if(!Dt.g.isPropertyTypeof(Ct,"getStream","function"))return Kt(new Error("replacePublishedStream() - Cannot replace stream, wrong arguments"));It.stream.publishedInConversations.delete(It.conversation.getName()),It.conversation.conversationPublishedStreams.delete(It.stream.userMediaStreamId);var Yt={getUserMediaStreamId:function(){return Ct.getStream().then(function(tn){It.stream=tn,tn.publishedInConversations.set(It.conversation.getName(),It.callId),It.conversation.callIdToStreamId.set(It.callId,tn.userMediaStreamId);var ln={contact:null,isRemote:!1,hasAudio:tn.hasAudio(),hasVideo:tn.hasVideo(),isScreensharing:tn.isScreensharing(),streamId:tn.userMediaStreamId,callId:It.callId};return It.conversation.conversationPublishedStreams.set(tn.userMediaStreamId,ln),tn.userMediaStreamId}).catch(Kt)}};Vr.webRTCClient.webRTCClient.addMedia(It.callId,!0,null,Yt).then(function(tn){var ln=function(Sn){if(yo.has(Sn))return yo.get(Sn);var Dn=apiCC.getUserMediaStream(Sn);if(Dn){var rr="audio";return Dn.video===!0&&(rr="video"),new so(Dn.stream,{type:rr,constructor:!0,userMediaStreamId:Dn.userMediaStreamId})}return null}(tn.userMediaStreamId);return ln!==null&&It.conversation.sendCustomEvent(et.g.CONTACT_STREAM_UPDATED_INFO,{callId:It.getCallId(),newStreamId:ln.data.id,oldStreamId:tn.oldMediaStreamId}),Ut(ln)}).catch(function(tn){return Kt(new Error("replacePublishedStream() - "+tn))})}else{It.stream.publishedInConversations.delete(It.conversation.getName()),It.conversation.conversationPublishedStreams.delete(It.stream.userMediaStreamId),Vr.webRTCClient.webRTCClient.addMedia(It.callId,!0,Xt.userMediaStreamId).then(function(tn){return It.conversation.sendCustomEvent(et.g.CONTACT_STREAM_UPDATED_INFO,{callId:It.getCallId(),newStreamId:Xt.data.id,oldStreamId:tn.oldMediaStreamId}),Ut(Xt)}).catch(function(tn){return Kt(new Error("replacePublishedStream() - "+tn))}),It.stream=Xt,Xt.publishedInConversations.set(It.conversation.getName(),It.callId),It.conversation.callIdToStreamId.set(It.callId,Xt.userMediaStreamId);var en={contact:null,isRemote:!1,hasAudio:Xt.hasAudio(),hasVideo:Xt.hasVideo(),isScreensharing:Xt.isScreensharing(),streamId:Xt.userMediaStreamId,callId:It.callId};It.conversation.conversationPublishedStreams.set(Xt.userMediaStreamId,en)}})}},{key:"startStreaming",value:function(){var Xt=this,Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(It,Ut){return Xt.asyncCallbacks?Ut(Dt.g.createError(et.g.ERROR_OTHER,"startStreaming() - busy",co)):Vr.webRTCClient.startStreaming(Ct.service,Ct.server,Ct.streamKey,Xt.callId)?(Xt.asyncCallbacks={},Xt.asyncCallbacks.timeoutId=setTimeout(function(){return Xt.asyncCallbacks&&(Vr.removeEventListener("MCUStreamingStarted",Xt.asyncCallbacks.streamingStarted),delete Xt.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"startStreaming() - timeout",co))},et.g.CONVERSATION_STREAMING_STARTED_DELAY),Xt.asyncCallbacks.streamingStarted=function(Kt){if(Kt.detail.roomName===Xt.conversation._getTechnicalName()&&Kt.detail.callId===Xt.callId){Xt.asyncCallbacks&&(Vr.removeEventListener("MCUStreamingStarted",Xt.asyncCallbacks.streamingStarted),clearTimeout(Xt.asyncCallbacks.timeoutId),delete Xt.asyncCallbacks);var Yt=$s("MCUStreamingStarted",Kt.detail);return It(Yt)}},void Vr.onEvent("MCUStreamingStarted",Xt.asyncCallbacks.streamingStarted)):Ut(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"startStreaming() - cannot start streaming",co))})}},{key:"stopStreaming",value:function(){var Xt=this;return new Promise(function(Ct,It){return Xt.asyncCallbacks?It(Dt.g.createError(et.g.ERROR_OTHER,"stopStreaming() - busy",co)):Vr.webRTCClient.stopStreaming(Xt.callId)?(Xt.asyncCallbacks={},Xt.asyncCallbacks.timeoutId=setTimeout(function(){return Xt.asyncCallbacks&&(Vr.removeEventListener("MCUStreamingStopped",Xt.asyncCallbacks.streamingStopped),delete Xt.asyncCallbacks),It(Dt.g.createError(et.g.ERROR_OTHER,"stopStreaming() - timeout",co))},et.g.CONVERSATION_STREAMING_STOPPED_DELAY),Xt.asyncCallbacks.streamingStopped=function(Ut){if(Ut.detail.roomName===Xt.conversation._getTechnicalName()&&Ut.detail.callId===Xt.callId){Xt.asyncCallbacks&&(Vr.removeEventListener("MCUStreamingStopped",Xt.asyncCallbacks.streamingStopped),clearTimeout(Xt.asyncCallbacks.timeoutId),delete Xt.asyncCallbacks);var Kt=$s("MCUStreamingStopped",Ut.detail);return Ct(Kt)}},void Vr.onEvent("MCUStreamingStopped",Xt.asyncCallbacks.streamingStopped)):It(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"stopStreaming() - cannot stop streaming",co))})}},{key:"changeStreamPriority",value:function(Xt){var Ct=this;return new Promise(function(It,Ut){return Vr.webRTCClient.changeStreamPriority(Ct.callId,Xt)?(Ct.conversation.changeStreamPriority(Ct.stream.userMediaStreamId,!1,Xt),It()):Ut(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"changeStreamPriority() - cannot change stream priority",co))})}},{key:"updatePublishedStream",value:function(Xt,Ct){var It=this;return new Promise(function(Ut,Kt){if(Xt!=="audio"&&Xt!=="video")return Kt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"updatePublishedStream() - wrong type",co));var Yt=Ct?"sendonly":"inactive";return Vr.webRTCClient.webRTCClient.processUpdateStream(It.callId,Xt,Yt)?Ut():Kt(Dt.g.createError(et.g.ERROR_OTHER,"updatePublishedStream() - cannot update",co))})}}],Zt&&Bp($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),pn}(un);function Lo(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Pu(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Pu(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Pu(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function Du(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}var no=ft.Y.get("ContactCatalog"),mo=null,Mo={},bo={leftGroup:{},joinedGroup:{},userDataChanged:[]},Ro=function(){function Wt(){if(function(dn,pn){if(!(dn instanceof pn))throw new TypeError("Cannot call a class as a function")}(this,Wt),mo!==null)throw"Cannot construct singleton ContactCatalog";this.contactList=new Map,this.eventEmitter=new dt,mo=this;var Bt=Rn.get();Bt.onEvent("connectedUsersListUpdate",function(dn){var pn=apiRTC.session.apiCCId.toString(),Xt={};switch(dn.detail.updateReason){case"newConnectionState":if(dn.detail.status==="online"){no.debug("new connection");var Ct,It=Lo(dn.detail.usersList);try{for(It.s();!(Ct=It.n()).done;)(Xt={userId:Ct.value,group:dn.detail.group}).userId.toString()!==pn&&zp(Xt)}catch(Sn){It.e(Sn)}finally{It.f()}}else{no.debug("new disconnection");var Ut,Kt=Lo(dn.detail.usersList);try{for(Kt.s();!(Ut=Kt.n()).done;)Xt={userId:Ut.value,group:dn.detail.group},Mo[Xt.group]===void 0&&(Mo[Xt.group]={}),Xt.userId.toString()!==pn&&(Mo[Xt.group][Xt.userId.toString()]=setTimeout(Hp(Xt),Bt.contactDisconnectionDelay))}catch(Sn){Kt.e(Sn)}finally{Kt.f()}}break;case"userDataUpdate":no.debug("userDataUpdate");var Yt,en=Lo(dn.detail.usersList);try{for(en.s();!(Yt=en.n()).done;)(Xt={userId:Yt.value,group:dn.detail.group}).userId.toString()!==pn&&Nu(Xt)}catch(Sn){en.e(Sn)}finally{en.f()}break;case"callState":no.debug("callState change for user");var tn,ln=Lo(dn.detail.usersList);try{for(ln.s();!(tn=ln.n()).done;)(Xt={userId:tn.value,group:dn.detail.group}).userId.toString()!==pn&&Nu(Xt)}catch(Sn){ln.e(Sn)}finally{ln.f()}break;default:no.warn("default case for updateReason value")}}).onEvent("groupUnsubscribed",function(dn){var pn,Xt=mo.getContacts(dn),Ct=Lo(Xt.keys());try{for(Ct.s();!(pn=Ct.n()).done;){var It=pn.value;Xt.get(It).removeFromGroup(dn)}}catch(Ut){Ct.e(Ut)}finally{Ct.f()}})}var $t,Zt,xt;return $t=Wt,Zt=[{key:"onUpdate",value:function(Bt){this.eventEmitter.on("update",Bt)}},{key:"removeUpdateListener",value:function(Bt){this.eventEmitter.off("update",Bt)}},{key:"getContact",value:function(Bt){return Bt!=null&&this.contactList.has(Bt.toString())?this.contactList.get(Bt.toString()):null}},{key:"getOrCreateContact",value:function(Bt){var dn=null;if(Bt!=null)if(this.contactList.has(Bt.toString()))dn=this.contactList.get(Bt.toString());else try{dn=new No(Bt.toString(),{}),this.contactList.set(Bt.toString(),dn)}catch(pn){no.debug("Contact not added : "+pn)}return dn}},{key:"getContacts",value:function(Bt){if(Bt==null)return this.contactList;var dn,pn=new Map,Xt=Lo(this.contactList.keys());try{for(Xt.s();!(dn=Xt.n()).done;){var Ct=dn.value;this.contactList.get(Ct).inGroup(Bt)&&pn.set(Ct,this.contactList.get(Ct))}}catch(It){Xt.e(It)}finally{Xt.f()}return pn}},{key:"getOnlineContacts",value:function(Bt){var dn=new Map;if(Bt==null){var pn,Xt=Lo(this.contactList.keys());try{for(Xt.s();!(pn=Xt.n()).done;){var Ct=pn.value;this.contactList.get(Ct).isOnline()&&dn.set(Ct,this.contactList.get(Ct))}}catch(Yt){Xt.e(Yt)}finally{Xt.f()}}else{var It,Ut=Lo(this.contactList.keys());try{for(Ut.s();!(It=Ut.n()).done;){var Kt=It.value;this.contactList.get(Kt).inGroup(Bt)&&this.contactList.get(Kt).isOnline()&&dn.set(Kt,this.contactList.get(Kt))}}catch(Yt){Ut.e(Yt)}finally{Ut.f()}}return dn}}],xt=[{key:"get",value:function(){return mo===null&&(mo=new Wt),mo}}],Zt&&Du($t.prototype,Zt),xt&&Du($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function Hp(Wt){return function(){var $t=Wt.userId.toString();if(no.info("Contact disconnected "+$t+" from "+Wt.group),mo.contactList.has($t)){var Zt=mo.contactList.get($t);if(Zt===void 0)return void no.debug("Contact not exist with userId :",$t);Zt.removeFromGroup(Wt.group),function(xt,Bt){no.debug("updateContactListOnUserDisconnect()"),bo.leftGroup[xt]===void 0&&(bo.leftGroup[xt]=[]),bo.leftGroup[xt].push(Bt),Kl()}(Wt.group,Zt),Mo[Wt.group]!==void 0&&Mo[Wt.group][$t]!==void 0&&delete Mo[Wt.group][$t]}}}function Kl(){Object.keys(bo.leftGroup).length===0&&Object.keys(bo.joinedGroup).length===0&&bo.userDataChanged.length===0||(mo.eventEmitter.emit("update",bo),bo={leftGroup:{},joinedGroup:{},userDataChanged:[]})}function zp(Wt){no.debug("updateContactListOnUserConnection()");var $t=Wt.userId.toString(),Zt=null,xt=apiRTC.session.getConnectedUserInfo($t,"userData");no.debug("userData :",xt);try{Wt.userData=JSON.parse(xt)}catch(Bt){no.warn("userData parse error : "+Bt)}if(mo.contactList.has($t))Zt=mo.contactList.get(Wt.userId),Io.equals(Zt.userData,Wt.userData)||(Zt.userData=new Io(Wt.userData),bo.userDataChanged.push(Zt));else{try{Zt=new No($t,Wt.userData),mo.contactList.set($t,Zt)}catch(Bt){no.debug("Contact not added : "+Bt)}Zt=mo.contactList.get($t)}Zt!==void 0?(Mo[Wt.group]!==void 0&&Mo[Wt.group][$t]!==void 0&&(clearTimeout(Mo[Wt.group][$t]),delete Mo[Wt.group][$t]),Zt.inGroup(Wt.group)||(Zt.addToGroup(Wt.group),bo.joinedGroup[Wt.group]===void 0&&(bo.joinedGroup[Wt.group]=[]),bo.joinedGroup[Wt.group].push(Zt)),Kl()):no.debug("Contact not exist with userId :",$t)}function Nu(Wt){no.debug("updateContactListOnUserDataUpdate()");var $t=Wt.userId.toString(),Zt=mo.contactList.get(Wt.userId);if(Zt!==void 0){var xt=apiRTC.session.getConnectedUserInfo($t,"userData");no.debug("userData :",xt);try{Wt.userData=JSON.parse(xt)}catch(Bt){no.warn("userData parse error : "+Bt)}Io.equals(Zt.userData,Wt.userData)||(Zt.userData=new Io(Wt.userData),bo.userDataChanged.push(Zt)),Kl()}else no.debug("Contact not exist with userId :",$t)}function xs(Wt){return xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},xs(Wt)}function uo(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Lu(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Lu(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Lu(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function Gp(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Uu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Yl(Wt,$t){return Yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},Yl(Wt,$t)}function Kp(Wt,$t){if($t&&(xs($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gr(Wt)}function gr(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Ps(Wt){return Ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Ps(Wt)}var Gn=ft.Y.get("Conversation"),ir=Rn.get(),Eo=new(Go()),ro=Ro.get(),Yp=["adaptationTriggered","audioAmplitude","availableStreamsUpdated","bandwidthLimited","callStatsUpdate","compositeListChanged","contactJoined","contactJoinedWaitingRoom","contactLeft","contactLeftWaitingRoom","cpuLimited","customEvent","data","disconnectionWarning","entryAllowed","entryDenied","error","hangup","joined","left","localStreamUpdated","message","messageNotDelivered","moderatorConnected","newMediaAvailable","newWhiteboardSession","participantEjected","persistentDataUpdated","pointerLocationChanged","pointerSharingEnabled","recordingAvailable","recordingStarted","recordingStopped","remoteStreamUpdated","replayListChanged","roomModeChanged","simulcastFeedChanged","slowLink","streamAdded","streamListChanged","streamRemoved","streamingStarted","streamingStopped","transferPending","transferBegun","transferEnded","transferProgress","whiteboardRoomMemberUpdate","videoQualityChanged","waitingForModeratorAcceptance","remoteStreamIdUpdated"],ju=new Set(["CHAT","CALL","GROUP_CHAT","WEBCONF","REPORT","REPORT_PART","TICKET","EVENT","OTHER","BOT"]),qp=new Set(["audioSent","videoSent","audioReceived","videoReceived","quality"]),Jp=new Set(["CALL_ABORTED","SET_LOCAL_DESCRIPTION_FAILURE","SET_REMOTE_DESCRIPTION_FAILURE"]),ts=new WeakMap,ns=new WeakMap,Ko=new WeakMap,Po=new WeakMap,Ds=new WeakMap,Ns=new WeakMap,Ao=new WeakMap,wo=new WeakMap,Jl=new WeakMap,Xl=new WeakMap,Ls=new WeakMap,Us=new WeakMap,js=new WeakMap,$o=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&Yl(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Ps(Bt);if(dn){var Ut=Ps(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return Kp(this,Ct)});function Xt(Ct){var It,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Gp(this,Xt),It=pn.call(this,Gn),Gn.debug("Create Conversation"),Ct==null?ts.set(gr(It),Dt.g.guid().toString()):ts.set(gr(It),Ct.toString()),ns.set(gr(It),"OTHER"),It.active=!Object.prototype.hasOwnProperty.call(Ut,"active")||typeof Ut.active!="boolean"||Ut.active,It.meshModeEnabled=Ut.meshModeEnabled===!0,It.meshOnlyEnabled=Ut.meshOnlyEnabled===!0,It.moderationEnabled=Ut.moderationEnabled===!0,It.moderator=Ut.moderator===!0,It.conversationCalls=new Map,It.callIdToStreamId=new Map,It.token=null,It.sessionId=null,It.webconfId=null,It.conversationStreams=new Map,It.conversationPublishedStreams=new Map,It.groupChatStatus=et.g.CONVERSATION_STATUS_NOT_JOINED,It.status=et.g.CONVERSATION_STATUS_NOT_JOINED,It.whiteboardStarted=et.g.CONVERSATION_WHITEBOARD_NOT_STARTED,It.pointerSharingState=et.g.STATE_IDLE,It.pointerSharingAutoInvite=!1,It.pgroupWaitingRoomSubscribedTo=!1,Ds.set(gr(It),null),Ns.set(gr(It),null),Ao.set(gr(It),new Map),Po.set(gr(It),null),wo.set(gr(It),null),Ko.set(gr(It),{}),Ls.set(gr(It),new Map),js.set(gr(It),null),Us.set(gr(It),null),It.transferCallIds=[],It.uploadCap=null,It.downloadCap=null,It.reservedStreams=[];var Kt={contactCatalog:{}};for(var Yt in Kt.contactCatalog.onUpdate=function(tn){Gn.debug("onUpdate: contactList",tn);var ln=It._getTechnicalName();if(tn.joinedGroup[ln]!==void 0){var Sn,Dn=uo(tn.joinedGroup[ln]);try{for(Dn.s();!(Sn=Dn.n()).done;){var rr=Sn.value;Gn.debug(rr.getUsername()+" joined conversation "+It.getName()),zt.get(gr(It)).emit("contactJoined",rr),It.pointerSharingState===et.g.STATE_ACTIVE&&It.pointerSharingAutoInvite===!0&&ir.pointerSharingClient.inviteInRoom(ln,rr.getId())}}catch(sr){Dn.e(sr)}finally{Dn.f()}}else Gn.debug("not an event joinedGroup for conversation");if(tn.leftGroup[ln]!==void 0){var ar,hr=uo(tn.leftGroup[ln]);try{for(hr.s();!(ar=hr.n()).done;){var vr=ar.value;Gn.debug(vr.getUsername()+" left conversation "+It.getName()),zt.get(gr(It)).emit("contactLeft",vr)}}catch(sr){hr.e(sr)}finally{hr.f()}}else Gn.debug("not an event leftGroup for conversation");if(It.getRole()===et.g.CONVERSATION_ROLE_MODERATOR){var Pr,Zr=ro.getContacts(et.g.CONVERSATION_WAITING_ROOM_PREFIX+ln),na=uo(Ls.get(gr(It)).keys());try{for(na.s();!(Pr=na.n()).done;){var Vo=Pr.value;if(!Zr.has(Vo)){var pr=ro.getContact(Vo);pr!==null&&(Gn.debug(pr.getUsername()+" left waiting room "+It.getName()),zt.get(gr(It)).emit("contactLeftWaitingRoom",pr))}}}catch(sr){na.e(sr)}finally{na.f()}Zr.forEach(function(sr,Or){Ls.get(gr(It)).has(Or)||sr===null||(Gn.debug(sr.getUsername()+" joined waiting room "+It.getName()),zt.get(gr(It)).emit("contactJoinedWaitingRoom",sr),ir.sendData(Or,{event:et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER,command:"conversationModeratorConnected",roomname:ln}).catch(function(xr){var Er=Dt.g.createError(xr,"Notification not delivered",Gn);zt.get(gr(It)).emit("messageNotDelivered",{error:Er,contact:sr,event:et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER,command:"conversationModeratorConnected"})}))}),Ls.set(gr(It),Zr)}},ro.onUpdate(Kt.contactCatalog.onUpdate),zt.get(gr(It)).on("contactJoined",function(tn){It.getRole()===et.g.CONVERSATION_ROLE_MODERATOR&&ir.sendData(tn.getId(),{event:et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER,command:"conversationModeratorConnected",roomname:It._getTechnicalName()}).catch(function(ln){var Sn=Dt.g.createError(ln,"Notification not delivered",Gn);zt.get(gr(It)).emit("messageNotDelivered",{error:Sn,contact:tn,event:et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER,command:"conversationModeratorConnected"})})}),Kt.apiRTCManager={},Kt.apiRTCManager.receiveData=function(tn){var ln=tn.detail.data;if(ln!==void 0){if(ln.roomname===It._getTechnicalName()){var Sn=ro.getOrCreateContact(tn.detail.senderId);if(ln.event)switch(ln.event){case et.g.CONVERSATION_SEND_DATA_IDENTIFIER:if(It.status!==et.g.CONVERSATION_STATUS_JOINED)break;zt.get(gr(It)).emit("data",{sender:Sn,content:ln.content});break;case et.g.CONVERSATION_NEW_MEDIA_IDENTIFIER:if(It.status!==et.g.CONVERSATION_STATUS_JOINED)break;Gn.info("New media available in conversation",ln.media),zt.get(gr(It)).emit("newMediaAvailable",{sender:Sn,media:ln.media});break;case et.g.CONVERSATION_PERSISTENT_DATA_UPDATE_IDENTIFIER:if(It.status!==et.g.CONVERSATION_STATUS_JOINED)break;It.updateData();break;case et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER:zt.get(gr(It)).emit("moderatorConnected",Sn);break;case et.g.CONVERSATION_CLOSED_IDENTIFIER:ln.instanceId===It.getInstanceId()&&(Gn.info("Conference "+It.getName()+" has been closed..."),zt.get(gr(It)).emit("closed"),It.leave());break;case et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER:if(ln.access===void 0||ln.access===null){Gn.error("Conversation join answer has no access data");break}zt.get(gr(It)).emit(ln.access?"entryAllowed":"entryDenied");break;case et.g.CONTACT_STREAM_UPDATED_INFO:Gn.debug("CONTACT_STREAM_UPDATED_INFO :",tn.detail.data);var Dn={callId:tn.detail.data.callId,newStreamId:tn.detail.data.newStreamId,oldStreamId:tn.detail.data.oldStreamId};zt.get(gr(It)).emit("remoteStreamIdUpdated",Dn);break;default:zt.get(gr(It)).emit("customEvent",{event:ln.event,content:ln,sender:Sn})}else if(ln.command==="new_snapshot"){if(It.status!==et.g.CONVERSATION_STATUS_JOINED)return;Gn.info("New media available in conversation",ln.value.snapshot),zt.get(gr(It)).emit("newMediaAvailable",{sender:Sn,media:ln.value.snapshot})}else Gn.debug("Unprocessed conversation message",ln)}}else Gn.debug("Received data undefined, leaving process")},Kt.apiRTCManager.receiveGroupChatMessage=function(tn){if((It.status===et.g.CONVERSATION_STATUS_JOINED||It.groupChatStatus===et.g.CONVERSATION_STATUS_JOINED)&&tn.detail.groupChatId.toString()===It._getTechnicalName()){var ln={sender:ro.getOrCreateContact(tn.detail.senderId),sender_id:tn.detail.senderId,content:tn.detail.message,time:new Date};Dt.g.isTypeof(tn.detail,"metadata","object")&&(ln.metadata=tn.detail.metadata),zt.get(gr(It)).emit("message",ln)}},Kt.apiRTCManager.receiveRoomMessage=function(tn){if(tn.detail.roomType==="pointerSharing"&&It.pointerSharingState===et.g.STATE_ACTIVE&&tn.detail.message.type==="pointerLocation"&&tn.detail.roomId===It._getTechnicalName()){var ln={sender:ro.getOrCreateContact(tn.detail.senderId),source:tn.detail.message.source,x:tn.detail.message.x,y:tn.detail.message.y};Dt.g.isPropertyTypeof(tn.detail.message,"data","object")&&(ln.data=tn.detail.message.data),zt.get(gr(It)).emit("pointerLocationChanged",ln)}},Kt.apiRTCManager.roomInvitation=function(tn){if(Gn.info("roomInvitation event handler ",tn),tn.detail.roomId.toString()===It._getTechnicalName())if(Gn.info("roomInvitation for actual conversation",tn),tn.detail.roomType==="whiteBoard"){if(It.status===et.g.CONVERSATION_STATUS_JOINED){var ln=ro.getOrCreateContact(tn.detail.senderId);zt.get(gr(It)).emit("newWhiteboardSession",{sender:ln})}}else tn.detail.roomType==="pointerSharing"&&Ql(gr(It),!1,!0).then(function(){}).catch(function(Sn){})},Kt.apiRTCManager.onFilePending=function(tn){if(It.transferCallIds.includes(tn.detail.callId)){var ln={id:tn.detail.callId,name:tn.detail.name,rank:tn.detail.rank};zt.get(gr(It)).emit("transferPending",ln)}},Kt.apiRTCManager.onFileSending=function(tn){if(It.transferCallIds.includes(tn.detail.callId)){var ln={id:tn.detail.callId,name:tn.detail.name};zt.get(gr(It)).emit("transferBegun",ln)}},Kt.apiRTCManager.onFileProgress=function(tn){if(It.transferCallIds.includes(tn.detail.callId)){var ln={id:tn.detail.callId,name:tn.detail.name,size:tn.detail.fileSize,remBytes:tn.detail.remainingSize,percentage:tn.detail.percentage};zt.get(gr(It)).emit("transferProgress",ln)}},Kt.apiRTCManager.onFileSended=function(tn){var ln=It.transferCallIds.indexOf(tn.detail.callId);if(ln>=0){var Sn={id:tn.detail.callId,name:tn.detail.name};tn.detail.error&&(Sn.error=tn.detail.error),zt.get(gr(It)).emit("transferEnded",Sn),It.transferCallIds.splice(ln,1)}},Kt.apiRTCManager)ir.onEvent(Yt,Kt.apiRTCManager[Yt]);Jl.set(gr(It),Kt);var en={MCUAvailableStream:function(tn){var ln,Sn=uo(tn.detail.streams);try{for(Sn.s();!(ln=Sn.n()).done;){var Dn=ln.value;if(Dn.room===It._getTechnicalName()){var rr={contact:ro.getOrCreateContact(Dn.attributes.callerId),isRemote:tn.detail.isRemoteStream,hasAudio:Dn.audio,hasVideo:Dn.video,isAudioMuted:Dn.audioMuted,isVideoMuted:Dn.videoMuted,isScreensharing:Dn.attributes.callType==="screenSharing"||Dn.attributes.callType==="screenSharingWithAudio",isSIP:Dn.sip===!0,isSimulcast:Dn.simulcast===!0,streamId:Dn.id,type:"regular",callId:Dn.attributes.callId,descriptor:Dn.attributes.descriptor,context:Dn.context};It.conversationStreams.set(rr.streamId,rr);var ar={listEventType:"added"};Dt.g.assignObject(ar,rr),zt.get(gr(It)).emit("streamListChanged",ar)}}}catch(na){Sn.e(na)}finally{Sn.f()}Gn.debug("Nb stream into conversation :"+It.conversationStreams.size);var hr,vr={},Pr=uo(It.conversationStreams.keys());try{for(Pr.s();!(hr=Pr.n()).done;){var Zr=hr.value;vr[Zr]=It.conversationStreams.get(Zr)}}catch(na){Pr.e(na)}finally{Pr.f()}zt.get(gr(It)).emit("availableStreamsUpdated",vr)},MCUAvailableStreamUpdate:function(tn){var ln,Sn=uo(tn.detail.streams);try{for(Sn.s();!(ln=Sn.n()).done;){var Dn=ln.value;if(Dn.room===It._getTechnicalName()){var rr=It.conversationStreams.get(Dn.id);if(rr&&rr.type==="regular"){rr.hasAudio=Dn.audio,rr.hasVideo=Dn.video,rr.isAudioMuted=Dn.audioMuted,rr.isVideoMuted=Dn.videoMuted,rr.descriptor=Dn.attributes.descriptor;var ar={listEventType:"updated"};Dt.g.assignObject(ar,rr),zt.get(gr(It)).emit("streamListChanged",ar),rr.descriptor&&Object.prototype.hasOwnProperty.call(rr.descriptor,"priority")&&It.changeStreamPriority(rr.streamId,!0,rr.descriptor.priority)}}}}catch(na){Sn.e(na)}finally{Sn.f()}Gn.debug("Nb stream into conversation :"+It.conversationStreams.size);var hr,vr={},Pr=uo(It.conversationStreams.keys());try{for(Pr.s();!(hr=Pr.n()).done;){var Zr=hr.value;vr[Zr]=It.conversationStreams.get(Zr)}}catch(na){Pr.e(na)}finally{Pr.f()}zt.get(gr(It)).emit("availableStreamsUpdated",vr)},MCUAvailableComposite:function(tn){var ln,Sn=uo(tn.detail.streams);try{for(Sn.s();!(ln=Sn.n()).done;){var Dn=ln.value;if(Dn.room===It._getTechnicalName()){var rr={isRemote:tn.detail.isRemoteStream,hasAudio:Dn.audio,hasVideo:Dn.video,isAudioMuted:Dn.audioMuted,isVideoMuted:Dn.videoMuted,isScreensharing:Dn.attributes.callType==="screenSharing"||Dn.attributes.callType==="screenSharingWithAudio",isSIP:Dn.sip===!0,streamId:Dn.id,type:"composite",callId:Dn.attributes.callId,descriptor:Dn.attributes.descriptor,context:Dn.context};It.conversationStreams.set(rr.streamId,rr);var ar={listEventType:"added"};Dt.g.assignObject(ar,rr),zt.get(gr(It)).emit("compositeListChanged",ar)}}}catch(hr){Sn.e(hr)}finally{Sn.f()}},MCUAvailableReplay:function(tn){var ln,Sn=uo(tn.detail.streams);try{for(Sn.s();!(ln=Sn.n()).done;){var Dn=ln.value;if(Dn.room===It._getTechnicalName()){var rr={contact:ro.getOrCreateContact(Dn.attributes.callerId),isRemote:tn.detail.isRemoteStream,hasAudio:Dn.audio,hasVideo:Dn.video,isAudioMuted:Dn.audioMuted,isVideoMuted:Dn.videoMuted,isScreensharing:Dn.attributes.callType==="screenSharing"||Dn.attributes.callType==="screenSharingWithAudio",isSIP:Dn.sip===!0,streamId:Dn.id,type:"replay",callId:Dn.attributes.callId,descriptor:Dn.attributes.descriptor,context:Dn.context};It.conversationStreams.set(rr.streamId,rr);var ar={listEventType:"added"};Dt.g.assignObject(ar,rr),zt.get(gr(It)).emit("replayListChanged",ar)}}}catch(hr){Sn.e(hr)}finally{Sn.f()}},MCURemoveStream:function(tn){if(It.conversationStreams.has(tn.detail.streamId)){var ln={listEventType:"removed"};Dt.g.assignObject(ln,It.conversationStreams.get(tn.detail.streamId)),ln.type==="regular"?zt.get(gr(It)).emit("streamListChanged",ln):ln.type==="composite"&&zt.get(gr(It)).emit("compositeListChanged",ln),It.conversationStreams.delete(tn.detail.streamId),Gn.debug("Nb stream into conversation :"+It.conversationStreams.size);var Sn,Dn={},rr=uo(It.conversationStreams.keys());try{for(rr.s();!(Sn=rr.n()).done;){var ar=Sn.value;Dn[ar]=It.conversationStreams.get(ar)}}catch(hr){rr.e(hr)}finally{rr.f()}zt.get(gr(It)).emit("availableStreamsUpdated",Dn)}else Gn.debug("Not a conversation's stream")},remoteStreamAdded:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){Gn.info("remoteStreamAdded",tn.detail);var ln=ro.getOrCreateContact(tn.detail.remoteId),Sn=It.callIdToStreamId.get(tn.detail.callId),Dn=Ao.get(gr(It));Dn.has(Sn)&&zt.get(gr(It)).emit("streamRemoved",Dn.get(Sn));var rr=tn.detail.callType==="audio"?"audio":"video",ar=tn.detail.callType==="screenSharing",hr=new so(tn.detail.stream,{type:rr,contact:ln,streamId:Sn,callId:tn.detail.callId,callAudioAvailable:tn.detail.audioIsAvailable,callAudioActive:tn.detail.audioIsActive,callAudioMuted:tn.detail.audioIsMuted,callVideoAvailable:tn.detail.videoIsAvailable,callVideoActive:tn.detail.videoIsActive,callVideoMuted:tn.detail.videoIsMuted,screensharing:ar,constructor:!0});hr.publishedInConversations.set(It.getName(),tn.detail.callId),Ao.get(gr(It)).set(Sn,hr),apiRTC.session.remoteAccessInvitation!==null&&apiRTC.session.remoteAccessInvitation.screenSharingStreamId===Sn?(Gn.debug("This is screensharing stream for remoteAccess"),hr.screensharingRemoteAccessStream=!0,apiRTC.session.remoteAccessInvitation.setRemoteAccessStream(hr)):zt.get(gr(It)).emit("streamAdded",hr)}},remoteStreamRemoved:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){var ln=It.callIdToStreamId.get(tn.detail.callId),Sn=Ao.get(gr(It));Sn.has(ln)&&(zt.get(gr(It)).emit("streamRemoved",Sn.get(ln)),Sn.delete(ln))}},roomMemberUpdate:function(tn){Gn.info("roomMemberUpdate event handler ",tn);var ln,Sn=[],Dn=uo(tn.detail.contactList);try{for(Dn.s();!(ln=Dn.n()).done;){var rr=ln.value;Sn.push(ro.getOrCreateContact(rr.contactId))}}catch(ar){Dn.e(ar)}finally{Dn.f()}tn.detail.roomType==="whiteBoard"&&(Gn.info("Received whiteboard room member update"),zt.get(gr(It)).emit("whiteboardRoomMemberUpdate",{contacts:Sn,roomId:tn.detail.roomId,status:tn.detail.status}))},slowLink:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){var ln=It.callIdToStreamId.get(tn.detail.callId),Sn={callId:tn.detail.callId,streamId:ln};tn.detail.advice&&(Sn.advice=tn.detail.advice),zt.get(gr(It)).emit("slowLink",Sn)}},videoQualityChanged:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){var ln=It.callIdToStreamId.get(tn.detail.callId),Sn={callId:tn.detail.callId,streamId:ln,hint:tn.detail.hint,profileType:tn.detail.profileType};tn.detail.bitrate&&(Sn.bitrate=tn.detail.bitrate),tn.detail.width&&tn.detail.height&&(Sn.width=tn.detail.width,Sn.height=tn.detail.height),tn.detail.frameRate&&(Sn.frameRate=tn.detail.frameRate),zt.get(gr(It)).emit("videoQualityChanged",Sn)}},simulcastFeedChanged:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){var ln=It.callIdToStreamId.get(tn.detail.callId),Sn={callId:tn.detail.callId,streamId:ln,simulcast:tn.detail.simulcast};zt.get(gr(It)).emit("simulcastFeedChanged",Sn)}},localStreamUpdated:function(tn){if(tn.detail.onCall&&It.callIdToStreamId.has(tn.detail.callId)){var ln={callId:tn.detail.callId,streamId:tn.detail.userMediaStreamId,audio:tn.detail.audioIsAvailable&&tn.detail.audioIsActive,audioMuted:tn.detail.audioIsMuted,audioSilent:tn.detail.audioIsSilent,video:tn.detail.videoIsAvailable&&tn.detail.videoIsActive,videoMuted:tn.detail.videoIsMuted,videoSilent:tn.detail.videoIsSilent,cause:tn.detail.cause};zt.get(gr(It)).emit("localStreamUpdated",ln)}},remoteStreamUpdated:function(tn){var ln=tn.detail,Sn=ln.callId,Dn=ln.cause;if(It.callIdToStreamId.has(Sn)&&(Dn==="adaptation"||Dn==="userAction")){var rr={callId:Sn,streamId:It.callIdToStreamId.get(Sn),audio:tn.detail.audioIsAvailable&&tn.detail.audioIsActive,audioMuted:tn.detail.audioIsMuted,audioSilent:tn.detail.audioIsSilent,video:tn.detail.videoIsAvailable&&tn.detail.videoIsActive,videoMuted:tn.detail.videoIsMuted,videoSilent:tn.detail.videoIsSilent,cause:Dn};setTimeout(function(){zt.get(gr(It)).emit("remoteStreamUpdated",rr)})}},MCURecordingStarted:function(tn){if(tn.detail.roomName===It._getTechnicalName()){var ln=Dt.g.parseRecordingEvent("MCURecordingStarted",tn.detail);if(ln.callId==="COMPOSITE")It.recordingStatus=ln;else{var Sn=It.conversationCalls.get(ln.callId);Sn&&(Sn.recordingStatus=ln)}zt.get(gr(It)).emit("recordingStarted",ln)}},MCURecordingStopped:function(tn){if(tn.detail.roomName===It._getTechnicalName()){var ln=Dt.g.parseRecordingEvent("MCURecordingStopped",tn.detail);if(ln.callId==="COMPOSITE")delete It.recordingStatus;else{var Sn=It.conversationCalls.get(ln.callId);Sn&&delete Sn.recordingStatus}zt.get(gr(It)).emit("recordingStopped",ln)}},MCURecordedStreamsAvailable:function(tn){if(tn.detail.roomName===It._getTechnicalName()){var ln=Dt.g.parseRecordingEvent("MCURecordedStreamsAvailable",tn.detail);zt.get(gr(It)).emit("recordingAvailable",ln)}},MCUStreamingStarted:function(tn){if(tn.detail.roomName===It._getTechnicalName()){var ln=$s("MCUStreamingStarted",tn.detail),Sn=It.conversationCalls.get(ln.callId);Sn&&(Sn.streamingStatus=ln),zt.get(gr(It)).emit("streamingStarted",ln)}},MCUStreamingStopped:function(tn){if(tn.detail.roomName===It._getTechnicalName()){var ln=$s("MCUStreamingStopped",tn.detail),Sn=It.conversationCalls.get(ln.callId);Sn&&delete Sn.streamingStatus,zt.get(gr(It)).emit("streamingStopped",ln)}},onCallStatsUpdate:function(tn){if(It.callIdToStreamId.has(tn.detail.callId)){var ln=It.callIdToStreamId.get(tn.detail.callId),Sn={callId:tn.detail.callId,streamId:ln,stats:{}};tn.detail.userId&&(Sn.mesh=!0,Sn.userId=tn.detail.userId,Sn.contact=ro.getOrCreateContact(tn.detail.userId));for(var Dn=0,rr=Object.keys(tn.detail.stats);Dn=0;)if(tn[Sn].contactId===ln)return!0;return!1}(en.detail.contactList,ir.getClientId()))return Ct.asyncCallbacks&&(ir.removeEventListener("groupChatMemberUpdate",Ct.asyncCallbacks.groupChatMemberUpdate),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks),Kt()},ir.onEvent("groupChatMemberUpdate",Ct.asyncCallbacks.groupChatMemberUpdate),ir.joinGroupChat(Ct._getTechnicalName())})}).then(function(){Ct.groupChatStatus=et.g.CONVERSATION_STATUS_JOINED,ir.joinAndSubscribeToPresenceGroup(Ct._getTechnicalName()),It()}).catch(function(Kt){Ut(Dt.g.createError(et.g.ERROR_OTHER,"joinGroupChat() - cannot join group chat",Gn,{fromError:Kt}))})})}},{key:"leaveGroupChat",value:function(){var Ct=this;return new Promise(function(It,Ut){return Ct.groupChatStatus!==et.g.CONVERSATION_STATUS_JOINED?Ut(Dt.g.createError(et.g.ERROR_WRONG_STATE,"leaveGroupChat() - group chat not joined",Gn)):Ct.status!==et.g.CONVERSATION_STATUS_NOT_JOINED?Ut(Dt.g.createError(et.g.ERROR_WRONG_STATE,"leaveGroupChat() - webconf active",Gn)):void ir.leaveGroupChat(Ct._getTechnicalName()).then(function(){Ct.groupChatStatus=et.g.CONVERSATION_STATUS_NOT_JOINED,ir.leaveAndUnsubscribeToPresenceGroup(Ct._getTechnicalName()),It()}).catch(function(Kt){Ut(Dt.g.createError(et.g.ERROR_OTHER,"leaveGroupChat() - cannot leave group chat",Gn,{fromError:Kt}))})})}},{key:"isJoined",value:function(){return this.status===et.g.CONVERSATION_STATUS_JOINED}},{key:"isPublishedStream",value:function(Ct){return Ct.publishedInConversations.has(this.getName())}},{key:"publish",value:function(Ct,It){var Ut=this;return It||(It={}),new Promise(function(Kt,Yt){if(Ut.status!==et.g.CONVERSATION_STATUS_JOINED)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - conversation not joined",Gn));if(!(Ct instanceof so))return Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - No stream specified",Gn));if(Ut.isPublishedStream(Ct))return Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - Stream is already published in this conversation!",Gn));var en={};en.userMediaStreamId=Ct.userMediaStreamId,It!==null&&xs(It)==="object"&&(en.audioOnly=It.audioOnly,en.videoOnly=It.videoOnly,en.private=It.private,en.record=It.record,en.turnServerAddress=It.turnServerAddress,en.profileType=It.profileType,en.priority=It.priority,en.downgradeProfileList=It.downgradeProfileList,en.distributedBroadcastEnabled=It.distributedBroadcastEnabled),Dt.g.isPropertyTypeof(It,"mediaType","string")&&(en.mediaType=It.mediaType,en.audioOnly&&(en.mediaType="AUDIOONLY"),en.videoOnly&&(en.mediaType="VIDEOONLY")),Dt.g.isPropertyTypeof(It,"qos","object")&&(en.qos={},Dt.g.isPropertyTypeof(It.qos,"videoMinBitrate","number")&&(en.qos.videoMinBitrate=It.qos.videoMinBitrate),Dt.g.isPropertyTypeof(It.qos,"videoMinQuality","string")&&(en.qos.videoMinQuality=It.qos.videoMinQuality),Dt.g.isPropertyTypeof(It.qos,"videoStartBitrate","number")&&(en.qos.videoStartBitrate=It.qos.videoStartBitrate),Dt.g.isPropertyTypeof(It.qos,"videoStartQuality","string")&&(en.qos.videoStartQuality=It.qos.videoStartQuality),Dt.g.isPropertyTypeof(It.qos,"videoForbidInactive","boolean")&&(en.qos.videoForbidInactive=It.qos.videoForbidInactive)),Dt.g.isPropertyTypeof(It,"simulcast","object")&&!en.audioOnly&&(en.simulcast={},Dt.g.isPropertyTypeof(It.simulcast,"mode","string")&&["RID","SDP"].indexOf(It.simulcast.mode)>=0&&(en.simulcast.mode=It.simulcast.mode),Dt.g.isPropertyTypeof(It.simulcast,"maxBitrate","number")?en.simulcast.maxBitrate=It.simulcast.maxBitrate:Dt.g.isPropertyTypeof(It.simulcast,"encodings","object")&&(en.simulcast.encodings=Object.assign({},It.simulcast.encodings))),["audioLabels","videoLabels"].forEach(function(hr){Dt.g.isTypeof(It,hr,"array")&&(en[hr]=[],It[hr].forEach(function(vr){Dt.g.isTypeof(vr,"string")&&en[hr].push(vr)}))}),Dt.g.isPropertyTypeof(It,"context","object")&&(en.context=It.context);var tn=null;if(Ct.hasVideo()&&Ut.getNetworkCap({capacity:!0})&&It.profileType&&It.downgradeProfileList){for(var ln=It.downgradeProfileList.length;--ln>=0;)if(It.downgradeProfileList[ln].name===It.profileType){It.downgradeProfileList[ln].bitrate&&(tn=It.downgradeProfileList[ln].bitrate);break}}if(tn){if(!Ut.reserveResources(It.profileType,tn,Ct.userMediaStreamId,!1,It.priority,{isVideoOnly:!Ct.hasAudio(),isVideoMuted:en.audioOnly,control:!0})&&!Ut.disableLowerPriorityVideo(!1,tn,It.priority)){if(!Ct.hasAudio())return Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - not enough bandwidth",Gn));en.audioOnly=!0}Ut.reserveResources(It.profileType,tn,Ct.userMediaStreamId,!1,It.priority,{isVideoOnly:!Ct.hasAudio(),isVideoMuted:en.audioOnly})}Gn.info("callConfiguration:",en);var Sn=Ct.isScreensharing(),Dn=ir.webRTCClient.publish(Ut.sessionId,Ut.sessionId,Ut.token,en,{},{forceScreenSharingCallType:Sn});if(!Dn)return Ut.releaseResources(Ct.userMediaStreamId),Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - failed to establish call",Gn));Ut.conversationCalls.set(Dn,new Gl(Ut,Dn,Ct)),Ct.publishedInConversations.set(Ut.getName(),Dn),Ut.callIdToStreamId.set(Dn,Ct.userMediaStreamId);var rr={contact:null,isRemote:!1,hasAudio:Ct.hasAudio(),hasVideo:Ct.hasVideo(),isScreensharing:Ct.isScreensharing(),streamId:Ct.userMediaStreamId,callId:Dn};Ut.conversationPublishedStreams.set(Ct.userMediaStreamId,rr);var ar={callEstablishedHandler:function(hr){hr.detail.callId.toString()===Dn.toString()&&(ir.removeEventListener("callEstablished",ar.callEstablishedHandler),Ut.removeListener("error",ar.errorHandler),Kt(Ct))}};ir.onEvent("callEstablished",ar.callEstablishedHandler),ar.errorHandler=function(hr){hr.callId===Dn&&(ir.removeEventListener("callEstablished",ar.callEstablishedHandler),Ut.removeListener("error",ar.errorHandler),Ut.releaseResources(Ct.userMediaStreamId),Yt(Dt.g.createError(et.g.ERROR_OTHER,"publish() - "+hr.errorInfo,Gn)))},Ut.on("error",ar.errorHandler)})}},{key:"unpublish",value:function(Ct,It){if(It||(It={}),Ct instanceof so)if(this.isPublishedStream(Ct)){var Ut=Ct.publishedInConversations.get(this.getName()),Kt=!It.noTriggerAdaptation;Bu(this,Ut,{stream:Ct,triggerAdaptation:Kt}),ir.webRTCClient&&ir.webRTCClient.unpublish(Ut)}else Gn.error("unpublish() - Stream is not published to conversation");else Gn.error("unpublish() - No stream specified",Ct)}},{key:"getConversationCall",value:function(Ct){if(!Ct)return null;var It=Ct.publishedInConversations.get(this.getName());return It?this.conversationCalls.get(It):null}},{key:"replacePublishedStream",value:function(Ct,It,Ut){var Kt=this;return Gn.info("replacePublishedStream"),new Promise(function(Yt,en){var tn=Kt.getConversationCall(Ct);if(tn===null)return en(new Error("CALL_NOT_FOUND"));tn.replacePublishedStream(It,Ut).then(function(ln){console.error("replacePublishedStream OK"),Yt(ln)}).catch(function(ln){console.error("replacePublishedStream NOK"),en(ln)})})}},{key:"getCallId",value:function(Ct){return Ct.publishedInConversations.get(this.getName())}},{key:"checkAccess",value:function(Ct){var It=this;return Ct||(Ct={}),new Promise(function(Ut,Kt){if(Ct.force!==!0&&It.accessStatus)return Ut(It.accessStatus);Ct.hasOwnProperty("session")||zr.getActiveSession()===null||(Ct.session=zr.getActiveSession()),It.bind(Ct).then(function(Yt){return Ct.convId=Yt,Eo.checkConferenceAccess(It._getTechnicalName(),ir.getActiveApiKey(),Ct)}).then(function(Yt){return Yt.access!==et.g.CONVERSATION_ACCESS_GRANTED&&Yt.access!==et.g.CONVERSATION_NEED_MODERATOR_ACCEPTATION&&Gn.warn("checkAccess() - unknown access response:",Yt.access),Yt.role!==et.g.CONVERSATION_ROLE_MODERATOR&&Yt.role!==et.g.CONVERSATION_ROLE_CONTRIBUTOR&&Yt.role!==et.g.CONVERSATION_ROLE_GUEST&&Gn.warn("checkAccess() - unknown role response:",Yt.role),Yt.hasOwnProperty("webconfId")&&(It.webconfId=Yt.webconfId,delete Yt.webconfId),It.accessStatus=Dt.g.assignObject({},Yt),Ut(It.accessStatus)}).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_APIRTC_INITIALISATION_FAILED,"checkAccess() - cannot check access",Gn,{fromError:Yt}))})})}},{key:"join",value:function(){var Ct=this,It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Gn.debug("Joining "+this.getName()),new Promise(function(Ut,Kt){if(Ct.status!==et.g.CONVERSATION_STATUS_NOT_JOINED)return Kt(Dt.g.createError(et.g.ERROR_OTHER,"join() - cannot join conversation",Gn));It=Object.assign({},It);var Yt=!1;It.qualityAdaptationEnabled&&(Yt=!0,delete It.qualityAdaptationEnabled);var en=null;It.supportedVideoCodecs&&(en=It.supportedVideoCodecs,delete It.supportedVideoCodecs),Ct.checkAccess(It).then(function(tn){if(!Ct.conference){if(tn.type!=="public")return Promise.reject(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"join() - wrong conference type",Gn));if(tn.access!==et.g.CONVERSATION_ACCESS_GRANTED)return Promise.reject(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"join() - access to conference not granted",Gn))}return Qp(Ct,tn)}).then(function(tn){if(Ds.set(Ct,tn.role),Ct.status=et.g.CONVERSATION_STATUS_JOINING,Ct.conference)return It.hasOwnProperty("password")&&Us.set(Ct,It.password),Ct.friendlyName=tn.hasOwnProperty("friendlyName")?tn.friendlyName:Ct.friendlyName,js.set(Ct,tn.instanceId),Zp(Ct,wo.get(Ct),ir.getActiveApiKey())}).then(function(){var tn=Ct,ln=function rr(ar){if(Gn.debug("joinMCUSessionAnswer",tn._getTechnicalName(),ar.detail),ar.detail.roomId.toString()===tn._getTechnicalName()){if(ar.detail.result&&ar.detail.result.failed){Gn.error("Conversation "+tn.getName()+" join failed",ar.detail),this.status=et.g.CONVERSATION_STATUS_NOT_JOINED;var hr=ar.detail.result.reason?ar.detail.result.reason:"join failed";return Kt(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"join() - "+hr,Gn))}Gn.info("Conversation "+tn.getName()+" joined",ar.detail),ir.removeEventListener("joinMCUSessionAnswer",rr),tn.status=et.g.CONVERSATION_STATUS_JOINED,tn.token=ar.detail.token,tn.sessionId=ar.detail.sessionId,tn.mode=ar.detail.mode,tn.conversationStreams=new Map;var vr=Xl.get(tn);ir.onEvent("MCUAvailableStream",vr.MCUAvailableStream).onEvent("MCUAvailableStreamUpdate",vr.MCUAvailableStreamUpdate).onEvent("MCURemoveStream",vr.MCURemoveStream).onEvent("MCUAvailableComposite",vr.MCUAvailableComposite).onEvent("MCUAvailableReplay",vr.MCUAvailableReplay).onEvent("MCUParticipantEjected",vr.MCUParticipantEjected).onEvent("remoteStreamAdded",vr.remoteStreamAdded).onEvent("remoteStreamRemoved",vr.remoteStreamRemoved).onEvent("roomMemberUpdate",vr.roomMemberUpdate).onEvent("slowLink",vr.slowLink).onEvent("localStreamUpdated",vr.localStreamUpdated).onEvent("remoteStreamUpdated",vr.remoteStreamUpdated).onEvent("simulcastFeedChanged",vr.simulcastFeedChanged).onEvent("MCURecordingStarted",vr.MCURecordingStarted).onEvent("MCURecordingStopped",vr.MCURecordingStopped).onEvent("MCURecordedStreamsAvailable",vr.MCURecordedStreamsAvailable).onEvent("MCUStreamingStarted",vr.MCUStreamingStarted).onEvent("MCUStreamingStopped",vr.MCUStreamingStopped).onEvent("MCURoomModeChanged",vr.MCURoomModeChanged).onEvent("onCallStatsUpdate",vr.onCallStatsUpdate).onEvent("hangup",vr.hangup).onEvent("callRestarting",vr.callRestarting).onEvent("audioAmplitude",vr.audioAmplitude).onEvent("videoQualityChanged",vr.videoQualityChanged).onEvent("cpuLimited",vr.cpuLimited).onEvent("bandwidthLimited",vr.bandwidthLimited),tn.conference&&tn.updateData(),tn.getRole()===et.g.CONVERSATION_ROLE_MODERATOR&&(ir.apiRTCSession.subscribePresenceGroup([et.g.CONVERSATION_WAITING_ROOM_PREFIX+tn._getTechnicalName()]),tn.pgroupWaitingRoomSubscribedTo=!0),tn.groupChatStatus!==et.g.CONVERSATION_STATUS_NOT_JOINED&&(tn.groupChatStatus=et.g.CONVERSATION_STATUS_NOT_JOINED),zt.get(tn).emit("joined");var Pr={};ar.detail.mode==="mesh"&&(Pr.mode="mesh",ar.detail.meshOnly===!0&&(Pr.meshOnly=!0)),Ut(Pr)}};ir.onEvent("joinMCUSessionAnswer",ln);var Sn={};Sn.convId=Ct.getCloudConversationId(),Ct.meshModeEnabled&&(Sn.meshModeEnabled=Ct.meshModeEnabled),Ct.meshOnlyEnabled&&(Sn.meshOnlyEnabled=Ct.meshOnlyEnabled),Ct.conference||(Ct.moderationEnabled&&(Sn.moderationEnabled=!0),Ct.getRole()===et.g.CONVERSATION_ROLE_MODERATOR&&(Sn.moderator=!0)),Yt&&(Sn.qualityAdaptationEnabled=!0),en&&(Sn.supportedVideoCodecs=en);var Dn=ir.webRTCClient.joinMCUSession(Ct._getTechnicalName(),Sn);if(Dn instanceof Error)return ir.removeEventListener("joinMCUSessionAnswer",ln),tn.status=et.g.CONVERSATION_STATUS_NOT_JOINED,Kt(Dt.g.createError(et.g.ERROR_OTHER,"join() - cannot join conversation :"+Dn.message,Gn))}).catch(function(tn){return Ct.status=et.g.CONVERSATION_STATUS_NOT_JOINED,Kt(Dt.g.createError(et.g.ERROR_OTHER,"join() - cannot join conversation",Gn,{fromError:tn}))})})}},{key:"cancelJoin",value:function(){return this.cancelJoin0!==null&&typeof this.cancelJoin0=="function"&&this.cancelJoin0()}},{key:"eject",value:function(Ct,It){var Ut=this;return new Promise(function(Kt,Yt){if(Ut.status!==et.g.CONVERSATION_STATUS_JOINED)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"eject() - conference not joined",Gn));if(Ut.getRole()!==et.g.CONVERSATION_ROLE_MODERATOR)return Yt(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"eject() - only moderator can eject a contact",Gn));var en={};en.timeoutId=setTimeout(function(){return en&&(ir.removeEventListener("MCUParticipantEjected",en.ejected),en=!1),Yt(Dt.g.createError(et.g.ERROR_OTHER,"eject() - timeout",Gn))},et.g.CONVERSATION_PARTICIPANT_EJECTION_DELAY),en.ejected=function(tn){if(tn.detail.roomId===Ut._getTechnicalName()&&tn.detail.clientId===Ct.getId())return en&&(clearTimeout(en.timeoutId),ir.removeEventListener("MCUParticipantEjected",en.ejected),en=!1),Kt()},ir.onEvent("MCUParticipantEjected",en.ejected),ir.webRTCClient.ejectParticipantFromMCUSession(Ct.getId(),It)})}},{key:"allowEntry",value:function(Ct,It){var Ut=this;return It||(It={}),new Promise(function(Kt,Yt){if(Ut.status!==et.g.CONVERSATION_STATUS_JOINED)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"allowEntry() - conference not joined",Gn));if(!(Ct instanceof No))return Yt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"allowEntry() - parameter is not an instance of apiRTC.Contact",Gn));if(Ut.getRole()!==et.g.CONVERSATION_ROLE_MODERATOR)return Yt(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"allowEntry() - only moderator can allow entry to a contact",Gn));var en={roomname:Ut._getTechnicalName(),event:et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER,access:!0,command:"access",value:{access:!0}};if(It.hasOwnProperty("invitationId")&&(en.invitationId=It.invitationId),It.hasOwnProperty("answer")&&(en.answer=It.answer),ir.sendData(Ct.getId(),en).catch(function(ln){var Sn=Dt.g.createError(ln,"Notification not delivered",Gn);zt.get(Ut).emit("messageNotDelivered",{error:Sn,contact:Ct,event:et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER,command:"access"})}),It.ackEnabled===!0){var tn=setInterval(function(){en.command="access-new",ir.sendData(Ct.getId(),en).catch(function(ln){var Sn=Dt.g.createError(ln,"Notification not delivered",Gn);zt.get(Ut).emit("messageNotDelivered",{error:Sn,contact:Ct,event:et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER,command:"access"})})},et.g.CONVERSATION_JOIN_REQUEST_INTERVAL);ir.onEvent("receiveData",function ln(Sn){var Dn=ro.getOrCreateContact(Sn.detail.senderId);Sn.detail.hasOwnProperty("data")&&Sn.detail.data.command==="access-ack"&&Sn.detail.data.roomname===Ut._getTechnicalName()&&Dn.getId()===Ct.getId()&&(clearInterval(tn),ir.removeEventListener("receiveData",ln))})}return Kt()})}},{key:"denyEntry",value:function(Ct,It){var Ut=this;return It||(It={}),new Promise(function(Kt,Yt){if(Ut.status!==et.g.CONVERSATION_STATUS_JOINED)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"denyEntry() - conference not joined",Gn));if(!(Ct instanceof No))return Yt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"denyEntry() - parameter is not an instance of apiRTC.Contact",Gn));if(Ut.getRole()!==et.g.CONVERSATION_ROLE_MODERATOR)return Yt(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"denyEntry() - only moderator can deny entry to a contact",Gn));var en={roomname:Ut._getTechnicalName(),event:et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER,access:!1,command:"access",value:{access:!1}};return It.hasOwnProperty("invitationId")&&(en.invitationId=It.invitationId),It.hasOwnProperty("answer")&&(en.answer=It.answer),It.hasOwnProperty("reason")&&(en.reason=It.reason),ir.sendData(Ct.getId(),en).catch(function(tn){var ln=Dt.g.createError(tn,"Notification not delivered",Gn);zt.get(Ut).emit("messageNotDelivered",{error:ln,contact:Ct,event:et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER,command:"access"})}),Kt()})}},{key:"sendJoinRequest",value:function(){var Ct=this;if(this.status===et.g.CONVERSATION_STATUS_WAITING){if(!this.joinRequestIntervalId){var It=Xp(this);It&&(ir.sendData(It,{roomname:this._getTechnicalName(),event:et.g.CONVERSATION_JOIN_REQUEST_IDENTIFIER,invitationId:this._getTechnicalName(),sendTime:Date.now(),command:"userWaiting",value:{username:$u()}}).catch(function(Ut){var Kt=Dt.g.createError(Ut,"Notification not delivered",Gn);zt.get(Ct).emit("messageNotDelivered",{error:Kt,contact:Ct.getModerator(),event:et.g.CONVERSATION_JOIN_REQUEST_IDENTIFIER,command:"userWaiting"})}),this.joinRequestIntervalId=setInterval(function(){ir.sendData(It,{roomname:Ct._getTechnicalName(),event:et.g.CONVERSATION_JOIN_REQUEST_IDENTIFIER,invitationId:Ct._getTechnicalName(),sendTime:Date.now(),command:"userWaiting-new",value:{username:$u()}}).catch(function(Ut){var Kt=Dt.g.createError(Ut,"Notification not delivered",Gn);zt.get(Ct).emit("messageNotDelivered",{error:Kt,contact:Ct.getModerator(),event:et.g.CONVERSATION_JOIN_REQUEST_IDENTIFIER,command:"userWaiting-new"})})},et.g.CONVERSATION_JOIN_REQUEST_INTERVAL))}}else Gn.error("sendJoinRequest() - Not in conversation's waiting room, cannot send join request")}},{key:"leave",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.status!==et.g.CONVERSATION_STATUS_JOINED)return Ut(Dt.g.createError(et.g.ERROR_WRONG_STATE,"leave() - webconf not joined",Gn));for(var Kt=Xl.get(Ct),Yt=0,en=Object.keys(Kt);Yt=0?Kt.simulcast.streamQuality=It.simulcast.streamQuality:Kt.simulcast.streamQuality="default"),It.simulcast.streamFrameRate&&(ln.indexOf(It.simulcast.streamFrameRate)>=0?Kt.simulcast.streamFrameRate=It.simulcast.streamFrameRate:Kt.simulcast.streamFrameRate="default")}return new Promise(function(Sn,Dn){var rr="VIDEO";if(tn.hasVideo&&Ut.getNetworkCap({capacity:!0})&&Dt.g.isPropertyTypeof(tn,"descriptor","object")){var ar=tn.descriptor;if(!Ut.reserveResources(ar.profileType,ar.bitrate,Yt,!0,ar.priority,{isVideoOnly:!tn.hasAudio,isVideoMuted:It.audioOnly,control:!0})&&!Ut.disableLowerPriorityVideo(!0,ar.bitrate,ar.priority)){if(!tn.hasAudio)return Dn(Dt.g.createError(et.g.ERROR_OTHER,"subscribeToMedia() - not enough bandwidth",Gn));It.audioOnly=!0}Ut.reserveResources(ar.profileType,ar.bitrate,Yt,!0,ar.priority,{isVideoOnly:!tn.hasAudio,isVideoMuted:It.audioOnly})}It.audioOnly===!0?rr="AUDIOONLY":It.videoOnly===!0&&(rr="VIDEOONLY");var hr=ir.webRTCClient.subscribe([en],rr,{},Kt,It)[0];if(!hr)return Ut.releaseResources(Yt),Dn(Dt.g.createError(et.g.ERROR_OTHER,"subscribeToMedia() - stream not available",Gn));Ut.callIdToStreamId.set(hr,Yt),Gn.debug("Subscribed to stream "+Ct+" through call "+hr);var vr={streamAddedHandler:function(Pr){Pr.streamId===Yt&&(Ut.removeListener("streamAdded",vr.streamAddedHandler),Ut.removeListener("error",vr.errorHandler),Sn(Pr))}};Ut.on("streamAdded",vr.streamAddedHandler),vr.errorHandler=function(Pr){Pr.callId===hr&&(Ut.removeListener("streamAdded",vr.streamAddedHandler),Ut.removeListener("error",vr.errorHandler),Ut.releaseResources(Yt),Dn(Dt.g.createError(et.g.ERROR_OTHER,"subscribeToMedia() - "+Pr.errorInfo,Gn)))},Ut.on("error",vr.errorHandler)})}},{key:"updateSubscribedStream",value:function(Ct,It){It||(It={});var Ut=Number(Ct);if(!Ao.get(this).has(Ut))return Gn.error("updateSubscribedStream() - Conversation stream "+Ct+" does not exist or was not subscribed to"),Promise.reject("wrong streamId");var Kt=Ao.get(this).get(Ut);if(Dt.g.isTypeof(It.simulcast,"object"))return ir.webRTCClient.webRTCClient.updateSimulcastFeedOnCall(Kt.callId,It.simulcast);var Yt="VIDEO";return It.audioOnly===!0?Yt="AUDIOONLY":It.videoOnly===!0&&(Yt="VIDEOONLY"),ir.webRTCClient.webRTCClient.updateMediaTypeOnCall(Kt.callId,Yt)}},{key:"unsubscribeToStream",value:function(Ct,It){It||(It={});var Ut=Number(Ct);ir.webRTCClient!==null&&ir.webRTCClient.unsubscribe(Ut);var Kt=!It.noTriggerAdaptation;this.releaseResources(Ct,{isRemote:!0,triggerAdaptation:Kt})}},{key:"subscribeToMedia",value:function(Ct,It){return this.subscribeToStream(Ct,It)}},{key:"unsubscribeToMedia",value:function(Ct){this.unsubscribeToStream(Ct)}},{key:"startRecording",value:function(Ct){var It=this;return Ct||(Ct={}),new Promise(function(Ut,Kt){if(It.status!==et.g.CONVERSATION_STATUS_JOINED)return Kt(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - conversation not joined",Gn));if(It.asyncCallbacks)return Kt(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - busy",Gn));It.asyncCallbacks={},It.asyncCallbacks.timeoutId=setTimeout(function(){return It.asyncCallbacks&&(ir.removeEventListener("error",It.asyncCallbacks.error),ir.removeEventListener("MCURecordingStarted",It.asyncCallbacks.recordingStarted),delete It.asyncCallbacks),Kt(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - timeout",Gn))},et.g.CONVERSATION_RECORDING_STARTED_DELAY),It.asyncCallbacks.error=function(ln){if(String(ln.detail.convId)===It.getCloudConversationId()&&ln.detail.callId==="COMPOSITE"&&ln.detail.errorCode.indexOf("START_RECORD")>=0)return It.asyncCallbacks&&(ir.removeEventListener("error",It.asyncCallbacks.error),ir.removeEventListener("MCURecordingStarted",It.asyncCallbacks.recordingStarted),clearTimeout(It.asyncCallbacks.timeoutId),delete It.asyncCallbacks),Kt(Dt.g.createError(et.g.ERROR_OTHER,"startRecording() - "+ln.detail.errorInfo,Gn))},It.asyncCallbacks.recordingStarted=function(ln){if(String(ln.detail.convId)===It.getCloudConversationId()&&ln.detail.callId==="COMPOSITE"){It.asyncCallbacks&&(ir.removeEventListener("error",It.asyncCallbacks.error),ir.removeEventListener("MCURecordingStarted",It.asyncCallbacks.recordingStarted),clearTimeout(It.asyncCallbacks.timeoutId),delete It.asyncCallbacks);var Sn=Dt.g.parseRecordingEvent("MCURecordingStarted",ln.detail);return Ut(Sn)}},ir.onEvent("error",It.asyncCallbacks.error),ir.onEvent("MCURecordingStarted",It.asyncCallbacks.recordingStarted);var Yt="AUDIO-VIDEO";Ct.audioOnly===!0?Yt="AUDIO-ONLY":Ct.videoOnly===!0&&(Yt="VIDEO-ONLY");var en="composite";Dt.g.isPropertyTypeof(Ct,"customIdInFilename","string")&&(en=Ct.customIdInFilename);var tn={};Dt.g.isPropertyTypeof(Ct,"data","object")&&(tn=Dt.g.assignObject({},Ct.data)),["complete","efficient","audioOnly"].indexOf(Ct.mode)>=0?tn.mode=Ct.mode:tn.mode="complete",tn.labelEnabled=Ct.labelEnabled===!0,tn.labelEnabled===!0&&(tn.labels=[],Dt.g.isTypeof(Ct.labels,"array")&&Ct.labels.forEach(function(ln){Dt.g.isTypeof(ln,"string")&&tn.labels.push(ln)})),Dt.g.isTypeof(Ct,"ttl","number")&&Ct.ttl>0&&(tn.ttl=Ct.ttl),ir.webRTCClient.startCompositeRecording(Yt,en,It.getCloudConversationId(),tn)})}},{key:"stopRecording",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.asyncCallbacks)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopRecording() - busy",Gn));Ct.asyncCallbacks={},Ct.asyncCallbacks.timeoutId=setTimeout(function(){return Ct.asyncCallbacks&&(ir.removeEventListener("error",Ct.asyncCallbacks.error),ir.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),delete Ct.asyncCallbacks),It(Ct.recordingStatus)},et.g.CONVERSATION_RECORDING_STOPPED_DELAY),Ct.asyncCallbacks.error=function(Kt){if(String(Kt.detail.convId)===Ct.getCloudConversationId()&&Kt.detail.callId==="COMPOSITE"&&Kt.detail.errorCode.indexOf("STOP_RECORD")>=0)return Ct.asyncCallbacks&&(ir.removeEventListener("error",Ct.asyncCallbacks.error),ir.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks),Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopRecording() - "+Kt.detail.errorInfo,Gn))},Ct.asyncCallbacks.recordingStopped=function(Kt){if(String(Kt.detail.convId)===Ct.getCloudConversationId()&&Kt.detail.callId==="COMPOSITE"){Ct.asyncCallbacks&&(ir.removeEventListener("error",Ct.asyncCallbacks.error),ir.removeEventListener("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),clearTimeout(Ct.asyncCallbacks.timeoutId),delete Ct.asyncCallbacks);var Yt=Dt.g.parseRecordingEvent("MCURecordingStopped",Kt.detail);return It(Yt)}},ir.onEvent("error",Ct.asyncCallbacks.error),ir.onEvent("MCURecordingStopped",Ct.asyncCallbacks.recordingStopped),ir.webRTCClient.stopCompositeRecording()})}},{key:"getContacts",value:function(){Gn.debug("getContacts()");var Ct={};if(this.isBound()){var It,Ut=Ro.get().getContacts(this._getTechnicalName()),Kt=uo(Ut.keys());try{for(Kt.s();!(It=Kt.n()).done;){var Yt=It.value;Ct[Yt]=Ut.get(Yt)}}catch(en){Kt.e(en)}finally{Kt.f()}}else Gn.warn("getContacts() - Cannot get contacts as conversation is not joined");return Ct}},{key:"getContactsArray",value:function(){Gn.debug("getContactsArray()");var Ct=[];if(this.isBound()){var It,Ut=Ro.get().getContacts(this._getTechnicalName()),Kt=uo(Ut.keys());try{for(Kt.s();!(It=Kt.n()).done;){var Yt=It.value;Ct.push(Ut.get(Yt))}}catch(en){Kt.e(en)}finally{Kt.f()}}else Gn.warn("getContacts() - Cannot get contacts as conversation is not joined");return Ct}},{key:"getContactsNumber",value:function(){Gn.debug("getContactsNumber()");var Ct=0;return this.isBound()?Ct=Ro.get().getContacts(this._getTechnicalName()).size:Gn.warn("getContactsNumber() - Cannot get contacts as conversation is not joined"),Ct}},{key:"getData",value:function(){return Gn.debug("getData()"),this.isBound()||Gn.warn("getData() - Cannot get most recent data as conversation is not joined, you may want to call Conversation.updateData() instead"),Ko.get(this)}},{key:"setData",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){It.bind().then(function(){return Eo.setConversationData(Po.get(It),JSON.stringify(Ct),ir.getActiveApiKey(),{token:wo.get(It).token})}).then(function(){Ko.set(It,Ct),ir.dataClient.sendDataToGroup(It._getTechnicalName(),{event:et.g.CONVERSATION_PERSISTENT_DATA_UPDATE_IDENTIFIER,roomname:It._getTechnicalName()}),Ut()}).catch(function(){Kt(Dt.g.createError(et.g.ERROR_OTHER,"setData() - cannot set conversation data",Gn))})})}},{key:"updateData",value:function(){var Ct=this;return new Promise(function(It,Ut){(Ct.isBound()?Fu(Ct):Ct.bind()).then(function(){It(),zt.get(Ct).emit("persistentDataUpdated",Ko.get(Ct))}).catch(function(Kt){Ut(Dt.g.createError(et.g.ERROR_OTHER,"updateData() - cannot update conversation data",Gn,{fromError:Kt}))})})}},{key:"getAvailableMediaList",value:function(){return Gn.warn("Function deprecated, please use Conversation.getAvailableStreamList() instead"),this.getAvailableStreamList()}},{key:"getAvailableStreamList",value:function(){var Ct,It=[],Ut=uo(this.conversationStreams.keys());try{for(Ut.s();!(Ct=Ut.n()).done;){var Kt=Ct.value;It.push(this.conversationStreams.get(Kt))}}catch(Yt){Ut.e(Yt)}finally{Ut.f()}return It}},{key:"getStreamInfo",value:function(Ct){return this.conversationStreams.get(Ct)}},{key:"getSubscribedStream",value:function(Ct){return Ao.get(this).get(Number(Ct))}},{key:"linkWhiteboardClientToConversation",value:function(){Gn.warn("DEPRECATED : linkWhiteboardClientToConversation : no more needed")}},{key:"startNewWhiteboardSession",value:function(Ct,It){var Ut=this;return Gn.debug("startNewWhiteboardSession()"),new Promise(function(Kt,Yt){Ut.bind().then(function(){if(Ut.asyncCallbacks)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"startNewWhiteboardSession() - busy",Gn));if(Ut.whiteboardStarted!==et.g.CONVERSATION_WHITEBOARD_NOT_STARTED)return Kt();ir.whiteBoardClient.start(),Ut.asyncCallbacks={},Ut.asyncCallbacks.ackHandler=function(tn){var ln=tn.detail;ln.roomId===Ut._getTechnicalName()&&ln.roomType==="whiteBoard"&&(ln.eventType==="roomCreation"&&ln.status==="roomCreated"||ln.eventType==="roomJoined"&&ln.status==="roomJoined")&&(Ut.asyncCallbacks&&(ir.removeEventListener("roomCreation",Ut.asyncCallbacks.ackHandler),ir.removeEventListener("roomJoined",Ut.asyncCallbacks.ackHandler),clearTimeout(Ut.asyncCallbacks.timeoutId),delete Ut.asyncCallbacks),ir.whiteBoardClient.setCanvas(Ct),It!=null&&ir.whiteBoardClient.setUserCursorColor(It),ir.whiteBoardClient.deleteHistory(),Ut.whiteboardStarted=et.g.CONVERSATION_WHITEBOARD_STARTED,Kt())},ir.onEvent("roomCreation",Ut.asyncCallbacks.ackHandler),ir.onEvent("roomJoined",Ut.asyncCallbacks.ackHandler),Ut.asyncCallbacks.timeoutId=setTimeout(function(){return Ut.asyncCallbacks&&(ir.removeEventListener("roomCreation",Ut.asyncCallbacks.ackHandler),ir.removeEventListener("roomJoined",Ut.asyncCallbacks.ackHandler),delete Ut.asyncCallbacks),Yt(Dt.g.createError(et.g.ERROR_OTHER,"startNewWhiteboardSession() - timeout",Gn))},et.g.CONVERSATION_WHITEBOARD_START_DELAY);var en=Ut.getCloudConversationId();ir.whiteBoardClient.joinRoom(Ut._getTechnicalName(),{convId:en,webconf:!0})}).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"startNewWhiteboardSession() - cannot start whiteboard session",Gn,{fromError:en}))})})}},{key:"stopNewWhiteboardSession",value:function(){var Ct=this;return Gn.debug("stopNewWhiteboardSession()"),new Promise(function(It,Ut){Ct.bind().then(function(){return Ct.whiteboardStarted!==et.g.CONVERSATION_WHITEBOARD_STARTED?(Gn.error("Conversation is not joined!"),Ut(Dt.g.createError(et.g.ERROR_WRONG_STATE,"stopWhiteBoard() - Conversation not joined",Gn))):ir.whiteBoardClient.roomId!==Ct._getTechnicalName()?(Gn.error("Whiteboard session is not joined for this conversation!"),Ut(Dt.g.createError(et.g.ERROR_WRONG_STATE,"stopWhiteBoard() - whiteboard not joined",Gn))):(ir.whiteBoardClient.leaveRoom(),ir.whiteBoardClient.stop(),Ct.whiteboardStarted=et.g.CONVERSATION_WHITEBOARD_NOT_STARTED,void It())}).catch(function(Kt){Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopNewWhiteboardSession() - cannot stop whiteboard session",Gn,{fromError:Kt}))})})}},{key:"enablePointerSharing",value:function(Ct){return Ql(this,!0,Ct)}},{key:"sendPointerLocation",value:function(Ct,It,Ut,Kt){ir.pointerSharingClient.sendPointerLocation(this._getTechnicalName(),Ct,It,Ut,Kt)}},{key:"sendData",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){It.bind().then(function(){ir.dataClient.sendDataToGroup(It._getTechnicalName(),{event:et.g.CONVERSATION_SEND_DATA_IDENTIFIER,content:Ct,roomname:It._getTechnicalName()}),Ut()}).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_OTHER,"sendData() - cannot send data",Gn))})})}},{key:"sendRawData",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){It.bind().then(function(){ir.dataClient.sendDataToGroup(It._getTechnicalName(),Ct),Ut()}).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_OTHER,"sendRawData() - cannot send data",Gn))})})}},{key:"sendCustomEvent",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){It.bind().then(function(){var en=Ut;en.event=Ct,en.roomname=It._getTechnicalName(),ir.dataClient.sendDataToGroup(It._getTechnicalName(),en),Kt()}).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"sendCustomEvent() - cannot send data",Gn))})})}},{key:"sendMessage",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Kt=function(Yt){return new Promise(function(en,tn){var ln=wo.get(It);ln!==null?Eo.saveGroupChatMessage(It,ln,ir.getActiveApiKey(),Ct,Yt,Ut).then(function(){en(Yt)}).catch(tn):en(Yt)})};return new Promise(function(Yt,en){if(It.groupChatStatus!==et.g.CONVERSATION_STATUS_JOINED&&It.status!==et.g.CONVERSATION_STATUS_JOINED)return en(Dt.g.createError(et.g.ERROR_WRONG_STATE,"sendMessage() - group chat not joined",Gn));if(Ct===null||typeof Ct!="string")return en(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"sendMessage() - wrong type of message",Gn));if(Ct==="")return en(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"sendMessage() - message parameter is empty",Gn));var tn={};Dt.g.isTypeof(Ut,"metadata","object")&&(tn.metadata=Ut.metadata),ir.sendMessageToGroupChat(It._getTechnicalName(),Ct,tn).then(function(ln){Kt(ln).then(function(){Yt(ln)}).catch(function(Sn){en(Dt.g.createError(et.g.ERROR_OTHER,"sendMessage() - error on save",Gn,{fromError:Sn}))})}).catch(function(ln){en(Dt.g.createError(et.g.ERROR_OTHER,"sendMessage() - cannot send message",Gn,{fromError:ln}))})})}},{key:"pushMedia",value:function(Ct,It){var Ut=this;return It||(It={}),new Promise(function(Kt,Yt){Ut.bind().then(function(){return It.hasOwnProperty("token")||(It.token=wo.get(Ut).token),Eo.pushConversationMedia(Po.get(Ut),Ct,ir.getActiveApiKey(),It)}).then(function(en){ir.dataClient.sendDataToGroup(Ut._getTechnicalName(),{event:et.g.CONVERSATION_NEW_MEDIA_IDENTIFIER,roomname:Ut._getTechnicalName(),media:{url:en.url,id:en.id},command:"new_snapshot",value:{snapshot:en.url}}),Kt({url:en.url,id:en.id})}).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"pushMedia() - cannot push media",Gn,{fromError:en}))})})}},{key:"pushData",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ut=Dt.g.assignObject({},Ut),new Promise(function(Kt,Yt){if(ir.webRTCClient.webRTCClient.dataChannelCapable!==!0||Ut.forceHTTP===!0){if(!Ct.file)return Yt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"pushData() - missing file",Gn));var en={};if(Dt.g.isTypeof(Ct,"metadata","object"))try{en.metadata=JSON.stringify(Ct.metadata)}catch(tn){Gn.error("JSON.stringify",tn)}en.asFile=!0,Dt.g.isTypeof(Ct,"filename","string")?en.filename=Ct.filename:en.filename=Ct.file.name,Ct.overwrite===!0&&(en.overwrite=!0),Dt.g.isTypeof(Ct,"ttl","number")&&Ct.ttl>0&&(en.ttl=Ct.ttl),It.pushMedia(Ct.file,en).then(Kt).catch(Yt)}else It.bind().then(function(){var tn=It._getTechnicalName(),ln={};Ut.hasOwnProperty("turnServerAddress")&&(ln.turnServerAddress=Ut.turnServerAddress,delete Ut.turnServerAddress);var Sn=ir.webRTCClient.webRTCClient.pushData(It.getCloudConversationId(),Ct,ln,{success:function(Dn){if(Dn.state!=="complete")return Yt(Dt.g.createError(et.g.ERROR_OTHER,"pushData() - cannot push data",Gn));ir.dataClient.sendDataToGroup(tn,{event:et.g.CONVERSATION_NEW_MEDIA_IDENTIFIER,roomname:tn,media:{url:Dn.mediaURL,id:Dn.mediaId},command:"new_snapshot",value:{snapshot:Dn.mediaURL}}),Kt({url:Dn.mediaURL,id:Dn.mediaId})},failure:function(Dn,rr){if(Dn==="iceFailed"){var ar=Dt.g.assignObject({},Ut);return ar.forceHTTP=!0,void It.pushData(Ct,ar).then(Kt).catch(Yt)}if(Dn==="timeout"){if(rr){var hr=It.transferCallIds.indexOf(rr);hr>=0&&It.transferCallIds.splice(hr,1)}return Yt(Dt.g.createError(et.g.ERROR_TIMED_OUT,"pushData() - push data timed out",Gn))}return Yt(Dn==="canceled"?Dt.g.createError(et.g.ERROR_OPERATION_CANCELED,"pushData() - push data canceled",Gn):Dt.g.createError(et.g.ERROR_OTHER,"pushData() - cannot push data",Gn,{fromError:Dn}))}});if(!Sn)return Yt(Dt.g.createError(et.g.ERROR_OTHER,"pushData() - cannot push data",Gn));It.transferCallIds.push(Sn)}).catch(function(tn){return Yt(Dt.g.createError(et.g.ERROR_OTHER,"pushData() - cannot push data",Gn,{fromError:tn}))})})}},{key:"cancelPushData",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){if(!It.transferCallIds.includes(Ct))return Kt(Dt.g.createError(et.g.ERROR_OTHER,"cancelPushData() - no such push data",Gn));var Yt=ir.webRTCClient.webRTCClient.cancelPushData(Ct);if(Yt)return Kt(Dt.g.createError(et.g.ERROR_OTHER,"cancelPushData() - "+Yt,Gn));Ut()})}},{key:"fetchMediaList",value:function(Ct,It){var Ut=this;return It||(It={}),new Promise(function(Kt,Yt){Ut.bind().then(function(){return Object.prototype.hasOwnProperty.call(It,"token")||(Dt.g.isTypeof(Ct,"object")&&Ct instanceof zr?It.token=Ct.getToken():It.token=wo.get(Ut).token),Eo.getConversationMediaList(Po.get(Ut),ir.getActiveApiKey(),It)}).then(Kt).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"fetchMediaList() - cannot fetch media list",Gn,{fromError:en}))})})}},{key:"getWaitingRoomContacts",value:function(){Gn.debug("getWaitingRoomContacts()");var Ct={};if(this.status!==et.g.CONVERSATION_STATUS_JOINED)Gn.error("getWaitingRoomContacts() - Conversation is not joined, cannot get waiting room contacts");else if(this.getRole()!==et.g.CONVERSATION_ROLE_MODERATOR)Gn.error("getWaitingRoomContacts() - Role is not moderator, cannot get waiting room contacts");else{var It,Ut=Ro.get().getContacts(et.g.CONVERSATION_WAITING_ROOM_PREFIX+this._getTechnicalName()),Kt=uo(Ut.keys());try{for(Kt.s();!(It=Kt.n()).done;){var Yt=It.value;Ct[Yt]=Ut.get(Yt)}}catch(en){Kt.e(en)}finally{Kt.f()}}return Ct}},{key:"fetchMessageHistory",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Kt,Yt){It.bind().then(function(){return Object.prototype.hasOwnProperty.call(Ut,"token")?Eo.loadGroupChatMessages(It,null,Ut.token):(Dt.g.isTypeof(Ct,"object")&&Ct instanceof zr||(Ct=wo.get(It)),Eo.loadGroupChatMessages(It,Ct))}).then(function(en){var tn=en.map(function(ln){var Sn={content:ln.content,timestamp:1e3*ln.created_at,date:new Date(1e3*ln.created_at),sender_id:ln.user_id,display_name:ln.display_name};return ln.user_id.toString()!==Ct.getId()&&(Sn.sender=Ct.getOrCreateContact(ln.user_id)),Sn});Kt(tn)}).catch(function(en){Yt(Dt.g.createError(et.g.ERROR_OTHER,"fetchMessageHistory() - cannot fetch message history",Gn))})})}},{key:"sendInvitation",value:function(Ct,It){var Ut=this;if(It||(It={}),Ct instanceof No){Gn.info("Invite "+Ct.getId()+" to "+this._getTechnicalName()),Ct.isOnline()||Gn.warn("sendInvitation() - contact "+Ct.getUsername()+" does not seem to be connected.");var Kt={receiveNotifier:new dt};It.hasOwnProperty("expirationTime")&&(Kt.expirationTime=It.expirationTime);var Yt=new Do(Ct,this,Kt);Yt.type="conversation";var en={event:et.g.CONVERSATION_INVITATION_IDENTIFIER,invitationId:Yt.id,roomname:this._getTechnicalName(),sendTime:Yt.sendTime,conversationTypes:[]};return this.status===et.g.CONVERSATION_STATUS_JOINED?en.conversationTypes.push("WEBCONF"):this.groupChatStatus===et.g.CONVERSATION_STATUS_JOINED&&en.conversationTypes.push("GROUP_CHAT"),ir.sendData(Ct.getId(),en).then(function(){Kt.receiveNotifier.emit("receive")}).catch(function(tn){var ln=Dt.g.createError(tn,"Invitation not delivered",Gn);zt.get(Ut).emit("messageNotDelivered",{error:ln,contact:Ct,event:et.g.CONVERSATION_INVITATION_IDENTIFIER})}),Yt}return Gn.error("Parameter is not a contact"),null}},{key:"isRecorded",value:function(){return!!this.recordingStatus}},{key:"getRecordingInfo",value:function(){return this.isRecorded()?this.recordingStatus:null}},{key:"setNetworkCap",value:function(Ct,It){return typeof Ct!="number"||typeof It!="number"?(Gn.error("setNetworkCap - wrong cap",Ct,It),!1):Ct<=0||It<=0?(this.uploadCap=null,this.downloadCap=null,!0):(this.uploadCap=Ct,this.downloadCap=It,!0)}},{key:"getNetworkCap",value:function(){var Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.uploadCap||!this.downloadCap)return null;if(Ct.capacity)return[this.uploadCap,this.downloadCap];for(var It=this.uploadCap,Ut=this.downloadCap,Kt=this.reservedStreams.length;--Kt>=0;)this.reservedStreams[Kt].isVideoMuted||(this.reservedStreams[Kt].isRemote?Ut-=this.reservedStreams[Kt].resource:It-=this.reservedStreams[Kt].resource);return[It,Ut]}},{key:"getStreamResourceReservation",value:function(Ct){for(var It=this.reservedStreams.length;--It>=0;)if(this.reservedStreams[It].streamId===Ct)return this.reservedStreams[It];return null}},{key:"reserveResources",value:function(Ct,It,Ut,Kt,Yt){var en=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(Gn.debug("reserveResources",Ut),this.getStreamResourceReservation(Ut))throw new Error("reserveResources - already reserved stream");var tn=!1,ln={streamId:Ut,profileType:Ct,priority:Yt,resource:It,isRemote:Kt};if(ln.isVideoOnly=!!en.isVideoOnly,en.isVideoMuted)ln.isVideoMuted=!0,tn=!0;else{ln.isVideoMuted=!1;var Sn=this.getNetworkCap();tn=Kt?Sn[1]>=ln.resource:Sn[0]>=ln.resource}if(en.control)return tn;if(!tn)throw new Error("reserveResources - no such bandwidth availability");return this.reservedStreams.push(ln),this.reservedStreams.sort(function(Dn,rr){return Dn.priority>rr.priority?-1:Dn.priority===rr.priority?0:1}),Gn.debug("reservedStreams",this.reservedStreams),!0}},{key:"releaseResources",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.getNetworkCap({capacity:!0}))return!1;Gn.debug("releaseResources",Ct);for(var Ut=!1,Kt=this.reservedStreams.length;--Kt>=0;)if(this.reservedStreams[Kt].streamId===Ct){this.reservedStreams.splice(Kt,1),Ut=!0;break}return Gn.debug("reservedStreams",this.reservedStreams),Ut&&It.triggerAdaptation&&this.enableHigherPriorityVideo(!!It.isRemote),Ut}},{key:"changeStreamPriority",value:function(Ct,It,Ut){Gn.debug("changeStreamPriority",Ct,It,Ut);for(var Kt=null,Yt=this.reservedStreams.length;--Yt>=0;)if(this.reservedStreams[Yt].isRemote===It&&this.reservedStreams[Yt].streamId===Ct){Kt=this.reservedStreams[Yt];break}return!(!Kt||Kt.priority===Ut||(Kt.priority=Ut,this.reservedStreams.sort(function(en,tn){return en.priority>tn.priority?-1:en.priority===tn.priority?0:1}),Gn.debug("reservedStreams",this.reservedStreams),Kt.isVideoMuted?this.disableLowerPriorityVideo(Kt.isRemote,Kt.resource,Kt.priority)&&Hu(this,Kt):this.enableHigherPriorityVideo(Kt.isRemote,{resource:Kt.resource,priority:Kt.priority,control:!0})&&(Vu(this,Kt),this.enableHigherPriorityVideo(Kt.isRemote)),0))}},{key:"disableLowerPriorityVideo",value:function(Ct,It,Ut){Gn.debug("disableLowerPriorityVideo",Ct,It,Ut);for(var Kt=[],Yt=0,en=this.reservedStreams.length;--en>=0&&(this.reservedStreams[en].isRemote!==Ct||this.reservedStreams[en].isVideoMuted||this.reservedStreams[en].priority>=Ut||(Kt.push(this.reservedStreams[en]),!((Yt+=this.reservedStreams[en].resource)>=It))););if(Kt.length===0||Yt=0;)Vu(this,Kt[tn]);return!0}},{key:"enableHigherPriorityVideo",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Gn.debug("enableHigherPriorityVideo",Ct);var Ut=this.getNetworkCap(),Kt=Ct?Ut[1]:Ut[0];It.resource&&It.resource>0&&(Kt+=It.resource);for(var Yt=[],en=0;en=0;)Hu(this,Yt[tn]);return!0}},{key:"startComposite",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.status!==et.g.CONVERSATION_STATUS_JOINED)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"startComposite() - conversation not joined",Gn));ir.webRTCClient.startComposite(Ct._getTechnicalName()),It()})}},{key:"stopComposite",value:function(){var Ct=this;return new Promise(function(It,Ut){if(Ct.status!==et.g.CONVERSATION_STATUS_JOINED)return Ut(Dt.g.createError(et.g.ERROR_OTHER,"stopComposite() - conversation not joined",Gn));ir.webRTCClient.stopComposite(Ct._getTechnicalName()),It()})}},{key:"callVoIP",value:function(Ct){var It=this;return new Promise(function(Ut,Kt){return Ct&&typeof Ct=="string"?It.status!==et.g.CONVERSATION_STATUS_JOINED?Kt(Dt.g.createError(et.g.ERROR_OTHER,"callVoIP() - conversation not joined",Gn)):void ir.webRTCClient.webRTCClient.MCUClient.inviteVoIP(It._getTechnicalName(),It.getCloudConversationId(),Ct).then(Ut).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_OTHER,"callVoIP() - "+Yt.message,Gn))}):Kt(Dt.g.createError(et.g.ERROR_OTHER,"callVoIP() - wrong phoneNumber",Gn))})}},{key:"manageDisconnectionWarningEvent",value:function(Ct){Gn.debug("manageDisconnectionWarningEvent",Ct.detail);var It={};if(this.callIdToStreamId.has(Ct.detail.callId)){Gn.debug("call is linked with conversation");var Ut=this.callIdToStreamId.get(Ct.detail.callId);It=Ct.detail.settingUpType==="publish"||Ct.detail.settingUpType==="shareScreen"?this.conversationPublishedStreams.get(Ut):this.conversationStreams.get(Ut),zt.get(this).emit("disconnectionWarning",{streamInfo:It})}else Gn.debug("call is not linked with conversation")}},{key:"manageErrorEvent",value:function(Ct){if(Gn.debug("manageErrorEvent",Ct.detail),Ct.detail.errorCode==="DISTANT_ICE_CONNECTION_STATE_DISCONNECTED"||Ct.detail.errorCode==="DISTANT_ICE_CONNECTION_STATE_FAILED")zt.get(this).emit("error",{errorCode:Ct.detail.errorCode,errorInfo:Ct.detail.errorInfo,descriptor:Ct.detail.data});else if(this.callIdToStreamId.has(Ct.detail.callId)){Gn.debug("call is linked with conversation");var It=this.callIdToStreamId.get(Ct.detail.callId),Ut={streamInfo:Ct.detail.settingUpType==="publish"?this.conversationPublishedStreams.get(It):this.conversationStreams.get(It),errorCode:Ct.detail.errorCode,errorInfo:Ct.detail.errorInfo,callId:Ct.detail.callId,streamId:It};if(Ct.detail.data&&(Ut.descriptor=Ct.detail.data),zt.get(this).emit("error",Ut),Jp.has(Ct.detail.errorCode)){var Kt=this.conversationCalls.get(Ct.detail.callId);Kt?this.unpublish(Kt.stream):(this.unsubscribeToStream(It),Ct.detail.errorCode==="CALL_ABORTED"&&this.callIdToStreamId.delete(Ct.detail.callId))}}else Gn.debug("call is not linked with conversation")}}],xt=[{key:"getAvailableEvents",value:function(){return Yp}}],Zt&&Uu($t.prototype,Zt),xt&&Uu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(un),$u=function(){var Wt="guest";if(apiRTC.userAgentInstance){var $t=apiRTC.userAgentInstance.getUsername();$t&&(Wt=$t)}return Wt},Fu=function(Wt){var $t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Zt,xt){var Bt=null;if(Dt.g.isPropertyTypeof($t,"session","object")&&$t.session instanceof zr)Bt=$t.session;else{if(zr.getActiveSession()===null)return xt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"getOrCreateConversation() - missing session",Gn));Bt=zr.getActiveSession()}var dn={};dn.token=Bt.getToken(),dn.active=Wt.active,Eo.getOrCreateConversation(Wt,ir.getActiveApiKey(),dn).then(function(pn){Dt.g.isTypeof(pn,"public_id","string")&&(pn.id=pn.public_id,delete pn.public_id),Po.set(Wt,pn.id),Ko.set(Wt,pn.data),Dt.g.isTypeof(pn.typeString,"string")&&ju.has(pn.typeString)&&ns.set(Wt,pn.typeString),wo.set(Wt,Bt),Zt(pn)}).catch(function(pn){Po.set(Wt,null),Ko.set(Wt,null),ns.set(Wt,null),xt(Dt.g.createError(et.g.ERROR_HTTP,"getOrCreateConversation() - cannot get/create conversation",Gn,{fromError:pn}))})})},Xp=function(Wt){var $t=Wt.getModerator();return $t?$t.getId():!Wt.conference&&Wt.moderationEnabled?"#":null},Qp=function(Wt,$t){return new Promise(function(Zt,xt){if(Wt.conference){if($t.access===et.g.CONVERSATION_ACCESS_GRANTED)return Zt($t);if($t.access!==et.g.CONVERSATION_NEED_MODERATOR_ACCEPTATION)return xt(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"You were not allowed to join the conference"));var Bt=ro.getOrCreateContact($t.moderator);Ns.set(Wt,Bt),Wu(Wt).then(function(){Zt($t)}).catch(xt)}else{if(!Wt.moderationEnabled)return Zt(Object.assign($t,{access:et.g.CONVERSATION_ACCESS_GRANTED,role:et.g.CONVERSATION_ROLE_GUEST}));if(Wt.moderator)return Zt(Object.assign($t,{access:et.g.CONVERSATION_ACCESS_GRANTED,role:et.g.CONVERSATION_ROLE_MODERATOR}));Wu(Wt).then(function(){Zt(Object.assign($t,{access:et.g.CONVERSATION_NEED_MODERATOR_ACCEPTATION,role:et.g.CONVERSATION_ROLE_GUEST}))}).catch(xt)}})},Wu=function(Wt){return new Promise(function($t,Zt){var xt=Wt.getModerator();Wt.status=et.g.CONVERSATION_STATUS_WAITING;var Bt=!1,dn=setTimeout(function(){ir.apiRTCSession.joinPresenceGroup([et.g.CONVERSATION_WAITING_ROOM_PREFIX+Wt._getTechnicalName()],{doneByApiRTC:!0}),Bt=!0},et.g.JOIN_WAITING_ROOM_PRESENCE_GROUP_TIMEOUT);xt&&zt.get(Wt).emit("waitingForModeratorAcceptance",xt);var pn=new Do(xt,Wt);pn.id=Wt._getTechnicalName(),pn.type=Wt.conference?"conference":"conversation",Wt.sendJoinRequest();var Xt=function Ct(It){Gn.debug("dataMessage (waitingRoom)",It.detail);var Ut=It.detail.data;if(Ut.roomname===Wt._getTechnicalName()){var Kt=It.detail.senderId.toString();Ut.command==="access"||Ut.command==="access-new"||Ut.event===et.g.CONVERSATION_JOIN_ANSWER_IDENTIFIER?(delete Wt.cancelJoin0,Wt.joinRequestIntervalId&&(clearInterval(Wt.joinRequestIntervalId),delete Wt.joinRequestIntervalId),ir.removeEventListener("receiveData",Ct),Bt===!0?ir.apiRTCSession.leavePresenceGroup([et.g.CONVERSATION_WAITING_ROOM_PREFIX+Wt._getTechnicalName()],{doneByApiRTC:!0}):dn&&clearTimeout(dn),Ut.value.hasOwnProperty("access")&&Ut.value.access||Ut.access?(ir.sendData(Kt,{roomname:Wt._getTechnicalName(),command:"access-ack"}).catch(function(Yt){var en=Dt.g.createError(Yt,"Notification not delivered",Gn);zt.get(Wt).emit("messageNotDelivered",{error:en,contact:xt,command:"access-ack"})}),$t()):(Wt.status=et.g.CONVERSATION_STATUS_NOT_JOINED,Zt(Dt.g.createError(et.g.ERROR_NOT_ALLOWED,"You were not allowed to join the conversation",Gn)))):Ut.event===et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER&&Ut.roomname===Wt._getTechnicalName()&&zt.get(Wt).emit("moderatorConnected",ro.getOrCreateContact(Kt))}};ir.onEvent("receiveData",Xt),pn.onResponse(function(Ct){ir.removeEventListener("receiveData",Xt),Bt===!0?ir.apiRTCSession.leavePresenceGroup([et.g.CONVERSATION_WAITING_ROOM_PREFIX+Wt._getTechnicalName()]):dn&&clearTimeout(dn),Ct===et.g.INVITATION_STATUS_ACCEPTED?$t():(Wt.status=et.g.CONVERSATION_STATUS_NOT_JOINED,Zt(Dt.g.createError(et.g.ERROR_NOT_ALLOWED,"You were not allowed to join the conversation",Gn)))}),Wt.cancelJoin0=function(){return delete Wt.cancelJoin0,Wt.joinRequestIntervalId&&(clearInterval(Wt.joinRequestIntervalId),delete Wt.joinRequestIntervalId),ir.removeEventListener("receiveData",Xt),Bt===!0?ir.apiRTCSession.leavePresenceGroup([et.g.CONVERSATION_WAITING_ROOM_PREFIX+Wt._getTechnicalName()],{doneByApiRTC:!0}):dn&&clearTimeout(dn),Wt.status=et.g.CONVERSATION_STATUS_NOT_JOINED,Zt(Dt.g.createError(et.g.ERROR_OPERATION_CANCELED,"Operation canceled",Gn)),!0}})},Zp=function(Wt,$t,Zt){return new Promise(function(xt){Eo.updateConferencePresence(Wt,$t,Zt).then(xt,function(Bt){Gn.warn("updateConferencePresence",Bt),xt()})})},Bu=function(Wt,$t){var Zt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},xt=Zt.stream;if(!xt){var Bt=Wt.conversationCalls.get($t);if(!Bt)return!1;xt=Bt.stream}return Zt.noTriggerAdaptation?Wt.releaseResources(xt.userMediaStreamId):Wt.releaseResources(xt.userMediaStreamId,{triggerAdaptation:!0}),xt.publishedInConversations.delete(Wt.getName()),Wt.conversationPublishedStreams.delete(xt.userMediaStreamId),Wt.callIdToStreamId.delete($t),Wt.conversationCalls.delete($t),!0},Vu=function(Wt,$t){var Zt={streamId:$t.streamId,isRemote:$t.isRemote};if($t.isRemote)if($t.isVideoOnly){Zt.action="hangup";var xt=Ao.get(Wt).get($t.streamId);xt&&(Zt.callId=xt.callId),Gn.debug("disableVideoTrack - hangup",$t.streamId),Wt.unsubscribeToStream($t.streamId,{noTriggerAdaptation:!0})}else{Zt.action="disableTrack",Zt.trackType="video";var Bt=Ao.get(Wt).get($t.streamId);Bt&&(Zt.callId=Bt.callId),Gn.debug("disableVideoTrack - disable video track",$t.streamId),Wt.updateSubscribedStream($t.streamId,{audioOnly:!0}).catch(function(Ct){Gn.error("disableVideoTrack - updateSubscribedStream",Ct)}),$t.isVideoMuted=!0}else if($t.isVideoOnly){Zt.action="hangup";var dn=yo.get($t.streamId),pn=Wt.getConversationCall(dn);pn&&(Zt.callId=pn.callId),Gn.debug("disableVideoTrack - hangup",$t.streamId),Wt.unpublish(dn,{noTriggerAdaptation:!0})}else{var Xt=Wt.getConversationCall(yo.get($t.streamId));Xt?(Zt.action="disableTrack",Zt.trackType="video",Zt.callId=Xt.callId,Gn.debug("disableVideoTrack - disable video track",$t.streamId),Xt.updatePublishedStream("video",!1).catch(function(Ct){Gn.error("disableVideoTrack - updatePublishedStream",Ct)}),$t.isVideoMuted=!0):Zt=null}Zt&&zt.get(Wt).emit("adaptationTriggered",Zt)},Hu=function(Wt,$t){var Zt={streamId:$t.streamId,isRemote:$t.isRemote,action:"enableTrack",trackType:"video"};if($t.isRemote){var xt=Ao.get(Wt).get($t.streamId);xt&&(Zt.callId=xt.callId),Gn.debug("enableVideoTrack - enable video track",$t.streamId),Wt.updateSubscribedStream($t.streamId,{audioOnly:!1}).catch(function(dn){Gn.error("enableVideoTrack - updateSubscribedStream",dn)}),$t.isVideoMuted=!1}else{var Bt=Wt.getConversationCall(yo.get($t.streamId));Bt?(Zt.callId=Bt.callId,Gn.debug("enableVideoTrack - enable video track",$t.streamId),Bt.updatePublishedStream("video",!0).catch(function(dn){Gn.error("enableVideoTrack - updatePublishedStream",dn)}),$t.isVideoMuted=!1):Zt=null}Zt&&zt.get(Wt).emit("adaptationTriggered",Zt)},Ql=function(Wt,$t,Zt){return Zt===!0?Wt.pointerSharingState===et.g.STATE_IDLE?(Wt.pointerSharingState=et.g.STATE_JOINING,new Promise(function(xt,Bt){ir.pointerSharingClient.joinRoom(Wt._getTechnicalName(),{success:function(dn){Wt.pointerSharingState=et.g.STATE_ACTIVE,$t===!0&&(Wt.pointerSharingAutoInvite=!0);var pn={enabled:!0,roomId:dn};zt.get(Wt).emit("pointerSharingEnabled",pn),xt(),Wt.pointerSharingAutoInvite===!0&&ro.getContacts(Wt._getTechnicalName()).forEach(function(Xt){ir.pointerSharingClient.inviteInRoom(Wt._getTechnicalName(),Xt.getId())})},failure:function(dn,pn){Wt.pointerSharingState=et.g.STATE_IDLE,Wt.pointerSharingAutoInvite=!1,Bt(dn)}})})):Promise.reject(Dt.g.createError(et.g.ERROR_WRONG_STATE,"enablePointerSharing() - cannot enable pointer sharing")):Zt===!1?Wt.pointerSharingState===et.g.STATE_ACTIVE?(Wt.pointerSharingState=et.g.STATE_LEAVING,new Promise(function(xt,Bt){ir.pointerSharingClient.leaveRoom(Wt._getTechnicalName()),Wt.pointerSharingState=et.g.STATE_IDLE,Wt.pointerSharingAutoInvite=!1;var dn={enabled:!1,roomId:Wt._getTechnicalName()};zt.get(Wt).emit("pointerSharingEnabled",dn),xt()})):Promise.reject(Dt.g.createError(et.g.ERROR_WRONG_STATE,"enablePointerSharing() - cannot disable pointer sharing")):Promise.reject(Dt.g.createError(et.g.ERROR_BAD_PARAMETER,"enablePointerSharing() - cannot enable/disable pointer sharing"))},$s=function(Wt,$t){var Zt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return["roomName","callId","clientId"].forEach(function(xt){$t.hasOwnProperty(xt)&&(Zt[xt]=String($t[xt]))}),Zt};function Zl(Wt){return Zl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},Zl(Wt)}function _f(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function zu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function _c(){return _c=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(Wt,$t,Zt){var xt=_h(Wt,$t);if(xt){var Bt=Object.getOwnPropertyDescriptor(xt,$t);return Bt.get?Bt.get.call(arguments.length<3?Wt:Zt):Bt.value}},_c.apply(this,arguments)}function _h(Wt,$t){for(;!Object.prototype.hasOwnProperty.call(Wt,$t)&&(Wt=Yo(Wt))!==null;);return Wt}function _d(Wt,$t){return _d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},_d(Wt,$t)}function _g(Wt,$t){if($t&&(Zl($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(Zt){if(Zt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Zt}(Wt)}function Yo(Wt){return Yo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Yo(Wt)}var ba=ft.Y.get("Conference"),em=$o.getAvailableEvents().concat(["closed"]),Fs=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&_d(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Yo(Bt);if(dn){var Ut=Yo(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return _g(this,Ct)});function Xt(Ct){var It,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _f(this,Xt),It=pn.call(this,Ct,Ut),ba.info("Create conference"),It.conference=!0,It.friendlyName=Ut.hasOwnProperty("friendlyName")?Ut.friendlyName:Ct,It}return $t=Xt,xt=[{key:"getAvailableEvents",value:function(){return em}}],(Zt=[{key:"destroy",value:function(){po.get().deleteConference(this.getName()),_c(Yo(Xt.prototype),"destroy",this).call(this)}},{key:"_getTechnicalName",value:function(){return tm()+ts.get(this)}},{key:"getFriendlyName",value:function(){return this.friendlyName}},{key:"getInfo",value:function(){var Ct=this;return new Promise(function(It,Ut){var Kt={},Yt=wo.get(Ct);Yt&&(Kt.token=Yt.getToken()),Eo.getWebconf(Ct._getTechnicalName(),Kt).then(function(en){return It({dtmfCode:en.dtmfCode,endTime:en.end,hasPassword:en.hasPassword,sipNumber:en.sipNumber,startTime:en.start,state:en.state,type:en.type})}).catch(function(en){return Ut(Dt.g.createError(et.g.ERROR_OTHER,"getInfo() - Cannot get conference info",ba))})})}},{key:"close",value:function(){var Ct=this;return ba.debug("Closing "+this.getName()),new Promise(function(It,Ut){Ct.status!==et.g.CONVERSATION_STATUS_JOINED?Ut(Dt.g.createError(et.g.ERROR_OTHER,"close() - Conversation has to be joined to be closed",ba)):Ct.getRole()!==et.g.CONVERSATION_ROLE_MODERATOR?Ut(Dt.g.createError(et.g.ERROR_UNAUTHORIZED,"close() - Role has to be moderator to close the conversation",ba)):Eo.closeConferenceInstance(Ct,wo.get(Ct)).then(function(){ba.debug("Conversation closed successfully"),ir.dataClient.sendDataToGroup(Ct._getTechnicalName(),{event:et.g.CONVERSATION_CLOSED_IDENTIFIER,instanceId:Ct.getInstanceId(),roomname:Ct._getTechnicalName()}),zt.get(Ct).emit("closed"),Ct.leave(),It()}).catch(function(Kt){var Yt="close() - An error occured when closing conversation",en={error:new Error(Yt),code:et.g.ERROR_OTHER};ba.error(Yt,Kt),Kt.hasOwnProperty("code")?en.code=Kt.code:Kt.hasOwnProperty("http_code")&&(en.code=Kt.http_code.toString().startsWith("4")?et.g.ERROR_UNAUTHORIZED:et.g.ERROR_SERVER_UNAVAILABLE),Ut(en)})})}},{key:"sendInvitation",value:function(Ct,It){var Ut=this;if(It||(It={}),Ct instanceof No){ba.info("Invite "+Ct.getId()+" to "+this._getTechnicalName()),Ct.isOnline()||ba.warn("sendInvitation() - contact "+Ct.getUsername()+" does not seem to be connected.");var Kt={receiveNotifier:new dt};It.hasOwnProperty("expirationTime")&&(Kt.expirationTime=It.expirationTime);var Yt=new Do(Ct,this,Kt),en={event:et.g.CONVERSATION_INVITATION_IDENTIFIER,invitationId:Yt.id,roomname:this._getTechnicalName(),friendlyName:this.getFriendlyName(),sendTime:Yt.sendTime};return Yt.type="conference",Us.get(this)!==null&&(en.password=Us.get(this)),ir.sendData(Ct.getId(),en).then(function(){Kt.receiveNotifier.emit("receive")}).catch(function(tn){var ln=Dt.g.createError(tn,"Invitation not delivered",ba);zt.get(Ut).emit("messageNotDelivered",{error:ln,contact:Ct,event:et.g.CONVERSATION_INVITATION_IDENTIFIER})}),Yt}return ba.error("Parameter is not a contact"),null}},{key:"getTags",value:function(){var Ct=this;return new Promise(function(It,Ut){var Kt=zr.getActiveSession();if(!Kt)return Ut(Dt.g.createError(et.g.ERROR_NOT_ALLOWED,"getTags() - no session found",ba));var Yt=Kt.getUserAgent().getEnterprise();if(!Yt)return Ut(Dt.g.createError(et.g.ERROR_NOT_ALLOWED,"getTags() - no enterprise found",ba));Yt.getTags(Ct).then(function(en){for(var tn=[],ln=0;ln0)&&this.conversationList.delete(Bt)}},{key:"deleteConference",value:function(Bt){return!!(Dt.g.isTypeof(Bt,"string")&&Bt.length>0)&&this.conferenceList.delete(Bt)}},{key:"getOrCreateConversation",value:function(Bt){var dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pn=null;return Bt!=null&&Bt!==""?this.conversationList.has(Bt.toString())?pn=this.conversationList.get(Bt.toString()):(pn=new $o(Bt.toString(),dn),this.conversationList.set(Bt.toString(),pn)):(pn=new $o(null,dn),this.conversationList.set(pn.getName(),pn)),pn}},{key:"getOrCreateConference",value:function(Bt){var dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pn=null;return Bt!=null&&Bt!==""?this.conferenceList.has(Bt.toString())?pn=this.conferenceList.get(Bt.toString()):(pn=new Fs(Bt.toString(),dn),this.conferenceList.set(Bt.toString(),pn)):(pn=new Fs(null,dn),this.conferenceList.set(pn.getName(),pn)),pn}},{key:"getConversations",value:function(){return this.conversationList}},{key:"getConferences",value:function(){return this.conferenceList}},{key:"isConference",value:function(Bt){return Ku(Bt).hasOwnProperty("apiKey")}},{key:"getNameFromTechnicalName",value:function(Bt){return Ku(Bt).name}}],xt=[{key:"get",value:function(){return rs===null&&(rs=new Wt),rs}}],Zt&&Gu($t.prototype,Zt),xt&&Gu($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function Ku(Wt){var $t=Wt.match(/^([^:]+)[:]([^:]+)$/);return $t===null||$t.length<3?{name:Wt}:{apiKey:$t[1],name:$t[2]}}function eu(Wt){return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},eu(Wt)}function qo(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Yu(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Yu(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Yu(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function qu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function tu(Wt,$t){return tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},tu(Wt,$t)}function nm(Wt,$t){if($t&&(eu($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ur(Wt)}function Ur(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Ws(Wt){return Ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Ws(Wt)}var fr=ft.Y.get("Session"),Kr=Rn.get(),Bs=new(Go()),ao=Mr.get(),rm=["rawData","whiteboardInvitation","fileTransferInvitation","conversationMessage","conversationData","dataChannelInvitation","contactMessage","contactData","customEvent","conversationInvitation","incomingCall","disconnect","error","contactListUpdate","reconnecting","reconnection","conversationJoinRequest","newMediaAvailableFromContact","whiteboardRoomMemberUpdate","incomingScreenSharingCall","pointerSharingInvitation","pointerLocationChanged","incomingScreenSharingCallInvitation","cloudEventOccurred","remoteAccessInvitation"],Ju=new WeakMap,is=new WeakMap,Vs=null,nu=new WeakMap,as=new WeakMap,zr=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&tu(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Ws(Bt);if(dn){var Ut=Ws(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return nm(this,Ct)});function Xt(Ct){var It;(function(en,tn){if(!(en instanceof tn))throw new TypeError("Cannot call a class as a function")})(this,Xt),It=pn.call(this,fr),fr.debug("Create Session"),It.id=null,It.token=null,It.ccsToken=null,Ju.set(Ur(It),Ct),is.set(Ur(It),null),as.set(Ur(It),{}),It.isRecording=!1,It.userData=new Io,It.contactListUpdateListenerSetted=!1,It.waitingContactListUpdateEvent=[];var Ut=Ro.get(),Kt=po.get(),Yt={};return It.invitationsMap=new Map,Yt.channelEvent=function(en){switch(en.detail.channelEvent){case"onChannelReconnecting":zt.get(Ur(It)).emit("reconnecting",en);break;case"onChannelReconnect":zt.get(Ur(It)).emit("reconnection",en);break;case"onChannelError":zt.get(Ur(It)).emit("error",en);break;case"onChannelDisconnect":fr.error("Session :: onChannelDisconnect"),zt.get(Ur(It)).emit("disconnect",en)}},Yt.incomingCall=function(en){var tn=Ut.getOrCreateContact(en.detail.callerId),ln=en.detail.callId.toString();if(en.detail.callType==="data")if(fr.info("Received file transfer invitation from "+tn.getUsername()),Dt.g._private.dataCallsFileInfo.has(ln)){var Sn=Dt.g._private.dataCallsFileInfo.get(ln),Dn=null;It.invitationsMap.has(en.detail.callerId+"-sendfile-"+ln)?(Dn=It.invitationsMap.get(en.detail.callerId+"-sendfile-"+ln),fr.debug("invitation already exist :",Dn)):(Dn=new eo(tn,ln,Sn),It.invitationsMap.set(en.detail.callerId+"-sendfile-"+ln,Dn)),zt.get(Ur(It)).emit("fileTransferInvitation",Dn)}else Dt.g._private.dataChannelInvitations.has(ln)?zt.get(Ur(It)).emit("dataChannelInvitation",new Ho(tn,ln)):(fr.debug("File information has not been received yet, putting invitation on hold"),Dt.g._private.dataCallsOnHold.set(ln));else if(en.detail.callType==="screenSharing"||en.detail.callType==="screenSharingWithAudio")if(apiRTC.session.apiCCWebRTCClient.webRTCClient.userAcceptOnIncomingScreenSharingCall===!0){fr.debug("Received screenSharingCallInvitation from "+tn.getUsername());var rr=new Ar(tn,ln,en.detail.callType,{isRecorded:!!en.detail.hasOwnProperty("recordedCall")&&en.detail.recordedCall});zt.get(Ur(It)).emit("incomingScreenSharingCallInvitation",rr)}else{fr.debug("Received screenSharingCall from "+tn.getUsername());var ar=ao.getOrCreateCall(ln,tn,{started:!0,isRecorded:!!en.detail.hasOwnProperty("recordedCall")&&en.detail.recordedCall});zt.get(Ur(It)).emit("incomingScreenSharingCall",ar)}else{fr.info("Received call invitation from "+tn.getUsername());var hr=new Ar(tn,ln,en.detail.callType,{isRecorded:!!en.detail.hasOwnProperty("recordedCall")&&en.detail.recordedCall});zt.get(Ur(It)).emit("incomingCall",hr)}},Yt.roomInvitation=function(en){var tn=Ut.getOrCreateContact(en.detail.senderId);if(en.detail.roomType==="whiteBoard"){if(tn!==null){fr.info("Received whiteboard invitation from "+tn.getUsername());var ln={};en.detail.cloudConvId&&(ln.cloudConvId=en.detail.cloudConvId),en.detail.webconf===!0&&(ln.webconf=!0),zt.get(Ur(It)).emit("whiteboardInvitation",new vs(tn,en.detail.roomId,ln))}}else en.detail.roomType==="pointerSharing"&&(tn===null||Kt.getConversations().has(en.detail.roomId)||Kt.getConferences().has(en.detail.roomId)||(fr.info("Received pointer sharing invitation from "+tn.getUsername()),zt.get(Ur(It)).emit("pointerSharingInvitation",new Ml(tn,en.detail.roomId,Ur(It)))))},Yt.roomMemberUpdate=function(en){var tn,ln=[],Sn=qo(en.detail.contactList);try{for(Sn.s();!(tn=Sn.n()).done;){var Dn=tn.value;ln.push(Ut.getOrCreateContact(Dn.contactId))}}catch(rr){Sn.e(rr)}finally{Sn.f()}en.detail.roomType==="whiteBoard"&&(fr.info("Received whiteboard room member update"),zt.get(Ur(It)).emit("whiteboardRoomMemberUpdate",{contacts:ln,roomId:en.detail.roomId,status:en.detail.status}))},Yt.receiveRoomMessage=function(en){if(fr.debug("receiveRoomMessage",en),en.detail.roomType==="pointerSharing"&&en.detail.message.type==="pointerLocation"&&as.get(Ur(It)).hasOwnProperty(en.detail.roomId)){var tn={sender:Ut.getOrCreateContact(en.detail.senderId),source:en.detail.message.source,x:en.detail.message.x,y:en.detail.message.y};Dt.g.isPropertyTypeof(en.detail.message,"data","object")&&(tn.data=en.detail.message.data),zt.get(Ur(It)).emit("pointerLocationChanged",tn)}},Yt.receiveIMMessage=function(en){var tn=Ut.getOrCreateContact(en.detail.senderId);fr.debug("Received IM from "+tn.getUsername()+" : ",en.detail.message),zt.get(Ur(It)).emit("contactMessage",{sender:tn,content:en.detail.message,uuid:en.detail.UUCSeq,time:en.detail.time})},Yt.receiveData=function(en){var tn=Ut.getOrCreateContact(en.detail.senderId),ln=en.detail.data;if(ln!==void 0){var Sn=null;if(ln.roomname!==void 0&&(Sn=Kt.isConference(ln.roomname)?Kt.getOrCreateConference(Kt.getNameFromTechnicalName(ln.roomname)):Kt.getOrCreateConversation(Kt.getNameFromTechnicalName(ln.roomname))),fr.trace("Received data from "+tn.getId(),en.detail),zt.get(Ur(It)).emit("rawData",{sender:tn,content:ln}),ln.event!==void 0)switch(ln.event){case et.g.INVITATION_ANSWER_IDENTIFIER:case et.g.CONVERSATION_PERSISTENT_DATA_UPDATE_IDENTIFIER:break;case et.g.CONTACT_SEND_DATA_IDENTIFIER:fr.debug("Received contact data from "+tn.getUsername(),ln.content),zt.get(Ur(It)).emit("contactData",{sender:tn,content:ln.content});break;case et.g.CONVERSATION_SEND_DATA_IDENTIFIER:ln.roomname!==void 0&&(fr.debug("Received conversation data from "+tn.getUsername(),ln.content),zt.get(Ur(It)).emit("conversationData",{sender:tn,conversation:Sn,content:ln.content}));break;case et.g.CONTACT_NEW_MEDIA_IDENTIFIER:zt.get(Ur(It)).emit("newMediaAvailableFromContact",{sender:tn,media:ln.media});break;case et.g.CONTACT_DATACHANNEL_INVITATION:fr.debug("Received datachannel invitation from "+tn.getUsername()),Dt.g._private.dataChannelInvitations.set(ln.callId.toString(),!0),Dt.g._private.dataCallsOnHold.has(ln.callId.toString())&&zt.get(Ur(It)).emit("dataChannelInvitation",new Ho(tn,ln.callId.toString()));break;case et.g.CONTACT_SEND_FILEINFO_IDENTIFIER:fr.debug("Received file info from "+tn.getUsername(),ln.fileInfo);var Dn=ln.callId.toString();if(Dt.g._private.dataCallsFileInfo.set(Dn,ln.fileInfo),Dt.g._private.dataCallsOnHold.has(Dn)){var rr=null;It.invitationsMap.has(tn.getId()+"-sendfile-"+Dn)?(rr=It.invitationsMap.get(tn.getId()+"-sendfile-"+Dn),fr.debug("invitation already exist :",rr)):(rr=new eo(tn,Dn,ln.fileInfo),It.invitationsMap.set(en.detail.callerId+"-sendfile-"+Dn,rr)),zt.get(Ur(It)).emit("fileTransferInvitation",rr)}else fr.debug("no dataCallsOnHold");break;case et.g.CONVERSATION_INVITATION_IDENTIFIER:if(ln.roomname!==void 0){fr.info("Received conversation invitation from "+tn.getUsername());var ar={session:Ur(It)};ln.hasOwnProperty("password")&&(ar.password=ln.password),Sn?(ln.hasOwnProperty("friendlyName")&&Sn.name===Sn.friendlyName&&(Sn.friendlyName=ln.friendlyName),zt.get(Ur(It)).emit("conversationInvitation",new Vt(tn,ln,Sn,ar))):zt.get(Ur(It)).emit("conversationInvitation",new Vt(tn,ln,null,ar))}break;case et.g.CONVERSATION_JOIN_REQUEST_IDENTIFIER:fr.info("Received conversation join request from "+tn.getUsername()),Sn?zt.get(Ur(It)).emit("conversationJoinRequest",new zo(tn,Sn,ln.invitationId)):zt.get(Ur(It)).emit("conversationJoinRequest",new zo(tn,null,null));break;case et.g.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER:case et.g.CONVERSATION_CLOSED_IDENTIFIER:break;case et.g.CONTACT_REMOTEACCESS_INVITATION_IDENTIFIER:if(fr.debug("Received remote access invitation"),apiRTC.session.remoteAccessInvitation===null){var hr=new kp(tn,ln,Sn,{});apiRTC.session.remoteAccessInvitation=hr,zt.get(Ur(It)).emit("remoteAccessInvitation",hr)}else fr.error("remoteAccess session is already ongoing");break;case et.g.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER:case et.g.CONTACT_REMOTEACCESS_STOP_IDENTIFIER:case et.g.CONTACT_REMOTEACCESS_APP_MESSAGE:case et.g.CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE:break;default:var vr={event:ln.event,content:ln,sender:tn};Sn!==null&&(vr.conversation=Sn),zt.get(Ur(It)).emit("customEvent",vr)}else if(ln.command!==void 0)switch(ln.command){case"userWaiting":case"userWaiting-new":fr.info("Received conversation join request from "+tn.getUsername()),Sn?zt.get(Ur(It)).emit("conversationJoinRequest",new zo(tn,Sn,null)):zt.get(Ur(It)).emit("conversationJoinRequest",new zo(tn,null,null))}}else fr.debug("Received data undefined, leaving process")},Yt.receiveGroupChatMessage=function(en){var tn=Ut.getOrCreateContact(en.detail.senderId),ln=null,Sn=en.detail.groupChatId.toString();if(Sn!==void 0&&(ln=Kt.isConference(Sn)?Kt.getOrCreateConference(Kt.getNameFromTechnicalName(Sn)):Kt.getOrCreateConversation(Kt.getNameFromTechnicalName(Sn))),ln!==null){fr.debug("Received conversation message from "+tn.getUsername(),en.detail.message);var Dn={sender:tn,conversation:ln,content:en.detail.message};Dt.g.isTypeof(en.detail,"metadata","object")&&(Dn.metadata=en.detail.metadata),zt.get(Ur(It)).emit("conversationMessage",Dn)}},Yt.cloudEventOccurred=function(en){var tn={topic:en.detail.topic,target:en.detail.target};zt.get(Ur(It)).emit("cloudEventOccurred",tn)},Yt.callEstablished=function(en){if(en.detail.callId!==void 0){var tn=en.detail.callId.toString();fr.debug("callEstablished",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&ln.manageCallEstablishedEvent(en)}else fr.debug("callEstablished",en.detail)},Yt.remoteStreamAdded=function(en){if(en.detail.callId!==void 0){var tn=en.detail.callId.toString();fr.debug("remoteStreamAdded",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&ln.manageRemoteStreamAddedEvent(en)}else fr.debug("remoteStreamAdded",en.detail)},Yt.remoteStreamRemoved=function(en){if(en.detail.callId!==void 0){var tn=en.detail.callId.toString();fr.debug("remoteStreamRemoved",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&ln.manageRemoteStreamRemovedEvent(en)}else fr.debug("remoteStreamRemoved",en.detail)},Yt.userMediaSuccess=function(en){var tn=null;if(en.detail.callId!==void 0&&en.detail.callId!==null){tn=en.detail.callId.toString(),fr.debug("userMediaSuccess",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&ln.manageUserMediaSuccessEvent(en)}else fr.debug("userMediaSuccess",en.detail)},Yt.onCallStatsUpdate=function(en){if(en.detail.callId!==void 0){var tn=en.detail.callId.toString(),ln=ao.getCall(tn,null,{});ln!==null&&ln.manageCallStatsUpdateEvent(en)}else fr.debug("onCallStatsUpdate",en.detail)},Yt.error=function(en){if(fr.debug("error",en.detail),en.detail.roomName!==null&&en.detail.roomName!==void 0){fr.debug("error on conversation :",en.detail,en.detail.roomName,en.detail.callId);var tn=null;en.detail.roomName!==void 0&&(tn=Kt.isConference(en.detail.roomName)?Kt.getOrCreateConference(Kt.getNameFromTechnicalName(en.detail.roomName)):Kt.getOrCreateConversation(Kt.getNameFromTechnicalName(en.detail.roomName)))!==null&&tn.manageErrorEvent(en)}else if(en.detail.callId!==void 0){var ln=en.detail.callId.toString();fr.debug("error",en.detail,ln);var Sn=ao.getCall(ln,null,{});Sn!==null&&(Sn.manageErrorEvent(en),en.detail.errorCode==="RECORDING_FAILED"&&ao.removeCallFromList(Sn.getId()))}else fr.debug("error",en.detail),zt.get(Ur(It)).emit("error",en.detail)},Yt.disconnectionWarning=function(en){if(en.detail.roomName!==null){fr.debug("disconnectionWarning on conversation :",en.detail,en.detail.roomName,en.detail.callId);var tn=null;en.detail.roomName!==void 0&&(tn=Kt.isConference(en.detail.roomName)?Kt.getOrCreateConference(Kt.getNameFromTechnicalName(en.detail.roomName)):Kt.getOrCreateConversation(Kt.getNameFromTechnicalName(en.detail.roomName)))!==null&&tn.manageDisconnectionWarningEvent(en)}else if(en.detail.callId){var ln=en.detail.callId.toString();fr.debug("disconnectionWarning",en.detail,ln);var Sn=ao.getCall(ln,null,{});Sn!==null&&Sn.manageDisconnectionWarningEvent(en)}else fr.debug("disconnectionWarning",en.detail)},Yt.hangup=function(en){if(en.detail.callId){var tn=en.detail.callId.toString();fr.debug("hangup",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&(ln.manageHangupEvent(en),ln.isRecorded()===!1&&ao.removeCallFromList(ln.getId()))}else fr.debug("hangup",en.detail)},Yt.recordedStreamsAvailable=function(en){if(en.detail.userId2){var tn=Ut.getOrCreateContact(en.detail.userId2),ln=ao.getCall(null,tn);ln&&(ln.manageRecordAvailableEvent(en),ao.removeCallFromList(ln.getId()))}else fr.debug("recordedStreamsAvailable",en.detail)},Yt.desktopCapture=function(en){if(en.detail.callId){var tn=en.detail.callId.toString();fr.warn("desktopCapture",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&(ln.manageDesktopCaptureEvent(en),ao.removeCallFromList(ln.getId()))}else fr.debug("desktopCapture",en.detail)},Yt.userMediaError=function(en){if(en.detail.callId){var tn=en.detail.callId.toString();fr.warn("userMediaError",en.detail,tn);var ln=ao.getCall(tn,null,{});ln!==null&&(ln.manageUserMediaErrorEvent(en),en.detail.tryAudioCallActivated===!1&&ao.removeCallFromList(ln.getId()))}else fr.debug("userMediaError",en.detail)},fr.debug("av apiRTCManager onEvent ..."),Kr.onEvent("disconnectionWarning",Yt.disconnectionWarning).onEvent("incomingCall",Yt.incomingCall).onEvent("roomInvitation",Yt.roomInvitation).onEvent("roomMemberUpdate",Yt.roomMemberUpdate).onEvent("receiveRoomMessage",Yt.receiveRoomMessage).onEvent("receiveIMMessage",Yt.receiveIMMessage).onEvent("receiveData",Yt.receiveData).onEvent("receiveGroupChatMessage",Yt.receiveGroupChatMessage).onEvent("cloudEventOccurred",Yt.cloudEventOccurred).onEvent("callEstablished",Yt.callEstablished).onEvent("remoteStreamAdded",Yt.remoteStreamAdded).onEvent("remoteStreamRemoved",Yt.remoteStreamRemoved).onEvent("userMediaSuccess",Yt.userMediaSuccess).onEvent("onCallStatsUpdate",Yt.onCallStatsUpdate).onEvent("error",Yt.error).onEvent("hangup",Yt.hangup).onEvent("recordedStreamsAvailable",Yt.recordedStreamsAvailable).onEvent("desktopCapture",Yt.desktopCapture).onEvent("userMediaError",Yt.userMediaError),apiRTC.addEventListener("channelEvent",Yt.channelEvent),Ut.onUpdate(function(en){It.contactListUpdateListenerSetted===!1&&(fr.debug("No listener for contactListUpdate, storing event ..."),It.waitingContactListUpdateEvent.push(en)),zt.get(Ur(It)).emit("contactListUpdate",en)}),nu.set(Ur(It),Yt),It}return $t=Xt,Zt=[{key:"getToken",value:function(){return this.token}},{key:"getApzToken",value:function(){var Ct=null;return apiRTC.session!==void 0&&apiRTC.session!==null&&(Ct=apiRTC.session.JWTApzToken),Ct}},{key:"getId",value:function(){return this.id}},{key:"getUserAgent",value:function(){return Ju.get(this)}},{key:"getContact",value:function(Ct){return fr.warn("getContact() - Method deprecated, use Session.getOrCreateContact() instead"),Ro.get().getOrCreateContact(Ct)}},{key:"getOrCreateContact",value:function(Ct){return Ro.get().getOrCreateContact(Ct)}},{key:"createConversation",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return fr.warn("createConversation() - Method deprecated, use Session.getConversation() instead"),this.getConversation(Ct,It)}},{key:"getConversation",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return fr.trace("Getting conversation "+Ct,It),po.get().getOrCreateConversation(Ct)}},{key:"getConference",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return fr.trace("Getting conference "+Ct,It),po.get().getOrCreateConference(Ct)}},{key:"getOrCreateConversation",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ut=po.get().getNameFromTechnicalName(Ct);return po.get().isConference(Ct)?po.get().getOrCreateConference(Ut,It):po.get().getOrCreateConversation(Ut,It)}},{key:"getOrCreateConference",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.getOrCreateConversation(Ct,It)}},{key:"getActiveConversations",value:function(){var Ct,It={},Ut=po.get().getConversations(),Kt=qo(Ut.keys());try{for(Kt.s();!(Ct=Kt.n()).done;){var Yt=Ct.value,en=Ut.get(Yt);en.isJoined()&&(It[Yt]=en)}}catch(tn){Kt.e(tn)}finally{Kt.f()}return It}},{key:"getActiveConferences",value:function(){var Ct,It={},Ut=po.get().getConferences(),Kt=qo(Ut.keys());try{for(Kt.s();!(Ct=Kt.n()).done;){var Yt=Ct.value,en=Ut.get(Yt);en.isJoined()&&(It[Yt]=en)}}catch(tn){Kt.e(tn)}finally{Kt.f()}return It}},{key:"getWhiteboardClient",value:function(){return fr.trace("getWhiteboardClient()"),Kr.whiteBoardClient}},{key:"setUserData",value:function(Ct){this.userData.setProps(Ct).setToSession()}},{key:"setUsername",value:function(Ct){this.userData.setProp("username",Ct).setToSession()}},{key:"setPhotoUrl",value:function(Ct){this.userData.setProp("photo_url",Ct).setToSession()}},{key:"getUserData",value:function(){return this.userData}},{key:"getUsername",value:function(){return this.userData.get("username")!==null?this.userData.get("username"):this.userData.get("nickname")!==null?this.userData.get("nickname"):this.id.toString()}},{key:"getPhotoUrl",value:function(){return this.userData.get("photo_url")!==null?this.userData.get("photo_url"):this.userData.get("photoUrl")!==null?this.userData.get("photoUrl"):null}},{key:"subscribeToGroup",value:function(Ct){if(this.getSubscribedPresenceGroup().includes(Ct)){fr.debug("Already subscribed to this group");var It=apiCC.session.subscribeToPresenceGroupAddedByApiRTC.indexOf(Ct);It!==-1&&apiCC.session.subscribeToPresenceGroupAddedByApiRTC.splice(It,1)}else Kr.apiRTCSession.subscribePresenceGroup([Ct])}},{key:"unsubscribeToGroup",value:function(Ct){this.getSubscribedPresenceGroup().includes(Ct)?Kr.unsubscribeToPresenceGroup(Ct):fr.debug("Not subscribed to this group")}},{key:"joinGroup",value:function(Ct){if(this.getPresenceGroup().includes(Ct)){fr.debug("Already joined this group");var It=apiCC.session.presenceGroupAddedByApiRTC.indexOf(Ct);It!==-1&&apiCC.session.presenceGroupAddedByApiRTC.splice(It,1)}else Kr.joinAndSubscribeToPresenceGroup(Ct)}},{key:"leaveGroup",value:function(Ct){this.getPresenceGroup().includes(Ct)?Kr.leaveAndUnsubscribeToPresenceGroup(Ct):fr.debug("Group was not joined")}},{key:"subscribeToCloudEvent",value:function(Ct,It){Kr.subscribeToCloudEvent(Ct,It)}},{key:"unsubscribeToCloudEvent",value:function(Ct,It){Kr.unsubscribeToCloudEvent(Ct,It)}},{key:"joinConversationSpace",value:function(Ct){Kr.apiRTCSession.joinConversationSpace(Ct)}},{key:"leaveConversationSpace",value:function(Ct){Kr.apiRTCSession.leaveConversationSpace(Ct)}},{key:"getContacts",value:function(Ct){fr.trace("getContacts()");var It,Ut={},Kt=Ro.get().getContacts(Ct),Yt=qo(Kt.keys());try{for(Yt.s();!(It=Yt.n()).done;){var en=It.value;Ut[en]=Kt.get(en)}}catch(tn){Yt.e(tn)}finally{Yt.f()}return Ut}},{key:"getContactsArray",value:function(Ct){fr.log("getContactsArray");var It=Ro.get().getContacts(Ct);return Array.from(It.values())}},{key:"getOnlineContactsArray",value:function(Ct){fr.log("getOnlineContactsArray");var It=Ro.get().getOnlineContacts(Ct);return Array.from(It.values())}},{key:"getCall",value:function(Ct){return fr.trace("getCall()"),Mr.get().getCall(Ct)}},{key:"getCalls",value:function(){fr.trace("getCalls()");var Ct,It={},Ut=Mr.get().getCalls(),Kt=qo(Ut.keys());try{for(Kt.s();!(Ct=Kt.n()).done;){var Yt=Ct.value;It[Yt]=Ut.get(Yt)}}catch(en){Kt.e(en)}finally{Kt.f()}return It}},{key:"disconnect",value:function(){var Ct=this,It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{invalidateUserToken:!0};return new Promise(function(Ut,Kt){if(fr.info("disconnect()"),Ct.token===null&&Ct.id===null)fr.error("disconnect() - Session is already disconnected"),Kt("disconnect() - Session is already disconnected");else{var Yt,en=qo(po.get().getConversations().keys());try{for(en.s();!(Yt=en.n()).done;){var tn=Yt.value;tn.status===et.g.CONVERSATION_STATUS_JOINED&&tn.leave()}}catch(hr){en.e(hr)}finally{en.f()}if(clearInterval(is.get(Ct)),is.set(Ct,null),Ct.token!==null&&It.hasOwnProperty("invalidateUserToken")&&It.invalidateUserToken)Bs.invalidateUserToken(Ct.token).then(function(){Vs=null,It.invalidateApiCCId=!0,Kr.disconnect(It),Ct.id=null,Ct.token=null;for(var hr=nu.get(Ct),vr=0,Pr=Object.keys(hr);vr=0;--xr){var Er=this.tryEntries[xr],$a=Er.completion;if(Er.tryLoc==="root")return Or("end");if(Er.tryLoc<=this.prev){var to=Zt.call(Er,"catchLoc"),vo=Zt.call(Er,"finallyLoc");if(to&&vo){if(this.prev=0;--Or){var xr=this.tryEntries[Or];if(xr.tryLoc<=this.prev&&Zt.call(xr,"finallyLoc")&&this.prev=0;--sr){var Or=this.tryEntries[sr];if(Or.finallyLoc===pr)return this.complete(Or.completion,Or.afterLoc),Pr(Or),Ut}},catch:function(pr){for(var sr=this.tryEntries.length-1;sr>=0;--sr){var Or=this.tryEntries[sr];if(Or.tryLoc===pr){var xr=Or.completion;if(xr.type==="throw"){var Er=xr.arg;Pr(Or)}return Er}}throw new Error("illegal catch attempt")},delegateYield:function(pr,sr,Or){return this.delegate={iterator:na(pr),resultName:sr,nextLoc:Or},this.method==="next"&&(this.arg=void 0),Ut}},Wt}function Xu(Wt,$t,Zt,xt,Bt,dn,pn){try{var Xt=Wt[dn](pn),Ct=Xt.value}catch(It){return void Zt(It)}Xt.done?$t(Ct):Promise.resolve(Ct).then(xt,Bt)}function Uo(Wt){return function(){var $t=this,Zt=arguments;return new Promise(function(xt,Bt){var dn=Wt.apply($t,Zt);function pn(Ct){Xu(dn,xt,Bt,pn,Xt,"next",Ct)}function Xt(Ct){Xu(dn,xt,Bt,pn,Xt,"throw",Ct)}pn(void 0)})}}function jo(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return Qu(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?Qu(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function Qu(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function zs(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function Zu(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function Gs(Wt,$t,Zt){return $t&&Zu(Wt.prototype,$t),Zt&&Zu(Wt,Zt),Object.defineProperty(Wt,"prototype",{writable:!1}),Wt}function Ks(Wt,$t){if(typeof $t!="function"&&$t!==null)throw new TypeError("Super expression must either be null or a function");Wt.prototype=Object.create($t&&$t.prototype,{constructor:{value:Wt,writable:!0,configurable:!0}}),Object.defineProperty(Wt,"prototype",{writable:!1}),$t&&ls(Wt,$t)}function ls(Wt,$t){return ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},ls(Wt,$t)}function Ys(Wt){var $t=ep();return function(){var Zt,xt=Fo(Wt);if($t){var Bt=Fo(this).constructor;Zt=Reflect.construct(xt,arguments,Bt)}else Zt=xt.apply(this,arguments);return om(this,Zt)}}function om(Wt,$t){if($t&&(ss($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _i(Wt)}function _i(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function ep(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Fo(Wt){return Fo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Fo(Wt)}var Yn=ft.Y.get("Stream"),su=Rn.get(),sm=po.get(),lm=["stopped","trackStopped","audioAmplitude","audioAmplitudeInfo","muteStateChange","activeStateChange","backgroundSubstractionStopVisibilityChange","backgroundSubstractionStopComputeTime","AIESnapshot","AIELog","flowStatusChanged","audioFlowStatusChanged","videoFlowStatusChanged","remoteAudioFlowStatusChanged","remoteVideoFlowStatusChanged","release","constraintsChanged"],yo=new Map,qs=new WeakMap,cs=new WeakMap,ds=new WeakMap,lu=new WeakMap,Jo={},so=function(Wt){Ks(Zt,Wt);var $t=Ys(Zt);function Zt(xt){var Bt,dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(zs(this,Zt),Bt=$t.call(this,Yn),dn.constructor!==!0)throw new Error("Stream constructor should not be used directly, please use a static method of class Stream such as : createStreamFromUserMedia, createStreamFromMediaStream, createScreensharingStream");if(delete dn.constructor,!dn.hasOwnProperty("type"))throw new Error("Cannot create Stream with no type");if(Yn.debug("Create Stream with options",dn),Bt.data=xt,Bt.audioInput=dn.hasOwnProperty("audioInput")?dn.audioInput:null,Bt.videoInput=dn.hasOwnProperty("videoInput")?dn.videoInput:null,Bt.audioFilterIsApplied=!1,Bt.videoFilterIsApplied=!1,Bt.audioAppliedFilter="none",Bt.videoAppliedFilter="none",Bt.originalMediaTrack=null,dn.hasOwnProperty("userMediaStreamId")?(Bt.userMediaStreamId=dn.userMediaStreamId,Bt.isRemote=!1,yo.set(Bt.userMediaStreamId,_i(Bt))):(Bt.userMediaStreamId=null,Bt.isRemote=!0),Dt.g.isPropertyTypeof(dn,"streamId","number")?Bt.streamId=dn.streamId:Bt.userMediaStreamId!==null?Bt.streamId=Number(Bt.userMediaStreamId):Number.MAX_SAFE_INTEGER!==void 0?Bt.streamId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER):Bt.streamId=Math.floor(1024*Math.random()*1024*1024),Bt.contact=dn.hasOwnProperty("contact")?dn.contact:null,dn.hasOwnProperty("callId")?(Bt.callId=dn.callId,Bt.callAudioAvailable=dn.callAudioAvailable,Bt.callAudioActive=dn.callAudioActive,Bt.callAudioMuted=dn.callAudioMuted,Bt.callAudioSilent=dn.callAudioSilent,Bt.callVideoAvailable=dn.callVideoAvailable,Bt.callVideoActive=dn.callVideoActive,Bt.callVideoMuted=dn.callVideoMuted,Bt.callVideoSilent=dn.callVideoSilent):Bt.callId=null,Bt.publishedInConversations=new Map,Bt.mediaRecorder=null,Bt.recordedBlobs=[],qs.set(_i(Bt),!!dn.hasOwnProperty("screensharing")&&dn.screensharing),cs.set(_i(Bt),null),ds.set(_i(Bt),null),Bt.screensharingRemoteAccessStream=!1,apiRTC.userAgentInstance.apiRTCStreamsList.set(Bt.streamId,_i(Bt)),Bt.type=dn.type,Bt.visibilityChangeHandlerWhenTorchOn=function(ln){if(Yn.debug("visibilityChangeHandlerWhenTorchOn :",document.visibilityState),document.visibilityState==="hidden"&&(Yn.debug("visibilitychange is now hidden"),apiRTC.osName==="Android")){var Sn={video:{advanced:[{torch:!1}]}};Bt.informContactsOfChangedConstraints(Sn),Bt.emitConstraintsChanged(Sn),document.removeEventListener("visibilitychange",Bt.visibilityChangeHandlerWhenTorchOn,!1)}},apiRTC.browser!=="IE"&&Bt.data!==null){var pn,Xt=function(ln){ln.addEventListener("ended",function(Sn){Jo.hasOwnProperty(ln.id)||(zt.get(_i(Bt)).emit("trackStopped",{type:ln.kind,id:ln.id,reason:"ended"}),Jo[ln.id]=!0)})},Ct=jo(Bt.data.getVideoTracks());try{for(Ct.s();!(pn=Ct.n()).done;){var It=pn.value;Xt(It)}}catch(ln){Ct.e(ln)}finally{Ct.f()}var Ut,Kt=jo(Bt.data.getAudioTracks());try{for(Kt.s();!(Ut=Kt.n()).done;){var Yt=Ut.value;Xt(Yt)}}catch(ln){Kt.e(ln)}finally{Kt.f()}}var en={};if(Dt.g.isTypeof(Bt.userMediaStreamId,"string")?(en.userMediaStop=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId){var Sn={streamId:Bt.streamId,userMediaStreamId:Bt.userMediaStreamId};zt.get(_i(Bt)).emit("stopped",Sn);var Dn=lu.get(_i(Bt));if(Dn)for(var rr in Dn)apiRTC.removeEventListener(rr,Dn[rr])}},en.localStreamUpdated=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId&&ln.detail.callId===null){if(ln.detail.changeList.indexOf("audioIsMuted")>=0){var Sn={streamId:Bt.streamId,userMediaStreamId:Bt.userMediaStreamId,type:"audio",muted:ln.detail.audioIsMuted};zt.get(_i(Bt)).emit("muteStateChange",Sn),Bt.sendAudioFlowStatusChanged(),Bt.sendFlowStatusChanged("audio")}if(ln.detail.changeList.indexOf("videoIsMuted")>=0){var Dn={streamId:Bt.streamId,userMediaStreamId:Bt.userMediaStreamId,type:"video",muted:ln.detail.videoIsMuted};zt.get(_i(Bt)).emit("muteStateChange",Dn),Bt.sendVideoFlowStatusChanged(),Bt.sendFlowStatusChanged("video")}ln.detail.changeList.indexOf("audioIsSilent")>=0&&(Bt.sendAudioFlowStatusChanged(),Bt.sendFlowStatusChanged("audio")),ln.detail.changeList.indexOf("videoIsSilent")>=0&&(Bt.sendVideoFlowStatusChanged(),Bt.sendFlowStatusChanged("video"))}},en.backgroundSubstractionStopVisibilityChange=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId){var Sn={streamId:Bt.streamId,userMediaStreamId:Bt.userMediaStreamId};zt.get(_i(Bt)).emit("backgroundSubstractionStopVisibilityChange",Sn)}},en.backgroundSubstractionStopComputeTime=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId){var Sn={streamId:Bt.streamId,userMediaStreamId:Bt.userMediaStreamId};zt.get(_i(Bt)).emit("backgroundSubstractionStopComputeTime",Sn)}},en.AIESnapshot=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId){var Sn=ln.detail.image;zt.get(_i(Bt)).emit("AIESnapshot",Sn)}},en.AIELog=function(ln){if(ln.detail.userMediaStreamId===Bt.userMediaStreamId){var Sn=ln.detail.log;zt.get(_i(Bt)).emit("AIELog",Sn)}}):Dt.g.isTypeof(Bt.callId,"string")&&(en.hangup=function(ln){if(ln.detail.hangupType==="remote"&&ln.detail.callId===Bt.callId){var Sn={streamId:Bt.streamId,callId:Bt.callId};zt.get(_i(Bt)).emit("stopped",Sn);var Dn=lu.get(_i(Bt));for(var rr in Dn)apiRTC.removeEventListener(rr,Dn[rr])}},en.remoteStreamUpdated=function(ln){if(ln.detail.callId===Bt.callId){if(ln.detail.changeList.indexOf("audioIsActive")>=0){Bt.callAudioActive=ln.detail.audioIsActive;var Sn={streamId:Bt.streamId,callId:Bt.callId,type:"audio",active:ln.detail.audioIsActive};zt.get(_i(Bt)).emit("activeStateChange",Sn)}if(ln.detail.changeList.indexOf("audioIsMuted")>=0){Bt.callAudioMuted=ln.detail.audioIsMuted;var Dn={streamId:Bt.streamId,callId:Bt.callId,type:"audio",muted:ln.detail.audioIsMuted};zt.get(_i(Bt)).emit("muteStateChange",Dn),Bt.sendRemoteAudioFlowStatusChanged({enabled:!ln.detail.audioIsMuted,muted:ln.detail.audioIsSilent}),Bt.sendFlowStatusChangedForRemote("audio",{enabled:!ln.detail.audioIsMuted,muted:ln.detail.audioIsSilent})}if(ln.detail.changeList.indexOf("videoIsActive")>=0){Bt.callVideoActive=ln.detail.videoIsActive;var rr={streamId:Bt.streamId,callId:Bt.callId,type:"video",active:ln.detail.videoIsActive};zt.get(_i(Bt)).emit("activeStateChange",rr)}if(ln.detail.changeList.indexOf("videoIsMuted")>=0){Bt.callVideoMuted=ln.detail.videoIsMuted;var ar={streamId:Bt.streamId,callId:Bt.callId,type:"video",muted:ln.detail.videoIsMuted};zt.get(_i(Bt)).emit("muteStateChange",ar),Bt.sendRemoteVideoFlowStatusChanged({enabled:!ln.detail.videoIsMuted,muted:ln.detail.videoIsSilent}),Bt.sendFlowStatusChangedForRemote("video",{enabled:!ln.detail.videoIsMuted,muted:ln.detail.videoIsSilent})}ln.detail.changeList.indexOf("audioIsSilent")>=0&&(Bt.callAudioSilent=ln.detail.audioIsSilent,Bt.sendRemoteAudioFlowStatusChanged({enabled:!ln.detail.audioIsMuted,muted:ln.detail.audioIsSilent}),Bt.sendFlowStatusChangedForRemote("audio",{enabled:!ln.detail.audioIsMuted,muted:ln.detail.audioIsSilent})),ln.detail.changeList.indexOf("videoIsSilent")>=0&&(Bt.callVideoSilent=ln.detail.videoIsSilent,Bt.sendRemoteVideoFlowStatusChanged({enabled:!ln.detail.videoIsMuted,muted:ln.detail.videoIsSilent}),Bt.sendFlowStatusChangedForRemote("video",{enabled:!ln.detail.videoIsMuted,muted:ln.detail.videoIsSilent})),ln.detail.changeList.indexOf("audioIsSilentLocally")>=0&&(Bt.sendAudioFlowStatusChanged(),Bt.sendFlowStatusChanged("audio")),ln.detail.changeList.indexOf("videoIsSilentLocally")>=0&&(Bt.sendVideoFlowStatusChanged(),Bt.sendFlowStatusChanged("video"))}}),Object.keys(en).length>0)for(var tn in lu.set(_i(Bt),en),en)apiRTC.addEventListener(tn,en[tn]);return Bt}return Gs(Zt,[{key:"getContact",value:function(){return this.contact}},{key:"getData",value:function(){return this.data}},{key:"getConversations",value:function(){var xt,Bt=[],dn=jo(this.publishedInConversations.keys());try{for(dn.s();!(xt=dn.n()).done;){var pn=xt.value;Bt.push(sm.getConversations(pn))}}catch(Xt){dn.e(Xt)}finally{dn.f()}return Bt}},{key:"isScreensharing",value:function(){return qs.get(this)}},{key:"isScreensharingRemoteAccess",value:function(){return this.screensharingRemoteAccessStream}},{key:"hasData",value:function(){return this.data!==null}},{key:"hasVideo",value:function(){return this.callId?this.callVideoAvailable&&this.callVideoActive:!!this.hasData()&&this.data.getVideoTracks().length>0}},{key:"hasAudio",value:function(){return this.callId?this.callAudioAvailable&&this.callAudioActive:!!this.hasData()&&this.data.getAudioTracks().length>0}},{key:"isVideoMuted",value:function(){if(this.callId)return this.callVideoSilent;if(this.hasData()){var xt=this.data.getVideoTracks();if(xt&&xt.length>0)return xt[0].muted}return!0}},{key:"isVideoEnabled",value:function(){if(this.callId)return!this.callVideoMuted;if(this.hasData()){var xt=this.data.getVideoTracks();return xt&&xt.length>0&&xt[0].enabled}return!1}},{key:"isAudioMuted",value:function(){if(this.callId)return this.callAudioSilent;if(this.hasData()){var xt=this.data.getAudioTracks();if(xt&&xt.length>0)return xt[0].muted}return!0}},{key:"isAudioEnabled",value:function(){if(this.callId)return!this.callAudioMuted;if(this.hasData()){var xt=this.data.getAudioTracks();return xt&&xt.length>0&&xt[0].enabled}return!1}},{key:"getType",value:function(){return this.type}},{key:"release",value:function(){var xt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.childType==="noiseReduction"&&this.parent!==void 0){apiCC.audioProcessor.stopAudioNodeCtx(this.parent.nodeCtx);var Bt=apiCC.getUserMediaStream(this.parent.userMediaStreamId);apiCC.audioProcessor.listenToAudio(this.parent.data,Bt)}this.hasData()&&(this.releaseAudio(),this.releaseVideo(),this.data=null,this.userMediaStreamId&&(apiCC.releaseUserMediaStream(this.userMediaStreamId),yo.delete(this.userMediaStreamId))),zt.get(this).emit("release",{streamId:this.streamId,userMediaStreamId:this.userMediaStreamId}),xt.releaseChildrenStream!==!1&&this.releaseAllChildren(),xt.releaseParentStream!==!1&&this.parent!==void 0&&(Yn.debug("release parent is also requested"),this.parent.release(xt)),Yn.debug("Removing in apiRTCStreamsList :",this.streamId),apiRTC.userAgentInstance.apiRTCStreamsList.delete(this.streamId)}},{key:"releaseAudio",value:function(){var xt=this;this.hasData()&&(this.disableAudioAnalysis(),this.data.getAudioTracks().forEach(function(Bt){Bt.stop(),Jo.hasOwnProperty(Bt.id)||(zt.get(xt).emit("trackStopped",{type:Bt.kind,id:Bt.id,reason:"releaseAudio"}),Jo[Bt.id]=!0)}))}},{key:"releaseVideo",value:function(){var xt=this;this.hasData()&&this.data.getVideoTracks().forEach(function(Bt){Bt.stop(),Jo.hasOwnProperty(Bt.id)||(zt.get(xt).emit("trackStopped",{type:Bt.kind,id:Bt.id,reason:"releaseVideo"}),Jo[Bt.id]=!0)})}},{key:"muteAudio",value:function(){Yn.warn("This method is deprecated now, please use Stream.disableAudio() instead"),this.disableAudio()}},{key:"muteVideo",value:function(){Yn.warn("This method is deprecated now, please use Stream.disableVideo() instead"),this.disableVideo()}},{key:"unmuteAudio",value:function(){Yn.warn("This method is deprecated now, please use Stream.enableAudio() instead"),this.enableAudio()}},{key:"unmuteVideo",value:function(){Yn.warn("This method is deprecated now, please use Stream.enableVideo() instead"),this.enableVideo()}},{key:"sendStreamRequest",value:function(xt,Bt,dn){var pn={};pn.streamId=this.streamId;var Xt=this.publishedInConversations.keys();pn.roomname=Xt.next().value,this.contact.sendRequest(xt,pn).then(function(){return Bt()}).catch(function(Ct){return Yn.error("Error on sendRequest :",Ct),dn()})}},{key:"enableAudio",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return new Promise(function(){var dn=Uo(oo().mark(function pn(Xt,Ct){var It;return oo().wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(xt.isAudioEnabled()!==!0||xt.isRemote!==!1){Ut.next=3;break}return Yn.debug("audio already enabled"),Ut.abrupt("return",Xt());case 3:if(!xt.userMediaStreamId){Ut.next=16;break}if(It=apiCC.getUserMediaStream(xt.userMediaStreamId)){Ut.next=7;break}return Ut.abrupt("return",Ct());case 7:if(It.unMuteAudioOnStreams("enabled"),xt.parent===void 0){Ut.next=12;break}return Yn.debug("this is a child stream, need to unmute parent if necessary"),Ut.next=12,xt.parent.enableAudio();case 12:return xt.childrens!==void 0&&xt.childrens.forEach(function(){var Kt=Uo(oo().mark(function Yt(en,tn){return oo().wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,en.enableAudio();case 2:case"end":return ln.stop()}},Yt)}));return function(Yt,en){return Kt.apply(this,arguments)}}()),Ut.abrupt("return",Xt());case 16:if(!xt.callId){Ut.next=29;break}if(Bt!==!0){Ut.next=23;break}Yn.debug("enableAudio remote with applyRemotely"),Yn.debug("this.contact :",xt.contact),xt.sendStreamRequest(et.g.CONTACT_ENABLE_AUDIO_REQUEST,Xt,Ct),Ut.next=28;break;case 23:if(xt.hasData()){Ut.next=25;break}return Ut.abrupt("return",Ct());case 25:xt.data.getAudioTracks().forEach(function(Kt){Kt.enabled=!0}),xt.sendAudioFlowStatusChanged(),xt.sendFlowStatusChanged("audio");case 28:return Ut.abrupt("return",Xt());case 29:return Ut.abrupt("return",Ct());case 30:case"end":return Ut.stop()}},pn)}));return function(pn,Xt){return dn.apply(this,arguments)}}())}},{key:"disableAudio",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return new Promise(function(){var dn=Uo(oo().mark(function pn(Xt,Ct){var It;return oo().wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(xt.isAudioEnabled()!==!1||xt.isRemote!==!1){Ut.next=3;break}return Yn.debug("audio already disabled"),Ut.abrupt("return",Xt());case 3:if(!xt.userMediaStreamId){Ut.next=16;break}if(It=apiCC.getUserMediaStream(xt.userMediaStreamId)){Ut.next=7;break}return Ut.abrupt("return",Ct());case 7:if(It.muteAudioOnStreams("enabled"),xt.parent===void 0){Ut.next=12;break}return Yn.debug("this is a child stream, need to mute parent if necessary"),Ut.next=12,xt.parent.disableAudio();case 12:return xt.childrens!==void 0&&xt.childrens.forEach(function(){var Kt=Uo(oo().mark(function Yt(en,tn){return oo().wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,en.disableAudio();case 2:case"end":return ln.stop()}},Yt)}));return function(Yt,en){return Kt.apply(this,arguments)}}()),Ut.abrupt("return",Xt());case 16:if(!xt.callId){Ut.next=29;break}if(Bt!==!0){Ut.next=23;break}Yn.debug("disableAudio remote with applyRemotely"),Yn.debug("this.contact :",xt.contact),xt.sendStreamRequest(et.g.CONTACT_DISABLE_AUDIO_REQUEST,Xt,Ct),Ut.next=28;break;case 23:if(xt.hasData()){Ut.next=25;break}return Ut.abrupt("return",Ct());case 25:xt.data.getAudioTracks().forEach(function(Kt){Kt.enabled=!1}),xt.sendAudioFlowStatusChanged(),xt.sendFlowStatusChanged("audio");case 28:return Ut.abrupt("return",Xt());case 29:return Ut.abrupt("return",Ct());case 30:case"end":return Ut.stop()}},pn)}));return function(pn,Xt){return dn.apply(this,arguments)}}())}},{key:"enableVideo",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return new Promise(function(){var dn=Uo(oo().mark(function pn(Xt,Ct){var It;return oo().wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(xt.isVideoEnabled()!==!0||xt.isRemote!==!1){Ut.next=3;break}return Yn.debug("video already enabled"),Ut.abrupt("return",Xt());case 3:if(!xt.userMediaStreamId){Ut.next=16;break}if(It=apiCC.getUserMediaStream(xt.userMediaStreamId)){Ut.next=7;break}return Ut.abrupt("return",Ct());case 7:if(It.unMuteVideoOnStreams("enabled"),xt.parent===void 0){Ut.next=12;break}return Yn.debug("this is a child stream, need to unmute parent if necessary"),Ut.next=12,xt.parent.enableVideo();case 12:return xt.childrens!==void 0&&xt.childrens.forEach(function(){var Kt=Uo(oo().mark(function Yt(en,tn){return oo().wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,en.enableVideo();case 2:case"end":return ln.stop()}},Yt)}));return function(Yt,en){return Kt.apply(this,arguments)}}()),Ut.abrupt("return",Xt());case 16:if(!xt.callId){Ut.next=29;break}if(Bt!==!0){Ut.next=23;break}Yn.debug("enableVideo remote with applyRemotely"),Yn.debug("this.contact :",xt.contact),xt.sendStreamRequest(et.g.CONTACT_ENABLE_VIDEO_REQUEST,Xt,Ct),Ut.next=28;break;case 23:if(xt.hasData()){Ut.next=25;break}return Ut.abrupt("return",Ct());case 25:xt.data.getVideoTracks().forEach(function(Kt){Kt.enabled=!0}),xt.sendVideoFlowStatusChanged(),xt.sendFlowStatusChanged("video");case 28:return Ut.abrupt("return",Xt());case 29:return Ut.abrupt("return",Ct());case 30:case"end":return Ut.stop()}},pn)}));return function(pn,Xt){return dn.apply(this,arguments)}}())}},{key:"disableVideo",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return new Promise(function(){var dn=Uo(oo().mark(function pn(Xt,Ct){var It;return oo().wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:if(xt.isVideoEnabled()!==!1||xt.isRemote!==!1){Ut.next=3;break}return Yn.debug("video already disabled"),Ut.abrupt("return",Xt());case 3:if(!xt.userMediaStreamId){Ut.next=16;break}if(It=apiCC.getUserMediaStream(xt.userMediaStreamId)){Ut.next=7;break}return Ut.abrupt("return",Ct());case 7:if(It.muteVideoOnStreams("enabled"),xt.parent===void 0){Ut.next=12;break}return Yn.debug("this is a child stream, need to mute parent if necessary"),Ut.next=12,xt.parent.disableVideo();case 12:return xt.childrens!==void 0&&xt.childrens.forEach(function(){var Kt=Uo(oo().mark(function Yt(en,tn){return oo().wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,en.disableVideo();case 2:case"end":return ln.stop()}},Yt)}));return function(Yt,en){return Kt.apply(this,arguments)}}()),Ut.abrupt("return",Xt());case 16:if(!xt.callId){Ut.next=29;break}if(Bt!==!0){Ut.next=23;break}Yn.debug("disableVideo remote with applyRemotely"),Yn.debug("this.contact :",xt.contact),xt.sendStreamRequest(et.g.CONTACT_DISABLE_VIDEO_REQUEST,Xt,Ct),Ut.next=28;break;case 23:if(xt.hasData()){Ut.next=25;break}return Ut.abrupt("return",Ct());case 25:xt.data.getVideoTracks().forEach(function(Kt){Kt.enabled=!1}),xt.sendVideoFlowStatusChanged(),xt.sendFlowStatusChanged("video");case 28:return Ut.abrupt("return",Xt());case 29:return Ut.abrupt("return",Ct());case 30:case"end":return Ut.stop()}},pn)}));return function(pn,Xt){return dn.apply(this,arguments)}}())}},{key:"getAudioFlowStatus",value:function(){var xt={};return this.data.getAudioTracks().forEach(function(Bt){xt.enabled=Bt.enabled,xt.muted=Bt.muted}),xt}},{key:"getVideoFlowStatus",value:function(){var xt={};return this.data.getVideoTracks().forEach(function(Bt){xt.enabled=Bt.enabled,xt.muted=Bt.muted}),xt}},{key:"getRemoteAudioFlowStatus",value:function(){var xt=this;return new Promise(function(Bt,dn){if(!xt.isRemote)return dn("Please use this function on a remote Stream");if(Yn.debug("getRemoteAudioFlowStatus()"),xt.contact===null)return dn("No contact associated");var pn=xt.addPendingPromise("getRemoteAudioFlowStatus",Bt,dn);xt.contact.sendCustomEvent(et.g.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_IDENTIFIER,{requesterId:zr.getActiveSession().getUserAgent().userId,callId:xt.callId,streamId:xt.getId(),timeout:pn})})}},{key:"getRemoteVideoFlowStatus",value:function(){var xt=this;return new Promise(function(Bt,dn){if(!xt.isRemote)return dn("Please use this function on a remote Stream");if(Yn.debug("getRemoteVideoFlowStatus()"),xt.contact===null)return dn("No contact associated");var pn=xt.addPendingPromise("getRemoteVideoFlowStatus",Bt,dn);xt.contact.sendCustomEvent(et.g.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_IDENTIFIER,{requesterId:zr.getActiveSession().getUserAgent().userId,callId:xt.callId,streamId:xt.getId(),timeout:pn})})}},{key:"attachToElement",value:function(xt){Yn.debug("attachToElement"),su.attachMediaStream(xt,this.data)}},{key:"addInDiv",value:function(xt,Bt,dn,pn,Xt){Yn.debug("addInDiv"),su.addStreamInDiv(this.data,this.type,xt,Bt,dn,pn,Xt)}},{key:"removeFromDiv",value:function(xt,Bt){Yn.debug("removeFromDiv"),su.removeElementFromDiv(xt,Bt)}},{key:"startRecord",value:function(xt){return Yn.info("startRecord :",xt),apiCC.recordMgr.record(this.data,xt)}},{key:"stopRecord",value:function(){return Yn.info("stopRecord() - Stopping record"),apiCC.recordMgr.stop()}},{key:"pauseRecord",value:function(){return Yn.info("pauseRecord() - Pausing record"),apiCC.recordMgr.pause()}},{key:"resumeRecord",value:function(){return Yn.info("resumeRecord() - Resuming record"),apiCC.recordMgr.resume()}},{key:"enableAudioAnalysis",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yn.info("enableAudioAnalysis()");var dn=Dt.g.getAudioContext(),pn=null,Xt=!1,Ct=ds.get(this),It=cs.get(this);dn?this.hasData()?Ct!==null||It!==null?Yn.error("enableAudioAnalysis() - Audio analysis already enabled"):(Ct=dn.createMediaStreamSource(this.data),(It=dn.createScriptProcessor(2048,1,1)).connect(dn.destination),It.onaudioprocess=function(){var Ut,Kt=new Uint8Array(It.analyser.frequencyBinCount),Yt=0;It.analyser.getByteFrequencyData(Kt);var en,tn=jo(Kt);try{for(tn.s();!(en=tn.n()).done;)Yt+=en.value}catch(rr){tn.e(rr)}finally{tn.f()}Ut=Yt/Kt.length,zt.get(xt).emit("audioAmplitude",Ut);var ln=0;Kt.sort(function(rr,ar){return ar-rr}),Kt=Kt.slice(0,50);for(var Sn=0;SnDn&&(Xt||(Xt=!0,zt.get(xt).emit("audioAmplitudeInfo",{amplitude:Ut,isSpeaking:!0})),pn!==null&&clearTimeout(pn),pn=setTimeout(function(){zt.get(xt).emit("audioAmplitudeInfo",{amplitude:Ut,isSpeaking:!1}),Xt=!1},1e3))},It.analyser=dn.createAnalyser(),It.analyser.smoothingTimeConstant=.5,It.analyser.fftSize=1024,Ct.connect(It.analyser),It.analyser.connect(It),cs.set(this,It),ds.set(this,Ct)):Yn.error("enableAudioAnalysis() - Stream has no data, unable to enable audio analysis"):Yn.error("enableAudioAnalysis() - AudioContext is not available, unable to enable audio analysis")}},{key:"disableAudioAnalysis",value:function(){Yn.info("disableAudioAnalysis()");var xt=ds.get(this),Bt=cs.get(this);xt!==null&&xt.disconnect(),Bt!==null&&(Bt.analyser.disconnect(),Bt.disconnect()),cs.set(this,null),ds.set(this,null)}},{key:"takeSnapshot",value:function(){var xt=this,Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yn.info("takeSnapshot()");var dn=null,pn=null;return new Promise(function(Xt,Ct){if(xt.hasData()){xt.hasVideo()||Yn.warn("takeSnapshot() - This stream does not have a video track"),dn=document.createElement("video"),pn=function(Yt){if(It.width=dn.videoWidth,It.height=dn.videoHeight,Bt.hasOwnProperty("width")&&(It.width=Bt.width),Bt.hasOwnProperty("height")&&(It.height=Bt.height),Bt.hasOwnProperty("filters")){for(var en=[],tn=0,ln=Object.keys(Bt.filters);tn0&&(xt.audioSourceLabel="",this.data.getAudioTracks()[0].label&&(xt.audioSourceLabel=this.data.getAudioTracks()[0].label)),this.hasData()&&this.data.getVideoTracks().length>0&&(xt.videoSourceLabel="",this.data.getVideoTracks()[0].label&&(xt.videoSourceLabel=this.data.getVideoTracks()[0].label)),Yn.debug("getLabels:",xt),xt}},{key:"checkImageCaptureCompatibility",value:function(){return typeof ImageCapture>"u"}},{key:"getLocalMediaStreamTrack",value:function(){var xt=null;return this.data.getVideoTracks().length===1&&(xt=this.data.getVideoTracks()[0]),xt}},{key:"getLocalMediaStreamAudioTrack",value:function(){var xt=null;return this.data.getAudioTracks().length===1&&(xt=this.data.getAudioTracks()[0]),xt}},{key:"informContactsOfChangedConstraints",value:function(xt){var Bt,dn=po.get().getConversations(),pn=jo(dn.keys());try{for(pn.s();!(Bt=pn.n()).done;){var Xt=Bt.value,Ct=dn.get(Xt).getContactsArray(),It=void 0;for(It=0;It0&&arguments[0]!==void 0?arguments[0]:0;if(typeof xt!="number")return Yn.error("minLogPeriod parameter must be an integer");var Bt=this.getStreamAIE();Bt!==null&&Bt.activateLogs(xt)}},{key:"stopAILogs",value:function(){var xt=this.getStreamAIE();xt!==null&&xt.stopLogs()}},{key:"activateAISnapshots",value:function(){var xt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;if(typeof xt!="number")return Yn.error("minSnapshotPeriod parameter must be an integer");var Bt=this.getStreamAIE();Bt!==null&&Bt.activateSnapshots(xt)}},{key:"stopAISnapshots",value:function(){var xt=this.getStreamAIE();xt!==null&&xt.stopSnapshots()}},{key:"getStreamAIE",value:function(){var xt=null;if(apiCC!==void 0){var Bt=apiCC.getUserMediaStream(this.userMediaStreamId);if(Bt.mediaFilterManager!==null){var dn=Bt.mediaFilterManager.filters;Object.values(dn).forEach(function(pn){pn.streamAIE!==null&&(xt=pn.streamAIE)}),xt===null&&Yn.error("Applied filter is not an AI filter")}else Yn.error("No filter applied on stream")}return xt}},{key:"addChildren",value:function(xt,Bt){this.childrenTypeExists(Bt)?Yn.error("This stream already has a sub instance running for this"):(this.childrens===void 0&&(this.childrens=[]),this.childrens.push(xt))}},{key:"releaseChildren",value:function(xt){this.childrens!==void 0&&this.childrens.forEach(function(Bt,dn){Bt.childType===xt&&Bt.release({releaseParentStream:!1})})}},{key:"releaseAllChildren",value:function(){Yn.debug("releaseAllChildren"),this.childrens!==void 0&&this.childrens.forEach(function(xt,Bt){xt.release({releaseParentStream:!1})})}},{key:"removeChildren",value:function(xt){var Bt=this;this.childrens!==void 0&&this.childrens.forEach(function(dn,pn){if(dn.childType===xt)return Bt.childrens.splice(pn,1)})}},{key:"childrenTypeExists",value:function(xt){var Bt=!1;return this.childrens!==void 0&&this.childrens.forEach(function(dn){dn.childType===xt&&(Bt=!0)}),Bt}},{key:"createChildStreamFromStream",value:function(xt,Bt){var dn=this,pn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise(function(Xt,Ct){Yn.debug("createChildStreamFromStream");var It={};It.type=et.g.STREAM_TYPE_NO_INPUT,xt.getAudioTracks().length>0&&(It.type=et.g.STREAM_TYPE_AUDIO),xt.getVideoTracks().length>0&&(It.type=et.g.STREAM_TYPE_VIDEO);var Ut=dn;apiRTC.createUserMediaStream({type:"media",stream:xt,success:function(Kt){Yn.debug("[createChildStreamFromStream] success; userMediaStreamId: "+Kt.userMediaStreamId),It.constructor=!0,It.userMediaStreamId=Kt.userMediaStreamId;var Yt=new cm(Kt.stream,It,Ut,Bt);Yt.parentStreamCtx=pn,pn.audioFilterIsApplied===!0&&(Yt.audioFilterIsApplied=pn.audioFilterIsApplied,Yt.audioAppliedFilter=pn.audioAppliedFilter),pn.videoFilterIsApplied===!0&&(Yt.videoFilterIsApplied=pn.videoFilterIsApplied,Yt.videoAppliedFilter=pn.videoAppliedFilter),Xt(Yt)},failure:function(Kt,Yt){Yn.debug("[createChildStreamFromStream] failure :",Yt),Ct()},childStreamType:Bt})})}},{key:"applyMuteStatusFromParent",value:function(){var xt=this,Bt=0;this.data.getAudioTracks().forEach(function(pn){pn.enabled=xt.parent.data.getAudioTracks()[Bt].enabled,Bt++});var dn=0;this.data.getVideoTracks().forEach(function(pn){pn.enabled=xt.parent.data.getVideoTracks()[dn].enabled,dn++})}},{key:"loadTFLiteModule",value:function(){return new Promise(function(xt,Bt){var dn;if(dn=iu.feature.simd?"https://cdn.apizee.com/apiRTC/lib/tflite/tflite-simd.js":"https://cdn.apizee.com/apiRTC/lib/tflite/tflite.js",apiRTC.userAgentInstance.tFLiteModuleLoaded===!1){Yn.debug("loading tflite");var pn={async:!0,numRetries:20,reqdelay:200,success:function(){Yn.debug("loaded successfully",iu.feature.simd),iu.feature.simd?createTFLiteSIMDModule().then(function(Xt){apiRTC.userAgentInstance.tFLiteSIMDModule=Xt,apiRTC.userAgentInstance.tFLiteModuleLoaded=!0,xt(Xt)}):createTFLiteModule().then(function(Xt){apiRTC.userAgentInstance.tFLiteSIMDModule=Xt,apiRTC.userAgentInstance.tFLiteModuleLoaded=!0,xt(Xt)})},error:function(Xt){Bt("Resources loading failed, depsNotFound: "+Xt)},retrycb:function(Xt,Ct){Yn.warn("Blur API module loading retry :"+Xt+" ,delay before retry :"+Ct)}};apiCC.resourcesLoader.loadjs([dn],"blur-api",pn)}else Yn.debug("tflite already loaded and TFLiteSIMDModule already created"),xt(apiRTC.userAgentInstance.tFLiteSIMDModule)})}},{key:"setupTFLiteModule",value:function(xt){return new Promise(function(Bt,dn){Yn.debug("setupTFLiteModule"),apiRTC.userAgentInstance.modelLoadedInModule===!1?(Yn.debug("loading model landscape"),fetch("https://cdn.apizee.com/apiRTC/lib/tflite/models/selfie_segmentation_landscape.tflite").then(function(pn){if(!pn.ok)throw new Error("Failed to download tflite model!");Yn.debug("loaded successfully");var Xt=xt._getModelBufferMemoryOffset();pn.arrayBuffer().then(function(Ct){xt.HEAPU8.set(new Uint8Array(Ct),Xt),xt._loadModel(Ct.byteLength),Yn.debug("module setup complete"),apiRTC.userAgentInstance.modelLoadedInModule=!0,apiRTC.userAgentInstance.tFLiteSIMDModule=xt,Bt(xt)})}).catch(function(pn){Yn.error("Something went wrong during tflite model loading..",pn)})):(Yn.debug("model landscape already loaded in module"),Bt(apiRTC.userAgentInstance.tFLiteSIMDModule))})}},{key:"onMaskFrameTimer",value:function(xt){xt.data.id===this.blurVariables.TIMEOUT_TICK&&this.renderMask()}},{key:"renderMask",value:function(){this.resizeSource(),this.runInference(),this.runPostProcessing(),this.blurVariables.maskFrameTimerWorker.postMessage({id:this.blurVariables.SET_TIMEOUT,timeMs:1e3/30})}},{key:"resizeSource",value:function(){this.blurVariables.segmentationMaskCtx.drawImage(this.blurVariables.inputVideoElement,0,0,this.blurVariables.inputVideoElement.width,this.blurVariables.inputVideoElement.height,0,0,this.blurVariables.width,this.blurVariables.height);for(var xt=this.blurVariables.segmentationMaskCtx.getImageData(0,0,this.blurVariables.width,this.blurVariables.height),Bt=this.blurVariables.tfliteModel._getInputMemoryOffset()/4,dn=0;dn1){var pn=this.blurVariables.virtualImage.height*(this.blurVariables.outputCanvasElement.width/this.blurVariables.outputCanvasElement.height),Xt=this.blurVariables.virtualImage.height,Ct=Math.abs(this.blurVariables.virtualImage.width-pn)/2;pn>this.blurVariables.virtualImage.width&&(pn=this.blurVariables.virtualImage.width,Ct=0),this.blurVariables.outputCanvasCtx.drawImage(this.blurVariables.virtualImage,Ct,0,pn,Xt,0,0,this.blurVariables.outputCanvasElement.width,this.blurVariables.outputCanvasElement.height)}else{var It=this.blurVariables.virtualImage.width,Ut=this.blurVariables.virtualImage.width/(this.blurVariables.outputCanvasElement.width/this.blurVariables.outputCanvasElement.height),Kt=Math.abs(this.blurVariables.virtualImage.height-Ut)/2;Ut>this.blurVariables.virtualImage.height&&(Ut=this.blurVariables.virtualImage.height,Kt=0),this.blurVariables.outputCanvasCtx.drawImage(this.blurVariables.virtualImage,0,Kt,It,Ut,0,0,this.blurVariables.outputCanvasElement.width,this.blurVariables.outputCanvasElement.height)}else this.blurVariables.outputCanvasCtx.filter="blur(15px)",this.blurVariables.outputCanvasCtx.drawImage(this.blurVariables.inputVideoElement,0,0)}},{key:"startSelfieSegmentation",value:function(){var xt=this;return new Promise(function(Bt,dn){Yn.debug("startSelfieSegmentation"),xt.loadTFLiteModule().then(function(pn){xt.setupTFLiteModule(pn).then(function(Xt){if(xt.blurVariables.tfliteModel=Xt,xt.blurVariables.firstVideoTrack=xt.data.getVideoTracks()[0],xt.blurVariables.firstVideoTrack!==null&&xt.blurVariables.firstVideoTrack!==void 0){var Ct=xt.blurVariables.firstVideoTrack.getSettings?xt.blurVariables.firstVideoTrack.getSettings():xt.blurVariables.firstVideoTrack.getConstraints(),It=Ct.height,Ut=Ct.frameRate,Kt=Ct.width;xt.blurVariables.height=144,xt.blurVariables.width=256,xt.blurVariables.frameRate=Ut,xt.blurVariables.segmentationPixelCount=xt.blurVariables.width*xt.blurVariables.height,xt.onMaskFrameTimer=xt.onMaskFrameTimer.bind(xt),xt.blurVariables.outputCanvasElement=document.createElement("canvas"),xt.blurVariables.outputCanvasElement.getContext("2d"),xt.blurVariables.inputVideoElement=document.createElement("video"),xt.blurVariables.SET_TIMEOUT=1,xt.blurVariables.CLEAR_TIMEOUT=2,xt.blurVariables.TIMEOUT_TICK=3,xt.blurVariables.maskFrameTimerWorker=new Worker(URL.createObjectURL(new Blob([` - var timer; - onmessage = function(request) { - switch (request.data.id) { - case `.concat(xt.blurVariables.SET_TIMEOUT,`: { - timer = setTimeout(() => { - postMessage({ id: `).concat(xt.blurVariables.TIMEOUT_TICK,` }); - }, request.data.timeMs); - break; - } - case `).concat(xt.blurVariables.CLEAR_TIMEOUT,`: { - if (timer) { - clearTimeout(timer); - } - break; - } - } - }; - `)],{type:"application/javascript"})),{name:"Blur effect worker"}),xt.blurVariables.maskFrameTimerWorker.onmessage=xt.onMaskFrameTimer,xt.blurVariables.segmentationMask=new ImageData(xt.blurVariables.width,xt.blurVariables.height),xt.blurVariables.segmentationMaskCanvas=document.createElement("canvas"),xt.blurVariables.segmentationMaskCanvas.width=xt.blurVariables.width,xt.blurVariables.segmentationMaskCanvas.height=xt.blurVariables.height,xt.blurVariables.segmentationMaskCtx=xt.blurVariables.segmentationMaskCanvas.getContext("2d"),xt.blurVariables.outputCanvasElement.width=parseInt(Kt,10),xt.blurVariables.outputCanvasElement.height=parseInt(It,10),xt.blurVariables.outputCanvasCtx=xt.blurVariables.outputCanvasElement.getContext("2d"),xt.blurVariables.inputVideoElement.width=parseInt(Kt,10),xt.blurVariables.inputVideoElement.height=parseInt(It,10),xt.blurVariables.inputVideoElement.autoplay=!0,xt.blurVariables.inputVideoElement.srcObject=xt.data,xt.blurVariables.inputVideoElement.onloadeddata=function(){xt.blurVariables.inputVideoElement.muted=!0,xt.blurVariables.maskFrameTimerWorker.postMessage({id:xt.blurVariables.SET_TIMEOUT,timeMs:1e3/30})},Bt(xt.blurVariables.outputCanvasElement.captureStream(parseInt(xt.blurVariables.frameRate,10)))}else dn("No video track on stream")}).catch(function(){return Yn.error("Catch on setupTFLiteModule"),dn("Catch on setupTFLiteModule")})}).catch(function(){return Yn.error("Catch on loadTFLiteModule"),dn("Catch on loadTFLiteModule")})})}},{key:"stopSelfieSegmentation",value:function(){Yn.debug("stopSelfieSegmentation"),this.blurVariables.maskFrameTimerWorker.postMessage({id:this.blurVariables.CLEAR_TIMEOUT}),this.blurVariables.maskFrameTimerWorker.terminate()}},{key:"checkChildTypeConditions",value:function(){return this.childType!==void 0&&this.videoFilterIsApplied?"This stream is already a childStream : need to remove previous applied effect : "+this.childType:this.childrenTypeExists("blur")?"This stream already has a blur sub instance running : need to unblur()":this.childrenTypeExists("backgroundImage")?"This stream already has a backgroundImage sub instance running : need to unBackgroundImage()":MediaStreamTrack.prototype.hasOwnProperty("getSettings")&&MediaStreamTrack.prototype.hasOwnProperty("getConstraints")?"OK":"Navigator not compatible with this function"}},{key:"blur",value:function(){var xt=this;return new Promise(function(Bt,dn){var pn=xt.checkChildTypeConditions();if(pn!=="OK")return dn(pn);if(apiCC.userAgentInstance.getCapabilities().backgroundRemoval==="OFF")return dn("Navigator not compatible with this function");var Xt=xt;xt.blurVariables={},xt.blurVariables.virtualBackground="blur",xt.startSelfieSegmentation().then(function(Ct){var It,Ut=jo(Xt.data.getAudioTracks());try{for(Ut.s();!(It=Ut.n()).done;){var Kt=It.value;Ct.addTrack(Kt.clone())}}catch(en){Ut.e(en)}finally{Ut.f()}var Yt={audioFilterIsApplied:xt.audioFilterIsApplied,audioAppliedFilter:xt.audioAppliedFilter,videoFilterIsApplied:xt.videoFilterIsApplied,videoAppliedFilter:xt.videoAppliedFilter,childType:xt.childType};Xt.createChildStreamFromStream(Ct,"blur",Yt).then(function(en){return xt.addChildren(en,"blur"),en.applyMuteStatusFromParent(),Bt(en)}).catch(function(){return Yn.error("Catch on createChildStreamFromStream blur"),dn("error on createChildStreamFromStream")})}).catch(function(Ct){return Yn.error("Catch on startSelfieSegmentation blur : ",Ct),dn(Ct)})})}},{key:"unblur",value:function(){var xt=this;return new Promise(function(Bt,dn){if(apiCC.userAgentInstance.getCapabilities().backgroundRemoval==="OFF")return dn("Navigator not compatible with this function");if(xt.childType==="blur"){Yn.debug("This is the blurred stream : applying process with parent stream");var pn=xt.parent;return pn.stopSelfieSegmentation(),pn.releaseChildren("blur"),pn.removeChildren("blur"),Bt(pn)}return xt.childrenTypeExists("blur")?(Yn.debug("This is the parent stream : applying process with this stream"),xt.stopSelfieSegmentation(),xt.releaseChildren("blur"),xt.removeChildren("blur"),Bt(xt)):(Yn.debug("No blurred instance found for this stream"),dn("No blurred instance found for this stream"))})}},{key:"backgroundImage",value:function(xt){var Bt=this;return Yn.debug("backgroundImage",xt),new Promise(function(dn,pn){var Xt=Bt.checkChildTypeConditions();if(Xt!=="OK")return pn(Xt);if(apiCC.userAgentInstance.getCapabilities().backgroundRemoval==="OFF")return pn("Navigator not compatible with this function");var Ct=Bt;Bt.blurVariables={},Bt.blurVariables.virtualBackground="image",Bt.blurVariables.virtualImage=new Image,Bt.blurVariables.virtualImage.crossOrigin="anonymous",Bt.blurVariables.virtualImage.src=xt,Bt.blurVariables.virtualImage.onload=function(){Bt.blurVariables.imageRatio=Bt.blurVariables.virtualImage.width/Bt.blurVariables.virtualImage.height,Bt.startSelfieSegmentation().then(function(It){var Ut,Kt=jo(Ct.data.getAudioTracks());try{for(Kt.s();!(Ut=Kt.n()).done;){var Yt=Ut.value;It.addTrack(Yt.clone())}}catch(tn){Kt.e(tn)}finally{Kt.f()}var en={audioFilterIsApplied:Bt.audioFilterIsApplied,audioAppliedFilter:Bt.audioAppliedFilter,videoFilterIsApplied:Bt.videoFilterIsApplied,videoAppliedFilter:Bt.videoAppliedFilter,childType:Bt.childType};Ct.createChildStreamFromStream(It,"backgroundImage",en).then(function(tn){return Bt.addChildren(tn,"backgroundImage"),tn.applyMuteStatusFromParent(),dn(tn)}).catch(function(){return Yn.error("Catch on createChildStreamFromStream bck"),pn("error on createChildStreamFromStream")})}).catch(function(It){return Yn.error("Catch on startSelfieSegmentation bck : ",It),pn(It)})},Bt.blurVariables.virtualImage.onerror=function(){return Yn.debug("Error on image loading"),pn("Error on image loading")}})}},{key:"unBackgroundImage",value:function(){var xt=this;return Yn.debug("unBackgroundImage"),new Promise(function(Bt,dn){if(apiCC.userAgentInstance.getCapabilities().backgroundRemoval==="OFF")return dn("Navigator not compatible with this function");if(xt.childType==="backgroundImage"){Yn.debug("This is the backgroundImage stream : applying process with parent stream");var pn=xt.parent;return pn.stopSelfieSegmentation(),pn.releaseChildren("backgroundImage"),pn.removeChildren("backgroundImage"),Bt(pn)}return xt.childrenTypeExists("backgroundImage")?(Yn.debug("This is the parent stream : applying process with this stream"),xt.stopSelfieSegmentation(),xt.releaseChildren("backgroundImage"),xt.removeChildren("backgroundImage"),Bt(xt)):(Yn.debug("No background image instance found for this stream"),dn("No background image instance found for this stream"))})}},{key:"applyVideoProcessor",value:function(xt,Bt){var dn=this;return new Promise(function(pn,Xt){if(xt!=="none"&&xt!=="blur"&&xt!=="backgroundImage")return Xt(new Yr("Requested videoProcessorType is not correct","none",dn));var Ct=dn,It="none",Ut=null,Kt=dn,Yt=!1;if(dn.childType==="noiseReduction"&&dn.videoFilterIsApplied===!0&&(Yn.debug("This is a noised reduced stream ... applying filter on parent"),Kt=dn.parent,dn.release({releaseParentStream:!1}),Yt=!0),Kt.childType!==void 0&&Kt.videoFilterIsApplied===!0&&(Kt.childType==="blur"?It="blur":Kt.childType==="backgroundImage"&&(It="backgroundImage"),Ct=Kt.parent,Ut=Kt),Kt.childrenTypeExists("blur")&&(It="blur",Kt.childrens.forEach(function(ln){Ut=ln})),Kt.childrenTypeExists("backgroundImage")&&(It="backgroundImage",Kt.childrens.forEach(function(ln){Ut=ln})),Yn.debug("actual applied effect =",It),xt==="none"&&It==="none")return Xt(new Yr("Requested videoProcessorType none and no effect applied","none",Ct));if(xt==="none"&&It==="blur")Yn.debug("need to unblur"),Ct.unblur().then(function(ln){if(Yt!==!0)return pn(ln);ln.startNoiseReduction().then(function(Sn){return pn(Sn)}).catch(function(Sn){return Yn.error("Catch on startNoiseReduction :",Sn),Xt(new Wo(Sn,ln.audioAppliedFilter,Ct))})}).catch(function(ln){return Yn.error("Catch on unblur: ",ln),Xt(new Yr(ln,"none",Ct))});else if(xt==="none"&&It==="backgroundImage")Yn.debug("need to unBackgroundImage"),Ct.unBackgroundImage().then(function(ln){if(Yt!==!0)return pn(ln);ln.startNoiseReduction().then(function(Sn){return pn(Sn)}).catch(function(Sn){return Yn.error("Catch on startNoiseReduction :",Sn),Xt(new Wo(Sn,ln.audioAppliedFilter,Ct))})}).catch(function(ln){return Yn.error("Catch on unBackgroundImage :",ln),Xt(new Yr(ln,"none",Ct))});else if(xt==="blur"&&It==="none")Yn.debug("need to blur"),Ct.blur().then(function(ln){if(Yt!==!0)return pn(ln);ln.startNoiseReduction().then(function(Sn){return pn(Sn)}).catch(function(Sn){return Yn.error("Catch on startNoiseReduction :",Sn),Xt(new Wo(Sn,ln.audioAppliedFilter,Ct))})}).catch(function(ln){return Yn.error("Catch on blur :",ln),Xt(new Yr(ln,"none",Ct))});else{if(xt==="blur"&&It==="blur")return Xt(new Yr("Requested videoProcessorType blur and blur already applied","blur",Ut));if(xt==="blur"&&It==="backgroundImage"){Yn.debug("need to unBackgroundImage then blur");var en=Ct.blurVariables.virtualImage.src;Ct.unBackgroundImage().then(function(ln){ln.blur().then(function(Sn){if(Yt!==!0)return pn(Sn);Sn.startNoiseReduction().then(function(Dn){return pn(Dn)}).catch(function(Dn){return Yn.error("Catch on startNoiseReduction :",Dn),Xt(new Wo(Dn,Sn.audioAppliedFilter,Ct))})}).catch(function(Sn){Yn.warn("Catch on blur - unBackgroundImage to blur :",Sn),Yn.debug("Reactivating previous effect : backgroundImage"),Ct.backgroundImage(en).then(function(Dn){if(Yn.warn("Could not apply blur effect, background restored"),Yt!==!0)return Xt(new Yr("Could not apply blur effect, background restored","backgroundImage",Dn));Dn.startNoiseReduction().then(function(rr){return Xt(new Yr("Could not apply blur effect, background restored","backgroundImage",rr))}).catch(function(rr){return Yn.error("Catch on startNoiseReduction :",rr),Xt(new Yr("Could not apply blur effect, background restored","backgroundImage",Dn))})}).catch(function(Dn){return Yn.error("Could not apply blur effect and error in restoring background :",Dn),Xt(new Yr("Could not apply blur effect and error in restoring background","none",Ct))})})}).catch(function(ln){return Yn.error("Catch on unBackgroundImage :",ln),Xt(new Yr(ln,"none",Ct))})}else if(xt==="backgroundImage"&&It==="none"){if(Yn.debug("need to backgroundImage"),Bt===void 0||Bt.backgroundImageUrl===void 0)return Xt(new Yr("Error options.backgroundImageUrl is not defined","none",Ct));Ct.backgroundImage(Bt.backgroundImageUrl).then(function(ln){if(Yt!==!0)return pn(ln);ln.startNoiseReduction().then(function(Sn){return pn(Sn)}).catch(function(Sn){return Yn.error("Catch on startNoiseReduction :",Sn),Xt(new Yr("Could not apply blur effect, background restored","backgroundImage",ln))})}).catch(function(ln){return Yn.error("Catch on backgroundImage :",ln),Xt(new Yr(ln,"none",Ct))})}else if(xt==="backgroundImage"&&It==="blur")Yn.debug("need to unblur then backgroundImage"),Ct.unblur().then(function(ln){ln.backgroundImage(Bt.backgroundImageUrl).then(function(Sn){if(Yt!==!0)return pn(Sn);Sn.startNoiseReduction().then(function(Dn){return pn(Dn)}).catch(function(Dn){return Yn.error("Catch on startNoiseReduction :",Dn),Xt(new Yr("Could not apply blur effect, background restored","backgroundImage",Sn))})}).catch(function(Sn){Yn.warn("Catch on backgroundImage - unBackgroundImage to blur :",Sn),Yn.debug("Reactivating previous effect : blur"),Ct.blur().then(function(Dn){if(Yt!==!0)return Yn.warn("Could not apply background effect, blur restored"),Xt(new Yr("Could not apply background effect, blur restored","blur",Dn));Dn.startNoiseReduction().then(function(rr){return Xt(new Yr("Could not apply background effect, blur restored","blur",rr))}).catch(function(rr){return Yn.error("Catch on startNoiseReduction :",rr),Xt(new Yr("Could not apply background effect, blur restored","blur",Dn))})}).catch(function(Dn){return Yn.error("Could not apply background effect and error in restoring blur :",Dn),Xt(new Yr("Could not apply background effect and error in restoring blur","none",Ct))})})}).catch(function(ln){return Yn.error("Catch on unblur :",ln),Xt(new Yr(ln,"none",Ct))});else if(xt==="backgroundImage"&&It==="backgroundImage"){var tn=Ct.blurVariables.virtualImage.src;if(Bt.backgroundImageUrl.startsWith("data:image")===!1&&tn.substring(tn.lastIndexOf("/")+1)===Bt.backgroundImageUrl.substring(Bt.backgroundImageUrl.lastIndexOf("/")+1))return Yn.debug("Same background image is already applied"),Xt(new Yr("Requested videoProcessorType backgroundImage and backgroundImage with the same image already applied","backgroundImage",Ut));Yn.debug("New background image is to be applied"),Ct.unBackgroundImage().then(function(ln){ln.backgroundImage(Bt.backgroundImageUrl).then(function(Sn){if(Yt!==!0)return pn(Sn);Sn.startNoiseReduction().then(function(Dn){return pn(Dn)}).catch(function(Dn){return Yn.error("Catch on startNoiseReduction :",Dn),Xt(new Yr("Could not apply background effect, blur restored","blur",Sn))})}).catch(function(Sn){Yn.warn("Catch on backgroundImage - change background image :",Sn),Yn.debug("Reactivating previous effect : backgroundImage"),Ct.backgroundImage(tn).then(function(Dn){if(Yt!==!0)return Xt(new Yr("Could not apply new image on background, former background restored","backgroundImage",Dn));Dn.startNoiseReduction().then(function(rr){return Yn.warn("Could not apply new image on background, former background restored"),Xt(new Yr("Could not apply new image on background, former background restored","backgroundImage",rr))}).catch(function(rr){return Yn.error("Catch on startNoiseReduction :",rr),Xt(new Yr("Could not apply background effect, blur restored","blur",Dn))})}).catch(function(Dn){return Yn.error("Could not apply new image on background and error in restoring former background :",Dn),Xt(new Yr("Could not apply new image on background and error in restoring former background","none",Ct))})})}).catch(function(ln){return Yn.error("Catch on unBackgroundImage :",ln),Xt(new Yr(ln,"none",Ct))})}}})}},{key:"checkAudioProcessorType",value:function(xt){return xt!=="none"&&xt!=="noiseReduction"?"Requested audioProcessorType is not correct":xt==="none"&&this.audioAppliedFilter!=="noiseReduction"?"Not a noised reduction stream":"OK"}},{key:"applyAudioProcessor",value:function(xt){var Bt=this;return new Promise(function(dn,pn){var Xt=Bt,Ct="none",It="none",Ut=Bt.checkAudioProcessorType(xt);if(Ut!=="OK")return pn(new Wo(Ut,Bt.audioAppliedFilter,Bt));if(xt==="none"){if(Bt.childType!=="noiseReduction"&&Bt.parent.childType==="noiseReduction"?(Yn.debug("applying process on parent stream as this one must be a video effect stream"),Xt=Bt.parent,Ct=Bt.childType,Bt.parent.blurVariables!==void 0&&Bt.parent.blurVariables.virtualImage!==void 0&&(It=Bt.parent.blurVariables.virtualImage.src),Bt.release({releaseParentStream:!1})):Yn.debug("no noiseReduction applied"),Xt.stopNoiseReduction(),Ct==="none"){Yn.debug("Release noiseReduction stream");var Kt=Bt.parent;return Xt.release({releaseParentStream:!1}),dn(Kt)}var Yt={backgroundImageUrl:It};Xt.parent.applyVideoProcessor(Ct,Yt).then(function(en){return Yn.debug("Release noiseReduction stream"),Xt.release({releaseParentStream:!1}),dn(en)}).catch(function(en){return Yn.error("Catch on applyVideoProcessor() - reapply effect : ",en),pn(new Wo("Error on restoring applied video filter",this.audioAppliedFilter,this))})}else xt==="noiseReduction"&&Xt.startNoiseReduction().then(function(en){return dn(en)}).catch(function(en){return Yn.error("Catch on startNoiseReduction :",en),pn(new Wo(en,Xt.audioAppliedFilter,Xt))})})}},{key:"startNoiseReduction",value:function(){return apiCC.audioProcessor.startNoiseReduction(this)}},{key:"stopNoiseReduction",value:function(){apiCC.audioProcessor.stopAudioNodeCtx(this.parent.nodeCtx)}},{key:"createMediaStreamTrackProcessor",value:function(){var xt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(Yn.debug("mediaStreamTrackProcessor kind: ".concat(xt?"audio":"video"," created")),xt){var Bt=this.data.getAudioTracks();if(Bt.length)return new MediaStreamTrackProcessor({track:Bt[0]});throw new Error("No audio tracks found")}var dn=this.data.getVideoTracks();if(dn.length)return new MediaStreamTrackProcessor({track:dn[0]});throw new Error("No video tracks found")}},{key:"createMediaStreamTrackGenerator",value:function(){var xt=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return Yn.debug("mediaStreamTrackGenerator kind: ".concat(xt?"audio":"video"," created")),xt?new MediaStreamTrackGenerator({kind:"audio"}):new MediaStreamTrackGenerator({kind:"video"})}},{key:"loadSegmentationAPI",value:function(){return new Promise(function(xt,Bt){var dn={async:!0,numRetries:20,reqdelay:200,success:function(){Yn.debug("Segmentation API loaded"),mergeReality.then(xt)},error:function(pn){Bt("Resources loading failed, depsNotFound: "+pn)},retrycb:function(pn,Xt){Yn.warn("Blur API model loading retry :"+pn+" ,delay before retry :"+Xt)}};apiCC.resourcesLoader.loadjs(["https://cdn.apizee.com/apiRTC/lib/mergereality/v1.0/merge_reality.js"],"merge-reality",dn)})}},{key:"startMergeReality",value:function(xt){var Bt=this;this.mergeRealityData={},this.mergeRealityLib=xt,this.mergeRealityData.stop=!1,this.mergeRealityData.WIDTH=this.getSettings().width,this.mergeRealityData.HEIGHT=this.getSettings().height,this.mergeRealityData.WEBCAM_CANVAS=new OffscreenCanvas(this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT),this.mergeRealityData.WEBCAM_CTX=this.mergeRealityData.WEBCAM_CANVAS.getContext("2d",{alpha:!1}),this.mergeRealityData.MASK_CANVAS=new OffscreenCanvas(this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT),this.mergeRealityData.MASK_CTX=this.mergeRealityData.MASK_CANVAS.getContext("2d",{alpha:!0}),this.mergeRealityData.SCREEN_VIDEO=document.createElement("video"),this.mergeRealityData.BG_SUB=new this.mergeRealityLib.BackgroundSubtractor,this.mergeRealityData.background=new this.mergeRealityLib.BackgroundImage(this.mergeRealityData.WEBCAM_CTX.getImageData(0,0,this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT),this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT),this.mergeRealityData.MSTP=this.createMediaStreamTrackProcessor().readable,this.mergeRealityData.MSTG=this.createMediaStreamTrackGenerator(),this.mergeRealityData.SINK=this.mergeRealityData.MSTG.writable,this.mergeRealityData.MASK_TRANSFORMER=new TransformStream({transform:function(dn,pn){Bt.mergeRealityData.stop||(Bt.mergeRealityData.MASK_CTX.save(),Bt.mergeRealityData.MASK_CTX.clearRect(0,0,Bt.mergeRealityData.WIDTH,Bt.mergeRealityData.HEIGHT),Bt.mergeRealityData.WEBCAM_CTX.clearRect(0,0,Bt.mergeRealityData.WIDTH,Bt.mergeRealityData.HEIGHT),Bt.mergeRealityData.WEBCAM_CTX.drawImage(dn,0,0),Bt.mergeRealityData.MASK_DATA=Bt.mergeRealityData.BG_SUB.computeMask(Bt.mergeRealityData.WEBCAM_CTX.getImageData(0,0,Bt.mergeRealityData.WIDTH,Bt.mergeRealityData.HEIGHT),Bt.mergeRealityData.background),Bt.mergeRealityData.RES=Bt.mergeRealityData.BG_SUB.applyTransparency(Bt.mergeRealityData.WEBCAM_CTX.getImageData(0,0,Bt.mergeRealityData.WIDTH,Bt.mergeRealityData.HEIGHT),Bt.mergeRealityData.MASK_DATA),Bt.mergeRealityData.MASK_CTX.putImageData(Bt.mergeRealityData.RES,0,0),Bt.mergeRealityData.MASK_CTX.globalCompositeOperation="destination-atop",Bt.mergeRealityData.MASK_CTX.drawImage(Bt.mergeRealityData.SCREEN_VIDEO,0,0,Bt.mergeRealityData.WIDTH,Bt.mergeRealityData.HEIGHT),Bt.mergeRealityData.MASK_CTX.restore(),pn.enqueue(new VideoFrame(Bt.mergeRealityData.MASK_CANVAS))),dn.close()}}),this.mergeRealityData.RES_MS=new MediaStream}},{key:"stopMergeReality",value:function(){this.mergeRealityData.stop=!0}},{key:"calibrateBackground",value:function(){this.childrenTypeExists("merge")?this.mergeRealityData.background=new this.mergeRealityLib.BackgroundImage(this.mergeRealityData.WEBCAM_CTX.getImageData(0,0,this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT),this.mergeRealityData.WIDTH,this.mergeRealityData.HEIGHT):Yn.error("No merged instance found for this stream")}},{key:"mergeReality",value:function(xt){var Bt=this;return new Promise(function(dn,pn){return window.MediaStreamTrackGenerator===void 0||window.MediaStreamTrackProcessor===void 0||window.TransformStream===void 0?pn("Your browser does not support InsertableStreams"):Bt.childrenTypeExists("merge")?pn("This stream already has a sub instance running for this"):void Bt.loadSegmentationAPI().then(function(Xt){Bt.startMergeReality(Xt),xt.attachToElement(Bt.mergeRealityData.SCREEN_VIDEO),Bt.mergeRealityData.SCREEN_VIDEO.autoplay=!0,Bt.mergeRealityData.MSTP.pipeThrough(Bt.mergeRealityData.MASK_TRANSFORMER).pipeTo(Bt.mergeRealityData.SINK),Bt.mergeRealityData.RES_MS.addTrack(Bt.mergeRealityData.MSTG);var Ct,It=jo(Bt.data.getAudioTracks());try{for(It.s();!(Ct=It.n()).done;){var Ut=Ct.value;Bt.mergeRealityData.RES_MS.addTrack(Ut)}}catch(en){It.e(en)}finally{It.f()}var Kt=Bt,Yt={audioFilterIsApplied:Bt.audioFilterIsApplied,audioAppliedFilter:Bt.audioAppliedFilter,videoFilterIsApplied:Bt.videoFilterIsApplied,videoAppliedFilter:Bt.videoAppliedFilter,childType:Bt.childType};Bt.createChildStreamFromStream(Bt.mergeRealityData.RES_MS,"merge",Yt).then(function(en){Kt.addChildren(en,"merge"),en.applyMuteStatusFromParent(),dn(en)}).catch(function(){Yn.error("Catch on createChildStreamFromStream mergeReality")})})})}},{key:"unmergeReality",value:function(){this.childrenTypeExists("merge")?(this.stopMergeReality(),this.releaseChildren("merge"),this.removeChildren("merge")):Yn.error("No merged instance found for this stream")}},{key:"addPendingPromise",value:function(xt,Bt,dn){var pn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5e3;return apiCC.addPendingPromise(xt,Bt,dn,pn)}},{key:"resolvePendingPromise",value:function(xt,Bt){apiCC.resolvePendingPromise(xt,Bt)}},{key:"rejectPendingPromise",value:function(xt,Bt){apiCC.rejectPendingPromise(xt,Bt)}},{key:"sendAudioFlowStatusChanged",value:function(){var xt=this.getAudioFlowStatus();zt.get(this).emit("audioFlowStatusChanged",xt)}},{key:"sendVideoFlowStatusChanged",value:function(){var xt=this.getVideoFlowStatus();zt.get(this).emit("videoFlowStatusChanged",xt)}},{key:"sendFlowStatusChanged",value:function(xt){var Bt;xt==="audio"?Bt=this.getAudioFlowStatus():xt==="video"&&(Bt=this.getVideoFlowStatus()),Bt.type=xt,zt.get(this).emit("flowStatusChanged",Bt)}},{key:"sendFlowStatusChangedForRemote",value:function(xt,Bt){Bt.type=xt,zt.get(this).emit("flowStatusChanged",Bt)}},{key:"sendRemoteAudioFlowStatusChanged",value:function(xt){zt.get(this).emit("remoteAudioFlowStatusChanged",xt)}},{key:"sendRemoteVideoFlowStatusChanged",value:function(xt){zt.get(this).emit("remoteVideoFlowStatusChanged",xt)}},{key:"emitConstraintsChanged",value:function(xt){zt.get(this).emit("constraintsChanged",xt)}}],[{key:"getAvailableEvents",value:function(){return lm}},{key:"createStreamFromUserMedia",value:function(xt,Bt,dn){var pn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Yn.debug("createStreamFromUserMedia"),Yn.debug("audioInput :",xt),Yn.debug("videoInput :",Bt),Yn.debug("constraints :",dn),Yn.debug("options :",pn),new Promise(function(Xt,Ct){var It=xt!==!1&&(xt!==null||dn===void 0||dn!==void 0&&dn.hasOwnProperty("audio")),Ut=Bt!==!1&&(Bt!==null||dn===void 0||dn!==void 0&&dn.hasOwnProperty("video")),Kt={type:et.g.STREAM_TYPE_NO_INPUT,audioInput:xt,videoInput:Bt},Yt="media";Ut?Kt.type=et.g.STREAM_TYPE_VIDEO:It&&(Kt.type=et.g.STREAM_TYPE_AUDIO),It&&!Ut?Yt="audio":!It&&Ut&&(Yt="videoOnly"),It&&pn.enhancedAudioActivated===!0&&(Yn.debug("Enhanced Audio is activated"),apiRTC.browser!=="Chrome"?Yn.debug("enhancedAudioActivated option is only available for Chrome"):(dn===void 0&&(dn={}),dn.audio&&ss(dn.audio)==="object"||(dn.audio={}),dn.video===void 0&&(dn.video={}),dn.audio.echoCancellation=!1,dn.audio.autoGainControl=!1,dn.audio.noiseSuppression=!1)),apiRTC.createUserMediaStream({audioSourceId:xt,videoSourceId:Bt,facingMode:pn.facingMode,gum_config:dn,filters:pn.filters,type:Yt,success:function(en){Yn.debug("[createStreamFromUserMedia] success; userMediaStreamId: "+en.userMediaStreamId),Kt.constructor=!0,Kt.userMediaStreamId=en.userMediaStreamId,Xt(new Zt(en.stream,Kt))},failure:function(en,tn){Yn.debug("[createStreamFromUserMedia] failure :",tn),Ct(tn)}})})}},{key:"createStreamFromMediaStream",value:function(xt){return Yn.debug("createStreamFromMediaStream"),new Promise(function(Bt,dn){var pn={};pn.type=et.g.STREAM_TYPE_NO_INPUT,xt.getAudioTracks().length>0&&(pn.type=et.g.STREAM_TYPE_AUDIO),xt.getVideoTracks().length>0&&(pn.type=et.g.STREAM_TYPE_VIDEO),apiRTC.createUserMediaStream({type:"media",stream:xt,success:function(Xt){Yn.debug("[createStreamFromUserMedia] success; userMediaStreamId: "+Xt.userMediaStreamId),pn.constructor=!0,pn.userMediaStreamId=Xt.userMediaStreamId,Bt(new Zt(Xt.stream,pn))},failure:function(Xt,Ct){Yn.debug("[createStreamFromUserMedia] failure :",Ct),dn()}})})}},{key:"createScreensharingStream",value:function(xt){return new Promise(function(Bt,dn){apiRTC.createUserMediaStream({type:"screenSharing",captureSourceType:xt,success:function(pn){Yn.debug("[createStreamFromUserMedia] success; userMediaStreamId: "+pn.userMediaStreamId);var Xt=new Zt(pn.stream,{constructor:!0,type:et.g.STREAM_TYPE_VIDEO,userMediaStreamId:pn.userMediaStreamId});qs.set(Xt,!0),Bt(Xt)},failure:function(pn,Xt){Yn.debug("[createStreamFromUserMedia] failure :",Xt),dn(Xt)}})})}},{key:"createDisplayMediaStream",value:function(xt,Bt){return new Promise(function(dn,pn){apiRTC.createUserMediaStream({type:"screenSharing",captureSourceType:xt,displayMediaStreamConstraints:xt,forceExtensionOnChrome:Bt,success:function(Xt){Yn.debug("[createStreamFromUserMedia] success; userMediaStreamId: "+Xt.userMediaStreamId);var Ct=new Zt(Xt.stream,{constructor:!0,type:et.g.STREAM_TYPE_VIDEO,userMediaStreamId:Xt.userMediaStreamId});qs.set(Ct,!0),dn(Ct)},failure:function(Xt,Ct){Yn.debug("[createStreamFromUserMedia] failure :",Ct),pn(Ct)}})})}},{key:"getLocalStreams",value:function(){return yo.values()}},{key:"getStream",value:function(xt){return xt!=null&&yo.has(xt.toString())?yo.get(xt.toString()):null}}]),Zt}(un),cm=function(Wt){Ks(Zt,Wt);var $t=Ys(Zt);function Zt(xt,Bt,dn,pn){var Xt;return zs(this,Zt),(Xt=$t.call(this,xt,Bt)).parent=dn,Xt.childType=pn,pn==="noiseReduction"&&(Xt.audioFilterIsApplied=!0,Xt.audioAppliedFilter=pn),pn!=="blur"&&pn!=="backgroundImage"||(Xt.videoFilterIsApplied=!0,Xt.videoAppliedFilter=pn),Xt}return Gs(Zt,[{key:"release",value:function(xt){this.childType!=="blur"&&this.childType!=="backgroundImage"||this.parent.stopSelfieSegmentation(),this.parent.removeChildren(this.childType),this.clonedStream!==void 0&&(Yn.debug("to be released ..."),this.clonedStream.getAudioTracks().forEach(function(Bt){Bt.stop()}),this.clonedStream.getVideoTracks().forEach(function(Bt){Bt.stop()})),ou(Fo(Zt.prototype),"release",this).call(this,xt)}}]),Zt}(so),Yr=function(Wt){Ks(Zt,Wt);var $t=Ys(Zt);function Zt(xt,Bt,dn){var pn;return zs(this,Zt),(pn=$t.call(this,xt)).name=pn.constructor.name,pn.appliedVideoProcessorType=Bt,pn.stream=dn,pn}return Gs(Zt)}(Hs(Error)),Wo=function(Wt){Ks(Zt,Wt);var $t=Ys(Zt);function Zt(xt,Bt,dn){var pn;return zs(this,Zt),(pn=$t.call(this,xt)).name=pn.constructor.name,pn.appliedAudioProcessorType=Bt,pn.stream=dn,pn}return Gs(Zt)}(Hs(Error));function Js(Wt,$t){var Zt=typeof Symbol<"u"&&Wt[Symbol.iterator]||Wt["@@iterator"];if(!Zt){if(Array.isArray(Wt)||(Zt=function(Ct,It){if(Ct){if(typeof Ct=="string")return tp(Ct,It);var Ut=Object.prototype.toString.call(Ct).slice(8,-1);return Ut==="Object"&&Ct.constructor&&(Ut=Ct.constructor.name),Ut==="Map"||Ut==="Set"?Array.from(Ct):Ut==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ut)?tp(Ct,It):void 0}}(Wt))||$t&&Wt&&typeof Wt.length=="number"){Zt&&(Wt=Zt);var xt=0,Bt=function(){};return{s:Bt,n:function(){return xt>=Wt.length?{done:!0}:{done:!1,value:Wt[xt++]}},e:function(Ct){throw Ct},f:Bt}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dn,pn=!0,Xt=!1;return{s:function(){Zt=Zt.call(Wt)},n:function(){var Ct=Zt.next();return pn=Ct.done,Ct},e:function(Ct){Xt=!0,dn=Ct},f:function(){try{pn||Zt.return==null||Zt.return()}finally{if(Xt)throw dn}}}}function tp(Wt,$t){($t==null||$t>Wt.length)&&($t=Wt.length);for(var Zt=0,xt=new Array($t);Zt<$t;Zt++)xt[Zt]=Wt[Zt];return xt}function np(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}var ho=ft.Y.get("Session"),dm=Rn.get(),xo=new(Go()),cu=Ro.get(),du=po.get(),um=Symbol("ENTERPRISE_NOT_LOADED"),uu=Symbol("ENTERPRISE_LOADED"),rp=new WeakMap,ip=new WeakMap,ap=new WeakMap,Xs=function(){function Wt(Bt,dn,pn){if(function(Xt,Ct){if(!(Xt instanceof Ct))throw new TypeError("Cannot call a class as a function")}(this,Wt),ho.info("Create Enterprise"),!(pn instanceof zr))throw"Cannot create Enterprise without a session";rp.set(this,pn),ap.set(this,dn),ip.set(this,Bt),this.status=um}var $t,Zt,xt;return $t=Wt,Zt=[{key:"getSession",value:function(){return rp.get(this)}},{key:"getId",value:function(){return ip.get(this).toString()}},{key:"getApiKey",value:function(){return ap.get(this).toString()}},{key:"load",value:function(){var Bt=this;return new Promise(function(dn,pn){xo.getEnterpriseUserList(Bt.getId(),Bt.getSession().getToken()).then(function(Xt){ho.info("Enterprise loaded!",Xt);var Ct,It=Js(Xt.users);try{for(It.s();!(Ct=It.n()).done;){var Ut=Ct.value;if(Bt.getSession().user.userId.toString()!==Ut.id.toString()){var Kt=cu.getOrCreateContact(Ut.id);Kt.profile=Ut,Kt.enterprise=Bt,Kt.userData.get("username")===null&&Kt.userData.setProp("username",Ut.username),Kt.userData.get("photo_url")===null&&Kt.userData.setProp("photo_url",Ut.photo_url)}}}catch(Yt){It.e(Yt)}finally{It.f()}Bt.status=uu,dn()}).catch(function(Xt){var Ct="load() - Enterprise load error",It={error:new Error(Ct),code:et.g.ERROR_OTHER};Xt.hasOwnProperty("code")?It.code=Xt.code:Xt.hasOwnProperty("http_code")&&(Xt.http_code.toString().startsWith("4")?It.code=et.g.ERROR_INVALID_CREDENTIALS:It.code=et.g.ERROR_SERVER_UNAVAILABLE),ho.error(Ct,Xt),pn(It)})})}},{key:"getContacts",value:function(){var Bt={};if(this.status!==uu)ho.error("Enterprise is not loaded, unable to getContacts");else{var dn,pn=cu.getContacts(),Xt=Js(pn.keys());try{for(Xt.s();!(dn=Xt.n()).done;){var Ct=dn.value,It=pn.get(Ct);It.enterprise!==null&&It.enterprise.id.toString()===this.getId()&&(Bt[It.getId()]=It)}}catch(Ut){Xt.e(Ut)}finally{Xt.f()}}return Bt}},{key:"getConfiguration",value:function(){return null}},{key:"uploadFile",value:function(Bt){var dn=this,pn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(Xt,Ct){ho.info("uploadFile()"),dn.status===uu?xo.uploadFile(Bt,dn.getSession().getToken(),pn).then(function(It){Xt(It.url)}).catch(function(It){ho.error(It),Ct(It)}):(ho.error("Enterprise is not loaded, cannot upload file"),Ct(new Error("Enterprise is not loaded, cannot upload file")))})}},{key:"getAvailableConferences",value:function(){var Bt=this;return ho.info("getAvailableConferences()"),new Promise(function(dn,pn){var Xt={};xo.getConferenceList(Bt.getSession().getToken()).then(function(Ct){var It,Ut=Js(Ct);try{for(Ut.s();!(It=Ut.n()).done;){var Kt=It.value;Xt[Kt.hash]=du.getOrCreateConference(Kt.hash),Xt[Kt.hash].friendlyName=Kt.friendlyName}}catch(Yt){Ut.e(Yt)}finally{Ut.f()}dn(Xt)}).catch(function(Ct){ho.error(Ct),pn(Ct)})})}},{key:"getConference",value:function(Bt){var dn=this;return new Promise(function(pn,Xt){var Ct={};Ct.token=dn.getSession().getToken(),xo.getWebconf(Bt,Ct).then(function(It){return pn(du.getOrCreateConference(It.hash))}).catch(function(It){return ho.error("getConference",It),Xt(It)})})}},{key:"createPrivateConference",value:function(){var Bt=this,dn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ho.info("createPrivateConference()"),new Promise(function(pn,Xt){var Ct=dn.hasOwnProperty("friendlyName")?dn.friendlyName:Dt.g.guid(),It=null,Ut=Bt.getSession().getToken();xo.createConference(Ut,Ct,dn).then(function(Kt){(It=du.getOrCreateConference(Kt.hash)).friendlyName=Ct;var Yt=dn.hasOwnProperty("password")?dn.password:"";return It.join({password:Yt,session:Bt.getSession()})}).then(function(){pn(It)}).catch(function(Kt){var Yt="createPrivateConference() - Could not create conference";ho.error(Yt,Kt),Xt(new Error(Yt))})})}},{key:"getTags",value:function(Bt){var dn=this;return new Promise(function(pn,Xt){var Ct={};Bt&&Bt.hasOwnProperty("webconfId")&&(Ct.webconfId=Bt.webconfId),xo.getEnterpriseTagList(dn.getId(),dn.getSession().getToken(),Ct).then(function(It){return It.hasOwnProperty("tags")&&Array.isArray(It.tags)?pn(It.tags):Xt(Dt.g.createError(et.g.ERROR_OTHER,"getTags() - unexpected response",ho))}).catch(function(It){return Xt(Dt.g.createError(et.g.ERROR_OTHER,"getTags() - cannot get tags",ho,{fromError:It}))})})}}],xt=[{key:"fetchEnterpriseInformation",value:function(Bt){var dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return dn.hasOwnProperty("cloudUrl")&&xo.setCloudURL(dn.cloudUrl),xo.getEnterpriseInformation(dn,Bt)}},{key:"fetchSiteAgents",value:function(Bt){var dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(pn,Xt){dn.hasOwnProperty("cloudUrl")&&xo.setCloudURL(dn.cloudUrl);var Ct=[];xo.getSiteAgents(dm.getActiveApiKey(),Bt,dn).then(function(It){var Ut,Kt=Js(It);try{for(Kt.s();!(Ut=Kt.n()).done;){var Yt=Ut.value;Ct.push({contact:cu.getOrCreateContact(Yt.id),title:Yt.title,nickname:Yt.nickname,isPrefered:Yt.isPrefered})}}catch(en){Kt.e(en)}finally{Kt.f()}pn(Ct)}).catch(function(It){Xt(Dt.g.createError(et.g.ERROR_OTHER,"fetchSiteAgents() - could not fetch site agents",ho))})})}}],Zt&&np($t.prototype,Zt),xt&&np($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}();function pu(Wt){return pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},pu(Wt)}function pm(Wt,$t){if(!(Wt instanceof $t))throw new TypeError("Cannot call a class as a function")}function op(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}function fu(Wt,$t){return fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(Zt,xt){return Zt.__proto__=xt,Zt},fu(Wt,$t)}function fm(Wt,$t){if($t&&(pu($t)==="object"||typeof $t=="function"))return $t;if($t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bo(Wt)}function Bo(Wt){if(Wt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Wt}function Qs(Wt){return Qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function($t){return $t.__proto__||Object.getPrototypeOf($t)},Qs(Wt)}s(3123);var yr=ft.Y.get("UserAgent"),Rr=Rn.get(),ko=new(Go()),hm="apizee:",gm="apirtc:",mm="token:",vm="apzkey:",Cm="apiKey:",us=new WeakMap,bm=["mediaDeviceChanged","externalJsLoadingStatus","ccsConnectionStatus","userMediaError"],sp=function(Wt){(function(Ct,It){if(typeof It!="function"&&It!==null)throw new TypeError("Super expression must either be null or a function");Ct.prototype=Object.create(It&&It.prototype,{constructor:{value:Ct,writable:!0,configurable:!0}}),Object.defineProperty(Ct,"prototype",{writable:!1}),It&&fu(Ct,It)})(Xt,Wt);var $t,Zt,xt,Bt,dn,pn=(Bt=Xt,dn=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ct,It=Qs(Bt);if(dn){var Ut=Qs(this).constructor;Ct=Reflect.construct(It,arguments,Ut)}else Ct=It.apply(this,arguments);return fm(this,Ct)});function Xt(){var Ct,It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pm(this,Xt),Ct=pn.call(this,yr),yr.debug("Create UserAgent"),Ct.uri=It.hasOwnProperty("uri")?It.uri:null,Ct.userId=null,Ct.username=null,Ct.profile=null,Ct.preRegisterUserData=new Io,Ct.callStatsMonitoringEnabled=null,Ct.callStatsMonitoringInterval=null,Ct.meshModeEnabled=null,Ct.apiRTCMediaDeviceDetectionEnabled=!!It.hasOwnProperty("apiRTCMediaDeviceDetectionEnabled")&&It.apiRTCMediaDeviceDetectionEnabled,Ct.apiRTCMediaDeviceDetectionDelay=It.hasOwnProperty("apiRTCMediaDeviceDetectionDelay")?It.apiRTCMediaDeviceDetectionDelay:et.g.APIRTC_MEDIA_DEVICE_DETECTION_DELAY,Ct.targetBandwidthUsage=0,Ct.videoBandwidthSettings={overallIncoming:3e3,overallOutgoing:3e3},Ct.currentSession=null,Ct.enterprise=null,Ct.capabilities={whiteboardCursor:"ON",mediaDeviceChanged:"ON",webRTCCompliant:"ON",screenSharingCompliant:"ON",qoSStatCompliant:"ON",backgroundRemoval:"ON",streamCapabilities:"ON",noiseReduction:"ON",remoteAccessUser:"ON"},Ct.browser=apiRTC.browser,Ct.browser_major_version=apiRTC.browser_major_version,Ct.browser_version=apiRTC.browser_version,Ct.osName=apiRTC.osName,Ct.osVersion=apiRTC.osVersion,Ct.browserInfo=apiRTC.browserInfo,Ct.browserDetails=apiRTC.browserDetails,Ct.tFLiteModuleLoaded=!1,Ct.tFLiteSIMDModule=null,Ct.modelLoadedInModule=!1,Ct.apiRTCStreamsList=new Map,us.set(Bo(Ct),null),Rr.createWhiteBoard(),apiCC.activateScreenSharing();var Ut=function(tn){zt.get(Bo(Ct)).emit("mediaDeviceChanged",{added:tn.detail.diff.added,removed:tn.detail.diff.removed,updated:tn.detail.diff.updated,updateReason:tn.detail.updateReason,firstMediaDeviceListInitialization:tn.detail.firstMediaDeviceListInitialization})};apiRTC.addEventListener("mediaDeviceChanged",Ut,"UserAgent");var Kt=function(tn){zt.get(Bo(Ct)).emit("externalJsLoadingStatus",{extjs:tn.detail.extjs,status:tn.detail.status})};apiRTC.addEventListener("externalJsLoadingStatus",Kt,"UserAgent");var Yt=function(tn){var ln=null;tn.detail.channelEvent==="onChannelOpened"?ln="connected":tn.detail.channelEvent==="onChannelDisconnect"?ln="disconnected":tn.detail.channelEvent==="onChannelReconnecting"?ln="retry":(tn.detail.channelEvent==="onChannelConnectError"||tn.detail.channelEvent==="onChannelError")&&(ln="error"),ln!==null&&zt.get(Bo(Ct)).emit("ccsConnectionStatus",{status:ln})};apiRTC.addEventListener("channelEvent",Yt,"UserAgent");var en=function(tn){var ln={error:tn.detail.error};tn.detail.callType==="media"?(ln.audio=!0,ln.video=!0,ln.screenSharing=!1):tn.detail.callType==="audio"?(ln.audio=!0,ln.video=!1,ln.screenSharing=!1):tn.detail.callType==="videoOnly"?(ln.audio=!1,ln.video=!0,ln.screenSharing=!1):tn.detail.callType==="screenSharing"?(ln.audio=!1,ln.video=!0,ln.screenSharing=!0):tn.detail.callType==="screenSharingWithAudio"&&(ln.audio=!0,ln.video=!0,ln.screenSharing=!0),zt.get(Bo(Ct)).emit("userMediaError",ln)};return apiRTC.addEventListener("userMediaError",en,"UserAgent"),Ct.checkUACapabilities(),Ct.capabilities.mediaDeviceChanged==="OFF"&&(yr.debug("mediaDeviceChanged is not supported"),Ct.apiRTCMediaDeviceDetectionEnabled===!0&&(yr.debug("apiRTCMediaDeviceDetectionEnabled is activated, starting process"),setInterval(function(){apiCC.mediaDeviceMgr.getMediaDevices()},Ct.apiRTCMediaDeviceDetectionDelay))),apiRTC.userAgentInstance=Bo(Ct),Ct}return $t=Xt,Zt=[{key:"fetchUserMediaDevices",value:function(){return yr.warn("DEPRECATION WARNING : fetchUserMediaDevices() is now deprecated, use getUserMediaDevices() instead"),new Promise(function(Ct,It){apiCC.browser==="IE"&&apiCC.browser_version>8?(apiCC.getMediaDevicesWithCB(apiCC.mediaDeviceMgr.gotSources),Ct(apiCC.mediaDeviceMgr.mediaDeviceSourceInfosArray)):apiCC.getMediaDevices().then(function(Ut){apiCC.mediaDeviceMgr.gotSources(Ut),Ct(apiCC.mediaDeviceMgr.mediaDeviceSourceInfosArray)}).catch(function(){yr.log("Error on MediaDeviceManager::getMediaDevices"),apiCC.mediaDeviceMgr.gotSources(null),It(Dt.g.createError(et.g.ERROR_OTHER,"fetchUserMediaDevices() - Could not get media devices",yr))})})}},{key:"getUserMediaDevices",value:function(){return apiCC.mediaDeviceMgr.mediaDeviceSourceInfosArray}},{key:"createStream",value:function(){var Ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return yr.info("createStream() with option :",Ct),so.createStreamFromUserMedia(Ct.audioInputId,Ct.videoInputId,Ct.constraints,Ct)}},{key:"createStreamFromMediaStream",value:function(Ct){return yr.info("createStreamFromMediaStream()"),so.createStreamFromMediaStream(Ct)}},{key:"fetchNetworkInformation_v2",value:function(Ct,It){yr.debug("fetchNetworkInformation Version 2 :",Ct);var Ut=ko.cloudUrl;Ct!=null&&(Ut=Ct);var Kt={testServer:Ut,httpPing:{},upload:{},download:{}};return It!=null&&Array.isArray(It)?(apiRTC.bandwidthRatingThresholds=It,yr.debug("New bandwidthRatingThresholds is defined :",apiRTC.bandwidthRatingThresholds)):yr.debug("Using default bandwidthRatingThresholds :",apiRTC.bandwidthRatingThresholds),apiRTC.bandwidthTestServer=Ut,yr.info("Start Network test"),new Promise(function(Yt,en){apiRTC.testUserPing(function(tn,ln){tn!==null?en(tn):(Kt.httpPing=ln,apiRTC.testUserUpload(25e4,function(Sn,Dn){Sn!==null?en(Sn):(Kt.upload.kbps=8*Dn.kBPerSec,Kt.upload.rating=Dn.rating,apiRTC.testUserUploadLoop(5e5,Kt.upload,function(rr,ar){rr!==null?en(rr):(Kt.upload.kbps=8*ar.kBPerSec,Kt.upload.rating=ar.rating,apiRTC.testUserDownload(256,function(hr,vr){hr!==null?en(hr):(Kt.download.kbps=8*vr.kBPerSec,Kt.download.rating=vr.rating,apiRTC.testUserDownloadLoop(1e3,Kt.download,function(Pr,Zr){Pr!==null?en(Pr):(Kt.download.kbps=8*Zr.kBPerSec,Kt.download.rating=Zr.rating,Yt(Kt))}))}))}))}))})})}},{key:"fetchNetworkInformation_v1",value:function(Ct,It){yr.debug("fetchNetworkInformation Version 1 :",Ct);var Ut=ko.cloudUrl;Ct!=null&&(Ut=Ct);var Kt={testServer:Ut,httpPing:{},upload:{},download:{}};return It!=null&&Array.isArray(It)?(apiRTC.bandwidthRatingThresholds=It,yr.debug("New bandwidthRatingThresholds is defined :",apiRTC.bandwidthRatingThresholds)):yr.debug("Using default bandwidthRatingThresholds :",apiRTC.bandwidthRatingThresholds),apiRTC.bandwidthTestServer=Ut,yr.info("Start Network test"),new Promise(function(Yt,en){apiRTC.testUserPing(function(tn,ln){tn!==null?en(tn):(Kt.httpPing=ln,apiRTC.testUserUpload(25e4,function(Sn,Dn){Sn!==null?en(Sn):(Kt.upload.kbps=8*Dn.kBPerSec,Kt.upload.rating=Dn.rating,Kt.upload.kbps>=1e3&&apiRTC.testUserUpload(5e5,function(rr,ar){rr!==null?en(rr):(Kt.upload.kbps=8*ar.kBPerSec,Kt.upload.rating=ar.rating)}),apiRTC.testUserDownload(256,function(rr,ar){rr!==null?en(rr):(Kt.download.kbps=8*ar.kBPerSec,Kt.download.rating=ar.rating,Kt.download.kbps>=500&&Kt.download.kbps<1500?apiRTC.testUserDownload(500,function(hr,vr){hr!==null?en(hr):(Kt.download.kbps=8*vr.kBPerSec,Kt.download.rating=vr.rating,Yt(Kt))}):Kt.download.kbps>=1500?apiRTC.testUserDownload(768,function(hr,vr){hr!==null?en(hr):(Kt.download.kbps=8*vr.kBPerSec,Kt.download.rating=vr.rating,Yt(Kt))}):Yt(Kt))}))}))})})}},{key:"fetchNetworkInformation",value:function(Ct,It){return this.fetchNetworkInformation_v1(Ct,It)}},{key:"fetchGeolocationInformation",value:function(Ct){return Ct==null&&(Ct={enableHighAccuracy:!1,timeout:1/0,maximumAge:0}),new Promise(function(It,Ut){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(Kt){It(Kt)},function(Kt){Ut(Kt)},Ct)})}},{key:"setUserData",value:function(Ct){this.currentSession&&this.currentSession.setUserData(Ct)}},{key:"setUsername",value:function(Ct){this.currentSession?this.currentSession.setUsername(Ct):this.preRegisterUserData.setProp("username",Ct)}},{key:"setPhotoUrl",value:function(Ct){this.currentSession?this.currentSession.setPhotoUrl(Ct):this.preRegisterUserData.setProp("photo_url",Ct)}},{key:"getUserData",value:function(){return this.currentSession?this.currentSession.getUserData():this.preRegisterUserData}},{key:"getUsername",value:function(){return this.currentSession?this.currentSession.getUsername():this.preRegisterUserData.get("username")!==null?this.preRegisterUserData.get("username"):this.preRegisterUserData.get("nickname")!==null?this.preRegisterUserData.get("nickname"):this.username}},{key:"getPhotoUrl",value:function(){return this.currentSession?this.currentSession.getPhotoUrl():this.preRegisterUserData.get("photo_url")!==null?this.preRegisterUserData.get("photo_url"):this.preRegisterUserData.get("photoUrl")!==null?this.preRegisterUserData.get("photoUrl"):null}},{key:"fetchProfileInformation",value:function(Ct){var It=this,Ut=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return new Promise(function(Kt,Yt){var en=null;It.profile===null||Ut?It.userId&&(en=Rr.getActiveApiKey())!==null?ko.getUserProfile(en,It.userId,Ct).then(function(tn){It.profile=tn,Kt(tn)}).catch(Yt):Yt("fetchProfileInformation() - missing registration"):Kt(It.profile)})}},{key:"getEnterprise",value:function(){return us.get(this)}},{key:"getCurrentSession",value:function(){return this.currentSession}},{key:"getEventCenter",value:function(){return apiRTC.eventCenter}},{key:"startWhiteboard",value:function(Ct,It){yr.trace("startWhiteboard()"),Rr.whiteBoardClient.start(),Rr.whiteBoardClient.setCanvas(Ct),It!=null&&Rr.whiteBoardClient.setUserCursorColor(It)}},{key:"stopWhiteboard",value:function(){yr.trace("stopWhiteboard()"),Rr.whiteBoardClient.stop()}},{key:"getWhiteboardClient",value:function(){return yr.trace("getWhiteboardClient()"),Rr.whiteBoardClient}},{key:"register",value:function(){var Ct=this,It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(Ut,Kt){if(yr.info("Register "+Ct.uri),It.hasOwnProperty("uri")&&(Ct.uri=It.uri),It.hasOwnProperty("cloudUrl")&&ko.setCloudURL(It.cloudUrl),It.hasOwnProperty("cloudFetchRetries")&&ko.setFetchRetries(It.cloudFetchRetries),It.hasOwnProperty("cloudFetchRetryDelay")&&ko.setFetchRetryDelay(It.cloudFetchRetryDelay),Ct.uri!==null)if(Ct.currentSession)Kt(Dt.g.createError(et.g.ERROR_APIRTC_SESSION_ALREADY_ON,"register() - Session already ON",yr));else if(Ct.uri.startsWith(mm))Sm(Ct,It,Ut,Kt);else if(Ct.uri.startsWith(hm)||Ct.uri.startsWith(gm))ym(Ct,It,Ut,Kt);else if(Ct.uri.startsWith(vm)||Ct.uri.startsWith(Cm))Tm(Ct,It,Ut,Kt);else{var Yt=Ct.uri.split(":")[0];Kt(Dt.g.createError(et.g.ERROR_REGISTRATION_URI_INVALID,"register() - prefix invalid used for uri :"+Yt,yr))}else Kt(Dt.g.createError(et.g.ERROR_REGISTRATION_URI_INVALID,"register() - Cannot register UserAgent, no uri was specified",yr))})}},{key:"unregister",value:function(){var Ct=this,It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{invalidateUserToken:!0,unregister:!0};return new Promise(function(Ut,Kt){Ct.currentSession!==null?Ct.currentSession.disconnect(It).then(function(){Ct.currentSession=null,us.set(Ct,null),Ut()}).catch(function(Yt){Kt(Dt.g.createError(et.g.ERROR_OTHER,"unregister() - unregistration error",yr))}):Kt(Dt.g.createError(et.g.ERROR_OTHER,"unregister() - no current session",yr))})}},{key:"isRegistered",value:function(){return this.currentSession!==null}},{key:"getDefaultDevices",value:function(){return{audioInput:apiCC.mediaDeviceMgr.defaultAudioInput,audioOutput:apiCC.mediaDeviceMgr.defaultAudioOuput,videoInput:apiCC.mediaDeviceMgr.defaultVideoInput}}},{key:"enableCallStatsMonitoring",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};["chrome","firefox","safari"].indexOf(apiCC.browserDetails.type)<0?yr.warn("enableCallStatsMonitoring() is only supported on Chrome, Firefox and Safari, support on other browsers will be added soon"):Ct===!0?(this.callStatsMonitoringEnabled=!0,Dt.g.isPropertyTypeof(It,"interval","number")&&It.interval>=1e3&&(this.callStatsMonitoringInterval=It.interval),this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.enableCallStatsMonitoring(!0,this.callStatsMonitoringInterval)):(this.callStatsMonitoringEnabled=!1,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.enableCallStatsMonitoring(!1))}},{key:"enableActiveSpeakerDetecting",value:function(Ct){var It=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ct===!0?Dt.g.isPropertyTypeof(It,"threshold","number")&&It.threshold>0?apiRTC.enableActiveSpeakerDetecting(!0,It.threshold):apiRTC.enableActiveSpeakerDetecting(!0):apiRTC.enableActiveSpeakerDetecting(!1)}},{key:"enableMeshRoomMode",value:function(Ct){Ct===!1||Ct===!0?(this.meshModeEnabled=Ct,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.enableMeshRoomMode(Ct)):yr.error("Wrong value",Ct)}},{key:"setTargetBandwidthUsage",value:function(Ct){typeof Ct!="number"&&!isNaN(Ct)&&Ct>0?(this.targetBandwidthUsage=Ct,this.isRegistered&&Rr.webRTCClient.setVideoBandwidth(Ct)):yr.error("Unvalid target bandwidth usage value",Ct)}},{key:"setOverallIncomingVideoBandwidth",value:function(Ct){Ct>0?(this.videoBandwidthSettings.overallIncoming=Ct,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setOverallIncomingVideoBandwidth(Ct)):(delete this.videoBandwidthSettings.overallIncoming,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setOverallIncomingVideoBandwidth(0))}},{key:"setOverallOutgoingVideoBandwidth",value:function(Ct){Ct>0?(this.videoBandwidthSettings.overallOutgoing=Ct,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setOverallOutgoingVideoBandwidth(Ct)):(delete this.videoBandwidthSettings.overallOutgoing,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setOverallOutgoingVideoBandwidth(0))}},{key:"setPerCallIncomingVideoBandwidth",value:function(Ct){Ct>0?(this.videoBandwidthSettings.perCallIncoming=Ct,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setPerCallIncomingVideoBandwidth(Ct)):(delete this.videoBandwidthSettings.perCallIncoming,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setPerCallIncomingVideoBandwidth(0))}},{key:"setPerCallOutgoingVideoBandwidth",value:function(Ct){Ct>0?(this.videoBandwidthSettings.perCallOutgoing=Ct,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setPerCallOutgoingVideoBandwidth(Ct)):(delete this.videoBandwidthSettings.perCallOutgoing,this.isRegistered&&Rr.webRTCClient&&Rr.webRTCClient.setPerCallOutgoingVideoBandwidth(0))}},{key:"updateMediaOnCall",value:function(Ct,It){Rr.webRTCClient.updateMediaDeviceOnCall(Ct,It)}},{key:"getCapabilities",value:function(){return this.capabilities}},{key:"getBrowser",value:function(){return this.browser}},{key:"getBrowserMajorVersion",value:function(){return this.browser_major_version}},{key:"getBrowserVersion",value:function(){return this.browser_version}},{key:"getOsName",value:function(){return this.osName}},{key:"getOsVersion",value:function(){return this.osVersion}},{key:"getBrowserInfo",value:function(){return this.browserInfo}},{key:"getBrowserDetails",value:function(){return this.browserDetails}},{key:"getCPUArchitecture",value:function(){return this.getUserData().cpuArchitecture}},{key:"getDeviceVendor",value:function(){return this.getUserData().deviceVendor}},{key:"getDeviceModel",value:function(){return this.getUserData().deviceModel}},{key:"getEngineName",value:function(){return this.getUserData().engineName}},{key:"getEngineVersion",value:function(){return this.getUserData().engineVersion}},{key:"checkUACapabilities",value:function(){yr.debug("checkUACapabilities"),apiRTC.osName==="iOS"&&(yr.debug("Deactivating whiteboardCursor for iOS"),this.capabilities.whiteboardCursor="OFF"),apiRTC.osName==="Android"&&apiRTC.browser==="Chrome"&&(yr.debug("mediaDeviceChanged not supported on Chrome/Android"),this.capabilities.mediaDeviceChanged="OFF"),pt.Xh!=="Safari"&&pt.Xh!=="Mobile Safari"||(yr.debug("mediaDeviceChanged not supported on Safari"),this.capabilities.mediaDeviceChanged="OFF"),apiRTC.webRTCCompliant===!1&&(yr.debug("WebRTC not compliant"),this.capabilities.webRTCCompliant="OFF"),apiRTC.screenSharingCompliant===!1&&(yr.debug("screenSharing not compliant"),this.capabilities.screenSharingCompliant="OFF"),apiRTC.qoSStatCompliant===!1&&(yr.debug("qoS Stat not compliant"),this.capabilities.qoSStatCompliant="OFF"),pt.Xh!=="Safari"&&pt.Xh!=="Mobile Safari"||(yr.debug("background removal not compliant"),this.capabilities.backgroundRemoval="ON",yr.debug("noiseReduction not compliant"),this.capabilities.noiseReduction="OFF"),"getCapabilities"in MediaStreamTrack.prototype||(yr.debug("Stream capabilities not compliant"),this.capabilities.streamCapabilities="OFF"),(apiRTC.osName!=="Windows"&&apiRTC.osVersion!=="10"||apiRTC.osName!=="Windows"&&apiRTC.osVersion!=="11")&&(yr.debug("remoteAccessUser not compliant"),this.capabilities.remoteAccessUser="OFF")}},{key:"startPrecallTest",value:function(Ct,It,Ut,Kt,Yt){Rr.webRTCClient.startPrecallTest(Ct,It,Ut,Kt,Yt)}},{key:"sendLogToCloud",value:function(Ct,It,Ut,Kt){apiCC.sendLogToCloud(Ct,It,Ut,Kt)}},{key:"getStreamWithRoomNameAndCallId",value:function(Ct,It){yr.debug("getStreamWithRoomNameAndCallId");var Ut="NOT_FOUND";return apiRTC.userAgentInstance.apiRTCStreamsList.forEach(function(Kt){var Yt=0;if((Yt=Kt.publishedInConversations.get(Ct))!==void 0&&Yt.toString()===It.toString())return yr.debug(" Stream is found"),Ut=Kt;yr.debug(" This is not the stream")}),Ut}},{key:"getStreamWithMediaStreamId",value:function(Ct){yr.debug("getStreamWithMediaStreamId");var It="NOT_FOUND";return apiRTC.userAgentInstance.apiRTCStreamsList.forEach(function(Ut){if(Ut.data.id===Ct.toString())return yr.debug(" Stream is found"),It=Ut;yr.debug(" This is not the stream")}),It}}],xt=[{key:"getAvailableEvents",value:function(){return bm}}],Zt&&op($t.prototype,Zt),xt&&op($t,xt),Object.defineProperty($t,"prototype",{writable:!1}),Xt}(un),ym=function(Wt,$t,Zt,xt){var Bt=Wt.uri.split(":");yr.debug("register() - Registration using prefix :"+Bt[0]);var dn=Bt[1];$t.password!==null&&typeof $t.password=="string"?ko.authentication(dn,$t.password,$t.captcha_token).then(function(pn){return lp(Wt,pn.token,$t)}).then(function(pn){Zt(pn)}).catch(function(pn){yr.error("registerPrefixApizee err : ",pn.message);var Xt="register() - An error occured during cloud credentials registration :"+JSON.stringify(pn),Ct=pn;Ct.message=Xt,pn.hasOwnProperty("code")?Ct.code=pn.code:pn.hasOwnProperty("http_code")&&(pn.http_code.toString().startsWith("4")?Ct.code=et.g.ERROR_INVALID_CREDENTIALS:Ct.code=et.g.ERROR_SERVER_UNAVAILABLE),xt(Ct)}):xt(Dt.g.createError(et.g.ERROR_INVALID_CREDENTIALS,"register() - No password was specified for apizee: UserAgent registration",yr))},Sm=function(Wt,$t,Zt,xt){yr.debug("register() - Registration using prefix :token:");var Bt=Wt.uri.split(":")[1];ko.checkUserToken(Bt).then(function(dn){return lp(Wt,Bt,$t)}).then(Zt).catch(function(dn){xt(Dt.g.createError(et.g.ERROR_OTHER,"register() - An error occured during cloud token registration",yr))})},Tm=function(Wt,$t,Zt,xt){var Bt=Wt.uri.split(":");yr.debug("register() - Registration using prefix :"+Bt[0]);var dn=Bt[1];if(!dn||typeof dn!="string")return xt(Dt.g.createError(et.g.ERROR_OTHER,"register() - Wrong apiKey",yr));new Promise(function(pn,Xt){ko.getPreferredCCS(dn).then(function(Ct){$t.ccs&&$t.ccs!==Ct.ccs&&(yr.debug("Overloading CCS address with init option"),Ct.ccs=$t.ccs),pn(Ct)}).catch(function(){Xt(Dt.g.createError(et.g.ERROR_OTHER,"register() - Could not get preferred CCS",yr))})}).then(function(pn){Wt.currentSession=new zr(Wt),Wt.currentSession.user=Wt,Wt.currentSession.token=null,Dt.g.isPropertyTypeof($t,"nickname","string")?Wt.username=$t.nickname:Wt.username="guest-"+Dt.g.guid().substr(0,13),Wt.preRegisterUserData.setProp("username",Wt.username),Wt.preRegisterUserData.setProp("userConfId",Wt.username+Date.now()),$t.userData&&Wt.preRegisterUserData.setProps($t.userData);var Xt={apiKey:dn,MCUActivated:!0,mcu:$t.hasOwnProperty("mcu")?$t.mcu:et.g.DEFAULT_MCU,nickname:Wt.username,ccsServer:pn.ccs,bandwidthTestServer:ko.cloudUrl,webRTCPluginActivated:!0,userData:Wt.preRegisterUserData,tryAudioCallAfterUserMediaError:!0,extJsLoadingRetryNb:$t.extJsLoadingRetryNb,extJsLoadingRetryDelay:$t.extJsLoadingRetryDelay,ccsConnectionRetryNb:$t.ccsConnectionRetryNb,ccsConnectionRetryDelay:$t.ccsConnectionRetryDelay,turnServerAddress:$t.turnServerAddress,userAcceptOnIncomingDataCall:$t.userAcceptOnIncomingDataCall,userAcceptOnIncomingScreenSharingCall:$t.userAcceptOnIncomingScreenSharingCall,cloudIsSecured:pn.secure};return $t.hasOwnProperty("id")&&(Xt.apiCCId=$t.id),Dt.g.isPropertyTypeof($t,"idPersistenceTimeout","number")&&$t.idPersistenceTimeout>=0&&(Xt.apiCCIdPersistenceTimeout=$t.idPersistenceTimeout),$t.hasOwnProperty("groups")&&(Xt.presenceGroup=$t.groups),$t.hasOwnProperty("subscribeTo")&&(Xt.subscribeToPresenceGroup=$t.subscribeTo),$t.hasOwnProperty("contactDisconnectionDelay")&&(yr.debug("Setting contactDisconnectionDelay :",$t.contactDisconnectionDelay),Rr.contactDisconnectionDelay=$t.contactDisconnectionDelay),Xt.idConversionActivated=!1,$t.hasOwnProperty("idConversionActivated")&&(Xt.idConversionActivated=$t.idConversionActivated),$t.hasOwnProperty("conversationSpace")&&(Xt.conversationSpace=$t.conversationSpace),$t.hasOwnProperty("token")&&(Xt.token=$t.token,Wt.currentSession.ccsToken=$t.token),Rr.initializeApiRTC(Xt)}).then(function(pn){Wt.callStatsMonitoringEnabled!==!1&&Wt.callStatsMonitoringEnabled!==!0||Rr.webRTCClient.enableCallStatsMonitoring(Wt.callStatsMonitoringEnabled,Wt.callStatsMonitoringInterval),Wt.meshModeEnabled!==!1&&Wt.meshModeEnabled!==!0||Rr.webRTCClient.enableMeshRoomMode(Wt.meshModeEnabled),Wt.targetBandwidthUsage>0&&Rr.webRTCClient.setVideoBandwidth(Wt.targetBandwidthUsage),Wt.videoBandwidthSettings.overallIncoming>0&&Rr.webRTCClient.setOverallIncomingVideoBandwidth(Wt.videoBandwidthSettings.overallIncoming),Wt.videoBandwidthSettings.overallOutgoing>0&&Rr.webRTCClient.setOverallOutgoingVideoBandwidth(Wt.videoBandwidthSettings.overallOutgoing),Wt.videoBandwidthSettings.perCallIncoming>0&&Rr.webRTCClient.setPerCallIncomingVideoBandwidth(Wt.videoBandwidthSettings.perCallIncoming),Wt.videoBandwidthSettings.perCallOutgoing>0&&Rr.webRTCClient.setPerCallOutgoingVideoBandwidth(Wt.videoBandwidthSettings.perCallOutgoing),Wt.userId=pn,Wt.currentSession.init(pn),yr.log("register() - APIRTC init OK",pn),Rr.apiRTCSession.userData!==void 0&&Rr.apiRTCSession.userData!==null&&(Wt.currentSession.userData=new Io(Rr.apiRTCSession.userData)),Zt(Wt.currentSession)}).catch(function(pn){xt(Dt.g.createError(et.g.ERROR_APIRTC_INITIALISATION_FAILED,"register() - ApiRTC Initialization error : "+pn,yr)),delete Wt.currentSession,Wt.currentSession=null})},lp=function(Wt,$t){var Zt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},xt=null,Bt=null;return yr.debug("initializeCloudUASession :",Zt),new Promise(function(dn,pn){ko.getConnectedUserInformation($t).then(function(Xt){if(Bt=Xt,yr.debug("Connected user information : ",Xt),Wt.currentSession=new zr(Wt),Wt.currentSession.user=Wt,Wt.currentSession.token=Xt.token,Zt.hasOwnProperty("idPersistenceTimeout")&&(Wt.currentSession.idPersistenceTimeout=Zt.idPersistenceTimeout),Wt.username=Xt.nickname,Wt.preRegisterUserData.setProp("username",Wt.username),Wt.preRegisterUserData.setProp("nickname",Wt.username),Wt.preRegisterUserData.setProp("photo_url",Xt.photo_url),Xt.mail&&Wt.preRegisterUserData.setProp("mail",Xt.mail),Wt.preRegisterUserData.setProp("userConfId",Wt.username+Date.now()),Zt.userData&&Wt.preRegisterUserData.setProps(Zt.userData),!Zt.hasOwnProperty("overLoadedApiRTCKey")||Zt.overLoadedApiRTCKey===null||Zt.overLoadedApiRTCKey===void 0||Xt.apiKey===Zt.overLoadedApiRTCKey)return Wt.userId=Xt.userId,xt=new Xs(Xt.enterpriseId,Xt.apiKey,Wt.currentSession),us.set(Wt,xt),xt.load();yr.debug("overLoadedApiRTCKey is defined :",Zt.overLoadedApiRTCKey),xt=new Xs(Xt.enterpriseId,Zt.overLoadedApiRTCKey,Wt.currentSession),delete Zt.id,Wt.userId=null,us.set(Wt,xt),yr.debug("... no enterprise users data loading")}).then(function(){var Xt={apiKey:xt.getApiKey(),ccsServer:Zt.ccs||Bt.ccs,MCUActivated:!0,mcu:Zt.hasOwnProperty("mcu")?Zt.mcu:et.g.DEFAULT_MCU,nickname:Wt.username,bandwidthTestServer:ko.cloudUrl,webRTCPluginActivated:!0,apiCCId:Zt.hasOwnProperty("id")?Zt.id:Wt.userId,userData:Wt.preRegisterUserData,tryAudioCallAfterUserMediaError:!0,presenceGroup:["agent"],subscribeToPresenceGroup:["agent","visitor"],extJsLoadingRetryNb:Zt.extJsLoadingRetryNb,extJsLoadingRetryDelay:Zt.extJsLoadingRetryDelay,ccsConnectionRetryNb:Zt.ccsConnectionRetryNb,ccsConnectionRetryDelay:Zt.ccsConnectionRetryDelay,turnServerAddress:Zt.turnServerAddress,userAcceptOnIncomingDataCall:Zt.userAcceptOnIncomingDataCall,userAcceptOnIncomingScreenSharingCall:Zt.userAcceptOnIncomingScreenSharingCall};return Dt.g.isPropertyTypeof(Zt,"idPersistenceTimeout","number")&&Zt.idPersistenceTimeout>=0&&(Xt.apiCCIdPersistenceTimeout=Zt.idPersistenceTimeout),Zt.hasOwnProperty("groups")&&(Xt.presenceGroup=Zt.groups),Zt.hasOwnProperty("subscribeTo")&&(Xt.subscribeToPresenceGroup=Zt.subscribeTo),Zt.hasOwnProperty("contactDisconnectionDelay")&&(yr.debug("Setting contactDisconnectionDelay :",Zt.contactDisconnectionDelay),Rr.contactDisconnectionDelay=Zt.contactDisconnectionDelay),Xt.idConversionActivated=!1,Zt.hasOwnProperty("idConversionActivated")&&(Xt.idConversionActivated=Zt.idConversionActivated),Zt.hasOwnProperty("conversationSpace")&&(Xt.conversationSpace=Zt.conversationSpace),Rr.initializeApiRTC(Xt)}).then(function(Xt){Wt.callStatsMonitoringEnabled!==!1&&Wt.callStatsMonitoringEnabled!==!0||Rr.webRTCClient.enableCallStatsMonitoring(Wt.callStatsMonitoringEnabled,Wt.callStatsMonitoringInterval),Wt.meshModeEnabled!==!1&&Wt.meshModeEnabled!==!0||Rr.webRTCClient.enableMeshRoomMode(Wt.meshModeEnabled),Wt.targetBandwidthUsage>0&&Rr.webRTCClient.setVideoBandwidth(Wt.targetBandwidthUsage),Wt.videoBandwidthSettings.overallIncoming>0&&Rr.webRTCClient.setOverallIncomingVideoBandwidth(Wt.videoBandwidthSettings.overallIncoming),Wt.videoBandwidthSettings.overallOutgoing>0&&Rr.webRTCClient.setOverallOutgoingVideoBandwidth(Wt.videoBandwidthSettings.overallOutgoing),Wt.videoBandwidthSettings.perCallIncoming>0&&Rr.webRTCClient.setPerCallIncomingVideoBandwidth(Wt.videoBandwidthSettings.perCallIncoming),Wt.videoBandwidthSettings.perCallOutgoing>0&&Rr.webRTCClient.setPerCallOutgoingVideoBandwidth(Wt.videoBandwidthSettings.perCallOutgoing),Wt.currentSession.init(Xt),yr.info("APIRTC init OK",Xt),Rr.apiRTCSession.userData!==void 0&&Rr.apiRTCSession.userData!==null&&(Wt.currentSession.userData=new Io(Rr.apiRTCSession.userData)),dn(Wt.currentSession)}).catch(function(Xt){yr.error(Xt),pn(Xt)})})};function Im(Wt,$t){for(var Zt=0;Zt<$t.length;Zt++){var xt=$t[Zt];xt.enumerable=xt.enumerable||!1,xt.configurable=!0,"value"in xt&&(xt.writable=!0),Object.defineProperty(Wt,xt.key,xt)}}var Xo=ft.Y.get("ResourcesLoader"),Rm=function(){function Wt(){(function(xt,Bt){if(!(xt instanceof Bt))throw new TypeError("Cannot call a class as a function")})(this,Wt),this.loadedJsLinks=[]}var $t,Zt;return $t=Wt,Zt=[{key:"loadjs",value:function(xt){function Bt(dn,pn,Xt){return xt.apply(this,arguments)}return Bt.toString=function(){return xt.toString()},Bt}(function(xt,Bt,dn){var pn=this;Xo.info("Load js resources",xt),Xo.debug("Already loaded js",this.loadedJsLinks);var Xt=dn.success;if((xt=xt.filter(function(Ct){return!pn.loadedJsLinks.includes(Ct)})).length===0)return Xo.debug("Skip resources loading, all resources previously loaded"),void(Xt instanceof Function&&Xt());Xo.debug("Filtered resources to load",xt),dn.success=function(){pn.loadedJsLinks.push.apply(pn.loadedJsLinks,xt),Xt instanceof Function&&Xt()},_e(xt,Bt,dn)})},{key:"unloadjs",value:function(xt){var Bt=this;Xo.info("Unload js",xt),xt.forEach(function(dn){var pn=document.querySelector('script[src="'+dn+'"]');pn!==void 0&&(pn.remove(),Bt.loadedJsLinks=Bt.loadedJsLinks.filter(function(Xt){return Xt!==dn}))}),Xo.debug("Scripts unloaded, currently loaded js",this.loadedJsLinks)}},{key:"reset",value:function(){unloadjs(this.loadedJsLinks),this.loadedJsLinks=[]}}],Zt&&Im($t.prototype,Zt),Object.defineProperty($t,"prototype",{writable:!1}),Wt}(),Dr=ft.Y.get("Init"),xa=ft.Y.get("MediaDeviceManager");function hu(Wt){return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($t){return typeof $t}:function($t){return $t&&typeof Symbol=="function"&&$t.constructor===Symbol&&$t!==Symbol.prototype?"symbol":typeof $t},hu(Wt)}rt=s.hmd(rt),console!=null&&(typeof apiRTC_React<"u"?console.info&&console.info("Loading APIRTC_REACT_NATIVE_MODULE"):console.info&&console.info("Loading APIRTC_MODULE")),window.Prototype&&delete Array.prototype.toJSON;var cp=new(Go());vt.version="5.0.19",vt.utils={},vt.eventCenter=new wt,vt.resourcesLoader=new Rm;for(var gu=0,dp=Object.keys(et.g);gu8?apiCC.getMediaDevicesWithCB(apiCC.mediaDeviceMgr.gotSources):apiCC.getMediaDevices().then(function($t){apiCC.mediaDeviceMgr.gotSources($t,Wt)}).catch(function(){xa.log("Error on MediaDeviceManager::getMediaDevices"),apiCC.mediaDeviceMgr.gotSources(null,Wt)})},this.getMediaDeviceListsDiff=function(Wt,$t){$t!==void 0&&$t||($t={}),Wt!==void 0&&Wt||(Wt={});for(var Zt=[],xt=[],Bt=[],dn=0,pn=Object.keys($t);dn0?Zt:null,removed:Object.keys(xt).length>0?xt:null,updated:Object.keys(Bt).length>0?Bt:null}}},vt.mediaDeviceMgr.getMediaDevices(),vt.webRTCCompliant=vt.isWebRTCCompliant(),vt.qoSStatCompliant=vt.isQoSStatCompliant(),vt.screenSharingCompliant=vt.isScreenSharingCompliant());const Em=apiRTC},1549:(rt,it,s)=>{s.d(it,{Y:()=>mt}),s(6992),s(1532),s(1539),s(8783),s(3948),s(2772),s(4916),s(5306),s(2222),s(8733),s(3710),s(3161),s(9653),s(9070),s(9753),s(2526),s(1817),s(2165),s(1038),s(7042),s(8309);var et=s(3173);function nt(ot){return function(pt){if(Array.isArray(pt))return at(pt)}(ot)||function(pt){if(typeof Symbol<"u"&&pt[Symbol.iterator]!=null||pt["@@iterator"]!=null)return Array.from(pt)}(ot)||function(pt,ft){if(pt){if(typeof pt=="string")return at(pt,ft);var yt=Object.prototype.toString.call(pt).slice(8,-1);return yt==="Object"&&pt.constructor&&(yt=pt.constructor.name),yt==="Map"||yt==="Set"?Array.from(pt):yt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(yt)?at(pt,ft):void 0}}(ot)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function at(ot,pt){(pt==null||pt>ot.length)&&(pt=ot.length);for(var ft=0,yt=new Array(pt);ftC:")===-1?ot[pt]="invite C->S: without candidate":ot[pt]="invite S->C: without candidate":ot[pt].indexOf("S->C:")===-1?ot[pt]="invite C->S: with candidate":ot[pt]="invite S->C: with candidate":ot[pt].indexOf('"type":"200OK"')!==-1?ot[pt].indexOf("candidate")===-1?ot[pt].indexOf("S->C:")===-1?ot[pt]="200OK C->S: without candidate":ot[pt]="200OK S->C: without candidate":ot[pt].indexOf("S->C:")===-1?ot[pt]="200OK C->S: with candidate":ot[pt]="200OK S->C: with candidate":ot[pt].indexOf('"type":"candidate"')!==-1&&(ot[pt].indexOf("S->C:")===-1?(ft=ot[pt].replace(/C->S: /g,""),yt=JSON.parse(ft),ot[pt]="candidate C->S:"+yt.candidate):(ft=ot[pt].replace(/onChannelMessage S->C: /g,""),yt=JSON.parse(ft),ot[pt]="candidate S->C:"+yt.candidate)));return ot},mt=function(){function ot(vt){if(function(bt,At){if(!(bt instanceof At))throw new TypeError("Cannot call a class as a function")}(this,ot),dt.has(vt))throw new Error("Cannot construct singleton Logger");this.category=vt,dt.set(vt,this)}var pt,ft,yt;return pt=ot,ft=[{key:"trace",value:function(){for(var vt=arguments.length,bt=new Array(vt),At=0;At1?bt-1:0),Nt=1;Nt{s.d(it,{g:()=>et}),s(2526),s(1817),s(1539);var et={LOG_PREFIX:"apiRTC",LOG_LEVEL_OFF:0,LOG_LEVEL_ERROR:1,LOG_LEVEL_WARN:2,LOG_LEVEL_INFO:3,LOG_LEVEL_DEBUG:4,LOG_LEVEL_TRACE:5,LOG_LEVEL_LABELS:{}};et.LOG_LEVEL_LABELS[et.LOG_LEVEL_ERROR]="ERROR",et.LOG_LEVEL_LABELS[et.LOG_LEVEL_WARN]="WARN",et.LOG_LEVEL_LABELS[et.LOG_LEVEL_INFO]="INFO",et.LOG_LEVEL_LABELS[et.LOG_LEVEL_DEBUG]="DEBUG",et.LOG_LEVEL_LABELS[et.LOG_LEVEL_TRACE]="TRACE",et.ERROR_OTHER=0,et.ERROR_INVALID_CREDENTIALS=1,et.ERROR_NETWORK_UNAVAILABLE=2,et.ERROR_SERVER_UNAVAILABLE=3,et.ERROR_UNAUTHORIZED=4,et.ERROR_APIRTC_INITIALISATION_FAILED=5,et.ERROR_APIRTC_SESSION_ALREADY_ON=6,et.ERROR_REGISTRATION_URI_INVALID=7,et.ERROR_NOT_FOUND=8,et.ERROR_BAD_PARAMETER=9,et.ERROR_INVITATION_STATE_INVALID=10,et.ERROR_TIMED_OUT=11,et.ERROR_STREAM_RECORD=12,et.ERROR_HTTP=13,et.ERROR_NOT_ALLOWED=14,et.ERROR_OPERATION_CANCELED=15,et.ERROR_WRONG_STATE=16,et.MEDIA_TYPE_PHOTO=0,et.MEDIA_TYPE_VIDEO=1,et.MEDIA_TYPE_AUDIO=2,et.MEDIA_TYPE_DOC=3,et.CONTACT_SEND_DATA_IDENTIFIER="contact_data",et.CONTACT_NEW_MEDIA_IDENTIFIER="contact_new_media",et.CONTACT_SEND_FILEINFO_IDENTIFIER="contact_file_info",et.CONTACT_DATACHANNEL_INVITATION="contact_datachannel_invitation",et.CONTACT_EVENTCENTER_DATA_REQUEST="contact_event_center_data_request",et.CONTACT_EVENTCENTER_DATA_ANSWER="contact_event_center_data_answer",et.CONTACT_GET_CAPABILITIES_IDENTIFIER="contact_get_capabilities",et.CONTACT_GET_CAPABILITIES_RESULT_IDENTIFIER="contact_get_capabilities_result",et.CONTACT_GET_SETTINGS_IDENTIFIER="contact_get_settings",et.CONTACT_GET_SETTINGS_RESULT_IDENTIFIER="contact_get_settings_result",et.CONTACT_GET_CONSTRAINTS_IDENTIFIER="contact_get_constraints",et.CONTACT_GET_CONSTRAINTS_RESULT_IDENTIFIER="contact_get_constraints_result",et.CONTACT_CHANGED_CONSTRAINTS_IDENTIFIER="contact_changed_constraints",et.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_IDENTIFIER="contact_get_remote_audio_flow_status",et.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_IDENTIFIER="contact_get_remote_video_flow_status",et.CONTACT_GET_REMOTE_AUDIO_FLOW_STATUS_RESULT_IDENTIFIER="contact_get_remote_audio_flow_status_result",et.CONTACT_GET_REMOTE_VIDEO_FLOW_STATUS_RESULT_IDENTIFIER="contact_get_remote_video_flow_status_result",et.CONTACT_GET_REMOTE_ERROR="contact_get_remote_error",et.CONTACT_APPLY_CONSTRAINTS_IDENTIFIER="contact_apply_constraints_identifier",et.CONTACT_APPLY_CONSTRAINTS_RESULT_IDENTIFIER="contact_apply_constraints_result_identifier",et.CONTACT_DISABLE_AUDIO_REQUEST="contact_disable_audio_request",et.CONTACT_DISABLE_AUDIO_ANSWER="contact_disable_audio_answer",et.CONTACT_ENABLE_AUDIO_REQUEST="contact_enable_audio_request",et.CONTACT_ENABLE_AUDIO_ANSWER="contact_enable_audio_answer",et.CONTACT_DISABLE_VIDEO_REQUEST="contact_disable_video_request",et.CONTACT_DISABLE_VIDEO_ANSWER="contact_disable_video_answer",et.CONTACT_ENABLE_VIDEO_REQUEST="contact_enable_video_request",et.CONTACT_ENABLE_VIDEO_ANSWER="contact_enable_video_answer",et.CONTACT_STREAM_UPDATED_INFO="contact_stream_updated_info",et.CONTACT_REMOTEACCESS_INVITATION_IDENTIFIER="contact_remote_access_invite",et.CONTACT_REMOTEACCESS_ANSWER_IDENTIFIER="contact_remote_access_answer",et.CONTACT_REMOTEACCESS_STOP_IDENTIFIER="contact_remote_access_stop",et.CONTACT_REMOTEACCESS_APP_STATUS_MESSAGE="contact_remote_access_app_status_message",et.CONTACT_REMOTEACCESS_APP_MESSAGE="contact_remote_access_app_message",et.CONVERSATION_ACCESS_GRANTED="GRANTED",et.CONVERSATION_NEED_MODERATOR_ACCEPTATION="NEED_MODERATOR_ACCEPTATION",et.CONVERSATION_ROLE_MODERATOR="moderator",et.CONVERSATION_ROLE_CONTRIBUTOR="contributor",et.CONVERSATION_ROLE_GUEST="guest",et.CONVERSATION_WAITING_ROOM_PREFIX="waiting-room-",et.CONVERSATION_SEND_DATA_IDENTIFIER="conv_data",et.CONVERSATION_PERSISTENT_DATA_UPDATE_IDENTIFIER="conv_persistent_data_update",et.CONVERSATION_JOIN_REQUEST_IDENTIFIER="conv_join_req",et.CONVERSATION_JOIN_ANSWER_IDENTIFIER="conv_join_ans",et.CONVERSATION_MODERATOR_CONNECTED_IDENTIFIER="conv_moderator_connected",et.CONVERSATION_NEW_MEDIA_IDENTIFIER="conv_new_media",et.CONVERSATION_CLOSED_IDENTIFIER="conv_closed",et.CONVERSATION_INVITATION_IDENTIFIER="conv_invite",et.INVITATION_ANSWER_IDENTIFIER="invite_ans",et.RECORD_BASE_URL="https://data2.apizee.com:10000/videoManager",et.RECORD_PLAY_URL=et.RECORD_BASE_URL+"?action=play&recordedFileName=",et.DEFAULT_MCU="mcu4.apizee.com",et.DEFAULT_TURNADDRESS="mp1.apizee.com",et.CALL_STATUS_WAITING_FOR_CALLEE=Symbol("CALL_STATUS_WAITING_FOR_CALLEE"),et.CALL_STATUS_ONGOING=Symbol("CALL_STATUS_ONGOING"),et.CALL_STATUS_ENDED=Symbol("CALL_STATUS_ENDED"),et.DATACHANNEL_STATUS_WAITING=Symbol("DATACHANNEL_STATUS_WAITING"),et.DATACHANNEL_STATUS_ONGOING=Symbol("DATACHANNEL_STATUS_ONGOING"),et.DATACHANNEL_STATUS_ENDED=Symbol("DATACHANNEL_STATUS_ENDED"),et.DATACHANNEL_TYPE_RECEIVE=Symbol("DATACHANNEL_TYPE_RECEIVE"),et.DATACHANNEL_TYPE_SEND=Symbol("DATACHANNEL_TYPE_SEND"),et.CONVERSATION_STATUS_JOINED=Symbol("CONVERSATION_STATUS_JOINED"),et.CONVERSATION_STATUS_NOT_JOINED=Symbol("CONVERSATION_STATUS_NOT_JOINED"),et.CONVERSATION_STATUS_WAITING=Symbol("CONVERSATION_STATUS_WAITING"),et.CONVERSATION_STATUS_JOINING=Symbol("CONVERSATION_STATUS_JOINING"),et.CONVERSATION_WHITEBOARD_STARTED=Symbol("CONVERSATION_WHITEBOARD_STARTED"),et.CONVERSATION_WHITEBOARD_NOT_STARTED=Symbol("CONVERSATION_WHITEBOARD_NOT_STARTED"),et.STATE_IDLE=Symbol("STATE_IDLE"),et.STATE_JOINING=Symbol("STATE_JOINING"),et.STATE_ACTIVE=Symbol("STATE_ACTIVE"),et.STATE_LEAVING=Symbol("STATE_LEAVING"),et.INVITATION_STATUS_ACCEPTED=Symbol("INVITATION_STATUS_ACCEPTED"),et.INVITATION_STATUS_DECLINED=Symbol("INVITATION_STATUS_DECLINED"),et.INVITATION_STATUS_STANDBY=Symbol("INVITATION_STATUS_STANDBY"),et.INVITATION_STATUS_EXPIRED=Symbol("INVITATION_STATUS_EXPIRED"),et.INVITATION_STATUS_CANCELLED=Symbol("INVITATION_STATUS_CANCELLED"),et.INVITATION_STATUS_ENDED=Symbol("INVITATION_STATUS_ENDED"),et.STREAM_TYPE_NO_INPUT="no_input",et.STREAM_TYPE_AUDIO="audio",et.STREAM_TYPE_VIDEO="video",et.STREAM_AUDIO_ANALYSIS_THRESHOLD=100,et.STREAM_AUDIO_NOISE_REDUCTION_VAI={soft:.7,medium:.8,hard:.9},et.CONTACT_DISCONNECTION_DELAY=1e4,et.CONVERSATION_JOIN_REQUEST_INTERVAL=5e3,et.APIRTC_MEDIA_DEVICE_DETECTION_DELAY=1e4,et.CONVERSATION_GROUP_CHAT_MEMBER_UPDATE_DELAY=5e3,et.CONVERSATION_WHITEBOARD_START_DELAY=5e3,et.CONVERSATION_RECORDING_STARTED_DELAY=1e4,et.CONVERSATION_RECORDING_STOPPED_DELAY=5e3,et.CONVERSATION_STREAMING_STARTED_DELAY=1e4,et.CONVERSATION_STREAMING_STOPPED_DELAY=1e4,et.CONVERSATION_PARTICIPANT_EJECTION_DELAY=5e3,et.JOIN_WAITING_ROOM_PRESENCE_GROUP_TIMEOUT=3e3},1215:(rt,it,s)=>{function et(dt){return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ut){return typeof ut}:function(ut){return ut&&typeof Symbol=="function"&&ut.constructor===Symbol&&ut!==Symbol.prototype?"symbol":typeof ut},et(dt)}function nt(dt,ut){return arguments.length===3?at(arguments[0],arguments[1],arguments[2]):ut==="null"?dt===null:ut==="array"?dt!==null&&et(dt)==="object"&&Array.isArray(dt):dt!==null&&et(dt)===ut}function at(dt,ut,lt){if(ut!==null&&et(ut)==="object"&&Array.isArray(ut)&&ut.length>=1){var mt=ut[0];if(ut.length>1)return nt(dt,"object")&&nt(mt,"string")&&dt.hasOwnProperty(mt)&&nt(dt[mt],"object")&&at(dt[mt],ut.slice(1),lt);ut=mt}return lt==="undefined"?nt(dt,"object")&&nt(ut,"string")&&!dt.hasOwnProperty(ut)&&nt(dt[ut],lt):nt(dt,"object")&&nt(ut,"string")&&dt.hasOwnProperty(ut)&&nt(dt[ut],lt)}s.d(it,{g:()=>ht}),s(4916),s(5306),s(3710),s(1539),s(9714),s(7941),s(9575),s(6716),s(9554),s(9601),s(6992),s(1532),s(8783),s(3948),s(9753),s(7042),s(3843),s(2564),s(2526),s(1817),s(2165);var ht={assignObject:function(dt,ut){var lt,mt,ot;for(dt==null&&(dt={}),lt=1;lt2&&arguments[2]!==void 0?arguments[2]:{},ft=null,yt=0,vt=function(){yt=pt.leading===!1?0:Date.now(),ft=null,ot=dt.apply(lt,mt),ft||(lt=mt=null)};return function(){var bt=Date.now();yt||pt.leading!==!1||(yt=bt);var At=ut-(bt-yt);return lt=this,mt=arguments,At<=0||At>ut?(ft&&(clearTimeout(ft),ft=null),yt=bt,ot=dt.apply(lt,mt),ft||(lt=mt=null)):ft||pt.trailing===!1||(ft=setTimeout(vt,At)),ot}},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(dt){var ut=16*Math.random()|0;return(dt==="x"?ut:3&ut|8).toString(16)})},hashString:function(dt){for(var ut=0,lt=0,mt=dt.length;lt2&&arguments[2]!==void 0?arguments[2]:{};if(["roomName","callId","recordType","convId","mediaId","mediaURL","recordedFileName"].forEach(function(ot){ut.hasOwnProperty(ot)&&(lt[ot]=String(ut[ot]))}),ut.mediaType==="AUDIO-ONLY"?(lt.audioOnly=!0,lt.videoOnly=!1):ut.mediaType==="VIDEO-ONLY"?(lt.audioOnly=!1,lt.videoOnly=!0):(lt.audioOnly=!1,lt.videoOnly=!1),lt.recordType==="composite"&&ut.hasOwnProperty("descriptor")){var mt={};Object.assign(mt,ut.descriptor),mt.hasOwnProperty("mode")?lt.mode=mt.mode:lt.mode="complete",mt.hasOwnProperty("labelEnabled")?(lt.labelEnabled=mt.labelEnabled===!0,lt.labelEnabled===!0&&mt.hasOwnProperty("labels")&&(lt.labels=mt.labels)):lt.labelEnabled=!1}return lt},paramsToQueryString:function(dt){for(var ut="",lt=0,mt=Object.keys(dt);lt3&&arguments[3]!==void 0?arguments[3]:{};lt&<.error(ut);var ot={code:dt};return ut instanceof String?ot.error=new Error(ut):ut instanceof Error?ot.error=ut:ot.error=new Error(String(ut)),nt(mt,"object")&&(mt.hasOwnProperty("fromError")&&(ot.fromError=mt.fromError),mt.hasOwnProperty("httpCode")&&(ot.httpCode=mt.httpCode)),ot},isSet:function(dt){return dt!=null},isTypeof:nt,isPropertyTypeof:at,_private:{dataCallsOnHold:new Map,dataChannelInvitations:new Map,dataCallsFileInfo:new Map}}},9662:(rt,it,s)=>{var et=s(614),nt=s(6330),at=TypeError;rt.exports=function(ht){if(et(ht))return ht;throw at(nt(ht)+" is not a function")}},9483:(rt,it,s)=>{var et=s(4411),nt=s(6330),at=TypeError;rt.exports=function(ht){if(et(ht))return ht;throw at(nt(ht)+" is not a constructor")}},6077:(rt,it,s)=>{var et=s(614),nt=String,at=TypeError;rt.exports=function(ht){if(typeof ht=="object"||et(ht))return ht;throw at("Can't set "+nt(ht)+" as a prototype")}},1223:(rt,it,s)=>{var et=s(5112),nt=s(30),at=s(3070).f,ht=et("unscopables"),dt=Array.prototype;dt[ht]==null&&at(dt,ht,{configurable:!0,value:nt(null)}),rt.exports=function(ut){dt[ht][ut]=!0}},1530:(rt,it,s)=>{var et=s(8710).charAt;rt.exports=function(nt,at,ht){return at+(ht?et(nt,at).length:1)}},5787:(rt,it,s)=>{var et=s(7976),nt=TypeError;rt.exports=function(at,ht){if(et(ht,at))return at;throw nt("Incorrect invocation")}},9670:(rt,it,s)=>{var et=s(111),nt=String,at=TypeError;rt.exports=function(ht){if(et(ht))return ht;throw at(nt(ht)+" is not an object")}},4019:rt=>{rt.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7556:(rt,it,s)=>{var et=s(7293);rt.exports=et(function(){if(typeof ArrayBuffer=="function"){var nt=new ArrayBuffer(8);Object.isExtensible(nt)&&Object.defineProperty(nt,"a",{value:8})}})},260:(rt,it,s)=>{var et,nt,at,ht=s(4019),dt=s(9781),ut=s(7854),lt=s(614),mt=s(111),ot=s(2597),pt=s(648),ft=s(6330),yt=s(8880),vt=s(8052),bt=s(3070).f,At=s(7976),Nt=s(9518),St=s(7674),wt=s(5112),Mt=s(9711),Ht=s(9909),Ot=Ht.enforce,Dt=Ht.get,Gt=ut.Int8Array,nn=Gt&&Gt.prototype,zt=ut.Uint8ClampedArray,Ft=zt&&zt.prototype,un=Gt&&Nt(Gt),vn=nn&&Nt(nn),yn=Object.prototype,cn=ut.TypeError,gn=wt("toStringTag"),bn=Mt("TYPED_ARRAY_TAG"),fn=ht&&!!St&&pt(ut.opera)!=="Opera",Tn=!1,_n={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Un={BigInt64Array:8,BigUint64Array:8},Pn=function(Rn){var On=Nt(Rn);if(mt(On)){var Ln=Dt(On);return Ln&&ot(Ln,"TypedArrayConstructor")?Ln.TypedArrayConstructor:Pn(On)}},In=function(Rn){if(!mt(Rn))return!1;var On=pt(Rn);return ot(_n,On)||ot(Un,On)};for(et in _n)(at=(nt=ut[et])&&nt.prototype)?Ot(at).TypedArrayConstructor=nt:fn=!1;for(et in Un)(at=(nt=ut[et])&&nt.prototype)&&(Ot(at).TypedArrayConstructor=nt);if((!fn||!lt(un)||un===Function.prototype)&&(un=function(){throw cn("Incorrect invocation")},fn))for(et in _n)ut[et]&&St(ut[et],un);if((!fn||!vn||vn===yn)&&(vn=un.prototype,fn))for(et in _n)ut[et]&&St(ut[et].prototype,vn);if(fn&&Nt(Ft)!==vn&&St(Ft,vn),dt&&!ot(vn,gn))for(et in Tn=!0,bt(vn,gn,{get:function(){return mt(this)?this[bn]:void 0}}),_n)ut[et]&&yt(ut[et],bn,et);rt.exports={NATIVE_ARRAY_BUFFER_VIEWS:fn,TYPED_ARRAY_TAG:Tn&&bn,aTypedArray:function(Rn){if(In(Rn))return Rn;throw cn("Target is not a typed array")},aTypedArrayConstructor:function(Rn){if(lt(Rn)&&(!St||At(un,Rn)))return Rn;throw cn(ft(Rn)+" is not a typed array constructor")},exportTypedArrayMethod:function(Rn,On,Ln,qn){if(dt){if(Ln)for(var jn in _n){var Fn=ut[jn];if(Fn&&ot(Fn.prototype,Rn))try{delete Fn.prototype[Rn]}catch{try{Fn.prototype[Rn]=On}catch{}}}vn[Rn]&&!Ln||vt(vn,Rn,Ln?On:fn&&nn[Rn]||On,qn)}},exportTypedArrayStaticMethod:function(Rn,On,Ln){var qn,jn;if(dt){if(St){if(Ln){for(qn in _n)if((jn=ut[qn])&&ot(jn,Rn))try{delete jn[Rn]}catch{}}if(un[Rn]&&!Ln)return;try{return vt(un,Rn,Ln?On:fn&&un[Rn]||On)}catch{}}for(qn in _n)!(jn=ut[qn])||jn[Rn]&&!Ln||vt(jn,Rn,On)}},getTypedArrayConstructor:Pn,isView:function(Rn){if(!mt(Rn))return!1;var On=pt(Rn);return On==="DataView"||ot(_n,On)||ot(Un,On)},isTypedArray:In,TypedArray:un,TypedArrayPrototype:vn}},3331:(rt,it,s)=>{var et=s(7854),nt=s(1702),at=s(9781),ht=s(4019),dt=s(6530),ut=s(8880),lt=s(9190),mt=s(7293),ot=s(5787),pt=s(9303),ft=s(7466),yt=s(7067),vt=s(1179),bt=s(9518),At=s(7674),Nt=s(8006).f,St=s(3070).f,wt=s(1285),Mt=s(1589),Ht=s(8003),Ot=s(9909),Dt=dt.PROPER,Gt=dt.CONFIGURABLE,nn=Ot.get,zt=Ot.set,Ft="ArrayBuffer",un="Wrong index",vn=et.ArrayBuffer,yn=vn,cn=yn&&yn.prototype,gn=et.DataView,bn=gn&&gn.prototype,fn=Object.prototype,Tn=et.Array,_n=et.RangeError,Un=nt(wt),Pn=nt([].reverse),In=vt.pack,Rn=vt.unpack,On=function(Cn){return[255&Cn]},Ln=function(Cn){return[255&Cn,Cn>>8&255]},qn=function(Cn){return[255&Cn,Cn>>8&255,Cn>>16&255,Cn>>24&255]},jn=function(Cn){return Cn[3]<<24|Cn[2]<<16|Cn[1]<<8|Cn[0]},Fn=function(Cn){return In(Cn,23,4)},Zn=function(Cn){return In(Cn,52,8)},on=function(Cn,Nn){St(Cn.prototype,Nn,{get:function(){return nn(this)[Nn]}})},Hn=function(Cn,Nn,qt,kt){var st=yt(qt),Tt=nn(Cn);if(st+Nn>Tt.byteLength)throw _n(un);var Rt=nn(Tt.buffer).bytes,Lt=st+Tt.byteOffset,Et=Mt(Rt,Lt,Lt+Nn);return kt?Et:Pn(Et)},Bn=function(Cn,Nn,qt,kt,st,Tt){var Rt=yt(qt),Lt=nn(Cn);if(Rt+Nn>Lt.byteLength)throw _n(un);for(var Et=nn(Lt.buffer).bytes,jt=Rt+Lt.byteOffset,Pt=kt(+st),Vt=0;VtKn;)($n=Jn[Kn++])in yn||ut(yn,$n,vn[$n]);cn.constructor=yn}At&&bt(bn)!==fn&&At(bn,fn);var An=new gn(new yn(2)),Wn=nt(bn.setInt8);An.setInt8(0,2147483648),An.setInt8(1,2147483649),!An.getInt8(0)&&An.getInt8(1)||lt(bn,{setInt8:function(Cn,Nn){Wn(this,Cn,Nn<<24>>24)},setUint8:function(Cn,Nn){Wn(this,Cn,Nn<<24>>24)}},{unsafe:!0})}else cn=(yn=function(Cn){ot(this,cn);var Nn=yt(Cn);zt(this,{bytes:Un(Tn(Nn),0),byteLength:Nn}),at||(this.byteLength=Nn)}).prototype,bn=(gn=function(Cn,Nn,qt){ot(this,bn),ot(Cn,cn);var kt=nn(Cn).byteLength,st=pt(Nn);if(st<0||st>kt)throw _n("Wrong offset");if(st+(qt=qt===void 0?kt-st:ft(qt))>kt)throw _n("Wrong length");zt(this,{buffer:Cn,byteLength:qt,byteOffset:st}),at||(this.buffer=Cn,this.byteLength=qt,this.byteOffset=st)}).prototype,at&&(on(yn,"byteLength"),on(gn,"buffer"),on(gn,"byteLength"),on(gn,"byteOffset")),lt(bn,{getInt8:function(Cn){return Hn(this,1,Cn)[0]<<24>>24},getUint8:function(Cn){return Hn(this,1,Cn)[0]},getInt16:function(Cn){var Nn=Hn(this,2,Cn,arguments.length>1?arguments[1]:void 0);return(Nn[1]<<8|Nn[0])<<16>>16},getUint16:function(Cn){var Nn=Hn(this,2,Cn,arguments.length>1?arguments[1]:void 0);return Nn[1]<<8|Nn[0]},getInt32:function(Cn){return jn(Hn(this,4,Cn,arguments.length>1?arguments[1]:void 0))},getUint32:function(Cn){return jn(Hn(this,4,Cn,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(Cn){return Rn(Hn(this,4,Cn,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(Cn){return Rn(Hn(this,8,Cn,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(Cn,Nn){Bn(this,1,Cn,On,Nn)},setUint8:function(Cn,Nn){Bn(this,1,Cn,On,Nn)},setInt16:function(Cn,Nn){Bn(this,2,Cn,Ln,Nn,arguments.length>2?arguments[2]:void 0)},setUint16:function(Cn,Nn){Bn(this,2,Cn,Ln,Nn,arguments.length>2?arguments[2]:void 0)},setInt32:function(Cn,Nn){Bn(this,4,Cn,qn,Nn,arguments.length>2?arguments[2]:void 0)},setUint32:function(Cn,Nn){Bn(this,4,Cn,qn,Nn,arguments.length>2?arguments[2]:void 0)},setFloat32:function(Cn,Nn){Bn(this,4,Cn,Fn,Nn,arguments.length>2?arguments[2]:void 0)},setFloat64:function(Cn,Nn){Bn(this,8,Cn,Zn,Nn,arguments.length>2?arguments[2]:void 0)}});Ht(yn,Ft),Ht(gn,"DataView"),rt.exports={ArrayBuffer:yn,DataView:gn}},1048:(rt,it,s)=>{var et=s(7908),nt=s(1400),at=s(6244),ht=s(5117),dt=Math.min;rt.exports=[].copyWithin||function(ut,lt){var mt=et(this),ot=at(mt),pt=nt(ut,ot),ft=nt(lt,ot),yt=arguments.length>2?arguments[2]:void 0,vt=dt((yt===void 0?ot:nt(yt,ot))-ft,ot-pt),bt=1;for(ft0;)ft in mt?mt[pt]=mt[ft]:ht(mt,pt),pt+=bt,ft+=bt;return mt}},1285:(rt,it,s)=>{var et=s(7908),nt=s(1400),at=s(6244);rt.exports=function(ht){for(var dt=et(this),ut=at(dt),lt=arguments.length,mt=nt(lt>1?arguments[1]:void 0,ut),ot=lt>2?arguments[2]:void 0,pt=ot===void 0?ut:nt(ot,ut);pt>mt;)dt[mt++]=ht;return dt}},8533:(rt,it,s)=>{var et=s(2092).forEach,nt=s(9341)("forEach");rt.exports=nt?[].forEach:function(at){return et(this,at,arguments.length>1?arguments[1]:void 0)}},7745:(rt,it,s)=>{var et=s(6244);rt.exports=function(nt,at){for(var ht=0,dt=et(at),ut=new nt(dt);dt>ht;)ut[ht]=at[ht++];return ut}},8457:(rt,it,s)=>{var et=s(9974),nt=s(6916),at=s(7908),ht=s(3411),dt=s(7659),ut=s(4411),lt=s(6244),mt=s(6135),ot=s(8554),pt=s(1246),ft=Array;rt.exports=function(yt){var vt=at(yt),bt=ut(this),At=arguments.length,Nt=At>1?arguments[1]:void 0,St=Nt!==void 0;St&&(Nt=et(Nt,At>2?arguments[2]:void 0));var wt,Mt,Ht,Ot,Dt,Gt,nn=pt(vt),zt=0;if(!nn||this===ft&&dt(nn))for(wt=lt(vt),Mt=bt?new this(wt):ft(wt);wt>zt;zt++)Gt=St?Nt(vt[zt],zt):vt[zt],mt(Mt,zt,Gt);else for(Dt=(Ot=ot(vt,nn)).next,Mt=bt?new this:[];!(Ht=nt(Dt,Ot)).done;zt++)Gt=St?ht(Ot,Nt,[Ht.value,zt],!0):Ht.value,mt(Mt,zt,Gt);return Mt.length=zt,Mt}},1318:(rt,it,s)=>{var et=s(5656),nt=s(1400),at=s(6244),ht=function(dt){return function(ut,lt,mt){var ot,pt=et(ut),ft=at(pt),yt=nt(mt,ft);if(dt&<!=lt){for(;ft>yt;)if((ot=pt[yt++])!=ot)return!0}else for(;ft>yt;yt++)if((dt||yt in pt)&&pt[yt]===lt)return dt||yt||0;return!dt&&-1}};rt.exports={includes:ht(!0),indexOf:ht(!1)}},2092:(rt,it,s)=>{var et=s(9974),nt=s(1702),at=s(8361),ht=s(7908),dt=s(6244),ut=s(5417),lt=nt([].push),mt=function(ot){var pt=ot==1,ft=ot==2,yt=ot==3,vt=ot==4,bt=ot==6,At=ot==7,Nt=ot==5||bt;return function(St,wt,Mt,Ht){for(var Ot,Dt,Gt=ht(St),nn=at(Gt),zt=et(wt,Mt),Ft=dt(nn),un=0,vn=Ht||ut,yn=pt?vn(St,Ft):ft||At?vn(St,0):void 0;Ft>un;un++)if((Nt||un in nn)&&(Dt=zt(Ot=nn[un],un,Gt),ot))if(pt)yn[un]=Dt;else if(Dt)switch(ot){case 3:return!0;case 5:return Ot;case 6:return un;case 2:lt(yn,Ot)}else switch(ot){case 4:return!1;case 7:lt(yn,Ot)}return bt?-1:yt||vt?vt:yn}};rt.exports={forEach:mt(0),map:mt(1),filter:mt(2),some:mt(3),every:mt(4),find:mt(5),findIndex:mt(6),filterReject:mt(7)}},6583:(rt,it,s)=>{var et=s(2104),nt=s(5656),at=s(9303),ht=s(6244),dt=s(9341),ut=Math.min,lt=[].lastIndexOf,mt=!!lt&&1/[1].lastIndexOf(1,-0)<0,ot=dt("lastIndexOf"),pt=mt||!ot;rt.exports=pt?function(ft){if(mt)return et(lt,this,arguments)||0;var yt=nt(this),vt=ht(yt),bt=vt-1;for(arguments.length>1&&(bt=ut(bt,at(arguments[1]))),bt<0&&(bt=vt+bt);bt>=0;bt--)if(bt in yt&&yt[bt]===ft)return bt||0;return-1}:lt},1194:(rt,it,s)=>{var et=s(7293),nt=s(5112),at=s(7392),ht=nt("species");rt.exports=function(dt){return at>=51||!et(function(){var ut=[];return(ut.constructor={})[ht]=function(){return{foo:1}},ut[dt](Boolean).foo!==1})}},9341:(rt,it,s)=>{var et=s(7293);rt.exports=function(nt,at){var ht=[][nt];return!!ht&&et(function(){ht.call(null,at||function(){return 1},1)})}},3671:(rt,it,s)=>{var et=s(9662),nt=s(7908),at=s(8361),ht=s(6244),dt=TypeError,ut=function(lt){return function(mt,ot,pt,ft){et(ot);var yt=nt(mt),vt=at(yt),bt=ht(yt),At=lt?bt-1:0,Nt=lt?-1:1;if(pt<2)for(;;){if(At in vt){ft=vt[At],At+=Nt;break}if(At+=Nt,lt?At<0:bt<=At)throw dt("Reduce of empty array with no initial value")}for(;lt?At>=0:bt>At;At+=Nt)At in vt&&(ft=ot(ft,vt[At],At,yt));return ft}};rt.exports={left:ut(!1),right:ut(!0)}},1589:(rt,it,s)=>{var et=s(1400),nt=s(6244),at=s(6135),ht=Array,dt=Math.max;rt.exports=function(ut,lt,mt){for(var ot=nt(ut),pt=et(lt,ot),ft=et(mt===void 0?ot:mt,ot),yt=ht(dt(ft-pt,0)),vt=0;pt{var et=s(1702);rt.exports=et([].slice)},4362:(rt,it,s)=>{var et=s(1589),nt=Math.floor,at=function(ut,lt){var mt=ut.length,ot=nt(mt/2);return mt<8?ht(ut,lt):dt(ut,at(et(ut,0,ot),lt),at(et(ut,ot),lt),lt)},ht=function(ut,lt){for(var mt,ot,pt=ut.length,ft=1;ft0;)ut[ot]=ut[--ot];ot!==ft++&&(ut[ot]=mt)}return ut},dt=function(ut,lt,mt,ot){for(var pt=lt.length,ft=mt.length,yt=0,vt=0;yt{var et=s(3157),nt=s(4411),at=s(111),ht=s(5112)("species"),dt=Array;rt.exports=function(ut){var lt;return et(ut)&&(lt=ut.constructor,(nt(lt)&&(lt===dt||et(lt.prototype))||at(lt)&&(lt=lt[ht])===null)&&(lt=void 0)),lt===void 0?dt:lt}},5417:(rt,it,s)=>{var et=s(7475);rt.exports=function(nt,at){return new(et(nt))(at===0?0:at)}},3411:(rt,it,s)=>{var et=s(9670),nt=s(9212);rt.exports=function(at,ht,dt,ut){try{return ut?ht(et(dt)[0],dt[1]):ht(dt)}catch(lt){nt(at,"throw",lt)}}},7072:(rt,it,s)=>{var et=s(5112)("iterator"),nt=!1;try{var at=0,ht={next:function(){return{done:!!at++}},return:function(){nt=!0}};ht[et]=function(){return this},Array.from(ht,function(){throw 2})}catch{}rt.exports=function(dt,ut){if(!ut&&!nt)return!1;var lt=!1;try{var mt={};mt[et]=function(){return{next:function(){return{done:lt=!0}}}},dt(mt)}catch{}return lt}},4326:(rt,it,s)=>{var et=s(1702),nt=et({}.toString),at=et("".slice);rt.exports=function(ht){return at(nt(ht),8,-1)}},648:(rt,it,s)=>{var et=s(1694),nt=s(614),at=s(4326),ht=s(5112)("toStringTag"),dt=Object,ut=at(function(){return arguments}())=="Arguments";rt.exports=et?at:function(lt){var mt,ot,pt;return lt===void 0?"Undefined":lt===null?"Null":typeof(ot=function(ft,yt){try{return ft[yt]}catch{}}(mt=dt(lt),ht))=="string"?ot:ut?at(mt):(pt=at(mt))=="Object"&&nt(mt.callee)?"Arguments":pt}},5631:(rt,it,s)=>{var et=s(3070).f,nt=s(30),at=s(9190),ht=s(9974),dt=s(5787),ut=s(408),lt=s(654),mt=s(6340),ot=s(9781),pt=s(2423).fastKey,ft=s(9909),yt=ft.set,vt=ft.getterFor;rt.exports={getConstructor:function(bt,At,Nt,St){var wt=bt(function(Gt,nn){dt(Gt,Mt),yt(Gt,{type:At,index:nt(null),first:void 0,last:void 0,size:0}),ot||(Gt.size=0),nn!=null&&ut(nn,Gt[St],{that:Gt,AS_ENTRIES:Nt})}),Mt=wt.prototype,Ht=vt(At),Ot=function(Gt,nn,zt){var Ft,un,vn=Ht(Gt),yn=Dt(Gt,nn);return yn?yn.value=zt:(vn.last=yn={index:un=pt(nn,!0),key:nn,value:zt,previous:Ft=vn.last,next:void 0,removed:!1},vn.first||(vn.first=yn),Ft&&(Ft.next=yn),ot?vn.size++:Gt.size++,un!=="F"&&(vn.index[un]=yn)),Gt},Dt=function(Gt,nn){var zt,Ft=Ht(Gt),un=pt(nn);if(un!=="F")return Ft.index[un];for(zt=Ft.first;zt;zt=zt.next)if(zt.key==nn)return zt};return at(Mt,{clear:function(){for(var Gt=Ht(this),nn=Gt.index,zt=Gt.first;zt;)zt.removed=!0,zt.previous&&(zt.previous=zt.previous.next=void 0),delete nn[zt.index],zt=zt.next;Gt.first=Gt.last=void 0,ot?Gt.size=0:this.size=0},delete:function(Gt){var nn=this,zt=Ht(nn),Ft=Dt(nn,Gt);if(Ft){var un=Ft.next,vn=Ft.previous;delete zt.index[Ft.index],Ft.removed=!0,vn&&(vn.next=un),un&&(un.previous=vn),zt.first==Ft&&(zt.first=un),zt.last==Ft&&(zt.last=vn),ot?zt.size--:nn.size--}return!!Ft},forEach:function(Gt){for(var nn,zt=Ht(this),Ft=ht(Gt,arguments.length>1?arguments[1]:void 0);nn=nn?nn.next:zt.first;)for(Ft(nn.value,nn.key,this);nn&&nn.removed;)nn=nn.previous},has:function(Gt){return!!Dt(this,Gt)}}),at(Mt,Nt?{get:function(Gt){var nn=Dt(this,Gt);return nn&&nn.value},set:function(Gt,nn){return Ot(this,Gt===0?0:Gt,nn)}}:{add:function(Gt){return Ot(this,Gt=Gt===0?0:Gt,Gt)}}),ot&&et(Mt,"size",{get:function(){return Ht(this).size}}),wt},setStrong:function(bt,At,Nt){var St=At+" Iterator",wt=vt(At),Mt=vt(St);lt(bt,At,function(Ht,Ot){yt(this,{type:St,target:Ht,state:wt(Ht),kind:Ot,last:void 0})},function(){for(var Ht=Mt(this),Ot=Ht.kind,Dt=Ht.last;Dt&&Dt.removed;)Dt=Dt.previous;return Ht.target&&(Ht.last=Dt=Dt?Dt.next:Ht.state.first)?Ot=="keys"?{value:Dt.key,done:!1}:Ot=="values"?{value:Dt.value,done:!1}:{value:[Dt.key,Dt.value],done:!1}:(Ht.target=void 0,{value:void 0,done:!0})},Nt?"entries":"values",!Nt,!0),mt(At)}}},9320:(rt,it,s)=>{var et=s(1702),nt=s(9190),at=s(2423).getWeakData,ht=s(9670),dt=s(111),ut=s(5787),lt=s(408),mt=s(2092),ot=s(2597),pt=s(9909),ft=pt.set,yt=pt.getterFor,vt=mt.find,bt=mt.findIndex,At=et([].splice),Nt=0,St=function(Ht){return Ht.frozen||(Ht.frozen=new wt)},wt=function(){this.entries=[]},Mt=function(Ht,Ot){return vt(Ht.entries,function(Dt){return Dt[0]===Ot})};wt.prototype={get:function(Ht){var Ot=Mt(this,Ht);if(Ot)return Ot[1]},has:function(Ht){return!!Mt(this,Ht)},set:function(Ht,Ot){var Dt=Mt(this,Ht);Dt?Dt[1]=Ot:this.entries.push([Ht,Ot])},delete:function(Ht){var Ot=bt(this.entries,function(Dt){return Dt[0]===Ht});return~Ot&&At(this.entries,Ot,1),!!~Ot}},rt.exports={getConstructor:function(Ht,Ot,Dt,Gt){var nn=Ht(function(vn,yn){ut(vn,zt),ft(vn,{type:Ot,id:Nt++,frozen:void 0}),yn!=null&<(yn,vn[Gt],{that:vn,AS_ENTRIES:Dt})}),zt=nn.prototype,Ft=yt(Ot),un=function(vn,yn,cn){var gn=Ft(vn),bn=at(ht(yn),!0);return bn===!0?St(gn).set(yn,cn):bn[gn.id]=cn,vn};return nt(zt,{delete:function(vn){var yn=Ft(this);if(!dt(vn))return!1;var cn=at(vn);return cn===!0?St(yn).delete(vn):cn&&ot(cn,yn.id)&&delete cn[yn.id]},has:function(vn){var yn=Ft(this);if(!dt(vn))return!1;var cn=at(vn);return cn===!0?St(yn).has(vn):cn&&ot(cn,yn.id)}}),nt(zt,Dt?{get:function(vn){var yn=Ft(this);if(dt(vn)){var cn=at(vn);return cn===!0?St(yn).get(vn):cn?cn[yn.id]:void 0}},set:function(vn,yn){return un(this,vn,yn)}}:{add:function(vn){return un(this,vn,!0)}}),nn}}},7710:(rt,it,s)=>{var et=s(2109),nt=s(7854),at=s(1702),ht=s(4705),dt=s(8052),ut=s(2423),lt=s(408),mt=s(5787),ot=s(614),pt=s(111),ft=s(7293),yt=s(7072),vt=s(8003),bt=s(9587);rt.exports=function(At,Nt,St){var wt=At.indexOf("Map")!==-1,Mt=At.indexOf("Weak")!==-1,Ht=wt?"set":"add",Ot=nt[At],Dt=Ot&&Ot.prototype,Gt=Ot,nn={},zt=function(gn){var bn=at(Dt[gn]);dt(Dt,gn,gn=="add"?function(fn){return bn(this,fn===0?0:fn),this}:gn=="delete"?function(fn){return!(Mt&&!pt(fn))&&bn(this,fn===0?0:fn)}:gn=="get"?function(fn){return Mt&&!pt(fn)?void 0:bn(this,fn===0?0:fn)}:gn=="has"?function(fn){return!(Mt&&!pt(fn))&&bn(this,fn===0?0:fn)}:function(fn,Tn){return bn(this,fn===0?0:fn,Tn),this})};if(ht(At,!ot(Ot)||!(Mt||Dt.forEach&&!ft(function(){new Ot().entries().next()}))))Gt=St.getConstructor(Nt,At,wt,Ht),ut.enable();else if(ht(At,!0)){var Ft=new Gt,un=Ft[Ht](Mt?{}:-0,1)!=Ft,vn=ft(function(){Ft.has(1)}),yn=yt(function(gn){new Ot(gn)}),cn=!Mt&&ft(function(){for(var gn=new Ot,bn=5;bn--;)gn[Ht](bn,bn);return!gn.has(-0)});yn||((Gt=Nt(function(gn,bn){mt(gn,Dt);var fn=bt(new Ot,gn,Gt);return bn!=null&<(bn,fn[Ht],{that:fn,AS_ENTRIES:wt}),fn})).prototype=Dt,Dt.constructor=Gt),(vn||cn)&&(zt("delete"),zt("has"),wt&&zt("get")),(cn||un)&&zt(Ht),Mt&&Dt.clear&&delete Dt.clear}return nn[At]=Gt,et({global:!0,constructor:!0,forced:Gt!=Ot},nn),vt(Gt,At),Mt||St.setStrong(Gt,At,wt),Gt}},9920:(rt,it,s)=>{var et=s(2597),nt=s(3887),at=s(1236),ht=s(3070);rt.exports=function(dt,ut,lt){for(var mt=nt(ut),ot=ht.f,pt=at.f,ft=0;ft{var et=s(5112)("match");rt.exports=function(nt){var at=/./;try{"/./"[nt](at)}catch{try{return at[et]=!1,"/./"[nt](at)}catch{}}return!1}},8544:(rt,it,s)=>{var et=s(7293);rt.exports=!et(function(){function nt(){}return nt.prototype.constructor=null,Object.getPrototypeOf(new nt)!==nt.prototype})},4994:(rt,it,s)=>{var et=s(3383).IteratorPrototype,nt=s(30),at=s(9114),ht=s(8003),dt=s(7497),ut=function(){return this};rt.exports=function(lt,mt,ot,pt){var ft=mt+" Iterator";return lt.prototype=nt(et,{next:at(+!pt,ot)}),ht(lt,ft,!1,!0),dt[ft]=ut,lt}},8880:(rt,it,s)=>{var et=s(9781),nt=s(3070),at=s(9114);rt.exports=et?function(ht,dt,ut){return nt.f(ht,dt,at(1,ut))}:function(ht,dt,ut){return ht[dt]=ut,ht}},9114:rt=>{rt.exports=function(it,s){return{enumerable:!(1&it),configurable:!(2&it),writable:!(4&it),value:s}}},6135:(rt,it,s)=>{var et=s(4948),nt=s(3070),at=s(9114);rt.exports=function(ht,dt,ut){var lt=et(dt);lt in ht?nt.f(ht,lt,at(0,ut)):ht[lt]=ut}},5573:(rt,it,s)=>{var et=s(1702),nt=s(7293),at=s(6650).start,ht=RangeError,dt=Math.abs,ut=Date.prototype,lt=ut.toISOString,mt=et(ut.getTime),ot=et(ut.getUTCDate),pt=et(ut.getUTCFullYear),ft=et(ut.getUTCHours),yt=et(ut.getUTCMilliseconds),vt=et(ut.getUTCMinutes),bt=et(ut.getUTCMonth),At=et(ut.getUTCSeconds);rt.exports=nt(function(){return lt.call(new Date(-50000000000001))!="0385-07-25T07:06:39.999Z"})||!nt(function(){lt.call(new Date(NaN))})?function(){if(!isFinite(mt(this)))throw ht("Invalid time value");var Nt=this,St=pt(Nt),wt=yt(Nt),Mt=St<0?"-":St>9999?"+":"";return Mt+at(dt(St),Mt?6:4,0)+"-"+at(bt(Nt)+1,2,0)+"-"+at(ot(Nt),2,0)+"T"+at(ft(Nt),2,0)+":"+at(vt(Nt),2,0)+":"+at(At(Nt),2,0)+"."+at(wt,3,0)+"Z"}:lt},7045:(rt,it,s)=>{var et=s(6339),nt=s(3070);rt.exports=function(at,ht,dt){return dt.get&&et(dt.get,ht,{getter:!0}),dt.set&&et(dt.set,ht,{setter:!0}),nt.f(at,ht,dt)}},8052:(rt,it,s)=>{var et=s(614),nt=s(3070),at=s(6339),ht=s(3072);rt.exports=function(dt,ut,lt,mt){mt||(mt={});var ot=mt.enumerable,pt=mt.name!==void 0?mt.name:ut;if(et(lt)&&at(lt,pt,mt),mt.global)ot?dt[ut]=lt:ht(ut,lt);else{try{mt.unsafe?dt[ut]&&(ot=!0):delete dt[ut]}catch{}ot?dt[ut]=lt:nt.f(dt,ut,{value:lt,enumerable:!1,configurable:!mt.nonConfigurable,writable:!mt.nonWritable})}return dt}},9190:(rt,it,s)=>{var et=s(8052);rt.exports=function(nt,at,ht){for(var dt in at)et(nt,dt,at[dt],ht);return nt}},3072:(rt,it,s)=>{var et=s(7854),nt=Object.defineProperty;rt.exports=function(at,ht){try{nt(et,at,{value:ht,configurable:!0,writable:!0})}catch{et[at]=ht}return ht}},654:(rt,it,s)=>{var et=s(2109),nt=s(6916),at=s(1913),ht=s(6530),dt=s(614),ut=s(4994),lt=s(9518),mt=s(7674),ot=s(8003),pt=s(8880),ft=s(8052),yt=s(5112),vt=s(7497),bt=s(3383),At=ht.PROPER,Nt=ht.CONFIGURABLE,St=bt.IteratorPrototype,wt=bt.BUGGY_SAFARI_ITERATORS,Mt=yt("iterator"),Ht="keys",Ot="values",Dt="entries",Gt=function(){return this};rt.exports=function(nn,zt,Ft,un,vn,yn,cn){ut(Ft,zt,un);var gn,bn,fn,Tn=function(Ln){if(Ln===vn&&Rn)return Rn;if(!wt&&Ln in Pn)return Pn[Ln];switch(Ln){case Ht:case Ot:case Dt:return function(){return new Ft(this,Ln)}}return function(){return new Ft(this)}},_n=zt+" Iterator",Un=!1,Pn=nn.prototype,In=Pn[Mt]||Pn["@@iterator"]||vn&&Pn[vn],Rn=!wt&&In||Tn(vn),On=zt=="Array"&&Pn.entries||In;if(On&&(gn=lt(On.call(new nn)))!==Object.prototype&&gn.next&&(at||lt(gn)===St||(mt?mt(gn,St):dt(gn[Mt])||ft(gn,Mt,Gt)),ot(gn,_n,!0,!0),at&&(vt[_n]=Gt)),At&&vn==Ot&&In&&In.name!==Ot&&(!at&&Nt?pt(Pn,"name",Ot):(Un=!0,Rn=function(){return nt(In,this)})),vn)if(bn={values:Tn(Ot),keys:yn?Rn:Tn(Ht),entries:Tn(Dt)},cn)for(fn in bn)(wt||Un||!(fn in Pn))&&ft(Pn,fn,bn[fn]);else et({target:zt,proto:!0,forced:wt||Un},bn);return at&&!cn||Pn[Mt]===Rn||ft(Pn,Mt,Rn,{name:vn}),vt[zt]=Rn,bn}},7235:(rt,it,s)=>{var et=s(857),nt=s(2597),at=s(6061),ht=s(3070).f;rt.exports=function(dt){var ut=et.Symbol||(et.Symbol={});nt(ut,dt)||ht(ut,dt,{value:at.f(dt)})}},5117:(rt,it,s)=>{var et=s(6330),nt=TypeError;rt.exports=function(at,ht){if(!delete at[ht])throw nt("Cannot delete property "+et(ht)+" of "+et(at))}},9781:(rt,it,s)=>{var et=s(7293);rt.exports=!et(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},317:(rt,it,s)=>{var et=s(7854),nt=s(111),at=et.document,ht=nt(at)&&nt(at.createElement);rt.exports=function(dt){return ht?at.createElement(dt):{}}},7207:rt=>{var it=TypeError;rt.exports=function(s){if(s>9007199254740991)throw it("Maximum allowed index exceeded");return s}},8324:rt=>{rt.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:(rt,it,s)=>{var et=s(317)("span").classList,nt=et&&et.constructor&&et.constructor.prototype;rt.exports=nt===Object.prototype?void 0:nt},8886:(rt,it,s)=>{var et=s(8113).match(/firefox\/(\d+)/i);rt.exports=!!et&&+et[1]},7871:rt=>{rt.exports=typeof window=="object"&&typeof Deno!="object"},256:(rt,it,s)=>{var et=s(8113);rt.exports=/MSIE|Trident/.test(et)},1528:(rt,it,s)=>{var et=s(8113),nt=s(7854);rt.exports=/ipad|iphone|ipod/i.test(et)&&nt.Pebble!==void 0},6833:(rt,it,s)=>{var et=s(8113);rt.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(et)},5268:(rt,it,s)=>{var et=s(4326),nt=s(7854);rt.exports=et(nt.process)=="process"},1036:(rt,it,s)=>{var et=s(8113);rt.exports=/web0s(?!.*chrome)/i.test(et)},8113:(rt,it,s)=>{var et=s(5005);rt.exports=et("navigator","userAgent")||""},7392:(rt,it,s)=>{var et,nt,at=s(7854),ht=s(8113),dt=at.process,ut=at.Deno,lt=dt&&dt.versions||ut&&ut.version,mt=lt&<.v8;mt&&(nt=(et=mt.split("."))[0]>0&&et[0]<4?1:+(et[0]+et[1])),!nt&&ht&&(!(et=ht.match(/Edge\/(\d+)/))||et[1]>=74)&&(et=ht.match(/Chrome\/(\d+)/))&&(nt=+et[1]),rt.exports=nt},8008:(rt,it,s)=>{var et=s(8113).match(/AppleWebKit\/(\d+)\./);rt.exports=!!et&&+et[1]},748:rt=>{rt.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:(rt,it,s)=>{var et=s(7854),nt=s(1236).f,at=s(8880),ht=s(8052),dt=s(3072),ut=s(9920),lt=s(4705);rt.exports=function(mt,ot){var pt,ft,yt,vt,bt,At=mt.target,Nt=mt.global,St=mt.stat;if(pt=Nt?et:St?et[At]||dt(At,{}):(et[At]||{}).prototype)for(ft in ot){if(vt=ot[ft],yt=mt.dontCallGetSet?(bt=nt(pt,ft))&&bt.value:pt[ft],!lt(Nt?ft:At+(St?".":"#")+ft,mt.forced)&&yt!==void 0){if(typeof vt==typeof yt)continue;ut(vt,yt)}(mt.sham||yt&&yt.sham)&&at(vt,"sham",!0),ht(pt,ft,vt,mt)}}},7293:rt=>{rt.exports=function(it){try{return!!it()}catch{return!0}}},7007:(rt,it,s)=>{s(4916);var et=s(1702),nt=s(8052),at=s(2261),ht=s(7293),dt=s(5112),ut=s(8880),lt=dt("species"),mt=RegExp.prototype;rt.exports=function(ot,pt,ft,yt){var vt=dt(ot),bt=!ht(function(){var wt={};return wt[vt]=function(){return 7},""[ot](wt)!=7}),At=bt&&!ht(function(){var wt=!1,Mt=/a/;return ot==="split"&&((Mt={}).constructor={},Mt.constructor[lt]=function(){return Mt},Mt.flags="",Mt[vt]=/./[vt]),Mt.exec=function(){return wt=!0,null},Mt[vt](""),!wt});if(!bt||!At||ft){var Nt=et(/./[vt]),St=pt(vt,""[ot],function(wt,Mt,Ht,Ot,Dt){var Gt=et(wt),nn=Mt.exec;return nn===at||nn===mt.exec?bt&&!Dt?{done:!0,value:Nt(Mt,Ht,Ot)}:{done:!0,value:Gt(Ht,Mt,Ot)}:{done:!1}});nt(String.prototype,ot,St[0]),nt(mt,vt,St[1])}yt&&ut(mt[vt],"sham",!0)}},6677:(rt,it,s)=>{var et=s(7293);rt.exports=!et(function(){return Object.isExtensible(Object.preventExtensions({}))})},2104:(rt,it,s)=>{var et=s(4374),nt=Function.prototype,at=nt.apply,ht=nt.call;rt.exports=typeof Reflect=="object"&&Reflect.apply||(et?ht.bind(at):function(){return ht.apply(at,arguments)})},9974:(rt,it,s)=>{var et=s(1702),nt=s(9662),at=s(4374),ht=et(et.bind);rt.exports=function(dt,ut){return nt(dt),ut===void 0?dt:at?ht(dt,ut):function(){return dt.apply(ut,arguments)}}},4374:(rt,it,s)=>{var et=s(7293);rt.exports=!et(function(){var nt=(function(){}).bind();return typeof nt!="function"||nt.hasOwnProperty("prototype")})},7065:(rt,it,s)=>{var et=s(1702),nt=s(9662),at=s(111),ht=s(2597),dt=s(206),ut=s(4374),lt=Function,mt=et([].concat),ot=et([].join),pt={},ft=function(yt,vt,bt){if(!ht(pt,vt)){for(var At=[],Nt=0;Nt{var et=s(4374),nt=Function.prototype.call;rt.exports=et?nt.bind(nt):function(){return nt.apply(nt,arguments)}},6530:(rt,it,s)=>{var et=s(9781),nt=s(2597),at=Function.prototype,ht=et&&Object.getOwnPropertyDescriptor,dt=nt(at,"name"),ut=dt&&(function(){}).name==="something",lt=dt&&(!et||et&&ht(at,"name").configurable);rt.exports={EXISTS:dt,PROPER:ut,CONFIGURABLE:lt}},1702:(rt,it,s)=>{var et=s(4374),nt=Function.prototype,at=nt.bind,ht=nt.call,dt=et&&at.bind(ht,ht);rt.exports=et?function(ut){return ut&&dt(ut)}:function(ut){return ut&&function(){return ht.apply(ut,arguments)}}},5005:(rt,it,s)=>{var et=s(7854),nt=s(614),at=function(ht){return nt(ht)?ht:void 0};rt.exports=function(ht,dt){return arguments.length<2?at(et[ht]):et[ht]&&et[ht][dt]}},1246:(rt,it,s)=>{var et=s(648),nt=s(8173),at=s(7497),ht=s(5112)("iterator");rt.exports=function(dt){if(dt!=null)return nt(dt,ht)||nt(dt,"@@iterator")||at[et(dt)]}},8554:(rt,it,s)=>{var et=s(6916),nt=s(9662),at=s(9670),ht=s(6330),dt=s(1246),ut=TypeError;rt.exports=function(lt,mt){var ot=arguments.length<2?dt(lt):mt;if(nt(ot))return at(et(ot,lt));throw ut(ht(lt)+" is not iterable")}},8173:(rt,it,s)=>{var et=s(9662);rt.exports=function(nt,at){var ht=nt[at];return ht==null?void 0:et(ht)}},647:(rt,it,s)=>{var et=s(1702),nt=s(7908),at=Math.floor,ht=et("".charAt),dt=et("".replace),ut=et("".slice),lt=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,mt=/\$([$&'`]|\d{1,2})/g;rt.exports=function(ot,pt,ft,yt,vt,bt){var At=ft+ot.length,Nt=yt.length,St=mt;return vt!==void 0&&(vt=nt(vt),St=lt),dt(bt,St,function(wt,Mt){var Ht;switch(ht(Mt,0)){case"$":return"$";case"&":return ot;case"`":return ut(pt,0,ft);case"'":return ut(pt,At);case"<":Ht=vt[ut(Mt,1,-1)];break;default:var Ot=+Mt;if(Ot===0)return wt;if(Ot>Nt){var Dt=at(Ot/10);return Dt===0?wt:Dt<=Nt?yt[Dt-1]===void 0?ht(Mt,1):yt[Dt-1]+ht(Mt,1):wt}Ht=yt[Ot-1]}return Ht===void 0?"":Ht})}},7854:(rt,it,s)=>{var et=function(nt){return nt&&nt.Math==Math&&nt};rt.exports=et(typeof globalThis=="object"&&globalThis)||et(typeof window=="object"&&window)||et(typeof self=="object"&&self)||et(typeof s.g=="object"&&s.g)||function(){return this}()||Function("return this")()},2597:(rt,it,s)=>{var et=s(1702),nt=s(7908),at=et({}.hasOwnProperty);rt.exports=Object.hasOwn||function(ht,dt){return at(nt(ht),dt)}},3501:rt=>{rt.exports={}},842:(rt,it,s)=>{var et=s(7854);rt.exports=function(nt,at){var ht=et.console;ht&&ht.error&&(arguments.length==1?ht.error(nt):ht.error(nt,at))}},490:(rt,it,s)=>{var et=s(5005);rt.exports=et("document","documentElement")},4664:(rt,it,s)=>{var et=s(9781),nt=s(7293),at=s(317);rt.exports=!et&&!nt(function(){return Object.defineProperty(at("div"),"a",{get:function(){return 7}}).a!=7})},1179:rt=>{var it=Array,s=Math.abs,et=Math.pow,nt=Math.floor,at=Math.log,ht=Math.LN2;rt.exports={pack:function(dt,ut,lt){var mt,ot,pt,ft=it(lt),yt=8*lt-ut-1,vt=(1<>1,At=ut===23?et(2,-24)-et(2,-77):0,Nt=dt<0||dt===0&&1/dt<0?1:0,St=0;for((dt=s(dt))!=dt||dt===1/0?(ot=dt!=dt?1:0,mt=vt):(mt=nt(at(dt)/ht),dt*(pt=et(2,-mt))<1&&(mt--,pt*=2),(dt+=mt+bt>=1?At/pt:At*et(2,1-bt))*pt>=2&&(mt++,pt/=2),mt+bt>=vt?(ot=0,mt=vt):mt+bt>=1?(ot=(dt*pt-1)*et(2,ut),mt+=bt):(ot=dt*et(2,bt-1)*et(2,ut),mt=0));ut>=8;)ft[St++]=255&ot,ot/=256,ut-=8;for(mt=mt<0;)ft[St++]=255&mt,mt/=256,yt-=8;return ft[--St]|=128*Nt,ft},unpack:function(dt,ut){var lt,mt=dt.length,ot=8*mt-ut-1,pt=(1<>1,yt=ot-7,vt=mt-1,bt=dt[vt--],At=127&bt;for(bt>>=7;yt>0;)At=256*At+dt[vt--],yt-=8;for(lt=At&(1<<-yt)-1,At>>=-yt,yt+=ut;yt>0;)lt=256*lt+dt[vt--],yt-=8;if(At===0)At=1-ft;else{if(At===pt)return lt?NaN:bt?-1/0:1/0;lt+=et(2,ut),At-=ft}return(bt?-1:1)*lt*et(2,At-ut)}}},8361:(rt,it,s)=>{var et=s(1702),nt=s(7293),at=s(4326),ht=Object,dt=et("".split);rt.exports=nt(function(){return!ht("z").propertyIsEnumerable(0)})?function(ut){return at(ut)=="String"?dt(ut,""):ht(ut)}:ht},9587:(rt,it,s)=>{var et=s(614),nt=s(111),at=s(7674);rt.exports=function(ht,dt,ut){var lt,mt;return at&&et(lt=dt.constructor)&<!==ut&&nt(mt=lt.prototype)&&mt!==ut.prototype&&at(ht,mt),ht}},2788:(rt,it,s)=>{var et=s(1702),nt=s(614),at=s(5465),ht=et(Function.toString);nt(at.inspectSource)||(at.inspectSource=function(dt){return ht(dt)}),rt.exports=at.inspectSource},2423:(rt,it,s)=>{var et=s(2109),nt=s(1702),at=s(3501),ht=s(111),dt=s(2597),ut=s(3070).f,lt=s(8006),mt=s(1156),ot=s(2050),pt=s(9711),ft=s(6677),yt=!1,vt=pt("meta"),bt=0,At=function(St){ut(St,vt,{value:{objectID:"O"+bt++,weakData:{}}})},Nt=rt.exports={enable:function(){Nt.enable=function(){},yt=!0;var St=lt.f,wt=nt([].splice),Mt={};Mt[vt]=1,St(Mt).length&&(lt.f=function(Ht){for(var Ot=St(Ht),Dt=0,Gt=Ot.length;Dt{var et,nt,at,ht=s(8536),dt=s(7854),ut=s(1702),lt=s(111),mt=s(8880),ot=s(2597),pt=s(5465),ft=s(6200),yt=s(3501),vt="Object already initialized",bt=dt.TypeError,At=dt.WeakMap;if(ht||pt.state){var Nt=pt.state||(pt.state=new At),St=ut(Nt.get),wt=ut(Nt.has),Mt=ut(Nt.set);et=function(Ot,Dt){if(wt(Nt,Ot))throw new bt(vt);return Dt.facade=Ot,Mt(Nt,Ot,Dt),Dt},nt=function(Ot){return St(Nt,Ot)||{}},at=function(Ot){return wt(Nt,Ot)}}else{var Ht=ft("state");yt[Ht]=!0,et=function(Ot,Dt){if(ot(Ot,Ht))throw new bt(vt);return Dt.facade=Ot,mt(Ot,Ht,Dt),Dt},nt=function(Ot){return ot(Ot,Ht)?Ot[Ht]:{}},at=function(Ot){return ot(Ot,Ht)}}rt.exports={set:et,get:nt,has:at,enforce:function(Ot){return at(Ot)?nt(Ot):et(Ot,{})},getterFor:function(Ot){return function(Dt){var Gt;if(!lt(Dt)||(Gt=nt(Dt)).type!==Ot)throw bt("Incompatible receiver, "+Ot+" required");return Gt}}}},7659:(rt,it,s)=>{var et=s(5112),nt=s(7497),at=et("iterator"),ht=Array.prototype;rt.exports=function(dt){return dt!==void 0&&(nt.Array===dt||ht[at]===dt)}},3157:(rt,it,s)=>{var et=s(4326);rt.exports=Array.isArray||function(nt){return et(nt)=="Array"}},614:rt=>{rt.exports=function(it){return typeof it=="function"}},4411:(rt,it,s)=>{var et=s(1702),nt=s(7293),at=s(614),ht=s(648),dt=s(5005),ut=s(2788),lt=function(){},mt=[],ot=dt("Reflect","construct"),pt=/^\s*(?:class|function)\b/,ft=et(pt.exec),yt=!pt.exec(lt),vt=function(At){if(!at(At))return!1;try{return ot(lt,mt,At),!0}catch{return!1}},bt=function(At){if(!at(At))return!1;switch(ht(At)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return yt||!!ft(pt,ut(At))}catch{return!0}};bt.sham=!0,rt.exports=!ot||nt(function(){var At;return vt(vt.call)||!vt(Object)||!vt(function(){At=!0})||At})?bt:vt},5032:(rt,it,s)=>{var et=s(2597);rt.exports=function(nt){return nt!==void 0&&(et(nt,"value")||et(nt,"writable"))}},4705:(rt,it,s)=>{var et=s(7293),nt=s(614),at=/#|\.prototype\./,ht=function(ot,pt){var ft=ut[dt(ot)];return ft==mt||ft!=lt&&(nt(pt)?et(pt):!!pt)},dt=ht.normalize=function(ot){return String(ot).replace(at,".").toLowerCase()},ut=ht.data={},lt=ht.NATIVE="N",mt=ht.POLYFILL="P";rt.exports=ht},5988:(rt,it,s)=>{var et=s(111),nt=Math.floor;rt.exports=Number.isInteger||function(at){return!et(at)&&isFinite(at)&&nt(at)===at}},111:(rt,it,s)=>{var et=s(614);rt.exports=function(nt){return typeof nt=="object"?nt!==null:et(nt)}},1913:rt=>{rt.exports=!1},7850:(rt,it,s)=>{var et=s(111),nt=s(4326),at=s(5112)("match");rt.exports=function(ht){var dt;return et(ht)&&((dt=ht[at])!==void 0?!!dt:nt(ht)=="RegExp")}},2190:(rt,it,s)=>{var et=s(5005),nt=s(614),at=s(7976),ht=s(3307),dt=Object;rt.exports=ht?function(ut){return typeof ut=="symbol"}:function(ut){var lt=et("Symbol");return nt(lt)&&at(lt.prototype,dt(ut))}},408:(rt,it,s)=>{var et=s(9974),nt=s(6916),at=s(9670),ht=s(6330),dt=s(7659),ut=s(6244),lt=s(7976),mt=s(8554),ot=s(1246),pt=s(9212),ft=TypeError,yt=function(bt,At){this.stopped=bt,this.result=At},vt=yt.prototype;rt.exports=function(bt,At,Nt){var St,wt,Mt,Ht,Ot,Dt,Gt,nn=Nt&&Nt.that,zt=!(!Nt||!Nt.AS_ENTRIES),Ft=!(!Nt||!Nt.IS_RECORD),un=!(!Nt||!Nt.IS_ITERATOR),vn=!(!Nt||!Nt.INTERRUPTED),yn=et(At,nn),cn=function(bn){return St&&pt(St,"normal",bn),new yt(!0,bn)},gn=function(bn){return zt?(at(bn),vn?yn(bn[0],bn[1],cn):yn(bn[0],bn[1])):vn?yn(bn,cn):yn(bn)};if(Ft)St=bt.iterator;else if(un)St=bt;else{if(!(wt=ot(bt)))throw ft(ht(bt)+" is not iterable");if(dt(wt)){for(Mt=0,Ht=ut(bt);Ht>Mt;Mt++)if((Ot=gn(bt[Mt]))&<(vt,Ot))return Ot;return new yt(!1)}St=mt(bt,wt)}for(Dt=Ft?bt.next:St.next;!(Gt=nt(Dt,St)).done;){try{Ot=gn(Gt.value)}catch(bn){pt(St,"throw",bn)}if(typeof Ot=="object"&&Ot&<(vt,Ot))return Ot}return new yt(!1)}},9212:(rt,it,s)=>{var et=s(6916),nt=s(9670),at=s(8173);rt.exports=function(ht,dt,ut){var lt,mt;nt(ht);try{if(!(lt=at(ht,"return"))){if(dt==="throw")throw ut;return ut}lt=et(lt,ht)}catch(ot){mt=!0,lt=ot}if(dt==="throw")throw ut;if(mt)throw lt;return nt(lt),ut}},3383:(rt,it,s)=>{var et,nt,at,ht=s(7293),dt=s(614),ut=s(30),lt=s(9518),mt=s(8052),ot=s(5112),pt=s(1913),ft=ot("iterator"),yt=!1;[].keys&&("next"in(at=[].keys())?(nt=lt(lt(at)))!==Object.prototype&&(et=nt):yt=!0),et==null||ht(function(){var vt={};return et[ft].call(vt)!==vt})?et={}:pt&&(et=ut(et)),dt(et[ft])||mt(et,ft,function(){return this}),rt.exports={IteratorPrototype:et,BUGGY_SAFARI_ITERATORS:yt}},7497:rt=>{rt.exports={}},6244:(rt,it,s)=>{var et=s(7466);rt.exports=function(nt){return et(nt.length)}},6339:(rt,it,s)=>{var et=s(7293),nt=s(614),at=s(2597),ht=s(9781),dt=s(6530).CONFIGURABLE,ut=s(2788),lt=s(9909),mt=lt.enforce,ot=lt.get,pt=Object.defineProperty,ft=ht&&!et(function(){return pt(function(){},"length",{value:8}).length!==8}),yt=String(String).split("String"),vt=rt.exports=function(bt,At,Nt){String(At).slice(0,7)==="Symbol("&&(At="["+String(At).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),Nt&&Nt.getter&&(At="get "+At),Nt&&Nt.setter&&(At="set "+At),(!at(bt,"name")||dt&&bt.name!==At)&&(ht?pt(bt,"name",{value:At,configurable:!0}):bt.name=At),ft&&Nt&&at(Nt,"arity")&&bt.length!==Nt.arity&&pt(bt,"length",{value:Nt.arity});try{Nt&&at(Nt,"constructor")&&Nt.constructor?ht&&pt(bt,"prototype",{writable:!1}):bt.prototype&&(bt.prototype=void 0)}catch{}var St=mt(bt);return at(St,"source")||(St.source=yt.join(typeof At=="string"?At:"")),bt};Function.prototype.toString=vt(function(){return nt(this)&&ot(this).source||ut(this)},"toString")},403:rt=>{var it=Math.log,s=Math.LOG10E;rt.exports=Math.log10||function(et){return it(et)*s}},4758:rt=>{var it=Math.ceil,s=Math.floor;rt.exports=Math.trunc||function(et){var nt=+et;return(nt>0?s:it)(nt)}},5948:(rt,it,s)=>{var et,nt,at,ht,dt,ut,lt,mt,ot=s(7854),pt=s(9974),ft=s(1236).f,yt=s(261).set,vt=s(6833),bt=s(1528),At=s(1036),Nt=s(5268),St=ot.MutationObserver||ot.WebKitMutationObserver,wt=ot.document,Mt=ot.process,Ht=ot.Promise,Ot=ft(ot,"queueMicrotask"),Dt=Ot&&Ot.value;Dt||(et=function(){var Gt,nn;for(Nt&&(Gt=Mt.domain)&&Gt.exit();nt;){nn=nt.fn,nt=nt.next;try{nn()}catch(zt){throw nt?ht():at=void 0,zt}}at=void 0,Gt&&Gt.enter()},vt||Nt||At||!St||!wt?!bt&&Ht&&Ht.resolve?((lt=Ht.resolve(void 0)).constructor=Ht,mt=pt(lt.then,lt),ht=function(){mt(et)}):Nt?ht=function(){Mt.nextTick(et)}:(yt=pt(yt,ot),ht=function(){yt(et)}):(dt=!0,ut=wt.createTextNode(""),new St(et).observe(ut,{characterData:!0}),ht=function(){ut.data=dt=!dt})),rt.exports=Dt||function(Gt){var nn={fn:Gt,next:void 0};at&&(at.next=nn),nt||(nt=nn,ht()),at=nn}},735:(rt,it,s)=>{var et=s(133);rt.exports=et&&!!Symbol.for&&!!Symbol.keyFor},133:(rt,it,s)=>{var et=s(7392),nt=s(7293);rt.exports=!!Object.getOwnPropertySymbols&&!nt(function(){var at=Symbol();return!String(at)||!(Object(at)instanceof Symbol)||!Symbol.sham&&et&&et<41})},590:(rt,it,s)=>{var et=s(7293),nt=s(5112),at=s(1913),ht=nt("iterator");rt.exports=!et(function(){var dt=new URL("b?a=1&b=2&c=3","http://a"),ut=dt.searchParams,lt="";return dt.pathname="c%20d",ut.forEach(function(mt,ot){ut.delete("b"),lt+=ot+mt}),at&&!dt.toJSON||!ut.sort||dt.href!=="http://a/c%20d?a=1&c=3"||ut.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!ut[ht]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://тест").host!=="xn--e1aybc"||new URL("http://a#б").hash!=="#%D0%B1"||lt!=="a1c3"||new URL("http://x",void 0).host!=="x"})},8536:(rt,it,s)=>{var et=s(7854),nt=s(614),at=s(2788),ht=et.WeakMap;rt.exports=nt(ht)&&/native code/.test(at(ht))},8523:(rt,it,s)=>{var et=s(9662),nt=function(at){var ht,dt;this.promise=new at(function(ut,lt){if(ht!==void 0||dt!==void 0)throw TypeError("Bad Promise constructor");ht=ut,dt=lt}),this.resolve=et(ht),this.reject=et(dt)};rt.exports.f=function(at){return new nt(at)}},3929:(rt,it,s)=>{var et=s(7850),nt=TypeError;rt.exports=function(at){if(et(at))throw nt("The method doesn't accept regular expressions");return at}},3009:(rt,it,s)=>{var et=s(7854),nt=s(7293),at=s(1702),ht=s(1340),dt=s(3111).trim,ut=s(1361),lt=et.parseInt,mt=et.Symbol,ot=mt&&mt.iterator,pt=/^[+-]?0x/i,ft=at(pt.exec),yt=lt(ut+"08")!==8||lt(ut+"0x16")!==22||ot&&!nt(function(){lt(Object(ot))});rt.exports=yt?function(vt,bt){var At=dt(ht(vt));return lt(At,bt>>>0||(ft(pt,At)?16:10))}:lt},1574:(rt,it,s)=>{var et=s(9781),nt=s(1702),at=s(6916),ht=s(7293),dt=s(1956),ut=s(5181),lt=s(5296),mt=s(7908),ot=s(8361),pt=Object.assign,ft=Object.defineProperty,yt=nt([].concat);rt.exports=!pt||ht(function(){if(et&&pt({b:1},pt(ft({},"a",{enumerable:!0,get:function(){ft(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var vt={},bt={},At=Symbol(),Nt="abcdefghijklmnopqrst";return vt[At]=7,Nt.split("").forEach(function(St){bt[St]=St}),pt({},vt)[At]!=7||dt(pt({},bt)).join("")!=Nt})?function(vt,bt){for(var At=mt(vt),Nt=arguments.length,St=1,wt=ut.f,Mt=lt.f;Nt>St;)for(var Ht,Ot=ot(arguments[St++]),Dt=wt?yt(dt(Ot),wt(Ot)):dt(Ot),Gt=Dt.length,nn=0;Gt>nn;)Ht=Dt[nn++],et&&!at(Mt,Ot,Ht)||(At[Ht]=Ot[Ht]);return At}:pt},30:(rt,it,s)=>{var et,nt=s(9670),at=s(6048),ht=s(748),dt=s(3501),ut=s(490),lt=s(317),mt=s(6200)("IE_PROTO"),ot=function(){},pt=function(vt){return" - +