o(ke,z))beo(re,ke)?(H[_]=re,H[be]=z,_=be):(H[_]=ke,H[J]=z,_=J);else if(be
o(re,z))H[_]=re,H[be]=z,_=be;else break e}}return Y}function o(H,Y){var z=H.sortIndex-Y.sortIndex;return z!==0?z:H.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,f=3,p=!1,h=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(H){for(var Y=r(c);Y!==null;){if(Y.callback===null)n(c);else if(Y.startTime<=H)n(c),Y.sortIndex=Y.expirationTime,t(l,Y);else break;Y=r(c)}}function C(H){if(v=!1,b(H),!h)if(r(l)!==null)h=!0,te(k);else{var Y=r(c);Y!==null&&we(C,Y.startTime-H)}}function k(H,Y){h=!1,v&&(v=!1,g(A),A=-1),p=!0;var z=f;try{for(b(Y),d=r(l);d!==null&&(!(d.expirationTime>Y)||H&&!M());){var _=d.callback;if(typeof _=="function"){d.callback=null,f=d.priorityLevel;var P=_(d.expirationTime<=Y);Y=e.unstable_now(),typeof P=="function"?d.callback=P:d===r(l)&&n(l),b(Y)}else n(l);d=r(l)}if(d!==null)var ee=!0;else{var J=r(c);J!==null&&we(C,J.startTime-Y),ee=!1}return ee}finally{d=null,f=z,p=!1}}var E=!1,w=null,A=-1,D=5,I=-1;function M(){return!(e.unstable_now()-IH||125_?(H.sortIndex=z,t(c,H),r(l)===null&&H===r(c)&&(v?(g(A),A=-1):v=!0,we(C,z-_))):(H.sortIndex=P,t(l,H),h||p||(h=!0,te(k))),H},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(H){var Y=f;return function(){var z=f;f=Y;try{return H.apply(this,arguments)}finally{f=z}}}})(Ik);(function(e){e.exports=Ik})(M7);/**
+ * @license React
+ * react-dom.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var xk=T,mn=my;function W(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yy=Object.prototype.hasOwnProperty,z7=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,VC={},KC={};function L7(e){return yy.call(KC,e)?!0:yy.call(VC,e)?!1:z7.test(e)?KC[e]=!0:(VC[e]=!0,!1)}function F7(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function j7(e,t,r,n){if(t===null||typeof t>"u"||F7(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Lr(e,t,r,n,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var dr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){dr[e]=new Lr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];dr[t]=new Lr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){dr[e]=new Lr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){dr[e]=new Lr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){dr[e]=new Lr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){dr[e]=new Lr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){dr[e]=new Lr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){dr[e]=new Lr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){dr[e]=new Lr(e,5,!1,e.toLowerCase(),null,!1,!1)});var a5=/[\-:]([a-z])/g;function l5(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(a5,l5);dr[t]=new Lr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(a5,l5);dr[t]=new Lr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(a5,l5);dr[t]=new Lr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){dr[e]=new Lr(e,1,!1,e.toLowerCase(),null,!1,!1)});dr.xlinkHref=new Lr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){dr[e]=new Lr(e,1,!1,e.toLowerCase(),null,!0,!0)});function c5(e,t,r,n){var o=dr.hasOwnProperty(t)?dr[t]:null;(o!==null?o.type!==0:n||!(2a||o[s]!==i[a]){var l=`
+`+o[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Sm=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Cd(e):""}function H7(e){switch(e.tag){case 5:return Cd(e.type);case 16:return Cd("Lazy");case 13:return Cd("Suspense");case 19:return Cd("SuspenseList");case 0:case 2:case 15:return e=bm(e.type,!1),e;case 11:return e=bm(e.type.render,!1),e;case 1:return e=bm(e.type,!0),e;default:return""}}function Ty(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case sl:return"Fragment";case il:return"Portal";case Sy:return"Profiler";case u5:return"StrictMode";case by:return"Suspense";case Cy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ok:return(e.displayName||"Context")+".Consumer";case Bk:return(e._context.displayName||"Context")+".Provider";case d5:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case f5:return t=e.displayName||null,t!==null?t:Ty(e.type)||"Memo";case Ii:t=e._payload,e=e._init;try{return Ty(e(t))}catch{}}return null}function q7(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ty(t);case 8:return t===u5?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Zi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Mk(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function U7(e){var t=Mk(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){n=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _f(e){e._valueTracker||(e._valueTracker=U7(e))}function zk(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Mk(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Kh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ey(e,t){var r=t.checked;return kt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function QC(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Zi(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Lk(e,t){t=t.checked,t!=null&&c5(e,"checked",t,!1)}function wy(e,t){Lk(e,t);var r=Zi(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?_y(e,t.type,r):t.hasOwnProperty("defaultValue")&&_y(e,t.type,Zi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function XC(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function _y(e,t,r){(t!=="number"||Kh(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Td=Array.isArray;function Sl(e,t,r,n){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=kf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function t1(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Nd={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},$7=["Webkit","ms","Moz","O"];Object.keys(Nd).forEach(function(e){$7.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nd[t]=Nd[e]})});function qk(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Nd.hasOwnProperty(e)&&Nd[e]?(""+t).trim():t+"px"}function Uk(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=qk(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,o):e[r]=o}}var W7=kt({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 Ry(e,t){if(t){if(W7[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function Ay(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Iy=null;function h5(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xy=null,bl=null,Cl=null;function ZC(e){if(e=N1(e)){if(typeof xy!="function")throw Error(W(280));var t=e.stateNode;t&&(t=$p(t),xy(e.stateNode,e.type,t))}}function $k(e){bl?Cl?Cl.push(e):Cl=[e]:bl=e}function Wk(){if(bl){var e=bl,t=Cl;if(Cl=bl=null,ZC(e),t)for(e=0;e>>=0,e===0?32:31-(rN(e)/nN|0)|0}var Pf=64,Rf=4194304;function Ed(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Yh(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,o=e.suspendedLanes,i=e.pingedLanes,s=r&268435455;if(s!==0){var a=s&~o;a!==0?n=Ed(a):(i&=s,i!==0&&(n=Ed(i)))}else s=r&~o,s!==0?n=Ed(s):i!==0&&(n=Ed(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&o)&&(o=n&-n,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function I1(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-eo(t),e[t]=r}function aN(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Od),lT=String.fromCharCode(32),cT=!1;function dP(e,t){switch(e){case"keyup":return DN.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fP(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var al=!1;function zN(e,t){switch(e){case"compositionend":return fP(t);case"keypress":return t.which!==32?null:(cT=!0,lT);case"textInput":return e=t.data,e===lT&&cT?null:e;default:return null}}function LN(e,t){if(al)return e==="compositionend"||!C5&&dP(e,t)?(e=cP(),Ch=y5=Mi=null,al=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=hT(r)}}function vP(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vP(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mP(){for(var e=window,t=Kh();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Kh(e.document)}return t}function T5(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function KN(e){var t=mP(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&vP(r.ownerDocument.documentElement,r)){if(n!==null&&T5(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!e.extend&&i>n&&(o=n,n=i,i=o),o=pT(r,i);var s=pT(r,n);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,ll=null,zy=null,Md=null,Ly=!1;function gT(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ly||ll==null||ll!==Kh(n)||(n=ll,"selectionStart"in n&&T5(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Md&&a1(Md,n)||(Md=n,n=ep(zy,"onSelect"),0dl||(e.current=$y[dl],$y[dl]=null,dl--)}function ct(e,t){dl++,$y[dl]=e.current,e.current=t}var es={},Rr=as(es),Qr=as(!1),fa=es;function xl(e,t){var r=e.type.contextTypes;if(!r)return es;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Xr(e){return e=e.childContextTypes,e!=null}function rp(){mt(Qr),mt(Rr)}function TT(e,t,r){if(Rr.current!==es)throw Error(W(168));ct(Rr,t),ct(Qr,r)}function kP(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in t))throw Error(W(108,q7(e)||"Unknown",o));return kt({},r,n)}function np(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||es,fa=Rr.current,ct(Rr,e),ct(Qr,Qr.current),!0}function ET(e,t,r){var n=e.stateNode;if(!n)throw Error(W(169));r?(e=kP(e,t,fa),n.__reactInternalMemoizedMergedChildContext=e,mt(Qr),mt(Rr),ct(Rr,e)):mt(Qr),ct(Qr,r)}var Go=null,Wp=!1,Om=!1;function PP(e){Go===null?Go=[e]:Go.push(e)}function iB(e){Wp=!0,PP(e)}function ls(){if(!Om&&Go!==null){Om=!0;var e=0,t=Xe;try{var r=Go;for(Xe=1;e>=s,o-=s,Qo=1<<32-eo(t)+o|r<A?(D=w,w=null):D=w.sibling;var I=f(g,w,b[A],C);if(I===null){w===null&&(w=D);break}e&&w&&I.alternate===null&&t(g,w),m=i(I,m,A),E===null?k=I:E.sibling=I,E=I,w=D}if(A===b.length)return r(g,w),Ct&&Ws(g,A),k;if(w===null){for(;AA?(D=w,w=null):D=w.sibling;var M=f(g,w,I.value,C);if(M===null){w===null&&(w=D);break}e&&w&&M.alternate===null&&t(g,w),m=i(M,m,A),E===null?k=M:E.sibling=M,E=M,w=D}if(I.done)return r(g,w),Ct&&Ws(g,A),k;if(w===null){for(;!I.done;A++,I=b.next())I=d(g,I.value,C),I!==null&&(m=i(I,m,A),E===null?k=I:E.sibling=I,E=I);return Ct&&Ws(g,A),k}for(w=n(g,w);!I.done;A++,I=b.next())I=p(w,g,A,I.value,C),I!==null&&(e&&I.alternate!==null&&w.delete(I.key===null?A:I.key),m=i(I,m,A),E===null?k=I:E.sibling=I,E=I);return e&&w.forEach(function(B){return t(g,B)}),Ct&&Ws(g,A),k}function y(g,m,b,C){if(typeof b=="object"&&b!==null&&b.type===sl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case wf:e:{for(var k=b.key,E=m;E!==null;){if(E.key===k){if(k=b.type,k===sl){if(E.tag===7){r(g,E.sibling),m=o(E,b.props.children),m.return=g,g=m;break e}}else if(E.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ii&&IT(k)===E.type){r(g,E.sibling),m=o(E,b.props),m.ref=Cc(g,E,b),m.return=g,g=m;break e}r(g,E);break}else t(g,E);E=E.sibling}b.type===sl?(m=la(b.props.children,g.mode,C,b.key),m.return=g,g=m):(C=Ah(b.type,b.key,b.props,null,g.mode,C),C.ref=Cc(g,m,b),C.return=g,g=C)}return s(g);case il:e:{for(E=b.key;m!==null;){if(m.key===E)if(m.tag===4&&m.stateNode.containerInfo===b.containerInfo&&m.stateNode.implementation===b.implementation){r(g,m.sibling),m=o(m,b.children||[]),m.return=g,g=m;break e}else{r(g,m);break}else t(g,m);m=m.sibling}m=qm(b,g.mode,C),m.return=g,g=m}return s(g);case Ii:return E=b._init,y(g,m,E(b._payload),C)}if(Td(b))return h(g,m,b,C);if(vc(b))return v(g,m,b,C);Df(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,m!==null&&m.tag===6?(r(g,m.sibling),m=o(m,b),m.return=g,g=m):(r(g,m),m=Hm(b,g.mode,C),m.return=g,g=m),s(g)):r(g,m)}return y}var Bl=DP(!0),MP=DP(!1),B1={},Po=as(B1),d1=as(B1),f1=as(B1);function oa(e){if(e===B1)throw Error(W(174));return e}function x5(e,t){switch(ct(f1,t),ct(d1,e),ct(Po,B1),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Py(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Py(t,e)}mt(Po),ct(Po,t)}function Ol(){mt(Po),mt(d1),mt(f1)}function zP(e){oa(f1.current);var t=oa(Po.current),r=Py(t,e.type);t!==r&&(ct(d1,e),ct(Po,r))}function N5(e){d1.current===e&&(mt(Po),mt(d1))}var Tt=as(0);function cp(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Dm=[];function B5(){for(var e=0;er?r:4,e(!0);var n=Mm.transition;Mm.transition={};try{e(!1),t()}finally{Xe=r,Mm.transition=n}}function ZP(){return zn().memoizedState}function cB(e,t,r){var n=Ki(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},e8(e))t8(t,r);else if(r=xP(e,t,r,n),r!==null){var o=Dr();to(r,e,n,o),r8(r,t,n)}}function uB(e,t,r){var n=Ki(e),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(e8(e))t8(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,r);if(o.hasEagerState=!0,o.eagerState=a,no(a,s)){var l=t.interleaved;l===null?(o.next=o,A5(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}r=xP(e,t,o,n),r!==null&&(o=Dr(),to(r,e,n,o),r8(r,t,n))}}function e8(e){var t=e.alternate;return e===_t||t!==null&&t===_t}function t8(e,t){zd=up=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function r8(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,g5(e,r)}}var dp={readContext:Mn,useCallback:mr,useContext:mr,useEffect:mr,useImperativeHandle:mr,useInsertionEffect:mr,useLayoutEffect:mr,useMemo:mr,useReducer:mr,useRef:mr,useState:mr,useDebugValue:mr,useDeferredValue:mr,useTransition:mr,useMutableSource:mr,useSyncExternalStore:mr,useId:mr,unstable_isNewReconciler:!1},dB={readContext:Mn,useCallback:function(e,t){return yo().memoizedState=[e,t===void 0?null:t],e},useContext:Mn,useEffect:NT,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_h(4194308,4,GP.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _h(4194308,4,e,t)},useInsertionEffect:function(e,t){return _h(4,2,e,t)},useMemo:function(e,t){var r=yo();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=yo();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=cB.bind(null,_t,e),[n.memoizedState,e]},useRef:function(e){var t=yo();return e={current:e},t.memoizedState=e},useState:xT,useDebugValue:L5,useDeferredValue:function(e){return yo().memoizedState=e},useTransition:function(){var e=xT(!1),t=e[0];return e=lB.bind(null,e[1]),yo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=_t,o=yo();if(Ct){if(r===void 0)throw Error(W(407));r=r()}else{if(r=t(),Qt===null)throw Error(W(349));pa&30||jP(n,t,r)}o.memoizedState=r;var i={value:r,getSnapshot:t};return o.queue=i,NT(qP.bind(null,n,i,e),[e]),n.flags|=2048,g1(9,HP.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=yo(),t=Qt.identifierPrefix;if(Ct){var r=Xo,n=Qo;r=(n&~(1<<32-eo(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=h1++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=s.createElement(r,{is:n.is}):(e=s.createElement(r),r==="select"&&(s=e,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):e=s.createElementNS(e,r),e[Eo]=t,e[u1]=n,d8(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ay(r,n),r){case"dialog":pt("cancel",e),pt("close",e),o=n;break;case"iframe":case"object":case"embed":pt("load",e),o=n;break;case"video":case"audio":for(o=0;oMl&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304)}else{if(!n)if(e=cp(s),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Tc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ct)return yr(t),null}else 2*zt()-i.renderingStartTime>Ml&&r!==1073741824&&(t.flags|=128,n=!0,Tc(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(r=i.last,r!==null?r.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=zt(),t.sibling=null,r=Tt.current,ct(Tt,n?r&1|2:r&1),t):(yr(t),null);case 22:case 23:return $5(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?sn&1073741824&&(yr(t),t.subtreeFlags&6&&(t.flags|=8192)):yr(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function SB(e,t){switch(w5(t),t.tag){case 1:return Xr(t.type)&&rp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ol(),mt(Qr),mt(Rr),B5(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return N5(t),null;case 13:if(mt(Tt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));Nl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return mt(Tt),null;case 4:return Ol(),null;case 10:return R5(t.type._context),null;case 22:case 23:return $5(),null;case 24:return null;default:return null}}var zf=!1,kr=!1,bB=typeof WeakSet=="function"?WeakSet:Set,ae=null;function gl(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){xt(e,t,n)}else r.current=null}function rS(e,t,r){try{r()}catch(n){xt(e,t,n)}}var HT=!1;function CB(e,t){if(Fy=Jh,e=mP(),T5(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(a=s+o),d!==i||n!==0&&d.nodeType!==3||(l=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++c===o&&(a=s),f===i&&++u===n&&(l=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(jy={focusedElem:e,selectionRange:r},Jh=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var v=h.memoizedProps,y=h.memoizedState,g=t.stateNode,m=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Yn(t.type,v),y);g.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(C){xt(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return h=HT,HT=!1,h}function Ld(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&rS(t,r,i)}o=o.next}while(o!==n)}}function Gp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function nS(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function p8(e){var t=e.alternate;t!==null&&(e.alternate=null,p8(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Eo],delete t[u1],delete t[Uy],delete t[nB],delete t[oB])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function g8(e){return e.tag===5||e.tag===3||e.tag===4}function qT(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||g8(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function oS(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=tp));else if(n!==4&&(e=e.child,e!==null))for(oS(e,t,r),e=e.sibling;e!==null;)oS(e,t,r),e=e.sibling}function iS(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(iS(e,t,r),e=e.sibling;e!==null;)iS(e,t,r),e=e.sibling}var or=null,Jn=!1;function Ti(e,t,r){for(r=r.child;r!==null;)v8(e,t,r),r=r.sibling}function v8(e,t,r){if(ko&&typeof ko.onCommitFiberUnmount=="function")try{ko.onCommitFiberUnmount(jp,r)}catch{}switch(r.tag){case 5:kr||gl(r,t);case 6:var n=or,o=Jn;or=null,Ti(e,t,r),or=n,Jn=o,or!==null&&(Jn?(e=or,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):or.removeChild(r.stateNode));break;case 18:or!==null&&(Jn?(e=or,r=r.stateNode,e.nodeType===8?Bm(e.parentNode,r):e.nodeType===1&&Bm(e,r),i1(e)):Bm(or,r.stateNode));break;case 4:n=or,o=Jn,or=r.stateNode.containerInfo,Jn=!0,Ti(e,t,r),or=n,Jn=o;break;case 0:case 11:case 14:case 15:if(!kr&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&rS(r,t,s),o=o.next}while(o!==n)}Ti(e,t,r);break;case 1:if(!kr&&(gl(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){xt(r,t,a)}Ti(e,t,r);break;case 21:Ti(e,t,r);break;case 22:r.mode&1?(kr=(n=kr)||r.memoizedState!==null,Ti(e,t,r),kr=n):Ti(e,t,r);break;default:Ti(e,t,r)}}function UT(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new bB),t.forEach(function(n){var o=IB.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Wn(e,t){var r=t.deletions;if(r!==null)for(var n=0;no&&(o=s),n&=~i}if(n=o,n=zt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*EB(n/1960))-n,10e?16:e,zi===null)var n=!1;else{if(e=zi,zi=null,pp=0,We&6)throw Error(W(331));var o=We;for(We|=4,ae=e.current;ae!==null;){var i=ae,s=i.child;if(ae.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lzt()-q5?aa(e,0):H5|=r),Yr(e,t)}function w8(e,t){t===0&&(e.mode&1?(t=Rf,Rf<<=1,!(Rf&130023424)&&(Rf=4194304)):t=1);var r=Dr();e=oi(e,t),e!==null&&(I1(e,t,r),Yr(e,r))}function AB(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),w8(e,r)}function IB(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(W(314))}n!==null&&n.delete(t),w8(e,r)}var _8;_8=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qr.current)Kr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Kr=!1,mB(e,t,r);Kr=!!(e.flags&131072)}else Kr=!1,Ct&&t.flags&1048576&&RP(t,ip,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;kh(e,t),e=t.pendingProps;var o=xl(t,Rr.current);El(t,r),o=D5(null,t,n,e,o,r);var i=M5();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Xr(n)?(i=!0,np(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,I5(t),o.updater=Vp,t.stateNode=o,o._reactInternals=t,Qy(t,n,e,r),t=Jy(null,t,n,!0,i,r)):(t.tag=0,Ct&&i&&E5(t),Nr(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(kh(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=NB(n),e=Yn(n,e),o){case 0:t=Yy(null,t,n,e,r);break e;case 1:t=LT(null,t,n,e,r);break e;case 11:t=MT(null,t,n,e,r);break e;case 14:t=zT(null,t,n,Yn(n.type,e),r);break e}throw Error(W(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Yn(n,o),Yy(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Yn(n,o),LT(e,t,n,o,r);case 3:e:{if(l8(t),e===null)throw Error(W(387));n=t.pendingProps,i=t.memoizedState,o=i.element,NP(e,t),lp(t,n,null,r);var s=t.memoizedState;if(n=s.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Dl(Error(W(423)),t),t=FT(e,t,n,r,o);break e}else if(n!==o){o=Dl(Error(W(424)),t),t=FT(e,t,n,r,o);break e}else for(cn=$i(t.stateNode.containerInfo.firstChild),hn=t,Ct=!0,Zn=null,r=MP(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Nl(),n===o){t=ii(e,t,r);break e}Nr(e,t,n,r)}t=t.child}return t;case 5:return zP(t),e===null&&Vy(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Hy(n,o)?s=null:i!==null&&Hy(n,i)&&(t.flags|=32),a8(e,t),Nr(e,t,s,r),t.child;case 6:return e===null&&Vy(t),null;case 13:return c8(e,t,r);case 4:return x5(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Bl(t,null,n,r):Nr(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Yn(n,o),MT(e,t,n,o,r);case 7:return Nr(e,t,t.pendingProps,r),t.child;case 8:return Nr(e,t,t.pendingProps.children,r),t.child;case 12:return Nr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,ct(sp,n._currentValue),n._currentValue=s,i!==null)if(no(i.value,s)){if(i.children===o.children&&!Qr.current){t=ii(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=Yo(-1,r&-r),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Ky(i.return,r,t),a.lanes|=r;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(W(341));s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),Ky(s,r,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Nr(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,El(t,r),o=Mn(o),n=n(o),t.flags|=1,Nr(e,t,n,r),t.child;case 14:return n=t.type,o=Yn(n,t.pendingProps),o=Yn(n.type,o),zT(e,t,n,o,r);case 15:return i8(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:Yn(n,o),kh(e,t),t.tag=1,Xr(n)?(e=!0,np(t)):e=!1,El(t,r),OP(t,n,o),Qy(t,n,o,r),Jy(null,t,n,!0,e,r);case 19:return u8(e,t,r);case 22:return s8(e,t,r)}throw Error(W(156,t.tag))};function k8(e,t){return Jk(e,t)}function xB(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nn(e,t,r,n){return new xB(e,t,r,n)}function V5(e){return e=e.prototype,!(!e||!e.isReactComponent)}function NB(e){if(typeof e=="function")return V5(e)?1:0;if(e!=null){if(e=e.$$typeof,e===d5)return 11;if(e===f5)return 14}return 2}function Gi(e,t){var r=e.alternate;return r===null?(r=Nn(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ah(e,t,r,n,o,i){var s=2;if(n=e,typeof e=="function")V5(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case sl:return la(r.children,o,i,t);case u5:s=8,o|=8;break;case Sy:return e=Nn(12,r,t,o|2),e.elementType=Sy,e.lanes=i,e;case by:return e=Nn(13,r,t,o),e.elementType=by,e.lanes=i,e;case Cy:return e=Nn(19,r,t,o),e.elementType=Cy,e.lanes=i,e;case Dk:return Xp(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Bk:s=10;break e;case Ok:s=9;break e;case d5:s=11;break e;case f5:s=14;break e;case Ii:s=16,n=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=Nn(s,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function la(e,t,r,n){return e=Nn(7,e,n,t),e.lanes=r,e}function Xp(e,t,r,n){return e=Nn(22,e,n,t),e.elementType=Dk,e.lanes=r,e.stateNode={isHidden:!1},e}function Hm(e,t,r){return e=Nn(6,e,null,t),e.lanes=r,e}function qm(e,t,r){return t=Nn(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BB(e,t,r,n,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tm(0),this.expirationTimes=Tm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tm(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function K5(e,t,r,n,o,i,s,a,l){return e=new BB(e,t,r,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Nn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},I5(i),e}function OB(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}t(),e.exports=Sn})(D7);const jf=r5(Zd);var YT=Zd;vy.createRoot=YT.createRoot,vy.hydrateRoot=YT.hydrateRoot;/**
+ * @remix-run/router v1.3.2
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function mp(){return mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function jB(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function HB(){return Math.random().toString(36).substr(2,8)}function ZT(e,t){return{usr:e.state,key:e.key,idx:t}}function uS(e,t,r,n){return r===void 0&&(r=null),mp({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?O1(t):t,{state:r,key:t&&t.key||n||HB()})}function I8(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function O1(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function qB(e,t,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:i=!1}=n,s=o.history,a=Li.Pop,l=null,c=u();c==null&&(c=0,s.replaceState(mp({},s.state,{idx:c}),""));function u(){return(s.state||{idx:null}).idx}function d(){a=Li.Pop;let y=u(),g=y==null?null:y-c;c=y,l&&l({action:a,location:v.location,delta:g})}function f(y,g){a=Li.Push;let m=uS(v.location,y,g);r&&r(m,y),c=u()+1;let b=ZT(m,c),C=v.createHref(m);try{s.pushState(b,"",C)}catch{o.location.assign(C)}i&&l&&l({action:a,location:v.location,delta:1})}function p(y,g){a=Li.Replace;let m=uS(v.location,y,g);r&&r(m,y),c=u();let b=ZT(m,c),C=v.createHref(m);s.replaceState(b,"",C),i&&l&&l({action:a,location:v.location,delta:0})}function h(y){let g=o.location.origin!=="null"?o.location.origin:o.location.href,m=typeof y=="string"?y:I8(y);return Jr(g,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,g)}let v={get action(){return a},get location(){return e(o,s)},listen(y){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(JT,d),l=y,()=>{o.removeEventListener(JT,d),l=null}},createHref(y){return t(o,y)},createURL:h,encodeLocation(y){let g=h(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:p,go(y){return s.go(y)}};return v}var e9;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(e9||(e9={}));function UB(e,t,r){r===void 0&&(r="/");let n=typeof t=="string"?O1(t):t,o=B8(n.pathname||"/",r);if(o==null)return null;let i=x8(e);$B(i);let s=null;for(let a=0;s==null&&a{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(Jr(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=_l([n,l.relativePath]),u=r.concat(l);i.children&&i.children.length>0&&(Jr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),x8(i.children,t,u,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:YB(c,i.index),routesMeta:u})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of N8(i.path))o(i,s,l)}),t}function N8(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return o?[i,""]:[i];let s=N8(n.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function $B(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:JB(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const WB=/^:\w+$/,VB=3,KB=2,GB=1,QB=10,XB=-2,t9=e=>e==="*";function YB(e,t){let r=e.split("/"),n=r.length;return r.some(t9)&&(n+=XB),t&&(n+=KB),r.filter(o=>!t9(o)).reduce((o,i)=>o+(WB.test(i)?VB:i===""?GB:QB),n)}function JB(e,t){return e.length===t.length&&e.slice(0,-1).every((n,o)=>n===t[o])?e[e.length-1]-t[t.length-1]:0}function ZB(e,t){let{routesMeta:r}=e,n={},o="/",i=[];for(let s=0;s{if(u==="*"){let f=a[d]||"";s=i.slice(0,i.length-f.length).replace(/(.)\/+$/,"$1")}return c[u]=nO(a[d]||"",u),c},{}),pathname:i,pathnameBase:s,pattern:e}}function tO(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Y5(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(s,a)=>(n.push(a),"/([^\\/]+)"));return e.endsWith("*")?(n.push("*"),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function rO(e){try{return decodeURI(e)}catch(t){return Y5(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function nO(e,t){try{return decodeURIComponent(e)}catch(r){return Y5(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),e}}function B8(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function Y5(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}const _l=e=>e.join("/").replace(/\/\/+/g,"/"),oO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/");function iO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const sO=["post","put","patch","delete"];[...sO];/**
+ * React Router v6.8.1
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function dS(){return dS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.value=n,o.getSnapshot=t,Um(o)&&i({inst:o})},[e,n,t]),uO(()=>(Um(o)&&i({inst:o}),e(()=>{Um(o)&&i({inst:o})})),[e]),fO(n),n}function Um(e){const t=e.getSnapshot,r=e.value;try{const n=t();return!lO(r,n)}catch{return!0}}function pO(e,t,r){return t()}const gO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vO=!gO,mO=vO?pO:hO;"useSyncExternalStore"in ti&&(e=>e.useSyncExternalStore)(ti);const O8=T.createContext(null),D8=T.createContext(null),M8=T.createContext(null),tg=T.createContext(null),D1=T.createContext({outlet:null,matches:[]}),z8=T.createContext(null);function J5(){return T.useContext(tg)!=null}function yO(){return J5()||Jr(!1),T.useContext(tg).location}const SO=T.createContext(null);function bO(e){let t=T.useContext(D1).outlet;return t&&T.createElement(SO.Provider,{value:e},t)}function CO(e,t){J5()||Jr(!1);let{navigator:r}=T.useContext(M8),n=T.useContext(D8),{matches:o}=T.useContext(D1),i=o[o.length-1],s=i?i.params:{};i&&i.pathname;let a=i?i.pathnameBase:"/";i&&i.route;let l=yO(),c;if(t){var u;let v=typeof t=="string"?O1(t):t;a==="/"||(u=v.pathname)!=null&&u.startsWith(a)||Jr(!1),c=v}else c=l;let d=c.pathname||"/",f=a==="/"?d:d.slice(a.length)||"/",p=UB(e,{pathname:f}),h=_O(p&&p.map(v=>Object.assign({},v,{params:Object.assign({},s,v.params),pathname:_l([a,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?a:_l([a,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),o,n||void 0);return t&&h?T.createElement(tg.Provider,{value:{location:dS({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Li.Pop}},h):h}function TO(){let e=AO(),t=iO(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},i=null;return T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},t),r?T.createElement("pre",{style:o},r):null,i)}class EO extends T.Component{constructor(t){super(t),this.state={location:t.location,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location?{error:t.error,location:t.location}:{error:t.error||r.error,location:r.location}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error?T.createElement(D1.Provider,{value:this.props.routeContext},T.createElement(z8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wO(e){let{routeContext:t,match:r,children:n}=e,o=T.useContext(O8);return o&&o.static&&o.staticContext&&r.route.errorElement&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),T.createElement(D1.Provider,{value:t},n)}function _O(e,t,r){if(t===void 0&&(t=[]),e==null)if(r!=null&&r.errors)e=r.matches;else return null;let n=e,o=r==null?void 0:r.errors;if(o!=null){let i=n.findIndex(s=>s.route.id&&(o==null?void 0:o[s.route.id]));i>=0||Jr(!1),n=n.slice(0,Math.min(n.length,i+1))}return n.reduceRight((i,s,a)=>{let l=s.route.id?o==null?void 0:o[s.route.id]:null,c=r?s.route.errorElement||T.createElement(TO,null):null,u=t.concat(n.slice(0,a+1)),d=()=>T.createElement(wO,{match:s,routeContext:{outlet:i,matches:u}},l?c:s.route.element!==void 0?s.route.element:i);return r&&(s.route.errorElement||a===0)?T.createElement(EO,{location:r.location,component:c,error:l,children:d(),routeContext:{outlet:null,matches:u}}):d()},null)}var r9;(function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator"})(r9||(r9={}));var yp;(function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"})(yp||(yp={}));function kO(e){let t=T.useContext(D8);return t||Jr(!1),t}function PO(e){let t=T.useContext(D1);return t||Jr(!1),t}function RO(e){let t=PO(),r=t.matches[t.matches.length-1];return r.route.id||Jr(!1),r.route.id}function AO(){var e;let t=T.useContext(z8),r=kO(yp.UseRouteError),n=RO(yp.UseRouteError);return t||((e=r.errors)==null?void 0:e[n])}function IO(e){return bO(e.context)}function Ih(e){Jr(!1)}function xO(e){let{basename:t="/",children:r=null,location:n,navigationType:o=Li.Pop,navigator:i,static:s=!1}=e;J5()&&Jr(!1);let a=t.replace(/^\/*/,"/"),l=T.useMemo(()=>({basename:a,navigator:i,static:s}),[a,i,s]);typeof n=="string"&&(n=O1(n));let{pathname:c="/",search:u="",hash:d="",state:f=null,key:p="default"}=n,h=T.useMemo(()=>{let v=B8(c,a);return v==null?null:{pathname:v,search:u,hash:d,state:f,key:p}},[a,c,u,d,f,p]);return h==null?null:T.createElement(M8.Provider,{value:l},T.createElement(tg.Provider,{children:r,value:{location:h,navigationType:o}}))}function NO(e){let{children:t,location:r}=e,n=T.useContext(O8),o=n&&!t?n.router.routes:fS(t);return CO(o,r)}var n9;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(n9||(n9={}));new Promise(()=>{});function fS(e,t){t===void 0&&(t=[]);let r=[];return T.Children.forEach(e,(n,o)=>{if(!T.isValidElement(n))return;if(n.type===T.Fragment){r.push.apply(r,fS(n.props.children,t));return}n.type!==Ih&&Jr(!1),!n.props.index||!n.props.children||Jr(!1);let i=[...t,o],s={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,hasErrorBoundary:n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle};n.props.children&&(s.children=fS(n.props.children,i)),r.push(s)}),r}/**
+ * React Router DOM v6.8.1
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function BO(e){let{basename:t,children:r,window:n}=e,o=T.useRef();o.current==null&&(o.current=FB({window:n,v5Compat:!0}));let i=o.current,[s,a]=T.useState({action:i.action,location:i.location});return T.useLayoutEffect(()=>i.listen(a),[i]),T.createElement(xO,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:i})}var o9;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"})(o9||(o9={}));var i9;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(i9||(i9={}));const OO="/assets/msft_logo_white-1da561dd.png",DO="/assets/msft_logo_gray-c17d0524.png",MO=(e,t)=>{switch(t.type){case"TOGGLE_CHAT_HISTORY":return{...e,isChatHistoryOpen:!e.isChatHistoryOpen};case"UPDATE_CURRENT_CHAT":return{...e,currentChat:t.payload};case"UPDATE_CHAT_HISTORY_LOADING_STATE":return{...e,chatHistoryLoadingState:t.payload};case"UPDATE_CHAT_HISTORY":if(!e.chatHistory||!e.currentChat)return e;let r=e.chatHistory.findIndex(s=>s.id===t.payload.id);if(r!==-1){let s=[...e.chatHistory];return s[r]=e.currentChat,{...e,chatHistory:s}}else return{...e,chatHistory:[...e.chatHistory,t.payload]};case"UPDATE_CHAT_TITLE":if(!e.chatHistory)return{...e,chatHistory:[]};let n=e.chatHistory.map(s=>{var a;return s.id===t.payload.id?(((a=e.currentChat)==null?void 0:a.id)===t.payload.id&&(e.currentChat.title=t.payload.title),{...s,title:t.payload.title}):s});return{...e,chatHistory:n};case"DELETE_CHAT_ENTRY":if(!e.chatHistory)return{...e,chatHistory:[]};let o=e.chatHistory.filter(s=>s.id!==t.payload);return e.currentChat=null,{...e,chatHistory:o};case"DELETE_CHAT_HISTORY":return{...e,chatHistory:[],filteredChatHistory:[],currentChat:null};case"DELETE_CURRENT_CHAT_MESSAGES":if(!e.currentChat||!e.chatHistory)return e;const i={...e.currentChat,messages:[]};return{...e,currentChat:i};case"FETCH_CHAT_HISTORY":return{...e,chatHistory:t.payload};case"SET_COSMOSDB_STATUS":return{...e,isCosmosDBAvailable:t.payload};case"FETCH_FRONTEND_SETTINGS":return{...e,frontendSettings:t.payload};case"SET_FEEDBACK_STATE":return{...e,feedbackState:{...e.feedbackState,[t.payload.answerId]:t.payload.feedback}};case"SET_AUDIO_SERVICE":return{...e,audioService:t.payload};case"TOGGLE_AUDIO_MUTE":return{...e,audioMuted:!e.audioMuted};default:return e}};var un=(e=>(e.NotConfigured="CosmosDB is not configured",e.NotWorking="CosmosDB is not working",e.Working="CosmosDB is configured and working",e))(un||{}),Er=(e=>(e.Loading="loading",e.Success="success",e.Fail="fail",e.NotStarted="notStarted",e))(Er||{}),ze=(e=>(e.Neutral="neutral",e.Positive="positive",e.Negative="negative",e.MissingCitation="missing_citation",e.WrongCitation="wrong_citation",e.OutOfScope="out_of_scope",e.InaccurateOrIrrelevant="inaccurate_or_irrelevant",e.OtherUnhelpful="other_unhelpful",e.HateSpeech="hate_speech",e.Violent="violent",e.Sexual="sexual",e.Manipulative="manipulative",e.OtherHarmful="other_harmlful",e))(ze||{});async function zO(e,t,r){console.log("conversationApi",e,r);const n=new FormData;return r&&n.append("file",r),n.append("messages",JSON.stringify(e.messages)),await fetch("/conversation",{method:"POST",body:n,signal:t})}async function LO(){const e=await fetch("/.auth/me");return e.ok?await e.json():(console.log("No identity provider found. Access to chat will be blocked."),[])}const L8=async(e=0)=>await fetch(`/history/list?offset=${e}`,{method:"GET"}).then(async r=>{const n=await r.json();return Array.isArray(n)?await Promise.all(n.map(async i=>{let s=[];return s=await FO(i.id).then(l=>l).catch(l=>(console.error("error fetching messages: ",l),[])),{id:i.id,title:i.title,date:i.createdAt,messages:s}})):(console.error("There was an issue fetching your data."),null)}).catch(r=>(console.error("There was an issue fetching your data."),null)),FO=async e=>await fetch("/history/read",{method:"POST",body:JSON.stringify({conversation_id:e}),headers:{"Content-Type":"application/json"}}).then(async r=>{if(!r)return[];const n=await r.json();let o=[];return n!=null&&n.messages&&n.messages.forEach(i=>{const s={id:i.id,role:i.role,date:i.createdAt,content:i.content,feedback:i.feedback??void 0};o.push(s)}),o}).catch(r=>(console.error("There was an issue fetching your data."),[])),s9=async(e,t,r)=>{let n;return r?n=JSON.stringify({conversation_id:r,messages:e.messages}):n=JSON.stringify({messages:e.messages}),await fetch("/history/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:n,signal:t}).then(i=>i).catch(i=>(console.error("There was an issue fetching your data."),new Response))},jO=async(e,t)=>await fetch("/history/update",{method:"POST",body:JSON.stringify({conversation_id:t,messages:e}),headers:{"Content-Type":"application/json"}}).then(async n=>n).catch(n=>(console.error("There was an issue fetching your data."),{...new Response,ok:!1,status:500})),HO=async e=>await fetch("/history/delete",{method:"DELETE",body:JSON.stringify({conversation_id:e}),headers:{"Content-Type":"application/json"}}).then(r=>r).catch(r=>(console.error("There was an issue fetching your data."),{...new Response,ok:!1,status:500})),qO=async()=>await fetch("/history/delete_all",{method:"DELETE",body:JSON.stringify({}),headers:{"Content-Type":"application/json"}}).then(t=>t).catch(t=>(console.error("There was an issue fetching your data."),{...new Response,ok:!1,status:500})),UO=async e=>await fetch("/history/clear",{method:"POST",body:JSON.stringify({conversation_id:e}),headers:{"Content-Type":"application/json"}}).then(r=>r).catch(r=>(console.error("There was an issue fetching your data."),{...new Response,ok:!1,status:500})),$O=async(e,t)=>await fetch("/history/rename",{method:"POST",body:JSON.stringify({conversation_id:e,title:t}),headers:{"Content-Type":"application/json"}}).then(n=>n).catch(n=>(console.error("There was an issue fetching your data."),{...new Response,ok:!1,status:500})),WO=async()=>await fetch("/history/ensure",{method:"GET"}).then(async t=>{let r=await t.json(),n;return r.message?n=un.Working:t.status===500?n=un.NotWorking:n=un.NotConfigured,t.ok?{cosmosDB:!0,status:n}:{cosmosDB:!1,status:n}}).catch(t=>(console.error("There was an issue fetching your data."),{cosmosDB:!1,status:t}));async function a9(){const e=await fetch("/speech/issueToken");if(!e.ok){console.log("Can't retrieve access token, speech will be disabled.");return}const t=await e.json(),r=new Date;return r.setMinutes(r.getMinutes()+9),{access_token:t.access_token,region:t.region,expiresTime:r}}const VO=async()=>await fetch("/frontend_settings",{method:"GET"}).then(t=>t.json()).catch(t=>(console.error("There was an issue fetching your data."),null)),$m=async(e,t,r)=>await fetch("/history/message_feedback",{method:"POST",body:JSON.stringify({message_id:e,message_feedback:t,msr_feedback:r??!1}),headers:{"Content-Type":"application/json"}}).then(o=>o).catch(o=>(console.error("There was an issue logging feedback."),{...new Response,ok:!1,status:500}));var xr={},Wm={},rg={},Vm={},It={},Zl={},Ln={},F8={},ng={},og={};Object.defineProperty(og,"__esModule",{value:!0});og.default=GO;let Hf;const KO=new Uint8Array(16);function GO(){if(!Hf&&(Hf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hf(KO)}var cs={},ka={},ig={};Object.defineProperty(ig,"__esModule",{value:!0});ig.default=void 0;var QO=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;ig.default=QO;Object.defineProperty(ka,"__esModule",{value:!0});ka.default=void 0;var XO=YO(ig);function YO(e){return e&&e.__esModule?e:{default:e}}function JO(e){return typeof e=="string"&&XO.default.test(e)}var ZO=JO;ka.default=ZO;Object.defineProperty(cs,"__esModule",{value:!0});cs.default=void 0;cs.unsafeStringify=j8;var eD=tD(ka);function tD(e){return e&&e.__esModule?e:{default:e}}const nr=[];for(let e=0;e<256;++e)nr.push((e+256).toString(16).slice(1));function j8(e,t=0){return nr[e[t+0]]+nr[e[t+1]]+nr[e[t+2]]+nr[e[t+3]]+"-"+nr[e[t+4]]+nr[e[t+5]]+"-"+nr[e[t+6]]+nr[e[t+7]]+"-"+nr[e[t+8]]+nr[e[t+9]]+"-"+nr[e[t+10]]+nr[e[t+11]]+nr[e[t+12]]+nr[e[t+13]]+nr[e[t+14]]+nr[e[t+15]]}function rD(e,t=0){const r=j8(e,t);if(!(0,eD.default)(r))throw TypeError("Stringified UUID is invalid");return r}var nD=rD;cs.default=nD;Object.defineProperty(ng,"__esModule",{value:!0});ng.default=void 0;var oD=sD(og),iD=cs;function sD(e){return e&&e.__esModule?e:{default:e}}let l9,Km,Gm=0,Qm=0;function aD(e,t,r){let n=t&&r||0;const o=t||new Array(16);e=e||{};let i=e.node||l9,s=e.clockseq!==void 0?e.clockseq:Km;if(i==null||s==null){const f=e.random||(e.rng||oD.default)();i==null&&(i=l9=[f[0]|1,f[1],f[2],f[3],f[4],f[5]]),s==null&&(s=Km=(f[6]<<8|f[7])&16383)}let a=e.msecs!==void 0?e.msecs:Date.now(),l=e.nsecs!==void 0?e.nsecs:Qm+1;const c=a-Gm+(l-Qm)/1e4;if(c<0&&e.clockseq===void 0&&(s=s+1&16383),(c<0||a>Gm)&&e.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Gm=a,Qm=l,Km=s,a+=122192928e5;const u=((a&268435455)*1e4+l)%4294967296;o[n++]=u>>>24&255,o[n++]=u>>>16&255,o[n++]=u>>>8&255,o[n++]=u&255;const d=a/4294967296*1e4&268435455;o[n++]=d>>>8&255,o[n++]=d&255,o[n++]=d>>>24&15|16,o[n++]=d>>>16&255,o[n++]=s>>>8|128,o[n++]=s&255;for(let f=0;f<6;++f)o[n+f]=i[f];return t||(0,iD.unsafeStringify)(o)}var lD=aD;ng.default=lD;var sg={},ts={},M1={};Object.defineProperty(M1,"__esModule",{value:!0});M1.default=void 0;var cD=uD(ka);function uD(e){return e&&e.__esModule?e:{default:e}}function dD(e){if(!(0,cD.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var fD=dD;M1.default=fD;Object.defineProperty(ts,"__esModule",{value:!0});ts.URL=ts.DNS=void 0;ts.default=mD;var hD=cs,pD=gD(M1);function gD(e){return e&&e.__esModule?e:{default:e}}function vD(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r>5]>>>o%32&255,s=parseInt(n.charAt(i>>>4&15)+n.charAt(i&15),16);t.push(s)}return t}function U8(e){return(e+64>>>9<<4)+14+1}function bD(e,t){e[t>>5]|=128<>5]|=(e[n/8]&255)<>16)+(t>>16)+(r>>16)<<16|r&65535}function TD(e,t){return e<>>32-t}function lg(e,t,r,n,o,i){return Fi(TD(Fi(Fi(t,e),Fi(n,i)),o),r)}function Sr(e,t,r,n,o,i,s){return lg(t&r|~t&n,e,t,o,i,s)}function br(e,t,r,n,o,i,s){return lg(t&n|r&~n,e,t,o,i,s)}function Cr(e,t,r,n,o,i,s){return lg(t^r^n,e,t,o,i,s)}function Tr(e,t,r,n,o,i,s){return lg(r^(t|~n),e,t,o,i,s)}var ED=yD;ag.default=ED;Object.defineProperty(sg,"__esModule",{value:!0});sg.default=void 0;var wD=$8(ts),_D=$8(ag);function $8(e){return e&&e.__esModule?e:{default:e}}const kD=(0,wD.default)("v3",48,_D.default);var PD=kD;sg.default=PD;var cg={},ug={};Object.defineProperty(ug,"__esModule",{value:!0});ug.default=void 0;const RD=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var AD={randomUUID:RD};ug.default=AD;Object.defineProperty(cg,"__esModule",{value:!0});cg.default=void 0;var c9=W8(ug),ID=W8(og),xD=cs;function W8(e){return e&&e.__esModule?e:{default:e}}function ND(e,t,r){if(c9.default.randomUUID&&!t&&!e)return c9.default.randomUUID();e=e||{};const n=e.random||(e.rng||ID.default)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return(0,xD.unsafeStringify)(n)}var BD=ND;cg.default=BD;var dg={},fg={};Object.defineProperty(fg,"__esModule",{value:!0});fg.default=void 0;function OD(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Xm(e,t){return e<>>32-t}function DD(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){const s=unescape(encodeURIComponent(e));e=[];for(let a=0;a>>0;f=d,d=u,u=Xm(c,30)>>>0,c=l,l=v}r[0]=r[0]+l>>>0,r[1]=r[1]+c>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+d>>>0,r[4]=r[4]+f>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var MD=DD;fg.default=MD;Object.defineProperty(dg,"__esModule",{value:!0});dg.default=void 0;var zD=V8(ts),LD=V8(fg);function V8(e){return e&&e.__esModule?e:{default:e}}const FD=(0,zD.default)("v5",80,LD.default);var jD=FD;dg.default=jD;var hg={};Object.defineProperty(hg,"__esModule",{value:!0});hg.default=void 0;var HD="00000000-0000-0000-0000-000000000000";hg.default=HD;var pg={};Object.defineProperty(pg,"__esModule",{value:!0});pg.default=void 0;var qD=UD(ka);function UD(e){return e&&e.__esModule?e:{default:e}}function $D(e){if(!(0,qD.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}var WD=$D;pg.default=WD;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return s.default}});var t=u(ng),r=u(sg),n=u(cg),o=u(dg),i=u(hg),s=u(pg),a=u(ka),l=u(cs),c=u(M1);function u(d){return d&&d.__esModule?d:{default:d}}})(F8);Object.defineProperty(Ln,"__esModule",{value:!0});Ln.createNoDashGuid=Ln.createGuid=void 0;const VD=F8,K8=()=>VD.v4();Ln.createGuid=K8;const KD=()=>K8().replace(new RegExp("-","g"),"").toUpperCase();Ln.createNoDashGuid=KD;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformEvent=e.EventType=void 0;const t=Ln;(function(n){n[n.Debug=0]="Debug",n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error",n[n.None=4]="None"})(e.EventType||(e.EventType={}));class r{constructor(o,i){this.privName=o,this.privEventId=t.createNoDashGuid(),this.privEventTime=new Date().toISOString(),this.privEventType=i,this.privMetadata={}}get name(){return this.privName}get eventId(){return this.privEventId}get eventTime(){return this.privEventTime}get eventType(){return this.privEventType}get metadata(){return this.privMetadata}}e.PlatformEvent=r})(Zl);Object.defineProperty(It,"__esModule",{value:!0});It.AudioStreamNodeErrorEvent=It.AudioStreamNodeDetachedEvent=It.AudioStreamNodeAttachedEvent=It.AudioStreamNodeAttachingEvent=It.AudioStreamNodeEvent=It.AudioSourceErrorEvent=It.AudioSourceOffEvent=It.AudioSourceReadyEvent=It.AudioSourceInitializingEvent=It.AudioSourceEvent=void 0;const hS=Zl;class ec extends hS.PlatformEvent{constructor(t,r,n=hS.EventType.Info){super(t,n),this.privAudioSourceId=r}get audioSourceId(){return this.privAudioSourceId}}It.AudioSourceEvent=ec;class GD extends ec{constructor(t){super("AudioSourceInitializingEvent",t)}}It.AudioSourceInitializingEvent=GD;class QD extends ec{constructor(t){super("AudioSourceReadyEvent",t)}}It.AudioSourceReadyEvent=QD;class XD extends ec{constructor(t){super("AudioSourceOffEvent",t)}}It.AudioSourceOffEvent=XD;class YD extends ec{constructor(t,r){super("AudioSourceErrorEvent",t,hS.EventType.Error),this.privError=r}get error(){return this.privError}}It.AudioSourceErrorEvent=YD;class z1 extends ec{constructor(t,r,n){super(t,r),this.privAudioNodeId=n}get audioNodeId(){return this.privAudioNodeId}}It.AudioStreamNodeEvent=z1;class JD extends z1{constructor(t,r){super("AudioStreamNodeAttachingEvent",t,r)}}It.AudioStreamNodeAttachingEvent=JD;class ZD extends z1{constructor(t,r){super("AudioStreamNodeAttachedEvent",t,r)}}It.AudioStreamNodeAttachedEvent=ZD;class eM extends z1{constructor(t,r){super("AudioStreamNodeDetachedEvent",t,r)}}It.AudioStreamNodeDetachedEvent=eM;class tM extends z1{constructor(t,r,n){super("AudioStreamNodeErrorEvent",t,r),this.privError=n}get error(){return this.privError}}It.AudioStreamNodeErrorEvent=tM;var jt={};Object.defineProperty(jt,"__esModule",{value:!0});jt.ConnectionMessageSentEvent=jt.ConnectionMessageReceivedEvent=jt.ConnectionEstablishErrorEvent=jt.ConnectionErrorEvent=jt.ConnectionClosedEvent=jt.ConnectionEstablishedEvent=jt.ConnectionStartEvent=jt.ConnectionEvent=jt.ServiceEvent=void 0;const ma=Zl;class rM extends ma.PlatformEvent{constructor(t,r,n=ma.EventType.Info){super(t,n),this.privJsonResult=r}get jsonString(){return this.privJsonResult}}jt.ServiceEvent=rM;class us extends ma.PlatformEvent{constructor(t,r,n=ma.EventType.Info){super(t,n),this.privConnectionId=r}get connectionId(){return this.privConnectionId}}jt.ConnectionEvent=us;class nM extends us{constructor(t,r,n){super("ConnectionStartEvent",t),this.privUri=r,this.privHeaders=n}get uri(){return this.privUri}get headers(){return this.privHeaders}}jt.ConnectionStartEvent=nM;class oM extends us{constructor(t){super("ConnectionEstablishedEvent",t)}}jt.ConnectionEstablishedEvent=oM;class iM extends us{constructor(t,r,n){super("ConnectionClosedEvent",t,ma.EventType.Debug),this.privReason=n,this.privStatusCode=r}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}jt.ConnectionClosedEvent=iM;class sM extends us{constructor(t,r,n){super("ConnectionErrorEvent",t,ma.EventType.Debug),this.privMessage=r,this.privType=n}get message(){return this.privMessage}get type(){return this.privType}}jt.ConnectionErrorEvent=sM;class aM extends us{constructor(t,r,n){super("ConnectionEstablishErrorEvent",t,ma.EventType.Error),this.privStatusCode=r,this.privReason=n}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}jt.ConnectionEstablishErrorEvent=aM;class lM extends us{constructor(t,r,n){super("ConnectionMessageReceivedEvent",t),this.privNetworkReceivedTime=r,this.privMessage=n}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}jt.ConnectionMessageReceivedEvent=lM;class cM extends us{constructor(t,r,n){super("ConnectionMessageSentEvent",t),this.privNetworkSentTime=r,this.privMessage=n}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}jt.ConnectionMessageSentEvent=cM;var Z5={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});cr.ObjectDisposedError=cr.InvalidOperationError=cr.ArgumentNullError=void 0;class uM extends Error{constructor(t){super(t),this.name="ArgumentNull",this.message=t}}cr.ArgumentNullError=uM;class dM extends Error{constructor(t){super(t),this.name="InvalidOperation",this.message=t}}cr.InvalidOperationError=dM;class fM extends Error{constructor(t,r){super(r),this.name=t+"ObjectDisposed",this.message=r}}cr.ObjectDisposedError=fM;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectionMessage=e.MessageType=void 0;const t=cr,r=Ln;var n;(function(i){i[i.Text=0]="Text",i[i.Binary=1]="Binary"})(n=e.MessageType||(e.MessageType={}));class o{constructor(s,a,l,c){if(this.privBody=null,s===n.Text&&a&&typeof a!="string")throw new t.InvalidOperationError("Payload must be a string");if(s===n.Binary&&a&&!(a instanceof ArrayBuffer))throw new t.InvalidOperationError("Payload must be ArrayBuffer");switch(this.privMessageType=s,this.privBody=a,this.privHeaders=l||{},this.privId=c||r.createNoDashGuid(),this.messageType){case n.Binary:this.privSize=this.binaryBody!==null?this.binaryBody.byteLength:0;break;case n.Text:this.privSize=this.textBody.length}}get messageType(){return this.privMessageType}get headers(){return this.privHeaders}get body(){return this.privBody}get textBody(){if(this.privMessageType===n.Binary)throw new t.InvalidOperationError("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===n.Text)throw new t.InvalidOperationError("Not supported for text message");return this.privBody}get id(){return this.privId}}e.ConnectionMessage=o})(Z5);var gg={};Object.defineProperty(gg,"__esModule",{value:!0});gg.ConnectionOpenResponse=void 0;class hM{constructor(t,r){this.privStatusCode=t,this.privReason=r}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}gg.ConnectionOpenResponse=hM;var vg={};Object.defineProperty(vg,"__esModule",{value:!0});vg.DeferralMap=void 0;class pM{constructor(){this.privMap={}}add(t,r){this.privMap[t]=r}getId(t){return this.privMap[t]}complete(t,r){try{this.privMap[t].resolve(r)}catch(n){this.privMap[t].reject(n)}finally{this.privMap[t]=void 0}}}vg.DeferralMap=pM;var ya={};Object.defineProperty(ya,"__esModule",{value:!0});ya.SendingAgentContextMessageEvent=ya.DialogEvent=void 0;const u9=Zl;class G8 extends u9.PlatformEvent{constructor(t,r=u9.EventType.Info){super(t,r)}}ya.DialogEvent=G8;class gM extends G8{constructor(t){super("SendingAgentContextMessageEvent"),this.privAgentConfig=t}get agentConfig(){return this.privAgentConfig}}ya.SendingAgentContextMessageEvent=gM;var mg={},L1={};Object.defineProperty(L1,"__esModule",{value:!0});L1.EventSource=void 0;const vM=cr,mM=Ln;class yM{constructor(t){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=t}onEvent(t){if(this.isDisposed())throw new vM.ObjectDisposedError("EventSource");if(this.metadata)for(const r in this.metadata)r&&t.metadata&&(t.metadata[r]||(t.metadata[r]=this.metadata[r]));for(const r in this.privEventListeners)r&&this.privEventListeners[r]&&this.privEventListeners[r](t)}attach(t){const r=mM.createNoDashGuid();return this.privEventListeners[r]=t,{detach:()=>(delete this.privEventListeners[r],Promise.resolve())}}attachListener(t){return this.attach(r=>t.onEvent(r))}attachConsoleListener(t){return this.privConsoleListener&&this.privConsoleListener.detach(),this.privConsoleListener=this.attach(r=>t.onEvent(r)),this.privConsoleListener}isDisposed(){return this.privIsDisposed}dispose(){this.privEventListeners=null,this.privIsDisposed=!0}get metadata(){return this.privMetadata}}L1.EventSource=yM;Object.defineProperty(mg,"__esModule",{value:!0});mg.Events=void 0;const SM=cr,bM=L1;class m1{static setEventSource(t){if(!t)throw new SM.ArgumentNullError("eventSource");m1.privInstance=t}static get instance(){return m1.privInstance}}mg.Events=m1;m1.privInstance=new bM.EventSource;var Q8={};Object.defineProperty(Q8,"__esModule",{value:!0});var X8={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectionState=void 0,function(t){t[t.None=0]="None",t[t.Connected=1]="Connected",t[t.Connecting=2]="Connecting",t[t.Disconnected=3]="Disconnected"}(e.ConnectionState||(e.ConnectionState={}))})(X8);var Y8={};Object.defineProperty(Y8,"__esModule",{value:!0});var J8={};Object.defineProperty(J8,"__esModule",{value:!0});var Z8={};Object.defineProperty(Z8,"__esModule",{value:!0});var eR={};Object.defineProperty(eR,"__esModule",{value:!0});var tR={};Object.defineProperty(tR,"__esModule",{value:!0});var rR={};Object.defineProperty(rR,"__esModule",{value:!0});var nR={};Object.defineProperty(nR,"__esModule",{value:!0});var oR={};Object.defineProperty(oR,"__esModule",{value:!0});var F1={};Object.defineProperty(F1,"__esModule",{value:!0});F1.List=void 0;const CM=cr;let TM=class Ks{constructor(t){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.privList=[],t)for(const r of t)this.privList.push(r)}get(t){return this.throwIfDisposed(),this.privList[t]}first(){return this.get(0)}last(){return this.get(this.length()-1)}add(t){this.throwIfDisposed(),this.insertAt(this.privList.length,t)}insertAt(t,r){this.throwIfDisposed(),t===0?this.privList.unshift(r):t===this.privList.length?this.privList.push(r):this.privList.splice(t,0,r),this.triggerSubscriptions(this.privAddSubscriptions)}removeFirst(){return this.throwIfDisposed(),this.removeAt(0)}removeLast(){return this.throwIfDisposed(),this.removeAt(this.length()-1)}removeAt(t){return this.throwIfDisposed(),this.remove(t,1)[0]}remove(t,r){this.throwIfDisposed();const n=this.privList.splice(t,r);return this.triggerSubscriptions(this.privRemoveSubscriptions),n}clear(){this.throwIfDisposed(),this.remove(0,this.length())}length(){return this.throwIfDisposed(),this.privList.length}onAdded(t){this.throwIfDisposed();const r=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[r]=t,{detach:()=>(delete this.privAddSubscriptions[r],Promise.resolve())}}onRemoved(t){this.throwIfDisposed();const r=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[r]=t,{detach:()=>(delete this.privRemoveSubscriptions[r],Promise.resolve())}}onDisposed(t){this.throwIfDisposed();const r=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[r]=t,{detach:()=>(delete this.privDisposedSubscriptions[r],Promise.resolve())}}join(t){return this.throwIfDisposed(),this.privList.join(t)}toArray(){const t=Array();return this.privList.forEach(r=>{t.push(r)}),t}any(t){return this.throwIfDisposed(),t?this.where(t).length()>0:this.length()>0}all(t){return this.throwIfDisposed(),this.where(t).length()===this.length()}forEach(t){this.throwIfDisposed();for(let r=0;rt(n,r))}clone(){return this.throwIfDisposed(),new Ks(this.toArray())}concat(t){return this.throwIfDisposed(),new Ks(this.privList.concat(t.toArray()))}concatArray(t){return this.throwIfDisposed(),new Ks(this.privList.concat(t))}isDisposed(){return this.privList==null}dispose(t){this.isDisposed()||(this.privDisposeReason=t,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))}throwIfDisposed(){if(this.isDisposed())throw new CM.ObjectDisposedError("List",this.privDisposeReason)}triggerSubscriptions(t){if(t)for(const r in t)r&&t[r]()}};F1.List=TM;var eb={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.marshalPromiseToCallbacks=e.Sink=e.Deferred=e.PromiseResultEventSource=e.PromiseResult=e.PromiseState=void 0;var t;(function(a){a[a.None=0]="None",a[a.Resolved=1]="Resolved",a[a.Rejected=2]="Rejected"})(t=e.PromiseState||(e.PromiseState={}));class r{constructor(l){this.throwIfError=()=>{if(this.isError)throw this.error},l.on(c=>{this.privIsCompleted||(this.privIsCompleted=!0,this.privIsError=!1,this.privResult=c)},c=>{this.privIsCompleted||(this.privIsCompleted=!0,this.privIsError=!0,this.privError=c)})}get isCompleted(){return this.privIsCompleted}get isError(){return this.privIsError}get error(){return this.privError}get result(){return this.privResult}}e.PromiseResult=r;class n{constructor(){this.setResult=l=>{this.privOnSetResult(l)},this.setError=l=>{this.privOnSetError(l)},this.on=(l,c)=>{this.privOnSetResult=l,this.privOnSetError=c}}}e.PromiseResultEventSource=n;class o{constructor(){this.resolve=l=>(this.privResolve(l),this),this.reject=l=>(this.privReject(l),this),this.privPromise=new Promise((l,c)=>{this.privResolve=l,this.privReject=c})}get promise(){return this.privPromise}}e.Deferred=o;class i{constructor(){this.privState=t.None,this.privPromiseResult=null,this.privPromiseResultEvents=null,this.privSuccessHandlers=[],this.privErrorHandlers=[],this.privPromiseResultEvents=new n,this.privPromiseResult=new r(this.privPromiseResultEvents)}get state(){return this.privState}get result(){return this.privPromiseResult}resolve(l){if(this.privState!==t.None)throw new Error("'Cannot resolve a completed promise'");this.privState=t.Resolved,this.privPromiseResultEvents.setResult(l);for(let c=0;c{}),this.privState===t.None?(this.privSuccessHandlers.push(l),this.privErrorHandlers.push(c)):(this.privState===t.Resolved?this.executeSuccessCallback(this.privPromiseResult.result,l,c):this.privState===t.Rejected&&this.executeErrorCallback(this.privPromiseResult.error,c),this.detachHandlers())}executeSuccessCallback(l,c,u){try{c(l)}catch(d){this.executeErrorCallback(`'Unhandled callback error: ${d}'`,u)}}executeErrorCallback(l,c){if(c)try{c(l)}catch(u){throw new Error(`'Unhandled callback error: ${u}. InnerError: ${l}'`)}else throw new Error(`'Unhandled error: ${l}'`)}detachHandlers(){this.privErrorHandlers=[],this.privSuccessHandlers=[]}}e.Sink=i;function s(a,l,c){a.then(u=>{try{l&&l(u)}catch(d){if(c)try{if(d instanceof Error){const f=d;c(f.name+": "+f.message)}else c(d)}catch{}}},u=>{if(c)try{if(u instanceof Error){const d=u;c(d.name+": "+d.message)}else c(u)}catch{}})}e.marshalPromiseToCallbacks=s})(eb);var j1={};Object.defineProperty(j1,"__esModule",{value:!0});j1.Queue=void 0;const Ym=cr,Jm=F1,d9=eb;var Hd;(function(e){e[e.Dequeue=0]="Dequeue",e[e.Peek=1]="Peek"})(Hd||(Hd={}));class EM{constructor(t){this.privPromiseStore=new Jm.List,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=t||new Jm.List,this.privDetachables=[],this.privSubscribers=new Jm.List,this.privDetachables.push(this.privList.onAdded(()=>this.drain()))}enqueue(t){this.throwIfDispose(),this.enqueueFromPromise(new Promise(r=>r(t)))}enqueueFromPromise(t){this.throwIfDispose(),t.then(r=>{this.privList.add(r)},()=>{})}dequeue(){this.throwIfDispose();const t=new d9.Deferred;return this.privSubscribers&&(this.privSubscribers.add({deferral:t,type:Hd.Dequeue}),this.drain()),t.promise}peek(){this.throwIfDispose();const t=new d9.Deferred;return this.privSubscribers&&(this.privSubscribers.add({deferral:t,type:Hd.Peek}),this.drain()),t.promise}length(){return this.throwIfDispose(),this.privList.length()}isDisposed(){return this.privSubscribers==null}async drainAndDispose(t,r){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=r,this.privIsDisposing=!0;const n=this.privSubscribers;if(n){for(;n.length()>0;)n.removeFirst().deferral.resolve(void 0);this.privSubscribers===n&&(this.privSubscribers=n)}for(const o of this.privDetachables)await o.detach();if(this.privPromiseStore.length()>0&&t){const o=[];return this.privPromiseStore.toArray().forEach(i=>{o.push(i)}),Promise.all(o).finally(()=>{this.privSubscribers=null,this.privList.forEach(i=>{t(i)}),this.privList=null}).then()}else this.privSubscribers=null,this.privList=null}}async dispose(t){await this.drainAndDispose(null,t)}drain(){if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const t=this.privSubscribers,r=this.privList;if(t&&r){for(;r.length()>0&&t.length()>0&&!this.privIsDisposing;){const n=t.removeFirst();if(n.type===Hd.Peek)n.deferral.resolve(r.first());else{const o=r.removeFirst();n.deferral.resolve(o)}}this.privSubscribers===t&&(this.privSubscribers=t),this.privList===r&&(this.privList=r)}this.privIsDrainInProgress=!1}}throwIfDispose(){if(this.isDisposed())throw this.privDisposeReason?new Ym.InvalidOperationError(this.privDisposeReason):new Ym.ObjectDisposedError("Queue");if(this.privIsDisposing)throw new Ym.InvalidOperationError("Queue disposing")}}j1.Queue=EM;var yg={};Object.defineProperty(yg,"__esModule",{value:!0});yg.RawWebsocketMessage=void 0;const qf=Z5,wc=cr,wM=Ln;class _M{constructor(t,r,n){if(this.privPayload=null,!r)throw new wc.ArgumentNullError("payload");if(t===qf.MessageType.Binary&&Object.getPrototypeOf(r).constructor.name!=="ArrayBuffer")throw new wc.InvalidOperationError("Payload must be ArrayBuffer");if(t===qf.MessageType.Text&&typeof r!="string")throw new wc.InvalidOperationError("Payload must be a string");this.privMessageType=t,this.privPayload=r,this.privId=n||wM.createNoDashGuid()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===qf.MessageType.Binary)throw new wc.InvalidOperationError("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===qf.MessageType.Text)throw new wc.InvalidOperationError("Not supported for text message");return this.privPayload}get id(){return this.privId}}yg.RawWebsocketMessage=_M;var Sg={};Object.defineProperty(Sg,"__esModule",{value:!0});Sg.RiffPcmEncoder=void 0;class kM{constructor(t,r){this.privActualSampleRate=t,this.privDesiredSampleRate=r}encode(t){const r=this.downSampleAudioFrame(t,this.privActualSampleRate,this.privDesiredSampleRate);if(!r)return null;const n=r.length*2,o=new ArrayBuffer(n),i=new DataView(o);return this.floatTo16BitPCM(i,0,r),o}setString(t,r,n){for(let o=0;or)return t;const o=r/n,i=Math.round(t.length/o),s=new Float32Array(i);let a=0,l=0;for(;l((t===void 0||t.isEnd)&&await this.privReaderQueue.dispose("End of stream reached"),t))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new h9.Queue)}throwIfClosed(){if(this.privIsWriteEnded)throw new f9.InvalidOperationError("Stream closed")}}bg.Stream=RM;var Cg={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TranslationStatus=void 0,function(t){t[t.Success=0]="Success",t[t.Error=1]="Error"}(e.TranslationStatus||(e.TranslationStatus={}))})(Cg);var _c={},p9;function AM(){if(p9)return _c;p9=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.ChunkedArrayBufferStream=void 0;const e=ve();let t=class extends e.Stream{constructor(n,o){super(o),this.privTargetChunkSize=n,this.privNextBufferReadyBytes=0}writeStreamChunk(n){if(n.isEnd||this.privNextBufferReadyBytes===0&&n.buffer.byteLength===this.privTargetChunkSize){super.writeStreamChunk(n);return}let o=0;for(;o{}]]),r=new Map,o="data:text/javascript;base64,"+btoa(`!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error('There is no interval scheduled with the given id "'.concat(e,'".'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error('The given method "'.concat(e.method,'" is not supported'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);`),i=new Worker(o);return i.addEventListener("message",({data:l})=>{if(wr.isCallNotification(l)){const{params:{timerId:c}}=l,u=t.get(c);if(typeof u=="number"){const d=r.get(u);if(d===void 0||d!==c)throw new Error("The timer is in an undefined state.")}else if(typeof u<"u")u(),t.delete(c);else throw new Error("The timer is in an undefined state.")}else if(wr.isClearResponse(l)){const{id:c}=l,u=r.get(c);if(u===void 0)throw new Error("The timer is in an undefined state.");r.delete(c),t.delete(u)}else{const{error:{message:c}}=l;throw new Error(c)}}),{clearTimeout:l=>{const c=Math.random();r.set(c,l),t.set(l,c),i.postMessage({id:c,method:"clear",params:{timerId:l}})},setTimeout:(l,c)=>{const u=Math.random();return t.set(u,l),i.postMessage({id:null,method:"set",params:{delay:c,now:performance.now(),timerId:u}}),u}}}static loadWorkerTimers(){return()=>(wr.workerTimers!==null||(wr.workerTimers=wr.load()),wr.workerTimers)}static isCallNotification(t){return t.method!==void 0&&t.method==="call"}static isClearResponse(t){return t.error===null&&typeof t.id=="number"}}Tg.Timeout=wr;wr.workerTimers=null;wr.clearTimeout=e=>wr.timers().clearTimeout(e);wr.setTimeout=(e,t)=>wr.timers().setTimeout(e,t);wr.timers=wr.loadWorkerTimers();var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.OCSPCacheUpdateErrorEvent=Le.OCSPResponseRetrievedEvent=Le.OCSPCacheFetchErrorEvent=Le.OCSPVerificationFailedEvent=Le.OCSPCacheHitEvent=Le.OCSPCacheEntryNeedsRefreshEvent=Le.OCSPCacheEntryExpiredEvent=Le.OCSPWSUpgradeStartedEvent=Le.OCSPStapleReceivedEvent=Le.OCSPCacheUpdateCompleteEvent=Le.OCSPDiskCacheStoreEvent=Le.OCSPMemoryCacheStoreEvent=Le.OCSPCacheUpdateNeededEvent=Le.OCSPDiskCacheHitEvent=Le.OCSPCacheMissEvent=Le.OCSPMemoryCacheHitEvent=Le.OCSPEvent=void 0;const fr=Zl;class hr extends fr.PlatformEvent{constructor(t,r,n){super(t,r),this.privSignature=n}}Le.OCSPEvent=hr;class IM extends hr{constructor(t){super("OCSPMemoryCacheHitEvent",fr.EventType.Debug,t)}}Le.OCSPMemoryCacheHitEvent=IM;class xM extends hr{constructor(t){super("OCSPCacheMissEvent",fr.EventType.Debug,t)}}Le.OCSPCacheMissEvent=xM;class NM extends hr{constructor(t){super("OCSPDiskCacheHitEvent",fr.EventType.Debug,t)}}Le.OCSPDiskCacheHitEvent=NM;class BM extends hr{constructor(t){super("OCSPCacheUpdateNeededEvent",fr.EventType.Debug,t)}}Le.OCSPCacheUpdateNeededEvent=BM;class OM extends hr{constructor(t){super("OCSPMemoryCacheStoreEvent",fr.EventType.Debug,t)}}Le.OCSPMemoryCacheStoreEvent=OM;class DM extends hr{constructor(t){super("OCSPDiskCacheStoreEvent",fr.EventType.Debug,t)}}Le.OCSPDiskCacheStoreEvent=DM;class MM extends hr{constructor(t){super("OCSPCacheUpdateCompleteEvent",fr.EventType.Debug,t)}}Le.OCSPCacheUpdateCompleteEvent=MM;class zM extends hr{constructor(){super("OCSPStapleReceivedEvent",fr.EventType.Debug,"")}}Le.OCSPStapleReceivedEvent=zM;class LM extends hr{constructor(t){super("OCSPWSUpgradeStartedEvent",fr.EventType.Debug,t)}}Le.OCSPWSUpgradeStartedEvent=LM;class FM extends hr{constructor(t,r){super("OCSPCacheEntryExpiredEvent",fr.EventType.Debug,t),this.privExpireTime=r}}Le.OCSPCacheEntryExpiredEvent=FM;class jM extends hr{constructor(t,r,n){super("OCSPCacheEntryNeedsRefreshEvent",fr.EventType.Debug,t),this.privExpireTime=n,this.privStartTime=r}}Le.OCSPCacheEntryNeedsRefreshEvent=jM;class HM extends hr{constructor(t,r,n){super("OCSPCacheHitEvent",fr.EventType.Debug,t),this.privExpireTime=n,this.privExpireTimeString=new Date(n).toLocaleDateString(),this.privStartTime=r,this.privStartTimeString=new Date(r).toLocaleTimeString()}}Le.OCSPCacheHitEvent=HM;class qM extends hr{constructor(t,r){super("OCSPVerificationFailedEvent",fr.EventType.Debug,t),this.privError=r}}Le.OCSPVerificationFailedEvent=qM;class UM extends hr{constructor(t,r){super("OCSPCacheFetchErrorEvent",fr.EventType.Debug,t),this.privError=r}}Le.OCSPCacheFetchErrorEvent=UM;class $M extends hr{constructor(t){super("OCSPResponseRetrievedEvent",fr.EventType.Debug,t)}}Le.OCSPResponseRetrievedEvent=$M;class WM extends hr{constructor(t,r){super("OCSPCacheUpdateErrorEvent",fr.EventType.Debug,t),this.privError=r}}Le.OCSPCacheUpdateErrorEvent=WM;var kc={},g9;function VM(){if(g9)return kc;g9=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.BackgroundEvent=void 0;const e=ve();class t extends e.PlatformEvent{constructor(n){super("BackgroundEvent",e.EventType.Error),this.privError=n}get error(){return this.privError}}return kc.BackgroundEvent=t,kc}var v9;function ve(){return v9||(v9=1,function(e){var t=Oe&&Oe.__createBinding||(Object.create?function(o,i,s,a){a===void 0&&(a=s),Object.defineProperty(o,a,{enumerable:!0,get:function(){return i[s]}})}:function(o,i,s,a){a===void 0&&(a=s),o[a]=i[s]}),r=Oe&&Oe.__exportStar||function(o,i){for(var s in o)s!=="default"&&!i.hasOwnProperty(s)&&t(i,o,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(It,e),r(jt,e),r(Z5,e),r(gg,e),r(vg,e),r(ya,e),r(cr,e),r(mg,e),r(L1,e),r(Ln,e),r(Q8,e),r(X8,e),r(Y8,e),r(J8,e),r(Z8,e),r(eR,e),r(tR,e),r(rR,e),r(nR,e),r(oR,e),r(F1,e),r(Zl,e),r(eb,e),r(j1,e),r(yg,e),r(Sg,e),r(bg,e);var n=Cg;Object.defineProperty(e,"TranslationStatus",{enumerable:!0,get:function(){return n.TranslationStatus}}),r(AM(),e),r(iR,e),r(Tg,e),r(Le,e),r(VM(),e)}(Vm)),Vm}var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.HeaderNames=void 0;class io{}Yt.HeaderNames=io;io.AuthKey="Ocp-Apim-Subscription-Key";io.Authorization="Authorization";io.SpIDAuthKey="Apim-Subscription-Id";io.ConnectionId="X-ConnectionId";io.ContentType="Content-Type";io.CustomCommandsAppId="X-CommandsAppId";io.Path="Path";io.RequestId="X-RequestId";io.RequestStreamId="X-StreamId";io.RequestTimestamp="X-Timestamp";var tc={};Object.defineProperty(tc,"__esModule",{value:!0});tc.AuthInfo=void 0;class KM{constructor(t,r){this.privHeaderName=t,this.privToken=r}get headerName(){return this.privHeaderName}get token(){return this.privToken}}tc.AuthInfo=KM;Object.defineProperty(rg,"__esModule",{value:!0});rg.CognitiveSubscriptionKeyAuthentication=void 0;const GM=ve(),QM=Yt,XM=tc;class YM{constructor(t){if(!t)throw new GM.ArgumentNullError("subscriptionKey");this.privAuthInfo=new XM.AuthInfo(QM.HeaderNames.AuthKey,t)}fetch(t){return Promise.resolve(this.privAuthInfo)}fetchOnExpiry(t){return Promise.resolve(this.privAuthInfo)}}rg.CognitiveSubscriptionKeyAuthentication=YM;var Eg={};Object.defineProperty(Eg,"__esModule",{value:!0});Eg.CognitiveTokenAuthentication=void 0;const m9=ve(),y9=tc,S9=Yt;class y1{constructor(t,r){if(!t)throw new m9.ArgumentNullError("fetchCallback");if(!r)throw new m9.ArgumentNullError("fetchOnExpiryCallback");this.privFetchCallback=t,this.privFetchOnExpiryCallback=r}fetch(t){return this.privFetchCallback(t).then(r=>new y9.AuthInfo(S9.HeaderNames.Authorization,r===void 0?void 0:y1.privTokenPrefix+r))}fetchOnExpiry(t){return this.privFetchOnExpiryCallback(t).then(r=>new y9.AuthInfo(S9.HeaderNames.Authorization,r===void 0?void 0:y1.privTokenPrefix+r))}}Eg.CognitiveTokenAuthentication=y1;y1.privTokenPrefix="Bearer ";var sR={};Object.defineProperty(sR,"__esModule",{value:!0});var aR={};Object.defineProperty(aR,"__esModule",{value:!0});var Pc={},Zm={},wg={};const JM={},ZM=Object.freeze(Object.defineProperty({__proto__:null,default:JM},Symbol.toStringTag,{value:"Module"})),Pa=u7(ZM);var tb={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LogLevel=void 0;const t=ve();Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return t.EventType}})})(tb);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.Contracts=void 0;class Ni{static throwIfNullOrUndefined(t,r){if(t==null)throw new Error("throwIfNullOrUndefined:"+r)}static throwIfNull(t,r){if(t===null)throw new Error("throwIfNull:"+r)}static throwIfNullOrWhitespace(t,r){if(Ni.throwIfNullOrUndefined(t,r),(""+t).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+r)}static throwIfNullOrTooLong(t,r,n){if(Ni.throwIfNullOrUndefined(t,r),(""+t).length>n)throw new Error("throwIfNullOrTooLong:"+r+" (more than "+n.toString()+" characters)")}static throwIfNullOrTooShort(t,r,n){if(Ni.throwIfNullOrUndefined(t,r),(""+t).length=this.privLogLevelFilter){const r=this.toString(t);if(this.logCallback&&this.logCallback(r),this.privLogPath&&b9.writeFileSync(this.privLogPath,r+`
+`,{flag:"a+"}),this.privEnableConsoleOutput)switch(t.eventType){case Rc.LogLevel.Debug:console.debug(r);break;case Rc.LogLevel.Info:console.info(r);break;case Rc.LogLevel.Warning:console.warn(r);break;case Rc.LogLevel.Error:console.error(r);break;default:console.log(r);break}}}toString(t){const r=[`${t.eventTime}`,`${t.name}`],n=t;for(const o in n)if(o&&t.hasOwnProperty(o)&&o!=="eventTime"&&o!=="eventType"&&o!=="eventId"&&o!=="name"&&o!=="constructor"){const i=n[o];let s="";i!=null&&(typeof i=="number"||typeof i=="string"?s=i.toString():s=JSON.stringify(i)),r.push(`${o}: ${s}`)}return r.join(" | ")}}wg.ConsoleLoggingListener=oz;var lR={};Object.defineProperty(lR,"__esModule",{value:!0});var e0={},ds={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AudioStreamFormatImpl=e.AudioStreamFormat=e.AudioFormatTag=void 0;var t;(function(o){o[o.PCM=1]="PCM",o[o.MuLaw=2]="MuLaw",o[o.Siren=3]="Siren",o[o.MP3=4]="MP3",o[o.SILKSkype=5]="SILKSkype",o[o.OGG_OPUS=6]="OGG_OPUS",o[o.WEBM_OPUS=7]="WEBM_OPUS",o[o.ALaw=8]="ALaw",o[o.FLAC=9]="FLAC",o[o.OPUS=10]="OPUS",o[o.AMR_WB=11]="AMR_WB",o[o.G722=12]="G722"})(t=e.AudioFormatTag||(e.AudioFormatTag={}));class r{static getDefaultInputFormat(){return n.getDefaultInputFormat()}static getWaveFormat(i,s,a,l){return new n(i,s,a,l)}static getWaveFormatPCM(i,s,a){return new n(i,s,a)}}e.AudioStreamFormat=r;class n extends r{constructor(i=16e3,s=16,a=1,l=t.PCM){super();let c=!0;switch(l){case t.PCM:this.formatTag=1;break;case t.ALaw:this.formatTag=6;break;case t.MuLaw:this.formatTag=7;break;default:c=!1}if(this.bitsPerSample=s,this.samplesPerSec=i,this.channels=a,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),c){this.privHeader=new ArrayBuffer(44);const u=new DataView(this.privHeader);this.setString(u,0,"RIFF"),u.setUint32(4,0,!0),this.setString(u,8,"WAVEfmt "),u.setUint32(16,16,!0),u.setUint16(20,this.formatTag,!0),u.setUint16(22,this.channels,!0),u.setUint32(24,this.samplesPerSec,!0),u.setUint32(28,this.avgBytesPerSec,!0),u.setUint16(32,this.channels*(this.bitsPerSample/8),!0),u.setUint16(34,this.bitsPerSample,!0),this.setString(u,36,"data"),u.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new n}static getAudioContext(i){const s=window.AudioContext||window.webkitAudioContext||!1;if(s)return i!==void 0&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new s({sampleRate:i}):new s;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}setString(i,s,a){for(let l=0;l{s.mediaDevices.getUserMedia(l).then(c).catch(u)}),a){const l=()=>{this.onEvent(new r.AudioSourceInitializingEvent(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new r.AudioSourceReadyEvent(this.privId)),this.privInitializeDeferral.resolve()):a({audio:this.deviceId?{deviceId:this.deviceId}:!0,video:!1},c=>{this.privMediaStream=c,this.onEvent(new r.AudioSourceReadyEvent(this.privId)),this.privInitializeDeferral.resolve()},c=>{const u=`Error occurred during microphone initialization: ${c}`;this.privInitializeDeferral.reject(u),this.onEvent(new r.AudioSourceErrorEvent(this.privId,u))})};this.privContext.state==="suspended"?this.privContext.resume().then(l).catch(c=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${c}`)}):l()}else{const l="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(l),this.onEvent(new r.AudioSourceErrorEvent(l,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(s){return this.onEvent(new r.AudioStreamNodeAttachingEvent(this.privId,s)),this.listen(s).then(a=>(this.onEvent(new r.AudioStreamNodeAttachedEvent(this.privId,s)),{detach:async()=>(a.readEnded(),delete this.privStreams[s],this.onEvent(new r.AudioStreamNodeDetachedEvent(this.privId,s)),this.turnOff()),id:()=>s,read:()=>a.read()}))}detach(s){s&&this.privStreams[s]&&(this.privStreams[s].close(),delete this.privStreams[s],this.onEvent(new r.AudioStreamNodeDetachedEvent(this.privId,s)))}async turnOff(){for(const s in this.privStreams)if(s){const a=this.privStreams[s];a&&a.close()}this.onEvent(new r.AudioSourceOffEvent(this.privId)),this.privInitializeDeferral&&(await this.privInitializeDeferral,this.privInitializeDeferral=null),await this.destroyAudioContext()}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then(s=>({bitspersample:o.AUDIOFORMAT.bitsPerSample,channelcount:o.AUDIOFORMAT.channels,connectivity:t.connectivity.Unknown,manufacturer:"Speech SDK",model:s,samplerate:o.AUDIOFORMAT.samplesPerSec,type:t.type.Microphones}))}setProperty(s,a){if(s===e.AudioWorkletSourceURLPropertyName)this.privRecorder.setWorkletUrl(a);else throw new Error("Property '"+s+"' is not supported on Microphone.")}getMicrophoneLabel(){const s="microphone";if(this.privMicrophoneLabel!==void 0)return Promise.resolve(this.privMicrophoneLabel);if(this.privMediaStream===void 0||!this.privMediaStream.active)return Promise.resolve(s);this.privMicrophoneLabel=s;const a=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(a===void 0)return Promise.resolve(this.privMicrophoneLabel);const l=new r.Deferred;return navigator.mediaDevices.enumerateDevices().then(c=>{for(const u of c)if(u.deviceId===a){this.privMicrophoneLabel=u.label;break}l.resolve(this.privMicrophoneLabel)},()=>l.resolve(this.privMicrophoneLabel)),l.promise}async listen(s){await this.turnOn();const a=new r.ChunkedArrayBufferStream(this.privOutputChunkSize,s);this.privStreams[s]=a;try{this.privRecorder.record(this.privContext,this.privMediaStream,a)}catch(c){throw this.onEvent(new r.AudioStreamNodeErrorEvent(this.privId,s,c)),c}return a}onEvent(s){this.privEvents.onEvent(s),r.Events.instance.onEvent(s)}createAudioContext(){this.privContext||(this.privContext=n.AudioStreamFormatImpl.getAudioContext(o.AUDIOFORMAT.samplesPerSec))}async destroyAudioContext(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let s=!1;"close"in this.privContext&&(s=!0),s?this.privIsClosing||(this.privIsClosing=!0,await this.privContext.close(),this.privContext=null,this.privIsClosing=!1):this.privContext!==null&&this.privContext.state==="running"&&await this.privContext.suspend()}}e.MicAudioSource=o,o.AUDIOFORMAT=n.AudioStreamFormat.getDefaultInputFormat()}(e0)),e0}var Ac={},T9;function sz(){if(T9)return Ac;T9=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.FileAudioSource=void 0;const e=ue(),t=ve(),r=ds;let n=class{constructor(i,s,a){this.privStreams={},this.privHeaderEnd=44,this.privId=a||t.createNoDashGuid(),this.privEvents=new t.EventSource,this.privSource=i,typeof window<"u"&&typeof Blob<"u"&&this.privSource instanceof Blob?this.privFilename=i.name:this.privFilename=s||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}turnOn(){if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const i=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new t.AudioSourceErrorEvent(i,"")),Promise.reject(i)}this.onEvent(new t.AudioSourceInitializingEvent(this.privId)),this.onEvent(new t.AudioSourceReadyEvent(this.privId))}id(){return this.privId}async attach(i){this.onEvent(new t.AudioStreamNodeAttachingEvent(this.privId,i));const s=await this.upload(i);return this.onEvent(new t.AudioStreamNodeAttachedEvent(this.privId,i)),Promise.resolve({detach:async()=>{s.readEnded(),delete this.privStreams[i],this.onEvent(new t.AudioStreamNodeDetachedEvent(this.privId,i)),await this.turnOff()},id:()=>i,read:()=>s.read()})}detach(i){i&&this.privStreams[i]&&(this.privStreams[i].close(),delete this.privStreams[i],this.onEvent(new t.AudioStreamNodeDetachedEvent(this.privId,i)))}turnOff(){for(const i in this.privStreams)if(i){const s=this.privStreams[i];s&&!s.isClosed&&s.close()}return this.onEvent(new t.AudioSourceOffEvent(this.privId)),Promise.resolve()}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then(i=>Promise.resolve({bitspersample:i.bitsPerSample,channelcount:i.channels,connectivity:e.connectivity.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:i.samplesPerSec,type:e.type.File}))}readHeader(){const s=this.privSource.slice(0,4296),a=new t.Deferred,l=c=>{const u=new DataView(c),d=g=>String.fromCharCode(u.getUint8(g),u.getUint8(g+1),u.getUint8(g+2),u.getUint8(g+3));if(d(0)!=="RIFF"){a.reject("Invalid WAV header in file, RIFF was not found");return}if(d(8)!=="WAVE"||d(12)!=="fmt "){a.reject("Invalid WAV header in file, WAVEfmt was not found");return}const f=u.getInt32(16,!0),p=u.getUint16(22,!0),h=u.getUint32(24,!0),v=u.getUint16(34,!0);let y=36+Math.max(f-16,0);for(;d(y)!=="data";y+=2)if(y>4296-8){a.reject("Invalid WAV header in file, data block was not found");return}this.privHeaderEnd=y+8,a.resolve(r.AudioStreamFormat.getWaveFormatPCM(h,v,p))};if(typeof window<"u"&&typeof Blob<"u"&&s instanceof Blob){const c=new FileReader;c.onload=u=>{const d=u.target.result;l(d)},c.readAsArrayBuffer(s)}else{const c=s;l(c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength))}return a.promise}async upload(i){const s=a=>{const l=`Error occurred while processing '${this.privFilename}'. ${a}`;throw this.onEvent(new t.AudioStreamNodeErrorEvent(this.privId,i,l)),new Error(l)};try{await this.turnOn();const a=await this.privAudioFormatPromise,l=new t.ChunkedArrayBufferStream(a.avgBytesPerSec/10,i);this.privStreams[i]=l;const c=this.privSource.slice(this.privHeaderEnd),u=d=>{l.isClosed||(l.writeStreamChunk({buffer:d,isEnd:!1,timeReceived:Date.now()}),l.close())};if(typeof window<"u"&&typeof Blob<"u"&&c instanceof Blob){const d=new FileReader;d.onerror=f=>s(f.toString()),d.onload=f=>{const p=f.target.result;u(p)},d.readAsArrayBuffer(c)}else{const d=c;u(d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength))}return l}catch(a){s(a)}}onEvent(i){this.privEvents.onEvent(i),t.Events.instance.onEvent(i)}};return Ac.FileAudioSource=n,Ac}var _g={};Object.defineProperty(_g,"__esModule",{value:!0});_g.PcmRecorder=void 0;const az=ve();class lz{constructor(t){this.privStopInputOnRelease=t}record(t,r,n){const i=new az.RiffPcmEncoder(t.sampleRate,16e3),s=t.createMediaStreamSource(r),a=()=>{const c=(()=>{let u=0;try{return t.createScriptProcessor(u,1,1)}catch{u=2048;let f=t.sampleRate;for(;u<16384&&f>=32e3;)u<<=1,f>>=1;return t.createScriptProcessor(u,1,1)}})();c.onaudioprocess=u=>{const d=u.inputBuffer.getChannelData(0);if(n&&!n.isClosed){const f=i.encode(d);f&&n.writeStreamChunk({buffer:f,isEnd:!1,timeReceived:Date.now()})}},s.connect(c),c.connect(t.destination),this.privMediaResources={scriptProcessorNode:c,source:s,stream:r}},l=!!this.privSpeechProcessorScript&&this.privSpeechProcessorScript.toLowerCase()==="ignore";if(t.audioWorklet&&!l){if(!this.privSpeechProcessorScript){const c=`class SP extends AudioWorkletProcessor {
+ constructor(options) {
+ super(options);
+ }
+ process(inputs, outputs) {
+ const input = inputs[0];
+ const output = [];
+ for (let channel = 0; channel < input.length; channel += 1) {
+ output[channel] = input[channel];
+ }
+ this.port.postMessage(output[0]);
+ return true;
+ }
+ }
+ registerProcessor('speech-processor', SP);`,u=new Blob([c],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(u)}t.audioWorklet.addModule(this.privSpeechProcessorScript).then(()=>{const c=new AudioWorkletNode(t,"speech-processor");c.port.onmessage=u=>{const d=u.data;if(n&&!n.isClosed){const f=i.encode(d);f&&n.writeStreamChunk({buffer:f,isEnd:!1,timeReceived:Date.now()})}},s.connect(c),c.connect(t.destination),this.privMediaResources={scriptProcessorNode:c,source:s,stream:r}}).catch(()=>{a()})}else try{a()}catch(c){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${c}`)}}releaseMediaResources(t){this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(t.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach(r=>r.stop()),this.privMediaResources.source=null))}setWorkletUrl(t){this.privSpeechProcessorScript=t}}_g.PcmRecorder=lz;var kg={},H1={},cz=Oe&&Oe.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uz=Oe&&Oe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cR=Oe&&Oe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&cz(t,e,r);return uz(t,e),t},rb=Oe&&Oe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(H1,"__esModule",{value:!0});H1.WebsocketMessageAdapter=void 0;const dz=cR(Pa),fz=cR(Pa),hz=rb(Pa),pz=rb(Pa),gz=rb(Pa),vz=Yt,Pe=ve();class S1{constructor(t,r,n,o,i,s){if(!t)throw new Pe.ArgumentNullError("uri");if(!n)throw new Pe.ArgumentNullError("messageFormatter");this.proxyInfo=o,this.privConnectionEvents=new Pe.EventSource,this.privConnectionId=r,this.privMessageFormatter=n,this.privConnectionState=Pe.ConnectionState.None,this.privUri=t,this.privHeaders=i,this.privEnableCompression=s,this.privHeaders[vz.HeaderNames.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}open(){if(this.privConnectionState===Pe.ConnectionState.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new Pe.Deferred,this.privCertificateValidatedDeferral=new Pe.Deferred,this.privConnectionState=Pe.ConnectionState.Connecting;try{if(typeof WebSocket<"u"&&!S1.forceNpmWebSocket)this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);else{const t={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve(),t.agent=this.getAgent();let n=new URL(this.privUri).protocol;(n==null?void 0:n.toLocaleLowerCase())==="wss:"?n="https:":(n==null?void 0:n.toLocaleLowerCase())==="ws:"&&(n="http:"),t.agent.protocol=n,this.privWebsocketClient=new gz.default(this.privUri,t)}this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new Pe.Queue,this.privDisconnectDeferral=new Pe.Deferred,this.privSendMessageQueue=new Pe.Queue,this.processSendQueue().catch(t=>{Pe.Events.instance.onEvent(new Pe.BackgroundEvent(t))})}catch(t){return this.privConnectionEstablishDeferral.resolve(new Pe.ConnectionOpenResponse(500,t)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new Pe.ConnectionStartEvent(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=()=>{this.privCertificateValidatedDeferral.promise.then(()=>{this.privConnectionState=Pe.ConnectionState.Connected,this.onEvent(new Pe.ConnectionEstablishedEvent(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new Pe.ConnectionOpenResponse(200,""))},t=>{this.privConnectionEstablishDeferral.reject(t)})},this.privWebsocketClient.onerror=t=>{this.onEvent(new Pe.ConnectionErrorEvent(this.privConnectionId,t.message,t.type)),this.privLastErrorReceived=t.message},this.privWebsocketClient.onclose=t=>{this.privConnectionState===Pe.ConnectionState.Connecting?(this.privConnectionState=Pe.ConnectionState.Disconnected,this.privConnectionEstablishDeferral.resolve(new Pe.ConnectionOpenResponse(t.code,t.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Pe.ConnectionState.Disconnected,this.privWebsocketClient=null,this.onEvent(new Pe.ConnectionClosedEvent(this.privConnectionId,t.code,t.reason))),this.onClose(t.code,t.reason).catch(r=>{Pe.Events.instance.onEvent(new Pe.BackgroundEvent(r))})},this.privWebsocketClient.onmessage=t=>{const r=new Date().toISOString();if(this.privConnectionState===Pe.ConnectionState.Connected){const n=new Pe.Deferred;if(this.privReceivingMessageQueue.enqueueFromPromise(n.promise),t.data instanceof ArrayBuffer){const o=new Pe.RawWebsocketMessage(Pe.MessageType.Binary,t.data);this.privMessageFormatter.toConnectionMessage(o).then(i=>{this.onEvent(new Pe.ConnectionMessageReceivedEvent(this.privConnectionId,r,i)),n.resolve(i)},i=>{n.reject(`Invalid binary message format. Error: ${i}`)})}else{const o=new Pe.RawWebsocketMessage(Pe.MessageType.Text,t.data);this.privMessageFormatter.toConnectionMessage(o).then(i=>{this.onEvent(new Pe.ConnectionMessageReceivedEvent(this.privConnectionId,r,i)),n.resolve(i)},i=>{n.reject(`Invalid text message format. Error: ${i}`)})}}},this.privConnectionEstablishDeferral.promise}send(t){if(this.privConnectionState!==Pe.ConnectionState.Connected)return Promise.reject(`Cannot send on connection that is in ${Pe.ConnectionState[this.privConnectionState]} state`);const r=new Pe.Deferred,n=new Pe.Deferred;return this.privSendMessageQueue.enqueueFromPromise(n.promise),this.privMessageFormatter.fromConnectionMessage(t).then(o=>{n.resolve({Message:t,RawWebsocketMessage:o,sendStatusDeferral:r})},o=>{n.reject(`Error formatting the message. ${o}`)}),r.promise}read(){return this.privConnectionState!==Pe.ConnectionState.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue()}close(t){if(this.privWebsocketClient)this.privConnectionState!==Pe.ConnectionState.Disconnected&&this.privWebsocketClient.close(1e3,t||"Normal closure by client");else return Promise.resolve();return this.privDisconnectDeferral.promise}get events(){return this.privConnectionEvents}sendRawMessage(t){try{if(!t)return Promise.resolve();if(this.onEvent(new Pe.ConnectionMessageSentEvent(this.privConnectionId,new Date().toISOString(),t.Message)),this.isWebsocketOpen)this.privWebsocketClient.send(t.RawWebsocketMessage.payload);else return Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+t.Message.id+" "+new Error().stack);return Promise.resolve()}catch(r){return Promise.reject(`websocket send error: ${r}`)}}async onClose(t,r){const n=`Connection closed. ${t}: ${r}`;this.privConnectionState=Pe.ConnectionState.Disconnected,this.privDisconnectDeferral.resolve(),await this.privReceivingMessageQueue.drainAndDispose(()=>{},n),await this.privSendMessageQueue.drainAndDispose(o=>{o.sendStatusDeferral.reject(n)},n)}async processSendQueue(){for(;;){const r=await this.privSendMessageQueue.dequeue();if(!r)return;try{await this.sendRawMessage(r),r.sendStatusDeferral.resolve()}catch(n){r.sendStatusDeferral.reject(n)}}}onEvent(t){this.privConnectionEvents.onEvent(t),Pe.Events.instance.onEvent(t)}getAgent(){const t=new hz.default.Agent(this.createConnection);return this.proxyInfo!==void 0&&this.proxyInfo.HostName!==void 0&&this.proxyInfo.Port>0&&(t.proxyInfo=this.proxyInfo),t}static GetProxyAgent(t){const r={host:t.HostName,port:t.Port};return t.UserName?r.headers={"Proxy-Authentication":"Basic "+new Buffer(`${t.UserName}:${t.Password===void 0?"":t.Password}`).toString("base64")}:r.headers={},r.headers.requestOCSP="true",new pz.default(r)}createConnection(t,r){let n;if(r={...r,requestOCSP:!0,servername:r.host},this.proxyInfo){const i=S1.GetProxyAgent(this.proxyInfo);n=new Promise((s,a)=>{i.callback(t,r,(l,c)=>{l?a(l):s(c)})})}else r.secureEndpoint?n=Promise.resolve(fz.connect(r)):n=Promise.resolve(dz.connect(r));return n}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}H1.WebsocketMessageAdapter=S1;S1.forceNpmWebSocket=!1;Object.defineProperty(kg,"__esModule",{value:!0});kg.WebsocketConnection=void 0;const t0=ve(),mz=H1;class yz{constructor(t,r,n,o,i,s=!1,a){if(this.privIsDisposed=!1,!t)throw new t0.ArgumentNullError("uri");if(!o)throw new t0.ArgumentNullError("messageFormatter");this.privMessageFormatter=o;let l="",c=0;if(r){for(const u in r)if(u){l+=c===0&&t.indexOf("?")===-1?"?":"&";const d=encodeURIComponent(u);l+=d;let f=r[u];f&&(f=encodeURIComponent(f),l+=`=${f}`),c++}}if(n){for(const u in n)if(u){l+=c===0&&t.indexOf("?")===-1?"?":"&";const d=encodeURIComponent(n[u]);l+=`${u}=${d}`,c++}}this.privUri=t+l,this.privId=a||t0.createNoDashGuid(),this.privConnectionMessageAdapter=new mz.WebsocketMessageAdapter(this.privUri,this.id,this.privMessageFormatter,i,n,s)}async dispose(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&await this.privConnectionMessageAdapter.close()}isDisposed(){return this.privIsDisposed}get id(){return this.privId}get uri(){return this.privUri}state(){return this.privConnectionMessageAdapter.state}open(){return this.privConnectionMessageAdapter.open()}send(t){return this.privConnectionMessageAdapter.send(t)}read(){return this.privConnectionMessageAdapter.read()}get events(){return this.privConnectionMessageAdapter.events}}kg.WebsocketConnection=yz;var Pg={};Object.defineProperty(Pg,"__esModule",{value:!0});Pg.ReplayableAudioNode=void 0;class Sz{constructor(t,r){this.privBuffers=[],this.privReplayOffset=0,this.privLastShrinkOffset=0,this.privBufferStartOffset=0,this.privBufferSerial=0,this.privBufferedBytes=0,this.privReplay=!1,this.privLastChunkAcquiredTime=0,this.privAudioNode=t,this.privBytesPerSecond=r}id(){return this.privAudioNode.id()}read(){if(this.privReplay&&this.privBuffers.length!==0){const t=this.privReplayOffset-this.privBufferStartOffset;let r=Math.round(t*this.privBytesPerSecond*1e-7);r%2!==0&&r++;let n=0;for(;n=this.privBuffers[n].chunk.buffer.byteLength;)r-=this.privBuffers[n++].chunk.buffer.byteLength;if(n(t&&t.buffer&&(this.privBuffers.push(new bz(t,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=t.buffer.byteLength),t))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&this.privBuffers.length!==0&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(t){if(this.privBuffers===void 0||this.privBuffers.length===0)return;this.privLastShrinkOffset=t;const r=t-this.privBufferStartOffset;let n=Math.round(r*this.privBytesPerSecond*1e-7),o=0;for(;o=this.privBuffers[o].chunk.buffer.byteLength;)n-=this.privBuffers[o++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(t-n/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(o)}findTimeAtOffset(t){if(t=n&&t<=o)return r.chunk.timeReceived}return 0}}Pg.ReplayableAudioNode=Sz;class bz{constructor(t,r,n){this.chunk=t,this.serial=r,this.byteOffset=n}}var Ic={},r0={},Mo={},q1={},Cz=Oe&&Oe.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Tz=Oe&&Oe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ez=Oe&&Oe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Cz(t,e,r);return Tz(t,e),t};Object.defineProperty(q1,"__esModule",{value:!0});q1.AudioFileWriter=void 0;const xc=Ez(Pa),n0=Ce;class wz{constructor(t){n0.Contracts.throwIfNullOrUndefined(xc.openSync,`
+File System access not available, please use Push or PullAudioOutputStream`),this.privFd=xc.openSync(t,"w")}set format(t){n0.Contracts.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=t;let r=0;this.privAudioFormat.hasHeader&&(r=this.privAudioFormat.header.byteLength),this.privFd!==void 0&&(this.privWriteStream=xc.createWriteStream("",{fd:this.privFd,start:r,autoClose:!1}))}write(t){n0.Contracts.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),this.privWriteStream!==void 0&&this.privWriteStream.write(new Uint8Array(t.slice(0)))}close(){this.privFd!==void 0&&(this.privWriteStream.on("finish",()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),xc.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),xc.closeSync(this.privFd),this.privFd=void 0}),this.privWriteStream.end())}id(){return this.privId}}q1.AudioFileWriter=wz;var nn={},E9;function uR(){if(E9)return nn;E9=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.PullAudioInputStreamImpl=nn.PullAudioInputStream=nn.PushAudioInputStreamImpl=nn.PushAudioInputStream=nn.AudioInputStream=void 0;const e=ue(),t=ve(),r=Ln,n=$(),o=ds;let i=class{constructor(){}static createPushStream(d){return s.create(d)}static createPullStream(d,f){return l.create(d,f)}};nn.AudioInputStream=i;class s extends i{static create(d){return new a(d)}}nn.PushAudioInputStream=s;class a extends s{constructor(d){super(),d===void 0?this.privFormat=o.AudioStreamFormatImpl.getDefaultInputFormat():this.privFormat=d,this.privEvents=new t.EventSource,this.privId=r.createNoDashGuid(),this.privStream=new t.ChunkedArrayBufferStream(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(d){this.privStream.writeStreamChunk({buffer:d,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}turnOn(){this.onEvent(new t.AudioSourceInitializingEvent(this.privId)),this.onEvent(new t.AudioSourceReadyEvent(this.privId))}async attach(d){this.onEvent(new t.AudioStreamNodeAttachingEvent(this.privId,d)),await this.turnOn();const f=this.privStream;return this.onEvent(new t.AudioStreamNodeAttachedEvent(this.privId,d)),{detach:async()=>(this.onEvent(new t.AudioStreamNodeDetachedEvent(this.privId,d)),this.turnOff()),id:()=>d,read:()=>f.read()}}detach(d){this.onEvent(new t.AudioStreamNodeDetachedEvent(this.privId,d))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:e.connectivity.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:e.type.Stream})}onEvent(d){this.privEvents.onEvent(d),t.Events.instance.onEvent(d)}toBuffer(d){const f=Buffer.alloc(d.byteLength),p=new Uint8Array(d);for(let h=0;h(this.privCallback.close(),this.onEvent(new t.AudioStreamNodeDetachedEvent(this.privId,d)),this.turnOff()),id:()=>d,read:()=>{let f=0,p;for(;ft.byteLength)return r.set(this.privLastChunkView.slice(0,t.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(t.byteLength),Promise.resolve(t.byteLength);r.set(this.privLastChunkView),n=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;nt.byteLength-n?(i=o.buffer.slice(0,t.byteLength-n),this.privLastChunkView=new Int8Array(o.buffer.slice(t.byteLength-n))):i=o.buffer,r.set(new Int8Array(i),n),n+=i.byteLength}else this.privStream.readEnded()}return n}write(t){_z.Contracts.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:t,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}ar.PullAudioOutputStreamImpl=dR;class fR extends ob{constructor(){super()}static create(t){return new hR(t)}}ar.PushAudioOutputStream=fR;class hR extends fR{constructor(t){super(),this.privId=pS.createNoDashGuid(),this.privCallback=t}set format(t){}write(t){this.privCallback.write&&this.privCallback.write(t)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}ar.PushAudioOutputStreamImpl=hR;var w9;function gR(){if(w9)return Mo;w9=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.AudioOutputConfigImpl=Mo.AudioConfigImpl=Mo.AudioConfig=void 0;const e=Jt(),t=Ce,r=$(),n=q1,o=uR(),i=ar;let s=class pR{static fromDefaultMicrophoneInput(){const u=new e.PcmRecorder(!0);return new a(new e.MicAudioSource(u))}static fromMicrophoneInput(u){const d=new e.PcmRecorder(!0);return new a(new e.MicAudioSource(d,u))}static fromWavFileInput(u,d="unnamedBuffer.wav"){return new a(new e.FileAudioSource(u,d))}static fromStreamInput(u){if(u instanceof r.PullAudioInputStreamCallback)return new a(new o.PullAudioInputStreamImpl(u));if(u instanceof r.AudioInputStream)return new a(u);if(typeof MediaStream<"u"&&u instanceof MediaStream){const d=new e.PcmRecorder(!1);return new a(new e.MicAudioSource(d,null,null,u))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new l(new r.SpeakerAudioDestination)}static fromSpeakerOutput(u){if(u===void 0)return pR.fromDefaultSpeakerOutput();if(u instanceof r.SpeakerAudioDestination)return new l(u);throw new Error("Not Supported Type")}static fromAudioFileOutput(u){return new l(new n.AudioFileWriter(u))}static fromStreamOutput(u){if(u instanceof r.PushAudioOutputStreamCallback)return new l(new i.PushAudioOutputStreamImpl(u));if(u instanceof r.PushAudioOutputStream)return new l(u);if(u instanceof r.PullAudioOutputStream)return new l(u);throw new Error("Not Supported Type")}};Mo.AudioConfig=s;class a extends s{constructor(u){super(),this.privSource=u}get format(){return this.privSource.format}close(u,d){this.privSource.turnOff().then(()=>{u&&u()},f=>{d&&d(f)})}id(){return this.privSource.id()}turnOn(){return this.privSource.turnOn()}attach(u){return this.privSource.attach(u)}detach(u){return this.privSource.detach(u)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(u,d){if(t.Contracts.throwIfNull(d,"value"),this.privSource.setProperty!==void 0)this.privSource.setProperty(u,d);else throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(u,d){if(this.privSource.getProperty!==void 0)return this.privSource.getProperty(u,d);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}Mo.AudioConfigImpl=a;class l extends s{constructor(u){super(),this.privDestination=u}set format(u){this.privDestination.format=u}write(u){this.privDestination.write(u)}close(){this.privDestination.close()}id(){return this.privDestination.id()}setProperty(){throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(){throw new Error("This AudioConfig instance does not support getting properties.")}}return Mo.AudioOutputConfigImpl=l,Mo}var vR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationReason=void 0,function(t){t[t.Error=0]="Error",t[t.EndOfStream=1]="EndOfStream"}(e.CancellationReason||(e.CancellationReason={}))})(vR);var Rg={};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.PullAudioInputStreamCallback=void 0;class Pz{}Rg.PullAudioInputStreamCallback=Pz;var Ag={};Object.defineProperty(Ag,"__esModule",{value:!0});Ag.PushAudioOutputStreamCallback=void 0;class Rz{}Ag.PushAudioOutputStreamCallback=Rz;var Ig={};Object.defineProperty(Ig,"__esModule",{value:!0});Ig.KeywordRecognitionModel=void 0;const _9=Ce;class Az{constructor(){this.privDisposed=!1}static fromFile(t){throw _9.Contracts.throwIfFileDoesNotExist(t,"fileName"),new Error("Not yet implemented.")}static fromStream(t){throw _9.Contracts.throwIfNull(t,"file"),new Error("Not yet implemented.")}close(){this.privDisposed||(this.privDisposed=!0)}}Ig.KeywordRecognitionModel=Az;var xg={};Object.defineProperty(xg,"__esModule",{value:!0});xg.SessionEventArgs=void 0;class Iz{constructor(t){this.privSessionId=t}get sessionId(){return this.privSessionId}}xg.SessionEventArgs=Iz;var Nc={},k9;function xz(){if(k9)return Nc;k9=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.RecognitionEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{constructor(n,o){super(o),this.privOffset=n}get offset(){return this.privOffset}};return Nc.RecognitionEventArgs=t,Nc}var mR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.OutputFormat=void 0,function(t){t[t.Simple=0]="Simple",t[t.Detailed=1]="Detailed"}(e.OutputFormat||(e.OutputFormat={}))})(mR);var Bc={},P9;function Nz(){if(P9)return Bc;P9=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.IntentRecognitionEventArgs=void 0;const e=$();let t=class extends e.RecognitionEventArgs{constructor(n,o,i){super(o,i),this.privResult=n}get result(){return this.privResult}};return Bc.IntentRecognitionEventArgs=t,Bc}var Ng={};Object.defineProperty(Ng,"__esModule",{value:!0});Ng.RecognitionResult=void 0;class Bz{constructor(t,r,n,o,i,s,a,l,c,u){this.privResultId=t,this.privReason=r,this.privText=n,this.privDuration=o,this.privOffset=i,this.privLanguage=s,this.privLanguageDetectionConfidence=a,this.privErrorDetails=l,this.privJson=c,this.privProperties=u}get resultId(){return this.privResultId}get reason(){return this.privReason}get text(){return this.privText}get duration(){return this.privDuration}get offset(){return this.privOffset}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}get errorDetails(){return this.privErrorDetails}get json(){return this.privJson}get properties(){return this.privProperties}}Ng.RecognitionResult=Bz;var Oc={},R9;function Oz(){if(R9)return Oc;R9=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.SpeechRecognitionResult=void 0;const e=$();let t=class extends e.RecognitionResult{constructor(n,o,i,s,a,l,c,u,d,f,p){super(n,o,i,s,a,l,c,d,f,p),this.privSpeakerId=u}get speakerId(){return this.privSpeakerId}};return Oc.SpeechRecognitionResult=t,Oc}var Dc={},A9;function Dz(){if(A9)return Dc;A9=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.IntentRecognitionResult=void 0;const e=$();let t=class extends e.SpeechRecognitionResult{constructor(n,o,i,s,a,l,c,u,d,f,p){super(o,i,s,a,l,c,u,void 0,d,f,p),this.privIntentId=n}get intentId(){return this.privIntentId}};return Dc.IntentRecognitionResult=t,Dc}var zl={};Object.defineProperty(zl,"__esModule",{value:!0});zl.LanguageUnderstandingModelImpl=zl.LanguageUnderstandingModel=void 0;const Wa=Ce;class yR{constructor(){}static fromEndpoint(t){Wa.Contracts.throwIfNull(t,"uri"),Wa.Contracts.throwIfNullOrWhitespace(t.hostname,"uri");const r=new xh,n=t.host.indexOf(".");if(n===-1)throw new Error("Could not determine region from endpoint");r.region=t.host.substr(0,n);const o=t.pathname.lastIndexOf("/")+1;if(o===-1)throw new Error("Could not determine appId from endpoint");if(r.appId=t.pathname.substr(o),r.subscriptionKey=t.searchParams.get("subscription-key"),r.subscriptionKey===void 0)throw new Error("Could not determine subscription key from endpoint");return r}static fromAppId(t){Wa.Contracts.throwIfNullOrWhitespace(t,"appId");const r=new xh;return r.appId=t,r}static fromSubscription(t,r,n){Wa.Contracts.throwIfNullOrWhitespace(t,"subscriptionKey"),Wa.Contracts.throwIfNullOrWhitespace(r,"appId"),Wa.Contracts.throwIfNullOrWhitespace(n,"region");const o=new xh;return o.appId=r,o.region=n,o.subscriptionKey=t,o}}zl.LanguageUnderstandingModel=yR;class xh extends yR{}zl.LanguageUnderstandingModelImpl=xh;var zo={},I9;function Mz(){if(I9)return zo;I9=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.MeetingTranscriptionEventArgs=zo.ConversationTranscriptionEventArgs=zo.SpeechRecognitionEventArgs=void 0;const e=$();let t=class extends e.RecognitionEventArgs{constructor(i,s,a){super(s,a),this.privResult=i}get result(){return this.privResult}};zo.SpeechRecognitionEventArgs=t;class r extends e.RecognitionEventArgs{constructor(i,s,a){super(s,a),this.privResult=i}get result(){return this.privResult}}zo.ConversationTranscriptionEventArgs=r;class n extends t{}return zo.MeetingTranscriptionEventArgs=n,zo}var Mc={},zc={},x9;function U1(){if(x9)return zc;x9=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.CancellationEventArgsBase=void 0;const e=$();let t=class extends e.RecognitionEventArgs{constructor(n,o,i,s,a){super(s,a),this.privReason=n,this.privErrorDetails=o,this.privErrorCode=i}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}};return zc.CancellationEventArgsBase=t,zc}var N9;function zz(){if(N9)return Mc;N9=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.SpeechRecognitionCanceledEventArgs=void 0;const e=U1();let t=class extends e.CancellationEventArgsBase{};return Mc.SpeechRecognitionCanceledEventArgs=t,Mc}var Lc={},B9;function Lz(){if(B9)return Lc;B9=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.TranslationRecognitionEventArgs=void 0;const e=$();let t=class extends e.RecognitionEventArgs{constructor(n,o,i){super(o,i),this.privResult=n}get result(){return this.privResult}};return Lc.TranslationRecognitionEventArgs=t,Lc}var Fc={},O9;function Fz(){if(O9)return Fc;O9=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.TranslationSynthesisEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{constructor(n,o){super(o),this.privResult=n}get result(){return this.privResult}};return Fc.TranslationSynthesisEventArgs=t,Fc}var jc={},D9;function bR(){if(D9)return jc;D9=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.TranslationRecognitionResult=void 0;const e=$();let t=class SR extends e.SpeechRecognitionResult{constructor(n,o,i,s,a,l,c,u,d,f,p){super(o,i,s,a,l,c,u,void 0,d,f,p),this.privTranslations=n}static fromSpeechRecognitionResult(n){return new SR(void 0,n.resultId,n.reason,n.text,n.duration,n.offset,n.language,n.languageDetectionConfidence,n.errorDetails,n.json,n.properties)}get translations(){return this.privTranslations}};return jc.TranslationRecognitionResult=t,jc}var Bg={};Object.defineProperty(Bg,"__esModule",{value:!0});Bg.TranslationSynthesisResult=void 0;class jz{constructor(t,r){this.privReason=t,this.privAudio=r}get audio(){return this.privAudio}get reason(){return this.privReason}}Bg.TranslationSynthesisResult=jz;var CR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ResultReason=void 0,function(t){t[t.NoMatch=0]="NoMatch",t[t.Canceled=1]="Canceled",t[t.RecognizingSpeech=2]="RecognizingSpeech",t[t.RecognizedSpeech=3]="RecognizedSpeech",t[t.RecognizedKeyword=4]="RecognizedKeyword",t[t.RecognizingIntent=5]="RecognizingIntent",t[t.RecognizedIntent=6]="RecognizedIntent",t[t.TranslatingSpeech=7]="TranslatingSpeech",t[t.TranslatedSpeech=8]="TranslatedSpeech",t[t.SynthesizingAudio=9]="SynthesizingAudio",t[t.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",t[t.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",t[t.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",t[t.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",t[t.RecognizedSpeakers=14]="RecognizedSpeakers",t[t.RecognizedSpeaker=15]="RecognizedSpeaker",t[t.ResetVoiceProfile=16]="ResetVoiceProfile",t[t.DeletedVoiceProfile=17]="DeletedVoiceProfile",t[t.VoicesListRetrieved=18]="VoicesListRetrieved",t[t.TranslatingParticipantSpeech=19]="TranslatingParticipantSpeech",t[t.TranslatedParticipantSpeech=20]="TranslatedParticipantSpeech",t[t.TranslatedInstantMessage=21]="TranslatedInstantMessage",t[t.TranslatedParticipantInstantMessage=22]="TranslatedParticipantInstantMessage"}(e.ResultReason||(e.ResultReason={}))})(CR);var Ts={},M9;function Hz(){if(M9)return Ts;M9=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.SpeechConfigImpl=Ts.SpeechConfig=void 0;const e=ue(),t=Ce,r=$();let n=class{constructor(){}static fromSubscription(s,a){t.Contracts.throwIfNullOrWhitespace(s,"subscriptionKey"),t.Contracts.throwIfNullOrWhitespace(a,"region");const l=new o;return l.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l.setProperty(r.PropertyId.SpeechServiceConnection_IntentRegion,a),l.setProperty(r.PropertyId.SpeechServiceConnection_Key,s),l}static fromEndpoint(s,a){t.Contracts.throwIfNull(s,"endpoint");const l=new o;return l.setProperty(r.PropertyId.SpeechServiceConnection_Endpoint,s.href),a!==void 0&&l.setProperty(r.PropertyId.SpeechServiceConnection_Key,a),l}static fromHost(s,a){t.Contracts.throwIfNull(s,"hostName");const l=new o;return l.setProperty(r.PropertyId.SpeechServiceConnection_Host,s.protocol+"//"+s.hostname+(s.port===""?"":":"+s.port)),a!==void 0&&l.setProperty(r.PropertyId.SpeechServiceConnection_Key,a),l}static fromAuthorizationToken(s,a){t.Contracts.throwIfNull(s,"authorizationToken"),t.Contracts.throwIfNullOrWhitespace(a,"region");const l=new o;return l.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l.setProperty(r.PropertyId.SpeechServiceConnection_IntentRegion,a),l.authorizationToken=s,l}close(){}};Ts.SpeechConfig=n;class o extends n{constructor(){super(),this.privProperties=new r.PropertyCollection,this.speechRecognitionLanguage="en-US",this.outputFormat=r.OutputFormat.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,s)}get speechRecognitionLanguage(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage,s)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages,s)}get outputFormat(){return r.OutputFormat[this.privProperties.getProperty(e.OutputFormatPropertyName,void 0)]}set outputFormat(s){this.privProperties.setProperty(e.OutputFormatPropertyName,r.OutputFormat[s])}get endpointId(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_EndpointId)}set endpointId(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_EndpointId,s)}setProperty(s,a){t.Contracts.throwIfNull(a,"value"),this.privProperties.setProperty(s,a)}getProperty(s,a){return this.privProperties.getProperty(s,a)}setProxy(s,a,l,c){this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyHostName],s),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyPort],a),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyUserName],l),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyPassword],c)}setServiceProperty(s,a){const l=JSON.parse(this.privProperties.getProperty(e.ServicePropertiesPropertyName,"{}"));l[s]=a,this.privProperties.setProperty(e.ServicePropertiesPropertyName,JSON.stringify(l))}setProfanity(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceResponse_ProfanityOption,r.ProfanityOption[s])}enableAudioLogging(){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(r.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty(e.ForceDictationPropertyName,"true")}clone(){const s=new o;return s.privProperties=this.privProperties.clone(),s}get speechSynthesisLanguage(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthLanguage,s)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthVoice,s)}get speechSynthesisOutputFormat(){return r.SpeechSynthesisOutputFormat[this.privProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(s){this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthOutputFormat,r.SpeechSynthesisOutputFormat[s])}}return Ts.SpeechConfigImpl=o,Ts}var Es={},z9;function qz(){if(z9)return Es;z9=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.SpeechTranslationConfigImpl=Es.SpeechTranslationConfig=void 0;const e=ue(),t=Ce,r=$();let n=class extends r.SpeechConfig{constructor(){super()}static fromSubscription(s,a){t.Contracts.throwIfNullOrWhitespace(s,"subscriptionKey"),t.Contracts.throwIfNullOrWhitespace(a,"region");const l=new o;return l.properties.setProperty(r.PropertyId.SpeechServiceConnection_Key,s),l.properties.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l}static fromAuthorizationToken(s,a){t.Contracts.throwIfNullOrWhitespace(s,"authorizationToken"),t.Contracts.throwIfNullOrWhitespace(a,"region");const l=new o;return l.properties.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,s),l.properties.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l}static fromHost(s,a){t.Contracts.throwIfNull(s,"hostName");const l=new o;return l.setProperty(r.PropertyId.SpeechServiceConnection_Host,s.protocol+"//"+s.hostname+(s.port===""?"":":"+s.port)),a!==void 0&&l.setProperty(r.PropertyId.SpeechServiceConnection_Key,a),l}static fromEndpoint(s,a){t.Contracts.throwIfNull(s,"endpoint"),t.Contracts.throwIfNull(a,"subscriptionKey");const l=new o;return l.properties.setProperty(r.PropertyId.SpeechServiceConnection_Endpoint,s.href),l.properties.setProperty(r.PropertyId.SpeechServiceConnection_Key,a),l}};Es.SpeechTranslationConfig=n;class o extends n{constructor(){super(),this.privSpeechProperties=new r.PropertyCollection,this.outputFormat=r.OutputFormat.Simple}set authorizationToken(s){t.Contracts.throwIfNullOrWhitespace(s,"value"),this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,s)}set speechRecognitionLanguage(s){t.Contracts.throwIfNullOrWhitespace(s,"value"),this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage,s)}get speechRecognitionLanguage(){return this.privSpeechProperties.getProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_RecoLanguage])}get subscriptionKey(){return this.privSpeechProperties.getProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_Key])}get outputFormat(){return r.OutputFormat[this.privSpeechProperties.getProperty(e.OutputFormatPropertyName,void 0)]}set outputFormat(s){this.privSpeechProperties.setProperty(e.OutputFormatPropertyName,r.OutputFormat[s])}get endpointId(){return this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_EndpointId)}set endpointId(s){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_EndpointId,s)}addTargetLanguage(s){t.Contracts.throwIfNullOrWhitespace(s,"value");const a=this.targetLanguages;a.includes(s)||(a.push(s),this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages,a.join(",")))}get targetLanguages(){return this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages,void 0)!==void 0?this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(","):[]}get voiceName(){return this.getProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_TranslationVoice])}set voiceName(s){t.Contracts.throwIfNullOrWhitespace(s,"value"),this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_TranslationVoice,s)}get region(){return this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_Region)}setProxy(s,a,l,c){this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyHostName],s),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyPort],a),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyUserName],l),this.setProperty(r.PropertyId[r.PropertyId.SpeechServiceConnection_ProxyPassword],c)}getProperty(s,a){return this.privSpeechProperties.getProperty(s,a)}setProperty(s,a){this.privSpeechProperties.setProperty(s,a)}get properties(){return this.privSpeechProperties}close(){}setServiceProperty(s,a){const l=JSON.parse(this.privSpeechProperties.getProperty(e.ServicePropertiesPropertyName,"{}"));l[s]=a,this.privSpeechProperties.setProperty(e.ServicePropertiesPropertyName,JSON.stringify(l))}setProfanity(s){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceResponse_ProfanityOption,r.ProfanityOption[s])}enableAudioLogging(){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privSpeechProperties.setProperty(e.ForceDictationPropertyName,"true")}get speechSynthesisLanguage(){return this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(s){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthLanguage,s)}get speechSynthesisVoiceName(){return this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(s){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthVoice,s)}get speechSynthesisOutputFormat(){return r.SpeechSynthesisOutputFormat[this.privSpeechProperties.getProperty(r.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(s){this.privSpeechProperties.setProperty(r.PropertyId.SpeechServiceConnection_SynthOutputFormat,r.SpeechSynthesisOutputFormat[s])}}return Es.SpeechTranslationConfigImpl=o,Es}var Hc={},L9;function ER(){if(L9)return Hc;L9=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.PropertyCollection=void 0;const e=$();let t=class TR{constructor(){this.privKeys=[],this.privValues=[]}getProperty(n,o){let i;typeof n=="string"?i=n:i=e.PropertyId[n];for(let s=0;s{if(n.getProperty(o,void 0)===void 0){const i=this.getProperty(o);n.setProperty(o,i)}})}get keys(){return this.privKeys}};return Hc.PropertyCollection=t,Hc}var Og={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PropertyId=void 0,function(t){t[t.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",t[t.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",t[t.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",t[t.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",t[t.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",t[t.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",t[t.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",t[t.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",t[t.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",t[t.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",t[t.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",t[t.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",t[t.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",t[t.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",t[t.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",t[t.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",t[t.Speech_SessionId=16]="Speech_SessionId",t[t.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",t[t.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",t[t.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",t[t.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",t[t.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",t[t.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",t[t.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",t[t.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",t[t.CancellationDetails_Reason=25]="CancellationDetails_Reason",t[t.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",t[t.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",t[t.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",t[t.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",t[t.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",t[t.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",t[t.Speech_SegmentationSilenceTimeoutMs=32]="Speech_SegmentationSilenceTimeoutMs",t[t.SpeechServiceConnection_EnableAudioLogging=33]="SpeechServiceConnection_EnableAudioLogging",t[t.SpeechServiceConnection_LanguageIdMode=34]="SpeechServiceConnection_LanguageIdMode",t[t.SpeechServiceConnection_RecognitionEndpointVersion=35]="SpeechServiceConnection_RecognitionEndpointVersion",t[t.SpeechServiceConnection_SpeakerIdMode=36]="SpeechServiceConnection_SpeakerIdMode",t[t.SpeechServiceResponse_ProfanityOption=37]="SpeechServiceResponse_ProfanityOption",t[t.SpeechServiceResponse_PostProcessingOption=38]="SpeechServiceResponse_PostProcessingOption",t[t.SpeechServiceResponse_RequestWordLevelTimestamps=39]="SpeechServiceResponse_RequestWordLevelTimestamps",t[t.SpeechServiceResponse_StablePartialResultThreshold=40]="SpeechServiceResponse_StablePartialResultThreshold",t[t.SpeechServiceResponse_OutputFormatOption=41]="SpeechServiceResponse_OutputFormatOption",t[t.SpeechServiceResponse_TranslationRequestStablePartialResult=42]="SpeechServiceResponse_TranslationRequestStablePartialResult",t[t.SpeechServiceResponse_RequestWordBoundary=43]="SpeechServiceResponse_RequestWordBoundary",t[t.SpeechServiceResponse_RequestPunctuationBoundary=44]="SpeechServiceResponse_RequestPunctuationBoundary",t[t.SpeechServiceResponse_RequestSentenceBoundary=45]="SpeechServiceResponse_RequestSentenceBoundary",t[t.Conversation_ApplicationId=46]="Conversation_ApplicationId",t[t.Conversation_DialogType=47]="Conversation_DialogType",t[t.Conversation_Initial_Silence_Timeout=48]="Conversation_Initial_Silence_Timeout",t[t.Conversation_From_Id=49]="Conversation_From_Id",t[t.Conversation_Conversation_Id=50]="Conversation_Conversation_Id",t[t.Conversation_Custom_Voice_Deployment_Ids=51]="Conversation_Custom_Voice_Deployment_Ids",t[t.Conversation_Speech_Activity_Template=52]="Conversation_Speech_Activity_Template",t[t.Conversation_Request_Bot_Status_Messages=53]="Conversation_Request_Bot_Status_Messages",t[t.Conversation_Agent_Connection_Id=54]="Conversation_Agent_Connection_Id",t[t.SpeechServiceConnection_Host=55]="SpeechServiceConnection_Host",t[t.ConversationTranslator_Host=56]="ConversationTranslator_Host",t[t.ConversationTranslator_Name=57]="ConversationTranslator_Name",t[t.ConversationTranslator_CorrelationId=58]="ConversationTranslator_CorrelationId",t[t.ConversationTranslator_Token=59]="ConversationTranslator_Token",t[t.PronunciationAssessment_ReferenceText=60]="PronunciationAssessment_ReferenceText",t[t.PronunciationAssessment_GradingSystem=61]="PronunciationAssessment_GradingSystem",t[t.PronunciationAssessment_Granularity=62]="PronunciationAssessment_Granularity",t[t.PronunciationAssessment_EnableMiscue=63]="PronunciationAssessment_EnableMiscue",t[t.PronunciationAssessment_Json=64]="PronunciationAssessment_Json",t[t.PronunciationAssessment_Params=65]="PronunciationAssessment_Params",t[t.SpeakerRecognition_Api_Version=66]="SpeakerRecognition_Api_Version",t[t.WebWorkerLoadType=67]="WebWorkerLoadType",t[t.TalkingAvatarService_WebRTC_SDP=68]="TalkingAvatarService_WebRTC_SDP"}(e.PropertyId||(e.PropertyId={}))})(Og);var qc={},F9;function Uz(){if(F9)return qc;F9=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.Recognizer=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class wR{constructor(s,a,l){this.audioConfig=s!==void 0?s:n.AudioConfig.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=a.clone(),this.privConnectionFactory=l,this.implCommonRecognizerSetup()}close(s,a){r.Contracts.throwIfDisposed(this.privDisposed),t.marshalPromiseToCallbacks(this.dispose(!0),s,a)}get internalData(){return this.privReco}async dispose(s){this.privDisposed||(this.privDisposed=!0,s&&this.privReco&&(await this.privReco.audioSource.turnOff(),await this.privReco.dispose()))}static get telemetryEnabled(){return e.ServiceRecognizerBase.telemetryDataEnabled}static enableTelemetry(s){e.ServiceRecognizerBase.telemetryDataEnabled=s}implCommonRecognizerSetup(){let s=typeof window<"u"?"Browser":"Node",a="unknown",l="unknown";typeof navigator<"u"&&(s=s+"/"+navigator.platform,a=navigator.userAgent,l=navigator.appVersion);const c=this.createRecognizerConfig(new e.SpeechServiceConfig(new e.Context(new e.OS(s,a,l))));this.privReco=this.createServiceRecognizer(wR.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,c)}async recognizeOnceAsyncImpl(s){r.Contracts.throwIfDisposed(this.privDisposed);const a=new t.Deferred;await this.implRecognizerStop(),await this.privReco.recognize(s,a.resolve,a.reject);const l=await a.promise;return await this.implRecognizerStop(),l}async startContinuousRecognitionAsyncImpl(s){r.Contracts.throwIfDisposed(this.privDisposed),await this.implRecognizerStop(),await this.privReco.recognize(s,void 0,void 0)}async stopContinuousRecognitionAsyncImpl(){r.Contracts.throwIfDisposed(this.privDisposed),await this.implRecognizerStop()}async implRecognizerStop(){this.privReco&&await this.privReco.stopRecognizing()}static getAuthFromProperties(s){const a=s.getProperty(n.PropertyId.SpeechServiceConnection_Key,void 0);return a&&a!==""?new e.CognitiveSubscriptionKeyAuthentication(a):new e.CognitiveTokenAuthentication(()=>{const c=s.getProperty(n.PropertyId.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(c)},()=>{const c=s.getProperty(n.PropertyId.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(c)})}};return qc.Recognizer=o,qc}var Uc={},j9;function $z(){if(j9)return Uc;j9=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.SpeechRecognizer=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class _R extends n.Recognizer{constructor(s,a){const l=s;r.Contracts.throwIfNull(l,"speechConfig"),r.Contracts.throwIfNullOrWhitespace(l.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage),n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage]),super(a,l.properties,new e.SpeechConnectionFactory),this.privDisposedRecognizer=!1}static FromConfig(s,a,l){const c=s;return a.properties.mergeTo(c.properties),new _R(s,l)}get endpointId(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){r.Contracts.throwIfNullOrWhitespace(s,"token"),this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,s)}get speechRecognitionLanguage(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(e.OutputFormatPropertyName,n.OutputFormat[n.OutputFormat.Simple])===n.OutputFormat[n.OutputFormat.Simple]?n.OutputFormat.Simple:n.OutputFormat.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(s,a){t.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(e.RecognitionMode.Interactive),s,a)}startContinuousRecognitionAsync(s,a){t.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(e.RecognitionMode.Conversation),s,a)}stopContinuousRecognitionAsync(s,a){t.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(),s,a)}startKeywordRecognitionAsync(s,a,l){r.Contracts.throwIfNull(s,"model"),l&&l("Not yet implemented.")}stopKeywordRecognitionAsync(s){s&&s()}close(s,a){r.Contracts.throwIfDisposed(this.privDisposedRecognizer),t.marshalPromiseToCallbacks(this.dispose(!0),s,a)}async dispose(s){this.privDisposedRecognizer||(s&&(this.privDisposedRecognizer=!0,await this.implRecognizerStop()),await super.dispose(s))}createRecognizerConfig(s){return new e.RecognizerConfig(s,this.privProperties)}createServiceRecognizer(s,a,l,c){const u=l;return new e.SpeechServiceRecognizer(s,a,u,c,this)}};return Uc.SpeechRecognizer=o,Uc}var $c={},H9;function Wz(){if(H9)return $c;H9=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.IntentRecognizer=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class extends n.Recognizer{constructor(s,a){r.Contracts.throwIfNullOrUndefined(s,"speechConfig");const l=s;r.Contracts.throwIfNullOrUndefined(l,"speechConfig"),super(a,l.properties,new e.IntentConnectionFactory),this.privAddedIntents=[],this.privAddedLmIntents={},this.privDisposedIntentRecognizer=!1,this.privProperties=l.properties,r.Contracts.throwIfNullOrWhitespace(this.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage),n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage])}get speechRecognitionLanguage(){return r.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage)}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,s)}get properties(){return this.privProperties}recognizeOnceAsync(s,a){if(r.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),Object.keys(this.privAddedLmIntents).length!==0||this.privUmbrellaIntent!==void 0){const l=this.buildSpeechContext();this.privReco.speechContext.setSection("intent",l.Intent),this.privReco.dynamicGrammar.addReferenceGrammar(l.ReferenceGrammars),this.privReco.setIntents(this.privAddedLmIntents,this.privUmbrellaIntent)}t.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(e.RecognitionMode.Interactive),s,a)}startContinuousRecognitionAsync(s,a){if(Object.keys(this.privAddedLmIntents).length!==0||this.privUmbrellaIntent!==void 0){const l=this.buildSpeechContext();this.privReco.speechContext.setSection("intent",l.Intent),this.privReco.dynamicGrammar.addReferenceGrammar(l.ReferenceGrammars),this.privReco.setIntents(this.privAddedLmIntents,this.privUmbrellaIntent)}t.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(e.RecognitionMode.Conversation),s,a)}stopContinuousRecognitionAsync(s,a){t.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(),s,a)}startKeywordRecognitionAsync(s,a,l){r.Contracts.throwIfNull(s,"model"),l&&l("Not yet implemented.")}stopKeywordRecognitionAsync(s,a){if(s)try{s()}catch(l){a&&a(l)}}addIntent(s,a){r.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),r.Contracts.throwIfNullOrWhitespace(a,"intentId"),r.Contracts.throwIfNullOrWhitespace(s,"simplePhrase"),this.privAddedIntents.push([a,s])}addIntentWithLanguageModel(s,a,l){r.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),r.Contracts.throwIfNullOrWhitespace(s,"intentId"),r.Contracts.throwIfNull(a,"model");const c=a;r.Contracts.throwIfNullOrWhitespace(c.appId,"model.appId"),this.privAddedLmIntents[s]=new e.AddedLmIntent(c,l)}addAllIntents(s,a){r.Contracts.throwIfNull(s,"model");const l=s;r.Contracts.throwIfNullOrWhitespace(l.appId,"model.appId"),this.privUmbrellaIntent=new e.AddedLmIntent(l,a)}close(s,a){r.Contracts.throwIfDisposed(this.privDisposedIntentRecognizer),t.marshalPromiseToCallbacks(this.dispose(!0),s,a)}createRecognizerConfig(s){return new e.RecognizerConfig(s,this.privProperties)}createServiceRecognizer(s,a,l,c){const u=l;return new e.IntentServiceRecognizer(s,a,u,c,this)}async dispose(s){this.privDisposedIntentRecognizer||s&&(this.privDisposedIntentRecognizer=!0,await super.dispose(s))}buildSpeechContext(){let s,a,l;const c=[];this.privUmbrellaIntent!==void 0&&(s=this.privUmbrellaIntent.modelImpl.appId,a=this.privUmbrellaIntent.modelImpl.region,l=this.privUmbrellaIntent.modelImpl.subscriptionKey);for(const u of Object.keys(this.privAddedLmIntents)){const d=this.privAddedLmIntents[u];if(s===void 0)s=d.modelImpl.appId;else if(s!==d.modelImpl.appId)throw new Error("Intents must all be from the same LUIS model");if(a===void 0)a=d.modelImpl.region;else if(a!==d.modelImpl.region)throw new Error("Intents must all be from the same LUIS model in a single region");if(l===void 0)l=d.modelImpl.subscriptionKey;else if(l!==d.modelImpl.subscriptionKey)throw new Error("Intents must all use the same subscription key");const f="luis/"+s+"-PRODUCTION#"+u;c.push(f)}return{Intent:{id:s,key:l===void 0?this.privProperties.getProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_Key]):l,provider:"LUIS"},ReferenceGrammars:this.privUmbrellaIntent===void 0?c:["luis/"+s+"-PRODUCTION"]}}};return $c.IntentRecognizer=o,$c}var kR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceProfileType=void 0,function(t){t[t.TextIndependentIdentification=0]="TextIndependentIdentification",t[t.TextDependentVerification=1]="TextDependentVerification",t[t.TextIndependentVerification=2]="TextIndependentVerification"}(e.VoiceProfileType||(e.VoiceProfileType={}))})(kR);var Wc={},Vc={},ws={},q9;function PR(){if(q9)return ws;q9=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ConnectionMessageImpl=ws.ConnectionMessage=void 0;const e=Yt,t=ve(),r=ER(),n=Og;let o=class{};ws.ConnectionMessage=o;class i{constructor(a){this.privConnectionMessage=a,this.privProperties=new r.PropertyCollection,this.privConnectionMessage.headers[e.HeaderNames.ConnectionId]&&this.privProperties.setProperty(n.PropertyId.Speech_SessionId,this.privConnectionMessage.headers[e.HeaderNames.ConnectionId]),Object.keys(this.privConnectionMessage.headers).forEach(l=>{this.privProperties.setProperty(l,this.privConnectionMessage.headers[l])})}get path(){return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find(a=>a.toLowerCase()==="path".toLowerCase())]}get isTextMessage(){return this.privConnectionMessage.messageType===t.MessageType.Text}get isBinaryMessage(){return this.privConnectionMessage.messageType===t.MessageType.Binary}get TextMessage(){return this.privConnectionMessage.textBody}get binaryMessage(){return this.privConnectionMessage.binaryBody}get properties(){return this.privProperties}toString(){return""}}return ws.ConnectionMessageImpl=i,ws}var U9;function RR(){if(U9)return Vc;U9=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.Connection=void 0;const e=ue(),t=ve(),r=PR(),n=Ce,o=$();let i=class gS{static fromRecognizer(a){const l=a.internalData,c=new gS;return c.privInternalData=l,c.setupEvents(),c}static fromSynthesizer(a){const l=a.internalData,c=new gS;return c.privInternalData=l,c.setupEvents(),c}openConnection(a,l){t.marshalPromiseToCallbacks(this.privInternalData.connect(),a,l)}closeConnection(a,l){if(this.privInternalData instanceof e.SynthesisAdapterBase)throw new Error("Disconnecting a synthesizer's connection is currently not supported");t.marshalPromiseToCallbacks(this.privInternalData.disconnect(),a,l)}setMessageProperty(a,l,c){if(n.Contracts.throwIfNullOrWhitespace(l,"propertyName"),this.privInternalData instanceof e.ServiceRecognizerBase){if(a.toLowerCase()!=="speech.context")throw new Error("Only speech.context message property sets are currently supported for recognizer");this.privInternalData.speechContext.setSection(l,c)}else if(this.privInternalData instanceof e.SynthesisAdapterBase){if(a.toLowerCase()!=="synthesis.context")throw new Error("Only synthesis.context message property sets are currently supported for synthesizer");this.privInternalData.synthesisContext.setSection(l,c)}}sendMessageAsync(a,l,c,u){t.marshalPromiseToCallbacks(this.privInternalData.sendNetworkMessage(a,l),c,u)}close(){}setupEvents(){this.privEventListener=this.privInternalData.connectionEvents.attach(a=>{a.name==="ConnectionEstablishedEvent"?this.connected&&this.connected(new o.ConnectionEventArgs(a.connectionId)):a.name==="ConnectionClosedEvent"?this.disconnected&&this.disconnected(new o.ConnectionEventArgs(a.connectionId)):a.name==="ConnectionMessageSentEvent"?this.messageSent&&this.messageSent(new o.ConnectionMessageEventArgs(new r.ConnectionMessageImpl(a.message))):a.name==="ConnectionMessageReceivedEvent"&&this.messageReceived&&this.messageReceived(new o.ConnectionMessageEventArgs(new r.ConnectionMessageImpl(a.message)))}),this.privServiceEventListener=this.privInternalData.serviceEvents.attach(a=>{this.receivedServiceMessage&&this.receivedServiceMessage(new o.ServiceEventArgs(a.jsonString,a.name))})}};return Vc.Connection=i,Vc}var $9;function Vz(){if($9)return Wc;$9=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.TranslationRecognizer=void 0;const e=ue(),t=ve(),r=RR(),n=Ce,o=$();let i=class AR extends o.Recognizer{constructor(a,l,c){const u=a;n.Contracts.throwIfNull(u,"speechConfig"),super(l,u.properties,c||new e.TranslationConnectionFactory),this.privDisposedTranslationRecognizer=!1,this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationVoice,void 0)!==void 0&&n.Contracts.throwIfNullOrWhitespace(this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationVoice),o.PropertyId[o.PropertyId.SpeechServiceConnection_TranslationVoice]),n.Contracts.throwIfNullOrWhitespace(this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages),o.PropertyId[o.PropertyId.SpeechServiceConnection_TranslationToLanguages]),n.Contracts.throwIfNullOrWhitespace(this.properties.getProperty(o.PropertyId.SpeechServiceConnection_RecoLanguage),o.PropertyId[o.PropertyId.SpeechServiceConnection_RecoLanguage])}static FromConfig(a,l,c){const u=a;return l.properties.mergeTo(u.properties),new AR(a,c)}get speechRecognitionLanguage(){return n.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),this.properties.getProperty(o.PropertyId.SpeechServiceConnection_RecoLanguage)}get targetLanguages(){return n.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(",")}get voiceName(){return n.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationVoice,void 0)}get properties(){return this.privProperties}get authorizationToken(){return this.properties.getProperty(o.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(a){this.properties.setProperty(o.PropertyId.SpeechServiceAuthorization_Token,a)}recognizeOnceAsync(a,l){n.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),t.marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(e.RecognitionMode.Interactive),a,l)}startContinuousRecognitionAsync(a,l){t.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(e.RecognitionMode.Conversation),a,l)}stopContinuousRecognitionAsync(a,l){t.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(),a,l)}removeTargetLanguage(a){if(n.Contracts.throwIfNullOrUndefined(a,"language to be removed"),this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages,void 0)!==void 0){const l=this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(","),c=l.indexOf(a);c>-1&&(l.splice(c,1),this.properties.setProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages,l.join(",")),this.updateLanguages(l))}}addTargetLanguage(a){n.Contracts.throwIfNullOrUndefined(a,"language to be added");let l=[];this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages,void 0)!==void 0?(l=this.properties.getProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages).split(","),l.includes(a)||(l.push(a),this.properties.setProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages,l.join(",")))):(this.properties.setProperty(o.PropertyId.SpeechServiceConnection_TranslationToLanguages,a),l=[a]),this.updateLanguages(l)}close(a,l){n.Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer),t.marshalPromiseToCallbacks(this.dispose(!0),a,l)}onConnection(){}async dispose(a){this.privDisposedTranslationRecognizer||(this.privDisposedTranslationRecognizer=!0,a&&(await this.implRecognizerStop(),await super.dispose(a)))}createRecognizerConfig(a){return new e.RecognizerConfig(a,this.privProperties)}createServiceRecognizer(a,l,c,u){const d=c;return new e.TranslationServiceRecognizer(a,l,d,u,this)}updateLanguages(a){const l=r.Connection.fromRecognizer(this);l&&(l.setMessageProperty("speech.context","translationcontext",{to:a}),l.sendMessageAsync("event",JSON.stringify({id:"translation",name:"updateLanguage",to:a})))}};return Wc.TranslationRecognizer=i,Wc}var Kc={},W9;function Kz(){if(W9)return Kc;W9=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.Translations=void 0;const e=$();let t=class{constructor(){this.privMap=new e.PropertyCollection}get languages(){return this.privMap.keys}get(n,o){return this.privMap.getProperty(n,o)}set(n,o){this.privMap.setProperty(n,o)}};return Kc.Translations=t,Kc}var IR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NoMatchReason=void 0,function(t){t[t.NotRecognized=0]="NotRecognized",t[t.InitialSilenceTimeout=1]="InitialSilenceTimeout",t[t.InitialBabbleTimeout=2]="InitialBabbleTimeout"}(e.NoMatchReason||(e.NoMatchReason={}))})(IR);var Gc={},V9;function Gz(){if(V9)return Gc;V9=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.NoMatchDetails=void 0;const e=ue(),t=$();let r=class xR{constructor(o){this.privReason=o}static fromResult(o){const i=e.SimpleSpeechPhrase.fromJSON(o.json);let s=t.NoMatchReason.NotRecognized;switch(i.RecognitionStatus){case e.RecognitionStatus.BabbleTimeout:s=t.NoMatchReason.InitialBabbleTimeout;break;case e.RecognitionStatus.InitialSilenceTimeout:s=t.NoMatchReason.InitialSilenceTimeout;break;default:s=t.NoMatchReason.NotRecognized;break}return new xR(s)}get reason(){return this.privReason}};return Gc.NoMatchDetails=r,Gc}var Dg={};Object.defineProperty(Dg,"__esModule",{value:!0});Dg.TranslationRecognitionCanceledEventArgs=void 0;class Qz{constructor(t,r,n,o,i){this.privCancelReason=r,this.privErrorDetails=n,this.privResult=i,this.privSessionId=t,this.privErrorCode=o}get result(){return this.privResult}get sessionId(){return this.privSessionId}get reason(){return this.privCancelReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}Dg.TranslationRecognitionCanceledEventArgs=Qz;var Qc={},K9;function Xz(){if(K9)return Qc;K9=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.IntentRecognitionCanceledEventArgs=void 0;const e=$();let t=class extends e.IntentRecognitionEventArgs{constructor(n,o,i,s,a,l){super(s,a,l),this.privReason=n,this.privErrorDetails=o,this.privErrorCode=i}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}};return Qc.IntentRecognitionCanceledEventArgs=t,Qc}var $1={};Object.defineProperty($1,"__esModule",{value:!0});$1.CancellationDetailsBase=void 0;class Yz{constructor(t,r,n){this.privReason=t,this.privErrorDetails=r,this.privErrorCode=n}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get ErrorCode(){return this.privErrorCode}}$1.CancellationDetailsBase=Yz;var Xc={},G9;function Jz(){if(G9)return Xc;G9=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.CancellationDetails=void 0;const e=ue(),t=$1,r=$();let n=class NR extends t.CancellationDetailsBase{constructor(i,s,a){super(i,s,a)}static fromResult(i){let s=r.CancellationReason.Error,a=r.CancellationErrorCode.NoError;if(i instanceof r.RecognitionResult&&i.json){const l=e.SimpleSpeechPhrase.fromJSON(i.json);s=e.EnumTranslation.implTranslateCancelResult(l.RecognitionStatus)}return i.properties&&(a=r.CancellationErrorCode[i.properties.getProperty(e.CancellationErrorCodePropertyName,r.CancellationErrorCode[r.CancellationErrorCode.NoError])]),new NR(s,i.errorDetails||e.EnumTranslation.implTranslateErrorDetails(a),a)}};return Xc.CancellationDetails=n,Xc}var BR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationErrorCode=void 0,function(t){t[t.NoError=0]="NoError",t[t.AuthenticationFailure=1]="AuthenticationFailure",t[t.BadRequestParameters=2]="BadRequestParameters",t[t.TooManyRequests=3]="TooManyRequests",t[t.ConnectionFailure=4]="ConnectionFailure",t[t.ServiceTimeout=5]="ServiceTimeout",t[t.ServiceError=6]="ServiceError",t[t.RuntimeError=7]="RuntimeError",t[t.Forbidden=8]="Forbidden"}(e.CancellationErrorCode||(e.CancellationErrorCode={}))})(BR);var Yc={},Q9;function Zz(){if(Q9)return Yc;Q9=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.ConnectionEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{};return Yc.ConnectionEventArgs=t,Yc}var Jc={},X9;function eL(){if(X9)return Jc;X9=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.ServiceEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{constructor(n,o,i){super(i),this.privJsonResult=n,this.privEventName=o}get jsonString(){return this.privJsonResult}get eventName(){return this.privEventName}};return Jc.ServiceEventArgs=t,Jc}var Mg={};Object.defineProperty(Mg,"__esModule",{value:!0});Mg.PhraseListGrammar=void 0;class sb{constructor(t){this.privGrammerBuilder=t.dynamicGrammar}static fromRecognizer(t){const r=t.internalData;return new sb(r)}addPhrase(t){this.privGrammerBuilder.addPhrase(t)}addPhrases(t){this.privGrammerBuilder.addPhrase(t)}clear(){this.privGrammerBuilder.clearPhrases()}}Mg.PhraseListGrammar=sb;var _s={},Y9;function ab(){if(Y9)return _s;Y9=1,Object.defineProperty(_s,"__esModule",{value:!0}),_s.DialogServiceConfigImpl=_s.DialogServiceConfig=void 0;const e=Ce,t=$();let r=class{constructor(){}set applicationId(i){}static get DialogTypes(){return{BotFramework:"bot_framework",CustomCommands:"custom_commands"}}};_s.DialogServiceConfig=r;class n extends r{constructor(){super(),this.privSpeechConfig=new t.SpeechConfigImpl}get properties(){return this.privSpeechConfig.properties}get speechRecognitionLanguage(){return this.privSpeechConfig.speechRecognitionLanguage}set speechRecognitionLanguage(i){e.Contracts.throwIfNullOrWhitespace(i,"value"),this.privSpeechConfig.speechRecognitionLanguage=i}get outputFormat(){return this.privSpeechConfig.outputFormat}set outputFormat(i){this.privSpeechConfig.outputFormat=i}setProperty(i,s){this.privSpeechConfig.setProperty(i,s)}getProperty(i,s){return this.privSpeechConfig.getProperty(i)}setProxy(i,s,a,l){this.setProperty(t.PropertyId.SpeechServiceConnection_ProxyHostName,i),this.setProperty(t.PropertyId.SpeechServiceConnection_ProxyPort,`${s}`),a&&this.setProperty(t.PropertyId.SpeechServiceConnection_ProxyUserName,a),l&&this.setProperty(t.PropertyId.SpeechServiceConnection_ProxyPassword,l)}setServiceProperty(i,s,a){this.privSpeechConfig.setServiceProperty(i,s)}close(){}}return _s.DialogServiceConfigImpl=n,_s}var Zc={},J9;function tL(){if(J9)return Zc;J9=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.BotFrameworkConfig=void 0;const e=Ce,t=ab(),r=$();let n=class extends t.DialogServiceConfigImpl{constructor(){super()}static fromSubscription(i,s,a){e.Contracts.throwIfNullOrWhitespace(i,"subscription"),e.Contracts.throwIfNullOrWhitespace(s,"region");const l=new t.DialogServiceConfigImpl;return l.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.BotFramework),l.setProperty(r.PropertyId.SpeechServiceConnection_Key,i),l.setProperty(r.PropertyId.SpeechServiceConnection_Region,s),a&&l.setProperty(r.PropertyId.Conversation_ApplicationId,a),l}static fromAuthorizationToken(i,s,a){e.Contracts.throwIfNullOrWhitespace(i,"authorizationToken"),e.Contracts.throwIfNullOrWhitespace(s,"region");const l=new t.DialogServiceConfigImpl;return l.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.BotFramework),l.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,i),l.setProperty(r.PropertyId.SpeechServiceConnection_Region,s),a&&l.setProperty(r.PropertyId.Conversation_ApplicationId,a),l}static fromHost(i,s,a){e.Contracts.throwIfNullOrUndefined(i,"host");const l=i instanceof URL?i:new URL(`wss://${i}.convai.speech.azure.us`);e.Contracts.throwIfNullOrUndefined(l,"resolvedHost");const c=new t.DialogServiceConfigImpl;return c.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.BotFramework),c.setProperty(r.PropertyId.SpeechServiceConnection_Host,l.toString()),s!==void 0&&c.setProperty(r.PropertyId.SpeechServiceConnection_Key,s),c}static fromEndpoint(i,s){e.Contracts.throwIfNull(i,"endpoint");const a=new t.DialogServiceConfigImpl;return a.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.BotFramework),a.setProperty(r.PropertyId.SpeechServiceConnection_Endpoint,i.toString()),s!==void 0&&a.setProperty(r.PropertyId.SpeechServiceConnection_Key,s),a}};return Zc.BotFrameworkConfig=n,Zc}var eu={},Z9;function rL(){if(Z9)return eu;Z9=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.CustomCommandsConfig=void 0;const e=Ce,t=ab(),r=$();let n=class extends t.DialogServiceConfigImpl{constructor(){super()}static fromSubscription(i,s,a){e.Contracts.throwIfNullOrWhitespace(i,"applicationId"),e.Contracts.throwIfNullOrWhitespace(s,"subscription"),e.Contracts.throwIfNullOrWhitespace(a,"region");const l=new t.DialogServiceConfigImpl;return l.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.CustomCommands),l.setProperty(r.PropertyId.Conversation_ApplicationId,i),l.setProperty(r.PropertyId.SpeechServiceConnection_Key,s),l.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l}static fromAuthorizationToken(i,s,a){e.Contracts.throwIfNullOrWhitespace(i,"applicationId"),e.Contracts.throwIfNullOrWhitespace(s,"authorizationToken"),e.Contracts.throwIfNullOrWhitespace(a,"region");const l=new t.DialogServiceConfigImpl;return l.setProperty(r.PropertyId.Conversation_DialogType,t.DialogServiceConfig.DialogTypes.CustomCommands),l.setProperty(r.PropertyId.Conversation_ApplicationId,i),l.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,s),l.setProperty(r.PropertyId.SpeechServiceConnection_Region,a),l}set applicationId(i){e.Contracts.throwIfNullOrWhitespace(i,"value"),this.setProperty(r.PropertyId.Conversation_ApplicationId,i)}get applicationId(){return this.getProperty(r.PropertyId.Conversation_ApplicationId)}};return eu.CustomCommandsConfig=n,eu}var tu={},ru={},nu={},so={};Object.defineProperty(so,"__esModule",{value:!0});so.QueryParameterNames=void 0;class Ot{}so.QueryParameterNames=Ot;Ot.BotId="botid";Ot.CustomSpeechDeploymentId="cid";Ot.CustomVoiceDeploymentId="deploymentId";Ot.EnableAudioLogging="storeAudio";Ot.EnableLanguageId="lidEnabled";Ot.EnableWordLevelTimestamps="wordLevelTimestamps";Ot.EndSilenceTimeoutMs="endSilenceTimeoutMs";Ot.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs";Ot.Format="format";Ot.InitialSilenceTimeoutMs="initialSilenceTimeoutMs";Ot.Language="language";Ot.Profanity="profanity";Ot.RequestBotStatusMessages="enableBotMessageStatus";Ot.StableIntermediateThreshold="stableIntermediateThreshold";Ot.StableTranslation="stableTranslation";Ot.TestHooks="testhooks";Ot.Postprocessing="postprocessing";Ot.CtsMeetingId="meetingId";Ot.CtsDeviceId="deviceId";Ot.CtsIsParticipant="isParticipant";Ot.EnableAvatar="enableTalkingAvatar";var e2;function ao(){if(e2)return nu;e2=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.ConnectionFactoryBase=void 0;const e=ue(),t=$(),r=so;let n=class{static getHostSuffix(i){if(i){if(i.toLowerCase().startsWith("china"))return".azure.cn";if(i.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(i,s,a){new Map([[t.PropertyId.Speech_SegmentationSilenceTimeoutMs,r.QueryParameterNames.SegmentationSilenceTimeoutMs],[t.PropertyId.SpeechServiceConnection_EnableAudioLogging,r.QueryParameterNames.EnableAudioLogging],[t.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,r.QueryParameterNames.EndSilenceTimeoutMs],[t.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,r.QueryParameterNames.InitialSilenceTimeoutMs],[t.PropertyId.SpeechServiceResponse_PostProcessingOption,r.QueryParameterNames.Postprocessing],[t.PropertyId.SpeechServiceResponse_ProfanityOption,r.QueryParameterNames.Profanity],[t.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,r.QueryParameterNames.EnableWordLevelTimestamps],[t.PropertyId.SpeechServiceResponse_StablePartialResultThreshold,r.QueryParameterNames.StableIntermediateThreshold]]).forEach((u,d)=>{this.setUrlParameter(d,u,i,s,a)});const c=JSON.parse(i.parameters.getProperty(e.ServicePropertiesPropertyName,"{}"));Object.keys(c).forEach(u=>{s[u]=c[u]})}setUrlParameter(i,s,a,l,c){const u=a.parameters.getProperty(i,void 0);u&&(!c||c.search(s)===-1)&&(l[s]=u.toLocaleLowerCase())}};return nu.ConnectionFactoryBase=n,nu}var t2;function nL(){if(t2)return ru;t2=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.DialogConnectionFactory=void 0;const e=Jt(),t=ue(),r=$(),n=ao(),o=ue(),i=Yt,s=so;class a extends n.ConnectionFactoryBase{create(c,u,d){const f=c.parameters.getProperty(r.PropertyId.Conversation_ApplicationId,""),p=c.parameters.getProperty(r.PropertyId.Conversation_DialogType),h=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Region),v=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage,"en-US"),y=c.parameters.getProperty(r.PropertyId.Conversation_Request_Bot_Status_Messages,"true"),g={};g[i.HeaderNames.ConnectionId]=d,g[s.QueryParameterNames.Format]=c.parameters.getProperty(t.OutputFormatPropertyName,r.OutputFormat[r.OutputFormat.Simple]).toLowerCase(),g[s.QueryParameterNames.Language]=v,g[s.QueryParameterNames.RequestBotStatusMessages]=y,f&&(g[s.QueryParameterNames.BotId]=f,p===r.DialogServiceConfig.DialogTypes.CustomCommands&&(g[i.HeaderNames.CustomCommandsAppId]=f));const m=p===r.DialogServiceConfig.DialogTypes.CustomCommands?"commands/":"",b=p===r.DialogServiceConfig.DialogTypes.CustomCommands?"v1":p===r.DialogServiceConfig.DialogTypes.BotFramework?"v3":"v0",C={};u.token!=null&&u.token!==""&&(C[u.headerName]=u.token);let k=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Endpoint,"");if(!k){const w=n.ConnectionFactoryBase.getHostSuffix(h),A=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Host,`wss://${h}.${a.BaseUrl}${w}`);k=`${A.endsWith("/")?A:A+"/"}${m}${a.ApiKey}/${b}`}this.setCommonUrlParams(c,g,k);const E=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(k,g,C,new o.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),E,d)}}return ru.DialogConnectionFactory=a,a.ApiKey="api",a.BaseUrl="convai.speech",ru}var r2;function oL(){if(r2)return tu;r2=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.DialogServiceConnector=void 0;const e=nL(),t=ue(),r=ve(),n=Ce,o=$(),i=Og;let s=class extends o.Recognizer{constructor(l,c){const u=l;n.Contracts.throwIfNull(l,"dialogConfig"),super(c,u.properties,new e.DialogConnectionFactory),this.isTurnComplete=!0,this.privIsDisposed=!1,this.privProperties=u.properties.clone();const d=this.buildAgentConfig();this.privReco.agentConfig.set(d)}connect(l,c){r.marshalPromiseToCallbacks(this.privReco.connect(),l,c)}disconnect(l,c){r.marshalPromiseToCallbacks(this.privReco.disconnect(),l,c)}get authorizationToken(){return this.properties.getProperty(i.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(l){n.Contracts.throwIfNullOrWhitespace(l,"token"),this.properties.setProperty(i.PropertyId.SpeechServiceAuthorization_Token,l)}get properties(){return this.privProperties}get speechActivityTemplate(){return this.properties.getProperty(i.PropertyId.Conversation_Speech_Activity_Template)}set speechActivityTemplate(l){this.properties.setProperty(i.PropertyId.Conversation_Speech_Activity_Template,l)}listenOnceAsync(l,c){if(this.isTurnComplete){n.Contracts.throwIfDisposed(this.privIsDisposed);const d=(async()=>{await this.privReco.connect(),await this.implRecognizerStop(),this.isTurnComplete=!1;const f=new r.Deferred;await this.privReco.recognize(t.RecognitionMode.Conversation,f.resolve,f.reject);const p=await f.promise;return await this.implRecognizerStop(),p})();d.catch(()=>{this.dispose(!0).catch(()=>{})}),r.marshalPromiseToCallbacks(d.finally(()=>{this.isTurnComplete=!0}),l,c)}}sendActivityAsync(l,c,u){r.marshalPromiseToCallbacks(this.privReco.sendMessage(l),c,u)}close(l,c){n.Contracts.throwIfDisposed(this.privIsDisposed),r.marshalPromiseToCallbacks(this.dispose(!0),l,c)}async dispose(l){this.privIsDisposed||l&&(this.privIsDisposed=!0,await this.implRecognizerStop(),await super.dispose(l))}createRecognizerConfig(l){return new t.RecognizerConfig(l,this.privProperties)}createServiceRecognizer(l,c,u,d){const f=u;return new t.DialogServiceAdapter(l,c,f,d,this)}buildAgentConfig(){return{botInfo:{commType:this.properties.getProperty("Conversation_Communication_Type","Default"),commandsCulture:void 0,connectionId:this.properties.getProperty(i.PropertyId.Conversation_Agent_Connection_Id),conversationId:this.properties.getProperty(i.PropertyId.Conversation_Conversation_Id,void 0),fromId:this.properties.getProperty(i.PropertyId.Conversation_From_Id,void 0),ttsAudioFormat:this.properties.getProperty(i.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0)},version:.2}}};return tu.DialogServiceConnector=s,tu}var zg={};Object.defineProperty(zg,"__esModule",{value:!0});zg.ActivityReceivedEventArgs=void 0;class iL{constructor(t,r){this.privActivity=t,this.privAudioStream=r}get activity(){return this.privActivity}get audioStream(){return this.privAudioStream}}zg.ActivityReceivedEventArgs=iL;var Lg={},Fg={};Object.defineProperty(Fg,"__esModule",{value:!0});Fg.TurnStatusResponsePayload=void 0;class lb{constructor(t){this.privMessageStatusResponse=JSON.parse(t)}static fromJSON(t){return new lb(t)}get interactionId(){return this.privMessageStatusResponse.interactionId}get conversationId(){return this.privMessageStatusResponse.conversationId}get statusCode(){switch(this.privMessageStatusResponse.statusCode){case"Success":return 200;case"Failed":return 400;case"TimedOut":return 429;default:return this.privMessageStatusResponse.statusCode}}}Fg.TurnStatusResponsePayload=lb;Object.defineProperty(Lg,"__esModule",{value:!0});Lg.TurnStatusReceivedEventArgs=void 0;const sL=Fg;class aL{constructor(t){this.privTurnStatus=sL.TurnStatusResponsePayload.fromJSON(t)}get interactionId(){return this.privTurnStatus.interactionId}get conversationId(){return this.privTurnStatus.conversationId}get statusCode(){return this.privTurnStatus.statusCode}}Lg.TurnStatusReceivedEventArgs=aL;var OR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServicePropertyChannel=void 0,function(t){t[t.UriQueryParameter=0]="UriQueryParameter"}(e.ServicePropertyChannel||(e.ServicePropertyChannel={}))})(OR);var DR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProfanityOption=void 0,function(t){t[t.Masked=0]="Masked",t[t.Removed=1]="Removed",t[t.Raw=2]="Raw"}(e.ProfanityOption||(e.ProfanityOption={}))})(DR);var ou={},n2;function lL(){if(n2)return ou;n2=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.BaseAudioPlayer=void 0;const e=cr,t=$(),r=ds;let n=class{constructor(i){this.audioContext=null,this.gainNode=null,this.autoUpdateBufferTimer=0,i===void 0&&(i=t.AudioStreamFormat.getDefaultInputFormat()),this.init(i)}playAudioSample(i,s,a){try{this.ensureInitializedContext();const l=this.formatAudioData(i),c=new Float32Array(this.samples.length+l.length);c.set(this.samples,0),c.set(l,this.samples.length),this.samples=c,s&&s()}catch(l){a&&a(l)}}stopAudio(i,s){this.audioContext!==null&&(this.samples=new Float32Array,clearInterval(this.autoUpdateBufferTimer),this.audioContext.close().then(()=>{i&&i()},a=>{s&&s(a)}),this.audioContext=null)}init(i){this.audioFormat=i,this.samples=new Float32Array}ensureInitializedContext(){if(this.audioContext===null){this.createAudioContext();const i=200;this.autoUpdateBufferTimer=setInterval(()=>{this.updateAudioBuffer()},i)}}createAudioContext(){this.audioContext=r.AudioStreamFormatImpl.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioContext.destination),this.startTime=this.audioContext.currentTime}formatAudioData(i){switch(this.audioFormat.bitsPerSample){case 8:return this.formatArrayBuffer(new Int8Array(i),128);case 16:return this.formatArrayBuffer(new Int16Array(i),32768);case 32:return this.formatArrayBuffer(new Int32Array(i),2147483648);default:throw new e.InvalidOperationError("Only WAVE_FORMAT_PCM (8/16/32 bps) format supported at this time")}}formatArrayBuffer(i,s){const a=new Float32Array(i.length);for(let l=0;l{s.buffer=l,s.connect(a),s.start(0)})}};return ou.BaseAudioPlayer=n,ou}var jg={};Object.defineProperty(jg,"__esModule",{value:!0});jg.ConnectionMessageEventArgs=void 0;class cL{constructor(t){this.privConnectionMessage=t}get message(){return this.privConnectionMessage}toString(){return"Message: "+this.privConnectionMessage.toString()}}jg.ConnectionMessageEventArgs=cL;var Hg={};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.VoiceProfile=void 0;class uL{constructor(t,r){this.privId=t,this.privProfileType=r}get profileId(){return this.privId}get profileType(){return this.privProfileType}}Hg.VoiceProfile=uL;var ks={},o2;function dL(){if(o2)return ks;o2=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.VoiceProfileEnrollmentCancellationDetails=ks.VoiceProfileEnrollmentResult=void 0;const e=ue(),t=$();let r=class vS{constructor(i,s,a){this.privReason=i,this.privProperties=new t.PropertyCollection,this.privReason!==t.ResultReason.Canceled?s&&(this.privDetails=JSON.parse(s),this.privDetails.enrollmentStatus.toLowerCase()==="enrolling"&&(this.privReason=t.ResultReason.EnrollingVoiceProfile)):(this.privErrorDetails=a,this.privProperties.setProperty(e.CancellationErrorCodePropertyName,t.CancellationErrorCode[t.CancellationErrorCode.ServiceError]))}get reason(){return this.privReason}get enrollmentsCount(){return this.privDetails.enrollmentsCount}get enrollmentsLength(){return this.privDetails.enrollmentsLength}get properties(){return this.privProperties}get enrollmentResultDetails(){return this.privDetails}get errorDetails(){return this.privErrorDetails}static FromIdentificationProfileList(i){const s=[];for(const a of i.value){const l=a.enrollmentStatus.toLowerCase()==="enrolling"?t.ResultReason.EnrollingVoiceProfile:a.enrollmentStatus.toLowerCase()==="enrolled"?t.ResultReason.EnrolledVoiceProfile:t.ResultReason.Canceled,c=new vS(l,null,null);c.privDetails=this.getIdentificationDetails(a),s.push(c)}return s}static FromVerificationProfileList(i){const s=[];for(const a of i.value){const l=a.enrollmentStatus.toLowerCase()==="enrolling"?t.ResultReason.EnrollingVoiceProfile:a.enrollmentStatus.toLowerCase()==="enrolled"?t.ResultReason.EnrolledVoiceProfile:t.ResultReason.Canceled,c=new vS(l,null,null);c.privDetails=this.getVerificationDetails(a),s.push(c)}return s}static getIdentificationDetails(i){return{audioLength:i.audioLength?parseFloat(i.audioLength):0,audioSpeechLength:i.audioSpeechLength?parseFloat(i.audioSpeechLength):0,enrollmentStatus:i.enrollmentStatus,enrollmentsCount:i.enrollmentsCount||0,enrollmentsLength:i.enrollmentsLength?parseFloat(i.enrollmentsLength):0,enrollmentsSpeechLength:i.enrollmentsSpeechLength?parseFloat(i.enrollmentsSpeechLength):0,profileId:i.profileId||i.identificationProfileId,remainingEnrollmentsSpeechLength:i.remainingEnrollmentsSpeechLength?parseFloat(i.remainingEnrollmentsSpeechLength):0}}static getVerificationDetails(i){return{audioLength:i.audioLength?parseFloat(i.audioLength):0,audioSpeechLength:i.audioSpeechLength?parseFloat(i.audioSpeechLength):0,enrollmentStatus:i.enrollmentStatus,enrollmentsCount:i.enrollmentsCount,enrollmentsLength:i.enrollmentsLength?parseFloat(i.enrollmentsLength):0,enrollmentsSpeechLength:i.enrollmentsSpeechLength?parseFloat(i.enrollmentsSpeechLength):0,profileId:i.profileId||i.verificationProfileId,remainingEnrollmentsCount:i.remainingEnrollments||i.remainingEnrollmentsCount,remainingEnrollmentsSpeechLength:i.remainingEnrollmentsSpeechLength?parseFloat(i.remainingEnrollmentsSpeechLength):0}}};ks.VoiceProfileEnrollmentResult=r;class n extends t.CancellationDetailsBase{constructor(i,s,a){super(i,s,a)}static fromResult(i){const s=t.CancellationReason.Error;let a=t.CancellationErrorCode.NoError;return i.properties&&(a=t.CancellationErrorCode[i.properties.getProperty(e.CancellationErrorCodePropertyName,t.CancellationErrorCode[t.CancellationErrorCode.NoError])]),new n(s,i.errorDetails,a)}}return ks.VoiceProfileEnrollmentCancellationDetails=n,ks}var Ps={},i2;function fL(){if(i2)return Ps;i2=1,Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.VoiceProfileCancellationDetails=Ps.VoiceProfileResult=void 0;const e=ue(),t=Ce,r=$();let n=class{constructor(s,a){this.privReason=s,this.privProperties=new r.PropertyCollection,s===r.ResultReason.Canceled&&(t.Contracts.throwIfNullOrUndefined(a,"statusText"),this.privErrorDetails=a,this.privProperties.setProperty(e.CancellationErrorCodePropertyName,r.CancellationErrorCode[r.CancellationErrorCode.ServiceError]))}get reason(){return this.privReason}get properties(){return this.privProperties}get errorDetails(){return this.privErrorDetails}};Ps.VoiceProfileResult=n;class o extends r.CancellationDetailsBase{constructor(s,a,l){super(s,a,l)}static fromResult(s){const a=r.CancellationReason.Error;let l=r.CancellationErrorCode.NoError;return s.properties&&(l=r.CancellationErrorCode[s.properties.getProperty(e.CancellationErrorCodePropertyName,r.CancellationErrorCode[r.CancellationErrorCode.NoError])]),new o(a,s.errorDetails,l)}}return Ps.VoiceProfileCancellationDetails=o,Ps}var iu={},s2;function hL(){if(s2)return iu;s2=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.VoiceProfilePhraseResult=void 0;const e=Ce,t=$();let r=class extends t.VoiceProfileResult{constructor(o,i,s,a){super(o,i),this.privPhrases=[],e.Contracts.throwIfNullOrUndefined(a,"phrase array"),this.privType=s,a&&a[0]&&(this.privPhrases=a)}get phrases(){return this.privPhrases}get type(){return this.privType}};return iu.VoiceProfilePhraseResult=r,iu}var su={},a2;function pL(){if(a2)return su;a2=1,Object.defineProperty(su,"__esModule",{value:!0}),su.VoiceProfileClient=void 0;const e=ue(),t=gR(),r=Ce,n=$();let o=class extends n.Recognizer{constructor(s){r.Contracts.throwIfNullOrUndefined(s,"speechConfig");const a=s;r.Contracts.throwIfNull(a,"speechConfig"),super(t.AudioConfig.fromStreamInput(n.AudioInputStream.createPushStream()),a.properties,new e.VoiceProfileConnectionFactory),this.privProperties=a.properties.clone(),this.privVoiceAdapter=this.privReco,this.privDisposedVoiceAdapter=!1}get properties(){return this.privProperties}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){r.Contracts.throwIfNullOrWhitespace(s,"token"),this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,s)}async createProfileAsync(s,a){const l=await this.privVoiceAdapter.createProfile(s,a);return new n.VoiceProfile(l[0],s)}async retrieveEnrollmentResultAsync(s){return this.privVoiceAdapter.retrieveEnrollmentResult(s)}async getAllProfilesAsync(s){return this.privVoiceAdapter.getAllProfiles(s)}async getActivationPhrasesAsync(s,a){return this.privVoiceAdapter.getActivationPhrases(s,a)}async enrollProfileAsync(s,a){const l=a;return r.Contracts.throwIfNullOrUndefined(l,"audioConfig"),this.audioConfig=a,this.privVoiceAdapter.SpeakerAudioSource=l,this.privVoiceAdapter.enrollProfile(s)}async deleteProfileAsync(s){return this.privVoiceAdapter.deleteProfile(s)}async resetProfileAsync(s){return this.privVoiceAdapter.resetProfile(s)}async close(){await this.dispose(!0)}createServiceRecognizer(s,a,l,c){const u=l;return new e.VoiceServiceRecognizer(s,a,u,c,this)}async dispose(s){this.privDisposedVoiceAdapter||(this.privDisposedVoiceAdapter=!0,s&&await super.dispose(s))}createRecognizerConfig(s){return new e.RecognizerConfig(s,this.properties)}getResult(s,a){return new n.VoiceProfileResult(s.ok?a:n.ResultReason.Canceled,s.statusText)}};return su.VoiceProfileClient=o,su}var au={},l2;function gL(){if(l2)return au;l2=1,Object.defineProperty(au,"__esModule",{value:!0}),au.SpeakerRecognizer=void 0;const e=ue(),t=Ce,r=$();let n=class extends r.Recognizer{constructor(i,s){t.Contracts.throwIfNullOrUndefined(i,"speechConfig");const a=i;t.Contracts.throwIfNullOrUndefined(a,"speechConfig"),super(s,a.properties,new e.SpeakerRecognitionConnectionFactory),this.privAudioConfigImpl=s,t.Contracts.throwIfNull(this.privAudioConfigImpl,"audioConfig"),this.privDisposedSpeakerRecognizer=!1,this.privProperties=a.properties}get authorizationToken(){return this.properties.getProperty(r.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(i){t.Contracts.throwIfNullOrWhitespace(i,"token"),this.properties.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,i)}get properties(){return this.privProperties}async recognizeOnceAsync(i){return t.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer),this.recognizeSpeakerOnceAsyncImpl(i)}async close(){t.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer),await this.dispose(!0)}async recognizeSpeakerOnceAsyncImpl(i){t.Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer),await this.implRecognizerStop();const s=await this.privReco.recognizeSpeaker(i);return await this.implRecognizerStop(),s}async implRecognizerStop(){this.privReco&&await this.privReco.stopRecognizing()}createRecognizerConfig(i){return new e.RecognizerConfig(i,this.privProperties)}createServiceRecognizer(i,s,a,l){const c=a;return new e.SpeakerServiceRecognizer(i,s,c,l,this)}async dispose(i){this.privDisposedSpeakerRecognizer||i&&(this.privDisposedSpeakerRecognizer=!0,await super.dispose(i))}};return au.SpeakerRecognizer=n,au}var lu={},c2;function vL(){if(c2)return lu;c2=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.SpeakerIdentificationModel=void 0;const e=Ce,t=$();let r=class MR{constructor(o){if(this.privVoiceProfiles=[],this.privProfileIds=[],e.Contracts.throwIfNullOrUndefined(o,"VoiceProfiles"),o.length===0)throw new Error("Empty Voice Profiles array");for(const i of o){if(i.profileType!==t.VoiceProfileType.TextIndependentIdentification)throw new Error("Identification model can only be created from Identification profile: "+i.profileId);this.privVoiceProfiles.push(i),this.privProfileIds.push(i.profileId)}}static fromProfiles(o){return new MR(o)}get voiceProfileIds(){return this.privProfileIds.join(",")}get profileIds(){return this.privProfileIds}get scenario(){return"TextIndependentIdentification"}};return lu.SpeakerIdentificationModel=r,lu}var cu={},u2;function mL(){if(u2)return cu;u2=1,Object.defineProperty(cu,"__esModule",{value:!0}),cu.SpeakerVerificationModel=void 0;const e=Ce,t=$();let r=class zR{constructor(o){if(e.Contracts.throwIfNullOrUndefined(o,"VoiceProfile"),o.profileType===t.VoiceProfileType.TextIndependentIdentification)throw new Error("Verification model cannot be created from Identification profile");this.privVoiceProfile=o}static fromProfile(o){return new zR(o)}get voiceProfile(){return this.privVoiceProfile}get profileIds(){return[this.voiceProfile.profileId]}get scenario(){return this.voiceProfile.profileType===t.VoiceProfileType.TextDependentVerification?"TextDependentVerification":"TextIndependentVerification"}};return cu.SpeakerVerificationModel=r,cu}var uu={},cb={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageIdMode=void 0,function(t){t[t.AtStart=0]="AtStart",t[t.Continuous=1]="Continuous"}(e.LanguageIdMode||(e.LanguageIdMode={}))})(cb);var d2;function yL(){if(d2)return uu;d2=1,Object.defineProperty(uu,"__esModule",{value:!0}),uu.AutoDetectSourceLanguageConfig=void 0;const e=ue(),t=Ce,r=$(),n=cb;let o=class Nh{constructor(){this.privProperties=new r.PropertyCollection,this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_LanguageIdMode,"AtStart"),this.privLanguageIdMode=n.LanguageIdMode.AtStart}static fromOpenRange(){const s=new Nh;return s.properties.setProperty(r.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages,e.AutoDetectSourceLanguagesOpenRangeOptionName),s}static fromLanguages(s){t.Contracts.throwIfArrayEmptyOrWhitespace(s,"languages");const a=new Nh;return a.properties.setProperty(r.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages,s.join()),a}static fromSourceLanguageConfigs(s){if(s.length<1)throw new Error("Expected non-empty SourceLanguageConfig array.");const a=new Nh,l=[];return s.forEach(c=>{if(l.push(c.language),c.endpointId!==void 0&&c.endpointId!==""){const u=c.language+r.PropertyId.SpeechServiceConnection_EndpointId.toString();a.properties.setProperty(u,c.endpointId)}}),a.properties.setProperty(r.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages,l.join()),a}get properties(){return this.privProperties}set mode(s){s===n.LanguageIdMode.Continuous?(this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion,"2"),this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_LanguageIdMode,"Continuous")):(this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion,"1"),this.privProperties.setProperty(r.PropertyId.SpeechServiceConnection_LanguageIdMode,"AtStart")),this.privLanguageIdMode=s}};return uu.AutoDetectSourceLanguageConfig=o,uu}var qg={};Object.defineProperty(qg,"__esModule",{value:!0});qg.AutoDetectSourceLanguageResult=void 0;const f2=Ce;class Sp{constructor(t,r){f2.Contracts.throwIfNullOrUndefined(t,"language"),f2.Contracts.throwIfNullOrUndefined(r,"languageDetectionConfidence"),this.privLanguage=t,this.privLanguageDetectionConfidence=r}static fromResult(t){return new Sp(t.language,t.languageDetectionConfidence)}static fromConversationTranscriptionResult(t){return new Sp(t.language,t.languageDetectionConfidence)}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}}qg.AutoDetectSourceLanguageResult=Sp;var Ug={};Object.defineProperty(Ug,"__esModule",{value:!0});Ug.SourceLanguageConfig=void 0;const SL=Ce;class ub{constructor(t,r){SL.Contracts.throwIfNullOrUndefined(t,"language"),this.privLanguage=t,this.privEndpointId=r}static fromLanguage(t,r){return new ub(t,r)}get language(){return this.privLanguage}get endpointId(){return this.privEndpointId}}Ug.SourceLanguageConfig=ub;var o0={},h2;function bL(){return h2||(h2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SpeakerRecognitionCancellationDetails=e.SpeakerRecognitionResult=e.SpeakerRecognitionResultType=void 0;const t=ue(),r=$();var n;(function(s){s[s.Verify=0]="Verify",s[s.Identify=1]="Identify"})(n=e.SpeakerRecognitionResultType||(e.SpeakerRecognitionResultType={}));class o{constructor(a,l=r.ResultReason.RecognizedSpeaker,c=r.CancellationErrorCode.NoError,u=""){this.privProperties=new r.PropertyCollection;const d=a.scenario==="TextIndependentIdentification"?n.Identify:n.Verify;this.privReason=l,this.privReason!==r.ResultReason.Canceled?d===n.Identify?(this.privProfileId=a.identificationResult.identifiedProfile.profileId,this.privScore=a.identificationResult.identifiedProfile.score,this.privReason=r.ResultReason.RecognizedSpeakers):(this.privScore=a.verificationResult.score,a.verificationResult.recognitionResult.toLowerCase()!=="accept"&&(this.privReason=r.ResultReason.NoMatch),a.verificationResult.profileId!==void 0&&a.verificationResult.profileId!==""&&(this.privProfileId=a.verificationResult.profileId)):(this.privErrorDetails=u,this.privProperties.setProperty(t.CancellationErrorCodePropertyName,r.CancellationErrorCode[c])),this.privProperties.setProperty(r.PropertyId.SpeechServiceResponse_JsonResult,JSON.stringify(a))}get properties(){return this.privProperties}get reason(){return this.privReason}get profileId(){return this.privProfileId}get errorDetails(){return this.privErrorDetails}get score(){return this.privScore}}e.SpeakerRecognitionResult=o;class i extends r.CancellationDetailsBase{constructor(a,l,c){super(a,l,c)}static fromResult(a){const l=r.CancellationReason.Error;let c=r.CancellationErrorCode.NoError;return a.properties&&(c=r.CancellationErrorCode[a.properties.getProperty(t.CancellationErrorCodePropertyName,r.CancellationErrorCode[r.CancellationErrorCode.NoError])]),new i(l,a.errorDetails,c)}}e.SpeakerRecognitionCancellationDetails=i}(o0)),o0}var i0={},Rs={},p2;function LR(){if(p2)return Rs;p2=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.ConversationImpl=Rs.Conversation=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class{constructor(){}static createConversationAsync(a,l,c,u){r.Contracts.throwIfNullOrUndefined(a,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","config")),r.Contracts.throwIfNullOrUndefined(a.region,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","SpeechServiceConnection_Region")),!a.subscriptionKey&&!a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceAuthorization_Token])&&r.Contracts.throwIfNullOrUndefined(a.subscriptionKey,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","SpeechServiceConnection_Key"));let d,f,p;return typeof l=="string"?(d=new i(a,l),t.marshalPromiseToCallbacks((async()=>{})(),c,u)):(d=new i(a),f=l,p=c,d.createConversationAsync(()=>{f&&f()},h=>{p&&p(h)})),d}};Rs.Conversation=o;class i extends o{constructor(a,l){if(super(),this.privErrors=e.ConversationConnectionConfig.restErrors,this.onConnected=d=>{var f;this.privIsConnected=!0;try{(f=this.privConversationTranslator)!=null&&f.sessionStarted&&this.privConversationTranslator.sessionStarted(this.privConversationTranslator,d)}catch{}},this.onDisconnected=d=>{var f;try{(f=this.privConversationTranslator)!=null&&f.sessionStopped&&this.privConversationTranslator.sessionStopped(this.privConversationTranslator,d)}catch{}finally{this.close(!1)}},this.onCanceled=(d,f)=>{var p;try{(p=this.privConversationTranslator)!=null&&p.canceled&&this.privConversationTranslator.canceled(this.privConversationTranslator,f)}catch{}},this.onParticipantUpdateCommandReceived=(d,f)=>{try{const p=this.privParticipants.getParticipant(f.id);if(p!==void 0){switch(f.key){case e.ConversationTranslatorCommandTypes.changeNickname:p.displayName=f.value;break;case e.ConversationTranslatorCommandTypes.setUseTTS:p.isUsingTts=f.value;break;case e.ConversationTranslatorCommandTypes.setProfanityFiltering:p.profanity=f.value;break;case e.ConversationTranslatorCommandTypes.setMute:p.isMuted=f.value;break;case e.ConversationTranslatorCommandTypes.setTranslateToLanguages:p.translateToLanguages=f.value;break}this.privParticipants.addOrUpdateParticipant(p),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.Updated,[this.toParticipant(p)],f.sessionId))}}catch{}},this.onLockRoomCommandReceived=()=>{},this.onMuteAllCommandReceived=(d,f)=>{try{this.privParticipants.participants.forEach(p=>p.isMuted=p.isHost?!1:f.isMuted),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.Updated,this.toParticipants(!1),f.sessionId))}catch{}},this.onParticipantJoinCommandReceived=(d,f)=>{try{const p=this.privParticipants.addOrUpdateParticipant(f.participant);p!==void 0&&this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.JoinedConversation,[this.toParticipant(p)],f.sessionId))}catch{}},this.onParticipantLeaveCommandReceived=(d,f)=>{try{const p=this.privParticipants.getParticipant(f.participant.id);p!==void 0&&(this.privParticipants.deleteParticipant(f.participant.id),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.LeftConversation,[this.toParticipant(p)],f.sessionId)))}catch{}},this.onTranslationReceived=(d,f)=>{try{switch(f.command){case e.ConversationTranslatorMessageTypes.final:this.privConversationTranslator&&this.privConversationTranslator.transcribed(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break;case e.ConversationTranslatorMessageTypes.partial:this.privConversationTranslator&&this.privConversationTranslator.transcribing(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break;case e.ConversationTranslatorMessageTypes.instantMessage:this.privConversationTranslator&&this.privConversationTranslator.textMessageReceived(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break}}catch{}},this.onParticipantsListReceived=(d,f)=>{var p;try{if(f.sessionToken!==void 0&&f.sessionToken!==null&&(this.privRoom.token=f.sessionToken),this.privParticipants.participants=[...f.participants],this.privParticipants.me!==void 0&&(this.privIsReady=!0),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.JoinedConversation,this.toParticipants(!0),f.sessionId)),this.me.isHost){const h=(p=this.privConversationTranslator)==null?void 0:p.properties.getProperty(n.PropertyId.ConversationTranslator_Name);h!==void 0&&h.length>0&&h!==this.me.displayName&&this.changeNicknameAsync(h)}}catch{}},this.onConversationExpiration=(d,f)=>{try{this.privConversationTranslator&&this.privConversationTranslator.conversationExpiration(this.privConversationTranslator,f)}catch{}},this.privIsConnected=!1,this.privIsDisposed=!1,this.privConversationId="",this.privProperties=new n.PropertyCollection,this.privManager=new e.ConversationManager,a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage])||a.setProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage],e.ConversationConnectionConfig.defaultLanguageCode),this.privLanguage=a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage]),l)this.privConversationId=l;else{a.targetLanguages.length===0&&a.addTargetLanguage(this.privLanguage),a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceResponse_ProfanityOption])||a.setProfanity(n.ProfanityOption.Masked);let f=a.getProperty(n.PropertyId[n.PropertyId.ConversationTranslator_Name]);f==null&&(f="Host"),r.Contracts.throwIfNullOrTooLong(f,"nickname",50),r.Contracts.throwIfNullOrTooShort(f,"nickname",2),a.setProperty(n.PropertyId[n.PropertyId.ConversationTranslator_Name],f)}this.privConfig=a;const u=a;r.Contracts.throwIfNull(u,"speechConfig"),this.privProperties=u.properties.clone(),this.privIsConnected=!1,this.privParticipants=new e.InternalParticipants,this.privIsReady=!1,this.privTextMessageMaxLength=1e3}get room(){return this.privRoom}get connection(){return this.privConversationRecognizer}get config(){return this.privConfig}get conversationId(){return this.privRoom?this.privRoom.roomId:this.privConversationId}get properties(){return this.privProperties}get speechRecognitionLanguage(){return this.privLanguage}get isMutedByHost(){var a,l;return(a=this.privParticipants.me)!=null&&a.isHost?!1:(l=this.privParticipants.me)==null?void 0:l.isMuted}get isConnected(){return this.privIsConnected&&this.privIsReady}get participants(){return this.toParticipants(!0)}get me(){return this.toParticipant(this.privParticipants.me)}get host(){return this.toParticipant(this.privParticipants.host)}get transcriberRecognizer(){return this.privTranscriberRecognizer}get conversationInfo(){const a=this.conversationId,l=this.participants.map(d=>({id:d.id,preferredLanguage:d.preferredLanguage,voice:d.voice})),c={};for(const d of e.ConversationConnectionConfig.transcriptionEventKeys){const f=this.properties.getProperty(d,"");f!==""&&(c[d]=f)}return{id:a,participants:l,conversationProperties:c}}get canSend(){var a;return this.privIsConnected&&!((a=this.privParticipants.me)!=null&&a.isMuted)}get canSendAsHost(){var a;return this.privIsConnected&&((a=this.privParticipants.me)==null?void 0:a.isHost)}get authorizationToken(){return this.privToken}set authorizationToken(a){r.Contracts.throwIfNullOrWhitespace(a,"authorizationToken"),this.privToken=a}set conversationTranslator(a){this.privConversationTranslator=a}onToken(a){this.privConversationTranslator.onToken(a)}createConversationAsync(a,l){try{this.privConversationRecognizer&&this.handleError(new Error(this.privErrors.permissionDeniedStart),l),this.privManager.createOrJoin(this.privProperties,void 0,c=>{c||this.handleError(new Error(this.privErrors.permissionDeniedConnect),l),this.privRoom=c,this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}startConversationAsync(a,l){try{this.privConversationRecognizer&&this.handleError(new Error(this.privErrors.permissionDeniedStart),l),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedConnect),this.privParticipants.meId=this.privRoom.participantId,this.privConversationRecognizer=e.ConversationRecognizerFactory.fromConfig(this,this.privConfig),this.privConversationRecognizer.connected=this.onConnected,this.privConversationRecognizer.disconnected=this.onDisconnected,this.privConversationRecognizer.canceled=this.onCanceled,this.privConversationRecognizer.participantUpdateCommandReceived=this.onParticipantUpdateCommandReceived,this.privConversationRecognizer.lockRoomCommandReceived=this.onLockRoomCommandReceived,this.privConversationRecognizer.muteAllCommandReceived=this.onMuteAllCommandReceived,this.privConversationRecognizer.participantJoinCommandReceived=this.onParticipantJoinCommandReceived,this.privConversationRecognizer.participantLeaveCommandReceived=this.onParticipantLeaveCommandReceived,this.privConversationRecognizer.translationReceived=this.onTranslationReceived,this.privConversationRecognizer.participantsListReceived=this.onParticipantsListReceived,this.privConversationRecognizer.conversationExpiration=this.onConversationExpiration,this.privConversationRecognizer.connect(this.privRoom.token,()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}addParticipantAsync(a,l,c){r.Contracts.throwIfNullOrUndefined(a,"Participant"),t.marshalPromiseToCallbacks(this.addParticipantImplAsync(a),l,c)}joinConversationAsync(a,l,c,u,d){try{r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","conversationId")),r.Contracts.throwIfNullOrWhitespace(l,this.privErrors.invalidArgs.replace("{arg}","nickname")),r.Contracts.throwIfNullOrWhitespace(c,this.privErrors.invalidArgs.replace("{arg}","language")),this.privManager.createOrJoin(this.privProperties,a,f=>{r.Contracts.throwIfNullOrUndefined(f,this.privErrors.permissionDeniedConnect),this.privRoom=f,this.privConfig.authorizationToken=f.cognitiveSpeechAuthToken,u&&u(f.cognitiveSpeechAuthToken)},f=>{this.handleError(f,d)})}catch(f){this.handleError(f,d)}}deleteConversationAsync(a,l){t.marshalPromiseToCallbacks(this.deleteConversationImplAsync(),a,l)}async deleteConversationImplAsync(){r.Contracts.throwIfNullOrUndefined(this.privProperties,this.privErrors.permissionDeniedConnect),r.Contracts.throwIfNullOrWhitespace(this.privRoom.token,this.privErrors.permissionDeniedConnect),await this.privManager.leave(this.privProperties,this.privRoom.token),this.dispose()}endConversationAsync(a,l){t.marshalPromiseToCallbacks(this.endConversationImplAsync(),a,l)}endConversationImplAsync(){return this.close(!0)}lockConversationAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","lock")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getLockCommand(!0),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}muteAllParticipantsAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privConversationRecognizer,this.privErrors.permissionDeniedSend),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","mute")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(!0),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}muteParticipantAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","userId")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),!this.me.isHost&&this.me.id!==a&&this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","mute")),c),this.privParticipants.getParticipantIndex(a)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteCommand(a,!0),()=>{this.handleCallback(l,c)},d=>{this.handleError(d,c)})}catch(u){this.handleError(u,c)}}removeParticipantAsync(a,l,c){try{if(r.Contracts.throwIfDisposed(this.privIsDisposed),this.privTranscriberRecognizer&&a.hasOwnProperty("id"))t.marshalPromiseToCallbacks(this.removeParticipantImplAsync(a),l,c);else{r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","remove")),c);let u="";typeof a=="string"?u=a:a.hasOwnProperty("id")?u=a.id:a.hasOwnProperty("userId")&&(u=a.userId),r.Contracts.throwIfNullOrWhitespace(u,this.privErrors.invalidArgs.replace("{arg}","userId")),this.participants.findIndex(f=>f.id===u)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getEjectCommand(u),()=>{this.handleCallback(l,c)},f=>{this.handleError(f,c)})}}catch(u){this.handleError(u,c)}}unlockConversationAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","unlock")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getLockCommand(!1),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}unmuteAllParticipantsAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","unmute all")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(!1),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}unmuteParticipantAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","userId")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),!this.me.isHost&&this.me.id!==a&&this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","mute")),c),this.privParticipants.getParticipantIndex(a)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteCommand(a,!1),()=>{this.handleCallback(l,c)},d=>{this.handleError(d,c)})}catch(u){this.handleError(u,c)}}sendTextMessageAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","message")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),a.length>this.privTextMessageMaxLength&&this.handleError(new Error(this.privErrors.invalidArgs.replace("{arg}","message length")),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMessageCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}setTranslatedLanguagesAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfArrayEmptyOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","languages")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}changeNicknameAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","nickname")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}isDisposed(){return this.privIsDisposed}dispose(){this.isDisposed||(this.privIsDisposed=!0,this.config&&this.config.close(),this.privConfig=void 0,this.privLanguage=void 0,this.privProperties=void 0,this.privRoom=void 0,this.privToken=void 0,this.privManager=void 0,this.privIsConnected=!1,this.privIsReady=!1,this.privParticipants=void 0)}async connectTranscriberRecognizer(a){this.privTranscriberRecognizer&&await this.privTranscriberRecognizer.close(),await a.enforceAudioGating(),this.privTranscriberRecognizer=a,this.privTranscriberRecognizer.conversation=this}getKeepAlive(){const a=this.me?this.me.displayName:"default_nickname";return JSON.stringify({id:"0",nickname:a,participantId:this.privRoom.participantId,roomId:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.keepAlive})}addParticipantImplAsync(a){if(this.privParticipants.addOrUpdateParticipant(a)!==void 0&&this.privTranscriberRecognizer){const c=this.conversationInfo;return c.participants=[a],this.privTranscriberRecognizer.pushConversationEvent(c,"join")}}removeParticipantImplAsync(a){this.privParticipants.deleteParticipant(a.id);const l=this.conversationInfo;return l.participants=[a],this.privTranscriberRecognizer.pushConversationEvent(l,"leave")}async close(a){var l;try{this.privIsConnected=!1,await((l=this.privConversationRecognizer)==null?void 0:l.close()),this.privConversationRecognizer=void 0,this.privConversationTranslator&&this.privConversationTranslator.dispose()}catch(c){throw c}a&&this.dispose()}handleCallback(a,l){if(a){try{a()}catch(c){l&&l(c)}a=void 0}}handleError(a,l){if(l)if(a instanceof Error){const c=a;l(c.name+": "+c.message)}else l(a)}toParticipants(a){const l=this.privParticipants.participants.map(c=>this.toParticipant(c));return a?l:l.filter(c=>c.isHost===!1)}toParticipant(a){return new n.Participant(a.id,a.avatar,a.displayName,a.isHost,a.isMuted,a.isUsingTts,a.preferredLanguage,a.voice)}getMuteAllCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setMuteAll,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getMuteCommand(a,l){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(a,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setMute,participantId:a,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:l})}getLockCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setLockState,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getEjectCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(a,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.ejectParticipant,participantId:a,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand})}getSetTranslateToLanguagesCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setTranslateToLanguages,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getChangeNicknameCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(a,"nickname"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.changeNickname,nickname:a,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getMessageCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),r.Contracts.throwIfNullOrWhitespace(a,"message"),JSON.stringify({participantId:this.privRoom.participantId,roomId:this.privRoom.roomId,text:a,type:e.ConversationTranslatorMessageTypes.instantMessage})}}return Rs.ConversationImpl=i,Rs}var $g={};Object.defineProperty($g,"__esModule",{value:!0});$g.ConversationCommon=void 0;class CL{constructor(t){this.privAudioConfig=t}handleCallback(t,r){if(t){try{t()}catch(n){r&&r(n)}t=void 0}}handleError(t,r){if(r)if(t instanceof Error){const n=t;r(n.name+": "+n.message)}else r(t)}}$g.ConversationCommon=CL;var du={},g2;function TL(){if(g2)return du;g2=1,Object.defineProperty(du,"__esModule",{value:!0}),du.ConversationExpirationEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{constructor(n,o){super(o),this.privExpirationTime=n}get expirationTime(){return this.privExpirationTime}};return du.ConversationExpirationEventArgs=t,du}var fu={},v2;function EL(){if(v2)return fu;v2=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.ConversationParticipantsChangedEventArgs=void 0;const e=$();let t=class extends e.SessionEventArgs{constructor(n,o,i){super(i),this.privReason=n,this.privParticipant=o}get reason(){return this.privReason}get participants(){return this.privParticipant}};return fu.ConversationParticipantsChangedEventArgs=t,fu}var hu={},m2;function wL(){if(m2)return hu;m2=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.ConversationTranslationCanceledEventArgs=void 0;const e=U1();let t=class extends e.CancellationEventArgsBase{};return hu.ConversationTranslationCanceledEventArgs=t,hu}var pu={},y2;function _L(){if(y2)return pu;y2=1,Object.defineProperty(pu,"__esModule",{value:!0}),pu.ConversationTranslationEventArgs=void 0;const e=$();let t=class extends e.RecognitionEventArgs{constructor(n,o,i){super(o,i),this.privResult=n}get result(){return this.privResult}};return pu.ConversationTranslationEventArgs=t,pu}var gu={},S2;function kL(){if(S2)return gu;S2=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.ConversationTranslationResult=void 0;const e=bR();let t=class extends e.TranslationRecognitionResult{constructor(n,o,i,s,a,l,c,u,d,f,p){super(o,s,a,l,c,u,void 0,void 0,d,f,p),this.privId=n,this.privOrigLang=i}get participantId(){return this.privId}get originalLang(){return this.privOrigLang}};return gu.ConversationTranslationResult=t,gu}var s0={},vu={},W1={};Object.defineProperty(W1,"__esModule",{value:!0});W1.StringUtils=void 0;class PL{static formatString(t,r){if(!t)return"";if(!r)return t;let n="",o="";const i=l=>{n+=l},s=l=>{o+=l};let a=i;for(let l=0;l{m[A]=w}),new a.TranscriberConnectionFactory().setQueryParams(m,u,g),m[i.QueryParameterNames.CtsMeetingId]=y[i.QueryParameterNames.CtsMeetingId],m[i.QueryParameterNames.CtsDeviceId]=y[i.QueryParameterNames.CtsDeviceId],h.isHost||(m[i.QueryParameterNames.CtsIsParticipant]=""),i.QueryParameterNames.Format in m||(m[i.QueryParameterNames.Format]="simple"),k.searchParams.forEach((w,A)=>{k.searchParams.set(A,m[A]),delete m[A]}),g=k.toString()}else{const k=new a.TranslationConnectionFactory;g=k.getEndpointUrl(u,!0),g=t.StringUtils.formatString(g,y),k.setQueryParams(m,u,g)}b[o.HeaderNames.ConnectionId]=f,b[e.RestConfigBase.configParams.token]=h.token,d.token&&(b[d.headerName]=d.token);const C=u.parameters.getProperty("SPEECH-EnableWebsocketCompression","").toUpperCase()==="TRUE";return new e.WebsocketConnection(g,m,b,new a.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(u),C,f)}};return vu.ConversationTranslatorConnectionFactory=l,l.CTS_VIRT_MIC_PATH="/speech/recognition/dynamicaudio",vu}var C2;function AL(){return C2||(C2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConversationTranslator=e.SpeechState=void 0;const t=ue(),r=RL(),n=ve(),o=Ce,i=$(),s=LR(),a=db();var l;(function(d){d[d.Inactive=0]="Inactive",d[d.Connecting=1]="Connecting",d[d.Connected=2]="Connected"})(l=e.SpeechState||(e.SpeechState={}));class c extends i.TranslationRecognizer{constructor(f,p,h,v){super(f,p,new r.ConversationTranslatorConnectionFactory(v)),this.privSpeechState=l.Inactive,h&&(this.privTranslator=h,this.sessionStarted=()=>{this.privSpeechState=l.Connected},this.sessionStopped=()=>{this.privSpeechState=l.Inactive},this.recognizing=(y,g)=>{this.privTranslator.recognizing&&this.privTranslator.recognizing(this.privTranslator,g)},this.recognized=async(y,g)=>{var m;(m=g.result)!=null&&m.errorDetails?(await this.cancelSpeech(),this.fireCancelEvent(g.result.errorDetails)):this.privTranslator.recognized&&this.privTranslator.recognized(this.privTranslator,g)},this.canceled=async()=>{if(this.privSpeechState!==l.Inactive)try{await this.cancelSpeech()}catch{this.privSpeechState=l.Inactive}})}get state(){return this.privSpeechState}set state(f){this.privSpeechState=f}set authentication(f){this.privReco.authentication=f}onConnection(){this.privSpeechState=l.Connected}async onCancelSpeech(){this.privSpeechState=l.Inactive,await this.cancelSpeech()}fireCancelEvent(f){try{if(this.privTranslator.canceled){const p=new a.ConversationTranslationCanceledEventArgs(i.CancellationReason.Error,f,i.CancellationErrorCode.RuntimeError);this.privTranslator.canceled(this.privTranslator,p)}}catch{}}async cancelSpeech(){var f;try{this.stopContinuousRecognitionAsync(),await((f=this.privReco)==null?void 0:f.disconnect()),this.privSpeechState=l.Inactive}catch{}}}class u extends a.ConversationCommon{constructor(f){super(f),this.privErrors=t.ConversationConnectionConfig.restErrors,this.privIsDisposed=!1,this.privIsSpeaking=!1,this.privPlaceholderKey="abcdefghijklmnopqrstuvwxyz012345",this.privPlaceholderRegion="westus",this.privProperties=new i.PropertyCollection}get properties(){return this.privProperties}get speechRecognitionLanguage(){return this.privSpeechRecognitionLanguage}get participants(){var f;return(f=this.privConversation)==null?void 0:f.participants}get canSpeak(){return!(!this.privConversation.isConnected||!this.privCTRecognizer||this.privIsSpeaking||this.privCTRecognizer.state===l.Connected||this.privCTRecognizer.state===l.Connecting||this.privConversation.isMutedByHost)}onToken(f){this.privCTRecognizer.authentication=f}setServiceProperty(f,p){const h=JSON.parse(this.privProperties.getProperty(t.ServicePropertiesPropertyName,"{}"));h[f]=p,this.privProperties.setProperty(t.ServicePropertiesPropertyName,JSON.stringify(h))}joinConversationAsync(f,p,h,v,y){try{if(typeof f=="string"){o.Contracts.throwIfNullOrUndefined(f,this.privErrors.invalidArgs.replace("{arg}","conversation id")),o.Contracts.throwIfNullOrWhitespace(p,this.privErrors.invalidArgs.replace("{arg}","nickname")),this.privConversation&&this.handleError(new Error(this.privErrors.permissionDeniedStart),y);let g=h;(g==null||g==="")&&(g=t.ConversationConnectionConfig.defaultLanguageCode),this.privSpeechTranslationConfig=i.SpeechTranslationConfig.fromSubscription(this.privPlaceholderKey,this.privPlaceholderRegion),this.privSpeechTranslationConfig.setProfanity(i.ProfanityOption.Masked),this.privSpeechTranslationConfig.addTargetLanguage(g),this.privSpeechTranslationConfig.setProperty(i.PropertyId[i.PropertyId.SpeechServiceConnection_RecoLanguage],g),this.privSpeechTranslationConfig.setProperty(i.PropertyId[i.PropertyId.ConversationTranslator_Name],p);const m=[i.PropertyId.SpeechServiceConnection_Host,i.PropertyId.ConversationTranslator_Host,i.PropertyId.SpeechServiceConnection_Endpoint,i.PropertyId.SpeechServiceConnection_ProxyHostName,i.PropertyId.SpeechServiceConnection_ProxyPassword,i.PropertyId.SpeechServiceConnection_ProxyPort,i.PropertyId.SpeechServiceConnection_ProxyUserName,"ConversationTranslator_MultiChannelAudio","ConversationTranslator_Region"];for(const C of m){const k=this.privProperties.getProperty(C);if(k){const E=typeof C=="string"?C:i.PropertyId[C];this.privSpeechTranslationConfig.setProperty(E,k)}}const b=JSON.parse(this.privProperties.getProperty(t.ServicePropertiesPropertyName,"{}"));for(const C of Object.keys(b))this.privSpeechTranslationConfig.setServiceProperty(C,b[C],i.ServicePropertyChannel.UriQueryParameter);this.privConversation=new s.ConversationImpl(this.privSpeechTranslationConfig),this.privConversation.conversationTranslator=this,this.privConversation.joinConversationAsync(f,p,g,C=>{C||this.handleError(new Error(this.privErrors.permissionDeniedConnect),y),this.privSpeechTranslationConfig.authorizationToken=C,this.privConversation.room.isHost=!1,this.privConversation.startConversationAsync(()=>{this.handleCallback(v,y)},k=>{this.handleError(k,y)})},C=>{this.handleError(C,y)})}else typeof f=="object"?(o.Contracts.throwIfNullOrUndefined(f,this.privErrors.invalidArgs.replace("{arg}","conversation id")),o.Contracts.throwIfNullOrWhitespace(p,this.privErrors.invalidArgs.replace("{arg}","nickname")),this.privProperties.setProperty(i.PropertyId.ConversationTranslator_Name,p),this.privConversation=f,this.privConversation.conversationTranslator=this,this.privConversation.room.isHost=!0,o.Contracts.throwIfNullOrUndefined(this.privConversation,this.privErrors.permissionDeniedConnect),o.Contracts.throwIfNullOrUndefined(this.privConversation.room.token,this.privErrors.permissionDeniedConnect),this.privSpeechTranslationConfig=f.config,this.handleCallback(h,v)):this.handleError(new Error(this.privErrors.invalidArgs.replace("{arg}","invalid conversation type")),v)}catch(g){this.handleError(g,typeof h=="string"?y:v)}}leaveConversationAsync(f,p){n.marshalPromiseToCallbacks((async()=>{await this.cancelSpeech(),await this.privConversation.endConversationImplAsync(),await this.privConversation.deleteConversationImplAsync(),this.dispose()})(),f,p)}sendTextMessageAsync(f,p,h){try{o.Contracts.throwIfNullOrUndefined(this.privConversation,this.privErrors.permissionDeniedSend),o.Contracts.throwIfNullOrWhitespace(f,this.privErrors.invalidArgs.replace("{arg}",f)),this.privConversation.sendTextMessageAsync(f,p,h)}catch(v){this.handleError(v,h)}}startTranscribingAsync(f,p){n.marshalPromiseToCallbacks((async()=>{try{o.Contracts.throwIfNullOrUndefined(this.privConversation,this.privErrors.permissionDeniedSend),o.Contracts.throwIfNullOrUndefined(this.privConversation.room.token,this.privErrors.permissionDeniedConnect),this.privCTRecognizer===void 0&&await this.connectTranslatorRecognizer(),o.Contracts.throwIfNullOrUndefined(this.privCTRecognizer,this.privErrors.permissionDeniedSend),this.canSpeak||this.handleError(new Error(this.privErrors.permissionDeniedSend),p),await this.startContinuousRecognition(),this.privIsSpeaking=!0}catch(h){throw this.privIsSpeaking=!1,await this.cancelSpeech(),h}})(),f,p)}stopTranscribingAsync(f,p){n.marshalPromiseToCallbacks((async()=>{try{if(!this.privIsSpeaking){await this.cancelSpeech();return}this.privIsSpeaking=!1,await new Promise((h,v)=>{this.privCTRecognizer.stopContinuousRecognitionAsync(h,v)})}catch{await this.cancelSpeech()}})(),f,p)}isDisposed(){return this.privIsDisposed}dispose(f,p,h){n.marshalPromiseToCallbacks((async()=>{this.isDisposed&&!this.privIsSpeaking||(await this.cancelSpeech(),this.privIsDisposed=!0,this.privSpeechTranslationConfig.close(),this.privSpeechRecognitionLanguage=void 0,this.privProperties=void 0,this.privAudioConfig=void 0,this.privSpeechTranslationConfig=void 0,this.privConversation.dispose(),this.privConversation=void 0)})(),p,h)}async cancelSpeech(){var f;try{this.privIsSpeaking=!1,await((f=this.privCTRecognizer)==null?void 0:f.onCancelSpeech()),this.privCTRecognizer=void 0}catch{}}async connectTranslatorRecognizer(){try{this.privAudioConfig===void 0&&(this.privAudioConfig=i.AudioConfig.fromDefaultMicrophoneInput()),this.privSpeechTranslationConfig.getProperty(i.PropertyId[i.PropertyId.SpeechServiceConnection_Key])===this.privPlaceholderKey&&this.privSpeechTranslationConfig.setProperty(i.PropertyId[i.PropertyId.SpeechServiceConnection_Key],"");const f=()=>this.privConversation;this.privCTRecognizer=new c(this.privSpeechTranslationConfig,this.privAudioConfig,this,f)}catch(f){throw await this.cancelSpeech(),f}}startContinuousRecognition(){return new Promise((f,p)=>{this.privCTRecognizer.startContinuousRecognitionAsync(f,p)})}}e.ConversationTranslator=u}(s0)),s0}var mu={},T2;function IL(){if(T2)return mu;T2=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.ConversationTranscriber=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class jR extends n.Recognizer{constructor(s,a){const l=s;r.Contracts.throwIfNull(l,"speechConfig"),r.Contracts.throwIfNullOrWhitespace(l.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage),n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage]),super(a,l.properties,new e.ConversationTranscriberConnectionFactory),this.privProperties.setProperty(n.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion,"2"),this.privDisposedRecognizer=!1}static FromConfig(s,a,l){const c=s;return a.properties.mergeTo(c.properties),new jR(s,l)}get endpointId(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){r.Contracts.throwIfNullOrWhitespace(s,"token"),this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,s)}get speechRecognitionLanguage(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(e.OutputFormatPropertyName,n.OutputFormat[n.OutputFormat.Simple])===n.OutputFormat[n.OutputFormat.Simple]?n.OutputFormat.Simple:n.OutputFormat.Detailed}get properties(){return this.privProperties}startTranscribingAsync(s,a){t.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(e.RecognitionMode.Conversation),s,a)}stopTranscribingAsync(s,a){t.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(),s,a)}close(s,a){r.Contracts.throwIfDisposed(this.privDisposedRecognizer),t.marshalPromiseToCallbacks(this.dispose(!0),s,a)}async dispose(s){this.privDisposedRecognizer||(s&&(this.privDisposedRecognizer=!0,await this.implRecognizerStop()),await super.dispose(s))}createRecognizerConfig(s){return new e.RecognizerConfig(s,this.privProperties)}createServiceRecognizer(s,a,l,c){const u=l;return c.isSpeakerDiarizationEnabled=!0,new e.ConversationTranscriptionServiceRecognizer(s,a,u,c,this)}};return mu.ConversationTranscriber=o,mu}var As={},E2;function xL(){if(E2)return As;E2=1,Object.defineProperty(As,"__esModule",{value:!0}),As.Participant=As.User=void 0;const e=$();class t{constructor(o){this.privUserId=o}get userId(){return this.privUserId}}As.User=t;class r{constructor(o,i,s,a,l,c,u,d){this.privId=o,this.privAvatar=i,this.privDisplayName=s,this.privIsHost=a,this.privIsMuted=l,this.privIsUsingTts=c,this.privPreferredLanguage=u,this.privVoice=d,this.privProperties=new e.PropertyCollection}get avatar(){return this.privAvatar}get displayName(){return this.privDisplayName}get id(){return this.privId}get preferredLanguage(){return this.privPreferredLanguage}get isHost(){return this.privIsHost}get isMuted(){return this.privIsMuted}get isUsingTts(){return this.privIsUsingTts}get voice(){return this.privVoice}get properties(){return this.privProperties}static From(o,i,s){return new r(o,"",o,!1,!1,!1,i,s)}}return As.Participant=r,As}var HR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParticipantChangedReason=void 0,function(t){t[t.JoinedConversation=0]="JoinedConversation",t[t.LeftConversation=1]="LeftConversation",t[t.Updated=2]="Updated"}(e.ParticipantChangedReason||(e.ParticipantChangedReason={}))})(HR);var Is={},w2;function NL(){if(w2)return Is;w2=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.MeetingImpl=Is.Meeting=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class{constructor(){}static createMeetingAsync(a,l,c,u){if(r.Contracts.throwIfNullOrUndefined(a,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","config")),r.Contracts.throwIfNullOrUndefined(a.region,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","SpeechServiceConnection_Region")),r.Contracts.throwIfNull(l,"meetingId"),l.length===0)throw new Error("meetingId cannot be empty");!a.subscriptionKey&&!a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceAuthorization_Token])&&r.Contracts.throwIfNullOrUndefined(a.subscriptionKey,e.ConversationConnectionConfig.restErrors.invalidArgs.replace("{arg}","SpeechServiceConnection_Key"));const d=new i(a,l);return t.marshalPromiseToCallbacks((async()=>{})(),c,u),d}};Is.Meeting=o;class i extends o{constructor(a,l){super(),this.privErrors=e.ConversationConnectionConfig.restErrors,this.onConnected=d=>{var f;this.privIsConnected=!0;try{(f=this.privConversationTranslator)!=null&&f.sessionStarted&&this.privConversationTranslator.sessionStarted(this.privConversationTranslator,d)}catch{}},this.onDisconnected=d=>{var f;try{(f=this.privConversationTranslator)!=null&&f.sessionStopped&&this.privConversationTranslator.sessionStopped(this.privConversationTranslator,d)}catch{}finally{this.close(!1)}},this.onCanceled=(d,f)=>{var p;try{(p=this.privConversationTranslator)!=null&&p.canceled&&this.privConversationTranslator.canceled(this.privConversationTranslator,f)}catch{}},this.onParticipantUpdateCommandReceived=(d,f)=>{try{const p=this.privParticipants.getParticipant(f.id);if(p!==void 0){switch(f.key){case e.ConversationTranslatorCommandTypes.changeNickname:p.displayName=f.value;break;case e.ConversationTranslatorCommandTypes.setUseTTS:p.isUsingTts=f.value;break;case e.ConversationTranslatorCommandTypes.setProfanityFiltering:p.profanity=f.value;break;case e.ConversationTranslatorCommandTypes.setMute:p.isMuted=f.value;break;case e.ConversationTranslatorCommandTypes.setTranslateToLanguages:p.translateToLanguages=f.value;break}this.privParticipants.addOrUpdateParticipant(p),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.Updated,[this.toParticipant(p)],f.sessionId))}}catch{}},this.onLockRoomCommandReceived=()=>{},this.onMuteAllCommandReceived=(d,f)=>{try{this.privParticipants.participants.forEach(p=>p.isMuted=p.isHost?!1:f.isMuted),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.Updated,this.toParticipants(!1),f.sessionId))}catch{}},this.onParticipantJoinCommandReceived=(d,f)=>{try{const p=this.privParticipants.addOrUpdateParticipant(f.participant);p!==void 0&&this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.JoinedConversation,[this.toParticipant(p)],f.sessionId))}catch{}},this.onParticipantLeaveCommandReceived=(d,f)=>{try{const p=this.privParticipants.getParticipant(f.participant.id);p!==void 0&&(this.privParticipants.deleteParticipant(f.participant.id),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.LeftConversation,[this.toParticipant(p)],f.sessionId)))}catch{}},this.onTranslationReceived=(d,f)=>{try{switch(f.command){case e.ConversationTranslatorMessageTypes.final:this.privConversationTranslator&&this.privConversationTranslator.transcribed(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break;case e.ConversationTranslatorMessageTypes.partial:this.privConversationTranslator&&this.privConversationTranslator.transcribing(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break;case e.ConversationTranslatorMessageTypes.instantMessage:this.privConversationTranslator&&this.privConversationTranslator.textMessageReceived(this.privConversationTranslator,new n.ConversationTranslationEventArgs(f.payload,void 0,f.sessionId));break}}catch{}},this.onParticipantsListReceived=(d,f)=>{var p;try{if(f.sessionToken!==void 0&&f.sessionToken!==null&&(this.privRoom.token=f.sessionToken),this.privParticipants.participants=[...f.participants],this.privParticipants.me!==void 0&&(this.privIsReady=!0),this.privConversationTranslator&&this.privConversationTranslator.participantsChanged(this.privConversationTranslator,new n.ConversationParticipantsChangedEventArgs(n.ParticipantChangedReason.JoinedConversation,this.toParticipants(!0),f.sessionId)),this.me.isHost){const h=(p=this.privConversationTranslator)==null?void 0:p.properties.getProperty(n.PropertyId.ConversationTranslator_Name);h!==void 0&&h.length>0&&h!==this.me.displayName&&this.changeNicknameAsync(h)}}catch{}},this.onConversationExpiration=(d,f)=>{try{this.privConversationTranslator&&this.privConversationTranslator.conversationExpiration(this.privConversationTranslator,f)}catch{}},this.privIsConnected=!1,this.privIsDisposed=!1,this.privConversationId="",this.privProperties=new n.PropertyCollection,this.privManager=new e.ConversationManager,a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage])||a.setProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage],e.ConversationConnectionConfig.defaultLanguageCode),this.privLanguage=a.getProperty(n.PropertyId[n.PropertyId.SpeechServiceConnection_RecoLanguage]),this.privConversationId=l,this.privConfig=a;const u=a;r.Contracts.throwIfNull(u,"speechConfig"),this.privProperties=u.properties.clone(),this.privIsConnected=!1,this.privParticipants=new e.InternalParticipants,this.privIsReady=!1,this.privTextMessageMaxLength=1e3}get room(){return this.privRoom}get connection(){return this.privConversationRecognizer}get config(){return this.privConfig}get meetingId(){return this.privRoom?this.privRoom.roomId:this.privConversationId}get properties(){return this.privProperties}get speechRecognitionLanguage(){return this.privLanguage}get isMutedByHost(){var a,l;return(a=this.privParticipants.me)!=null&&a.isHost?!1:(l=this.privParticipants.me)==null?void 0:l.isMuted}get isConnected(){return this.privIsConnected&&this.privIsReady}get participants(){return this.toParticipants(!0)}get me(){return this.toParticipant(this.privParticipants.me)}get host(){return this.toParticipant(this.privParticipants.host)}get transcriberRecognizer(){return this.privTranscriberRecognizer}get meetingInfo(){const a=this.meetingId,l=this.participants.map(d=>({id:d.id,preferredLanguage:d.preferredLanguage,voice:d.voice})),c={};for(const d of e.ConversationConnectionConfig.transcriptionEventKeys){const f=this.properties.getProperty(d,"");f!==""&&(c[d]=f)}return{id:a,participants:l,meetingProperties:c}}get canSend(){var a;return this.privIsConnected&&!((a=this.privParticipants.me)!=null&&a.isMuted)}get canSendAsHost(){var a;return this.privIsConnected&&((a=this.privParticipants.me)==null?void 0:a.isHost)}get authorizationToken(){return this.privToken}set authorizationToken(a){r.Contracts.throwIfNullOrWhitespace(a,"authorizationToken"),this.privToken=a}createMeetingAsync(a,l){try{this.privConversationRecognizer&&this.handleError(new Error(this.privErrors.permissionDeniedStart),l),this.privManager.createOrJoin(this.privProperties,void 0,c=>{c||this.handleError(new Error(this.privErrors.permissionDeniedConnect),l),this.privRoom=c,this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}startMeetingAsync(a,l){try{this.privConversationRecognizer&&this.handleError(new Error(this.privErrors.permissionDeniedStart),l),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedConnect),this.privParticipants.meId=this.privRoom.participantId,this.privConversationRecognizer.connected=this.onConnected,this.privConversationRecognizer.disconnected=this.onDisconnected,this.privConversationRecognizer.canceled=this.onCanceled,this.privConversationRecognizer.participantUpdateCommandReceived=this.onParticipantUpdateCommandReceived,this.privConversationRecognizer.lockRoomCommandReceived=this.onLockRoomCommandReceived,this.privConversationRecognizer.muteAllCommandReceived=this.onMuteAllCommandReceived,this.privConversationRecognizer.participantJoinCommandReceived=this.onParticipantJoinCommandReceived,this.privConversationRecognizer.participantLeaveCommandReceived=this.onParticipantLeaveCommandReceived,this.privConversationRecognizer.translationReceived=this.onTranslationReceived,this.privConversationRecognizer.participantsListReceived=this.onParticipantsListReceived,this.privConversationRecognizer.conversationExpiration=this.onConversationExpiration,this.privConversationRecognizer.connect(this.privRoom.token,()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}addParticipantAsync(a,l,c){r.Contracts.throwIfNullOrUndefined(a,"Participant"),t.marshalPromiseToCallbacks(this.addParticipantImplAsync(a),l,c)}joinMeetingAsync(a,l,c,u,d){try{r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","conversationId")),r.Contracts.throwIfNullOrWhitespace(l,this.privErrors.invalidArgs.replace("{arg}","nickname")),r.Contracts.throwIfNullOrWhitespace(c,this.privErrors.invalidArgs.replace("{arg}","language")),this.privManager.createOrJoin(this.privProperties,a,f=>{r.Contracts.throwIfNullOrUndefined(f,this.privErrors.permissionDeniedConnect),this.privRoom=f,this.privConfig.authorizationToken=f.cognitiveSpeechAuthToken,u&&u(f.cognitiveSpeechAuthToken)},f=>{this.handleError(f,d)})}catch(f){this.handleError(f,d)}}deleteMeetingAsync(a,l){t.marshalPromiseToCallbacks(this.deleteMeetingImplAsync(),a,l)}async deleteMeetingImplAsync(){r.Contracts.throwIfNullOrUndefined(this.privProperties,this.privErrors.permissionDeniedConnect),r.Contracts.throwIfNullOrWhitespace(this.privRoom.token,this.privErrors.permissionDeniedConnect),await this.privManager.leave(this.privProperties,this.privRoom.token),this.dispose()}endMeetingAsync(a,l){t.marshalPromiseToCallbacks(this.endMeetingImplAsync(),a,l)}endMeetingImplAsync(){return this.close(!0)}lockMeetingAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","lock")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getLockCommand(!0),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}muteAllParticipantsAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privConversationRecognizer,this.privErrors.permissionDeniedSend),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","mute")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(!0),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}muteParticipantAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","userId")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),!this.me.isHost&&this.me.id!==a&&this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","mute")),c),this.privParticipants.getParticipantIndex(a)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteCommand(a,!0),()=>{this.handleCallback(l,c)},d=>{this.handleError(d,c)})}catch(u){this.handleError(u,c)}}removeParticipantAsync(a,l,c){try{if(r.Contracts.throwIfDisposed(this.privIsDisposed),this.privTranscriberRecognizer&&a.hasOwnProperty("id"))t.marshalPromiseToCallbacks(this.removeParticipantImplAsync(a),l,c);else{r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","remove")),c);let u="";typeof a=="string"?u=a:a.hasOwnProperty("id")?u=a.id:a.hasOwnProperty("userId")&&(u=a.userId),r.Contracts.throwIfNullOrWhitespace(u,this.privErrors.invalidArgs.replace("{arg}","userId")),this.participants.findIndex(f=>f.id===u)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getEjectCommand(u),()=>{this.handleCallback(l,c)},f=>{this.handleError(f,c)})}}catch(u){this.handleError(u,c)}}unlockMeetingAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","unlock")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getLockCommand(!1),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}unmuteAllParticipantsAsync(a,l){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSendAsHost||this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace("{command}","unmute all")),l),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(!1),()=>{this.handleCallback(a,l)},c=>{this.handleError(c,l)})}catch(c){this.handleError(c,l)}}unmuteParticipantAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","userId")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),!this.me.isHost&&this.me.id!==a&&this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace("{command}","mute")),c),this.privParticipants.getParticipantIndex(a)===-1&&this.handleError(new Error(this.privErrors.invalidParticipantRequest),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMuteCommand(a,!1),()=>{this.handleCallback(l,c)},d=>{this.handleError(d,c)})}catch(u){this.handleError(u,c)}}sendTextMessageAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","message")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),a.length>this.privTextMessageMaxLength&&this.handleError(new Error(this.privErrors.invalidArgs.replace("{arg}","message length")),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getMessageCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}setTranslatedLanguagesAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfArrayEmptyOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","languages")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}changeNicknameAsync(a,l,c){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed()),r.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","nickname")),r.Contracts.throwIfNullOrUndefined(this.privRoom,this.privErrors.permissionDeniedSend),this.canSend||this.handleError(new Error(this.privErrors.permissionDeniedSend),c),this.privConversationRecognizer&&this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(a),()=>{this.handleCallback(l,c)},u=>{this.handleError(u,c)})}catch(u){this.handleError(u,c)}}isDisposed(){return this.privIsDisposed}dispose(){this.isDisposed||(this.privIsDisposed=!0,this.config&&this.config.close(),this.privConfig=void 0,this.privLanguage=void 0,this.privProperties=void 0,this.privRoom=void 0,this.privToken=void 0,this.privManager=void 0,this.privIsConnected=!1,this.privIsReady=!1,this.privParticipants=void 0)}async connectTranscriberRecognizer(a){this.privTranscriberRecognizer&&await this.privTranscriberRecognizer.close(),await a.enforceAudioGating(),this.privTranscriberRecognizer=a,this.privTranscriberRecognizer.meeting=this}getKeepAlive(){const a=this.me?this.me.displayName:"default_nickname";return JSON.stringify({id:"0",nickname:a,participantId:this.privRoom.participantId,roomId:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.keepAlive})}addParticipantImplAsync(a){if(this.privParticipants.addOrUpdateParticipant(a)!==void 0&&this.privTranscriberRecognizer){const c=this.meetingInfo;return c.participants=[a],this.privTranscriberRecognizer.pushMeetingEvent(c,"join")}}removeParticipantImplAsync(a){this.privParticipants.deleteParticipant(a.id);const l=this.meetingInfo;return l.participants=[a],this.privTranscriberRecognizer.pushMeetingEvent(l,"leave")}async close(a){var l;try{this.privIsConnected=!1,await((l=this.privConversationRecognizer)==null?void 0:l.close()),this.privConversationRecognizer=void 0,this.privConversationTranslator&&this.privConversationTranslator.dispose()}catch(c){throw c}a&&this.dispose()}handleCallback(a,l){if(a){try{a()}catch(c){l&&l(c)}a=void 0}}handleError(a,l){if(l)if(a instanceof Error){const c=a;l(c.name+": "+c.message)}else l(a)}toParticipants(a){const l=this.privParticipants.participants.map(c=>this.toParticipant(c));return a?l:l.filter(c=>c.isHost===!1)}toParticipant(a){return new n.Participant(a.id,a.avatar,a.displayName,a.isHost,a.isMuted,a.isUsingTts,a.preferredLanguage,a.voice)}getMuteAllCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingd"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setMuteAll,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getMuteCommand(a,l){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"conversationId"),r.Contracts.throwIfNullOrWhitespace(a,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setMute,participantId:a,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:l})}getLockCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setLockState,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getEjectCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingId"),r.Contracts.throwIfNullOrWhitespace(a,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.ejectParticipant,participantId:a,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand})}getSetTranslateToLanguagesCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.setTranslateToLanguages,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getChangeNicknameCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingId"),r.Contracts.throwIfNullOrWhitespace(a,"nickname"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),JSON.stringify({command:e.ConversationTranslatorCommandTypes.changeNickname,nickname:a,participantId:this.privRoom.participantId,roomid:this.privRoom.roomId,type:e.ConversationTranslatorMessageTypes.participantCommand,value:a})}getMessageCommand(a){return r.Contracts.throwIfNullOrWhitespace(this.privRoom.roomId,"meetingId"),r.Contracts.throwIfNullOrWhitespace(this.privRoom.participantId,"participantId"),r.Contracts.throwIfNullOrWhitespace(a,"message"),JSON.stringify({participantId:this.privRoom.participantId,roomId:this.privRoom.roomId,text:a,type:e.ConversationTranslatorMessageTypes.instantMessage})}}return Is.MeetingImpl=i,Is}var yu={},_2;function BL(){if(_2)return yu;_2=1,Object.defineProperty(yu,"__esModule",{value:!0}),yu.MeetingTranscriptionCanceledEventArgs=void 0;const e=U1();class t extends e.CancellationEventArgsBase{}return yu.MeetingTranscriptionCanceledEventArgs=t,yu}var Su={},k2;function OL(){if(k2)return Su;k2=1,Object.defineProperty(Su,"__esModule",{value:!0}),Su.MeetingTranscriber=void 0;const e=ue(),t=ve(),r=Ce,n=$(),o=db();let i=class{constructor(a){this.privAudioConfig=a,this.privProperties=new n.PropertyCollection,this.privRecognizer=void 0,this.privDisposedRecognizer=!1}get speechRecognitionLanguage(){return r.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(n.PropertyId.SpeechServiceConnection_RecoLanguage)}get properties(){return this.privProperties}get internalData(){return this.privRecognizer.internalData}get connection(){return n.Connection.fromRecognizer(this.privRecognizer)}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(a){r.Contracts.throwIfNullOrWhitespace(a,"token"),this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,a)}joinMeetingAsync(a,l,c){const u=a;r.Contracts.throwIfNullOrUndefined(o.MeetingImpl,"Meeting"),this.privRecognizer=new e.TranscriberRecognizer(a.config,this.privAudioConfig),r.Contracts.throwIfNullOrUndefined(this.privRecognizer,"Recognizer"),this.privRecognizer.connectMeetingCallbacks(this),t.marshalPromiseToCallbacks(u.connectTranscriberRecognizer(this.privRecognizer),l,c)}startTranscribingAsync(a,l){this.privRecognizer.startContinuousRecognitionAsync(a,l)}stopTranscribingAsync(a,l){this.privRecognizer.stopContinuousRecognitionAsync(a,l)}leaveMeetingAsync(a,l){this.privRecognizer.disconnectCallbacks(),t.marshalPromiseToCallbacks((async()=>{})(),a,l)}close(a,l){r.Contracts.throwIfDisposed(this.privDisposedRecognizer),t.marshalPromiseToCallbacks(this.dispose(!0),a,l)}async dispose(a){this.privDisposedRecognizer||(this.privRecognizer&&(await this.privRecognizer.close(),this.privRecognizer=void 0),a&&(this.privDisposedRecognizer=!0))}};return Su.MeetingTranscriber=i,Su}var bu={},P2;function DL(){if(P2)return bu;P2=1,Object.defineProperty(bu,"__esModule",{value:!0}),bu.ConversationTranscriptionResult=void 0;const e=$();let t=class extends e.RecognitionResult{constructor(n,o,i,s,a,l,c,u,d,f,p){super(n,o,i,s,a,l,c,d,f,p),this.privSpeakerId=u}get speakerId(){return this.privSpeakerId}};return bu.ConversationTranscriptionResult=t,bu}var R2;function db(){return R2||(R2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=LR();Object.defineProperty(e,"Conversation",{enumerable:!0,get:function(){return t.Conversation}}),Object.defineProperty(e,"ConversationImpl",{enumerable:!0,get:function(){return t.ConversationImpl}});var r=$g;Object.defineProperty(e,"ConversationCommon",{enumerable:!0,get:function(){return r.ConversationCommon}});var n=TL();Object.defineProperty(e,"ConversationExpirationEventArgs",{enumerable:!0,get:function(){return n.ConversationExpirationEventArgs}});var o=EL();Object.defineProperty(e,"ConversationParticipantsChangedEventArgs",{enumerable:!0,get:function(){return o.ConversationParticipantsChangedEventArgs}});var i=wL();Object.defineProperty(e,"ConversationTranslationCanceledEventArgs",{enumerable:!0,get:function(){return i.ConversationTranslationCanceledEventArgs}});var s=_L();Object.defineProperty(e,"ConversationTranslationEventArgs",{enumerable:!0,get:function(){return s.ConversationTranslationEventArgs}});var a=kL();Object.defineProperty(e,"ConversationTranslationResult",{enumerable:!0,get:function(){return a.ConversationTranslationResult}});var l=AL();Object.defineProperty(e,"ConversationTranslator",{enumerable:!0,get:function(){return l.ConversationTranslator}});var c=IL();Object.defineProperty(e,"ConversationTranscriber",{enumerable:!0,get:function(){return c.ConversationTranscriber}});var u=xL();Object.defineProperty(e,"Participant",{enumerable:!0,get:function(){return u.Participant}}),Object.defineProperty(e,"User",{enumerable:!0,get:function(){return u.User}});var d=HR;Object.defineProperty(e,"ParticipantChangedReason",{enumerable:!0,get:function(){return d.ParticipantChangedReason}});var f=NL();Object.defineProperty(e,"Meeting",{enumerable:!0,get:function(){return f.Meeting}}),Object.defineProperty(e,"MeetingImpl",{enumerable:!0,get:function(){return f.MeetingImpl}});var p=BL();Object.defineProperty(e,"MeetingTranscriptionCanceledEventArgs",{enumerable:!0,get:function(){return p.MeetingTranscriptionCanceledEventArgs}});var h=OL();Object.defineProperty(e,"MeetingTranscriber",{enumerable:!0,get:function(){return h.MeetingTranscriber}});var v=DL();Object.defineProperty(e,"ConversationTranscriptionResult",{enumerable:!0,get:function(){return v.ConversationTranscriptionResult}})}(i0)),i0}var xs={},A2;function fb(){if(A2)return xs;A2=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.SynthesisRequest=xs.Synthesizer=void 0;const e=ue(),t=ve(),r=Ce,n=$();let o=class qR{constructor(a){const l=a;r.Contracts.throwIfNull(l,"speechConfig"),this.privProperties=l.properties.clone(),this.privDisposed=!1,this.privSynthesizing=!1,this.synthesisRequestQueue=new t.Queue}get authorizationToken(){return this.properties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(a){r.Contracts.throwIfNullOrWhitespace(a,"token"),this.properties.setProperty(n.PropertyId.SpeechServiceAuthorization_Token,a)}get properties(){return this.privProperties}get autoDetectSourceLanguage(){return this.properties.getProperty(n.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages)===e.AutoDetectSourceLanguagesOpenRangeOptionName}buildSsml(a){const l={["af-ZA"]:"af-ZA-AdriNeural",["am-ET"]:"am-ET-AmehaNeural",["ar-AE"]:"ar-AE-FatimaNeural",["ar-BH"]:"ar-BH-AliNeural",["ar-DZ"]:"ar-DZ-AminaNeural",["ar-EG"]:"ar-EG-SalmaNeural",["ar-IQ"]:"ar-IQ-BasselNeural",["ar-JO"]:"ar-JO-SanaNeural",["ar-KW"]:"ar-KW-FahedNeural",["ar-LY"]:"ar-LY-ImanNeural",["ar-MA"]:"ar-MA-JamalNeural",["ar-QA"]:"ar-QA-AmalNeural",["ar-SA"]:"ar-SA-HamedNeural",["ar-SY"]:"ar-SY-AmanyNeural",["ar-TN"]:"ar-TN-HediNeural",["ar-YE"]:"ar-YE-MaryamNeural",["bg-BG"]:"bg-BG-BorislavNeural",["bn-BD"]:"bn-BD-NabanitaNeural",["bn-IN"]:"bn-IN-BashkarNeural",["ca-ES"]:"ca-ES-JoanaNeural",["cs-CZ"]:"cs-CZ-AntoninNeural",["cy-GB"]:"cy-GB-AledNeural",["da-DK"]:"da-DK-ChristelNeural",["de-AT"]:"de-AT-IngridNeural",["de-CH"]:"de-CH-JanNeural",["de-DE"]:"de-DE-KatjaNeural",["el-GR"]:"el-GR-AthinaNeural",["en-AU"]:"en-AU-NatashaNeural",["en-CA"]:"en-CA-ClaraNeural",["en-GB"]:"en-GB-LibbyNeural",["en-HK"]:"en-HK-SamNeural",["en-IE"]:"en-IE-ConnorNeural",["en-IN"]:"en-IN-NeerjaNeural",["en-KE"]:"en-KE-AsiliaNeural",["en-NG"]:"en-NG-AbeoNeural",["en-NZ"]:"en-NZ-MitchellNeural",["en-PH"]:"en-PH-JamesNeural",["en-SG"]:"en-SG-LunaNeural",["en-TZ"]:"en-TZ-ElimuNeural",["en-US"]:"en-US-AvaMultilingualNeural",["en-ZA"]:"en-ZA-LeahNeural",["es-AR"]:"es-AR-ElenaNeural",["es-BO"]:"es-BO-MarceloNeural",["es-CL"]:"es-CL-CatalinaNeural",["es-CO"]:"es-CO-GonzaloNeural",["es-CR"]:"es-CR-JuanNeural",["es-CU"]:"es-CU-BelkysNeural",["es-DO"]:"es-DO-EmilioNeural",["es-EC"]:"es-EC-AndreaNeural",["es-ES"]:"es-ES-AlvaroNeural",["es-GQ"]:"es-GQ-JavierNeural",["es-GT"]:"es-GT-AndresNeural",["es-HN"]:"es-HN-CarlosNeural",["es-MX"]:"es-MX-DaliaNeural",["es-NI"]:"es-NI-FedericoNeural",["es-PA"]:"es-PA-MargaritaNeural",["es-PE"]:"es-PE-AlexNeural",["es-PR"]:"es-PR-KarinaNeural",["es-PY"]:"es-PY-MarioNeural",["es-SV"]:"es-SV-LorenaNeural",["es-US"]:"es-US-AlonsoNeural",["es-UY"]:"es-UY-MateoNeural",["es-VE"]:"es-VE-PaolaNeural",["et-EE"]:"et-EE-AnuNeural",["fa-IR"]:"fa-IR-DilaraNeural",["fi-FI"]:"fi-FI-SelmaNeural",["fil-PH"]:"fil-PH-AngeloNeural",["fr-BE"]:"fr-BE-CharlineNeural",["fr-CA"]:"fr-CA-SylvieNeural",["fr-CH"]:"fr-CH-ArianeNeural",["fr-FR"]:"fr-FR-DeniseNeural",["ga-IE"]:"ga-IE-ColmNeural",["gl-ES"]:"gl-ES-RoiNeural",["gu-IN"]:"gu-IN-DhwaniNeural",["he-IL"]:"he-IL-AvriNeural",["hi-IN"]:"hi-IN-MadhurNeural",["hr-HR"]:"hr-HR-GabrijelaNeural",["hu-HU"]:"hu-HU-NoemiNeural",["id-ID"]:"id-ID-ArdiNeural",["is-IS"]:"is-IS-GudrunNeural",["it-IT"]:"it-IT-IsabellaNeural",["ja-JP"]:"ja-JP-NanamiNeural",["jv-ID"]:"jv-ID-DimasNeural",["kk-KZ"]:"kk-KZ-AigulNeural",["km-KH"]:"km-KH-PisethNeural",["kn-IN"]:"kn-IN-GaganNeural",["ko-KR"]:"ko-KR-SunHiNeural",["lo-LA"]:"lo-LA-ChanthavongNeural",["lt-LT"]:"lt-LT-LeonasNeural",["lv-LV"]:"lv-LV-EveritaNeural",["mk-MK"]:"mk-MK-AleksandarNeural",["ml-IN"]:"ml-IN-MidhunNeural",["mr-IN"]:"mr-IN-AarohiNeural",["ms-MY"]:"ms-MY-OsmanNeural",["mt-MT"]:"mt-MT-GraceNeural",["my-MM"]:"my-MM-NilarNeural",["nb-NO"]:"nb-NO-PernilleNeural",["nl-BE"]:"nl-BE-ArnaudNeural",["nl-NL"]:"nl-NL-ColetteNeural",["pl-PL"]:"pl-PL-AgnieszkaNeural",["ps-AF"]:"ps-AF-GulNawazNeural",["pt-BR"]:"pt-BR-FranciscaNeural",["pt-PT"]:"pt-PT-DuarteNeural",["ro-RO"]:"ro-RO-AlinaNeural",["ru-RU"]:"ru-RU-SvetlanaNeural",["si-LK"]:"si-LK-SameeraNeural",["sk-SK"]:"sk-SK-LukasNeural",["sl-SI"]:"sl-SI-PetraNeural",["so-SO"]:"so-SO-MuuseNeural",["sr-RS"]:"sr-RS-NicholasNeural",["su-ID"]:"su-ID-JajangNeural",["sv-SE"]:"sv-SE-SofieNeural",["sw-KE"]:"sw-KE-RafikiNeural",["sw-TZ"]:"sw-TZ-DaudiNeural",["ta-IN"]:"ta-IN-PallaviNeural",["ta-LK"]:"ta-LK-KumarNeural",["ta-SG"]:"ta-SG-AnbuNeural",["te-IN"]:"te-IN-MohanNeural",["th-TH"]:"th-TH-PremwadeeNeural",["tr-TR"]:"tr-TR-AhmetNeural",["uk-UA"]:"uk-UA-OstapNeural",["ur-IN"]:"ur-IN-GulNeural",["ur-PK"]:"ur-PK-AsadNeural",["uz-UZ"]:"uz-UZ-MadinaNeural",["vi-VN"]:"vi-VN-HoaiMyNeural",["zh-CN"]:"zh-CN-XiaoxiaoNeural",["zh-HK"]:"zh-HK-HiuMaanNeural",["zh-TW"]:"zh-TW-HsiaoChenNeural",["zu-ZA"]:"zu-ZA-ThandoNeural"};let c=this.properties.getProperty(n.PropertyId.SpeechServiceConnection_SynthLanguage,"en-US"),u=this.properties.getProperty(n.PropertyId.SpeechServiceConnection_SynthVoice,""),d=qR.XMLEncode(a);return this.autoDetectSourceLanguage?c="en-US":u=u||l[c],u&&(d=`${d}`),d=`${d}`,d}async dispose(a){this.privDisposed||(a&&this.privAdapter&&await this.privAdapter.dispose(),this.privDisposed=!0)}async adapterSpeak(){if(!this.privDisposed&&!this.privSynthesizing){this.privSynthesizing=!0;const a=await this.synthesisRequestQueue.dequeue();return this.privAdapter.Speak(a.text,a.isSSML,a.requestId,a.cb,a.err,a.dataStream)}}createSynthesizerConfig(a){return new e.SynthesizerConfig(a,this.privProperties)}implCommonSynthesizeSetup(){let a=typeof window<"u"?"Browser":"Node",l="unknown",c="unknown";typeof navigator<"u"&&(a=a+"/"+navigator.platform,l=navigator.userAgent,c=navigator.appVersion);const u=this.createSynthesizerConfig(new e.SpeechServiceConfig(new e.Context(new e.OS(a,l,c)))),d=this.privProperties.getProperty(n.PropertyId.SpeechServiceConnection_Key,void 0),f=d&&d!==""?new e.CognitiveSubscriptionKeyAuthentication(d):new e.CognitiveTokenAuthentication(()=>{const p=this.privProperties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(p)},()=>{const p=this.privProperties.getProperty(n.PropertyId.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(p)});this.privAdapter=this.createSynthesisAdapter(f,this.privConnectionFactory,u),this.privRestAdapter=this.createRestSynthesisAdapter(f,u)}static XMLEncode(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}};xs.Synthesizer=o;class i{constructor(a,l,c,u,d,f){this.requestId=a,this.text=l,this.isSSML=c,this.cb=u,this.err=d,this.dataStream=f}}return xs.SynthesisRequest=i,xs}var Cu={},I2;function ML(){if(I2)return Cu;I2=1,Object.defineProperty(Cu,"__esModule",{value:!0}),Cu.SpeechSynthesizer=void 0;const e=ue(),t=ve(),r=q1,n=fs,o=ar,i=Ce,s=$(),a=fb();let l=class UR extends s.Synthesizer{constructor(u,d){super(u),d!==null&&(d===void 0?this.audioConfig=typeof window>"u"?void 0:s.AudioConfig.fromDefaultSpeakerOutput():this.audioConfig=d),this.privConnectionFactory=new e.SpeechSynthesisConnectionFactory,this.implCommonSynthesizeSetup()}static FromConfig(u,d,f){const p=u;return d.properties.mergeTo(p.properties),new UR(u,f)}speakTextAsync(u,d,f,p){this.speakImpl(u,!1,d,f,p)}speakSsmlAsync(u,d,f,p){this.speakImpl(u,!0,d,f,p)}async getVoicesAsync(u=""){return this.getVoices(u)}close(u,d){i.Contracts.throwIfDisposed(this.privDisposed),t.marshalPromiseToCallbacks(this.dispose(!0),u,d)}get internalData(){return this.privAdapter}createSynthesisAdapter(u,d,f){return new e.SpeechSynthesisAdapter(u,d,f,this,this.audioConfig)}createRestSynthesisAdapter(u,d){return new e.SynthesisRestAdapter(d,u)}implCommonSynthesizeSetup(){super.implCommonSynthesizeSetup(),this.privAdapter.audioOutputFormat=n.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(s.SpeechSynthesisOutputFormat[this.properties.getProperty(s.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0)])}speakImpl(u,d,f,p,h){try{i.Contracts.throwIfDisposed(this.privDisposed);const v=t.createNoDashGuid();let y;h instanceof s.PushAudioOutputStreamCallback?y=new o.PushAudioOutputStreamImpl(h):h instanceof s.PullAudioOutputStream?y=h:h!==void 0?y=new r.AudioFileWriter(h):y=void 0,this.synthesisRequestQueue.enqueue(new a.SynthesisRequest(v,u,d,g=>{if(this.privSynthesizing=!1,f)try{f(g)}catch(m){p&&p(m)}f=void 0,this.adapterSpeak().catch(()=>{})},g=>{p&&p(g)},y)),this.adapterSpeak().catch(()=>{})}catch(v){if(p)if(v instanceof Error){const y=v;p(y.name+": "+y.message)}else p(v);this.dispose(!0).catch(()=>{})}}async getVoices(u){const d=t.createNoDashGuid(),f=await this.privRestAdapter.getVoicesList(d);if(f.ok&&Array.isArray(f.json)){let p=f.json;return u&&u.length>0&&(p=p.filter(h=>!!h.Locale&&h.Locale.toLowerCase()===u.toLowerCase())),new s.SynthesisVoicesResult(d,p,void 0)}else return new s.SynthesisVoicesResult(d,void 0,`Error: ${f.status}: ${f.statusText}`)}};return Cu.SpeechSynthesizer=l,Cu}var Wg={};Object.defineProperty(Wg,"__esModule",{value:!0});Wg.SynthesisResult=void 0;class zL{constructor(t,r,n,o){this.privResultId=t,this.privReason=r,this.privErrorDetails=n,this.privProperties=o}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}Wg.SynthesisResult=zL;var Tu={},x2;function LL(){if(x2)return Tu;x2=1,Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.SpeechSynthesisResult=void 0;const e=$();let t=class extends e.SynthesisResult{constructor(n,o,i,s,a,l){super(n,o,s,a),this.privAudioData=i,this.privAudioDuration=l}get audioData(){return this.privAudioData}get audioDuration(){return this.privAudioDuration}};return Tu.SpeechSynthesisResult=t,Tu}var Vg={};Object.defineProperty(Vg,"__esModule",{value:!0});Vg.SpeechSynthesisEventArgs=void 0;class FL{constructor(t){this.privResult=t}get result(){return this.privResult}}Vg.SpeechSynthesisEventArgs=FL;var Kg={};Object.defineProperty(Kg,"__esModule",{value:!0});Kg.SpeechSynthesisWordBoundaryEventArgs=void 0;class jL{constructor(t,r,n,o,i,s){this.privAudioOffset=t,this.privDuration=r,this.privText=n,this.privWordLength=o,this.privTextOffset=i,this.privBoundaryType=s}get audioOffset(){return this.privAudioOffset}get duration(){return this.privDuration}get text(){return this.privText}get wordLength(){return this.privWordLength}get textOffset(){return this.privTextOffset}get boundaryType(){return this.privBoundaryType}}Kg.SpeechSynthesisWordBoundaryEventArgs=jL;var Gg={};Object.defineProperty(Gg,"__esModule",{value:!0});Gg.SpeechSynthesisBookmarkEventArgs=void 0;class HL{constructor(t,r){this.privAudioOffset=t,this.privText=r}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}Gg.SpeechSynthesisBookmarkEventArgs=HL;var Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});Qg.SpeechSynthesisVisemeEventArgs=void 0;class qL{constructor(t,r,n){this.privAudioOffset=t,this.privVisemeId=r,this.privAnimation=n}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}Qg.SpeechSynthesisVisemeEventArgs=qL;var $R={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SpeechSynthesisBoundaryType=void 0,function(t){t.Word="WordBoundary",t.Punctuation="PunctuationBoundary",t.Sentence="SentenceBoundary"}(e.SpeechSynthesisBoundaryType||(e.SpeechSynthesisBoundaryType={}))})($R);var Eu={},N2;function UL(){if(N2)return Eu;N2=1,Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.SynthesisVoicesResult=void 0;const e=$();let t=class extends e.SynthesisResult{constructor(n,o,i){if(Array.isArray(o)){super(n,e.ResultReason.VoicesListRetrieved,void 0,new e.PropertyCollection),this.privVoices=[];for(const s of o)this.privVoices.push(new e.VoiceInfo(s))}else super(n,e.ResultReason.Canceled,i||"Error information unavailable",new e.PropertyCollection)}get voices(){return this.privVoices}};return Eu.SynthesisVoicesResult=t,Eu}var WR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInfo=e.SynthesisVoiceType=e.SynthesisVoiceGender=void 0;var t;(function(i){i[i.Unknown=0]="Unknown",i[i.Female=1]="Female",i[i.Male=2]="Male",i[i.Neutral=3]="Neutral"})(t=e.SynthesisVoiceGender||(e.SynthesisVoiceGender={}));var r;(function(i){i[i.OnlineNeural=1]="OnlineNeural",i[i.OnlineStandard=2]="OnlineStandard",i[i.OfflineNeural=3]="OfflineNeural",i[i.OfflineStandard=4]="OfflineStandard"})(r=e.SynthesisVoiceType||(e.SynthesisVoiceType={}));const n={[t[t.Neutral]]:t.Neutral,[t[t.Male]]:t.Male,[t[t.Female]]:t.Female};class o{constructor(s){if(this.privStyleList=[],s){if(this.privName=s.Name,this.privLocale=s.Locale,this.privShortName=s.ShortName,this.privLocaleName=s.LocaleName,this.privDisplayName=s.DisplayName,this.privLocalName=s.LocalName,this.privVoiceType=s.VoiceType.endsWith("Standard")?r.OnlineStandard:r.OnlineNeural,this.privGender=n[s.Gender]||t.Unknown,s.StyleList&&Array.isArray(s.StyleList))for(const a of s.StyleList)this.privStyleList.push(a);this.privSampleRateHertz=s.SampleRateHertz,this.privStatus=s.Status,s.ExtendedPropertyMap&&(this.privExtendedPropertyMap=s.ExtendedPropertyMap),this.privWordsPerMinute=s.WordsPerMinute,Array.isArray(s.SecondaryLocaleList)&&(this.privSecondaryLocaleList=[...s.SecondaryLocaleList]),Array.isArray(s.RolePlayList)&&(this.privRolePlayList=[...s.RolePlayList])}}get name(){return this.privName}get locale(){return this.privLocale}get shortName(){return this.privShortName}get displayName(){return this.privDisplayName}get localName(){return this.privLocalName}get localeName(){return this.privLocaleName}get gender(){return this.privGender}get voiceType(){return this.privVoiceType}get styleList(){return this.privStyleList}get sampleRateHertz(){return this.privSampleRateHertz}get status(){return this.privStatus}get extendedPropertyMap(){return this.privExtendedPropertyMap}get wordsPerMinute(){return this.privWordsPerMinute}get secondaryLocaleList(){return this.privSecondaryLocaleList}get rolePlayList(){return this.privRolePlayList}}e.VoiceInfo=o})(WR);var Xg={};Object.defineProperty(Xg,"__esModule",{value:!0});Xg.SpeakerAudioDestination=void 0;const Ns=ve(),$L=ar,$r=ds,WL=60*30,B2={[$r.AudioFormatTag.PCM]:"audio/wav",[$r.AudioFormatTag.MuLaw]:"audio/x-wav",[$r.AudioFormatTag.MP3]:"audio/mpeg",[$r.AudioFormatTag.OGG_OPUS]:"audio/ogg",[$r.AudioFormatTag.WEBM_OPUS]:"audio/webm; codecs=opus",[$r.AudioFormatTag.ALaw]:"audio/x-wav",[$r.AudioFormatTag.FLAC]:"audio/flac",[$r.AudioFormatTag.AMR_WB]:"audio/amr-wb",[$r.AudioFormatTag.G722]:"audio/G722"};class VL{constructor(t){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=t||Ns.createNoDashGuid(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(t,r,n){this.privAudioBuffer!==void 0?(this.privAudioBuffer.push(t),this.updateSourceBuffer().then(()=>{r&&r()},o=>{n&&n(o)})):this.privAudioOutputStream!==void 0&&(this.privAudioOutputStream.write(t),this.privBytesReceived+=t.byteLength)}close(t,r){if(this.privIsClosed=!0,this.privSourceBuffer!==void 0)this.handleSourceBufferUpdateEnd().then(()=>{t&&t()},n=>{r&&r(n)});else if(this.privAudioOutputStream!==void 0&&typeof window<"u")if((this.privFormat.formatTag===$r.AudioFormatTag.PCM||this.privFormat.formatTag===$r.AudioFormatTag.MuLaw||this.privFormat.formatTag===$r.AudioFormatTag.ALaw)&&this.privFormat.hasHeader===!1)console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else{let n=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(n).then(()=>{n=this.privFormat.addHeader(n);const o=new Blob([n],{type:B2[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(o),this.notifyPlayback().then(()=>{t&&t()},i=>{r&&r(i)})},o=>{r&&r(o)})}else this.onAudioEnd&&this.onAudioEnd(this)}set format(t){if(typeof AudioContext<"u"||typeof window<"u"&&typeof window.webkitAudioContext<"u"){this.privFormat=t;const r=B2[this.privFormat.formatTag];r===void 0?console.warn(`Unknown mimeType for format ${$r.AudioFormatTag[this.privFormat.formatTag]}; playback is not supported.`):typeof MediaSource<"u"&&MediaSource.isTypeSupported(r)?(this.privAudio=new Audio,this.privAudioBuffer=[],this.privMediaSource=new MediaSource,this.privAudio.src=URL.createObjectURL(this.privMediaSource),this.privAudio.load(),this.privMediaSource.onsourceopen=()=>{this.privMediaSourceOpened=!0,this.privMediaSource.duration=WL,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(r),this.privSourceBuffer.onupdate=()=>{this.updateSourceBuffer().catch(n=>{Ns.Events.instance.onEvent(new Ns.BackgroundEvent(n))})},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch(n=>{Ns.Events.instance.onEvent(new Ns.BackgroundEvent(n))})},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch(n=>{Ns.Events.instance.onEvent(new Ns.BackgroundEvent(n))})):(console.warn(`Format ${$r.AudioFormatTag[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new $L.PullAudioOutputStreamImpl,this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){var t;return((t=this.privAudio)==null?void 0:t.volume)??-1}set volume(t){this.privAudio&&(this.privAudio.volume=t)}mute(){this.privAudio&&(this.privAudio.muted=!0)}unmute(){this.privAudio&&(this.privAudio.muted=!1)}get isClosed(){return this.privIsClosed}get currentTime(){return this.privAudio!==void 0?this.privAudio.currentTime:-1}pause(){!this.privIsPaused&&this.privAudio!==void 0&&(this.privAudio.pause(),this.privIsPaused=!0)}resume(t,r){this.privIsPaused&&this.privAudio!==void 0&&(this.privAudio.play().then(()=>{t&&t()},n=>{r&&r(n)}),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}async updateSourceBuffer(){if(this.privAudioBuffer!==void 0&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const t=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(t)}catch{this.privAudioBuffer.unshift(t),console.log("buffer filled, pausing addition of binaries until space is made");return}await this.notifyPlayback()}else this.canEndStream()&&await this.handleSourceBufferUpdateEnd()}async handleSourceBufferUpdateEnd(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),await this.notifyPlayback())}async notifyPlayback(){!this.privPlaybackStarted&&this.privAudio!==void 0&&(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||await this.privAudio.play())}canEndStream(){return this.isClosed&&this.privSourceBuffer!==void 0&&this.privAudioBuffer.length===0&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&this.privMediaSource.readyState==="open"}sourceBufferAvailable(){return this.privSourceBuffer!==void 0&&!this.privSourceBuffer.updating}}Xg.SpeakerAudioDestination=VL;var wu={},O2;function KL(){if(O2)return wu;O2=1,Object.defineProperty(wu,"__esModule",{value:!0}),wu.ConversationTranscriptionCanceledEventArgs=void 0;const e=U1();let t=class extends e.CancellationEventArgsBase{};return wu.ConversationTranscriptionCanceledEventArgs=t,wu}var _u={},D2;function GL(){if(D2)return _u;D2=1,Object.defineProperty(_u,"__esModule",{value:!0}),_u.MeetingTranscriptionCanceledEventArgs=void 0;const e=U1();let t=class extends e.CancellationEventArgsBase{};return _u.MeetingTranscriptionCanceledEventArgs=t,_u}var VR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PronunciationAssessmentGradingSystem=void 0,function(t){t[t.FivePoint=1]="FivePoint",t[t.HundredMark=2]="HundredMark"}(e.PronunciationAssessmentGradingSystem||(e.PronunciationAssessmentGradingSystem={}))})(VR);var KR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PronunciationAssessmentGranularity=void 0,function(t){t[t.Phoneme=1]="Phoneme",t[t.Word=2]="Word",t[t.FullText=3]="FullText"}(e.PronunciationAssessmentGranularity||(e.PronunciationAssessmentGranularity={}))})(KR);var ku={},M2;function QL(){if(M2)return ku;M2=1,Object.defineProperty(ku,"__esModule",{value:!0}),ku.PronunciationAssessmentConfig=void 0;const e=Ce,t=$();let r=class GR{constructor(o,i=t.PronunciationAssessmentGradingSystem.FivePoint,s=t.PronunciationAssessmentGranularity.Phoneme,a=!1){e.Contracts.throwIfNullOrUndefined(o,"referenceText"),this.privProperties=new t.PropertyCollection,this.privProperties.setProperty(t.PropertyId.PronunciationAssessment_ReferenceText,o),this.privProperties.setProperty(t.PropertyId.PronunciationAssessment_GradingSystem,t.PronunciationAssessmentGradingSystem[i]),this.privProperties.setProperty(t.PropertyId.PronunciationAssessment_Granularity,t.PronunciationAssessmentGranularity[s]),this.privProperties.setProperty(t.PropertyId.PronunciationAssessment_EnableMiscue,String(a))}static fromJSON(o){e.Contracts.throwIfNullOrUndefined(o,"json");const i=new GR("");return i.privProperties=new t.PropertyCollection,i.properties.setProperty(t.PropertyId.PronunciationAssessment_Json,o),i}toJSON(){return this.updateJson(),this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_Params)}applyTo(o){this.updateJson();const i=o.internalData;i.expectContentAssessmentResponse=!!this.privContentAssessmentTopic,i.speechContext.setPronunciationAssessmentParams(this.properties.getProperty(t.PropertyId.PronunciationAssessment_Params),this.privContentAssessmentTopic,i.isSpeakerDiarizationEnabled)}get referenceText(){return this.properties.getProperty(t.PropertyId.PronunciationAssessment_ReferenceText)}set referenceText(o){e.Contracts.throwIfNullOrWhitespace(o,"referenceText"),this.properties.setProperty(t.PropertyId.PronunciationAssessment_ReferenceText,o)}set phonemeAlphabet(o){e.Contracts.throwIfNullOrWhitespace(o,"phonemeAlphabet"),this.privPhonemeAlphabet=o}set enableMiscue(o){const i=o?"true":"false";this.properties.setProperty(t.PropertyId.PronunciationAssessment_EnableMiscue,i)}get enableMiscue(){return this.properties.getProperty(t.PropertyId.PronunciationAssessment_EnableMiscue,"false").toLowerCase()==="true"}set nbestPhonemeCount(o){this.privNBestPhonemeCount=o}set enableProsodyAssessment(o){this.privEnableProsodyAssessment=o}enableContentAssessmentWithTopic(o){this.privContentAssessmentTopic=o}get properties(){return this.privProperties}updateJson(){const o=this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_Json,"{}"),i=JSON.parse(o),s=this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_ReferenceText);s&&(i.referenceText=s);const a=this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_GradingSystem);a&&(i.gradingSystem=a);const l=this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_Granularity);l&&(i.granularity=l),this.privPhonemeAlphabet&&(i.phonemeAlphabet=this.privPhonemeAlphabet),this.privNBestPhonemeCount&&(i.nbestPhonemeCount=this.privNBestPhonemeCount),i.enableProsodyAssessment=this.privEnableProsodyAssessment,i.dimension="Comprehensive",this.privProperties.getProperty(t.PropertyId.PronunciationAssessment_EnableMiscue)&&(i.enableMiscue=this.enableMiscue),this.privProperties.setProperty(t.PropertyId.PronunciationAssessment_Params,JSON.stringify(i))}};return ku.PronunciationAssessmentConfig=r,ku}var Bs={},z2;function XL(){if(z2)return Bs;z2=1,Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.PronunciationAssessmentResult=Bs.ContentAssessmentResult=void 0;const e=Ce,t=$();class r{constructor(i){this.privPronJson=i}get grammarScore(){return this.privPronJson.ContentAssessment.GrammarScore}get vocabularyScore(){return this.privPronJson.ContentAssessment.VocabularyScore}get topicScore(){return this.privPronJson.ContentAssessment.TopicScore}}Bs.ContentAssessmentResult=r;let n=class QR{constructor(i){const s=JSON.parse(i);e.Contracts.throwIfNullOrUndefined(s.NBest[0],"NBest"),this.privPronJson=s.NBest[0]}static fromResult(i){e.Contracts.throwIfNullOrUndefined(i,"result");const s=i.properties.getProperty(t.PropertyId.SpeechServiceResponse_JsonResult);return e.Contracts.throwIfNullOrUndefined(s,"json"),new QR(s)}get detailResult(){return this.privPronJson}get accuracyScore(){var i;return(i=this.detailResult.PronunciationAssessment)==null?void 0:i.AccuracyScore}get pronunciationScore(){var i;return(i=this.detailResult.PronunciationAssessment)==null?void 0:i.PronScore}get completenessScore(){var i;return(i=this.detailResult.PronunciationAssessment)==null?void 0:i.CompletenessScore}get fluencyScore(){var i;return(i=this.detailResult.PronunciationAssessment)==null?void 0:i.FluencyScore}get prosodyScore(){var i;return(i=this.detailResult.PronunciationAssessment)==null?void 0:i.ProsodyScore}get contentAssessmentResult(){if(this.detailResult.ContentAssessment!==void 0)return new r(this.detailResult)}};return Bs.PronunciationAssessmentResult=n,Bs}var Pu={},L2;function YL(){if(L2)return Pu;L2=1,Object.defineProperty(Pu,"__esModule",{value:!0}),Pu.AvatarConfig=void 0;const e=Ce,t=$();let r=class{constructor(o,i,s){this.privCustomized=!1,e.Contracts.throwIfNullOrWhitespace(o,"character"),this.character=o,this.style=i,s===void 0&&(s=new t.AvatarVideoFormat),this.videoFormat=s}get customized(){return this.privCustomized}set customized(o){this.privCustomized=o}get backgroundColor(){return this.privBackgroundColor}set backgroundColor(o){this.privBackgroundColor=o}get backgroundImage(){return this.privBackgroundImage}set backgroundImage(o){this.privBackgroundImage=o}get remoteIceServers(){return this.privRemoteIceServers}set remoteIceServers(o){this.privRemoteIceServers=o}};return Pu.AvatarConfig=r,Pu}var XR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AvatarEventArgs=e.AvatarEventTypes=void 0,function(r){r.SwitchedToSpeaking="SwitchedToSpeaking",r.SwitchedToIdle="SwitchedToIdle",r.SessionClosed="SessionClosed"}(e.AvatarEventTypes||(e.AvatarEventTypes={}));class t{constructor(n,o){this.privOffset=n,this.privDescription=o}get type(){return this.privType}get offset(){return this.privOffset}get description(){return this.privDescription}}e.AvatarEventArgs=t})(XR);var Ru={},Au={},F2;function YR(){if(F2)return Au;F2=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.SpeechSynthesisConnectionFactory=void 0;const e=Jt(),t=$(),r=ao(),n=ue(),o=Yt,i=so;let s=class{constructor(){this.synthesisUri="/cognitiveservices/websocket/v1"}create(l,c,u){let d=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint,void 0);const f=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Region,void 0),p=r.ConnectionFactoryBase.getHostSuffix(f),h=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_EndpointId,void 0),v=h===void 0?"tts":"voice",y=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,"wss://"+f+"."+v+".speech"+p),g={},m={};c.token!==void 0&&c.token!==""&&(m[c.headerName]=c.token),m[o.HeaderNames.ConnectionId]=u,h!==void 0&&h!==""&&(!d||d.search(i.QueryParameterNames.CustomVoiceDeploymentId)===-1)&&(g[i.QueryParameterNames.CustomVoiceDeploymentId]=h),l.avatarEnabled&&(!d||d.search(i.QueryParameterNames.EnableAvatar)===-1)&&(g[i.QueryParameterNames.EnableAvatar]="true"),d||(d=y+this.synthesisUri),l.parameters.setProperty(t.PropertyId.SpeechServiceConnection_Url,d);const b=l.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(d,g,m,new n.WebsocketMessageFormatter,e.ProxyInfo.fromParameters(l.parameters),b,u)}};return Au.SpeechSynthesisConnectionFactory=s,Au}var j2;function JL(){if(j2)return Ru;j2=1,Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.AvatarSynthesizer=void 0;const e=YR(),t=ue(),r=ve(),n=fs,o=$(),i=Ce,s=fb();let a=class extends o.Synthesizer{constructor(c,u){super(c),i.Contracts.throwIfNullOrUndefined(u,"avatarConfig"),this.privConnectionFactory=new e.SpeechSynthesisConnectionFactory,this.privAvatarConfig=u,this.implCommonSynthesizeSetup()}implCommonSynthesizeSetup(){super.implCommonSynthesizeSetup(),this.privAdapter.audioOutputFormat=n.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(o.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm)}async startAvatarAsync(c){i.Contracts.throwIfNullOrUndefined(c,"peerConnection"),this.privIceServers=c.getConfiguration().iceServers,i.Contracts.throwIfNullOrUndefined(this.privIceServers,"Ice servers must be set.");const u=new r.Deferred;c.onicegatheringstatechange=()=>{r.Events.instance.onEvent(new r.PlatformEvent("peer connection: ice gathering state: "+c.iceGatheringState,r.EventType.Debug)),c.iceGatheringState==="complete"&&(r.Events.instance.onEvent(new r.PlatformEvent("peer connection: ice gathering complete.",r.EventType.Info)),u.resolve())},c.onicecandidate=v=>{v.candidate?r.Events.instance.onEvent(new r.PlatformEvent("peer connection: ice candidate: "+v.candidate.candidate,r.EventType.Debug)):(r.Events.instance.onEvent(new r.PlatformEvent("peer connection: ice candidate: complete",r.EventType.Debug)),u.resolve())},setTimeout(()=>{c.iceGatheringState!=="complete"&&(r.Events.instance.onEvent(new r.PlatformEvent("peer connection: ice gathering timeout.",r.EventType.Warning)),u.resolve())},2e3);const d=await c.createOffer();await c.setLocalDescription(d),await u.promise,r.Events.instance.onEvent(new r.PlatformEvent("peer connection: got local SDP.",r.EventType.Info)),this.privProperties.setProperty(o.PropertyId.TalkingAvatarService_WebRTC_SDP,JSON.stringify(c.localDescription));const f=await this.speak("",!1);if(f.reason!==o.ResultReason.SynthesizingAudioCompleted)return new o.SynthesisResult(f.resultId,f.reason,f.errorDetails,f.properties);const p=atob(f.properties.getProperty(o.PropertyId.TalkingAvatarService_WebRTC_SDP)),h=new RTCSessionDescription(JSON.parse(p));return await c.setRemoteDescription(h),new o.SynthesisResult(f.resultId,f.reason,void 0,f.properties)}async speakTextAsync(c){const u=await this.speak(c,!1);return new o.SynthesisResult(u.resultId,u.reason,u.errorDetails,u.properties)}async speakSsmlAsync(c){const u=await this.speak(c,!0);return new o.SynthesisResult(u.resultId,u.reason,u.errorDetails,u.properties)}async stopSpeakingAsync(){for(;this.synthesisRequestQueue.length()>0;)(await this.synthesisRequestQueue.dequeue()).err("Synthesis is canceled by user.");return this.privAdapter.stopSpeaking()}async stopAvatarAsync(){return i.Contracts.throwIfDisposed(this.privDisposed),this.dispose(!0)}async close(){if(!this.privDisposed)return this.dispose(!0)}get iceServers(){return this.privIceServers}createSynthesisAdapter(c,u,d){return new t.AvatarSynthesisAdapter(c,u,d,this,this.privAvatarConfig)}createRestSynthesisAdapter(c,u){}createSynthesizerConfig(c){const u=super.createSynthesizerConfig(c);return u.avatarEnabled=!0,u}async speak(c,u){const d=r.createNoDashGuid(),f=new r.Deferred;return this.synthesisRequestQueue.enqueue(new s.SynthesisRequest(d,c,u,p=>{f.resolve(p),this.privSynthesizing=!1,this.adapterSpeak()},p=>{f.reject(p),this.privSynthesizing=!1})),this.adapterSpeak(),f.promise}};return Ru.AvatarSynthesizer=a,Ru}var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});Ll.AvatarVideoFormat=Ll.Coordinate=void 0;class ZL{constructor(t,r){this.x=t,this.y=r}}Ll.Coordinate=ZL;class eF{constructor(t="H264",r=2e6,n=1920,o=1080){this.codec=t,this.bitrate=r,this.width=n,this.height=o}setCropRange(t,r){this.cropRange={bottomRight:r,topLeft:t}}}Ll.AvatarVideoFormat=eF;var Iu={},H2;function tF(){if(H2)return Iu;H2=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.AvatarWebRTCConnectionResult=void 0;const e=$();let t=class extends e.SynthesisResult{constructor(n,o,i,s,a){super(o,i,s,a),this.privSDPAnswer=n}get SDPAnswer(){return this.privSDPAnswer}};return Iu.AvatarWebRTCConnectionResult=t,Iu}var xu={},q2;function rF(){if(q2)return xu;q2=1,Object.defineProperty(xu,"__esModule",{value:!0}),xu.Diagnostics=void 0;const e=Jt(),t=ve();let r=class{static SetLoggingLevel(o){this.privListener=new e.ConsoleLoggingListener(o),t.Events.instance.attachConsoleListener(this.privListener)}static StartConsoleOutput(){this.privListener&&(this.privListener.enableConsoleOutput=!0)}static StopConsoleOutput(){this.privListener&&(this.privListener.enableConsoleOutput=!1)}static SetLogOutputPath(o){if(typeof window>"u")this.privListener&&(this.privListener.logPath=o);else throw new Error("File system logging not available in browser.")}static set onLogOutput(o){this.privListener&&(this.privListener.logCallback=o)}};return xu.Diagnostics=r,r.privListener=void 0,xu}var U2;function $(){return U2||(U2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=gR();Object.defineProperty(e,"AudioConfig",{enumerable:!0,get:function(){return t.AudioConfig}});var r=ds;Object.defineProperty(e,"AudioStreamFormat",{enumerable:!0,get:function(){return r.AudioStreamFormat}}),Object.defineProperty(e,"AudioFormatTag",{enumerable:!0,get:function(){return r.AudioFormatTag}});var n=uR();Object.defineProperty(e,"AudioInputStream",{enumerable:!0,get:function(){return n.AudioInputStream}}),Object.defineProperty(e,"PullAudioInputStream",{enumerable:!0,get:function(){return n.PullAudioInputStream}}),Object.defineProperty(e,"PushAudioInputStream",{enumerable:!0,get:function(){return n.PushAudioInputStream}});var o=ar;Object.defineProperty(e,"AudioOutputStream",{enumerable:!0,get:function(){return o.AudioOutputStream}}),Object.defineProperty(e,"PullAudioOutputStream",{enumerable:!0,get:function(){return o.PullAudioOutputStream}}),Object.defineProperty(e,"PushAudioOutputStream",{enumerable:!0,get:function(){return o.PushAudioOutputStream}});var i=vR;Object.defineProperty(e,"CancellationReason",{enumerable:!0,get:function(){return i.CancellationReason}});var s=Rg;Object.defineProperty(e,"PullAudioInputStreamCallback",{enumerable:!0,get:function(){return s.PullAudioInputStreamCallback}});var a=Ag;Object.defineProperty(e,"PushAudioOutputStreamCallback",{enumerable:!0,get:function(){return a.PushAudioOutputStreamCallback}});var l=Ig;Object.defineProperty(e,"KeywordRecognitionModel",{enumerable:!0,get:function(){return l.KeywordRecognitionModel}});var c=xg;Object.defineProperty(e,"SessionEventArgs",{enumerable:!0,get:function(){return c.SessionEventArgs}});var u=xz();Object.defineProperty(e,"RecognitionEventArgs",{enumerable:!0,get:function(){return u.RecognitionEventArgs}});var d=mR;Object.defineProperty(e,"OutputFormat",{enumerable:!0,get:function(){return d.OutputFormat}});var f=Nz();Object.defineProperty(e,"IntentRecognitionEventArgs",{enumerable:!0,get:function(){return f.IntentRecognitionEventArgs}});var p=Ng;Object.defineProperty(e,"RecognitionResult",{enumerable:!0,get:function(){return p.RecognitionResult}});var h=Oz();Object.defineProperty(e,"SpeechRecognitionResult",{enumerable:!0,get:function(){return h.SpeechRecognitionResult}});var v=Dz();Object.defineProperty(e,"IntentRecognitionResult",{enumerable:!0,get:function(){return v.IntentRecognitionResult}});var y=zl;Object.defineProperty(e,"LanguageUnderstandingModel",{enumerable:!0,get:function(){return y.LanguageUnderstandingModel}});var g=Mz();Object.defineProperty(e,"SpeechRecognitionEventArgs",{enumerable:!0,get:function(){return g.SpeechRecognitionEventArgs}}),Object.defineProperty(e,"ConversationTranscriptionEventArgs",{enumerable:!0,get:function(){return g.ConversationTranscriptionEventArgs}}),Object.defineProperty(e,"MeetingTranscriptionEventArgs",{enumerable:!0,get:function(){return g.MeetingTranscriptionEventArgs}});var m=zz();Object.defineProperty(e,"SpeechRecognitionCanceledEventArgs",{enumerable:!0,get:function(){return m.SpeechRecognitionCanceledEventArgs}});var b=Lz();Object.defineProperty(e,"TranslationRecognitionEventArgs",{enumerable:!0,get:function(){return b.TranslationRecognitionEventArgs}});var C=Fz();Object.defineProperty(e,"TranslationSynthesisEventArgs",{enumerable:!0,get:function(){return C.TranslationSynthesisEventArgs}});var k=bR();Object.defineProperty(e,"TranslationRecognitionResult",{enumerable:!0,get:function(){return k.TranslationRecognitionResult}});var E=Bg;Object.defineProperty(e,"TranslationSynthesisResult",{enumerable:!0,get:function(){return E.TranslationSynthesisResult}});var w=CR;Object.defineProperty(e,"ResultReason",{enumerable:!0,get:function(){return w.ResultReason}});var A=Hz();Object.defineProperty(e,"SpeechConfig",{enumerable:!0,get:function(){return A.SpeechConfig}}),Object.defineProperty(e,"SpeechConfigImpl",{enumerable:!0,get:function(){return A.SpeechConfigImpl}});var D=qz();Object.defineProperty(e,"SpeechTranslationConfig",{enumerable:!0,get:function(){return D.SpeechTranslationConfig}}),Object.defineProperty(e,"SpeechTranslationConfigImpl",{enumerable:!0,get:function(){return D.SpeechTranslationConfigImpl}});var I=ER();Object.defineProperty(e,"PropertyCollection",{enumerable:!0,get:function(){return I.PropertyCollection}});var M=Og;Object.defineProperty(e,"PropertyId",{enumerable:!0,get:function(){return M.PropertyId}});var B=Uz();Object.defineProperty(e,"Recognizer",{enumerable:!0,get:function(){return B.Recognizer}});var F=$z();Object.defineProperty(e,"SpeechRecognizer",{enumerable:!0,get:function(){return F.SpeechRecognizer}});var se=Wz();Object.defineProperty(e,"IntentRecognizer",{enumerable:!0,get:function(){return se.IntentRecognizer}});var pe=kR;Object.defineProperty(e,"VoiceProfileType",{enumerable:!0,get:function(){return pe.VoiceProfileType}});var te=Vz();Object.defineProperty(e,"TranslationRecognizer",{enumerable:!0,get:function(){return te.TranslationRecognizer}});var we=Kz();Object.defineProperty(e,"Translations",{enumerable:!0,get:function(){return we.Translations}});var H=IR;Object.defineProperty(e,"NoMatchReason",{enumerable:!0,get:function(){return H.NoMatchReason}});var Y=Gz();Object.defineProperty(e,"NoMatchDetails",{enumerable:!0,get:function(){return Y.NoMatchDetails}});var z=Dg;Object.defineProperty(e,"TranslationRecognitionCanceledEventArgs",{enumerable:!0,get:function(){return z.TranslationRecognitionCanceledEventArgs}});var _=Xz();Object.defineProperty(e,"IntentRecognitionCanceledEventArgs",{enumerable:!0,get:function(){return _.IntentRecognitionCanceledEventArgs}});var P=$1;Object.defineProperty(e,"CancellationDetailsBase",{enumerable:!0,get:function(){return P.CancellationDetailsBase}});var ee=Jz();Object.defineProperty(e,"CancellationDetails",{enumerable:!0,get:function(){return ee.CancellationDetails}});var J=BR;Object.defineProperty(e,"CancellationErrorCode",{enumerable:!0,get:function(){return J.CancellationErrorCode}});var ke=Zz();Object.defineProperty(e,"ConnectionEventArgs",{enumerable:!0,get:function(){return ke.ConnectionEventArgs}});var be=eL();Object.defineProperty(e,"ServiceEventArgs",{enumerable:!0,get:function(){return be.ServiceEventArgs}});var re=RR();Object.defineProperty(e,"Connection",{enumerable:!0,get:function(){return re.Connection}});var Te=Mg;Object.defineProperty(e,"PhraseListGrammar",{enumerable:!0,get:function(){return Te.PhraseListGrammar}});var dt=ab();Object.defineProperty(e,"DialogServiceConfig",{enumerable:!0,get:function(){return dt.DialogServiceConfig}});var pr=tL();Object.defineProperty(e,"BotFrameworkConfig",{enumerable:!0,get:function(){return pr.BotFrameworkConfig}});var jr=rL();Object.defineProperty(e,"CustomCommandsConfig",{enumerable:!0,get:function(){return jr.CustomCommandsConfig}});var gr=oL();Object.defineProperty(e,"DialogServiceConnector",{enumerable:!0,get:function(){return gr.DialogServiceConnector}});var Tn=zg;Object.defineProperty(e,"ActivityReceivedEventArgs",{enumerable:!0,get:function(){return Tn.ActivityReceivedEventArgs}});var Un=Lg;Object.defineProperty(e,"TurnStatusReceivedEventArgs",{enumerable:!0,get:function(){return Un.TurnStatusReceivedEventArgs}});var ho=OR;Object.defineProperty(e,"ServicePropertyChannel",{enumerable:!0,get:function(){return ho.ServicePropertyChannel}});var Do=DR;Object.defineProperty(e,"ProfanityOption",{enumerable:!0,get:function(){return Do.ProfanityOption}});var vs=lL();Object.defineProperty(e,"BaseAudioPlayer",{enumerable:!0,get:function(){return vs.BaseAudioPlayer}});var ms=jg;Object.defineProperty(e,"ConnectionMessageEventArgs",{enumerable:!0,get:function(){return ms.ConnectionMessageEventArgs}});var Ma=PR();Object.defineProperty(e,"ConnectionMessage",{enumerable:!0,get:function(){return Ma.ConnectionMessage}});var ys=Hg;Object.defineProperty(e,"VoiceProfile",{enumerable:!0,get:function(){return ys.VoiceProfile}});var Ci=dL();Object.defineProperty(e,"VoiceProfileEnrollmentResult",{enumerable:!0,get:function(){return Ci.VoiceProfileEnrollmentResult}}),Object.defineProperty(e,"VoiceProfileEnrollmentCancellationDetails",{enumerable:!0,get:function(){return Ci.VoiceProfileEnrollmentCancellationDetails}});var Ss=fL();Object.defineProperty(e,"VoiceProfileResult",{enumerable:!0,get:function(){return Ss.VoiceProfileResult}}),Object.defineProperty(e,"VoiceProfileCancellationDetails",{enumerable:!0,get:function(){return Ss.VoiceProfileCancellationDetails}});var za=hL();Object.defineProperty(e,"VoiceProfilePhraseResult",{enumerable:!0,get:function(){return za.VoiceProfilePhraseResult}});var La=pL();Object.defineProperty(e,"VoiceProfileClient",{enumerable:!0,get:function(){return La.VoiceProfileClient}});var Fa=gL();Object.defineProperty(e,"SpeakerRecognizer",{enumerable:!0,get:function(){return Fa.SpeakerRecognizer}});var ja=vL();Object.defineProperty(e,"SpeakerIdentificationModel",{enumerable:!0,get:function(){return ja.SpeakerIdentificationModel}});var L=mL();Object.defineProperty(e,"SpeakerVerificationModel",{enumerable:!0,get:function(){return L.SpeakerVerificationModel}});var G=yL();Object.defineProperty(e,"AutoDetectSourceLanguageConfig",{enumerable:!0,get:function(){return G.AutoDetectSourceLanguageConfig}});var ge=qg;Object.defineProperty(e,"AutoDetectSourceLanguageResult",{enumerable:!0,get:function(){return ge.AutoDetectSourceLanguageResult}});var U=Ug;Object.defineProperty(e,"SourceLanguageConfig",{enumerable:!0,get:function(){return U.SourceLanguageConfig}});var ne=bL();Object.defineProperty(e,"SpeakerRecognitionResult",{enumerable:!0,get:function(){return ne.SpeakerRecognitionResult}}),Object.defineProperty(e,"SpeakerRecognitionResultType",{enumerable:!0,get:function(){return ne.SpeakerRecognitionResultType}}),Object.defineProperty(e,"SpeakerRecognitionCancellationDetails",{enumerable:!0,get:function(){return ne.SpeakerRecognitionCancellationDetails}});var de=db();Object.defineProperty(e,"Conversation",{enumerable:!0,get:function(){return de.Conversation}}),Object.defineProperty(e,"ConversationExpirationEventArgs",{enumerable:!0,get:function(){return de.ConversationExpirationEventArgs}}),Object.defineProperty(e,"ConversationParticipantsChangedEventArgs",{enumerable:!0,get:function(){return de.ConversationParticipantsChangedEventArgs}}),Object.defineProperty(e,"ConversationTranslationCanceledEventArgs",{enumerable:!0,get:function(){return de.ConversationTranslationCanceledEventArgs}}),Object.defineProperty(e,"ConversationTranslationEventArgs",{enumerable:!0,get:function(){return de.ConversationTranslationEventArgs}}),Object.defineProperty(e,"ConversationTranslationResult",{enumerable:!0,get:function(){return de.ConversationTranslationResult}}),Object.defineProperty(e,"ConversationTranslator",{enumerable:!0,get:function(){return de.ConversationTranslator}}),Object.defineProperty(e,"ConversationTranscriber",{enumerable:!0,get:function(){return de.ConversationTranscriber}}),Object.defineProperty(e,"ConversationTranscriptionResult",{enumerable:!0,get:function(){return de.ConversationTranscriptionResult}}),Object.defineProperty(e,"Meeting",{enumerable:!0,get:function(){return de.Meeting}}),Object.defineProperty(e,"MeetingTranscriber",{enumerable:!0,get:function(){return de.MeetingTranscriber}}),Object.defineProperty(e,"Participant",{enumerable:!0,get:function(){return de.Participant}}),Object.defineProperty(e,"ParticipantChangedReason",{enumerable:!0,get:function(){return de.ParticipantChangedReason}}),Object.defineProperty(e,"User",{enumerable:!0,get:function(){return de.User}});var Ke=fb();Object.defineProperty(e,"Synthesizer",{enumerable:!0,get:function(){return Ke.Synthesizer}});var ot=nb;Object.defineProperty(e,"SpeechSynthesisOutputFormat",{enumerable:!0,get:function(){return ot.SpeechSynthesisOutputFormat}});var it=ML();Object.defineProperty(e,"SpeechSynthesizer",{enumerable:!0,get:function(){return it.SpeechSynthesizer}});var Je=Wg;Object.defineProperty(e,"SynthesisResult",{enumerable:!0,get:function(){return Je.SynthesisResult}});var je=LL();Object.defineProperty(e,"SpeechSynthesisResult",{enumerable:!0,get:function(){return je.SpeechSynthesisResult}});var po=Vg;Object.defineProperty(e,"SpeechSynthesisEventArgs",{enumerable:!0,get:function(){return po.SpeechSynthesisEventArgs}});var Zt=Kg;Object.defineProperty(e,"SpeechSynthesisWordBoundaryEventArgs",{enumerable:!0,get:function(){return Zt.SpeechSynthesisWordBoundaryEventArgs}});var bs=Gg;Object.defineProperty(e,"SpeechSynthesisBookmarkEventArgs",{enumerable:!0,get:function(){return bs.SpeechSynthesisBookmarkEventArgs}});var vr=Qg;Object.defineProperty(e,"SpeechSynthesisVisemeEventArgs",{enumerable:!0,get:function(){return vr.SpeechSynthesisVisemeEventArgs}});var go=$R;Object.defineProperty(e,"SpeechSynthesisBoundaryType",{enumerable:!0,get:function(){return go.SpeechSynthesisBoundaryType}});var $n=UL();Object.defineProperty(e,"SynthesisVoicesResult",{enumerable:!0,get:function(){return $n.SynthesisVoicesResult}});var Cs=WR;Object.defineProperty(e,"VoiceInfo",{enumerable:!0,get:function(){return Cs.VoiceInfo}});var Ha=Xg;Object.defineProperty(e,"SpeakerAudioDestination",{enumerable:!0,get:function(){return Ha.SpeakerAudioDestination}});var qa=KL();Object.defineProperty(e,"ConversationTranscriptionCanceledEventArgs",{enumerable:!0,get:function(){return qa.ConversationTranscriptionCanceledEventArgs}});var Dt=GL();Object.defineProperty(e,"MeetingTranscriptionCanceledEventArgs",{enumerable:!0,get:function(){return Dt.MeetingTranscriptionCanceledEventArgs}});var En=VR;Object.defineProperty(e,"PronunciationAssessmentGradingSystem",{enumerable:!0,get:function(){return En.PronunciationAssessmentGradingSystem}});var Lt=KR;Object.defineProperty(e,"PronunciationAssessmentGranularity",{enumerable:!0,get:function(){return Lt.PronunciationAssessmentGranularity}});var ft=QL();Object.defineProperty(e,"PronunciationAssessmentConfig",{enumerable:!0,get:function(){return ft.PronunciationAssessmentConfig}});var er=XL();Object.defineProperty(e,"PronunciationAssessmentResult",{enumerable:!0,get:function(){return er.PronunciationAssessmentResult}});var gm=cb;Object.defineProperty(e,"LanguageIdMode",{enumerable:!0,get:function(){return gm.LanguageIdMode}});var HC=YL();Object.defineProperty(e,"AvatarConfig",{enumerable:!0,get:function(){return HC.AvatarConfig}});var vm=XR;Object.defineProperty(e,"AvatarEventArgs",{enumerable:!0,get:function(){return vm.AvatarEventArgs}});var Ua=JL();Object.defineProperty(e,"AvatarSynthesizer",{enumerable:!0,get:function(){return Ua.AvatarSynthesizer}});var qC=Ll;Object.defineProperty(e,"AvatarVideoFormat",{enumerable:!0,get:function(){return qC.AvatarVideoFormat}}),Object.defineProperty(e,"Coordinate",{enumerable:!0,get:function(){return qC.Coordinate}});var n7=tF();Object.defineProperty(e,"AvatarWebRTCConnectionResult",{enumerable:!0,get:function(){return n7.AvatarWebRTCConnectionResult}});var o7=rF();Object.defineProperty(e,"Diagnostics",{enumerable:!0,get:function(){return o7.Diagnostics}});var i7=tb;Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return i7.LogLevel}})}(r0)),r0}var $2;function nF(){if($2)return Ic;$2=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.ProxyInfo=void 0;const e=$();let t=class JR{constructor(n,o,i,s){this.privProxyHostName=n,this.privProxyPort=o,this.privProxyUserName=i,this.privProxyPassword=s}static fromParameters(n){return new JR(n.getProperty(e.PropertyId.SpeechServiceConnection_ProxyHostName),parseInt(n.getProperty(e.PropertyId.SpeechServiceConnection_ProxyPort),10),n.getProperty(e.PropertyId.SpeechServiceConnection_ProxyUserName),n.getProperty(e.PropertyId.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(n){return this.fromParameters(n.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}};return Ic.ProxyInfo=t,Ic}var ZR={};const oF=new Set(["json","buffer","string"]);var iF=e=>(...t)=>{const r=new Set;let n,o,i,s="";return t.forEach(a=>{if(typeof a=="string")if(a.toUpperCase()===a)if(n){const l=`Can't set method to ${a}, already set to ${n}.`;throw new Error(l)}else n=a;else if(a.startsWith("http:")||a.startsWith("https:"))s=a;else if(oF.has(a))o=a;else throw new Error(`Unknown encoding, ${a}`);else if(typeof a=="number")r.add(a);else if(typeof a=="object")if(Array.isArray(a)||a instanceof Set)a.forEach(l=>r.add(l));else{if(i)throw new Error("Cannot set headers twice.");i=a}else throw new Error(`Unknown type: ${typeof a}`)}),n||(n="GET"),r.size===0&&r.add(200),e(r,n,o,i,s)};const sF=iF;class hb extends Error{constructor(t,...r){super(...r),Error.captureStackTrace&&Error.captureStackTrace(this,hb),this.name="StatusError",this.message=t.statusMessage,this.statusCode=t.status,this.res=t,this.json=t.json.bind(t),this.text=t.text.bind(t),this.arrayBuffer=t.arrayBuffer.bind(t);let n;Object.defineProperty(this,"responseBody",{get:()=>(n||(n=this.arrayBuffer()),n)}),this.headers={};for(const[i,s]of t.headers.entries())this.headers[i.toLowerCase()]=s}}const aF=(e,t,r,n,o)=>async(i,s,a={})=>{i=o+(i||"");let l=new URL(i);if(n||(n={}),l.username&&(n.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),l.protocol!=="https:"&&l.protocol!=="http:")throw new Error(`Unknown protocol, ${l.protocol}`);if(s&&!(s instanceof ArrayBuffer||ArrayBuffer.isView(s)||typeof s=="string"))if(typeof s=="object")s=JSON.stringify(s),n["Content-Type"]="application/json";else throw new Error("Unknown body type.");a=new Headers({...n||{},...a});const c=await fetch(l,{method:t,headers:a,body:s});if(c.statusCode=c.status,!e.has(c.status))throw new hb(c);return r==="json"?c.json():r==="buffer"?c.arrayBuffer():r==="string"?c.text():c};var lF=sF(aF);(function(e){var t=Oe&&Oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(e,"__esModule",{value:!0}),e.RestMessageAdapter=e.RestRequestType=void 0;const r=t(lF),n=ve();var o;(function(s){s.Get="GET",s.Post="POST",s.Delete="DELETE",s.File="file"})(o=e.RestRequestType||(e.RestRequestType={}));class i{constructor(a){if(!a)throw new n.ArgumentNullError("configParams");this.privHeaders=a.headers,this.privIgnoreCache=a.ignoreCache}static extractHeaderValue(a,l){let c="";try{const u=l.trim().split(/[\r\n]+/),d={};u.forEach(f=>{const p=f.split(": "),h=p.shift().toLowerCase(),v=p.join(": ");d[h]=v}),c=d[a.toLowerCase()]}catch{}return c}set options(a){this.privHeaders=a.headers,this.privIgnoreCache=a.ignoreCache}setHeaders(a,l){this.privHeaders[a]=l}request(a,l,c={},u=null){const d=new n.Deferred,f=a===o.File?"POST":a,p=(v,y={})=>{const g=v;return{data:JSON.stringify(y),headers:JSON.stringify(v.headers),json:y,ok:v.statusCode>=200&&v.statusCode<300,status:v.statusCode,statusText:y.error?y.error.message:g.statusText?g.statusText:g.statusMessage}},h=v=>{const y=r.default(l,f,this.privHeaders,200,201,202,204,400,401,402,403,404),g=this.queryParams(c)===""?"":`?${this.queryParams(c)}`;y(g,v).then(async m=>{if(a===o.Delete||m.statusCode===204)d.resolve(p(m));else try{const b=await m.json();d.resolve(p(m,b))}catch{d.resolve(p(m))}}).catch(m=>{d.reject(m)})};return this.privIgnoreCache&&(this.privHeaders["Cache-Control"]="no-cache"),a===o.Post&&u&&(this.privHeaders["content-type"]="application/json",this.privHeaders["Content-Type"]="application/json"),h(u),d.promise}queryParams(a={}){return Object.keys(a).map(l=>encodeURIComponent(l)+"="+encodeURIComponent(a[l])).join("&")}}e.RestMessageAdapter=i})(ZR);var V1={};Object.defineProperty(V1,"__esModule",{value:!0});V1.RestConfigBase=void 0;class Qi{static get requestOptions(){return Qi.privDefaultRequestOptions}static get configParams(){return Qi.privDefaultParams}static get restErrors(){return Qi.privRestErrors}}V1.RestConfigBase=Qi;Qi.privDefaultRequestOptions={headers:{Accept:"application/json"},ignoreCache:!1,timeout:1e4};Qi.privRestErrors={authInvalidSubscriptionKey:"You must specify either an authentication token to use, or a Cognitive Speech subscription key.",authInvalidSubscriptionRegion:"You must specify the Cognitive Speech region to use.",invalidArgs:"Required input not found: {arg}.",invalidCreateJoinConversationResponse:"Creating/Joining conversation failed with HTTP {status}.",invalidParticipantRequest:"The requested participant was not found.",permissionDeniedConnect:"Required credentials not found.",permissionDeniedConversation:"Invalid operation: only the host can {command} the conversation.",permissionDeniedParticipant:"Invalid operation: only the host can {command} a participant.",permissionDeniedSend:"Invalid operation: the conversation is not in a connected state.",permissionDeniedStart:"Invalid operation: there is already an active conversation."};Qi.privDefaultParams={apiVersion:"api-version",authorization:"Authorization",clientAppId:"X-ClientAppId",contentTypeKey:"Content-Type",correlationId:"X-CorrelationId",languageCode:"language",nickname:"nickname",profanity:"profanity",requestId:"X-RequestId",roomId:"roomid",sessionToken:"token",subscriptionKey:"Ocp-Apim-Subscription-Key",subscriptionRegion:"Ocp-Apim-Subscription-Region",token:"X-CapitoToken"};var W2;function Jt(){return W2||(W2=1,function(e){var t=Oe&&Oe.__createBinding||(Object.create?function(n,o,i,s){s===void 0&&(s=i),Object.defineProperty(n,s,{enumerable:!0,get:function(){return o[i]}})}:function(n,o,i,s){s===void 0&&(s=i),n[s]=o[i]}),r=Oe&&Oe.__exportStar||function(n,o){for(var i in n)i!=="default"&&!o.hasOwnProperty(i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(wg,e),r(lR,e),r(iz(),e),r(sz(),e),r(_g,e),r(kg,e),r(H1,e),r(Pg,e),r(nF(),e),r(ZR,e),r(V1,e)}(Zm)),Zm}var V2;function cF(){if(V2)return Pc;V2=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.IntentConnectionFactory=void 0;const e=Jt(),t=$(),r=ao(),n=ue(),o=Yt;let i=class extends r.ConnectionFactoryBase{create(a,l,c){let u=a.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint);if(!u){const h=a.parameters.getProperty(t.PropertyId.SpeechServiceConnection_IntentRegion),v=r.ConnectionFactoryBase.getHostSuffix(h);u=a.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,"wss://"+h+".sr.speech"+v)+"/speech/recognition/interactive/cognitiveservices/v1"}const d={format:"simple",language:a.parameters.getProperty(t.PropertyId.SpeechServiceConnection_RecoLanguage)};this.setCommonUrlParams(a,d,u);const f={};l.token!==void 0&&l.token!==""&&(f[l.headerName]=l.token),f[o.HeaderNames.ConnectionId]=c,a.parameters.setProperty(t.PropertyId.SpeechServiceConnection_Url,u);const p=a.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(u,d,f,new n.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(a),p,c)}getSpeechRegionFromIntentRegion(a){switch(a){case"West US":case"US West":case"westus":return"uswest";case"West US 2":case"US West 2":case"westus2":return"uswest2";case"South Central US":case"US South Central":case"southcentralus":return"ussouthcentral";case"West Central US":case"US West Central":case"westcentralus":return"uswestcentral";case"East US":case"US East":case"eastus":return"useast";case"East US 2":case"US East 2":case"eastus2":return"useast2";case"West Europe":case"Europe West":case"westeurope":return"europewest";case"North Europe":case"Europe North":case"northeurope":return"europenorth";case"Brazil South":case"South Brazil":case"southbrazil":return"brazilsouth";case"Australia East":case"East Australia":case"eastaustralia":return"australiaeast";case"Southeast Asia":case"Asia Southeast":case"southeastasia":return"asiasoutheast";case"East Asia":case"Asia East":case"eastasia":return"asiaeast";default:return a}}};return Pc.IntentConnectionFactory=i,Pc}var Os={},K2;function uF(){if(K2)return Os;K2=1,Object.defineProperty(Os,"__esModule",{value:!0}),Os.VoiceProfileConnectionFactory=Os.SpeakerRecognitionConnectionFactory=void 0;const e=Jt(),t=$(),r=ao(),n=ue(),o=Yt;class i extends r.ConnectionFactoryBase{create(c,u,d,f){let p=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint);if(!p){const g=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Region),m=r.ConnectionFactoryBase.getHostSuffix(g),b=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,`wss://${g}.spr-frontend.speech${m}`),C=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_SpeakerIdMode,"TextIndependentIdentification");p=`${b}/speaker/ws/${this.scenarioToPath(C)}/${d}`}const h={format:"simple",language:c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_RecoLanguage)};this.setCommonUrlParams(c,h,p);const v={};u.token!==void 0&&u.token!==""&&(v[u.headerName]=u.token),v[o.HeaderNames.ConnectionId]=f,v[o.HeaderNames.SpIDAuthKey]=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Key),c.parameters.setProperty(t.PropertyId.SpeechServiceConnection_Url,p);const y=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(p,h,v,new n.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),y,f)}scenarioToPath(c){switch(c){case"TextIndependentVerification":case"2":return"verification/text-independent";case"TextDependentVerification":case"1":return"verification/text-dependent";default:return"identification/text-independent"}}}let s=class extends i{create(c,u,d){return super.create(c,u,"recognition",d)}};Os.SpeakerRecognitionConnectionFactory=s;class a extends i{create(c,u,d){return super.create(c,u,"profile",d)}}return Os.VoiceProfileConnectionFactory=a,Os}var Yg={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RecognitionEndedEvent=e.RecognitionCompletionStatus=e.RecognitionStartedEvent=e.ConnectingToServiceEvent=e.ListeningStartedEvent=e.RecognitionTriggeredEvent=e.SpeechRecognitionEvent=void 0;const t=ve();class r extends t.PlatformEvent{constructor(u,d,f,p=t.EventType.Info){super(u,p),this.privRequestId=d,this.privSessionId=f}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}e.SpeechRecognitionEvent=r;class n extends r{constructor(u,d,f,p){super("RecognitionTriggeredEvent",u,d),this.privAudioSourceId=f,this.privAudioNodeId=p}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}e.RecognitionTriggeredEvent=n;class o extends r{constructor(u,d,f,p){super("ListeningStartedEvent",u,d),this.privAudioSourceId=f,this.privAudioNodeId=p}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}e.ListeningStartedEvent=o;class i extends r{constructor(u,d,f){super("ConnectingToServiceEvent",u,f),this.privAuthFetchEventid=d}get authFetchEventid(){return this.privAuthFetchEventid}}e.ConnectingToServiceEvent=i;class s extends r{constructor(u,d,f,p,h){super("RecognitionStartedEvent",u,h),this.privAudioSourceId=d,this.privAudioNodeId=f,this.privAuthFetchEventId=p}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}e.RecognitionStartedEvent=s;var a;(function(c){c[c.Success=0]="Success",c[c.AudioSourceError=1]="AudioSourceError",c[c.AudioSourceTimeout=2]="AudioSourceTimeout",c[c.AuthTokenFetchError=3]="AuthTokenFetchError",c[c.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",c[c.UnAuthorized=5]="UnAuthorized",c[c.ConnectTimeout=6]="ConnectTimeout",c[c.ConnectError=7]="ConnectError",c[c.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",c[c.UnknownError=9]="UnknownError"})(a=e.RecognitionCompletionStatus||(e.RecognitionCompletionStatus={}));class l extends r{constructor(u,d,f,p,h,v,y,g){super("RecognitionEndedEvent",u,h,y===a.Success?t.EventType.Info:t.EventType.Error),this.privAudioSourceId=d,this.privAudioNodeId=f,this.privAuthFetchEventId=p,this.privStatus=y,this.privError=g,this.privServiceTag=v}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}get serviceTag(){return this.privServiceTag}get status(){return this.privStatus}get error(){return this.privError}}e.RecognitionEndedEvent=l})(Yg);var Nu={},hi={};Object.defineProperty(hi,"__esModule",{value:!0});hi.SpeechConnectionMessage=void 0;const a0=ve(),Lo=Yt;class pb extends a0.ConnectionMessage{constructor(t,r,n,o,i,s,a,l){if(!r)throw new a0.ArgumentNullError("path");if(!n)throw new a0.ArgumentNullError("requestId");const c={};if(c[Lo.HeaderNames.Path]=r,c[Lo.HeaderNames.RequestId]=n,c[Lo.HeaderNames.RequestTimestamp]=new Date().toISOString(),o&&(c[Lo.HeaderNames.ContentType]=o),s&&(c[Lo.HeaderNames.RequestStreamId]=s),a)for(const u in a)u&&(c[u]=a[u]);l?super(t,i,c,l):super(t,i,c),this.privPath=r,this.privRequestId=n,this.privContentType=o,this.privStreamId=s,this.privAdditionalHeaders=a}get path(){return this.privPath}get requestId(){return this.privRequestId}get contentType(){return this.privContentType}get streamId(){return this.privStreamId}get additionalHeaders(){return this.privAdditionalHeaders}static fromConnectionMessage(t){let r=null,n=null,o=null,i=null;const s={};if(t.headers)for(const a in t.headers)a&&(a.toLowerCase()===Lo.HeaderNames.Path.toLowerCase()?r=t.headers[a]:a.toLowerCase()===Lo.HeaderNames.RequestId.toLowerCase()?n=t.headers[a]:a.toLowerCase()===Lo.HeaderNames.ContentType.toLowerCase()?o=t.headers[a]:a.toLowerCase()===Lo.HeaderNames.RequestStreamId.toLowerCase()?i=t.headers[a]:s[a]=t.headers[a]);return new pb(t.messageType,r,n,o,t.body,i,s,t.id)}}hi.SpeechConnectionMessage=pb;var G2;function dF(){if(G2)return Nu;G2=1,Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.ServiceRecognizerBase=void 0;const e=Jt(),t=ve(),r=$(),n=ue(),o=hi;let i=class _d{constructor(a,l,c,u,d){if(this.privConnectionConfigurationPromise=void 0,this.privConnectionPromise=void 0,this.privSetTimeout=setTimeout,this.privIsLiveAudio=!1,this.privAverageBytesPerMs=0,this.privEnableSpeakerId=!1,this.privExpectContentAssessmentResponse=!1,this.recognizeOverride=void 0,this.recognizeSpeaker=void 0,this.disconnectOverride=void 0,this.receiveMessageOverride=void 0,this.sendPrePayloadJSONOverride=void 0,this.postConnectImplOverride=void 0,this.configConnectionOverride=void 0,this.handleSpeechPhraseMessage=void 0,this.handleSpeechHypothesisMessage=void 0,!a)throw new t.ArgumentNullError("authentication");if(!l)throw new t.ArgumentNullError("connectionFactory");if(!c)throw new t.ArgumentNullError("audioSource");if(!u)throw new t.ArgumentNullError("recognizerConfig");this.privEnableSpeakerId=u.isSpeakerDiarizationEnabled,this.privMustReportEndOfStream=!1,this.privAuthentication=a,this.privConnectionFactory=l,this.privAudioSource=c,this.privRecognizerConfig=u,this.privIsDisposed=!1,this.privRecognizer=d,this.privRequestSession=new n.RequestSession(this.privAudioSource.id()),this.privConnectionEvents=new t.EventSource,this.privServiceEvents=new t.EventSource,this.privDynamicGrammar=new n.DynamicGrammarBuilder,this.privSpeechContext=new n.SpeechContext(this.privDynamicGrammar),this.privAgentConfig=new n.AgentConfig,this.privRecognizerConfig.parameters.getProperty(r.PropertyId.WebWorkerLoadType,"on").toLowerCase()==="on"&&typeof Blob<"u"&&typeof Worker<"u"?this.privSetTimeout=t.Timeout.setTimeout:(typeof window<"u"&&(this.privSetTimeout=window.setTimeout.bind(window)),typeof globalThis<"u"&&(this.privSetTimeout=globalThis.setTimeout.bind(globalThis))),this.connectionEvents.attach(p=>{if(p.name==="ConnectionClosedEvent"){const h=p;(h.statusCode===1003||h.statusCode===1007||h.statusCode===1002||h.statusCode===4e3||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&this.cancelRecognitionLocal(r.CancellationReason.Error,h.statusCode===1007?r.CancellationErrorCode.BadRequestParameters:r.CancellationErrorCode.ConnectionFailure,`${h.reason} websocket error code: ${h.statusCode}`)}}),this.privEnableSpeakerId&&(this.privDiarizationSessionId=t.createNoDashGuid()),this.setLanguageIdJson(),this.setOutputDetailLevelJson()}setTranslationJson(){const a=this.privRecognizerConfig.parameters.getProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages,void 0);if(a!==void 0){const l=a.split(","),c=this.privRecognizerConfig.parameters.getProperty(r.PropertyId.SpeechServiceConnection_TranslationVoice,void 0),u=c!==void 0?"Synthesize":"None";if(this.privSpeechContext.setSection("translation",{onSuccess:{action:u},output:{interimResults:{mode:"Always"}},targetLanguages:l}),c!==void 0){const d={};for(const f of l)d[f]=c;this.privSpeechContext.setSection("synthesis",{defaultVoices:d})}}}setSpeechSegmentationTimeoutJson(){const a=this.privRecognizerConfig.parameters.getProperty(r.PropertyId.Speech_SegmentationSilenceTimeoutMs,void 0);if(a!==void 0){const l=this.recognitionMode===n.RecognitionMode.Conversation?"CONVERSATION":this.recognitionMode===n.RecognitionMode.Dictation?"DICTATION":"INTERACTIVE",c=parseInt(a,10),u=this.privSpeechContext.getSection("phraseDetection");u.mode=l,u[l]={segmentation:{mode:"Custom",segmentationSilenceTimeoutMs:c}},this.privSpeechContext.setSection("phraseDetection",u)}}setLanguageIdJson(){const a=this.privSpeechContext.getSection("phraseDetection");if(this.privRecognizerConfig.autoDetectSourceLanguages!==void 0){const c=this.privRecognizerConfig.autoDetectSourceLanguages.split(",");let u;this.privRecognizerConfig.languageIdMode==="Continuous"?u="DetectContinuous":u="DetectAtAudioStart",this.privSpeechContext.setSection("languageId",{Priority:"PrioritizeLatency",languages:c,mode:u,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}});const d=this.privRecognizerConfig.sourceLanguageModels;d!==void 0&&(a.customModels=d,a.onInterim={action:"None"},a.onSuccess={action:"None"})}this.privRecognizerConfig.parameters.getProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages,void 0)!==void 0&&(a.onInterim={action:"Translate"},a.onSuccess={action:"Translate"},this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"None"},phraseResults:{resultType:"None"}})),this.privSpeechContext.setSection("phraseDetection",a)}setOutputDetailLevelJson(){this.privEnableSpeakerId&&(this.privRecognizerConfig.parameters.getProperty(r.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,"false").toLowerCase()==="true"?this.privSpeechContext.setWordLevelTimings():this.privRecognizerConfig.parameters.getProperty(n.OutputFormatPropertyName,r.OutputFormat[r.OutputFormat.Simple]).toLowerCase()===r.OutputFormat[r.OutputFormat.Detailed].toLocaleLowerCase()&&this.privSpeechContext.setDetailedOutputFormat())}get isSpeakerDiarizationEnabled(){return this.privEnableSpeakerId}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(a){this.privRecognizerConfig.parameters.setProperty(r.PropertyId.ConversationTranslator_Token,a)}set voiceProfileType(a){this.privRecognizerConfig.parameters.setProperty(r.PropertyId.SpeechServiceConnection_SpeakerIdMode,a)}set authentication(a){this.privAuthentication=a}isDisposed(){return this.privIsDisposed}async dispose(a){if(this.privIsDisposed=!0,this.privConnectionConfigurationPromise!==void 0)try{await(await this.privConnectionConfigurationPromise).dispose(a)}catch{return}}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}async recognize(a,l,c){if(this.recognizeOverride!==void 0){await this.recognizeOverride(a,l,c);return}this.privConnectionConfigurationPromise=void 0,this.privRecognizerConfig.recognitionMode=a,this.setSpeechSegmentationTimeoutJson(),this.setTranslationJson(),this.privSuccessCallback=l,this.privErrorCallback=c,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const u=this.connectImpl();let d;try{const h=await this.audioSource.attach(this.privRequestSession.audioNodeId),v=await this.audioSource.format,y=await this.audioSource.deviceInfo;this.privIsLiveAudio=y.type&&y.type===n.type.Microphones,d=new e.ReplayableAudioNode(h,v.avgBytesPerSec),await this.privRequestSession.onAudioSourceAttachCompleted(d,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:y}}catch(h){throw await this.privRequestSession.onStopRecognizing(),h}try{await u}catch(h){await this.cancelRecognitionLocal(r.CancellationReason.Error,r.CancellationErrorCode.ConnectionFailure,h);return}const f=new r.SessionEventArgs(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,f),this.receiveMessage(),this.sendAudio(d).catch(async h=>{await this.cancelRecognitionLocal(r.CancellationReason.Error,r.CancellationErrorCode.RuntimeError,h)})}async stopRecognizing(){if(this.privRequestSession.isRecognizing)try{await this.audioSource.turnOff(),await this.sendFinalAudio(),await this.privRequestSession.onStopRecognizing(),await this.privRequestSession.turnCompletionPromise}finally{await this.privRequestSession.dispose()}}async connect(){return await this.connectImpl(),Promise.resolve()}connectAsync(a,l){this.connectImpl().then(()=>{try{a&&a()}catch(c){l&&l(c)}},c=>{try{l&&l(c)}catch{}})}async disconnect(){if(await this.cancelRecognitionLocal(r.CancellationReason.Error,r.CancellationErrorCode.NoError,"Disconnecting"),this.disconnectOverride!==void 0&&await this.disconnectOverride(),this.privConnectionPromise!==void 0)try{await(await this.privConnectionPromise).dispose()}catch{}this.privConnectionPromise=void 0}sendMessage(a){}async sendNetworkMessage(a,l){const c=typeof l=="string"?t.MessageType.Text:t.MessageType.Binary,u=typeof l=="string"?"application/json":"";return(await this.fetchConnection()).send(new o.SpeechConnectionMessage(c,a,this.privRequestSession.requestId,u,l))}set activityTemplate(a){this.privActivityTemplate=a}get activityTemplate(){return this.privActivityTemplate}set expectContentAssessmentResponse(a){this.privExpectContentAssessmentResponse=a}async sendTelemetryData(){const a=this.privRequestSession.getTelemetry();if(_d.telemetryDataEnabled!==!0||this.privIsDisposed||a===null)return;if(_d.telemetryData)try{_d.telemetryData(a)}catch{}await(await this.fetchConnection()).send(new o.SpeechConnectionMessage(t.MessageType.Text,"telemetry",this.privRequestSession.requestId,"application/json",a))}async cancelRecognitionLocal(a,l,c){this.privRequestSession.isRecognizing&&(await this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,a,l,c))}async receiveMessage(){try{if(this.privIsDisposed)return;let a=await this.fetchConnection();const l=await a.read();if(this.receiveMessageOverride!==void 0)return this.receiveMessageOverride();if(!l)return this.receiveMessage();this.privServiceHasSentMessage=!0;const c=o.SpeechConnectionMessage.fromConnectionMessage(l);if(c.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(c.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const u=n.SpeechDetected.fromJSON(c.textBody),d=new r.RecognitionEventArgs(u.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,d);break;case"speech.enddetected":let f;c.textBody.length>0?f=c.textBody:f="{ Offset: 0 }";const p=n.SpeechDetected.fromJSON(f),h=new r.RecognitionEventArgs(p.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,h);break;case"turn.end":await this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,await this.cancelRecognitionLocal(r.CancellationReason.EndOfStream,r.CancellationErrorCode.NoError,void 0));const v=new r.SessionEventArgs(this.privRequestSession.sessionId);if(await this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing){this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,v);return}else a=await this.fetchConnection(),await this.sendPrePayloadJSON(a);break;default:await this.processTypeSpecificMessages(c)||this.privServiceEvents&&this.serviceEvents.onEvent(new t.ServiceEvent(c.path.toLowerCase(),c.textBody))}return this.receiveMessage()}catch{return null}}updateSpeakerDiarizationAudioOffset(){const l=this.privRequestSession.recognitionBytesSent/this.privAverageBytesPerMs;this.privSpeechContext.setSpeakerDiarizationAudioOffsetMs(l)}sendSpeechContext(a,l){this.privEnableSpeakerId&&this.updateSpeakerDiarizationAudioOffset();const c=this.speechContext.toJSON();if(l&&this.privRequestSession.onSpeechContext(),c)return a.send(new o.SpeechConnectionMessage(t.MessageType.Text,"speech.context",this.privRequestSession.requestId,"application/json",c))}noOp(){}async sendPrePayloadJSON(a,l=!0){if(this.sendPrePayloadJSONOverride!==void 0)return this.sendPrePayloadJSONOverride(a);await this.sendSpeechContext(a,l),await this.sendWaveHeader(a)}async sendWaveHeader(a){const l=await this.audioSource.format;return a.send(new o.SpeechConnectionMessage(t.MessageType.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",l.header))}connectImpl(){return this.privConnectionPromise!==void 0?this.privConnectionPromise.then(a=>a.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise,()=>(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl())):(this.privConnectionPromise=this.retryableConnect(),this.privConnectionPromise.catch(()=>{}),this.postConnectImplOverride!==void 0?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}sendSpeechServiceConfig(a,l,c){if(l.onSpeechContext(),_d.telemetryDataEnabled!==!0){const d={context:{system:JSON.parse(c).context.system}};c=JSON.stringify(d)}if(this.privRecognizerConfig.parameters.getProperty("f0f5debc-f8c9-4892-ac4b-90a7ab359fd2","false").toLowerCase()==="true"){const u=JSON.parse(c);u.context.DisableReferenceChannel="True",u.context.MicSpec="1_0_0",c=JSON.stringify(u)}if(c)return a.send(new o.SpeechConnectionMessage(t.MessageType.Text,"speech.config",l.requestId,"application/json",c))}async fetchConnection(){return this.privConnectionConfigurationPromise!==void 0?this.privConnectionConfigurationPromise.then(a=>a.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise,()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection())):(this.privConnectionConfigurationPromise=this.configureConnection(),await this.privConnectionConfigurationPromise)}async sendAudio(a){const l=await this.audioSource.format;this.privAverageBytesPerMs=l.avgBytesPerSec/1e3;let c=Date.now();const u=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),d=l.avgBytesPerSec/1e3*parseInt(u,10),f=this.privRequestSession.recogNumber,p=async()=>{if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===f){const h=await this.fetchConnection(),v=await a.read();if(this.privRequestSession.isSpeechEnded)return;let y,g;if(!v||v.isEnd?(y=null,g=0):(y=v.buffer,this.privRequestSession.onAudioSent(y.byteLength),d>=this.privRequestSession.bytesSent?g=0:g=Math.max(0,c-Date.now())),g!==0&&await this.delay(g),y!==null&&(c=Date.now()+y.byteLength*1e3/(l.avgBytesPerSec*2)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===f)if(h.send(new o.SpeechConnectionMessage(t.MessageType.Binary,"audio",this.privRequestSession.requestId,null,y)).catch(()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch(()=>{})}),v!=null&&v.isEnd)this.privIsLiveAudio||this.privRequestSession.onSpeechEnded();else return p()}};return p()}async retryableConnect(){let a=!1;this.privAuthFetchEventId=t.createNoDashGuid();const l=this.privRequestSession.sessionId;this.privConnectionId=l!==void 0?l:t.createNoDashGuid(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let c=0,u="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const f=await(a?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId));await this.privRequestSession.onAuthCompleted(!1);const p=this.privConnectionFactory.create(this.privRecognizerConfig,f,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(p.events),p.events.attach(v=>{this.connectionEvents.onEvent(v)});const h=await p.open();if(h.statusCode===200)return await this.privRequestSession.onConnectionEstablishCompleted(h.statusCode),Promise.resolve(p);h.statusCode===1006&&(a=!0),c=h.statusCode,u=h.reason,this.privRequestSession.onRetryConnection()}return await this.privRequestSession.onConnectionEstablishCompleted(c,u),Promise.reject(`Unable to contact server. StatusCode: ${c}, ${this.privRecognizerConfig.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${u}`)}delay(a){return new Promise(l=>this.privSetTimeout(l,a))}writeBufferToConsole(a){let l="Buffer Size: ";if(a===null)l+="null";else{const c=new Uint8Array(a);l+=`${a.byteLength}\r
+`;for(let u=0;uthis.handleSpeechPhrase(c),this.handleSpeechHypothesisMessage=c=>this.handleSpeechHypothesis(c)}processTypeSpecificMessages(o){}handleRecognizedCallback(o,i,s){}handleRecognizingCallback(o,i,s){}async processSpeechMessages(o){let i=!1;switch(o.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":this.handleSpeechHypothesisMessage&&this.handleSpeechHypothesisMessage(o.textBody),i=!0;break;case"speech.phrase":this.handleSpeechPhraseMessage&&await this.handleSpeechPhraseMessage(o.textBody),i=!0;break}return i}cancelRecognition(o,i,s,a,l){}async handleSpeechPhrase(o){const i=t.SimpleSpeechPhrase.fromJSON(o),s=t.EnumTranslation.implTranslateRecognitionResult(i.RecognitionStatus);let a;const l=new e.PropertyCollection;l.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,o);const c=i.Offset+this.privRequestSession.currentTurnAudioOffset;let u=c;if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+i.Offset+i.Duration),e.ResultReason.Canceled===s){const d=t.EnumTranslation.implTranslateCancelResult(i.RecognitionStatus),f=t.EnumTranslation.implTranslateCancelErrorCode(i.RecognitionStatus);await this.cancelRecognitionLocal(d,f,t.EnumTranslation.implTranslateErrorDetails(f))}else if(!(this.privRequestSession.isSpeechEnded&&s===e.ResultReason.NoMatch&&i.RecognitionStatus!==t.RecognitionStatus.InitialSilenceTimeout)){if(this.privRecognizerConfig.parameters.getProperty(t.OutputFormatPropertyName)===e.OutputFormat[e.OutputFormat.Simple])a=new e.SpeechRecognitionResult(this.privRequestSession.requestId,s,i.DisplayText,i.Duration,c,i.Language,i.LanguageDetectionConfidence,i.SpeakerId,void 0,o,l);else{const d=t.DetailedSpeechPhrase.fromJSON(o),f=d.Offset+this.privRequestSession.currentTurnAudioOffset,p=d.getJsonWithCorrectedOffsets(f);a=new e.SpeechRecognitionResult(this.privRequestSession.requestId,s,d.Text,d.Duration,f,d.Language,d.LanguageDetectionConfidence,d.SpeakerId,void 0,p,l),u=a.offset}this.handleRecognizedCallback(a,u,this.privRequestSession.sessionId)}}handleSpeechHypothesis(o){const i=t.SpeechHypothesis.fromJSON(o),s=i.Offset+this.privRequestSession.currentTurnAudioOffset,a=new e.PropertyCollection;a.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,o);const l=new e.SpeechRecognitionResult(this.privRequestSession.requestId,e.ResultReason.RecognizingSpeech,i.Text,i.Duration,s,i.Language,i.LanguageDetectionConfidence,i.SpeakerId,void 0,o,a);this.privRequestSession.onHypothesis(s),this.handleRecognizingCallback(l,i.Duration,this.privRequestSession.sessionId)}};return Bu.ConversationServiceRecognizer=r,Bu}var l0={},X2;function hF(){return X2||(X2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RecognizerConfig=e.SpeechResultFormat=e.RecognitionMode=void 0;const t=$(),r=ue();var n;(function(i){i[i.Interactive=0]="Interactive",i[i.Conversation=1]="Conversation",i[i.Dictation=2]="Dictation"})(n=e.RecognitionMode||(e.RecognitionMode={})),function(i){i[i.Simple=0]="Simple",i[i.Detailed=1]="Detailed"}(e.SpeechResultFormat||(e.SpeechResultFormat={}));class o{constructor(s,a){this.privSpeechServiceConfig=s||new r.SpeechServiceConfig(new r.Context(null)),this.privParameters=a,this.privMaxRetryCount=parseInt(a.getProperty("SPEECH-Error-MaxRetryCount","4"),10),this.privLanguageIdMode=a.getProperty(t.PropertyId.SpeechServiceConnection_LanguageIdMode,void 0),this.privEnableSpeakerId=!1}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(s){this.privRecognitionMode=s,this.privRecognitionActivityTimeout=s===n.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=n[s]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==n.Interactive}get languageIdMode(){return this.privLanguageIdMode}get autoDetectSourceLanguages(){return this.parameters.getProperty(t.PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get recognitionEndpointVersion(){return this.parameters.getProperty(t.PropertyId.SpeechServiceConnection_RecognitionEndpointVersion,void 0)}get sourceLanguageModels(){const s=[];let a=!1;if(this.autoDetectSourceLanguages!==void 0)for(const l of this.autoDetectSourceLanguages.split(",")){const c=l+t.PropertyId.SpeechServiceConnection_EndpointId.toString(),u=this.parameters.getProperty(c,void 0);u!==void 0?(s.push({language:l,endpoint:u}),a=!0):s.push({language:l,endpoint:""})}return a?s:void 0}get maxRetryCount(){return this.privMaxRetryCount}get isSpeakerDiarizationEnabled(){return this.privEnableSpeakerId}set isSpeakerDiarizationEnabled(s){this.privEnableSpeakerId=s}}e.RecognizerConfig=o}(l0)),l0}var e6={};Object.defineProperty(e6,"__esModule",{value:!0});var Jg={};Object.defineProperty(Jg,"__esModule",{value:!0});Jg.WebsocketMessageFormatter=void 0;const wn=ve(),Y2=`\r
+`;class pF{toConnectionMessage(t){const r=new wn.Deferred;try{if(t.messageType===wn.MessageType.Text){const n=t.textContent;let o={},i=null;if(n){const s=n.split(`\r
+\r
+`);s&&s.length>0&&(o=this.parseHeaders(s[0]),s.length>1&&(i=s[1]))}r.resolve(new wn.ConnectionMessage(t.messageType,i,o,t.id))}else if(t.messageType===wn.MessageType.Binary){const n=t.binaryContent;let o={},i=null;if(!n||n.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const s=new DataView(n),a=s.getInt16(0);if(n.byteLengtha+2&&(i=n.slice(2+a)),r.resolve(new wn.ConnectionMessage(t.messageType,i,o,t.id))}}catch(n){r.reject(`Error formatting the message. Error: ${n}`)}return r.promise}fromConnectionMessage(t){const r=new wn.Deferred;try{if(t.messageType===wn.MessageType.Text){const n=`${this.makeHeaders(t)}${Y2}${t.textBody?t.textBody:""}`;r.resolve(new wn.RawWebsocketMessage(wn.MessageType.Text,n,t.id))}else if(t.messageType===wn.MessageType.Binary){const n=this.makeHeaders(t),o=t.binaryBody,i=this.stringToArrayBuffer(n),s=new Int8Array(i),a=s.byteLength,l=new Int8Array(2+a+(o?o.byteLength:0));if(l[0]=a>>8&255,l[1]=a&255,l.set(s,2),o){const u=new Int8Array(o);l.set(u,2+a)}const c=l.buffer;r.resolve(new wn.RawWebsocketMessage(wn.MessageType.Binary,c,t.id))}}catch(n){r.reject(`Error formatting the message. ${n}`)}return r.promise}makeHeaders(t){let r="";if(t.headers)for(const n in t.headers)n&&(r+=`${n}: ${t.headers[n]}${Y2}`);return r}parseHeaders(t){const r={};if(t){const n=t.match(/[^\r\n]+/g);if(r){for(const o of n)if(o){const i=o.indexOf(":"),s=i>0?o.substr(0,i).trim().toLowerCase():o,a=i>0&&o.length>i+1?o.substr(i+1).trim():"";r[s]=a}}}return r}stringToArrayBuffer(t){const r=new ArrayBuffer(t.length),n=new DataView(r);for(let o=0;o1?f=`${v}${this.universalUri}${c.recognitionEndpointVersion}`:f=v+this.conversationRelativeUri;break;case o.RecognitionMode.Dictation:f=v+this.dictationRelativeUri;break;default:c.recognitionEndpointVersion!==void 0&&parseInt(c.recognitionEndpointVersion,10)>1?f=`${v}${this.universalUri}${c.recognitionEndpointVersion}`:f=v+this.interactiveRelativeUri;break}const b={};u.token!==void 0&&u.token!==""&&(b[u.headerName]=u.token),b[i.HeaderNames.ConnectionId]=d;const C=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",k=new e.WebsocketConnection(f,y,b,new o.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),C,d),E=k.uri;return c.parameters.setProperty(r.PropertyId.SpeechServiceConnection_Url,E),k}};return Ou.SpeechConnectionFactory=a,Ou}var Du={},Z2;function vF(){if(Z2)return Du;Z2=1,Object.defineProperty(Du,"__esModule",{value:!0}),Du.ConversationTranscriberConnectionFactory=void 0;const e=Jt(),t=$(),r=ue(),n=ao(),o=ue(),i=Yt,s=so;let a=class extends n.ConnectionFactoryBase{constructor(){super(...arguments),this.universalUri="/speech/universal/v2"}create(c,u,d){let f=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint,void 0);const p=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Region,void 0),h=n.ConnectionFactoryBase.getHostSuffix(p),v=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,"wss://"+p+".stt.speech"+h),y={},g=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_EndpointId,void 0),m=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_RecoLanguage,void 0);g?(!f||f.search(s.QueryParameterNames.CustomSpeechDeploymentId)===-1)&&(y[s.QueryParameterNames.CustomSpeechDeploymentId]=g):m&&(!f||f.search(s.QueryParameterNames.Language)===-1)&&(y[s.QueryParameterNames.Language]=m),c.autoDetectSourceLanguages!==void 0&&(y[s.QueryParameterNames.EnableLanguageId]="true"),this.setV2UrlParams(c,y,f),f||(f=`${v}${this.universalUri}`);const b={};u.token!==void 0&&u.token!==""&&(b[u.headerName]=u.token),b[i.HeaderNames.ConnectionId]=d;const C=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",k=new e.WebsocketConnection(f,y,b,new o.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),C,d),E=k.uri;return c.parameters.setProperty(t.PropertyId.SpeechServiceConnection_Url,E),k}setV2UrlParams(c,u,d){new Map([[t.PropertyId.Speech_SegmentationSilenceTimeoutMs,s.QueryParameterNames.SegmentationSilenceTimeoutMs],[t.PropertyId.SpeechServiceConnection_EnableAudioLogging,s.QueryParameterNames.EnableAudioLogging],[t.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,s.QueryParameterNames.EndSilenceTimeoutMs],[t.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,s.QueryParameterNames.InitialSilenceTimeoutMs],[t.PropertyId.SpeechServiceResponse_PostProcessingOption,s.QueryParameterNames.Postprocessing],[t.PropertyId.SpeechServiceResponse_ProfanityOption,s.QueryParameterNames.Profanity],[t.PropertyId.SpeechServiceResponse_StablePartialResultThreshold,s.QueryParameterNames.StableIntermediateThreshold]]).forEach((h,v)=>{this.setUrlParameter(v,h,c,u,d)});const p=JSON.parse(c.parameters.getProperty(r.ServicePropertiesPropertyName,"{}"));Object.keys(p).forEach(h=>{u[h]=p[h]})}};return Du.ConversationTranscriberConnectionFactory=a,Du}var Mu={},eE;function mF(){if(eE)return Mu;eE=1,Object.defineProperty(Mu,"__esModule",{value:!0}),Mu.TranscriberConnectionFactory=void 0;const e=Jt(),t=$(),r=ao(),n=ue(),o=Yt,i=so;let s=class extends r.ConnectionFactoryBase{constructor(){super(...arguments),this.multiaudioRelativeUri="/speech/recognition/multiaudio"}create(l,c,u){let d=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint,void 0);const f=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Region,"centralus"),p=r.ConnectionFactoryBase.getHostSuffix(f),h="wss://transcribe."+f+".cts.speech"+p+this.multiaudioRelativeUri,v=l.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,h),y={};this.setQueryParams(y,l,d),d||(d=v);const g={};c.token!==void 0&&c.token!==""&&(g[c.headerName]=c.token),g[o.HeaderNames.ConnectionId]=u,l.parameters.setProperty(t.PropertyId.SpeechServiceConnection_Url,d);const m=l.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(d,y,g,new n.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(l),m,u)}setQueryParams(l,c,u){const d=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_EndpointId,void 0),f=c.parameters.getProperty(t.PropertyId.SpeechServiceConnection_RecoLanguage,void 0);d&&!(i.QueryParameterNames.CustomSpeechDeploymentId in l)&&(l[i.QueryParameterNames.CustomSpeechDeploymentId]=d),f&&!(i.QueryParameterNames.Language in l)&&(l[i.QueryParameterNames.Language]=f);const p=c.parameters.getProperty(t.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,"false").toLowerCase()==="true",h=c.parameters.getProperty(n.OutputFormatPropertyName,t.OutputFormat[t.OutputFormat.Simple])!==t.OutputFormat[t.OutputFormat.Simple];(p||h)&&(l[i.QueryParameterNames.Format]=t.OutputFormat[t.OutputFormat.Detailed].toLowerCase()),this.setCommonUrlParams(c,l,u)}};return Mu.TranscriberConnectionFactory=s,Mu}var zu={},tE;function yF(){if(tE)return zu;tE=1,Object.defineProperty(zu,"__esModule",{value:!0}),zu.TranslationConnectionFactory=void 0;const e=Jt(),t=W1,r=$(),n=ao(),o=ue(),i=Yt,s=so;let a=class extends n.ConnectionFactoryBase{create(c,u,d){const f=this.getEndpointUrl(c),p={};c.autoDetectSourceLanguages!==void 0&&(p[s.QueryParameterNames.EnableLanguageId]="true"),this.setQueryParams(p,c,f);const h={};u.token!==void 0&&u.token!==""&&(h[u.headerName]=u.token),h[i.HeaderNames.ConnectionId]=d,c.parameters.setProperty(r.PropertyId.SpeechServiceConnection_Url,f);const v=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(f,p,h,new o.WebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),v,d)}getEndpointUrl(c,u){const d=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Region),f=n.ConnectionFactoryBase.getHostSuffix(d);let p=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Endpoint,void 0);return p||(c.autoDetectSourceLanguages!==void 0?p=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Host,"wss://{region}.stt.speech"+f)+"/speech/universal/v2":p=c.parameters.getProperty(r.PropertyId.SpeechServiceConnection_Host,"wss://{region}.s2s.speech"+f)+"/speech/translation/cognitiveservices/v1"),u===!0?p:t.StringUtils.formatString(p,{region:d})}setQueryParams(c,u,d){c.from=u.parameters.getProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage),c.to=u.parameters.getProperty(r.PropertyId.SpeechServiceConnection_TranslationToLanguages),c.scenario=u.recognitionMode===o.RecognitionMode.Interactive?"interactive":u.recognitionMode===o.RecognitionMode.Conversation?"conversation":"",this.setCommonUrlParams(u,c,d),this.setUrlParameter(r.PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult,s.QueryParameterNames.StableTranslation,u,c,d);const f=u.parameters.getProperty(r.PropertyId.SpeechServiceConnection_TranslationVoice,void 0);f!==void 0&&(c.voice=f,c.features="texttospeech")}};return zu.TranslationConnectionFactory=a,zu}var Lu={},rE;function SF(){if(rE)return Lu;rE=1,Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.EnumTranslation=void 0;const e=$(),t=ue();let r=class{static implTranslateRecognitionResult(o,i=!1){let s=e.ResultReason.Canceled;switch(o){case t.RecognitionStatus.Success:s=e.ResultReason.RecognizedSpeech;break;case t.RecognitionStatus.EndOfDictation:s=i?e.ResultReason.RecognizedSpeech:e.ResultReason.NoMatch;break;case t.RecognitionStatus.NoMatch:case t.RecognitionStatus.InitialSilenceTimeout:case t.RecognitionStatus.BabbleTimeout:s=e.ResultReason.NoMatch;break;case t.RecognitionStatus.Error:case t.RecognitionStatus.BadRequest:case t.RecognitionStatus.Forbidden:default:s=e.ResultReason.Canceled;break}return s}static implTranslateCancelResult(o){let i=e.CancellationReason.EndOfStream;switch(o){case t.RecognitionStatus.Success:case t.RecognitionStatus.EndOfDictation:case t.RecognitionStatus.NoMatch:i=e.CancellationReason.EndOfStream;break;case t.RecognitionStatus.InitialSilenceTimeout:case t.RecognitionStatus.BabbleTimeout:case t.RecognitionStatus.Error:case t.RecognitionStatus.BadRequest:case t.RecognitionStatus.Forbidden:default:i=e.CancellationReason.Error;break}return i}static implTranslateCancelErrorCode(o){let i=e.CancellationErrorCode.NoError;switch(o){case t.RecognitionStatus.Error:i=e.CancellationErrorCode.ServiceError;break;case t.RecognitionStatus.TooManyRequests:i=e.CancellationErrorCode.TooManyRequests;break;case t.RecognitionStatus.BadRequest:i=e.CancellationErrorCode.BadRequestParameters;break;case t.RecognitionStatus.Forbidden:i=e.CancellationErrorCode.Forbidden;break;default:i=e.CancellationErrorCode.NoError;break}return i}static implTranslateErrorDetails(o){let i="The speech service encountered an internal error and could not continue.";switch(o){case e.CancellationErrorCode.Forbidden:i="The recognizer is using a free subscription that ran out of quota.";break;case e.CancellationErrorCode.BadRequestParameters:i="Invalid parameter or unsupported audio format in the request.";break;case e.CancellationErrorCode.TooManyRequests:i="The number of parallel requests exceeded the number of allowed concurrent transcriptions.";break}return i}};return Lu.EnumTranslation=r,Lu}var t6={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RecognitionStatus=e.SynthesisStatus=void 0,function(t){t[t.Success=0]="Success",t[t.SynthesisEnd=1]="SynthesisEnd",t[t.Error=2]="Error"}(e.SynthesisStatus||(e.SynthesisStatus={})),function(t){t[t.Success=0]="Success",t[t.NoMatch=1]="NoMatch",t[t.InitialSilenceTimeout=2]="InitialSilenceTimeout",t[t.BabbleTimeout=3]="BabbleTimeout",t[t.Error=4]="Error",t[t.EndOfDictation=5]="EndOfDictation",t[t.TooManyRequests=6]="TooManyRequests",t[t.BadRequest=7]="BadRequest",t[t.Forbidden=8]="Forbidden"}(e.RecognitionStatus||(e.RecognitionStatus={}))})(t6);var Fu={},nE;function bF(){if(nE)return Fu;nE=1,Object.defineProperty(Fu,"__esModule",{value:!0}),Fu.TranslationSynthesisEnd=void 0;const e=ue();let t=class r6{constructor(n){this.privSynthesisEnd=JSON.parse(n),this.privSynthesisEnd.SynthesisStatus&&(this.privSynthesisEnd.SynthesisStatus=e.SynthesisStatus[this.privSynthesisEnd.SynthesisStatus]),this.privSynthesisEnd.Status&&(this.privSynthesisEnd.SynthesisStatus=e.SynthesisStatus[this.privSynthesisEnd.Status])}static fromJSON(n){return new r6(n)}get SynthesisStatus(){return this.privSynthesisEnd.SynthesisStatus}get FailureReason(){return this.privSynthesisEnd.FailureReason}};return Fu.TranslationSynthesisEnd=t,Fu}var Zg={};Object.defineProperty(Zg,"__esModule",{value:!0});Zg.TranslationHypothesis=void 0;const CF=Ce,TF=Cg;class bp{constructor(t){this.privTranslationHypothesis=t,this.privTranslationHypothesis.Translation.TranslationStatus=TF.TranslationStatus[this.privTranslationHypothesis.Translation.TranslationStatus]}static fromJSON(t){return new bp(JSON.parse(t))}static fromTranslationResponse(t){CF.Contracts.throwIfNullOrUndefined(t,"translationHypothesis");const r=t.SpeechHypothesis;return t.SpeechHypothesis=void 0,r.Translation=t,new bp(r)}get Duration(){return this.privTranslationHypothesis.Duration}get Offset(){return this.privTranslationHypothesis.Offset}get Text(){return this.privTranslationHypothesis.Text}get Translation(){return this.privTranslationHypothesis.Translation}get Language(){var t;return(t=this.privTranslationHypothesis.PrimaryLanguage)==null?void 0:t.Language}}Zg.TranslationHypothesis=bp;var ju={},oE;function EF(){if(oE)return ju;oE=1,Object.defineProperty(ju,"__esModule",{value:!0}),ju.TranslationPhrase=void 0;const e=Ce,t=ue(),r=Cg;let n=class mS{constructor(i){this.privTranslationPhrase=i,this.privTranslationPhrase.RecognitionStatus=t.RecognitionStatus[this.privTranslationPhrase.RecognitionStatus],this.privTranslationPhrase.Translation!==void 0&&(this.privTranslationPhrase.Translation.TranslationStatus=r.TranslationStatus[this.privTranslationPhrase.Translation.TranslationStatus])}static fromJSON(i){return new mS(JSON.parse(i))}static fromTranslationResponse(i){e.Contracts.throwIfNullOrUndefined(i,"translationResponse");const s=i.SpeechPhrase;return i.SpeechPhrase=void 0,s.Translation=i,s.Text=s.DisplayText,new mS(s)}get RecognitionStatus(){return this.privTranslationPhrase.RecognitionStatus}get Offset(){return this.privTranslationPhrase.Offset}get Duration(){return this.privTranslationPhrase.Duration}get Text(){return this.privTranslationPhrase.Text}get Language(){var i;return(i=this.privTranslationPhrase.PrimaryLanguage)==null?void 0:i.Language}get Confidence(){var i;return(i=this.privTranslationPhrase.PrimaryLanguage)==null?void 0:i.Confidence}get Translation(){return this.privTranslationPhrase.Translation}};return ju.TranslationPhrase=n,ju}var Hu={},iE;function wF(){if(iE)return Hu;iE=1,Object.defineProperty(Hu,"__esModule",{value:!0}),Hu.TranslationServiceRecognizer=void 0;const e=ve(),t=$(),r=ue();let n=class extends r.ConversationServiceRecognizer{constructor(i,s,a,l,c){super(i,s,a,l,c),this.privTranslationRecognizer=c,this.connectionEvents.attach(u=>{u.name==="ConnectionEstablishedEvent"&&this.privTranslationRecognizer.onConnection()})}async processTypeSpecificMessages(i){const s=new t.PropertyCollection;let a=await this.processSpeechMessages(i);if(a)return!0;const l=async u=>{if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+u.Offset+u.Duration),u.RecognitionStatus===r.RecognitionStatus.Success){const d=this.fireEventForResult(u,s);if(this.privTranslationRecognizer.recognized)try{this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,d)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(d.result)}catch(f){this.privErrorCallback&&this.privErrorCallback(f)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}else{const d=r.EnumTranslation.implTranslateRecognitionResult(u.RecognitionStatus),f=new t.TranslationRecognitionResult(void 0,this.privRequestSession.requestId,d,u.Text,u.Duration,this.privRequestSession.currentTurnAudioOffset+u.Offset,u.Language,u.Confidence,void 0,i.textBody,s);if(d===t.ResultReason.Canceled){const p=r.EnumTranslation.implTranslateCancelResult(u.RecognitionStatus),h=r.EnumTranslation.implTranslateCancelErrorCode(u.RecognitionStatus);await this.cancelRecognitionLocal(p,h,r.EnumTranslation.implTranslateErrorDetails(h))}else{if(!(this.privRequestSession.isSpeechEnded&&d===t.ResultReason.NoMatch&&u.RecognitionStatus!==r.RecognitionStatus.InitialSilenceTimeout)){const p=new t.TranslationRecognitionEventArgs(f,f.offset,this.privRequestSession.sessionId);if(this.privTranslationRecognizer.recognized)try{this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,p)}catch{}}if(this.privSuccessCallback){try{this.privSuccessCallback(f)}catch(p){this.privErrorCallback&&this.privErrorCallback(p)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}a=!0}},c=(u,d)=>{const f=this.fireEventForResult(u,d);if(this.privRequestSession.onHypothesis(this.privRequestSession.currentTurnAudioOffset+f.offset),this.privTranslationRecognizer.recognizing)try{this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer,f)}catch{}a=!0};switch(i.messageType===e.MessageType.Text&&s.setProperty(t.PropertyId.SpeechServiceResponse_JsonResult,i.textBody),i.path.toLowerCase()){case"translation.hypothesis":c(r.TranslationHypothesis.fromJSON(i.textBody),s);break;case"translation.response":const u=JSON.parse(i.textBody);if(u.SpeechPhrase)await l(r.TranslationPhrase.fromTranslationResponse(u));else{const f=JSON.parse(i.textBody);f.SpeechHypothesis&&c(r.TranslationHypothesis.fromTranslationResponse(f),s)}break;case"translation.phrase":await l(r.TranslationPhrase.fromJSON(i.textBody));break;case"translation.synthesis":this.sendSynthesisAudio(i.binaryBody,this.privRequestSession.sessionId),a=!0;break;case"audio.end":case"translation.synthesis.end":const d=r.TranslationSynthesisEnd.fromJSON(i.textBody);switch(d.SynthesisStatus){case r.SynthesisStatus.Error:if(this.privTranslationRecognizer.synthesizing){const f=new t.TranslationSynthesisResult(t.ResultReason.Canceled,void 0),p=new t.TranslationSynthesisEventArgs(f,this.privRequestSession.sessionId);try{this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer,p)}catch{}}if(this.privTranslationRecognizer.canceled){const f=new t.TranslationRecognitionCanceledEventArgs(this.privRequestSession.sessionId,t.CancellationReason.Error,d.FailureReason,t.CancellationErrorCode.ServiceError,null);try{this.privTranslationRecognizer.canceled(this.privTranslationRecognizer,f)}catch{}}break;case r.SynthesisStatus.Success:this.sendSynthesisAudio(void 0,this.privRequestSession.sessionId);break}a=!0;break}return a}cancelRecognition(i,s,a,l,c){const u=new t.PropertyCollection;if(u.setProperty(r.CancellationErrorCodePropertyName,t.CancellationErrorCode[l]),this.privTranslationRecognizer.canceled){const d=new t.TranslationRecognitionCanceledEventArgs(i,a,c,l,void 0);try{this.privTranslationRecognizer.canceled(this.privTranslationRecognizer,d)}catch{}}if(this.privSuccessCallback){const d=new t.TranslationRecognitionResult(void 0,s,t.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,c,void 0,u);try{this.privSuccessCallback(d),this.privSuccessCallback=void 0}catch{}}}handleRecognizingCallback(i,s,a){try{const l=new t.TranslationRecognitionEventArgs(t.TranslationRecognitionResult.fromSpeechRecognitionResult(i),s,a);this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer,l)}catch{}}handleRecognizedCallback(i,s,a){try{const l=new t.TranslationRecognitionEventArgs(t.TranslationRecognitionResult.fromSpeechRecognitionResult(i),s,a);this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,l)}catch{}}fireEventForResult(i,s){let a;if(i.Translation.Translations!==void 0){a=new t.Translations;for(const h of i.Translation.Translations)a.set(h.Language,h.Text||h.DisplayText)}let l,c;i instanceof r.TranslationPhrase?(i.Translation&&i.Translation.TranslationStatus===e.TranslationStatus.Success?l=t.ResultReason.TranslatedSpeech:l=t.ResultReason.RecognizedSpeech,c=i.Confidence):l=t.ResultReason.TranslatingSpeech;const u=i.Language,d=i.Offset+this.privRequestSession.currentTurnAudioOffset,f=new t.TranslationRecognitionResult(a,this.privRequestSession.requestId,l,i.Text,i.Duration,d,u,c,i.Translation.FailureReason,JSON.stringify(i),s);return new t.TranslationRecognitionEventArgs(f,d,this.privRequestSession.sessionId)}sendSynthesisAudio(i,s){const a=i===void 0?t.ResultReason.SynthesizingAudioCompleted:t.ResultReason.SynthesizingAudio,l=new t.TranslationSynthesisResult(a,i),c=new t.TranslationSynthesisEventArgs(l,s);if(this.privTranslationRecognizer.synthesizing)try{this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer,c)}catch{}}};return Hu.TranslationServiceRecognizer=n,Hu}var ev={};Object.defineProperty(ev,"__esModule",{value:!0});ev.SpeechDetected=void 0;class gb{constructor(t){this.privSpeechStartDetected=JSON.parse(t)}static fromJSON(t){return new gb(t)}get Offset(){return this.privSpeechStartDetected.Offset}}ev.SpeechDetected=gb;var tv={};Object.defineProperty(tv,"__esModule",{value:!0});tv.SpeechHypothesis=void 0;class vb{constructor(t){this.privSpeechHypothesis=JSON.parse(t)}static fromJSON(t){return new vb(t)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return this.privSpeechHypothesis.PrimaryLanguage===void 0?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return this.privSpeechHypothesis.PrimaryLanguage===void 0?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}tv.SpeechHypothesis=vb;var rv={};Object.defineProperty(rv,"__esModule",{value:!0});rv.SpeechKeyword=void 0;class mb{constructor(t){this.privSpeechKeyword=JSON.parse(t)}static fromJSON(t){return new mb(t)}get Status(){return this.privSpeechKeyword.Status}get Text(){return this.privSpeechKeyword.Text}get Offset(){return this.privSpeechKeyword.Offset}get Duration(){return this.privSpeechKeyword.Duration}}rv.SpeechKeyword=mb;var qu={},sE;function _F(){if(sE)return qu;sE=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.SpeechServiceRecognizer=void 0;const e=$(),t=ue();let r=class extends t.ServiceRecognizerBase{constructor(o,i,s,a,l){super(o,i,s,a,l),this.privSpeechRecognizer=l}async processTypeSpecificMessages(o){let i;const s=new e.PropertyCollection;s.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,o.textBody);let a=!1;switch(o.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const l=t.SpeechHypothesis.fromJSON(o.textBody),c=l.Offset+this.privRequestSession.currentTurnAudioOffset;i=new e.SpeechRecognitionResult(this.privRequestSession.requestId,e.ResultReason.RecognizingSpeech,l.Text,l.Duration,c,l.Language,l.LanguageDetectionConfidence,void 0,void 0,o.textBody,s),this.privRequestSession.onHypothesis(c);const u=new e.SpeechRecognitionEventArgs(i,l.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,u)}catch{}a=!0;break;case"speech.phrase":const d=t.SimpleSpeechPhrase.fromJSON(o.textBody),f=t.EnumTranslation.implTranslateRecognitionResult(d.RecognitionStatus,this.privExpectContentAssessmentResponse);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+d.Offset+d.Duration),e.ResultReason.Canceled===f){const p=t.EnumTranslation.implTranslateCancelResult(d.RecognitionStatus),h=t.EnumTranslation.implTranslateCancelErrorCode(d.RecognitionStatus);await this.cancelRecognitionLocal(p,h,t.EnumTranslation.implTranslateErrorDetails(h))}else{if(!(this.privRequestSession.isSpeechEnded&&f===e.ResultReason.NoMatch&&d.RecognitionStatus!==t.RecognitionStatus.InitialSilenceTimeout)){if(this.privRecognizerConfig.parameters.getProperty(t.OutputFormatPropertyName)===e.OutputFormat[e.OutputFormat.Simple])i=new e.SpeechRecognitionResult(this.privRequestSession.requestId,f,d.DisplayText,d.Duration,d.Offset+this.privRequestSession.currentTurnAudioOffset,d.Language,d.LanguageDetectionConfidence,void 0,void 0,o.textBody,s);else{const h=t.DetailedSpeechPhrase.fromJSON(o.textBody),v=h.Offset+this.privRequestSession.currentTurnAudioOffset,y=h.getJsonWithCorrectedOffsets(v);i=new e.SpeechRecognitionResult(this.privRequestSession.requestId,f,h.RecognitionStatus===t.RecognitionStatus.Success?h.NBest[0].Display:void 0,h.Duration,v,h.Language,h.LanguageDetectionConfidence,void 0,void 0,y,s)}const p=new e.SpeechRecognitionEventArgs(i,i.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,p)}catch{}}if(this.privSuccessCallback){try{this.privSuccessCallback(i)}catch(p){this.privErrorCallback&&this.privErrorCallback(p)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}a=!0;break}return a}cancelRecognition(o,i,s,a,l){const c=new e.PropertyCollection;if(c.setProperty(t.CancellationErrorCodePropertyName,e.CancellationErrorCode[a]),this.privSpeechRecognizer.canceled){const u=new e.SpeechRecognitionCanceledEventArgs(s,l,a,void 0,o);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,u)}catch{}}if(this.privSuccessCallback){const u=new e.SpeechRecognitionResult(i,e.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,l,void 0,c);try{this.privSuccessCallback(u),this.privSuccessCallback=void 0}catch{}}}};return qu.SpeechServiceRecognizer=r,qu}var Uu={},aE;function kF(){if(aE)return Uu;aE=1,Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.ConversationTranscriptionServiceRecognizer=void 0;const e=$(),t=ue();let r=class extends t.ServiceRecognizerBase{constructor(o,i,s,a,l){super(o,i,s,a,l),this.privConversationTranscriber=l,this.setSpeakerDiarizationJson()}setSpeakerDiarizationJson(){if(this.privEnableSpeakerId){const o=this.privSpeechContext.getSection("phraseDetection");o.mode="Conversation";const i={};i.mode="Anonymous",i.audioSessionId=this.privDiarizationSessionId,i.audioOffsetMs=0,o.speakerDiarization=i,this.privSpeechContext.setSection("phraseDetection",o)}}async processTypeSpecificMessages(o){let i;const s=new e.PropertyCollection;s.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,o.textBody);let a=!1;switch(o.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const l=t.SpeechHypothesis.fromJSON(o.textBody),c=l.Offset+this.privRequestSession.currentTurnAudioOffset;i=new e.ConversationTranscriptionResult(this.privRequestSession.requestId,e.ResultReason.RecognizingSpeech,l.Text,l.Duration,c,l.Language,l.LanguageDetectionConfidence,void 0,void 0,o.textBody,s),this.privRequestSession.onHypothesis(c);const u=new e.ConversationTranscriptionEventArgs(i,l.Duration,this.privRequestSession.sessionId);if(this.privConversationTranscriber.transcribing)try{this.privConversationTranscriber.transcribing(this.privConversationTranscriber,u)}catch{}a=!0;break;case"speech.phrase":const d=t.SimpleSpeechPhrase.fromJSON(o.textBody),f=t.EnumTranslation.implTranslateRecognitionResult(d.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+d.Offset+d.Duration),e.ResultReason.Canceled===f){const p=t.EnumTranslation.implTranslateCancelResult(d.RecognitionStatus),h=t.EnumTranslation.implTranslateCancelErrorCode(d.RecognitionStatus);await this.cancelRecognitionLocal(p,h,t.EnumTranslation.implTranslateErrorDetails(h))}else if(!(this.privRequestSession.isSpeechEnded&&f===e.ResultReason.NoMatch&&d.RecognitionStatus!==t.RecognitionStatus.InitialSilenceTimeout)){if(this.privRecognizerConfig.parameters.getProperty(t.OutputFormatPropertyName)===e.OutputFormat[e.OutputFormat.Simple])i=new e.ConversationTranscriptionResult(this.privRequestSession.requestId,f,d.DisplayText,d.Duration,d.Offset+this.privRequestSession.currentTurnAudioOffset,d.Language,d.LanguageDetectionConfidence,d.SpeakerId,void 0,o.textBody,s);else{const h=t.DetailedSpeechPhrase.fromJSON(o.textBody),v=h.Offset+this.privRequestSession.currentTurnAudioOffset,y=h.getJsonWithCorrectedOffsets(v);i=new e.ConversationTranscriptionResult(this.privRequestSession.requestId,f,h.RecognitionStatus===t.RecognitionStatus.Success?h.NBest[0].Display:void 0,h.Duration,v,h.Language,h.LanguageDetectionConfidence,d.SpeakerId,void 0,y,s)}const p=new e.ConversationTranscriptionEventArgs(i,i.offset,this.privRequestSession.sessionId);if(this.privConversationTranscriber.transcribed)try{this.privConversationTranscriber.transcribed(this.privConversationTranscriber,p)}catch{}}a=!0;break}return a}cancelRecognition(o,i,s,a,l){if(new e.PropertyCollection().setProperty(t.CancellationErrorCodePropertyName,e.CancellationErrorCode[a]),this.privConversationTranscriber.canceled){const u=new e.ConversationTranscriptionCanceledEventArgs(s,l,a,void 0,o);try{this.privConversationTranscriber.canceled(this.privConversationTranscriber,u)}catch{}}}};return Uu.ConversationTranscriptionServiceRecognizer=r,Uu}var $u={},lE;function PF(){if(lE)return $u;lE=1,Object.defineProperty($u,"__esModule",{value:!0}),$u.TranscriptionServiceRecognizer=void 0;const e=ve(),t=$(),r=ue(),n=hi;let o=class extends r.ConversationServiceRecognizer{constructor(s,a,l,c,u){super(s,a,l,c,u),this.privTranscriberRecognizer=u,this.sendPrePayloadJSONOverride=d=>this.sendTranscriptionStartJSON(d),this.privRecognizerConfig.parameters.getProperty(t.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps)==="true"&&this.privSpeechContext.setWordLevelTimings()}async sendSpeechEventAsync(s,a){if(this.privRequestSession.isRecognizing){const l=await this.fetchConnection();await this.sendSpeechEvent(l,this.createSpeechEventPayload(s,a))}}async sendMeetingSpeechEventAsync(s,a){if(this.privRequestSession.isRecognizing){const l=await this.fetchConnection();await this.sendSpeechEvent(l,this.createMeetingSpeechEventPayload(s,a))}}processTypeSpecificMessages(s){return this.processSpeechMessages(s)}handleRecognizedCallback(s,a,l){try{const c=new t.SpeechRecognitionEventArgs(s,a,l);if(this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer,c),this.privSuccessCallback){try{this.privSuccessCallback(s)}catch(u){this.privErrorCallback&&this.privErrorCallback(u)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}catch{}}handleRecognizingCallback(s,a,l){try{const c=new t.SpeechRecognitionEventArgs(s,a,l);this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer,c)}catch{}}cancelRecognition(s,a,l,c,u){const d=new t.PropertyCollection;if(d.setProperty(r.CancellationErrorCodePropertyName,t.CancellationErrorCode[c]),this.privTranscriberRecognizer.IsMeetingRecognizer()){if(this.privTranscriberRecognizer.canceled){const f=new t.MeetingTranscriptionCanceledEventArgs(l,u,c,void 0,s);try{this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer,f)}catch{}}}else if(this.privTranscriberRecognizer.canceled){const f=new t.ConversationTranscriptionCanceledEventArgs(l,u,c,void 0,s);try{this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer,f)}catch{}}if(this.privSuccessCallback){const f=new t.SpeechRecognitionResult(a,t.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,u,void 0,d);try{this.privSuccessCallback(f),this.privSuccessCallback=void 0}catch{}}}async sendTranscriptionStartJSON(s){if(await this.sendSpeechContext(s,!0),this.privTranscriberRecognizer.IsMeetingRecognizer()){const a=this.privTranscriberRecognizer.getMeetingInfo(),l=this.createMeetingSpeechEventPayload(a,"start");await this.sendSpeechEvent(s,l)}else{const a=this.privTranscriberRecognizer.getConversationInfo(),l=this.createSpeechEventPayload(a,"start");await this.sendSpeechEvent(s,l)}await this.sendWaveHeader(s)}sendSpeechEvent(s,a){const l=JSON.stringify(a);if(l)return s.send(new n.SpeechConnectionMessage(e.MessageType.Text,"speech.event",this.privRequestSession.requestId,"application/json",l))}createSpeechEventPayload(s,a){const l={id:"meeting",name:a,meeting:s.conversationProperties};return l.meeting.id=s.id,l.meeting.attendees=s.participants,l}createMeetingSpeechEventPayload(s,a){const l={id:"meeting",name:a,meeting:s.meetingProperties};return l.meeting.id=s.id,l.meeting.attendees=s.participants,l}};return $u.TranscriptionServiceRecognizer=o,$u}var Wu={},cE;function RF(){if(cE)return Wu;cE=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.DetailedSpeechPhrase=void 0;const e=ue();let t=class n6{constructor(n){this.privDetailedSpeechPhrase=JSON.parse(n),this.privDetailedSpeechPhrase.RecognitionStatus=e.RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(n){return new n6(n)}getJsonWithCorrectedOffsets(n){if(this.privDetailedSpeechPhrase.NBest){let o;for(const i of this.privDetailedSpeechPhrase.NBest)if(i.Words&&i.Words[0]){o=i.Words[0].Offset;break}if(o&&o{if(this.privIntentRecognizer.recognized)try{this.privIntentRecognizer.recognized(this.privIntentRecognizer,a)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(s)}catch(v){this.privErrorCallback&&this.privErrorCallback(v)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}};this.privIntentDataSent===!1||t.ResultReason.NoMatch===a.result.reason?(this.privRequestSession.onPhraseRecognized(a.offset+a.result.duration),p()):this.privPendingIntentArgs=a,l=!0;break;case"response":if(a=this.privPendingIntentArgs,this.privPendingIntentArgs=void 0,a===void 0){if(i.textBody==="")return;a=new t.IntentRecognitionEventArgs(new t.IntentRecognitionResult,0,this.privRequestSession.sessionId)}const h=r.IntentResponse.fromJSON(i.textBody);if(h!==null&&h.topScoringIntent&&h.topScoringIntent.intent){let v=this.privAddedLmIntents[h.topScoringIntent.intent];if(this.privUmbrellaIntent!==void 0&&(v=this.privUmbrellaIntent),v){const y=v===void 0||v.intentName===void 0?h.topScoringIntent.intent:v.intentName;let g=a.result.reason;y!==void 0&&(g=t.ResultReason.RecognizedIntent);const m=a.result.properties!==void 0?a.result.properties:new t.PropertyCollection;m.setProperty(t.PropertyId.LanguageUnderstandingServiceResponse_JsonResult,i.textBody),a=new t.IntentRecognitionEventArgs(new t.IntentRecognitionResult(y,a.result.resultId,g,a.result.text,a.result.duration,a.result.offset,void 0,void 0,a.result.errorDetails,a.result.json,m),a.offset,a.sessionId)}}if(this.privRequestSession.onPhraseRecognized(a.offset+a.result.duration),this.privIntentRecognizer.recognized)try{this.privIntentRecognizer.recognized(this.privIntentRecognizer,a)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(a.result)}catch(v){this.privErrorCallback&&this.privErrorCallback(v)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}l=!0;break}const u=new e.Deferred;return u.resolve(l),u.promise}cancelRecognition(i,s,a,l,c){const u=new t.PropertyCollection;if(u.setProperty(r.CancellationErrorCodePropertyName,t.CancellationErrorCode[l]),this.privIntentRecognizer.canceled){const d=new t.IntentRecognitionCanceledEventArgs(a,c,l,void 0,void 0,i);try{this.privIntentRecognizer.canceled(this.privIntentRecognizer,d)}catch{}}if(this.privSuccessCallback){const d=new t.IntentRecognitionResult(void 0,s,t.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,c,void 0,u);try{this.privSuccessCallback(d),this.privSuccessCallback=void 0}catch{}}}};return Ku.IntentServiceRecognizer=n,Ku}var ov={};Object.defineProperty(ov,"__esModule",{value:!0});ov.IntentResponse=void 0;class yb{constructor(t){t===""?this.privIntentResponse={}:this.privIntentResponse=JSON.parse(t)}static fromJSON(t){return new yb(t)}get query(){return this.privIntentResponse.query}get topScoringIntent(){return this.privIntentResponse.topScoringIntent}get entities(){return this.privIntentResponse.entities}}ov.IntentResponse=yb;var i6={};Object.defineProperty(i6,"__esModule",{value:!0});var iv={},sv={};Object.defineProperty(sv,"__esModule",{value:!0});sv.ServiceTelemetryListener=void 0;const Fo=ve(),fE=Yg;class NF{constructor(t,r,n){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=t,this.privAudioSourceId=r,this.privAudioNodeId=n,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(t){t>0&&this.privPhraseLatencies.push(Date.now()-t)}hypothesisReceived(t){t>0&&this.privHypothesisLatencies.push(Date.now()-t)}onEvent(t){if(!this.privIsDisposed&&(t instanceof fE.RecognitionTriggeredEvent&&t.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:t.eventTime,Name:"ListeningTrigger",Start:t.eventTime}),t instanceof Fo.AudioStreamNodeAttachingEvent&&t.audioSourceId===this.privAudioSourceId&&t.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=t.eventTime),t instanceof Fo.AudioStreamNodeAttachedEvent&&t.audioSourceId===this.privAudioSourceId&&t.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=t.eventTime),t instanceof Fo.AudioSourceErrorEvent&&t.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:t.eventTime,Error:t.error,Name:"Microphone",Start:this.privMicStartTime})),t instanceof Fo.AudioStreamNodeErrorEvent&&t.audioSourceId===this.privAudioSourceId&&t.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:t.eventTime,Error:t.error,Name:"Microphone",Start:this.privMicStartTime})),t instanceof Fo.AudioStreamNodeDetachedEvent&&t.audioSourceId===this.privAudioSourceId&&t.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:t.eventTime,Name:"Microphone",Start:this.privMicStartTime})),t instanceof fE.ConnectingToServiceEvent&&t.requestId===this.privRequestId&&(this.privConnectionId=t.sessionId),t instanceof Fo.ConnectionStartEvent&&t.connectionId===this.privConnectionId&&(this.privConnectionStartTime=t.eventTime),t instanceof Fo.ConnectionEstablishedEvent&&t.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:t.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),t instanceof Fo.ConnectionEstablishErrorEvent&&t.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:t.eventTime,Error:this.getConnectionError(t.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),t instanceof Fo.ConnectionMessageReceivedEvent&&t.connectionId===this.privConnectionId&&t.message&&t.message.headers&&t.message.headers.path)){this.privReceivedMessages[t.message.headers.path]||(this.privReceivedMessages[t.message.headers.path]=new Array);const r=50;this.privReceivedMessages[t.message.headers.path].length0&&t.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&t.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const r={Metrics:t,ReceivedMessages:this.privReceivedMessages},n=JSON.stringify(r);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],n}get hasTelemetry(){return Object.keys(this.privReceivedMessages).length!==0||this.privListeningTriggerMetric!==null||this.privMicMetric!==null||this.privConnectionEstablishMetric!==null||this.privPhraseLatencies.length!==0||this.privHypothesisLatencies.length!==0}dispose(){this.privIsDisposed=!0}getConnectionError(t){switch(t){case 400:case 1002:case 1003:case 1005:case 1007:case 1008:case 1009:return"BadRequest";case 401:return"Unauthorized";case 403:return"Forbidden";case 503:case 1001:return"ServerUnavailable";case 500:case 1011:return"ServerError";case 408:case 504:return"Timeout";default:return"statuscode:"+t.toString()}}}sv.ServiceTelemetryListener=NF;Object.defineProperty(iv,"__esModule",{value:!0});iv.RequestSession=void 0;const Va=ve(),Uf=Yg,BF=sv;class OF{constructor(t){this.privIsDisposed=!1,this.privDetachables=new Array,this.privIsAudioNodeDetached=!1,this.privIsRecognizing=!1,this.privIsSpeechEnded=!1,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privHypothesisReceived=!1,this.privBytesSent=0,this.privRecognitionBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=t,this.privRequestId=Va.createNoDashGuid(),this.privAudioNodeId=Va.createNoDashGuid(),this.privTurnDeferral=new Va.Deferred,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}get recognitionBytesSent(){return this.privRecognitionBytesSent}listenForServiceTelemetry(t){this.privServiceTelemetryListener&&this.privDetachables.push(t.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privRecognitionBytesSent=0,this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new BF.ServiceTelemetryListener(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new Uf.RecognitionTriggeredEvent(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}async onAudioSourceAttachCompleted(t,r){this.privAudioNode=t,this.privIsAudioNodeDetached=!1,r?await this.onComplete():this.onEvent(new Uf.ListeningStartedEvent(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onPreConnectionStart(t,r){this.privAuthFetchEventId=t,this.privSessionId=r,this.onEvent(new Uf.ConnectingToServiceEvent(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}async onAuthCompleted(t){t&&await this.onComplete()}async onConnectionEstablishCompleted(t,r){if(t===200){this.onEvent(new Uf.RecognitionStartedEvent(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privBytesSent=0;return}else t===403&&await this.onComplete()}async onServiceTurnEndResponse(t){this.privTurnDeferral.resolve(),!t||this.isSpeechEnded?(await this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}onSpeechContext(){this.privRequestId=Va.createNoDashGuid()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch(()=>{})),this.privInTurn=!0,this.privTurnDeferral=new Va.Deferred}onHypothesis(t){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(t)))}onPhraseRecognized(t){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(t)),this.onServiceRecognized(t)}onServiceRecognized(t){this.privLastRecoOffset=t,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(t),this.privConnectionAttempts=0}onAudioSent(t){this.privBytesSent+=t,this.privRecognitionBytesSent+=t}onRetryConnection(){this.privConnectionAttempts++}async dispose(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const t of this.privDetachables)await t.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}async onStopRecognizing(){await this.onComplete()}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(t){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(t),Va.Events.instance.onEvent(t)}async onComplete(){this.privIsRecognizing&&(this.privIsRecognizing=!1,await this.detachAudioNode())}async detachAudioNode(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&await this.privAudioNode.detach())}}iv.RequestSession=OF;var av={};Object.defineProperty(av,"__esModule",{value:!0});av.SpeechContext=void 0;class DF{constructor(t){this.privContext={},this.privDynamicGrammar=t}getSection(t){return this.privContext[t]||{}}setSection(t,r){this.privContext[t]=r}setPronunciationAssessmentParams(t,r,n=!1){this.privContext.phraseDetection===void 0&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment===void 0&&(this.privContext.phraseDetection.enrichment={pronunciationAssessment:{}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(t),n&&(this.privContext.phraseDetection.mode="Conversation"),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),this.privContext.phraseOutput.detailed.options.indexOf("SNR")===-1&&this.privContext.phraseOutput.detailed.options.push("SNR"),r&&(this.privContext.phraseDetection.enrichment.contentAssessment={topic:r},this.privContext.phraseOutput.detailed.options.push("ContentAssessment"))}setDetailedOutputFormat(){this.privContext.phraseOutput===void 0&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),this.privContext.phraseOutput.detailed===void 0&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed"}setWordLevelTimings(){this.privContext.phraseOutput===void 0&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),this.privContext.phraseOutput.detailed===void 0&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed",this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")===-1&&this.privContext.phraseOutput.detailed.options.push("WordTimings")}setSpeakerDiarizationAudioOffsetMs(t){this.privContext.phraseDetection.speakerDiarization.audioOffsetMs=t}toJSON(){const t=this.privDynamicGrammar.generateGrammarObject();return this.setSection("dgi",t),JSON.stringify(this.privContext)}}av.SpeechContext=DF;var lv={};Object.defineProperty(lv,"__esModule",{value:!0});lv.DynamicGrammarBuilder=void 0;class MF{addPhrase(t){this.privPhrases||(this.privPhrases=[]),t instanceof Array?this.privPhrases=this.privPhrases.concat(t):this.privPhrases.push(t)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(t){this.privGrammars||(this.privGrammars=[]),t instanceof Array?this.privGrammars=this.privGrammars.concat(t):this.privGrammars.push(t)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(this.privGrammars===void 0&&this.privPhrases===void 0)return;const t={};if(t.ReferenceGrammars=this.privGrammars,this.privPhrases!==void 0&&this.privPhrases.length!==0){const r=[];this.privPhrases.forEach(n=>{r.push({Text:n})}),t.Groups=[{Type:"Generic",Items:r}]}return t}}lv.DynamicGrammarBuilder=MF;var s6={};Object.defineProperty(s6,"__esModule",{value:!0});var Gu={},cv={},uv={},Sb={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MessageDataStreamType=e.ActivityPayloadResponse=void 0;class t{constructor(n){this.privActivityResponse=JSON.parse(n)}static fromJSON(n){return new t(n)}get conversationId(){return this.privActivityResponse.conversationId}get messageDataStreamType(){return this.privActivityResponse.messageDataStreamType}get messagePayload(){return this.privActivityResponse.messagePayload}get version(){return this.privActivityResponse.version}}e.ActivityPayloadResponse=t,function(r){r[r.None=0]="None",r[r.TextToSpeechAudio=1]="TextToSpeechAudio"}(e.MessageDataStreamType||(e.MessageDataStreamType={}))})(Sb);Object.defineProperty(uv,"__esModule",{value:!0});uv.DialogServiceTurnState=void 0;const zF=fs,LF=ar,FF=Sb;class jF{constructor(t,r){this.privRequestId=r,this.privIsCompleted=!1,this.privAudioStream=null,this.privTurnManager=t,this.resetTurnEndTimeout()}get audioStream(){return this.resetTurnEndTimeout(),this.privAudioStream}processActivityPayload(t,r){return t.messageDataStreamType===FF.MessageDataStreamType.TextToSpeechAudio&&(this.privAudioStream=LF.AudioOutputStream.createPullStream(),this.privAudioStream.format=r!==void 0?r:zF.AudioOutputFormatImpl.getDefaultOutputFormat()),this.privAudioStream}endAudioStream(){this.privAudioStream!==null&&!this.privAudioStream.isClosed&&this.privAudioStream.close()}complete(){this.privTimeoutToken!==void 0&&clearTimeout(this.privTimeoutToken),this.endAudioStream()}resetTurnEndTimeout(){this.privTimeoutToken!==void 0&&clearTimeout(this.privTimeoutToken),this.privTimeoutToken=setTimeout(()=>{this.privTurnManager.CompleteTurn(this.privRequestId)},2e3)}}uv.DialogServiceTurnState=jF;Object.defineProperty(cv,"__esModule",{value:!0});cv.DialogServiceTurnStateManager=void 0;const hE=cr,HF=uv;class qF{constructor(){this.privTurnMap=new Map}StartTurn(t){if(this.privTurnMap.has(t))throw new hE.InvalidOperationError("Service error: There is already a turn with id:"+t);const r=new HF.DialogServiceTurnState(this,t);return this.privTurnMap.set(t,r),this.privTurnMap.get(t)}GetTurn(t){return this.privTurnMap.get(t)}CompleteTurn(t){if(!this.privTurnMap.has(t))throw new hE.InvalidOperationError("Service error: Received turn end for an unknown turn id:"+t);const r=this.privTurnMap.get(t);return r.complete(),this.privTurnMap.delete(t),r}}cv.DialogServiceTurnStateManager=qF;var pE;function UF(){if(pE)return Gu;pE=1,Object.defineProperty(Gu,"__esModule",{value:!0}),Gu.DialogServiceAdapter=void 0;const e=Jt(),t=ya,r=ve(),n=fs,o=$(),i=cv,s=ue(),a=Sb,l=hi;let c=class extends s.ServiceRecognizerBase{constructor(d,f,p,h,v){super(d,f,p,h,v),this.privEvents=new r.EventSource,this.privDialogServiceConnector=v,this.receiveMessageOverride=()=>this.receiveDialogMessageOverride(),this.privTurnStateManager=new i.DialogServiceTurnStateManager,this.recognizeOverride=(y,g,m)=>this.listenOnce(y,g,m),this.postConnectImplOverride=y=>this.dialogConnectImpl(y),this.configConnectionOverride=y=>this.configConnection(y),this.disconnectOverride=()=>this.privDisconnect(),this.privDialogAudioSource=p,this.agentConfigSent=!1,this.privLastResult=null,this.connectionEvents.attach(y=>{y.name==="ConnectionClosedEvent"&&(this.terminateMessageLoop=!0)})}async sendMessage(d){const f=r.createGuid(),p=r.createNoDashGuid(),h={context:{interactionId:f},messagePayload:JSON.parse(d),version:.5},v=JSON.stringify(h);await(await this.fetchConnection()).send(new l.SpeechConnectionMessage(r.MessageType.Text,"agent",p,"application/json",v))}async privDisconnect(){await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,o.CancellationReason.Error,o.CancellationErrorCode.NoError,"Disconnecting"),this.terminateMessageLoop=!0,this.agentConfigSent=!1}processTypeSpecificMessages(d){const f=new o.PropertyCollection;d.messageType===r.MessageType.Text&&f.setProperty(o.PropertyId.SpeechServiceResponse_JsonResult,d.textBody);let p,h;switch(d.path.toLowerCase()){case"speech.phrase":const y=s.SimpleSpeechPhrase.fromJSON(d.textBody);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+y.Offset+y.Duration),y.RecognitionStatus!==s.RecognitionStatus.TooManyRequests&&y.RecognitionStatus!==s.RecognitionStatus.Error){const E=this.fireEventForResult(y,f);if(this.privLastResult=E.result,this.privDialogServiceConnector.recognized)try{this.privDialogServiceConnector.recognized(this.privDialogServiceConnector,E)}catch{}}h=!0;break;case"speech.hypothesis":const g=s.SpeechHypothesis.fromJSON(d.textBody),m=g.Offset+this.privRequestSession.currentTurnAudioOffset;p=new o.SpeechRecognitionResult(this.privRequestSession.requestId,o.ResultReason.RecognizingSpeech,g.Text,g.Duration,m,g.Language,g.LanguageDetectionConfidence,void 0,void 0,d.textBody,f),this.privRequestSession.onHypothesis(m);const b=new o.SpeechRecognitionEventArgs(p,g.Duration,this.privRequestSession.sessionId);if(this.privDialogServiceConnector.recognizing)try{this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector,b)}catch{}h=!0;break;case"speech.keyword":const C=s.SpeechKeyword.fromJSON(d.textBody);p=new o.SpeechRecognitionResult(this.privRequestSession.requestId,C.Status==="Accepted"?o.ResultReason.RecognizedKeyword:o.ResultReason.NoMatch,C.Text,C.Duration,C.Offset,void 0,void 0,void 0,void 0,d.textBody,f),C.Status!=="Accepted"&&(this.privLastResult=p);const k=new o.SpeechRecognitionEventArgs(p,p.duration,p.resultId);if(this.privDialogServiceConnector.recognized)try{this.privDialogServiceConnector.recognized(this.privDialogServiceConnector,k)}catch{}h=!0;break;case"audio":{const E=d.requestId.toUpperCase(),w=this.privTurnStateManager.GetTurn(E);try{d.binaryBody?w.audioStream.write(d.binaryBody):w.endAudioStream()}catch{}}h=!0;break;case"response":this.handleResponseMessage(d),h=!0;break}const v=new r.Deferred;return v.resolve(h),v.promise}async cancelRecognition(d,f,p,h,v){if(this.terminateMessageLoop=!0,this.privRequestSession.isRecognizing&&await this.privRequestSession.onStopRecognizing(),this.privDialogServiceConnector.canceled){const y=new o.PropertyCollection;y.setProperty(s.CancellationErrorCodePropertyName,o.CancellationErrorCode[h]);const g=new o.SpeechRecognitionCanceledEventArgs(p,v,h,void 0,d);try{this.privDialogServiceConnector.canceled(this.privDialogServiceConnector,g)}catch{}if(this.privSuccessCallback){const m=new o.SpeechRecognitionResult(void 0,o.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,v,void 0,y);try{this.privSuccessCallback(m),this.privSuccessCallback=void 0}catch{}}}}async listenOnce(d,f,p){this.privRecognizerConfig.recognitionMode=d,this.privSuccessCallback=f,this.privErrorCallback=p,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privDialogAudioSource.events),this.privRecognizerConfig.parameters.setProperty(o.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const h=this.connectImpl(),v=this.sendPreAudioMessages(),y=await this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId),g=await this.privDialogAudioSource.format,m=await this.privDialogAudioSource.deviceInfo,b=new e.ReplayableAudioNode(y,g.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(b,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:m};try{await h,await v}catch(E){return await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,o.CancellationReason.Error,o.CancellationErrorCode.ConnectionFailure,E),Promise.resolve()}const C=new o.SessionEventArgs(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,C),this.sendAudio(b).then(()=>{},async E=>{await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,o.CancellationReason.Error,o.CancellationErrorCode.RuntimeError,E)})}dialogConnectImpl(d){return this.privConnectionLoop=this.startMessageLoop(),d}receiveDialogMessageOverride(){const d=new r.Deferred,f=async()=>{try{const p=this.isDisposed(),h=!this.isDisposed()&&this.terminateMessageLoop;if(p||h){d.resolve(void 0);return}const y=await(await this.fetchConnection()).read();if(!y)return f();const g=l.SpeechConnectionMessage.fromConnectionMessage(y);switch(g.path.toLowerCase()){case"turn.start":{const A=g.requestId.toUpperCase(),D=this.privRequestSession.requestId.toUpperCase();A!==D?this.privTurnStateManager.StartTurn(A):this.privRequestSession.onServiceTurnStartResponse()}break;case"speech.startdetected":const b=s.SpeechDetected.fromJSON(g.textBody),C=new o.RecognitionEventArgs(b.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,C);break;case"speech.enddetected":let k;g.textBody.length>0?k=g.textBody:k="{ Offset: 0 }";const E=s.SpeechDetected.fromJSON(k);this.privRequestSession.onServiceRecognized(E.Offset+this.privRequestSession.currentTurnAudioOffset);const w=new o.RecognitionEventArgs(E.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,w);break;case"turn.end":{const A=g.requestId.toUpperCase(),D=this.privRequestSession.requestId.toUpperCase();if(A!==D)this.privTurnStateManager.CompleteTurn(A);else{const I=new o.SessionEventArgs(this.privRequestSession.sessionId);if(await this.privRequestSession.onServiceTurnEndResponse(!1),(!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)&&this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,I),this.privSuccessCallback&&this.privLastResult){try{this.privSuccessCallback(this.privLastResult),this.privLastResult=null}catch(M){this.privErrorCallback&&this.privErrorCallback(M)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}}break;default:try{await this.processTypeSpecificMessages(g)||this.serviceEvents&&this.serviceEvents.onEvent(new r.ServiceEvent(g.path.toLowerCase(),g.textBody))}catch{}}return f()}catch{this.terminateMessageLoop=!0,d.resolve()}};return f().catch(p=>{r.Events.instance.onEvent(new r.BackgroundEvent(p))}),d.promise}async startMessageLoop(){this.terminateMessageLoop=!1;try{await this.receiveDialogMessageOverride()}catch(d){await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,o.CancellationReason.Error,o.CancellationErrorCode.RuntimeError,d)}return Promise.resolve()}async configConnection(d){return this.terminateMessageLoop?(this.terminateMessageLoop=!1,Promise.reject("Connection to service terminated.")):(await this.sendSpeechServiceConfig(d,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),await this.sendAgentConfig(d),d)}async sendPreAudioMessages(){const d=await this.fetchConnection();this.addKeywordContextData(),await this.sendSpeechContext(d,!0),await this.sendAgentContext(d),await this.sendWaveHeader(d)}sendAgentConfig(d){if(this.agentConfig&&!this.agentConfigSent){if(this.privRecognizerConfig.parameters.getProperty(o.PropertyId.Conversation_DialogType)===o.DialogServiceConfig.DialogTypes.CustomCommands){const p=this.agentConfig.get();p.botInfo.commandsCulture=this.privRecognizerConfig.parameters.getProperty(o.PropertyId.SpeechServiceConnection_RecoLanguage,"en-us"),this.agentConfig.set(p)}this.onEvent(new t.SendingAgentContextMessageEvent(this.agentConfig));const f=this.agentConfig.toJsonString();return this.agentConfigSent=!0,d.send(new l.SpeechConnectionMessage(r.MessageType.Text,"agent.config",this.privRequestSession.requestId,"application/json",f))}}sendAgentContext(d){const f=r.createGuid(),p=this.privDialogServiceConnector.properties.getProperty(o.PropertyId.Conversation_Speech_Activity_Template),v=JSON.stringify({channelData:"",context:{interactionId:f},messagePayload:typeof p===void 0?void 0:p,version:.5});return d.send(new l.SpeechConnectionMessage(r.MessageType.Text,"speech.agent.context",this.privRequestSession.requestId,"application/json",v))}fireEventForResult(d,f){const p=s.EnumTranslation.implTranslateRecognitionResult(d.RecognitionStatus),h=d.Offset+this.privRequestSession.currentTurnAudioOffset,v=new o.SpeechRecognitionResult(this.privRequestSession.requestId,p,d.DisplayText,d.Duration,h,d.Language,d.LanguageDetectionConfidence,void 0,void 0,JSON.stringify(d),f);return new o.SpeechRecognitionEventArgs(v,h,this.privRequestSession.sessionId)}handleResponseMessage(d){const f=JSON.parse(d.textBody);switch(f.messageType.toLowerCase()){case"message":const p=d.requestId.toUpperCase(),h=a.ActivityPayloadResponse.fromJSON(d.textBody),v=this.privTurnStateManager.GetTurn(p);if(h.conversationId){const m=this.agentConfig.get();m.botInfo.conversationId=h.conversationId,this.agentConfig.set(m)}const y=v.processActivityPayload(h,n.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(this.privDialogServiceConnector.properties.getProperty(o.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0))),g=new o.ActivityReceivedEventArgs(h.messagePayload,y);if(this.privDialogServiceConnector.activityReceived)try{this.privDialogServiceConnector.activityReceived(this.privDialogServiceConnector,g)}catch{}break;case"messagestatus":if(this.privDialogServiceConnector.turnStatusReceived)try{this.privDialogServiceConnector.turnStatusReceived(this.privDialogServiceConnector,new o.TurnStatusReceivedEventArgs(d.textBody))}catch{}break;default:r.Events.instance.onEvent(new r.BackgroundEvent(`Unexpected response of type ${f.messageType}. Ignoring.`));break}}onEvent(d){this.privEvents.onEvent(d),r.Events.instance.onEvent(d)}addKeywordContextData(){const d=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect");if(d===void 0)return;const f=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Offsets"),p=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Durations"),h=d.split(";"),v=f===void 0?[]:f.split(";"),y=p===void 0?[]:p.split(";"),g=[];for(let m=0;m{const E=e.RestMessageAdapter.extractHeaderValue(this.privRequestParams.requestId,k.headers);if(!k.ok){if(c){let A=this.privErrors.invalidCreateJoinConversationResponse.replace("{status}",k.status.toString()),D;try{D=JSON.parse(k.data),A+=` [${D.error.code}: ${D.error.message}]`}catch{A+=` [${k.data}]`}E&&(A+=` ${E}`),c(A)}return}const w=JSON.parse(k.data);if(w&&(w.requestId=E),l){try{l(w)}catch(A){c&&c(A)}l=void 0}}).catch(()=>{})}catch(u){if(c)if(u instanceof Error){const d=u;c(d.name+": "+d.message)}else c(u)}}leave(s,a){return new Promise((l,c)=>{try{t.Contracts.throwIfNullOrUndefined(s,this.privErrors.invalidArgs.replace("{arg}","config")),t.Contracts.throwIfNullOrWhitespace(a,this.privErrors.invalidArgs.replace("{arg}","token"));const u=s.getProperty(r.PropertyId.ConversationTranslator_Host,this.privHost),d=s.getProperty(r.PropertyId.ConversationTranslator_CorrelationId),f={};f[this.privRequestParams.apiVersion]=this.privApiVersion,f[this.privRequestParams.sessionToken]=a;const p={};d&&(p[this.privRequestParams.correlationId]=d);const h={};h.headers=p,this.privRestAdapter.options=h;const v=`https://${u}${this.privRestPath}`;this.privRestAdapter.request(e.RestRequestType.Delete,v,f,null).then(y=>{y.ok,l()}).catch(()=>{})}catch(u){if(u instanceof Error){const d=u;c(d.name+": "+d.message)}else c(u)}})}};return Qu.ConversationManager=o,Qu}var Ds={},Xu={},fv={},K1={};Object.defineProperty(K1,"__esModule",{value:!0});K1.ConversationConnectionMessage=void 0;const KF=ve();class GF extends KF.ConnectionMessage{constructor(t,r,n,o){super(t,r,n,o);const i=JSON.parse(this.textBody);i.type!==void 0&&(this.privConversationMessageType=i.type)}get conversationMessageType(){return this.privConversationMessageType}}K1.ConversationConnectionMessage=GF;Object.defineProperty(fv,"__esModule",{value:!0});fv.ConversationWebsocketMessageFormatter=void 0;const Ms=ve(),vE=K1;class QF{toConnectionMessage(t){const r=new Ms.Deferred;try{if(t.messageType===Ms.MessageType.Text){const n=new vE.ConversationConnectionMessage(t.messageType,t.textContent,{},t.id);r.resolve(n)}else t.messageType===Ms.MessageType.Binary&&r.resolve(new vE.ConversationConnectionMessage(t.messageType,t.binaryContent,void 0,t.id))}catch(n){r.reject(`Error formatting the message. Error: ${n}`)}return r.promise}fromConnectionMessage(t){const r=new Ms.Deferred;try{if(t.messageType===Ms.MessageType.Text){const n=`${t.textBody?t.textBody:""}`;r.resolve(new Ms.RawWebsocketMessage(Ms.MessageType.Text,n,t.id))}}catch(n){r.reject(`Error formatting the message. ${n}`)}return r.promise}}fv.ConversationWebsocketMessageFormatter=QF;var mE;function XF(){if(mE)return Xu;mE=1,Object.defineProperty(Xu,"__esModule",{value:!0}),Xu.ConversationConnectionFactory=void 0;const e=Jt(),t=ve(),r=Ce,n=$(),o=ao(),i=rc,s=fv;let a=class extends o.ConnectionFactoryBase{create(c,u,d){const f=c.parameters.getProperty(n.PropertyId.ConversationTranslator_Host,i.ConversationConnectionConfig.host),p=c.parameters.getProperty(n.PropertyId.ConversationTranslator_CorrelationId,t.createGuid()),h=`wss://${f}${i.ConversationConnectionConfig.webSocketPath}`,v=c.parameters.getProperty(n.PropertyId.ConversationTranslator_Token,void 0);r.Contracts.throwIfNullOrUndefined(v,"token");const y={};y[i.ConversationConnectionConfig.configParams.apiVersion]=i.ConversationConnectionConfig.apiVersion,y[i.ConversationConnectionConfig.configParams.token]=v,y[i.ConversationConnectionConfig.configParams.correlationId]=p;const g=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new e.WebsocketConnection(h,y,{},new s.ConversationWebsocketMessageFormatter,e.ProxyInfo.fromRecognizerConfig(c),g,d)}};return Xu.ConversationConnectionFactory=a,Xu}var Yu={},hv={};Object.defineProperty(hv,"__esModule",{value:!0});hv.ConversationRequestSession=void 0;const u0=ve();class YF{constructor(t){this.privIsDisposed=!1,this.privDetachables=new Array,this.privSessionId=t,this.privRequestId=u0.createNoDashGuid(),this.privRequestCompletionDeferral=new u0.Deferred}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get completionPromise(){return this.privRequestCompletionDeferral.promise}onPreConnectionStart(t,r){this.privSessionId=r}onAuthCompleted(t){t&&this.onComplete()}onConnectionEstablishCompleted(t){t!==200&&t===403&&this.onComplete()}onServiceTurnEndResponse(t){t?this.privRequestId=u0.createNoDashGuid():this.onComplete()}async dispose(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const t of this.privDetachables)await t.detach()}}onComplete(){}}hv.ConversationRequestSession=YF;var Ir={},yE;function a6(){if(yE)return Ir;yE=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.ConversationReceivedTranslationEventArgs=Ir.ParticipantsListEventArgs=Ir.ParticipantAttributeEventArgs=Ir.ParticipantEventArgs=Ir.LockRoomEventArgs=Ir.MuteAllEventArgs=void 0;const e=$();class t extends e.SessionEventArgs{constructor(l,c){super(c),this.privIsMuted=l}get isMuted(){return this.privIsMuted}}Ir.MuteAllEventArgs=t;class r extends e.SessionEventArgs{constructor(l,c){super(c),this.privIsLocked=l}get isMuted(){return this.privIsLocked}}Ir.LockRoomEventArgs=r;class n extends e.SessionEventArgs{constructor(l,c){super(c),this.privParticipant=l}get participant(){return this.privParticipant}}Ir.ParticipantEventArgs=n;class o extends e.SessionEventArgs{constructor(l,c,u,d){super(d),this.privKey=c,this.privValue=u,this.privParticipantId=l}get value(){return this.privValue}get key(){return this.privKey}get id(){return this.privParticipantId}}Ir.ParticipantAttributeEventArgs=o;class i extends e.SessionEventArgs{constructor(l,c,u,d,f,p,h,v,y){super(y),this.privRoomId=l,this.privSessionToken=c,this.privTranslateTo=u,this.privProfanityFilter=d,this.privRoomProfanityFilter=f,this.privIsRoomLocked=p,this.privIsRoomLocked=h,this.privParticipants=v}get sessionToken(){return this.privSessionToken}get conversationId(){return this.privRoomId}get translateTo(){return this.privTranslateTo}get profanityFilter(){return this.privProfanityFilter}get roomProfanityFilter(){return this.privRoomProfanityFilter}get isRoomLocked(){return this.privIsRoomLocked}get isMuteAll(){return this.privIsMuteAll}get participants(){return this.privParticipants}}Ir.ParticipantsListEventArgs=i;class s{constructor(l,c,u){this.privPayload=c,this.privCommand=l,this.privSessionId=u}get payload(){return this.privPayload}get command(){return this.privCommand}get sessionId(){return this.privSessionId}}return Ir.ConversationReceivedTranslationEventArgs=s,Ir}var Jo={};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.ConversationTranslatorCommandTypes=Jo.ConversationTranslatorMessageTypes=Jo.InternalParticipants=void 0;class JF{constructor(t=[],r){this.participants=t,this.meId=r}addOrUpdateParticipant(t){if(t===void 0)return;const r=this.getParticipantIndex(t.id);return r>-1?this.participants.splice(r,1,t):this.participants.push(t),this.getParticipant(t.id)}getParticipantIndex(t){return this.participants.findIndex(r=>r.id===t)}getParticipant(t){return this.participants.find(r=>r.id===t)}deleteParticipant(t){this.participants=this.participants.filter(r=>r.id!==t)}get host(){return this.participants.find(t=>t.isHost===!0)}get me(){return this.getParticipant(this.meId)}}Jo.InternalParticipants=JF;Jo.ConversationTranslatorMessageTypes={command:"command",final:"final",info:"info",instantMessage:"instant_message",keepAlive:"keep_alive",partial:"partial",participantCommand:"participant_command",translatedMessage:"translated_message"};Jo.ConversationTranslatorCommandTypes={changeNickname:"ChangeNickname",disconnectSession:"DisconnectSession",ejectParticipant:"EjectParticipant",instant_message:"instant_message",joinSession:"JoinSession",leaveSession:"LeaveSession",participantList:"ParticipantList",roomExpirationWarning:"RoomExpirationWarning",setLockState:"SetLockState",setMute:"SetMute",setMuteAll:"SetMuteAll",setProfanityFiltering:"SetProfanityFiltering",setTranslateToLanguages:"SetTranslateToLanguages",setUseTTS:"SetUseTTS"};var l6={},pv={};Object.defineProperty(pv,"__esModule",{value:!0});pv.CommandResponsePayload=void 0;const ZF=e=>JSON.parse(e);class bb{constructor(t){this.privCommandResponse=ZF(t)}get type(){return this.privCommandResponse.type}get command(){return this.privCommandResponse.command}get id(){return this.privCommandResponse.id}get nickname(){return this.privCommandResponse.nickname}get participantId(){return this.privCommandResponse.participantId}get roomid(){return this.privCommandResponse.roomid}get value(){return this.privCommandResponse.value}get token(){return this.privCommandResponse.token}static fromJSON(t){return new bb(t)}}pv.CommandResponsePayload=bb;var Fl={};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.ParticipantPayloadResponse=Fl.ParticipantsListPayloadResponse=void 0;const ej=e=>JSON.parse(e),tj=e=>JSON.parse(e);class Cb{constructor(t){this.privParticipantsPayloadResponse=ej(t)}get roomid(){return this.privParticipantsPayloadResponse.roomid}get id(){return this.privParticipantsPayloadResponse.id}get command(){return this.privParticipantsPayloadResponse.command}get participants(){return this.privParticipantsPayloadResponse.participants}get token(){return this.privParticipantsPayloadResponse.token}get translateTo(){return this.privParticipantsPayloadResponse.translateTo}get profanityFilter(){return this.privParticipantsPayloadResponse.profanityFilter}get roomProfanityFilter(){return this.privParticipantsPayloadResponse.roomProfanityFilter}get roomLocked(){return this.privParticipantsPayloadResponse.roomLocked}get muteAll(){return this.privParticipantsPayloadResponse.muteAll}get type(){return this.privParticipantsPayloadResponse.type}static fromJSON(t){return new Cb(t)}}Fl.ParticipantsListPayloadResponse=Cb;class Tb{constructor(t){this.privParticipantPayloadResponse=tj(t)}get nickname(){return this.privParticipantPayloadResponse.nickname}get locale(){return this.privParticipantPayloadResponse.locale}get usetts(){return this.privParticipantPayloadResponse.usetts}get ismuted(){return this.privParticipantPayloadResponse.ismuted}get ishost(){return this.privParticipantPayloadResponse.ishost}get participantId(){return this.privParticipantPayloadResponse.participantId}get avatar(){return this.privParticipantPayloadResponse.avatar}static fromJSON(t){return new Tb(t)}}Fl.ParticipantPayloadResponse=Tb;var jl={};Object.defineProperty(jl,"__esModule",{value:!0});jl.TextResponsePayload=jl.SpeechResponsePayload=void 0;const rj=e=>JSON.parse(e),nj=e=>JSON.parse(e);class Eb{constructor(t){this.privSpeechResponse=rj(t)}get recognition(){return this.privSpeechResponse.recognition}get translations(){return this.privSpeechResponse.translations}get id(){return this.privSpeechResponse.id}get language(){return this.privSpeechResponse.language}get nickname(){return this.privSpeechResponse.nickname}get participantId(){return this.privSpeechResponse.participantId}get roomid(){return this.privSpeechResponse.roomid}get timestamp(){return this.privSpeechResponse.timestamp}get type(){return this.privSpeechResponse.type}get isFinal(){return this.privSpeechResponse.type==="final"}static fromJSON(t){return new Eb(t)}}jl.SpeechResponsePayload=Eb;class wb{constructor(t){this.privTextResponse=nj(t)}get originalText(){return this.privTextResponse.originalText}get translations(){return this.privTextResponse.translations}get id(){return this.privTextResponse.id}get language(){return this.privTextResponse.language}get nickname(){return this.privTextResponse.nickname}get participantId(){return this.privTextResponse.participantId}get roomid(){return this.privTextResponse.roomid}get timestamp(){return this.privTextResponse.timestamp}get type(){return this.privTextResponse.type}static fromJSON(t){return new wb(t)}}jl.TextResponsePayload=wb;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=pv;Object.defineProperty(e,"CommandResponsePayload",{enumerable:!0,get:function(){return t.CommandResponsePayload}});var r=Fl;Object.defineProperty(e,"ParticipantsListPayloadResponse",{enumerable:!0,get:function(){return r.ParticipantsListPayloadResponse}}),Object.defineProperty(e,"ParticipantPayloadResponse",{enumerable:!0,get:function(){return r.ParticipantPayloadResponse}});var n=jl;Object.defineProperty(e,"SpeechResponsePayload",{enumerable:!0,get:function(){return n.SpeechResponsePayload}}),Object.defineProperty(e,"TextResponsePayload",{enumerable:!0,get:function(){return n.TextResponsePayload}})})(l6);var SE;function oj(){if(SE)return Yu;SE=1,Object.defineProperty(Yu,"__esModule",{value:!0}),Yu.ConversationServiceAdapter=void 0;const e=ve(),t=$(),r=ue(),n=K1,o=hv,i=a6(),s=Jo,a=l6;let l=class extends r.ServiceRecognizerBase{constructor(u,d,f,p,h){super(u,d,f,p,h),this.privConnectionConfigPromise=void 0,this.privLastPartialUtteranceId="",this.privConversationServiceConnector=h,this.privConversationAuthentication=u,this.receiveMessageOverride=()=>this.receiveConversationMessageOverride(),this.recognizeOverride=()=>this.noOp(),this.postConnectImplOverride=v=>this.conversationConnectImpl(v),this.configConnectionOverride=()=>this.configConnection(),this.disconnectOverride=()=>this.privDisconnect(),this.privConversationRequestSession=new o.ConversationRequestSession(e.createNoDashGuid()),this.privConversationConnectionFactory=d,this.privConversationIsDisposed=!1}isDisposed(){return super.isDisposed()||this.privConversationIsDisposed}async dispose(u){this.privConversationIsDisposed=!0,this.privConnectionConfigPromise!==void 0&&await(await this.privConnectionConfigPromise).dispose(u),await super.dispose(u)}async sendMessage(u){return(await this.fetchConnection()).send(new n.ConversationConnectionMessage(e.MessageType.Text,u))}async sendMessageAsync(u){await(await this.fetchConnection()).send(new n.ConversationConnectionMessage(e.MessageType.Text,u))}privDisconnect(){if(!this.terminateMessageLoop)return this.cancelRecognition(this.privConversationRequestSession.sessionId,this.privConversationRequestSession.requestId,t.CancellationReason.Error,t.CancellationErrorCode.NoError,"Disconnecting"),this.terminateMessageLoop=!0,Promise.resolve()}async processTypeSpecificMessages(){return!0}cancelRecognition(u,d,f,p,h){this.terminateMessageLoop=!0;const v=new t.ConversationTranslationCanceledEventArgs(f,h,p,void 0,u);try{this.privConversationServiceConnector.canceled&&this.privConversationServiceConnector.canceled(this.privConversationServiceConnector,v)}catch{}}async conversationConnectImpl(u){return this.privConnectionLoop=this.startMessageLoop(),u}async receiveConversationMessageOverride(){if(this.isDisposed()||this.terminateMessageLoop)return Promise.resolve();const u=new e.Deferred;try{const f=await(await this.fetchConnection()).read();if(this.isDisposed()||this.terminateMessageLoop)return u.resolve(),Promise.resolve();if(!f)return this.receiveConversationMessageOverride();const p=this.privConversationRequestSession.sessionId,h=f.conversationMessageType.toLowerCase();let v=!1;try{switch(h){case"info":case"participant_command":case"command":const y=a.CommandResponsePayload.fromJSON(f.textBody);switch(y.command.toLowerCase()){case"participantlist":const E=a.ParticipantsListPayloadResponse.fromJSON(f.textBody),w=E.participants.map(F=>({avatar:F.avatar,displayName:F.nickname,id:F.participantId,isHost:F.ishost,isMuted:F.ismuted,isUsingTts:F.usetts,preferredLanguage:F.locale}));this.privConversationServiceConnector.participantsListReceived&&this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector,new i.ParticipantsListEventArgs(E.roomid,E.token,E.translateTo,E.profanityFilter,E.roomProfanityFilter,E.roomLocked,E.muteAll,w,p));break;case"settranslatetolanguages":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new i.ParticipantAttributeEventArgs(y.participantId,s.ConversationTranslatorCommandTypes.setTranslateToLanguages,y.value,p));break;case"setprofanityfiltering":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new i.ParticipantAttributeEventArgs(y.participantId,s.ConversationTranslatorCommandTypes.setProfanityFiltering,y.value,p));break;case"setmute":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new i.ParticipantAttributeEventArgs(y.participantId,s.ConversationTranslatorCommandTypes.setMute,y.value,p));break;case"setmuteall":this.privConversationServiceConnector.muteAllCommandReceived&&this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector,new i.MuteAllEventArgs(y.value,p));break;case"roomexpirationwarning":this.privConversationServiceConnector.conversationExpiration&&this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector,new t.ConversationExpirationEventArgs(y.value,this.privConversationRequestSession.sessionId));break;case"setusetts":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new i.ParticipantAttributeEventArgs(y.participantId,s.ConversationTranslatorCommandTypes.setUseTTS,y.value,p));break;case"setlockstate":this.privConversationServiceConnector.lockRoomCommandReceived&&this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector,new i.LockRoomEventArgs(y.value,p));break;case"changenickname":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new i.ParticipantAttributeEventArgs(y.participantId,s.ConversationTranslatorCommandTypes.changeNickname,y.value,p));break;case"joinsession":const A=a.ParticipantPayloadResponse.fromJSON(f.textBody),D={avatar:A.avatar,displayName:A.nickname,id:A.participantId,isHost:A.ishost,isMuted:A.ismuted,isUsingTts:A.usetts,preferredLanguage:A.locale};this.privConversationServiceConnector.participantJoinCommandReceived&&this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector,new i.ParticipantEventArgs(D,p));break;case"leavesession":const I={id:y.participantId};this.privConversationServiceConnector.participantLeaveCommandReceived&&this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector,new i.ParticipantEventArgs(I,p));break;case"disconnectsession":const M={id:y.participantId};break;case"token":const B=new r.CognitiveTokenAuthentication(()=>{const F=y.token;return Promise.resolve(F)},()=>{const F=y.token;return Promise.resolve(F)});this.authentication=B,this.privConversationServiceConnector.onToken(B);break;default:break}break;case"partial":case"final":const g=a.SpeechResponsePayload.fromJSON(f.textBody),m=h==="final"?t.ResultReason.TranslatedParticipantSpeech:t.ResultReason.TranslatingParticipantSpeech,b=new t.ConversationTranslationResult(g.participantId,this.getTranslations(g.translations),g.language,g.id,m,g.recognition,void 0,void 0,f.textBody,void 0);g.isFinal?((b.text!==void 0&&b.text.length>0||g.id===this.privLastPartialUtteranceId)&&(v=!0),v&&this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new i.ConversationReceivedTranslationEventArgs(s.ConversationTranslatorMessageTypes.final,b,p))):b.text!==void 0&&(this.privLastPartialUtteranceId=g.id,this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new i.ConversationReceivedTranslationEventArgs(s.ConversationTranslatorMessageTypes.partial,b,p)));break;case"translated_message":const C=a.TextResponsePayload.fromJSON(f.textBody),k=new t.ConversationTranslationResult(C.participantId,this.getTranslations(C.translations),C.language,void 0,void 0,C.originalText,void 0,void 0,void 0,f.textBody,void 0);this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new i.ConversationReceivedTranslationEventArgs(s.ConversationTranslatorMessageTypes.instantMessage,k,p));break;default:break}}catch{}return this.receiveConversationMessageOverride()}catch{this.terminateMessageLoop=!0}return u.promise}async startMessageLoop(){if(this.isDisposed())return Promise.resolve();this.terminateMessageLoop=!1;const u=this.receiveConversationMessageOverride();try{return await u}catch(d){return this.cancelRecognition(this.privRequestSession?this.privRequestSession.sessionId:"",this.privRequestSession?this.privRequestSession.requestId:"",t.CancellationReason.Error,t.CancellationErrorCode.RuntimeError,d),null}}configConnection(){return this.isDisposed()?Promise.resolve(void 0):this.privConnectionConfigPromise!==void 0?this.privConnectionConfigPromise.then(u=>u.state()===e.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigPromise=void 0,this.configConnection()):this.privConnectionConfigPromise,()=>(this.privConnectionId=null,this.privConnectionConfigPromise=void 0,this.configConnection())):this.terminateMessageLoop?Promise.resolve(void 0):(this.privConnectionConfigPromise=this.connectImpl().then(u=>u),this.privConnectionConfigPromise)}getTranslations(u){let d;if(u!==void 0){d=new t.Translations;for(const f of u)d.set(f.lang,f.translation)}return d}};return Yu.ConversationServiceAdapter=l,Yu}var bE;function ij(){if(bE)return Ds;bE=1,Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.ConversationTranslatorRecognizer=Ds.ConversationRecognizerFactory=void 0;const e=ue(),t=ve(),r=Ce,n=$(),o=XF(),i=oj();class s{static fromConfig(c,u,d){return new a(c,u,d)}}Ds.ConversationRecognizerFactory=s;let a=class extends n.Recognizer{constructor(c,u,d){const f=u;r.Contracts.throwIfNull(f,"speechConfig");const p=c;r.Contracts.throwIfNull(p,"conversationImpl"),super(d,f.properties,new o.ConversationConnectionFactory),this.privConversation=p,this.privIsDisposed=!1,this.privProperties=f.properties.clone(),this.privConnection=n.Connection.fromRecognizer(this),this.privProperties.getProperty(n.PropertyId.WebWorkerLoadType,"on").toLowerCase()==="on"&&typeof Blob<"u"&&typeof Worker<"u"?(this.privSetTimeout=t.Timeout.setTimeout,this.privClearTimeout=t.Timeout.clearTimeout):typeof window<"u"?(this.privSetTimeout=window.setTimeout.bind(window),this.privClearTimeout=window.clearTimeout.bind(window)):(this.privSetTimeout=setTimeout,this.privClearTimeout=clearTimeout)}set connected(c){this.privConnection.connected=c}set disconnected(c){this.privConnection.disconnected=c}get speechRecognitionLanguage(){return this.privSpeechRecognitionLanguage}get properties(){return this.privProperties}isDisposed(){return this.privIsDisposed}connect(c,u,d){try{r.Contracts.throwIfDisposed(this.privIsDisposed),r.Contracts.throwIfNullOrWhitespace(c,"token"),this.privReco.conversationTranslatorToken=c,this.resetConversationTimeout(),this.privReco.connectAsync(u,d)}catch(f){if(d)if(f instanceof Error){const p=f;d(p.name+": "+p.message)}else d(f)}}disconnect(c,u){try{r.Contracts.throwIfDisposed(this.privIsDisposed),this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privReco.disconnect().then(()=>{c&&c()},d=>{u&&u(d)})}catch(d){if(u)if(d instanceof Error){const f=d;u(f.name+": "+f.message)}else u(d);this.dispose(!0).catch(f=>{t.Events.instance.onEvent(new t.BackgroundEvent(f))})}}sendRequest(c,u,d){try{r.Contracts.throwIfDisposed(this.privIsDisposed),this.sendMessage(c,u,d)}catch(f){if(d)if(f instanceof Error){const p=f;d(p.name+": "+p.message)}else d(f);this.dispose(!0).catch(p=>{t.Events.instance.onEvent(new t.BackgroundEvent(p))})}}onToken(c){this.privConversation.onToken(c)}async close(){this.privIsDisposed||(this.privConnection&&(this.privConnection.closeConnection(),this.privConnection.close()),this.privConnection=void 0,await this.dispose(!0))}async dispose(c){this.privIsDisposed||c&&(this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privIsDisposed=!0,this.privConnection&&(this.privConnection.closeConnection(),this.privConnection.close(),this.privConnection=void 0),await super.dispose(c))}createRecognizerConfig(c){return new e.RecognizerConfig(c,this.privProperties)}createServiceRecognizer(c,u,d,f){const p=d;return new i.ConversationServiceAdapter(c,u,p,f,this)}sendMessage(c,u,d){const f=this.privReco;((h,v,y)=>{h!==void 0?h.then(()=>{try{v&&v()}catch(g){y&&y(`'Unhandled error on promise callback: ${g}'`)}},g=>{try{y&&y(g)}catch{}}):y&&y("Null promise")})(f.sendMessageAsync(c),u,d),this.resetConversationTimeout()}resetConversationTimeout(){this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privTimeoutToken=this.privSetTimeout(()=>{this.sendRequest(this.privConversation.getKeepAlive())},6e4)}};return Ds.ConversationTranslatorRecognizer=a,Ds}var Ju={},CE;function sj(){if(CE)return Ju;CE=1,Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.TranscriberRecognizer=void 0;const e=ve(),t=Ce,r=$(),n=ue();let o=class extends r.Recognizer{constructor(s,a){const l=s;t.Contracts.throwIfNull(l,"speechTranslationConfig");const c=a;t.Contracts.throwIfNull(c,"audioConfigImpl"),t.Contracts.throwIfNullOrWhitespace(l.speechRecognitionLanguage,r.PropertyId[r.PropertyId.SpeechServiceConnection_RecoLanguage]),super(a,l.properties,new n.TranscriberConnectionFactory),this.privDisposedRecognizer=!1,this.isMeetingRecognizer=!1}get speechRecognitionLanguage(){return t.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(r.PropertyId.SpeechServiceConnection_RecoLanguage)}get properties(){return this.privProperties}get authorizationToken(){return this.properties.getProperty(r.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){t.Contracts.throwIfNullOrWhitespace(s,"token"),this.properties.setProperty(r.PropertyId.SpeechServiceAuthorization_Token,s)}set conversation(s){t.Contracts.throwIfNullOrUndefined(s,"Conversation"),this.isMeetingRecognizer=!1,this.privConversation=s}getConversationInfo(){return t.Contracts.throwIfNullOrUndefined(this.privConversation,"Conversation"),this.privConversation.conversationInfo}set meeting(s){t.Contracts.throwIfNullOrUndefined(s,"Meeting"),this.isMeetingRecognizer=!0,this.privMeeting=s}getMeetingInfo(){return t.Contracts.throwIfNullOrUndefined(this.privMeeting,"Meeting"),this.privMeeting.meetingInfo}IsMeetingRecognizer(){return this.isMeetingRecognizer}startContinuousRecognitionAsync(s,a){e.marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(n.RecognitionMode.Conversation),s,a)}stopContinuousRecognitionAsync(s,a){e.marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(),s,a)}async close(){this.privDisposedRecognizer||await this.dispose(!0)}async pushConversationEvent(s,a){const l=this.privReco;t.Contracts.throwIfNullOrUndefined(l,"serviceRecognizer"),await l.sendSpeechEventAsync(s,a)}async pushMeetingEvent(s,a){const l=this.privReco;t.Contracts.throwIfNullOrUndefined(l,"serviceRecognizer"),await l.sendMeetingSpeechEventAsync(s,a)}async enforceAudioGating(){const l=(await this.audioConfig.format).channels;if(l===1){if(this.properties.getProperty("f0f5debc-f8c9-4892-ac4b-90a7ab359fd2","false").toLowerCase()!=="true")throw new Error("Single channel audio configuration for MeetingTranscriber is currently under private preview, please contact diarizationrequest@microsoft.com for more details")}else if(l!==8)throw new Error(`Unsupported audio configuration: Detected ${l}-channel audio`)}connectMeetingCallbacks(s){this.isMeetingRecognizer=!0,this.canceled=(a,l)=>{s.canceled&&s.canceled(s,l)},this.recognizing=(a,l)=>{s.transcribing&&s.transcribing(s,l)},this.recognized=(a,l)=>{s.transcribed&&s.transcribed(s,l)},this.sessionStarted=(a,l)=>{s.sessionStarted&&s.sessionStarted(s,l)},this.sessionStopped=(a,l)=>{s.sessionStopped&&s.sessionStopped(s,l)}}disconnectCallbacks(){this.canceled=void 0,this.recognizing=void 0,this.recognized=void 0,this.sessionStarted=void 0,this.sessionStopped=void 0}async dispose(s){this.privDisposedRecognizer||(s&&(this.privDisposedRecognizer=!0,await this.implRecognizerStop()),await super.dispose(s))}createRecognizerConfig(s){return new n.RecognizerConfig(s,this.properties)}createServiceRecognizer(s,a,l,c){const u=l;return new n.TranscriptionServiceRecognizer(s,a,u,c,this)}};return Ju.TranscriberRecognizer=o,Ju}var TE;function aj(){return TE||(TE=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=VF();Object.defineProperty(e,"ConversationManager",{enumerable:!0,get:function(){return t.ConversationManager}});var r=rc;Object.defineProperty(e,"ConversationConnectionConfig",{enumerable:!0,get:function(){return r.ConversationConnectionConfig}});var n=ij();Object.defineProperty(e,"ConversationRecognizerFactory",{enumerable:!0,get:function(){return n.ConversationRecognizerFactory}});var o=sj();Object.defineProperty(e,"TranscriberRecognizer",{enumerable:!0,get:function(){return o.TranscriberRecognizer}});var i=a6();Object.defineProperty(e,"ConversationReceivedTranslationEventArgs",{enumerable:!0,get:function(){return i.ConversationReceivedTranslationEventArgs}}),Object.defineProperty(e,"LockRoomEventArgs",{enumerable:!0,get:function(){return i.LockRoomEventArgs}}),Object.defineProperty(e,"MuteAllEventArgs",{enumerable:!0,get:function(){return i.MuteAllEventArgs}}),Object.defineProperty(e,"ParticipantAttributeEventArgs",{enumerable:!0,get:function(){return i.ParticipantAttributeEventArgs}}),Object.defineProperty(e,"ParticipantEventArgs",{enumerable:!0,get:function(){return i.ParticipantEventArgs}}),Object.defineProperty(e,"ParticipantsListEventArgs",{enumerable:!0,get:function(){return i.ParticipantsListEventArgs}});var s=Jo;Object.defineProperty(e,"ConversationTranslatorCommandTypes",{enumerable:!0,get:function(){return s.ConversationTranslatorCommandTypes}}),Object.defineProperty(e,"ConversationTranslatorMessageTypes",{enumerable:!0,get:function(){return s.ConversationTranslatorMessageTypes}}),Object.defineProperty(e,"InternalParticipants",{enumerable:!0,get:function(){return s.InternalParticipants}})}(c0)),c0}var _b={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SynthesisAudioMetadata=e.MetadataType=void 0,function(r){r.WordBoundary="WordBoundary",r.Bookmark="Bookmark",r.Viseme="Viseme",r.SentenceBoundary="SentenceBoundary",r.SessionEnd="SessionEnd",r.AvatarSignal="TalkingAvatarSignal"}(e.MetadataType||(e.MetadataType={}));class t{constructor(n){this.privSynthesisAudioMetadata=JSON.parse(n)}static fromJSON(n){return new t(n)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}e.SynthesisAudioMetadata=t})(_b);var Zu={},_o={};Object.defineProperty(_o,"__esModule",{value:!0});_o.SynthesisStartedEvent=_o.ConnectingToSynthesisServiceEvent=_o.SynthesisTriggeredEvent=_o.SpeechSynthesisEvent=void 0;const EE=ve();class gv extends EE.PlatformEvent{constructor(t,r,n=EE.EventType.Info){super(t,n),this.privRequestId=r}get requestId(){return this.privRequestId}}_o.SpeechSynthesisEvent=gv;class lj extends gv{constructor(t,r,n){super("SynthesisTriggeredEvent",t),this.privSessionAudioDestinationId=r,this.privTurnAudioDestinationId=n}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}_o.SynthesisTriggeredEvent=lj;class cj extends gv{constructor(t,r){super("ConnectingToSynthesisServiceEvent",t),this.privAuthFetchEventId=r}get authFetchEventId(){return this.privAuthFetchEventId}}_o.ConnectingToSynthesisServiceEvent=cj;class uj extends gv{constructor(t,r){super("SynthesisStartedEvent",t),this.privAuthFetchEventId=r}get authFetchEventId(){return this.privAuthFetchEventId}}_o.SynthesisStartedEvent=uj;var wE;function dj(){if(wE)return Zu;wE=1,Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.SynthesisTurn=void 0;const e=ve(),t=ar,r=$(),n=_b,o=_o;let i=class yS{constructor(){this.privIsDisposed=!1,this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!1,this.privBytesReceived=0,this.privInTurn=!1,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privRequestId=e.createNoDashGuid(),this.privTurnDeferral=new e.Deferred,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(a){this.privStreamId=a}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(a){this.privAudioOutputFormat=a}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get currentSentenceOffset(){return this.privSentenceOffset}get bytesReceived(){return this.privBytesReceived}get audioDuration(){return this.privAudioDuration}get extraProperties(){if(this.privWebRTCSDP){const a=new r.PropertyCollection;return a.setProperty(r.PropertyId.TalkingAvatarService_WebRTC_SDP,this.privWebRTCSDP),a}}async getAllReceivedAudio(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(await this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}async getAllReceivedAudioWithHeader(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const a=await this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=this.audioOutputFormat.addHeader(a),this.privReceivedAudioWithHeader}else return this.getAllReceivedAudio()}startNewSynthesis(a,l,c,u){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=a,this.privRawText=l,this.privIsSSML=c,this.privAudioOutputStream=new t.PullAudioOutputStreamImpl,this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privPartialVisemeAnimation="",this.privWebRTCSDP="",u!==void 0&&(this.privTurnAudioDestination=u,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new o.SynthesisTriggeredEvent(this.requestId,void 0,u===void 0?void 0:u.id()))}onPreConnectionStart(a){this.privAuthFetchEventId=a,this.onEvent(new o.ConnectingToSynthesisServiceEvent(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(a){a&&this.onComplete()}onConnectionEstablishCompleted(a){if(a===200){this.onEvent(new o.SynthesisStartedEvent(this.requestId,this.privAuthFetchEventId)),this.privBytesReceived=0;return}else a===403&&this.onComplete()}onServiceResponseMessage(a){const l=JSON.parse(a);this.streamId=l.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}onServiceTurnStartResponse(a){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch(()=>{})),this.privInTurn=!0,this.privTurnDeferral=new e.Deferred;const l=JSON.parse(a);l.webrtc&&(this.privWebRTCSDP=l.webrtc.connectionString)}onAudioChunkReceived(a){this.isSynthesizing&&(this.privAudioOutputStream.write(a),this.privBytesReceived+=a.byteLength,this.privTurnAudioDestination!==void 0&&this.privTurnAudioDestination.write(a))}onTextBoundaryEvent(a){this.updateTextOffset(a.Data.text.Text,a.Type)}onVisemeMetadataReceived(a){a.Data.AnimationChunk!==void 0&&(this.privPartialVisemeAnimation+=a.Data.AnimationChunk)}onSessionEnd(a){this.privAudioDuration=a.Data.Offset}async constructSynthesisResult(){const a=await this.getAllReceivedAudioWithHeader();return new r.SpeechSynthesisResult(this.requestId,r.ResultReason.SynthesizingAudioCompleted,a,void 0,this.extraProperties,this.audioDuration)}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const a=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",a}onEvent(a){e.Events.instance.onEvent(a)}static isXmlTag(a){return a.length>=2&&a[0]==="<"&&a[a.length-1]===">"}updateTextOffset(a,l){l===n.MetadataType.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(a,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+a.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!yS.isXmlTag(a)&&this.updateTextOffset(a,l))):(this.privSentenceOffset=this.privRawText.indexOf(a,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+a.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!yS.isXmlTag(a)&&this.updateTextOffset(a,l)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,this.privTurnAudioDestination!==void 0&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}async readAllAudioFromStream(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{await this.privAudioOutputStream.read(this.privReceivedAudio)}catch{this.privReceivedAudio=new ArrayBuffer(0)}}}withinXmlTag(a){return this.privRawText.indexOf("<",a+1)>this.privRawText.indexOf(">",a+1)}};return Zu.SynthesisTurn=i,Zu}var ed={},_E;function fj(){if(_E)return ed;_E=1,Object.defineProperty(ed,"__esModule",{value:!0}),ed.SynthesisAdapterBase=void 0;const e=ve(),t=$(),r=ue(),n=hi;let o=class{constructor(s,a,l,c){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!s)throw new e.ArgumentNullError("authentication");if(!a)throw new e.ArgumentNullError("connectionFactory");if(!l)throw new e.ArgumentNullError("synthesizerConfig");this.privAuthentication=s,this.privConnectionFactory=a,this.privSynthesizerConfig=l,this.privIsDisposed=!1,this.privSessionAudioDestination=c,this.privSynthesisTurn=new r.SynthesisTurn,this.privConnectionEvents=new e.EventSource,this.privServiceEvents=new e.EventSource,this.privSynthesisContext=new r.SynthesisContext,this.privAgentConfig=new r.AgentConfig,this.connectionEvents.attach(u=>{if(u.name==="ConnectionClosedEvent"){const d=u;d.statusCode!==1e3&&this.cancelSynthesisLocal(t.CancellationReason.Error,d.statusCode===1007?t.CancellationErrorCode.BadRequestParameters:t.CancellationErrorCode.ConnectionFailure,`${d.reason} websocket error code: ${d.statusCode}`)}})}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(s){this.privActivityTemplate=s}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(s){this.privAudioOutputFormat=s,this.privSynthesisTurn.audioOutputFormat=s,this.privSessionAudioDestination!==void 0&&(this.privSessionAudioDestination.format=s),this.synthesisContext!==void 0&&(this.synthesisContext.audioOutputFormat=s)}isDisposed(){return this.privIsDisposed}async dispose(s){this.privIsDisposed=!0,this.privSessionAudioDestination!==void 0&&this.privSessionAudioDestination.close(),this.privConnectionConfigurationPromise!==void 0&&await(await this.privConnectionConfigurationPromise).dispose(s)}async connect(){await this.connectImpl()}async sendNetworkMessage(s,a){const l=typeof a=="string"?e.MessageType.Text:e.MessageType.Binary,c=typeof a=="string"?"application/json":"";return(await this.fetchConnection()).send(new n.SpeechConnectionMessage(l,s,this.privSynthesisTurn.requestId,c,a))}async Speak(s,a,l,c,u,d){let f;if(a?f=s:f=this.privSynthesizer.buildSsml(s),this.speakOverride!==void 0)return this.speakOverride(f,l,c,u);this.privSuccessCallback=c,this.privErrorCallback=u,this.privSynthesisTurn.startNewSynthesis(l,s,a,d);try{await this.connectImpl();const p=await this.fetchConnection();await this.sendSynthesisContext(p),await this.sendSsmlMessage(p,f,l),this.onSynthesisStarted(l),this.receiveMessage()}catch(p){return this.cancelSynthesisLocal(t.CancellationReason.Error,t.CancellationErrorCode.ConnectionFailure,p),Promise.reject(p)}}async stopSpeaking(){return await this.connectImpl(),(await this.fetchConnection()).send(new n.SpeechConnectionMessage(e.MessageType.Text,"synthesis.control",this.privSynthesisTurn.requestId,"application/json",JSON.stringify({action:"stop"})))}cancelSynthesis(s,a,l,c){const u=new t.PropertyCollection;u.setProperty(r.CancellationErrorCodePropertyName,t.CancellationErrorCode[l]);const d=new t.SpeechSynthesisResult(s,t.ResultReason.Canceled,void 0,c,u);if(this.onSynthesisCancelled(d),this.privSuccessCallback)try{this.privSuccessCallback(d)}catch{}}cancelSynthesisLocal(s,a,l){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,s,a,l))}processTypeSpecificMessages(s){return!0}async receiveMessage(){try{const a=await(await this.fetchConnection()).read();if(this.receiveMessageOverride!==void 0)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!a)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const l=n.SpeechConnectionMessage.fromConnectionMessage(a);if(l.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(l.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse(l.textBody);break;case"response":this.privSynthesisTurn.onServiceResponseMessage(l.textBody);break;case"audio":this.privSynthesisTurn.streamId.toLowerCase()===l.streamId.toLowerCase()&&l.binaryBody&&(this.privSynthesisTurn.onAudioChunkReceived(l.binaryBody),this.onSynthesizing(l.binaryBody),this.privSessionAudioDestination!==void 0&&this.privSessionAudioDestination.write(l.binaryBody));break;case"audio.metadata":const c=r.SynthesisAudioMetadata.fromJSON(l.textBody).Metadata;for(const d of c)switch(d.Type){case r.MetadataType.WordBoundary:case r.MetadataType.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(d);const f=new t.SpeechSynthesisWordBoundaryEventArgs(d.Data.Offset,d.Data.Duration,d.Data.text.Text,d.Data.text.Length,d.Type===r.MetadataType.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,d.Data.text.BoundaryType);this.onWordBoundary(f);break;case r.MetadataType.Bookmark:const p=new t.SpeechSynthesisBookmarkEventArgs(d.Data.Offset,d.Data.Bookmark);this.onBookmarkReached(p);break;case r.MetadataType.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(d),d.Data.IsLastAnimation){const h=new t.SpeechSynthesisVisemeEventArgs(d.Data.Offset,d.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());this.onVisemeReceived(h)}break;case r.MetadataType.AvatarSignal:this.onAvatarEvent(d);break;case r.MetadataType.SessionEnd:this.privSynthesisTurn.onSessionEnd(d);break}break;case"turn.end":this.privSynthesisTurn.onServiceTurnEndResponse();let u;try{u=await this.privSynthesisTurn.constructSynthesisResult(),this.privSuccessCallback&&this.privSuccessCallback(u)}catch(d){this.privErrorCallback&&this.privErrorCallback(d)}this.onSynthesisCompleted(u);break;default:this.processTypeSpecificMessages(l)||this.privServiceEvents&&this.serviceEvents.onEvent(new e.ServiceEvent(l.path.toLowerCase(),l.textBody))}return this.receiveMessage()}catch{}}sendSynthesisContext(s){this.setSynthesisContextSynthesisSection();const a=this.synthesisContext.toJSON();if(a)return s.send(new n.SpeechConnectionMessage(e.MessageType.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",a))}setSpeechConfigSynthesisSection(){}connectImpl(s=!1){if(this.privConnectionPromise!=null)return this.privConnectionPromise.then(l=>l.state()===e.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise,()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()));this.privAuthFetchEventId=e.createNoDashGuid(),this.privConnectionId=e.createNoDashGuid(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const a=s?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=a.then(async l=>{this.privSynthesisTurn.onAuthCompleted(!1);const c=this.privConnectionFactory.create(this.privSynthesizerConfig,l,this.privConnectionId);c.events.attach(d=>{this.connectionEvents.onEvent(d)});const u=await c.open();return u.statusCode===200?(this.privSynthesisTurn.onConnectionEstablishCompleted(u.statusCode),Promise.resolve(c)):u.statusCode===403&&!s?this.connectImpl(!0):(this.privSynthesisTurn.onConnectionEstablishCompleted(u.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${u.statusCode},
+ ${this.privSynthesizerConfig.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Url)} Reason: ${u.reason}`))},l=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(l)}),this.privConnectionPromise.catch(()=>{}),this.privConnectionPromise}sendSpeechServiceConfig(s,a){if(a)return s.send(new n.SpeechConnectionMessage(e.MessageType.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",a))}sendSsmlMessage(s,a,l){return s.send(new n.SpeechConnectionMessage(e.MessageType.Text,"ssml",l,"application/ssml+xml",a))}async fetchConnection(){return this.privConnectionConfigurationPromise!==void 0?this.privConnectionConfigurationPromise.then(s=>s.state()===e.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()):this.privConnectionConfigurationPromise,()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection())):(this.privConnectionConfigurationPromise=this.configureConnection(),await this.privConnectionConfigurationPromise)}async configureConnection(){const s=await this.connectImpl();return this.configConnectionOverride!==void 0?this.configConnectionOverride(s):(this.setSpeechConfigSynthesisSection(),await this.sendSpeechServiceConfig(s,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),s)}onAvatarEvent(s){}onSynthesisStarted(s){}onSynthesizing(s){}onSynthesisCancelled(s){}onSynthesisCompleted(s){}onWordBoundary(s){}onVisemeReceived(s){}onBookmarkReached(s){}};return ed.SynthesisAdapterBase=o,o.telemetryDataEnabled=!0,ed}var td={},kE;function hj(){if(kE)return td;kE=1,Object.defineProperty(td,"__esModule",{value:!0}),td.AvatarSynthesisAdapter=void 0;const e=$(),t=ue();let r=class extends t.SynthesisAdapterBase{constructor(o,i,s,a,l){super(o,i,s,void 0),this.privAvatarSynthesizer=a,this.privSynthesizer=a,this.privAvatarConfig=l}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(void 0)}setSpeechConfigSynthesisSection(){var o,i,s,a,l,c,u,d,f,p,h,v,y,g,m,b,C;this.privSynthesizerConfig.synthesisVideoSection={format:{bitrate:(o=this.privAvatarConfig.videoFormat)==null?void 0:o.bitrate,codec:(i=this.privAvatarConfig.videoFormat)==null?void 0:i.codec,crop:{bottomRight:{x:(l=(a=(s=this.privAvatarConfig.videoFormat)==null?void 0:s.cropRange)==null?void 0:a.bottomRight)==null?void 0:l.x,y:(d=(u=(c=this.privAvatarConfig.videoFormat)==null?void 0:c.cropRange)==null?void 0:u.bottomRight)==null?void 0:d.y},topLeft:{x:(h=(p=(f=this.privAvatarConfig.videoFormat)==null?void 0:f.cropRange)==null?void 0:p.topLeft)==null?void 0:h.x,y:(g=(y=(v=this.privAvatarConfig.videoFormat)==null?void 0:v.cropRange)==null?void 0:y.topLeft)==null?void 0:g.y}},resolution:{height:(m=this.privAvatarConfig.videoFormat)==null?void 0:m.height,width:(b=this.privAvatarConfig.videoFormat)==null?void 0:b.width}},protocol:{name:"WebRTC",webrtcConfig:{clientDescription:btoa(this.privSynthesizerConfig.parameters.getProperty(e.PropertyId.TalkingAvatarService_WebRTC_SDP)),iceServers:this.privAvatarConfig.remoteIceServers??this.privAvatarSynthesizer.iceServers}},talkingAvatar:{background:{color:this.privAvatarConfig.backgroundColor,image:{url:(C=this.privAvatarConfig.backgroundImage)==null?void 0:C.toString()}},character:this.privAvatarConfig.character,customized:this.privAvatarConfig.customized,style:this.privAvatarConfig.style}}}onAvatarEvent(o){if(this.privAvatarSynthesizer.avatarEventReceived){const i=new e.AvatarEventArgs(o.Data.Offset,o.Data.Name);try{this.privAvatarSynthesizer.avatarEventReceived(this.privAvatarSynthesizer,i)}catch{}}}};return td.AvatarSynthesisAdapter=r,td}var rd={},PE;function pj(){if(PE)return rd;PE=1,Object.defineProperty(rd,"__esModule",{value:!0}),rd.SpeechSynthesisAdapter=void 0;const e=$(),t=ue();let r=class extends t.SynthesisAdapterBase{constructor(o,i,s,a,l){super(o,i,s,l),this.privSpeechSynthesizer=a,this.privSynthesizer=a}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer)}onSynthesisStarted(o){const i=new e.SpeechSynthesisEventArgs(new e.SpeechSynthesisResult(o,e.ResultReason.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,i)}onSynthesizing(o){if(this.privSpeechSynthesizer.synthesizing)try{const i=this.privSynthesisTurn.audioOutputFormat.addHeader(o),s=new e.SpeechSynthesisEventArgs(new e.SpeechSynthesisResult(this.privSynthesisTurn.requestId,e.ResultReason.SynthesizingAudio,i));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,s)}catch{}}onSynthesisCancelled(o){if(this.privSpeechSynthesizer.SynthesisCanceled){const i=new e.SpeechSynthesisEventArgs(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,i)}catch{}}}onSynthesisCompleted(o){if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new e.SpeechSynthesisEventArgs(o))}catch{}}onWordBoundary(o){if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,o)}catch{}}onVisemeReceived(o){if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,o)}catch{}}onBookmarkReached(o){if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,o)}catch{}}};return rd.SpeechSynthesisAdapter=r,rd}var nd={},RE;function gj(){if(RE)return nd;RE=1,Object.defineProperty(nd,"__esModule",{value:!0}),nd.SynthesisRestAdapter=void 0;const e=Jt(),t=$(),r=ao(),n=Yt;let o=class{constructor(s,a){let l=s.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Endpoint,void 0);if(!l){const u=s.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Region,"westus"),d=r.ConnectionFactoryBase.getHostSuffix(u);l=s.parameters.getProperty(t.PropertyId.SpeechServiceConnection_Host,`https://${u}.tts.speech${d}`)}this.privUri=`${l}/cognitiveservices/voices/list`;const c=e.RestConfigBase.requestOptions;this.privRestAdapter=new e.RestMessageAdapter(c),this.privAuthentication=a}getVoicesList(s){return this.privRestAdapter.setHeaders(n.HeaderNames.ConnectionId,s),this.privAuthentication.fetch(s).then(a=>(this.privRestAdapter.setHeaders(a.headerName,a.token),this.privRestAdapter.request(e.RestRequestType.Get,this.privUri)))}};return nd.SynthesisRestAdapter=o,nd}var d0={},AE;function vj(){return AE||(AE=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SynthesizerConfig=e.SynthesisServiceType=void 0;const t=ue();var r;(function(o){o[o.Standard=0]="Standard",o[o.Custom=1]="Custom"})(r=e.SynthesisServiceType||(e.SynthesisServiceType={}));class n{constructor(i,s){this.privSynthesisServiceType=r.Standard,this.avatarEnabled=!1,this.privSpeechServiceConfig=i||new t.SpeechServiceConfig(new t.Context(null)),this.privParameters=s}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(i){this.privSynthesisServiceType=i}set synthesisVideoSection(i){this.privSpeechServiceConfig.Context.synthesis={video:i}}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}e.SynthesizerConfig=n}(d0)),d0}var od={},IE;function mj(){if(IE)return od;IE=1,Object.defineProperty(od,"__esModule",{value:!0}),od.SynthesisContext=void 0;const e=$();let t=class{constructor(){this.privContext={}}setSection(n,o){this.privContext[n]=o}set audioOutputFormat(n){this.privAudioOutputFormat=n}toJSON(){return JSON.stringify(this.privContext)}setSynthesisSection(n){const o=this.buildSynthesisContext(n);this.setSection("synthesis",o)}buildSynthesisContext(n){return{audio:{metadataOptions:{bookmarkEnabled:!!(n!=null&&n.bookmarkReached),punctuationBoundaryEnabled:n==null?void 0:n.properties.getProperty(e.PropertyId.SpeechServiceResponse_RequestPunctuationBoundary,!!(n!=null&&n.wordBoundary)),sentenceBoundaryEnabled:n==null?void 0:n.properties.getProperty(e.PropertyId.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!(n!=null&&n.visemeReceived),wordBoundaryEnabled:n==null?void 0:n.properties.getProperty(e.PropertyId.SpeechServiceResponse_RequestWordBoundary,!!(n!=null&&n.wordBoundary))},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:n==null?void 0:n.autoDetectSourceLanguage}}}};return od.SynthesisContext=t,od}var id={},xE;function yj(){if(xE)return id;xE=1,Object.defineProperty(id,"__esModule",{value:!0}),id.SpeakerRecognitionConfig=void 0;const e=ue();let t=class{constructor(n,o){this.privContext=n||new e.Context(null),this.privParameters=o}get parameters(){return this.privParameters}get Context(){return this.privContext}};return id.SpeakerRecognitionConfig=t,id}var sd={},NE;function Sj(){if(NE)return sd;NE=1,Object.defineProperty(sd,"__esModule",{value:!0}),sd.SpeakerServiceRecognizer=void 0;const e=Jt(),t=ve(),r=$(),n=ue(),o=hi;let i=class extends n.ServiceRecognizerBase{constructor(a,l,c,u,d){super(a,l,c,u,d),this.privSpeakerRecognizer=d,this.privSpeakerAudioSource=c,this.recognizeSpeaker=f=>this.recognizeSpeakerOnce(f),this.sendPrePayloadJSONOverride=()=>this.noOp()}processTypeSpecificMessages(a){let l=!1;const c=new r.PropertyCollection;switch(a.messageType===t.MessageType.Text&&c.setProperty(r.PropertyId.SpeechServiceResponse_JsonResult,a.textBody),a.path.toLowerCase()){case"speaker.response":const d=JSON.parse(a.textBody);let f;d.status.statusCode.toLowerCase()!=="success"?f=new r.SpeakerRecognitionResult(d,r.ResultReason.Canceled,r.CancellationErrorCode.ServiceError,d.status.reason):f=new r.SpeakerRecognitionResult(d,r.ResultReason.RecognizedSpeaker),this.privResultDeferral&&this.privResultDeferral.resolve(f),l=!0;break}const u=new t.Deferred;return u.resolve(l),u.promise}cancelRecognition(a,l,c,u,d){if(new r.PropertyCollection().setProperty(n.CancellationErrorCodePropertyName,r.CancellationErrorCode[u]),this.privResultDeferral){const p=new r.SpeakerRecognitionResult({scenario:this.privSpeakerModel.scenario,status:{statusCode:d,reason:d}},r.ResultReason.Canceled,u,d);try{this.privResultDeferral.resolve(p)}catch(h){this.privResultDeferral.reject(h)}}}async recognizeSpeakerOnce(a){this.privSpeakerModel=a,this.voiceProfileType=a.scenario,this.privResultDeferral||(this.privResultDeferral=new t.Deferred),this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(r.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const l=this.connectImpl(),c=this.sendPreAudioMessages(this.extractSpeakerContext(a)),u=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),d=await this.privSpeakerAudioSource.format,f=await this.privSpeakerAudioSource.deviceInfo,p=new e.ReplayableAudioNode(u,d.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(p,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:f};try{await l,await c}catch(y){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,r.CancellationReason.Error,r.CancellationErrorCode.ConnectionFailure,y)}const h=new r.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,h),this.receiveMessage(),this.sendAudio(p).then(()=>{},y=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,r.CancellationReason.Error,r.CancellationErrorCode.RuntimeError,y)}),this.privResultDeferral.promise}async sendPreAudioMessages(a){const l=await this.fetchConnection();await this.sendSpeakerRecognition(l,a)}async sendSpeakerRecognition(a,l){const c=JSON.stringify(l);return a.send(new o.SpeechConnectionMessage(t.MessageType.Text,"speaker.context",this.privRequestSession.requestId,"application/json; charset=utf-8",c))}extractSpeakerContext(a){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:a.profileIds,scenario:a.scenario}}};return sd.SpeakerServiceRecognizer=i,sd}var ad={},BE;function bj(){if(BE)return ad;BE=1,Object.defineProperty(ad,"__esModule",{value:!0}),ad.VoiceServiceRecognizer=void 0;const e=Jt(),t=ve(),r=$(),n=ue(),o=hi;let i=class extends n.ServiceRecognizerBase{constructor(a,l,c,u,d){super(a,l,c,u,d),this.privDeferralMap=new t.DeferralMap,this.privSpeakerAudioSource=c,this.sendPrePayloadJSONOverride=()=>this.noOp()}set SpeakerAudioSource(a){this.privSpeakerAudioSource=a}processTypeSpecificMessages(a){let l=!1;const c=new r.PropertyCollection;switch(a.messageType===t.MessageType.Text&&c.setProperty(r.PropertyId.SpeechServiceResponse_JsonResult,a.textBody),a.path.toLowerCase()){case"speaker.profiles":const d=JSON.parse(a.textBody);switch(d.operation.toLowerCase()){case"create":this.handleCreateResponse(d,a.requestId);break;case"delete":case"reset":this.handleResultResponse(d,a.requestId);break;case"fetch":const v=JSON.parse(a.textBody);this.handleFetchResponse(v,a.requestId);break}l=!0;break;case"speaker.phrases":const f=JSON.parse(a.textBody);this.handlePhrasesResponse(f,a.requestId),l=!0;break;case"speaker.profile.enrollment":const p=JSON.parse(a.textBody),h=new r.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(p.enrollment?p.enrollment.enrollmentStatus:p.status.statusCode),p.enrollment?JSON.stringify(p.enrollment):void 0,p.status.reason);this.privDeferralMap.getId(a.requestId)&&this.privDeferralMap.complete(a.requestId,h),this.privRequestSession.onSpeechEnded(),l=!0;break}const u=new t.Deferred;return u.resolve(l),u.promise}cancelRecognition(a,l,c,u,d){new r.PropertyCollection().setProperty(n.CancellationErrorCodePropertyName,r.CancellationErrorCode[u]);const p=new r.VoiceProfileEnrollmentResult(r.ResultReason.Canceled,d,d);this.privDeferralMap.getId(l)&&this.privDeferralMap.complete(l,p)}async createProfile(a,l){this.voiceProfileType=a.toString();const c=this.connectImpl();try{const u=new t.Deferred;return await c,await this.sendCreateProfile(u,a,l),this.receiveMessage(),u.promise}catch(u){throw u}}async resetProfile(a){return this.voiceProfileType=a.profileType.toString(),this.sendCommonRequest("reset",a.profileType,a)}async deleteProfile(a){return this.voiceProfileType=a.profileType.toString(),this.sendCommonRequest("delete",a.profileType,a)}async retrieveEnrollmentResult(a){return this.voiceProfileType=a.profileType.toString(),this.privExpectedProfileId=a.profileId,this.sendCommonRequest("fetch",a.profileType,a)}async getAllProfiles(a){return this.voiceProfileType=a.toString(),this.sendCommonRequest("fetch",a)}async getActivationPhrases(a,l){this.voiceProfileType=a.toString();const c=this.connectImpl();try{const u=new t.Deferred;return await c,await this.sendPhrasesRequest(u,a,l),this.receiveMessage(),u.promise}catch(u){throw u}}async enrollProfile(a){this.voiceProfileType=a.profileType.toString();const l=new t.Deferred;this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(r.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const c=this.connectImpl(),u=this.sendPreAudioMessages(a,l),d=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),f=await this.privSpeakerAudioSource.format,p=await this.privSpeakerAudioSource.deviceInfo,h=new e.ReplayableAudioNode(d,f.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(h,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:p};try{await c,await u}catch(g){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,r.CancellationReason.Error,r.CancellationErrorCode.ConnectionFailure,g)}const v=new r.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,v),this.receiveMessage(),this.sendAudio(h).then(()=>{},g=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,r.CancellationReason.Error,r.CancellationErrorCode.RuntimeError,g)}),l.promise}async sendPreAudioMessages(a,l){const c=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,l),await this.sendBaseRequest(c,"enroll",this.scenarioFrom(a.profileType),a)}async sendPhrasesRequest(a,l,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,a);const d=this.scenarioFrom(l),f={locale:c,scenario:d};return u.send(new o.SpeechConnectionMessage(t.MessageType.Text,"speaker.profile.phrases",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(f)))}async sendCreateProfile(a,l,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,a);const d=l===r.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":l===r.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification",f={locale:c,number:"1",scenario:d};return u.send(new o.SpeechConnectionMessage(t.MessageType.Text,"speaker.profile.create",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(f)))}async sendCommonRequest(a,l,c=void 0){const u=this.connectImpl();try{const d=new t.Deferred;this.privRequestSession.onSpeechContext(),await u;const f=await this.fetchConnection();return this.privDeferralMap.add(this.privRequestSession.requestId,d),await this.sendBaseRequest(f,a,this.scenarioFrom(l),c),this.receiveMessage(),d.promise}catch(d){throw d}}async sendBaseRequest(a,l,c,u){const d={scenario:c};return u?d.profileIds=[u.profileId]:d.maxPageSize=-1,a.send(new o.SpeechConnectionMessage(t.MessageType.Text,`speaker.profile.${l}`,this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(d)))}extractSpeakerContext(a){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:a.profileIds,scenario:a.scenario}}handlePhrasesResponse(a,l){if(this.privDeferralMap.getId(l))if(a.status.statusCode.toLowerCase()!=="success"){const c=r.ResultReason.Canceled,u=new r.VoiceProfilePhraseResult(c,a.status.statusCode,a.passPhraseType,[]);this.privDeferralMap.complete(l,u)}else if(a.phrases&&a.phrases.length>0){const c=r.ResultReason.EnrollingVoiceProfile,u=new r.VoiceProfilePhraseResult(c,a.status.statusCode,a.passPhraseType,a.phrases);this.privDeferralMap.complete(l,u)}else throw new Error("Voice Profile get activation phrases failed, no phrases received");else throw new Error(`Voice Profile get activation phrases request for requestID ${l} not found`)}handleCreateResponse(a,l){if(a.profiles&&a.profiles.length>0)if(this.privDeferralMap.getId(l)){const c=a.profiles.map(u=>u.profileId);this.privDeferralMap.complete(l,c)}else throw new Error(`Voice Profile create request for requestID ${l} not found`);else throw new Error("Voice Profile create failed, no profile id received")}handleResultResponse(a,l){if(this.privDeferralMap.getId(l)){const c=a.operation.toLowerCase()==="delete"?r.ResultReason.DeletedVoiceProfile:r.ResultReason.ResetVoiceProfile,u=a.status.statusCode.toLowerCase()==="success"?c:r.ResultReason.Canceled,d=new r.VoiceProfileResult(u,`statusCode: ${a.status.statusCode}, errorDetails: ${a.status.reason}`);this.privDeferralMap.complete(l,d)}else throw new Error(`Voice Profile create request for requestID ${l} not found`)}handleFetchResponse(a,l){if(this.privDeferralMap.getId(l)&&a.profiles[0]){if(this.privExpectedProfileId&&a.profiles.length===1&&a.profiles[0].profileId===this.privExpectedProfileId){this.privExpectedProfileId=void 0;const c=a.profiles[0],u=new r.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(c.enrollmentStatus),JSON.stringify(c),a.status.reason);this.privDeferralMap.complete(l,u)}else if(a.profiles.length>0){const c=a.profiles,u=[];for(const d of c)u.push(new r.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(d.enrollmentStatus),JSON.stringify(d),a.status.reason));this.privDeferralMap.complete(l,u)}}else throw new Error(`Voice Profile fetch request for requestID ${l} not found`)}enrollmentReasonFrom(a){switch(a.toLowerCase()){case"enrolled":return r.ResultReason.EnrolledVoiceProfile;case"invalidlocale":case"invalidphrase":case"invalidaudioformat":case"invalidscenario":case"invalidprofilecount":case"invalidoperation":case"audiotooshort":case"audiotoolong":case"toomanyenrollments":case"storageconflict":case"profilenotfound":case"incompatibleprofiles":case"incompleteenrollment":return r.ResultReason.Canceled;default:return r.ResultReason.EnrollingVoiceProfile}}scenarioFrom(a){return a===r.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":a===r.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification"}};return ad.VoiceServiceRecognizer=i,ad}var c6={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.connectivity=e.Device=e.OS=e.System=e.Context=e.SpeechServiceConfig=void 0;class t{constructor(a){this.context=a}serialize(){return JSON.stringify(this,(a,l)=>{if(l&&typeof l=="object"&&!Array.isArray(l)){const c={};for(const u in l)Object.hasOwnProperty.call(l,u)&&(c[u&&u.charAt(0).toLowerCase()+u.substring(1)]=l[u]);return c}return l})}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(a){this.recognition=a.toLowerCase()}}e.SpeechServiceConfig=t;class r{constructor(a){this.system=new n,this.os=a}}e.Context=r;class n{constructor(){const a="1.40.0";this.name="SpeechSDK",this.version=a,this.build="JavaScript",this.lang="JavaScript"}}e.System=n;class o{constructor(a,l,c){this.platform=a,this.name=l,this.version=c}}e.OS=o;class i{constructor(a,l,c){this.manufacturer=a,this.model=l,this.version=c}}e.Device=i,function(s){s.Bluetooth="Bluetooth",s.Wired="Wired",s.WiFi="WiFi",s.Cellular="Cellular",s.InBuilt="InBuilt",s.Unknown="Unknown"}(e.connectivity||(e.connectivity={})),function(s){s.Phone="Phone",s.Speaker="Speaker",s.Car="Car",s.Headset="Headset",s.Thermostat="Thermostat",s.Microphones="Microphones",s.Deskphone="Deskphone",s.RemoteControl="RemoteControl",s.Unknown="Unknown",s.File="File",s.Stream="Stream"}(e.type||(e.type={}))})(c6);var OE;function ue(){return OE||(OE=1,function(e){var t=Oe&&Oe.__createBinding||(Object.create?function(i,s,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return s[a]}})}:function(i,s,a,l){l===void 0&&(l=a),i[l]=s[a]}),r=Oe&&Oe.__exportStar||function(i,s){for(var a in i)a!=="default"&&!s.hasOwnProperty(a)&&t(s,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.AutoDetectSourceLanguagesOpenRangeOptionName=e.ForceDictationPropertyName=e.ServicePropertiesPropertyName=e.CancellationErrorCodePropertyName=e.OutputFormatPropertyName=void 0,r(rg,e),r(Eg,e),r(tc,e),r(sR,e),r(aR,e),r(cF(),e),r(uF(),e),r(Yg,e),r(dF(),e),r(fF(),e),r(hF(),e),r(e6,e),r(Jg,e),r(gF(),e),r(vF(),e),r(mF(),e),r(yF(),e),r(YR(),e),r(SF(),e),r(t6,e),r(bF(),e),r(Zg,e),r(EF(),e),r(wF(),e),r(ev,e),r(tv,e),r(rv,e),r(_F(),e),r(kF(),e),r(PF(),e),r(RF(),e),r(AF(),e),r(nv,e),r(xF(),e),r(ov,e),r(i6,e),r(iv,e),r(av,e),r(lv,e),r(s6,e),r(UF(),e),r(dv,e),r(aj(),e),r(_b,e),r(dj(),e),r(fj(),e);var n=hj();Object.defineProperty(e,"AvatarSynthesisAdapter",{enumerable:!0,get:function(){return n.AvatarSynthesisAdapter}});var o=pj();Object.defineProperty(e,"SpeechSynthesisAdapter",{enumerable:!0,get:function(){return o.SpeechSynthesisAdapter}}),r(gj(),e),r(vj(),e),r(mj(),e),r(yj(),e),r(Sj(),e),r(bj(),e),r(c6,e),e.OutputFormatPropertyName="OutputFormat",e.CancellationErrorCodePropertyName="CancellationErrorCode",e.ServicePropertiesPropertyName="ServiceProperties",e.ForceDictationPropertyName="ForceDictation",e.AutoDetectSourceLanguagesOpenRangeOptionName="OpenRange"}(Wm)),Wm}(function(e){var t=Oe&&Oe.__createBinding||(Object.create?function(o,i,s,a){a===void 0&&(a=s),Object.defineProperty(o,a,{enumerable:!0,get:function(){return i[s]}})}:function(o,i,s,a){a===void 0&&(a=s),o[a]=i[s]}),r=Oe&&Oe.__exportStar||function(o,i){for(var s in o)s!=="default"&&!i.hasOwnProperty(s)&&t(i,o,s)};Object.defineProperty(e,"__esModule",{value:!0});const n=ue();new n.AgentConfig,r($(),e)})(xr);class u6{constructor(){tr(this,"recognizer");tr(this,"synthesizer");tr(this,"autoDetectSourceLanguageConfig",xr.AutoDetectSourceLanguageConfig.fromLanguages(["en-US","de-DE","zh-CN","nl-NL"]));tr(this,"recognizerAudioConfig",xr.AudioConfig.fromDefaultMicrophoneInput());tr(this,"audioPlayer",new xr.SpeakerAudioDestination);tr(this,"synthesizerAudioConfig",xr.AudioConfig.fromSpeakerOutput(this.audioPlayer));tr(this,"speechConfig");tr(this,"speechToken");tr(this,"audioMuted",!0);tr(this,"currentSpokenText",{message_id:"",text:void 0});tr(this,"createResources",async()=>{if(this.speechToken=await a9(),this.speechToken)this.speechConfig=xr.SpeechConfig.fromAuthorizationToken(this.speechToken.access_token,this.speechToken.region),this.recognizer=xr.SpeechRecognizer.FromConfig(this.speechConfig,this.autoDetectSourceLanguageConfig,this.recognizerAudioConfig),this.synthesizer=new xr.SpeechSynthesizer(this.speechConfig,this.synthesizerAudioConfig),this.audioPlayer.mute();else throw new Error("Speech was cancelled. Auth token cannot be retrieved.")});tr(this,"speakAnswer",async(t,r)=>{if(!this.synthesizer){console.error("Speech was cancelled. Synthesizer cannot be retrieved.");return}if(t===void 0||r===void 0||this.currentSpokenText.message_id===t&&this.currentSpokenText.text===r)return;await this.refreshSpeechToken();let n="";t===this.currentSpokenText.message_id?n=r.replace(this.currentSpokenText.text||"",""):n=r,t!==this.currentSpokenText.message_id&&this.createNewSynthesizer(),this.currentSpokenText={message_id:t,text:r},n=n.replace(/<[^>]*>?/gm,""),n=n.replace(/\^(\d+)\^/g,(o,i)=>`reference ${i}, `),this.synthesizer.speakTextAsync(n)});tr(this,"refreshSpeechToken",async()=>{var t;if(!((t=this.speechToken)!=null&&t.expiresTime&&this.speechToken.expiresTime>new Date))if(this.speechToken=await a9(),this.speechToken)this.speechConfig=xr.SpeechConfig.fromAuthorizationToken(this.speechToken.access_token,this.speechToken.region),this.recognizer=xr.SpeechRecognizer.FromConfig(this.speechConfig,this.autoDetectSourceLanguageConfig,this.recognizerAudioConfig),this.synthesizer=new xr.SpeechSynthesizer(this.speechConfig,this.synthesizerAudioConfig);else throw new Error("Speech was cancelled. Auth token cannot be retrieved.")});tr(this,"stopAudioPlayback",()=>{try{this.audioPlayer.internalAudio.pause()}catch(t){console.error("Error stopping audio playback:",t)}});tr(this,"createNewSynthesizer",()=>{var t;this.audioPlayer.internalAudio.pause(),this.audioPlayer.close(),(t=this.synthesizer)==null||t.close(),this.audioPlayer=new xr.SpeakerAudioDestination,this.synthesizerAudioConfig=xr.AudioConfig.fromSpeakerOutput(this.audioPlayer),this.speechConfig&&(this.synthesizer=new xr.SpeechSynthesizer(this.speechConfig,this.synthesizerAudioConfig)),this.audioMuted&&this.audioPlayer.mute()});tr(this,"toggleMute",()=>{this.audioMuted=!this.audioMuted;try{this.audioMuted?this.audioPlayer.mute():this.audioPlayer.unmute()}catch(t){console.error("Error toggling audio mute:",t)}});this.createResources()}}const Cj={isChatHistoryOpen:!1,chatHistoryLoadingState:Er.Loading,chatHistory:null,filteredChatHistory:null,currentChat:null,isCosmosDBAvailable:{cosmosDB:!1,status:un.NotConfigured},frontendSettings:null,feedbackState:{},speech_enabled:void 0,audioService:new u6,audioMuted:!0},Zr=T.createContext(void 0),Tj=({children:e})=>{var n;const[t,r]=T.useReducer(MO,Cj);return T.useEffect(()=>{const o=async(s=0)=>await L8(s).then(l=>(r(l?{type:"FETCH_CHAT_HISTORY",payload:l}:{type:"FETCH_CHAT_HISTORY",payload:null}),l)).catch(l=>(r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Fail}),r({type:"FETCH_CHAT_HISTORY",payload:null}),console.error("There was an issue fetching your data."),null));(async()=>{r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Loading}),WO().then(s=>{s!=null&&s.cosmosDB?o().then(a=>{a?(r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Success}),r({type:"SET_COSMOSDB_STATUS",payload:s})):(r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Fail}),r({type:"SET_COSMOSDB_STATUS",payload:{cosmosDB:!1,status:un.NotWorking}}))}).catch(a=>{r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Fail}),r({type:"SET_COSMOSDB_STATUS",payload:{cosmosDB:!1,status:un.NotWorking}})}):(r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Fail}),r({type:"SET_COSMOSDB_STATUS",payload:s}))}).catch(s=>{r({type:"UPDATE_CHAT_HISTORY_LOADING_STATE",payload:Er.Fail}),r({type:"SET_COSMOSDB_STATUS",payload:{cosmosDB:!1,status:un.NotConfigured}})})})()},[]),T.useEffect(()=>{(async()=>{VO().then(i=>{r({type:"FETCH_FRONTEND_SETTINGS",payload:i})}).catch(i=>{console.error("There was an issue fetching your data.")})})()},[]),T.useEffect(()=>{var o;(o=t.frontendSettings)!=null&&o.speech_enabled&&r({type:"SET_AUDIO_SERVICE",payload:new u6})},[(n=t.frontendSettings)==null?void 0:n.speech_enabled]),R(Zr.Provider,{value:{state:t,dispatch:r},children:e})},Ej=["Top","Right","Bottom","Left"];function G1(e,t,...r){const[n,o=n,i=n,s=o]=r,a=[n,o,i,s],l={};for(let c=0;ctypeof e=="string"&&/(\d+(\w+|%))/.test(e),$f=e=>typeof e=="number"&&!Number.isNaN(e),Nj=e=>e==="initial",DE=e=>e==="auto",Bj=e=>e==="none",Oj=["content","fit-content","max-content","min-content"],f0=e=>Oj.some(t=>e===t)||xj(e);function Dj(...e){const t=e.length===1,r=e.length===2,n=e.length===3;if(t){const[o]=e;if(Nj(o))return{flexGrow:0,flexShrink:1,flexBasis:"auto"};if(DE(o))return{flexGrow:1,flexShrink:1,flexBasis:"auto"};if(Bj(o))return{flexGrow:0,flexShrink:0,flexBasis:"auto"};if($f(o))return{flexGrow:o,flexShrink:1,flexBasis:0};if(f0(o))return{flexGrow:1,flexShrink:1,flexBasis:o}}if(r){const[o,i]=e;if($f(i))return{flexGrow:o,flexShrink:i,flexBasis:0};if(f0(i))return{flexGrow:o,flexShrink:1,flexBasis:i}}if(n){const[o,i,s]=e;if($f(o)&&$f(i)&&(DE(s)||f0(s)))return{flexGrow:o,flexShrink:i,flexBasis:s}}return{}}function Mj(e,t=e){return{columnGap:e,rowGap:t}}const zj=/var\(.*\)/gi;function Lj(e){return e===void 0||typeof e=="number"||typeof e=="string"&&!zj.test(e)}const Fj=/^[a-zA-Z0-9\-_\\#;]+$/,jj=/^-moz-initial$|^auto$|^initial$|^inherit$|^revert$|^unset$|^span \d+$|^\d.*/;function h0(e){return e!==void 0&&typeof e=="string"&&Fj.test(e)&&!jj.test(e)}function Hj(...e){if(e.some(i=>!Lj(i)))return{};const t=e[0]!==void 0?e[0]:"auto",r=e[1]!==void 0?e[1]:h0(t)?t:"auto",n=e[2]!==void 0?e[2]:h0(t)?t:"auto",o=e[3]!==void 0?e[3]:h0(r)?r:"auto";return{gridRowStart:t,gridColumnStart:r,gridRowEnd:n,gridColumnEnd:o}}function qj(...e){return G1("margin","",...e)}function Uj(e,t=e){return{marginBlockStart:e,marginBlockEnd:t}}function $j(e,t=e){return{marginInlineStart:e,marginInlineEnd:t}}function Wj(...e){return G1("padding","",...e)}function Vj(e,t=e){return{paddingBlockStart:e,paddingBlockEnd:t}}function Kj(e,t=e){return{paddingInlineStart:e,paddingInlineEnd:t}}function Gj(e,t=e){return{overflowX:e,overflowY:t}}function Qj(...e){const[t,r=t,n=t,o=r]=e;return{top:t,right:r,bottom:n,left:o}}function Xj(e,t,r){return{outlineWidth:e,...t&&{outlineStyle:t},...r&&{outlineColor:r}}}function Yj(...e){return Zj(e)?{transitionDelay:e[0],transitionDuration:e[0],transitionProperty:e[0],transitionTimingFunction:e[0]}:eH(e).reduce((r,[n,o="0s",i="0s",s="ease"],a)=>(a===0?(r.transitionProperty=n,r.transitionDuration=o,r.transitionDelay=i,r.transitionTimingFunction=s):(r.transitionProperty+=`, ${n}`,r.transitionDuration+=`, ${o}`,r.transitionDelay+=`, ${i}`,r.transitionTimingFunction+=`, ${s}`),r),{})}const Jj=["-moz-initial","inherit","initial","revert","unset"];function Zj(e){return e.length===1&&Jj.includes(e[0])}function eH(e){return e.length===1&&Array.isArray(e[0])?e[0]:[e]}function tH(e,...t){if(t.length===0)return nH(e)?{textDecorationStyle:e}:{textDecorationLine:e};const[r,n,o]=t;return{textDecorationLine:e,...r&&{textDecorationStyle:r},...n&&{textDecorationColor:n},...o&&{textDecorationThickness:o}}}const rH=["dashed","dotted","double","solid","wavy"];function nH(e){return rH.includes(e)}const p0=typeof window>"u"?global:window,g0="@griffel/";function oH(e,t){return p0[Symbol.for(g0+e)]||(p0[Symbol.for(g0+e)]=t),p0[Symbol.for(g0+e)]}const TS=oH("DEFINITION_LOOKUP_TABLE",{}),Bh="data-make-styles-bucket",ES="f",wS=7,kb="___",iH=kb.length+wS,sH=0,aH=1,lH={all:1,animation:1,animationRange:1,background:1,backgroundPosition:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockStart:1,borderBottom:1,borderColor:1,borderImage:1,borderInline:1,borderInlineEnd:1,borderInlineStart:1,borderLeft:1,borderRadius:1,borderRight:1,borderStyle:1,borderTop:1,borderWidth:1,caret:1,columns:1,columnRule:1,containIntrinsicSize:1,container:1,flex:1,flexFlow:1,font:1,gap:1,grid:1,gridArea:1,gridColumn:1,gridRow:1,gridTemplate:1,inset:1,insetBlock:1,insetInline:1,lineClamp:1,listStyle:1,margin:1,marginBlock:1,marginInline:1,mask:1,maskBorder:1,motion:1,offset:1,outline:1,overflow:1,overscrollBehavior:1,padding:1,paddingBlock:1,paddingInline:1,placeItems:1,placeContent:1,placeSelf:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginInline:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingInline:1,scrollSnapMargin:1,scrollTimeline:1,textDecoration:1,textEmphasis:1,transition:1,viewTimeline:1};function b1(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function cH(e){const t=e.length;if(t===wS)return e;for(let r=t;r0&&(t+=u.slice(0,d)),r+=f,n[c]=f}}}if(r==="")return t.slice(0,-1);const o=ME[r];if(o!==void 0)return t+o;const i=[];for(let c=0;ci.cssText):n}}}const fH=["r","d","l","v","w","f","i","h","a","s","k","t","m","c"],zE=fH.reduce((e,t,r)=>(e[t]=r,e),{});function hH(e,t,r,n,o={}){const i=e==="m",s=i?e+o.m:e;if(!n.stylesheets[s]){const a=t&&t.createElement("style"),l=dH(a,e,{...n.styleElementAttributes,...i&&{media:o.m}});n.stylesheets[s]=l,t&&a&&t.head.insertBefore(a,pH(t,r,e,n,o))}return n.stylesheets[s]}function pH(e,t,r,n,o){const i=zE[r];let s=u=>i-zE[u.getAttribute(Bh)],a=e.head.querySelectorAll(`[${Bh}]`);if(r==="m"&&o){const u=e.head.querySelectorAll(`[${Bh}="${r}"]`);u.length&&(a=u,s=d=>n.compareMediaQueries(o.m,d.media))}const l=a.length;let c=l-1;for(;c>=0;){const u=a.item(c);if(s(u)>0)return u.nextSibling;c--}return l>0?a.item(0):t?t.nextSibling:null}function LE(e,t){try{e.insertRule(t)}catch{}}let gH=0;const vH=(e,t)=>et?1:0;function mH(e=typeof document>"u"?void 0:document,t={}){const{unstable_filterCSSRule:r,insertionPoint:n,styleElementAttributes:o,compareMediaQueries:i=vH}=t,s={insertionCache:{},stylesheets:{},styleElementAttributes:Object.freeze(o),compareMediaQueries:i,id:`d${gH++}`,insertCSSRules(a){for(const l in a){const c=a[l];for(let u=0,d=c.length;u{const e={};return function(r,n){e[r.id]===void 0&&(r.insertCSSRules(n),e[r.id]=!0)}};function h6(e){return e.reduce(function(t,r){var n=r[0],o=r[1];return t[n]=o,t[o]=n,t},{})}function yH(e){return typeof e=="boolean"}function SH(e){return typeof e=="function"}function kd(e){return typeof e=="number"}function bH(e){return e===null||typeof e>"u"}function CH(e){return e&&typeof e=="object"}function TH(e){return typeof e=="string"}function Oh(e,t){return e.indexOf(t)!==-1}function EH(e){return parseFloat(e)===0?e:e[0]==="-"?e.slice(1):"-"+e}function Wf(e,t,r,n){return t+EH(r)+n}function wH(e){var t=e.indexOf(".");if(t===-1)e=100-parseFloat(e)+"%";else{var r=e.length-t-2;e=100-parseFloat(e),e=e.toFixed(r)+"%"}return e}function p6(e){return e.replace(/ +/g," ").split(" ").map(function(t){return t.trim()}).filter(Boolean).reduce(function(t,r){var n=t.list,o=t.state,i=(r.match(/\(/g)||[]).length,s=(r.match(/\)/g)||[]).length;return o.parensDepth>0?n[n.length-1]=n[n.length-1]+" "+r:n.push(r),o.parensDepth+=i-s,{list:n,state:o}},{list:[],state:{parensDepth:0}}).list}function FE(e){var t=p6(e);if(t.length<=3||t.length>4)return e;var r=t[0],n=t[1],o=t[2],i=t[3];return[r,i,o,n].join(" ")}function _H(e){return!yH(e)&&!bH(e)}function kH(e){for(var t=[],r=0,n=0,o=!1;n0?Br(nc,--yn):0,Hl--,Et===10&&(Hl=1,yv--),Et}function On(){return Et=yn<_6?Br(nc,yn++):0,Hl++,Et===10&&(Hl=1,yv++),Et}function ca(){return Br(nc,yn)}function Dh(){return yn}function bv(e,t){return C1(nc,e,t)}function Tp(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function k6(e){return yv=Hl=1,_6=Co(nc=e),yn=0,[]}function P6(e){return nc="",e}function Mh(e){return C6(bv(yn-1,kS(e===91?e+2:e===40?e+1:e)))}function $H(e){return P6(VH(k6(e)))}function WH(e){for(;(Et=ca())&&Et<33;)On();return Tp(e)>2||Tp(Et)>3?"":" "}function VH(e){for(;On();)switch(Tp(Et)){case 0:ia(R6(yn-1),e);break;case 2:ia(Mh(Et),e);break;default:ia(mv(Et),e)}return e}function KH(e,t){for(;--t&&On()&&!(Et<48||Et>102||Et>57&&Et<65||Et>70&&Et<97););return bv(e,Dh()+(t<6&&ca()==32&&On()==32))}function kS(e){for(;On();)switch(Et){case e:return yn;case 34:case 39:e!==34&&e!==39&&kS(Et);break;case 40:e===41&&kS(e);break;case 92:On();break}return yn}function GH(e,t){for(;On()&&e+Et!==47+10;)if(e+Et===42+42&&ca()===47)break;return"/*"+bv(t,yn-1)+"*"+mv(e===47?e:On())}function R6(e){for(;!Tp(ca());)On();return bv(e,yn)}function A6(e){return P6(zh("",null,null,null,[""],e=k6(e),0,[0],e))}function zh(e,t,r,n,o,i,s,a,l){for(var c=0,u=0,d=s,f=0,p=0,h=0,v=1,y=1,g=1,m=0,b="",C=o,k=i,E=n,w=b;y;)switch(h=m,m=On()){case 40:if(h!=108&&Br(w,d-1)==58){E6(w+=Wr(Mh(m),"&","&\f"),"&\f",b6(c?a[c-1]:0))!=-1&&(g=-1);break}case 34:case 39:case 91:w+=Mh(m);break;case 9:case 10:case 13:case 32:w+=WH(h);break;case 92:w+=KH(Dh()-1,7);continue;case 47:switch(ca()){case 42:case 47:ia(QH(GH(On(),Dh()),t,r,l),l);break;default:w+="/"}break;case 123*v:a[c++]=Co(w)*g;case 125*v:case 59:case 0:switch(m){case 0:case 125:y=0;case 59+u:g==-1&&(w=Wr(w,/\f/g,"")),p>0&&Co(w)-d&&ia(p>32?qE(w+";",n,r,d-1,l):qE(Wr(w," ","")+";",n,r,d-2,l),l);break;case 59:w+=";";default:if(ia(E=HE(w,t,r,c,u,o,a,b,C=[],k=[],d,i),i),m===123)if(u===0)zh(w,t,E,E,C,i,d,a,k);else switch(f===99&&Br(w,3)===110?100:f){case 100:case 108:case 109:case 115:zh(e,E,E,n&&ia(HE(e,E,E,0,0,o,a,b,o,C=[],d,k),k),o,k,d,a,n?C:k);break;default:zh(w,E,E,E,[""],k,0,a,k)}}c=u=p=0,v=g=1,b=w="",d=s;break;case 58:d=1+Co(w),p=h;default:if(v<1){if(m==123)--v;else if(m==125&&v++==0&&UH()==125)continue}switch(w+=mv(m),m*v){case 38:g=u>0?1:(w+="\f",-1);break;case 44:a[c++]=(Co(w)-1)*g,g=1;break;case 64:ca()===45&&(w+=Mh(On())),f=ca(),u=d=Co(b=w+=R6(Dh())),m++;break;case 45:h===45&&Co(w)==2&&(v=0)}}return i}function HE(e,t,r,n,o,i,s,a,l,c,u,d){for(var f=o-1,p=o===0?i:[""],h=w6(p),v=0,y=0,g=0;v0?p[m]+" "+b:Wr(b,/&\f/g,p[m])))&&(l[g++]=C);return Sv(e,t,r,o===0?vv:a,l,c,u,d)}function QH(e,t,r,n){return Sv(e,t,r,y6,mv(qH()),C1(e,2,-2),0,n)}function qE(e,t,r,n,o){return Sv(e,t,r,Rb,C1(e,0,n),C1(e,n+1,-1),n,o)}function ql(e,t){for(var r="",n=0;n{switch(e.type){case vv:if(typeof e.props=="string")return;e.props=e.props.map(t=>t.indexOf(":global(")===-1?t:$H(t).reduce((r,n,o,i)=>{if(n==="")return r;if(n===":"&&i[o+1]==="global"){const s=i[o+2].slice(1,-1)+" ";return r.unshift(s),i[o+1]="",i[o+2]="",r}return r.push(n),r},[]).join(""))}};function B6(e,t,r){switch(jH(e,t)){case 5103:return Kn+"print-"+e+e;case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:return Kn+e+e;case 4215:if(Br(e,9)===102||Br(e,t+1)===116)return Kn+e+e;break;case 4789:return qd+e+e;case 5349:case 4246:case 6968:return Kn+e+qd+e+e;case 6187:if(!T6(e,/grab/))return Wr(Wr(Wr(e,/(zoom-|grab)/,Kn+"$1"),/(image-set)/,Kn+"$1"),e,"")+e;case 5495:case 3959:return Wr(e,/(image-set\([^]*)/,Kn+"$1$`$1");case 4095:case 3583:case 4068:case 2532:return Wr(e,/(.+)-inline(.+)/,Kn+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Co(e)-1-t>6)switch(Br(e,t+1)){case 102:if(Br(e,t+3)===108)return Wr(e,/(.+:)(.+)-([^]+)/,"$1"+Kn+"$2-$3$1"+qd+(Br(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~E6(e,"stretch")?B6(Wr(e,"stretch","fill-available"),t)+e:e}break}return e}function O6(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Rb:e.return=B6(e.value,e.length);return;case vv:if(e.length)return HH(e.props,function(o){switch(T6(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ql([m0(e,{props:[Wr(o,/:(read-\w+)/,":"+qd+"$1")]})],n);case"::placeholder":return ql([m0(e,{props:[Wr(o,/:(plac\w+)/,":"+Kn+"input-$1")]}),m0(e,{props:[Wr(o,/:(plac\w+)/,":"+qd+"$1")]})],n)}return""})}}function YH(e){switch(e.type){case"@container":case DH:case zH:case S6:return!0}return!1}const JH=e=>{YH(e)&&Array.isArray(e.children)&&e.children.sort((t,r)=>t.props[0]>r.props[0]?1:-1)};function ZH(){}function eq(e,t){const r=[];return ql(A6(e),x6([XH,t?JH:ZH,O6,I6,N6(n=>r.push(n))])),r}const tq=/,( *[^ &])/g;function rq(e){return"&"+m6(e.replace(tq,",&$1"))}function UE(e,t,r){let n=t;return r.length>0&&(n=r.reduceRight((o,i)=>`${rq(i)} { ${o} }`,t)),`${e}{${n}}`}function $E(e){const{className:t,media:r,layer:n,selectors:o,support:i,property:s,rtlClassName:a,rtlProperty:l,rtlValue:c,value:u,container:d}=e,f=`.${t}`,p=Array.isArray(u)?`${u.map(v=>`${Pd(s)}: ${v}`).join(";")};`:`${Pd(s)}: ${u};`;let h=UE(f,p,o);if(l&&a){const v=`.${a}`,y=Array.isArray(c)?`${c.map(g=>`${Pd(l)}: ${g}`).join(";")};`:`${Pd(l)}: ${c};`;h+=UE(v,y,o)}return r&&(h=`@media ${r} { ${h} }`),n&&(h=`@layer ${n} { ${h} }`),i&&(h=`@supports ${i} { ${h} }`),d&&(h=`@container ${d} { ${h} }`),eq(h,!0)}function nq(e){let t="";for(const r in e){const n=e[r];typeof n!="string"&&typeof n!="number"||(t+=Pd(r)+":"+n+";")}return t}function WE(e){let t="";for(const r in e)t+=`${r}{${nq(e[r])}}`;return t}function VE(e,t){const r=`@keyframes ${e} {${t}}`,n=[];return ql(A6(r),x6([I6,O6,N6(o=>n.push(o))])),n}function KE(e,t){return e.length===0?t:`${e} and ${t}`}function oq(e){return e.substr(0,6)==="@media"}function iq(e){return e.substr(0,6)==="@layer"}const sq=/^(:|\[|>|&)/;function aq(e){return sq.test(e)}function lq(e){return e.substr(0,9)==="@supports"}function cq(e){return e.substring(0,10)==="@container"}function uq(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}const GE={"us-w":"w","us-v":"i",nk:"l",si:"v",cu:"f",ve:"h",ti:"a"};function QE(e,t,r,n,o){if(r)return"m";if(t||n)return"t";if(o)return"c";if(e.length>0){const i=e[0].trim();if(i.charCodeAt(0)===58)return GE[i.slice(4,8)]||GE[i.slice(3,5)]||"d"}return"d"}function Vf({container:e,media:t,layer:r,property:n,selector:o,support:i,value:s}){const a=b1(o+e+t+r+i+n+s.trim());return ES+a}function XE(e,t,r,n,o){const i=e+t+r+n+o,s=b1(i),a=s.charCodeAt(0);return a>=48&&a<=57?String.fromCharCode(a+17)+s.slice(1):s}function YE(e){return e.replace(/>\s+/g,">")}function dq(e,t){const r=JSON.stringify(t,null,2);" ".repeat(2)+""," ".repeat(4)+""," ".repeat(6)+`"${e}": ${r.split(`
+`).map((n,o)=>" ".repeat(o===0?0:6)+n).join(`
+`)}`," ".repeat(4)+""," ".repeat(2)+"",e.indexOf("&")}function JE(e,t,r,n){e[t]=n?[r,n]:r}function ZE(e,t){return t?[e,t]:e}function y0(e,t,r,n,o){var i;let s;t==="m"&&o&&(s={m:o}),(i=e[t])!==null&&i!==void 0||(e[t]=[]),r&&e[t].push(ZE(r,s)),n&&e[t].push(ZE(n,s))}function Gs(e,t=[],r="",n="",o="",i="",s={},a={},l){for(const c in e){if(lH.hasOwnProperty(c)){e[c];continue}const u=e[c];if(u!=null){if(typeof u=="string"||typeof u=="number"){const d=YE(t.join("")),f=XE(d,i,r,o,c),p=Vf({container:i,media:r,layer:n,value:u.toString(),support:o,selector:d,property:c}),h=l&&{key:c,value:l}||_S(c,u),v=h.key!==c||h.value!==u,y=v?Vf({container:i,value:h.value.toString(),property:h.key,selector:d,media:r,layer:n,support:o}):void 0,g=v?{rtlClassName:y,rtlProperty:h.key,rtlValue:h.value}:void 0,m=QE(t,n,r,o,i),[b,C]=$E({className:p,media:r,layer:n,selectors:t,property:c,support:o,container:i,value:u,...g});JE(s,f,p,y),y0(a,m,b,C,r)}else if(c==="animationName"){const d=Array.isArray(u)?u:[u],f=[],p=[];for(const h of d){const v=WE(h),y=WE(v6(h)),g=ES+b1(v);let m;const b=VE(g,v);let C=[];v===y?m=g:(m=ES+b1(y),C=VE(m,y));for(let k=0;k(E??"").toString()).join(";"),support:o,selector:d,property:c}),h=u.map(E=>_S(c,E));if(!!h.some(E=>E.key!==h[0].key))continue;const y=h[0].key!==c||h.some((E,w)=>E.value!==u[w]),g=y?Vf({container:i,value:h.map(E=>{var w;return((w=E==null?void 0:E.value)!==null&&w!==void 0?w:"").toString()}).join(";"),property:h[0].key,selector:d,layer:n,media:r,support:o}):void 0,m=y?{rtlClassName:g,rtlProperty:h[0].key,rtlValue:h.map(E=>E.value)}:void 0,b=QE(t,n,r,o,i),[C,k]=$E({className:p,media:r,layer:n,selectors:t,property:c,support:o,container:i,value:u,...m});JE(s,f,p,g),y0(a,b,C,k,r)}else if(uq(u))if(aq(c))Gs(u,t.concat(m6(c)),r,n,o,i,s,a);else if(oq(c)){const d=KE(r,c.slice(6).trim());Gs(u,t,d,n,o,i,s,a)}else if(iq(c)){const d=(n?`${n}.`:"")+c.slice(6).trim();Gs(u,t,r,d,o,i,s,a)}else if(lq(c)){const d=KE(o,c.slice(9).trim());Gs(u,t,r,n,d,i,s,a)}else if(cq(c)){const d=c.slice(10).trim();Gs(u,t,r,n,o,d,s,a)}else dq(c,u)}}return[s,a]}function fq(e){const t={},r={};for(const n in e){const o=e[n],[i,s]=Gs(o);t[n]=i,Object.keys(s).forEach(a=>{r[a]=(r[a]||[]).concat(s[a])})}return[t,r]}function hq(e,t=Pb){const r=t();let n=null,o=null,i=null,s=null;function a(l){const{dir:c,renderer:u}=l;n===null&&([n,o]=fq(e));const d=c==="ltr";return d?i===null&&(i=Cp(n,c)):s===null&&(s=Cp(n,c)),r(u,o),d?i:s}return a}function D6(e,t,r=Pb){const n=r();let o=null,i=null;function s(a){const{dir:l,renderer:c}=a,u=l==="ltr";return u?o===null&&(o=Cp(e,l)):i===null&&(i=Cp(e,l)),n(c,t),u?o:i}return s}function pq(e,t,r,n=Pb){const o=n();function i(s){const{dir:a,renderer:l}=s,c=a==="ltr"?e:t||e;return o(l,Array.isArray(r)?{r}:r),c}return i}const me={border:_j,borderLeft:kj,borderBottom:Pj,borderRight:Rj,borderTop:Aj,borderColor:CS,borderStyle:bS,borderRadius:Ij,borderWidth:SS,flex:Dj,gap:Mj,gridArea:Hj,margin:qj,marginBlock:Uj,marginInline:$j,padding:Wj,paddingBlock:Vj,paddingInline:Kj,overflow:Gj,inset:Qj,outline:Xj,transition:Yj,textDecoration:tH};function gq(){return typeof window<"u"&&!!(window.document&&window.document.createElement)}const e4=ti["useInsertionEffect"]?ti["useInsertionEffect"]:void 0,Ab=()=>{const e={};return function(r,n){if(e4&&gq()){e4(()=>{r.insertCSSRules(n)},[r,n]);return}e[r.id]===void 0&&(r.insertCSSRules(n),e[r.id]=!0)}},vq=T.createContext(mH());function X1(){return T.useContext(vq)}const M6=T.createContext("ltr"),mq=({children:e,dir:t})=>T.createElement(M6.Provider,{value:t},e);function Ib(){return T.useContext(M6)}function en(e){const t=hq(e,Ab);return function(){const n=Ib(),o=X1();return t({dir:n,renderer:o})}}function oe(e,t){const r=D6(e,t,Ab);return function(){const o=Ib(),i=X1();return r({dir:o,renderer:i})}}function Ye(e,t,r){const n=pq(e,t,r,Ab);return function(){const i=Ib(),s=X1();return n({dir:i,renderer:s})}}function yq(e,t){if(t){const r=Object.keys(t).reduce((n,o)=>`${n}--${o}: ${t[o]}; `,"");return`${e} { ${r} }`}return`${e} {}`}const z6=Symbol.for("fui.slotRenderFunction"),Cv=Symbol.for("fui.slotElementType");function _e(e,t){const{defaultProps:r,elementType:n}=t,o=xb(e),i={...r,...o,[Cv]:n};return o&&typeof o.children=="function"&&(i[z6]=o.children,i.children=r==null?void 0:r.children),i}function qe(e,t){if(!(e===null||e===void 0&&!t.renderByDefault))return _e(e,t)}function xb(e){return typeof e=="string"||typeof e=="number"||Array.isArray(e)||T.isValidElement(e)?{children:e}:e}function Sq(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&!T.isValidElement(e)}function Ep(e){return Boolean(e==null?void 0:e.hasOwnProperty(Cv))}const ut=(...e)=>{const t={};for(const r of e){const n=Array.isArray(r)?r:Object.keys(r);for(const o of n)t[o]=1}return t},bq=ut(["onAuxClick","onAnimationEnd","onAnimationStart","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onInput","onSubmit","onLoad","onError","onKeyDown","onKeyDownCapture","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onClickCapture","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onMouseUpCapture","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onPointerCancel","onPointerDown","onPointerEnter","onPointerLeave","onPointerMove","onPointerOut","onPointerOver","onPointerUp","onGotPointerCapture","onLostPointerCapture"]),Cq=ut(["accessKey","children","className","contentEditable","dir","draggable","hidden","htmlFor","id","lang","ref","role","style","tabIndex","title","translate","spellCheck","name"]),Tq=ut(["itemID","itemProp","itemRef","itemScope","itemType"]),qt=ut(Cq,bq,Tq),Eq=ut(qt,["form"]),L6=ut(qt,["height","loop","muted","preload","src","width"]),wq=ut(L6,["poster"]),_q=ut(qt,["start"]),kq=ut(qt,["value"]),Pq=ut(qt,["download","href","hrefLang","media","rel","target","type"]),Rq=ut(qt,["dateTime"]),Tv=ut(qt,["autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","type","value"]),Aq=ut(Tv,["accept","alt","autoCapitalize","autoComplete","checked","dirname","form","height","inputMode","list","max","maxLength","min","multiple","pattern","placeholder","readOnly","required","src","step","size","type","value","width"]),Iq=ut(Tv,["autoCapitalize","cols","dirname","form","maxLength","placeholder","readOnly","required","rows","wrap"]),xq=ut(Tv,["form","multiple","required"]),Nq=ut(qt,["selected","value"]),Bq=ut(qt,["cellPadding","cellSpacing"]),Oq=qt,Dq=ut(qt,["colSpan","rowSpan","scope"]),Mq=ut(qt,["colSpan","headers","rowSpan","scope"]),zq=ut(qt,["span"]),Lq=ut(qt,["span"]),Fq=ut(qt,["disabled","form"]),jq=ut(qt,["acceptCharset","action","encType","encType","method","noValidate","target"]),Hq=ut(qt,["allow","allowFullScreen","allowPaymentRequest","allowTransparency","csp","height","importance","referrerPolicy","sandbox","src","srcDoc","width"]),qq=ut(qt,["alt","crossOrigin","height","src","srcSet","useMap","width"]),Uq=ut(qt,["open","onCancel","onClose"]);function $q(e,t,r){const n=Array.isArray(t),o={},i=Object.keys(e);for(const s of i)(!n&&t[s]||n&&t.indexOf(s)>=0||s.indexOf("data-")===0||s.indexOf("aria-")===0)&&(!r||(r==null?void 0:r.indexOf(s))===-1)&&(o[s]=e[s]);return o}const Wq={label:Eq,audio:L6,video:wq,ol:_q,li:kq,a:Pq,button:Tv,input:Aq,textarea:Iq,select:xq,option:Nq,table:Bq,tr:Oq,th:Dq,td:Mq,colGroup:zq,col:Lq,fieldset:Fq,form:jq,iframe:Hq,img:qq,time:Rq,dialog:Uq};function F6(e,t,r){const n=e&&Wq[e]||qt;return n.as=1,$q(t,n,r)}const Y1=({primarySlotTagName:e,props:t,excludedPropNames:r})=>({root:{style:t.style,className:t.className},primary:F6(e,t,[...r||[],"style","className"])}),rt=(e,t,r)=>{var n;return F6((n=t.as)!==null&&n!==void 0?n:e,t,r)};function oc(){return typeof window<"u"&&!!(window.document&&window.document.createElement)}function j6(e,t){const r=T.useRef(void 0),n=T.useCallback((i,s)=>(r.current!==void 0&&t(r.current),r.current=e(i,s),r.current),[t,e]),o=T.useCallback(()=>{r.current!==void 0&&(t(r.current),r.current=void 0)},[t]);return T.useEffect(()=>o,[o]),[n,o]}const Vq=e=>(e(0),0),Kq=e=>e;function Gq(){const e=oc();return j6(e?requestAnimationFrame:Vq,e?cancelAnimationFrame:Kq)}function Qq(e){return typeof e=="function"}const Cn=e=>{const[t,r]=T.useState(()=>e.defaultState===void 0?e.initialState:Xq(e.defaultState)?e.defaultState():e.defaultState),n=T.useRef(e.state);T.useEffect(()=>{n.current=e.state},[e.state]);const o=T.useCallback(i=>{Qq(i)&&i(n.current)},[]);return Yq(e.state)?[e.state,o]:[t,r]};function Xq(e){return typeof e=="function"}const Yq=e=>{const[t]=T.useState(()=>e!==void 0);return t},Jq={current:0},Zq=T.createContext(void 0);function eU(){var e;return(e=T.useContext(Zq))!==null&&e!==void 0?e:Jq}const oo=oc()?T.useLayoutEffect:T.useEffect,Ae=e=>{const t=T.useRef(()=>{throw new Error("Cannot call an event handler while rendering")});return oo(()=>{t.current=e},[e]),T.useCallback((...r)=>{const n=t.current;return n(...r)},[t])};function tU(){const e=T.useRef(!0);return e.current?(e.current=!1,!0):e.current}const H6=T.createContext(void 0);H6.Provider;function rU(){return T.useContext(H6)||""}function xo(e="fui-",t){const r=eU(),n=rU(),o=ti["useId"];if(o){const i=o(),s=T.useMemo(()=>i.replace(/:/g,""),[i]);return t||`${n}${e}${s}`}return T.useMemo(()=>t||`${n}${e}${++r.current}`,[n,e,t,r])}function pi(...e){const t=T.useCallback(r=>{t.current=r;for(const n of e)typeof n=="function"?n(r):n&&(n.current=r)},[...e]);return t}const q6=T.createContext(void 0),nU=q6.Provider,U6=T.createContext(void 0),oU="",iU=U6.Provider;function sU(){var e;return(e=T.useContext(U6))!==null&&e!==void 0?e:oU}const aU=T.createContext(void 0),lU=aU.Provider,$6=T.createContext(void 0),cU={targetDocument:typeof document=="object"?document:void 0,dir:"ltr"},uU=$6.Provider;function tn(){var e;return(e=T.useContext($6))!==null&&e!==void 0?e:cU}const W6=T.createContext(void 0),dU=W6.Provider;function J1(){var e;return(e=T.useContext(W6))!==null&&e!==void 0?e:{}}const Nb=T.createContext(void 0),fU=()=>{},hU=Nb.Provider,Qe=e=>{var t,r;return(r=(t=T.useContext(Nb))===null||t===void 0?void 0:t[e])!==null&&r!==void 0?r:fU},V6=T.createContext(void 0);V6.Provider;function pU(){return T.useContext(V6)}const K6=T.createContext(void 0);K6.Provider;function gU(){return T.useContext(K6)}const G6=(e,t)=>!!(e!=null&&e.contains(t)),vU=e=>{const{targetDocument:t}=tn(),r=t==null?void 0:t.defaultView,{refs:n,callback:o,element:i,disabled:s,disabledFocusOnIframe:a,contains:l=G6}=e,c=T.useRef(void 0);yU({element:i,disabled:a||s,callback:o,refs:n,contains:l});const u=T.useRef(!1),d=Ae(p=>{if(u.current){u.current=!1;return}const h=p.composedPath()[0];n.every(y=>!l(y.current||null,h))&&!s&&o(p)}),f=Ae(p=>{u.current=n.some(h=>l(h.current||null,p.target))});T.useEffect(()=>{if(s)return;let p=mU(r);const h=v=>{if(v===p){p=void 0;return}d(v)};return i==null||i.addEventListener("click",h,!0),i==null||i.addEventListener("touchstart",h,!0),i==null||i.addEventListener("contextmenu",h,!0),i==null||i.addEventListener("mousedown",f,!0),c.current=r==null?void 0:r.setTimeout(()=>{p=void 0},1),()=>{i==null||i.removeEventListener("click",h,!0),i==null||i.removeEventListener("touchstart",h,!0),i==null||i.removeEventListener("contextmenu",h,!0),i==null||i.removeEventListener("mousedown",f,!0),r==null||r.clearTimeout(c.current),p=void 0}},[d,i,s,f,r])},mU=e=>{if(e){var t,r;if(typeof e.window=="object"&&e.window===e)return e.event;var n;return(n=(r=e.ownerDocument)===null||r===void 0||(t=r.defaultView)===null||t===void 0?void 0:t.event)!==null&&n!==void 0?n:void 0}},S0="fuiframefocus",yU=e=>{const{disabled:t,element:r,callback:n,contains:o=G6,pollDuration:i=1e3,refs:s}=e,a=T.useRef(),l=Ae(c=>{s.every(d=>!o(d.current||null,c.target))&&!t&&n(c)});T.useEffect(()=>{if(!t)return r==null||r.addEventListener(S0,l,!0),()=>{r==null||r.removeEventListener(S0,l,!0)}},[r,t,l]),T.useEffect(()=>{var c;if(!t)return a.current=r==null||(c=r.defaultView)===null||c===void 0?void 0:c.setInterval(()=>{const u=r==null?void 0:r.activeElement;if((u==null?void 0:u.tagName)==="IFRAME"||(u==null?void 0:u.tagName)==="WEBVIEW"){const d=new CustomEvent(S0,{bubbles:!0});u.dispatchEvent(d)}},i),()=>{var u;r==null||(u=r.defaultView)===null||u===void 0||u.clearTimeout(a.current)}},[r,t,i])},SU=e=>{const{refs:t,callback:r,element:n,disabled:o,contains:i}=e,s=Ae(a=>{const l=i||((d,f)=>!!(d!=null&&d.contains(f))),c=a.composedPath()[0];t.every(d=>!l(d.current||null,c))&&!o&&r(a)});T.useEffect(()=>{if(!o)return n==null||n.addEventListener("wheel",s),n==null||n.addEventListener("touchmove",s),()=>{n==null||n.removeEventListener("wheel",s),n==null||n.removeEventListener("touchmove",s)}},[s,n,o])};function wp(){return j6(setTimeout,clearTimeout)}function Vt(e,t){return(...r)=>{e==null||e(...r),t==null||t(...r)}}function Sa(e,t){var r;const n=e;var o;return Boolean((n==null||(r=n.ownerDocument)===null||r===void 0?void 0:r.defaultView)&&n instanceof n.ownerDocument.defaultView[(o=t==null?void 0:t.constructorName)!==null&&o!==void 0?o:"HTMLElement"])}function Q6(e){return Boolean(e.type.isFluentTriggerComponent)}function X6(e,t){return typeof e=="function"?e(t):e?Y6(e,t):e||null}function Y6(e,t){if(!T.isValidElement(e)||e.type===T.Fragment)throw new Error("A trigger element must be a single element for this component. Please ensure that you're not using React Fragments.");if(Q6(e)){const r=Y6(e.props.children,t);return T.cloneElement(e,void 0,r)}else return T.cloneElement(e,t)}function Bb(e){return T.isValidElement(e)?Q6(e)?Bb(e.props.children):e:null}function t4(e){return e instanceof Set?e:new Set(e)}function J6(e){const[t,r]=Cn({initialState:new Set,defaultState:T.useMemo(()=>e.defaultSelectedItems&&t4(e.defaultSelectedItems),[e.defaultSelectedItems]),state:T.useMemo(()=>e.selectedItems&&t4(e.selectedItems),[e.selectedItems])});return[t,(o,i)=>{var s;(s=e.onSelectionChange)===null||s===void 0||s.call(e,o,{selectedItems:i}),r(i)}]}function bU(e){const[t,r]=J6(e);return[t,{deselectItem:o=>r(o,new Set),selectItem:(o,i)=>r(o,new Set([i])),toggleAllItems:()=>{},toggleItem:(o,i)=>r(o,new Set([i])),clearItems:o=>r(o,new Set),isSelected:o=>{var i;return(i=t.has(o))!==null&&i!==void 0?i:!1}}]}function CU(e){const[t,r]=J6(e);return[t,{toggleItem:(o,i)=>{const s=new Set(t);t.has(i)?s.delete(i):s.add(i),r(o,s)},selectItem:(o,i)=>{const s=new Set(t);s.add(i),r(o,s)},deselectItem:(o,i)=>{const s=new Set(t);s.delete(i),r(o,s)},clearItems:o=>{r(o,new Set)},isSelected:o=>t.has(o),toggleAllItems:(o,i)=>{const s=i.every(l=>t.has(l)),a=new Set(t);s?a.clear():i.forEach(l=>a.add(l)),r(o,a)}}]}function TU(e){return e.selectionMode==="multiselect"?CU(e):bU(e)}function EU(e){return e&&!!e._virtual}function wU(e){return EU(e)&&e._virtual.parent||null}function Z6(e,t={}){if(!e)return null;if(!t.skipVirtual){const r=wU(e);if(r)return r}return(e==null?void 0:e.parentNode)||null}function PS(e,t){if(!e||!t)return!1;if(e===t)return!0;{const r=new WeakSet;for(;t;){const n=Z6(t,{skipVirtual:r.has(t)});if(r.add(t),n===e)return!0;t=n}}return!1}function r4(e,t){if(!e)return;const r=e;r._virtual||(r._virtual={}),r._virtual.parent=t}function eA(e,t){return{...t,[Cv]:e}}var RS={},_U={get exports(){return RS},set exports(e){RS=e}},nt={};/** @license React v17.0.2
+ * react-is.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Ev=60103,wv=60106,Z1=60107,ef=60108,tf=60114,rf=60109,nf=60110,of=60112,sf=60113,Ob=60120,af=60115,lf=60116,tA=60121,rA=60122,nA=60117,oA=60129,iA=60131;if(typeof Symbol=="function"&&Symbol.for){var rr=Symbol.for;Ev=rr("react.element"),wv=rr("react.portal"),Z1=rr("react.fragment"),ef=rr("react.strict_mode"),tf=rr("react.profiler"),rf=rr("react.provider"),nf=rr("react.context"),of=rr("react.forward_ref"),sf=rr("react.suspense"),Ob=rr("react.suspense_list"),af=rr("react.memo"),lf=rr("react.lazy"),tA=rr("react.block"),rA=rr("react.server.block"),nA=rr("react.fundamental"),oA=rr("react.debug_trace_mode"),iA=rr("react.legacy_hidden")}function lo(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ev:switch(e=e.type,e){case Z1:case tf:case ef:case sf:case Ob:return e;default:switch(e=e&&e.$$typeof,e){case nf:case of:case lf:case af:case rf:return e;default:return t}}case wv:return t}}}var kU=rf,PU=Ev,RU=of,AU=Z1,IU=lf,xU=af,NU=wv,BU=tf,OU=ef,DU=sf;nt.ContextConsumer=nf;nt.ContextProvider=kU;nt.Element=PU;nt.ForwardRef=RU;nt.Fragment=AU;nt.Lazy=IU;nt.Memo=xU;nt.Portal=NU;nt.Profiler=BU;nt.StrictMode=OU;nt.Suspense=DU;nt.isAsyncMode=function(){return!1};nt.isConcurrentMode=function(){return!1};nt.isContextConsumer=function(e){return lo(e)===nf};nt.isContextProvider=function(e){return lo(e)===rf};nt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ev};nt.isForwardRef=function(e){return lo(e)===of};nt.isFragment=function(e){return lo(e)===Z1};nt.isLazy=function(e){return lo(e)===lf};nt.isMemo=function(e){return lo(e)===af};nt.isPortal=function(e){return lo(e)===wv};nt.isProfiler=function(e){return lo(e)===tf};nt.isStrictMode=function(e){return lo(e)===ef};nt.isSuspense=function(e){return lo(e)===sf};nt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Z1||e===tf||e===oA||e===ef||e===sf||e===Ob||e===iA||typeof e=="object"&&e!==null&&(e.$$typeof===lf||e.$$typeof===af||e.$$typeof===rf||e.$$typeof===nf||e.$$typeof===of||e.$$typeof===nA||e.$$typeof===tA||e[0]===rA)};nt.typeOf=lo;(function(e){e.exports=nt})(_U);const MU=r5(RS);function sA(e,t){return function(n,o,i,s,a){return Ep(o)?t(eA(n,o),null,i,s,a):Ep(n)?t(n,o,i,s,a):e(n,o,i,s,a)}}function Db(e){const{as:t,[Cv]:r,[z6]:n,...o}=e,i=o,s=typeof r=="string"?t??r:r;return typeof s!="string"&&t&&(i.as=t),{elementType:s,props:i,renderFunction:n}}const ua=O7,zU=(e,t,r)=>{const{elementType:n,renderFunction:o,props:i}=Db(e),s={...i,...t};return o?ua.jsx(T.Fragment,{children:o(n,s)},r):ua.jsx(n,s,r)},LU=(e,t,r)=>{const{elementType:n,renderFunction:o,props:i}=Db(e),s={...i,...t};return o?ua.jsx(T.Fragment,{children:o(n,{...s,children:ua.jsxs(T.Fragment,{children:s.children},void 0)})},r):ua.jsxs(n,s,r)},Z=sA(ua.jsx,zU),Ar=sA(ua.jsxs,LU),AS=T.createContext(void 0),FU={},jU=AS.Provider,HU=()=>T.useContext(AS)?T.useContext(AS):FU,qU=oe({root:{mc9l5x:"f1w7gpdv",Bg96gwp:"fez10in",ycbfsm:"fg4l7m0"},rtl:{Bz10aip:"f13rod7r"}},{d:[".f1w7gpdv{display:inline;}",".fez10in{line-height:0;}",".f13rod7r{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1);}"],t:["@media (forced-colors: active){.fg4l7m0{forced-color-adjust:auto;}}"]}),UU=(e,t)=>{const{title:r,primaryFill:n="currentColor",...o}=e,i={...o,title:void 0,fill:n},s=qU(),a=HU();return i.className=X(s.root,(t==null?void 0:t.flipInRtl)&&(a==null?void 0:a.textDirection)==="rtl"&&s.rtl,i.className),r&&(i["aria-label"]=r),!i["aria-label"]&&!i["aria-labelledby"]?i["aria-hidden"]=!0:i.role="img",i},Ne=(e,t,r,n)=>{const o=t==="1em"?"20":t,i=T.forwardRef((s,a)=>{const l={...UU(s,{flipInRtl:n==null?void 0:n.flipInRtl}),ref:a,width:t,height:t,viewBox:`0 0 ${o} ${o}`,xmlns:"http://www.w3.org/2000/svg"};return T.createElement("svg",l,...r.map(c=>T.createElement("path",{d:c,fill:l.fill})))});return i.displayName=e,i},$U=Ne("ChevronDownRegular","1em",["M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"]),WU=Ne("CircleFilled","1em",["M10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z"]),VU=Ne("ErrorCircleRegular","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm0 9.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5ZM10 6a.5.5 0 0 1 .5.41V11a.5.5 0 0 1-1 .09V6.5c0-.28.22-.5.5-.5Z"]),KU=Ne("SpeakerMuteRegular","1em",["M12 3a1 1 0 0 0-1.68-.73l-3.88 3.6A.5.5 0 0 1 6.1 6H3.5C2.67 6 2 6.67 2 7.5v5c0 .83.67 1.5 1.5 1.5h2.6a.5.5 0 0 1 .34.13l3.88 3.6a1 1 0 0 0 1.68-.74V3.01ZM7.12 6.6 11 3v14l-3.88-3.6A1.5 1.5 0 0 0 6.1 13H3.5a.5.5 0 0 1-.5-.5v-5c0-.28.22-.5.5-.5h2.6c.38 0 .75-.14 1.02-.4Zm6.02 1.05c.2-.2.51-.2.71 0l1.65 1.64 1.64-1.64a.5.5 0 1 1 .71.7L16.2 10l1.65 1.65a.5.5 0 1 1-.7.7l-1.65-1.64-1.65 1.64a.5.5 0 1 1-.7-.7L14.78 10l-1.65-1.65a.5.5 0 0 1 0-.7Z"]),GU=Ne("Add16Regular","16",["M8 2.5a.5.5 0 0 0-1 0V7H2.5a.5.5 0 0 0 0 1H7v4.5a.5.5 0 0 0 1 0V8h4.5a.5.5 0 0 0 0-1H8V2.5Z"]),QU=Ne("ArrowUpload16Regular","16",["M3.5 2a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1h-9Zm4.85 2.15a.5.5 0 0 0-.7 0l-3.5 3.5a.5.5 0 1 0 .7.7L7.5 5.71v7.79a.5.5 0 0 0 1 0V5.7l2.65 2.65a.5.5 0 0 0 .7-.7l-3.5-3.5Z"]),XU=Ne("Broom16Regular","16",["M14.85 1.15a.5.5 0 0 0-.7 0L9.48 5.82a3.68 3.68 0 0 0-4.83.37l-.68.64-2.68 1.21a.5.5 0 0 0-.14.81l6 6a.5.5 0 0 0 .8-.14l1.22-2.67.68-.69a3.67 3.67 0 0 0 .33-4.83l4.67-4.67a.5.5 0 0 0 0-.7Zm-10.7 6.7 4 4-.8 1.79-4.99-4.98 1.78-.81Zm4.6 3.2L4.97 7.25l.37-.34.01-.02a2.67 2.67 0 1 1 3.8 3.75l-.4.4Z"]),YU=Ne("Checkmark12Filled","12",["M9.76 3.2c.3.29.32.76.04 1.06l-4.25 4.5a.75.75 0 0 1-1.08.02L2.22 6.53a.75.75 0 0 1 1.06-1.06l1.7 1.7L8.7 3.24a.75.75 0 0 1 1.06-.04Z"]),JU=Ne("Checkmark16Filled","16",["M14.05 3.49c.28.3.27.77-.04 1.06l-7.93 7.47A.85.85 0 0 1 4.9 12L2.22 9.28a.75.75 0 1 1 1.06-1.06l2.24 2.27 7.47-7.04a.75.75 0 0 1 1.06.04Z"]),ZU=Ne("Checkmark20Regular","20",["M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"]),e$=Ne("CheckmarkCircle12Filled","12",["M1 6a5 5 0 1 1 10 0A5 5 0 0 1 1 6Zm7.35-.9a.5.5 0 1 0-.7-.7L5.5 6.54 4.35 5.4a.5.5 0 1 0-.7.7l1.5 1.5c.2.2.5.2.7 0l2.5-2.5Z"]),t$=Ne("ChevronDown16Regular","16",["M3.15 5.65c.2-.2.5-.2.7 0L8 9.79l4.15-4.14a.5.5 0 0 1 .7.7l-4.5 4.5a.5.5 0 0 1-.7 0l-4.5-4.5a.5.5 0 0 1 0-.7Z"]),r$=Ne("ChevronDown24Regular","24",["M4.22 8.47c.3-.3.77-.3 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25c-.3.3-.77.3-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06Z"]),n$=Ne("ChevronRight24Regular","24",["M8.47 4.22c-.3.3-.3.77 0 1.06L15.19 12l-6.72 6.72a.75.75 0 1 0 1.06 1.06l7.25-7.25c.3-.3.3-.77 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0Z"]),o$=Ne("ChevronUp16Regular","16",["M3.15 10.35c.2.2.5.2.7 0L8 6.21l4.15 4.14a.5.5 0 0 0 .7-.7l-4.5-4.5a.5.5 0 0 0-.7 0l-4.5 4.5a.5.5 0 0 0 0 .7Z"]),i$=Ne("Delete20Regular","20",["M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"]),s$=Ne("Delete24Regular","24",["M10 5h4a2 2 0 1 0-4 0ZM8.5 5a3.5 3.5 0 1 1 7 0h5.75a.75.75 0 0 1 0 1.5h-1.32l-1.17 12.11A3.75 3.75 0 0 1 15.03 22H8.97a3.75 3.75 0 0 1-3.73-3.39L4.07 6.5H2.75a.75.75 0 0 1 0-1.5H8.5Zm2 4.75a.75.75 0 0 0-1.5 0v7.5a.75.75 0 0 0 1.5 0v-7.5ZM14.25 9c.41 0 .75.34.75.75v7.5a.75.75 0 0 1-1.5 0v-7.5c0-.41.34-.75.75-.75Zm-7.52 9.47a2.25 2.25 0 0 0 2.24 2.03h6.06c1.15 0 2.12-.88 2.24-2.03L18.42 6.5H5.58l1.15 11.97Z"]),a$=Ne("Dismiss16Regular","16",["m2.59 2.72.06-.07a.5.5 0 0 1 .63-.06l.07.06L8 7.29l4.65-4.64a.5.5 0 0 1 .7.7L8.71 8l4.64 4.65c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L8 8.71l-4.65 4.64a.5.5 0 0 1-.7-.7L7.29 8 2.65 3.35a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),aA=Ne("Dismiss20Regular","20",["m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),lA=Ne("Dismiss24Regular","24",["m4.4 4.55.07-.08a.75.75 0 0 1 .98-.07l.08.07L12 10.94l6.47-6.47a.75.75 0 1 1 1.06 1.06L13.06 12l6.47 6.47c.27.27.3.68.07.98l-.07.08a.75.75 0 0 1-.98.07l-.08-.07L12 13.06l-6.47 6.47a.75.75 0 0 1-1.06-1.06L10.94 12 4.47 5.53a.75.75 0 0 1-.07-.98l.07-.08-.07.08Z"]),l$=Ne("Edit20Regular","20",["M17.18 2.93a2.97 2.97 0 0 0-4.26-.06l-9.37 9.38c-.33.33-.56.74-.66 1.2l-.88 3.94a.5.5 0 0 0 .6.6l3.93-.87c.46-.1.9-.34 1.23-.68l9.36-9.36a2.97 2.97 0 0 0 .05-4.15Zm-3.55.65a1.97 1.97 0 1 1 2.8 2.8l-.68.66-2.8-2.79.68-.67Zm-1.38 1.38 2.8 2.8-7.99 7.97c-.2.2-.46.35-.74.41l-3.16.7.7-3.18c.07-.27.2-.51.4-.7l8-8Z"]),c$=Ne("ErrorCircle12Filled","12",["M6 11A5 5 0 1 0 6 1a5 5 0 0 0 0 10Zm-.75-2.75a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0Zm.26-4.84a.5.5 0 0 1 .98 0l.01.09v2.59a.5.5 0 0 1-1 0V3.41Z"]),u$=Ne("History24Regular","24",["M12 4.5a7.5 7.5 0 1 1-7.42 6.4c.07-.46-.26-.9-.72-.9-.37 0-.7.26-.76.62A9 9 0 1 0 6 5.3V4.25a.75.75 0 0 0-1.5 0v3c0 .41.34.75.75.75h3a.75.75 0 0 0 0-1.5H6.9a7.47 7.47 0 0 1 5.1-2Zm.5 3.25a.75.75 0 0 0-1.5 0v4.5c0 .41.34.75.75.75h3a.75.75 0 0 0 0-1.5H12.5V7.75Z"]),d$=Ne("Info16Regular","16",["M8.5 7.5a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3Zm.25-2a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Z"]),f$=Ne("MicRecord24Filled","24",["M11 17.5c0 1.1.27 2.13.75 3.03v.72a.75.75 0 0 1-1.5.1v-2.37A6.75 6.75 0 0 1 4 12.48v-.73a.75.75 0 0 1 1.5-.1v.6a5.25 5.25 0 0 0 5.03 5.25H11Zm.17-1.5A6.51 6.51 0 0 1 15 11.5V6a4 4 0 0 0-8 0v6a4 4 0 0 0 4.17 4ZM20 17.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Zm3 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Zm-9.5 0a4 4 0 1 0 8 0 4 4 0 0 0-8 0Z"]),h$=Ne("MicSparkle24Regular","24",["M13.85 15.15a2.85 2.85 0 0 1 .69 1.11l.45 1.38a.54.54 0 0 0 1.02 0l.45-1.38a2.84 2.84 0 0 1 1.8-1.8l1.38-.44a.54.54 0 0 0 0-1.03h-.03l-1.38-.45a2.84 2.84 0 0 1-1.8-1.8L16 9.36a.54.54 0 0 0-1.03 0l-.45 1.38-.01.03a2.84 2.84 0 0 1-1.76 1.77l-1.38.44a.54.54 0 0 0 0 1.03l1.38.45c.42.14.8.37 1.11.69ZM16 6v2.1a1.54 1.54 0 0 0-1.5.24V6a2.5 2.5 0 0 0-5 0v6c0 .56.19 1.08.5 1.5a1.54 1.54 0 0 0 1.03 1.45h.01l1.39.46c.26.09.5.23.7.43A4 4 0 0 1 8 12V6a4 4 0 1 1 8 0Zm-3.75 11.5c.54 0 1.07-.08 1.56-.24l.23.7v.01c.1.25.25.48.45.65-.55.2-1.13.32-1.74.36v2.27a.75.75 0 0 1-1.5.1v-2.37A6.75 6.75 0 0 1 5 12.48v-.73a.75.75 0 0 1 1.5-.1v.6a5.25 5.25 0 0 0 5.03 5.25h.72Zm9.77 1.46.76.25h.02a.3.3 0 0 1 .14.47.3.3 0 0 1-.14.1l-.77.26a1.58 1.58 0 0 0-1 1l-.24.76a.3.3 0 0 1-.58 0l-.24-.77a1.57 1.57 0 0 0-1-1l-.77-.25a.3.3 0 0 1-.14-.46.3.3 0 0 1 .14-.1l.77-.26a1.58 1.58 0 0 0 .98-1l.25-.76a.3.3 0 0 1 .57 0l.25.77a1.58 1.58 0 0 0 1 1Z"]),p$=Ne("MoreHorizontal24Filled","24",["M8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm6 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 2a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"]),g$=Ne("PersonFeedback16Regular","16",["M9.5 1C8.67 1 8 1.67 8 2.5v2c0 .65.42 1.2 1 1.41V7a.5.5 0 0 0 .82.38L11.48 6h2.02c.83 0 1.5-.67 1.5-1.5v-2c0-.83-.67-1.5-1.5-1.5h-4ZM9 2.5c0-.28.22-.5.5-.5h4c.28 0 .5.22.5.5v2a.5.5 0 0 1-.5.5h-2.2a.5.5 0 0 0-.32.12l-.98.81V5.5a.5.5 0 0 0-.5-.5.5.5 0 0 1-.5-.5v-2ZM3 6a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm2-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM2.5 9h5c.83 0 1.5.67 1.5 1.5 0 1.12-.46 2.01-1.21 2.61-.74.6-1.74.89-2.79.89a4.43 4.43 0 0 1-2.79-.89A3.25 3.25 0 0 1 1 10.5C1 9.67 1.67 9 2.5 9Zm5 1h-5a.5.5 0 0 0-.5.5c0 .82.32 1.42.84 1.83.52.43 1.28.67 2.16.67.88 0 1.64-.24 2.16-.67.52-.4.84-1.01.84-1.83a.5.5 0 0 0-.5-.5Z"]),v$=Ne("Send32Regular","32",["M2.08 3.97a1.5 1.5 0 0 1 2.1-1.8l25 12.49a1.5 1.5 0 0 1 0 2.68l-25 12.5a1.5 1.5 0 0 1-2.1-1.8L5.95 16 2.08 3.97ZM7.73 17 4.35 27.52 27.38 16 4.35 4.48 7.73 15H19a1 1 0 1 1 0 2H7.73Z"],{flipInRtl:!0}),m$=Ne("ShieldLock48Regular","48",["M23.13 4.35a1.25 1.25 0 0 1 1.73 0c2.76 2.64 6.69 4.08 10.04 4.84a35.65 35.65 0 0 0 5.86.81h.02c.68.02 1.22.57 1.22 1.25V21c0 .98-.05 1.96-.16 2.94a7 7 0 0 0-2.38-1.5c.03-.48.04-.96.04-1.44v-8.57l-.65-.07a38.15 38.15 0 0 1-4.5-.73c-3.22-.74-7.21-2.1-10.35-4.7-3.14 2.6-7.13 3.96-10.35 4.7a38.15 38.15 0 0 1-5.15.8v8.32c0 4.41 1.13 8.72 3.65 12.35 2.46 3.55 6.29 6.52 11.85 8.34.7-.23 1.36-.47 2-.73V43l.01.38c-.53.2-1.08.39-1.64.56-.24.08-.5.08-.74 0-6.24-1.95-10.67-5.29-13.53-9.42A23.95 23.95 0 0 1 6 20.75v-9.5c0-.68.54-1.23 1.22-1.25h.02a9.4 9.4 0 0 0 .41-.02l1.25-.1c1.06-.11 2.54-.32 4.2-.7 3.35-.75 7.28-2.19 10.03-4.83ZM32 30v-1a5 5 0 0 1 10 0v1h1a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H31a3 3 0 0 1-3-3V33a3 3 0 0 1 3-3h1Zm2.5-1v1h5v-1a2.5 2.5 0 0 0-5 0Zm5.5 9a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z"]),y$=Ne("Speaker224Regular","24",["M15 4.25a1.25 1.25 0 0 0-2.08-.93L8.42 7.3a.75.75 0 0 1-.49.19H4.25C3.01 7.5 2 8.5 2 9.75v4.5c0 1.24 1 2.25 2.25 2.25h3.68c.18 0 .36.06.5.19l4.49 3.99c.8.72 2.08.14 2.08-.93V4.25ZM9.42 8.43l4.08-3.62v14.38l-4.08-3.63A2.25 2.25 0 0 0 7.93 15H4.25a.75.75 0 0 1-.75-.75v-4.5c0-.42.34-.75.75-.75h3.68c.55 0 1.08-.2 1.5-.57ZM19 5.9a.75.75 0 0 1 1.05.15 9.96 9.96 0 0 1 0 11.9.75.75 0 1 1-1.2-.9 8.46 8.46 0 0 0 0-10.1.75.75 0 0 1 .15-1.05Zm-1.85 2.47a.75.75 0 0 1 1.02.3 6.97 6.97 0 0 1 0 6.66.75.75 0 0 1-1.32-.72 5.47 5.47 0 0 0 0-5.22.75.75 0 0 1 .3-1.02Z"]),S$=Ne("Square12Filled","12",["M2 4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Z"]),b$=Ne("Square16Filled","16",["M2 4.5A2.5 2.5 0 0 1 4.5 2h7A2.5 2.5 0 0 1 14 4.5v7a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 11.5v-7Z"]),C$=Ne("Stop24Regular","24",["M19.25 4.5c.14 0 .25.11.25.25v14.5c0 .14-.11.25-.25.25H4.75a.25.25 0 0 1-.25-.25V4.75c0-.14.11-.25.25-.25h14.5ZM4.75 3C3.78 3 3 3.78 3 4.75v14.5c0 .97.78 1.75 1.75 1.75h14.5c.97 0 1.75-.78 1.75-1.75V4.75C21 3.78 20.22 3 19.25 3H4.75Z"]),T$=Ne("ThumbDislike20Filled","20",["M12.48 18.3c-.8.83-2.09.38-2.43-.6-.28-.8-.64-1.77-1-2.48C8 13.1 7.38 11.9 5.67 10.37c-.23-.2-.52-.36-.84-.49-1.13-.44-2.2-1.61-1.91-3l.35-1.77a2.5 2.5 0 0 1 1.8-1.92l5.6-1.53a4.5 4.5 0 0 1 5.6 3.54l.69 3.76A3 3 0 0 1 14 12.5h-.89l.01.05c.08.41.18.97.24 1.58.07.62.1 1.29.05 1.92a3.68 3.68 0 0 1-.5 1.73c-.11.16-.27.35-.44.52Z"]),E$=Ne("ThumbDislike20Regular","20",["M10.05 17.7c.34.98 1.63 1.43 2.43.6.17-.17.33-.36.44-.52.32-.48.45-1.12.5-1.73.05-.63.02-1.3-.05-1.92-.06-.6-.16-1.17-.24-1.58v-.05H14a3 3 0 0 0 2.95-3.54l-.69-3.76a4.5 4.5 0 0 0-5.6-3.54L5.06 3.2c-.92.25-1.62 1-1.8 1.92l-.35 1.77c-.28 1.39.78 2.56 1.9 3 .33.13.62.3.85.5 1.7 1.5 2.32 2.72 3.38 4.84.36.71.72 1.68 1 2.49Zm1.97-5.58v.04a14.2 14.2 0 0 1 .36 2.08c.06.58.09 1.18.04 1.73-.04.55-.15.98-.33 1.25-.06.1-.18.22-.33.39-.2.2-.63.16-.76-.23-.29-.82-.67-1.83-1.05-2.6-1.07-2.14-1.76-3.5-3.62-5.15-.34-.3-.74-.52-1.13-.68-.88-.34-1.45-1.14-1.3-1.87l.35-1.77c.11-.56.53-1 1.08-1.15l5.6-1.53a3.5 3.5 0 0 1 4.36 2.75l.68 3.76a2 2 0 0 1-1.96 2.36h-1.5a.5.5 0 0 0-.5.62Z"]),w$=Ne("ThumbLike20Filled","20",["M12.48 1.7c-.8-.83-2.09-.38-2.43.6-.28.8-.64 1.77-1 2.48C8 6.9 7.38 8.1 5.67 9.63c-.23.2-.52.36-.84.49-1.13.44-2.2 1.61-1.91 3l.35 1.77a2.5 2.5 0 0 0 1.8 1.92l5.6 1.52a4.5 4.5 0 0 0 5.6-3.53l.69-3.76A3 3 0 0 0 14 7.5h-.89l.01-.05c.08-.41.18-.97.24-1.59.07-.6.1-1.28.05-1.9a3.68 3.68 0 0 0-.5-1.74 4.16 4.16 0 0 0-.44-.52Z"]),_$=Ne("ThumbLike20Regular","20",["M10.05 2.3c.34-.98 1.63-1.43 2.43-.6.17.17.33.36.44.52.32.48.45 1.12.5 1.73.05.63.02 1.3-.05 1.91-.06.62-.16 1.18-.24 1.59v.05H14a3 3 0 0 1 2.95 3.54l-.69 3.76a4.5 4.5 0 0 1-5.6 3.53l-5.6-1.52a2.5 2.5 0 0 1-1.8-1.92l-.35-1.77c-.28-1.39.78-2.56 1.9-3 .33-.13.62-.3.85-.5 1.7-1.5 2.32-2.72 3.38-4.84.36-.71.72-1.68 1-2.49Zm1.97 5.58v-.04a13.7 13.7 0 0 0 .13-.58c.08-.4.17-.93.23-1.5.06-.58.09-1.18.04-1.73a2.73 2.73 0 0 0-.33-1.25 3.26 3.26 0 0 0-.33-.39c-.2-.2-.63-.16-.76.23-.29.82-.67 1.83-1.05 2.6-1.07 2.14-1.76 3.5-3.62 5.15-.34.3-.74.52-1.13.68-.88.34-1.45 1.14-1.3 1.87l.35 1.77c.11.56.53 1 1.08 1.15l5.6 1.53c1.98.54 4-.73 4.36-2.75l.68-3.76a2 2 0 0 0-1.96-2.36h-1.5a.5.5 0 0 1-.5-.62Z"]),k$=Ne("Warning12Filled","12",["M5.21 1.46a.9.9 0 0 1 1.58 0l4.09 7.17a.92.92 0 0 1-.79 1.37H1.91a.92.92 0 0 1-.79-1.37l4.1-7.17ZM5.5 4.5v1a.5.5 0 0 0 1 0v-1a.5.5 0 0 0-1 0ZM6 6.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"]),P$=(e,t)=>Z(uU,{value:t.provider,children:Z(nU,{value:t.theme,children:Z(iU,{value:t.themeClassName,children:Z(hU,{value:t.customStyleHooks_unstable,children:Z(lU,{value:t.tooltip,children:Z(mq,{dir:t.textDirection,children:Z(jU,{value:t.iconDirection,children:Z(dU,{value:t.overrides_unstable,children:Ar(e.root,{children:[oc()?null:Z("style",{dangerouslySetInnerHTML:{__html:e.serverStyleProps.cssRule},...e.serverStyleProps.attributes}),e.root.children]})})})})})})})})});var R$=typeof WeakRef<"u",cA=class{constructor(e){R$&&typeof e=="object"?this._weakRef=new WeakRef(e):this._instance=e}deref(){var e,t;let r;return this._weakRef?(r=(e=this._weakRef)==null?void 0:e.deref(),r||delete this._weakRef):(r=this._instance,(t=r==null?void 0:r.isDisposed)!=null&&t.call(r)&&delete this._instance),r}},si="keyborg:focusin";function A$(e){const t=e.HTMLElement,r=t.prototype.focus;let n=!1;return t.prototype.focus=function(){n=!0},e.document.createElement("button").focus(),t.prototype.focus=r,n}var b0=!1;function Ao(e){const t=e.focus;t.__keyborgNativeFocus?t.__keyborgNativeFocus.call(e):e.focus()}function I$(e){const t=e;b0||(b0=A$(t));const r=t.HTMLElement.prototype.focus;if(r.__keyborgNativeFocus)return;t.HTMLElement.prototype.focus=s;const n=a=>{const l=a.relatedTarget,c=a.currentTarget;c.contains(l)||(c.removeEventListener("focusin",o,!0),c.removeEventListener("focusout",n,!0))},o=a=>{var l;const c=a.target;if(!c)return;if(c.shadowRoot){c.shadowRoot.addEventListener("focusin",o,!0),c.shadowRoot.addEventListener("focusout",n,!0);return}const u={relatedTarget:a.relatedTarget||void 0},d=new CustomEvent(si,{cancelable:!0,bubbles:!0,composed:!0,detail:u});d.details=u,(b0||i.lastFocusedProgrammatically)&&(u.isFocusedProgrammatically=c===((l=i.lastFocusedProgrammatically)==null?void 0:l.deref()),i.lastFocusedProgrammatically=void 0),c.dispatchEvent(d)},i=t.__keyborgData={focusInHandler:o};t.document.addEventListener("focusin",t.__keyborgData.focusInHandler,!0);function s(){const a=t.__keyborgData;return a&&(a.lastFocusedProgrammatically=new cA(this)),r.apply(this,arguments)}s.__keyborgNativeFocus=r}function x$(e){const t=e,r=t.HTMLElement.prototype,n=r.focus.__keyborgNativeFocus,o=t.__keyborgData;o&&(t.document.removeEventListener("focusin",o.focusInHandler,!0),delete t.__keyborgData),n&&(r.focus=n)}var N$=500,uA=0,B$=class{constructor(){this.__keyborgCoreRefs={},this._isNavigatingWithKeyboard=!1}add(e){const t=e.id;t in this.__keyborgCoreRefs||(this.__keyborgCoreRefs[t]=new cA(e))}remove(e){delete this.__keyborgCoreRefs[e],Object.keys(this.__keyborgCoreRefs).length===0&&(this._isNavigatingWithKeyboard=!1)}setVal(e){if(this._isNavigatingWithKeyboard!==e){this._isNavigatingWithKeyboard=e;for(const t of Object.keys(this.__keyborgCoreRefs)){const n=this.__keyborgCoreRefs[t].deref();n?n.update(e):this.remove(t)}}}getVal(){return this._isNavigatingWithKeyboard}},So=new B$,O$=class{constructor(e,t){this._onFocusIn=n=>{if(this._isMouseUsedTimer||So.getVal())return;const o=n.detail;o.relatedTarget&&(o.isFocusedProgrammatically||o.isFocusedProgrammatically===void 0||So.setVal(!0))},this._onMouseDown=n=>{if(n.buttons===0||n.clientX===0&&n.clientY===0&&n.screenX===0&&n.screenY===0)return;const o=this._win;o&&(this._isMouseUsedTimer&&o.clearTimeout(this._isMouseUsedTimer),this._isMouseUsedTimer=o.setTimeout(()=>{delete this._isMouseUsedTimer},1e3)),So.setVal(!1)},this._onKeyDown=n=>{So.getVal()?this._shouldDismissKeyboardNavigation(n)&&this._scheduleDismiss():this._shouldTriggerKeyboardNavigation(n)&&So.setVal(!0)},this.id="c"+ ++uA,this._win=e;const r=e.document;if(t){const n=t.triggerKeys,o=t.dismissKeys;n!=null&&n.length&&(this._triggerKeys=new Set(n)),o!=null&&o.length&&(this._dismissKeys=new Set(o))}r.addEventListener(si,this._onFocusIn,!0),r.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("keydown",this._onKeyDown,!0),I$(e),So.add(this)}dispose(){const e=this._win;if(e){this._isMouseUsedTimer&&(e.clearTimeout(this._isMouseUsedTimer),this._isMouseUsedTimer=void 0),this._dismissTimer&&(e.clearTimeout(this._dismissTimer),this._dismissTimer=void 0),x$(e);const t=e.document;t.removeEventListener(si,this._onFocusIn,!0),t.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("keydown",this._onKeyDown,!0),delete this._win,So.remove(this.id)}}isDisposed(){return!!this._win}update(e){var t,r;const n=(r=(t=this._win)==null?void 0:t.__keyborg)==null?void 0:r.refs;if(n)for(const o of Object.keys(n))Mb.update(n[o],e)}_shouldTriggerKeyboardNavigation(e){var t;if(e.key==="Tab")return!0;const r=(t=this._win)==null?void 0:t.document.activeElement,n=!this._triggerKeys||this._triggerKeys.has(e.keyCode),o=r&&(r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.isContentEditable);return n&&!o}_shouldDismissKeyboardNavigation(e){var t;return(t=this._dismissKeys)==null?void 0:t.has(e.keyCode)}_scheduleDismiss(){const e=this._win;if(e){this._dismissTimer&&(e.clearTimeout(this._dismissTimer),this._dismissTimer=void 0);const t=e.document.activeElement;this._dismissTimer=e.setTimeout(()=>{this._dismissTimer=void 0;const r=e.document.activeElement;t&&r&&t===r&&So.setVal(!1)},N$)}}},Mb=class dA{constructor(t,r){this._cb=[],this._id="k"+ ++uA,this._win=t;const n=t.__keyborg;n?(this._core=n.core,n.refs[this._id]=this):(this._core=new O$(t,r),t.__keyborg={core:this._core,refs:{[this._id]:this}})}static create(t,r){return new dA(t,r)}static dispose(t){t.dispose()}static update(t,r){t._cb.forEach(n=>n(r))}dispose(){var t;const r=(t=this._win)==null?void 0:t.__keyborg;r!=null&&r.refs[this._id]&&(delete r.refs[this._id],Object.keys(r.refs).length===0&&(r.core.dispose(),delete this._win.__keyborg)),this._cb=[],delete this._core,delete this._win}isNavigatingWithKeyboard(){return So.getVal()}subscribe(t){this._cb.push(t)}unsubscribe(t){const r=this._cb.indexOf(t);r>=0&&this._cb.splice(r,1)}setVal(t){So.setVal(t)}};function zb(e,t){return Mb.create(e,t)}function Lb(e){Mb.dispose(e)}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ *//*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */const Zo="data-tabster",fA="data-tabster-dummy",D$="tabster:deloser",hA="tabster:modalizer:active",pA="tabster:modalizer:inactive",M$="tabster:modalizer:focusin",z$="tabster:modalizer:focusout",L$="tabster:modalizer:beforefocusout",IS="tabster:mover",gA="tabster:focusin",vA="tabster:focusout",mA="tabster:movefocus",Fb=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","*[tabindex]","*[contenteditable]"].join(", "),F$={Any:0,Accessible:1,Focusable:2},j$={History:0,DeloserDefault:1,RootDefault:2,DeloserFirst:3,RootFirst:4},Wo={Invisible:0,PartiallyVisible:1,Visible:2},T1={Source:0,Target:1},Qs={Both:0,Vertical:1,Horizontal:2,Grid:3,GridLinear:4},yA={Unlimited:0,Limited:1,LimitedTrapFocus:2},SA={Auto:0,Inside:1,Outside:2};var an=Object.freeze({__proto__:null,TabsterAttributeName:Zo,TabsterDummyInputAttributeName:fA,DeloserEventName:D$,ModalizerActiveEventName:hA,ModalizerInactiveEventName:pA,ModalizerFocusInEventName:M$,ModalizerFocusOutEventName:z$,ModalizerBeforeFocusOutEventName:L$,MoverEventName:IS,FocusInEventName:gA,FocusOutEventName:vA,MoveFocusEventName:mA,FocusableSelector:Fb,ObservedElementAccesibilities:F$,RestoreFocusOrders:j$,Visibilities:Wo,RestorerTypes:T1,MoverDirections:Qs,GroupperTabbabilities:yA,SysDummyInputsPositions:SA});/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */function Mr(e,t){var r;return(r=e.storageEntry(t))===null||r===void 0?void 0:r.tabster}function bA(e,t,r){var n,o;const i=r||e._noop?void 0:t.getAttribute(Zo);let s=e.storageEntry(t),a;if(i)if(i!==((n=s==null?void 0:s.attr)===null||n===void 0?void 0:n.string))try{const d=JSON.parse(i);if(typeof d!="object")throw new Error(`Value is not a JSON object, got '${i}'.`);a={string:i,object:d}}catch{}else return;else if(!s)return;s||(s=e.storageEntry(t,!0)),s.tabster||(s.tabster={});const l=s.tabster||{},c=((o=s.attr)===null||o===void 0?void 0:o.object)||{},u=(a==null?void 0:a.object)||{};for(const d of Object.keys(c))if(!u[d]){if(d==="root"){const f=l[d];f&&e.root.onRoot(f,!0)}switch(d){case"deloser":case"root":case"groupper":case"modalizer":case"restorer":case"mover":const f=l[d];f&&(f.dispose(),delete l[d]);break;case"observed":delete l[d],e.observedElement&&e.observedElement.onObservedElementUpdate(t);break;case"focusable":case"outline":case"uncontrolled":case"sys":delete l[d];break}}for(const d of Object.keys(u)){const f=u.sys;switch(d){case"deloser":l.deloser?l.deloser.setProps(u.deloser):e.deloser&&(l.deloser=e.deloser.createDeloser(t,u.deloser));break;case"root":l.root?l.root.setProps(u.root):l.root=e.root.createRoot(t,u.root,f),e.root.onRoot(l.root);break;case"modalizer":l.modalizer?l.modalizer.setProps(u.modalizer):e.modalizer&&(l.modalizer=e.modalizer.createModalizer(t,u.modalizer,f));break;case"restorer":l.restorer?l.restorer.setProps(u.restorer):e.restorer&&u.restorer&&(l.restorer=e.restorer.createRestorer(t,u.restorer));break;case"focusable":l.focusable=u.focusable;break;case"groupper":l.groupper?l.groupper.setProps(u.groupper):e.groupper&&(l.groupper=e.groupper.createGroupper(t,u.groupper,f));break;case"mover":l.mover?l.mover.setProps(u.mover):e.mover&&(l.mover=e.mover.createMover(t,u.mover,f));break;case"observed":e.observedElement&&(l.observed=u.observed,e.observedElement.onObservedElementUpdate(t));break;case"uncontrolled":l.uncontrolled=u.uncontrolled;break;case"outline":e.outline&&(l.outline=u.outline);break;case"sys":l.sys=u.sys;break;default:console.error(`Unknown key '${d}' in data-tabster attribute value.`)}}a?s.attr=a:(Object.keys(l).length===0&&(delete s.tabster,delete s.attr),e.storageEntry(t,!1))}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */function H$(e){const t=e();try{if(t.EventTarget)return new t.EventTarget}catch(r){if(!(r instanceof TypeError))throw r}return t.document.createElement("div")}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */let xS;const n4=typeof DOMRect<"u"?DOMRect:class{constructor(e,t,r,n){this.left=e||0,this.top=t||0,this.right=(e||0)+(r||0),this.bottom=(t||0)+(n||0)}};let q$=0;try{document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT),xS=!1}catch{xS=!0}const C0=100;function gi(e){const t=e();let r=t.__tabsterInstanceContext;return r||(r={elementByUId:{},basics:{Promise:t.Promise||void 0,WeakRef:t.WeakRef||void 0},containerBoundingRectCache:{},lastContainerBoundingRectCacheId:0,fakeWeakRefs:[],fakeWeakRefsStarted:!1},t.__tabsterInstanceContext=r),r}function U$(e){const t=e.__tabsterInstanceContext;t&&(t.elementByUId={},delete t.WeakRef,t.containerBoundingRectCache={},t.containerBoundingRectCacheTimer&&e.clearTimeout(t.containerBoundingRectCacheTimer),t.fakeWeakRefsTimer&&e.clearTimeout(t.fakeWeakRefsTimer),t.fakeWeakRefs=[],delete e.__tabsterInstanceContext)}function $$(e){const t=e.__tabsterInstanceContext;return new((t==null?void 0:t.basics.WeakMap)||WeakMap)}function W$(e){return!!e.querySelector(Fb)}class CA{constructor(t){this._target=t}deref(){return this._target}static cleanup(t,r){return t._target?r||!Hb(t._target.ownerDocument,t._target)?(delete t._target,!0):!1:!0}}class pn{constructor(t,r,n){const o=gi(t);let i;o.WeakRef?i=new o.WeakRef(r):(i=new CA(r),o.fakeWeakRefs.push(i)),this._ref=i,this._data=n}get(){const t=this._ref;let r;return t&&(r=t.deref(),r||delete this._ref),r}getData(){return this._data}}function TA(e,t){const r=gi(e);r.fakeWeakRefs=r.fakeWeakRefs.filter(n=>!CA.cleanup(n,t))}function EA(e){const t=gi(e);t.fakeWeakRefsStarted||(t.fakeWeakRefsStarted=!0,t.WeakRef=Y$(t)),t.fakeWeakRefsTimer||(t.fakeWeakRefsTimer=e().setTimeout(()=>{t.fakeWeakRefsTimer=void 0,TA(e),EA(e)},2*60*1e3))}function V$(e){const t=gi(e);t.fakeWeakRefsStarted=!1,t.fakeWeakRefsTimer&&(e().clearTimeout(t.fakeWeakRefsTimer),t.fakeWeakRefsTimer=void 0,t.fakeWeakRefs=[])}function jb(e,t,r){if(t.nodeType!==Node.ELEMENT_NODE)return;const n=xS?r:{acceptNode:r};return e.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,n,!1)}function wA(e,t){let r=t.__tabsterCacheId;const n=gi(e),o=r?n.containerBoundingRectCache[r]:void 0;if(o)return o.rect;const i=t.ownerDocument&&t.ownerDocument.documentElement;if(!i)return new n4;let s=0,a=0,l=i.clientWidth,c=i.clientHeight;if(t!==i){const d=t.getBoundingClientRect();s=Math.max(s,d.left),a=Math.max(a,d.top),l=Math.min(l,d.right),c=Math.min(c,d.bottom)}const u=new n4(s{n.containerBoundingRectCacheTimer=void 0;for(const d of Object.keys(n.containerBoundingRectCache))delete n.containerBoundingRectCache[d].element.__tabsterCacheId;n.containerBoundingRectCache={}},50)),u}function o4(e,t,r){const n=_A(t);if(!n)return!1;const o=wA(e,n),i=t.getBoundingClientRect(),s=i.height*(1-r),a=Math.max(0,o.top-i.top),l=Math.max(0,i.bottom-o.bottom),c=a+l;return c===0||c<=s}function K$(e,t,r){const n=_A(t);if(n){const o=wA(e,n),i=t.getBoundingClientRect();r?n.scrollTop+=i.top-o.top:n.scrollTop+=i.bottom-o.bottom}}function _A(e){const t=e.ownerDocument;if(t){for(let r=e.parentElement;r;r=r.parentElement)if(r.scrollWidth>r.clientWidth||r.scrollHeight>r.clientHeight)return r;return t.documentElement}return null}function G$(e){e.__shouldIgnoreFocus=!0}function kA(e){return!!e.__shouldIgnoreFocus}function Q$(e){const t=new Uint32Array(4);if(e.crypto&&e.crypto.getRandomValues)e.crypto.getRandomValues(t);else if(e.msCrypto&&e.msCrypto.getRandomValues)e.msCrypto.getRandomValues(t);else for(let n=0;n{if(this._fixedTarget){const f=this._fixedTarget.get();f&&Ao(f);return}const d=this.input;if(this.onFocusIn&&d){const f=u.relatedTarget;this.onFocusIn(this,this._isBackward(!0,d,f),f)}},this._focusOut=u=>{if(this._fixedTarget)return;this.useDefaultAction=!1;const d=this.input;if(this.onFocusOut&&d){const f=u.relatedTarget;this.onFocusOut(this,this._isBackward(!1,d,f),f)}};const a=t(),l=a.document.createElement("i");l.tabIndex=0,l.setAttribute("role","none"),l.setAttribute(fA,""),l.setAttribute("aria-hidden","true");const c=l.style;c.position="fixed",c.width=c.height="1px",c.opacity="0.001",c.zIndex="-1",c.setProperty("content-visibility","hidden"),G$(l),this.input=l,this.isFirst=n.isFirst,this.isOutside=r,this._isPhantom=(s=n.isPhantom)!==null&&s!==void 0?s:!1,this._fixedTarget=i,l.addEventListener("focusin",this._focusIn),l.addEventListener("focusout",this._focusOut),l.__tabsterDummyContainer=o,this._isPhantom&&(this._disposeTimer=a.setTimeout(()=>{delete this._disposeTimer,this.dispose()},0),this._clearDisposeTimeout=()=>{this._disposeTimer&&(a.clearTimeout(this._disposeTimer),delete this._disposeTimer),delete this._clearDisposeTimeout})}dispose(){var t;this._clearDisposeTimeout&&this._clearDisposeTimeout();const r=this.input;r&&(delete this._fixedTarget,delete this.onFocusIn,delete this.onFocusOut,delete this.input,r.removeEventListener("focusin",this._focusIn),r.removeEventListener("focusout",this._focusOut),delete r.__tabsterDummyContainer,(t=r.parentElement)===null||t===void 0||t.removeChild(r))}setTopLeft(t,r){var n;const o=(n=this.input)===null||n===void 0?void 0:n.style;o&&(o.top=`${t}px`,o.left=`${r}px`)}_isBackward(t,r,n){return t&&!n?!this.isFirst:!!(n&&r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)}}const _v={Root:1,Modalizer:2,Mover:3,Groupper:4};class Ul{constructor(t,r,n,o,i,s){this._element=r,this._instance=new eW(t,r,this,n,o,i,s)}_setHandlers(t,r){this._onFocusIn=t,this._onFocusOut=r}moveOut(t){var r;(r=this._instance)===null||r===void 0||r.moveOut(t)}moveOutWithDefaultAction(t,r){var n;(n=this._instance)===null||n===void 0||n.moveOutWithDefaultAction(t,r)}getHandler(t){return t?this._onFocusIn:this._onFocusOut}setTabbable(t){var r;(r=this._instance)===null||r===void 0||r.setTabbable(this,t)}dispose(){this._instance&&(this._instance.dispose(this),delete this._instance),delete this._onFocusIn,delete this._onFocusOut}static moveWithPhantomDummy(t,r,n,o,i){var s;const l=new _p(t.getWindow,!0,{isPhantom:!0,isFirst:!0}).input;if(l){let c,u;if(r.tagName==="BODY")c=r,u=n&&o||!n&&!o?r.firstElementChild:null;else{n&&(!o||o&&!t.focusable.isFocusable(r,!1,!0,!0))?(c=r,u=o?r.firstElementChild:null):(c=r.parentElement,u=n&&o||!n&&!o?r:r.nextElementSibling);let d,f;do d=n&&o||!n&&!o?u==null?void 0:u.previousElementSibling:u,f=(s=d==null?void 0:d.__tabsterDummyContainer)===null||s===void 0?void 0:s.get(),f===r?u=n&&o||!n&&!o?d:d==null?void 0:d.nextElementSibling:f=void 0;while(f)}c&&Xi({by:"root",owner:c,next:null,relatedEvent:i})&&(c.insertBefore(l,u),Ao(l))}}static addPhantomDummyWithTarget(t,r,n,o){const s=new _p(t.getWindow,!0,{isPhantom:!0,isFirst:!0},void 0,new pn(t.getWindow,o)).input;if(s){let a,l;W$(r)&&!n?(a=r,l=r.firstElementChild):(a=r.parentElement,l=n?r:r.nextElementSibling),a==null||a.insertBefore(s,l)}}}class Z${constructor(t){this._updateQueue=new Set,this._lastUpdateQueueTime=0,this._changedParents=new WeakSet,this._dummyElements=[],this._dummyCallbacks=new WeakMap,this._domChanged=r=>{var n;this._changedParents.has(r)||(this._changedParents.add(r),!this._updateDummyInputsTimer&&(this._updateDummyInputsTimer=(n=this._win)===null||n===void 0?void 0:n.call(this).setTimeout(()=>{delete this._updateDummyInputsTimer;for(const o of this._dummyElements){const i=o.get();if(i){const s=this._dummyCallbacks.get(i);if(s){const a=i.parentElement;(!a||this._changedParents.has(a))&&s()}}}this._changedParents=new WeakSet},C0)))},this._win=t}add(t,r){!this._dummyCallbacks.has(t)&&this._win&&(this._dummyElements.push(new pn(this._win,t)),this._dummyCallbacks.set(t,r),this.domChanged=this._domChanged)}remove(t){this._dummyElements=this._dummyElements.filter(r=>{const n=r.get();return n&&n!==t}),this._dummyCallbacks.delete(t),this._dummyElements.length===0&&delete this.domChanged}dispose(){var t;const r=(t=this._win)===null||t===void 0?void 0:t.call(this);this._updateTimer&&(r==null||r.clearTimeout(this._updateTimer),delete this._updateTimer),this._updateDummyInputsTimer&&(r==null||r.clearTimeout(this._updateDummyInputsTimer),delete this._updateDummyInputsTimer),this._changedParents=new WeakSet,this._dummyCallbacks=new WeakMap,this._dummyElements=[],this._updateQueue.clear(),delete this.domChanged,delete this._win}updatePositions(t){this._win&&(this._updateQueue.add(t),this._lastUpdateQueueTime=Date.now(),this._scheduledUpdatePositions())}_scheduledUpdatePositions(){var t;this._updateTimer||(this._updateTimer=(t=this._win)===null||t===void 0?void 0:t.call(this).setTimeout(()=>{if(delete this._updateTimer,this._lastUpdateQueueTime+C0<=Date.now()){const r=new Map,n=[];for(const o of this._updateQueue)n.push(o(r));this._updateQueue.clear();for(const o of n)o();r.clear()}else this._scheduledUpdatePositions()},C0))}}class eW{constructor(t,r,n,o,i,s,a){this._wrappers=[],this._isOutside=!1,this._transformElements=new Set,this._onFocusIn=(p,h,v)=>{this._onFocus(!0,p,h,v)},this._onFocusOut=(p,h,v)=>{this._onFocus(!1,p,h,v)},this.moveOut=p=>{var h;const v=this._firstDummy,y=this._lastDummy;if(v&&y){this._ensurePosition();const g=v.input,m=y.input,b=(h=this._element)===null||h===void 0?void 0:h.get();if(g&&m&&b){let C;p?(g.tabIndex=0,C=g):(m.tabIndex=0,C=m),C&&Ao(C)}}},this.moveOutWithDefaultAction=(p,h)=>{var v;const y=this._firstDummy,g=this._lastDummy;if(y&&g){this._ensurePosition();const m=y.input,b=g.input,C=(v=this._element)===null||v===void 0?void 0:v.get();if(m&&b&&C){let k;p?!y.isOutside&&this._tabster.focusable.isFocusable(C,!0,!0,!0)?k=C:(y.useDefaultAction=!0,m.tabIndex=0,k=m):(g.useDefaultAction=!0,b.tabIndex=0,k=b),k&&Xi({by:"root",owner:C,next:null,relatedEvent:h})&&Ao(k)}}},this.setTabbable=(p,h)=>{var v,y;for(const m of this._wrappers)if(m.manager===p){m.tabbable=h;break}const g=this._getCurrent();if(g){const m=g.tabbable?0:-1;let b=(v=this._firstDummy)===null||v===void 0?void 0:v.input;b&&(b.tabIndex=m),b=(y=this._lastDummy)===null||y===void 0?void 0:y.input,b&&(b.tabIndex=m)}},this._addDummyInputs=()=>{this._addTimer||(this._addTimer=this._getWindow().setTimeout(()=>{delete this._addTimer,this._ensurePosition(),this._addTransformOffsets()},0))},this._addTransformOffsets=()=>{this._tabster._dummyObserver.updatePositions(this._computeTransformOffsets)},this._computeTransformOffsets=p=>{var h,v;const y=((h=this._firstDummy)===null||h===void 0?void 0:h.input)||((v=this._lastDummy)===null||v===void 0?void 0:v.input),g=this._transformElements,m=new Set;let b=0,C=0;const k=this._getWindow();for(let E=y;E&&E.nodeType===Node.ELEMENT_NODE;E=E.parentElement){let w=p.get(E);if(w===void 0){const A=k.getComputedStyle(E).transform;A&&A!=="none"&&(w={scrollTop:E.scrollTop,scrollLeft:E.scrollLeft}),p.set(E,w||null)}w&&(m.add(E),g.has(E)||E.addEventListener("scroll",this._addTransformOffsets),b+=w.scrollTop,C+=w.scrollLeft)}for(const E of g)m.has(E)||E.removeEventListener("scroll",this._addTransformOffsets);return this._transformElements=m,()=>{var E,w;(E=this._firstDummy)===null||E===void 0||E.setTopLeft(b,C),(w=this._lastDummy)===null||w===void 0||w.setTopLeft(b,C)}};const l=r.get();if(!l)throw new Error("No element");this._tabster=t,this._getWindow=t.getWindow,this._callForDefaultAction=a;const c=l.__tabsterDummy;if((c||this)._wrappers.push({manager:n,priority:o,tabbable:!0}),c)return c;l.__tabsterDummy=this;const u=i==null?void 0:i.dummyInputsPosition,d=l.tagName;this._isOutside=u?u===SA.Outside:(s||d==="UL"||d==="OL"||d==="TABLE")&&!(d==="LI"||d==="TD"||d==="TH"),this._firstDummy=new _p(this._getWindow,this._isOutside,{isFirst:!0},r),this._lastDummy=new _p(this._getWindow,this._isOutside,{isFirst:!1},r);const f=this._firstDummy.input;f&&t._dummyObserver.add(f,this._addDummyInputs),this._firstDummy.onFocusIn=this._onFocusIn,this._firstDummy.onFocusOut=this._onFocusOut,this._lastDummy.onFocusIn=this._onFocusIn,this._lastDummy.onFocusOut=this._onFocusOut,this._element=r,this._addDummyInputs()}dispose(t,r){var n,o,i,s;if((this._wrappers=this._wrappers.filter(l=>l.manager!==t&&!r)).length===0){delete((n=this._element)===null||n===void 0?void 0:n.get()).__tabsterDummy;for(const u of this._transformElements)u.removeEventListener("scroll",this._addTransformOffsets);this._transformElements.clear();const l=this._getWindow();this._addTimer&&(l.clearTimeout(this._addTimer),delete this._addTimer);const c=(o=this._firstDummy)===null||o===void 0?void 0:o.input;c&&this._tabster._dummyObserver.remove(c),(i=this._firstDummy)===null||i===void 0||i.dispose(),(s=this._lastDummy)===null||s===void 0||s.dispose()}}_onFocus(t,r,n,o){var i;const s=this._getCurrent();s&&(!r.useDefaultAction||this._callForDefaultAction)&&((i=s.manager.getHandler(t))===null||i===void 0||i(r,n,o))}_getCurrent(){return this._wrappers.sort((t,r)=>t.tabbable!==r.tabbable?t.tabbable?-1:1:t.priority-r.priority),this._wrappers[0]}_ensurePosition(){var t,r,n;const o=(t=this._element)===null||t===void 0?void 0:t.get(),i=(r=this._firstDummy)===null||r===void 0?void 0:r.input,s=(n=this._lastDummy)===null||n===void 0?void 0:n.input;if(!(!o||!i||!s))if(this._isOutside){const a=o.parentElement;if(a){const l=o.nextElementSibling;l!==s&&a.insertBefore(s,l),o.previousElementSibling!==i&&a.insertBefore(i,o)}}else{o.lastElementChild!==s&&o.appendChild(s);const a=o.firstElementChild;a&&a!==i&&o.insertBefore(i,a)}}}function RA(e){let t=null;for(let r=e.lastElementChild;r;r=r.lastElementChild)t=r;return t||void 0}function tW(e,t){let r=e,n=null;for(;r&&!n;)n=t?r.previousElementSibling:r.nextElementSibling,r=r.parentElement;return n||void 0}function rs(e,t,r){const n=document.createEvent("HTMLEvents");return n.initEvent(t,!0,!0),n.details=r,e.dispatchEvent(n),!n.defaultPrevented}function Xi(e){return rs(e.owner,mA,e)}function T0(e,t,r,n){const o=e.storageEntry(t,!0);let i=!1;if(!o.aug){if(n===void 0)return i;o.aug={}}if(n===void 0){if(r in o.aug){const s=o.aug[r];delete o.aug[r],s===null?t.removeAttribute(r):t.setAttribute(r,s),i=!0}}else{let s;r in o.aug||(s=t.getAttribute(r)),s!==void 0&&s!==n&&(o.aug[r]=s,n===null?t.removeAttribute(r):t.setAttribute(r,n),i=!0)}return n===void 0&&Object.keys(o.aug).length===0&&(delete o.aug,e.storageEntry(t,!1)),i}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */function kv(e,t){const r=JSON.stringify(e);return t===!0?r:{[Zo]:r}}function rW(e,t){for(const r of Object.keys(t)){const n=t[r];n?e[r]=n:delete e[r]}}function nW(e,t,r){let n;if(r){const o=e.getAttribute(Zo);if(o)try{n=JSON.parse(o)}catch{}}n||(n={}),rW(n,t),Object.keys(n).length>0?e.setAttribute(Zo,kv(n,!0)):e.removeAttribute(Zo)}class s4 extends Ul{constructor(t,r,n,o){super(t,r,_v.Root,o,void 0,!0),this._onDummyInputFocus=i=>{var s;if(i.useDefaultAction)this._setFocused(!1);else{this._tabster.keyboardNavigation.setNavigatingWithKeyboard(!0);const a=this._element.get();if(a){this._setFocused(!0);const l=this._tabster.focusedElement.getFirstOrLastTabbable(i.isFirst,{container:a,ignoreAccessibility:!0});if(l){Ao(l);return}}(s=i.input)===null||s===void 0||s.blur()}},this._setHandlers(this._onDummyInputFocus),this._tabster=t,this._setFocused=n}}class oW extends cf{constructor(t,r,n,o,i){super(t,r,o),this._isFocused=!1,this._setFocused=l=>{var c;if(this._setFocusedTimer&&(this._tabster.getWindow().clearTimeout(this._setFocusedTimer),delete this._setFocusedTimer),this._isFocused===l)return;const u=this._element.get();u&&(l?(this._isFocused=!0,(c=this._dummyManager)===null||c===void 0||c.setTabbable(!1),rs(this._tabster.root.eventTarget,"focus",{element:u})):this._setFocusedTimer=this._tabster.getWindow().setTimeout(()=>{var d;delete this._setFocusedTimer,this._isFocused=!1,(d=this._dummyManager)===null||d===void 0||d.setTabbable(!0),rs(this._tabster.root.eventTarget,"blur",{element:u})},0))},this._onFocusIn=l=>{const c=this._tabster.getParent,u=this._element.get();let d=l.target;do{if(d===u){this._setFocused(!0);return}d=d&&c(d)}while(d)},this._onFocusOut=()=>{this._setFocused(!1)},this._onDispose=n;const s=t.getWindow;this.uid=Lh(s,r),this._sys=i,(t.controlTab||t.rootDummyInputs)&&this.addDummyInputs();const a=s();a.document.addEventListener("focusin",this._onFocusIn),a.document.addEventListener("focusout",this._onFocusOut),this._add()}addDummyInputs(){this._dummyManager||(this._dummyManager=new s4(this._tabster,this._element,this._setFocused,this._sys))}dispose(){var t;this._onDispose(this);const r=this._tabster.getWindow();r.document.removeEventListener("focusin",this._onFocusIn),r.document.removeEventListener("focusout",this._onFocusOut),this._setFocusedTimer&&(r.clearTimeout(this._setFocusedTimer),delete this._setFocusedTimer),(t=this._dummyManager)===null||t===void 0||t.dispose(),this._remove()}moveOutWithDefaultAction(t,r){const n=this._dummyManager;if(n)n.moveOutWithDefaultAction(t,r);else{const o=this.getElement();o&&s4.moveWithPhantomDummy(this._tabster,o,!0,t,r)}}_add(){}_remove(){}}class wt{constructor(t,r){this._autoRootWaiting=!1,this._roots={},this._forceDummy=!1,this.rootById={},this._autoRootCreate=()=>{var n;const o=this._win().document,i=o.body;if(i){this._autoRootUnwait(o);const s=this._autoRoot;if(s)return nW(i,{root:s},!0),bA(this._tabster,i),(n=Mr(this._tabster,i))===null||n===void 0?void 0:n.root}else this._autoRootWaiting||(this._autoRootWaiting=!0,o.addEventListener("readystatechange",this._autoRootCreate))},this._onRootDispose=n=>{delete this._roots[n.id]},this._tabster=t,this._win=t.getWindow,this._autoRoot=r,this.eventTarget=H$(this._win),t.queueInit(()=>{this._autoRoot&&this._autoRootCreate()})}_autoRootUnwait(t){t.removeEventListener("readystatechange",this._autoRootCreate),this._autoRootWaiting=!1}dispose(){const t=this._win();this._autoRootUnwait(t.document),delete this._autoRoot,Object.keys(this._roots).forEach(r=>{this._roots[r]&&(this._roots[r].dispose(),delete this._roots[r])}),this.rootById={}}createRoot(t,r,n){const o=new oW(this._tabster,t,this._onRootDispose,r,n);return this._roots[o.id]=o,this._forceDummy&&o.addDummyInputs(),o}addDummyInputs(){this._forceDummy=!0;const t=this._roots;for(const r of Object.keys(t))t[r].addDummyInputs()}static getRootByUId(t,r){const n=t().__tabsterInstance;return n&&n.root.rootById[r]}static getTabsterContext(t,r,n){n===void 0&&(n={});var o,i,s,a;if(!r.ownerDocument)return;const{checkRtl:l,referenceElement:c}=n,u=t.getParent;t.drainInitQueue();let d,f,p,h,v=!1,y,g,m,b,C=c||r;const k={};for(;C&&(!d||l);){const w=Mr(t,C);if(l&&m===void 0){const B=C.dir;B&&(m=B.toLowerCase()==="rtl")}if(!w){C=u(C);continue}const A=C.tagName;(w.uncontrolled||A==="IFRAME"||A==="WEBVIEW")&&(b=C),!h&&(!((o=w.focusable)===null||o===void 0)&&o.excludeFromMover)&&!p&&(v=!0);const D=w.modalizer,I=w.groupper,M=w.mover;!f&&D&&(f=D),!p&&I&&(!f||D)&&(f?(!I.isActive()&&I.getProps().tabbability&&f.userId!==((i=t.modalizer)===null||i===void 0?void 0:i.activeId)&&(f=void 0,p=I),g=I):p=I),!h&&M&&(!f||D)&&(!I||C!==r)&&(h=M,y=!!p&&p!==I),w.root&&(d=w.root),!((s=w.focusable)===null||s===void 0)&&s.ignoreKeydown&&Object.assign(k,w.focusable.ignoreKeydown),C=u(C)}if(!d){const w=t.root;w._autoRoot&&!((a=r.ownerDocument)===null||a===void 0)&&a.body&&(d=w._autoRootCreate())}return p&&!h&&(y=!0),d?{root:d,modalizer:f,groupper:p,mover:h,groupperBeforeMover:y,modalizerInGroupper:g,rtl:l?!!m:void 0,uncontrolled:b,excludedFromMover:v,ignoreKeydown:w=>!!k[w.key]}:void 0}static getRoot(t,r){var n;const o=t.getParent;for(let i=r;i;i=o(i)){const s=(n=Mr(t,i))===null||n===void 0?void 0:n.root;if(s)return s}}onRoot(t,r){r?delete this.rootById[t.uid]:this.rootById[t.uid]=t}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */class AA{constructor(){this._callbacks=[]}dispose(){this._callbacks=[],delete this._val}subscribe(t){const r=this._callbacks;r.indexOf(t)<0&&r.push(t)}subscribeFirst(t){const r=this._callbacks,n=r.indexOf(t);n>=0&&r.splice(n,1),r.unshift(t)}unsubscribe(t){const r=this._callbacks.indexOf(t);r>=0&&this._callbacks.splice(r,1)}setVal(t,r){this._val!==t&&(this._val=t,this._callCallbacks(t,r))}getVal(){return this._val}trigger(t,r){this._callCallbacks(t,r)}_callCallbacks(t,r){this._callbacks.forEach(n=>n(t,r))}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */class iW{constructor(t){this._tabster=t}dispose(){}getProps(t){const r=Mr(this._tabster,t);return r&&r.focusable||{}}isFocusable(t,r,n,o){return PA(t,Fb)&&(r||t.tabIndex!==-1)?(n||this.isVisible(t))&&(o||this.isAccessible(t)):!1}isVisible(t){if(!t.ownerDocument||t.nodeType!==Node.ELEMENT_NODE||t.offsetParent===null&&t.ownerDocument.body!==t)return!1;const r=t.ownerDocument.defaultView;if(!r)return!1;const n=t.ownerDocument.body.getBoundingClientRect();return!(n.width===0&&n.height===0||r.getComputedStyle(t).visibility==="hidden")}isAccessible(t){var r;for(let n=t;n;n=n.parentElement){const o=Mr(this._tabster,n);if(this._isHidden(n)||!((r=o==null?void 0:o.focusable)===null||r===void 0?void 0:r.ignoreAriaDisabled)&&this._isDisabled(n))return!1}return!0}_isDisabled(t){return t.hasAttribute("disabled")}_isHidden(t){var r;const n=t.getAttribute("aria-hidden");return!!(n&&n.toLowerCase()==="true"&&!(!((r=this._tabster.modalizer)===null||r===void 0)&&r.isAugmented(t)))}findFirst(t,r){return this.findElement({...t},r)}findLast(t,r){return this.findElement({isBackward:!0,...t},r)}findNext(t,r){return this.findElement({...t},r)}findPrev(t,r){return this.findElement({...t,isBackward:!0},r)}findDefault(t,r){return this.findElement({...t,acceptCondition:n=>this.isFocusable(n,t.includeProgrammaticallyFocusable)&&!!this.getProps(n).isDefault},r)||null}findAll(t){return this._findElements(!0,t)||[]}findElement(t,r){const n=this._findElements(!1,t,r);return n&&n[0]}_findElements(t,r,n){var o,i,s;const{container:a,currentElement:l=null,includeProgrammaticallyFocusable:c,useActiveModalizer:u,ignoreAccessibility:d,modalizerId:f,isBackward:p,onElement:h}=r;n||(n={});const v=[];let{acceptCondition:y}=r;const g=!!y;if(!a)return null;y||(y=k=>this.isFocusable(k,c,!1,d));const m={container:a,modalizerUserId:f===void 0&&u?(o=this._tabster.modalizer)===null||o===void 0?void 0:o.activeId:f||((s=(i=wt.getTabsterContext(this._tabster,a))===null||i===void 0?void 0:i.modalizer)===null||s===void 0?void 0:s.userId),from:l||a,isBackward:p,acceptCondition:y,hasCustomCondition:g,includeProgrammaticallyFocusable:c,ignoreAccessibility:d,cachedGrouppers:{}},b=jb(a.ownerDocument,a,k=>this._acceptElement(k,m));if(!b)return null;const C=k=>{var E,w;const A=(E=m.foundElement)!==null&&E!==void 0?E:m.foundBackward;return A&&v.push(A),t?A&&(m.found=!1,delete m.foundElement,delete m.foundBackward,delete m.fromCtx,m.from=A,h&&!h(A))?!1:!!(A||k):(A&&n&&(n.uncontrolled=(w=wt.getTabsterContext(this._tabster,A))===null||w===void 0?void 0:w.uncontrolled),!!(k&&!A))};if(l||(n.outOfDOMOrder=!0),l)b.currentNode=l;else if(p){const k=RA(a);if(!k)return null;if(this._acceptElement(k,m)===NodeFilter.FILTER_ACCEPT&&!C(!0))return m.skippedFocusable&&(n.outOfDOMOrder=!0),v;b.currentNode=k}do p?b.previousNode():b.nextNode();while(C());return m.skippedFocusable&&(n.outOfDOMOrder=!0),v.length?v:null}_acceptElement(t,r){var n,o,i,s;if(r.found)return NodeFilter.FILTER_ACCEPT;const a=r.foundBackward;if(a&&(t===a||!a.contains(t)))return r.found=!0,r.foundElement=a,NodeFilter.FILTER_ACCEPT;const l=r.container;if(t===l)return NodeFilter.FILTER_SKIP;if(!l.contains(t)||t.__tabsterDummyContainer||!((n=r.rejectElementsFrom)===null||n===void 0)&&n.contains(t))return NodeFilter.FILTER_REJECT;const c=r.currentCtx=wt.getTabsterContext(this._tabster,t);if(!c)return NodeFilter.FILTER_SKIP;if(kA(t))return this.isFocusable(t,void 0,!0,!0)&&(r.skippedFocusable=!0),NodeFilter.FILTER_SKIP;if(!r.hasCustomCondition&&(t.tagName==="IFRAME"||t.tagName==="WEBVIEW"))return((o=c.modalizer)===null||o===void 0?void 0:o.userId)===((i=this._tabster.modalizer)===null||i===void 0?void 0:i.activeId)?(r.found=!0,r.rejectElementsFrom=r.foundElement=t,NodeFilter.FILTER_ACCEPT):NodeFilter.FILTER_REJECT;if(!r.ignoreAccessibility&&!this.isAccessible(t))return this.isFocusable(t,!1,!0,!0)&&(r.skippedFocusable=!0),NodeFilter.FILTER_REJECT;let u,d=r.fromCtx;d||(d=r.fromCtx=wt.getTabsterContext(this._tabster,r.from));const f=d==null?void 0:d.mover;let p=c.groupper,h=c.mover;if(u=(s=this._tabster.modalizer)===null||s===void 0?void 0:s.acceptElement(t,r),u!==void 0&&(r.skippedFocusable=!0),u===void 0&&(p||h||f)){const v=p==null?void 0:p.getElement(),y=f==null?void 0:f.getElement();let g=h==null?void 0:h.getElement();g&&(y!=null&&y.contains(g))&&l.contains(y)&&(!v||!h||y.contains(v))&&(h=f,g=y),v&&(v===l||!l.contains(v))&&(p=void 0),g&&!l.contains(g)&&(h=void 0),p&&h&&(g&&v&&!v.contains(g)?h=void 0:p=void 0),p&&(u=p.acceptElement(t,r)),h&&(u=h.acceptElement(t,r))}return u===void 0&&(u=r.acceptCondition(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,u===NodeFilter.FILTER_SKIP&&this.isFocusable(t,!1,!0,!0)&&(r.skippedFocusable=!0)),u===NodeFilter.FILTER_ACCEPT&&!r.found&&(r.isBackward?(r.foundBackward=t,u=NodeFilter.FILTER_SKIP):(r.found=!0,r.foundElement=t)),u}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */const He={Tab:9,Enter:13,Esc:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40};/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */function sW(e,t){var r;const n=e.getParent;let o=t;do{const i=(r=Mr(e,o))===null||r===void 0?void 0:r.uncontrolled;if(i&&e.uncontrolled.isUncontrolledCompletely(o,!!i.completely))return o;o=n(o)}while(o)}class Rt extends AA{constructor(t,r){super(),this._init=()=>{const n=this._win(),o=n.document;o.addEventListener(si,this._onFocusIn,!0),o.addEventListener("focusout",this._onFocusOut,!0),n.addEventListener("keydown",this._onKeyDown,!0);const i=o.activeElement;i&&i!==o.body&&this._setFocusedElement(i),this.subscribe(this._onChanged)},this._onFocusIn=n=>{this._setFocusedElement(n.target,n.details.relatedTarget,n.details.isFocusedProgrammatically)},this._onFocusOut=n=>{this._setFocusedElement(void 0,n.relatedTarget)},this._validateFocusedElement=n=>{},this._onKeyDown=n=>{if(n.keyCode!==He.Tab||n.ctrlKey)return;const o=this.getVal();if(!o||!o.ownerDocument||o.contentEditable==="true")return;const i=this._tabster,s=i.controlTab,a=wt.getTabsterContext(i,o);if(!a||a.ignoreKeydown(n))return;const l=n.shiftKey,c=Rt.findNextTabbable(i,a,void 0,o,void 0,l,!0),u=a.root.getElement();if(!u)return;const d=c==null?void 0:c.element,f=sW(i,o);if(d){const p=c.uncontrolled;if(a.uncontrolled||p!=null&&p.contains(o)){if(!c.outOfDOMOrder&&p===a.uncontrolled||f&&!f.contains(d))return;Ul.addPhantomDummyWithTarget(i,o,l,d);return}if(p||d.tagName==="IFRAME"){Xi({by:"root",owner:u,next:d,relatedEvent:n})&&Ul.moveWithPhantomDummy(this._tabster,p??d,!1,l,n);return}(s||c!=null&&c.outOfDOMOrder)&&Xi({by:"root",owner:u,next:d,relatedEvent:n})&&(n.preventDefault(),n.stopImmediatePropagation(),Ao(d))}else!f&&Xi({by:"root",owner:u,next:null,relatedEvent:n})&&a.root.moveOutWithDefaultAction(l,n)},this._onChanged=(n,o)=>{var i,s;if(n)rs(n,gA,o);else{const a=(i=this._lastVal)===null||i===void 0?void 0:i.get();if(a){const l={...o},c=wt.getTabsterContext(this._tabster,a),u=(s=c==null?void 0:c.modalizer)===null||s===void 0?void 0:s.userId;u&&(l.modalizerId=u),rs(a,vA,l)}}},this._tabster=t,this._win=r,t.queueInit(this._init)}dispose(){super.dispose();const t=this._win();t.document.removeEventListener(si,this._onFocusIn,!0),t.document.removeEventListener("focusout",this._onFocusOut,!0),t.removeEventListener("keydown",this._onKeyDown,!0),this.unsubscribe(this._onChanged),delete Rt._lastResetElement,delete this._nextVal,delete this._lastVal}static forgetMemorized(t,r){var n,o;let i=Rt._lastResetElement,s=i&&i.get();s&&r.contains(s)&&delete Rt._lastResetElement,s=(o=(n=t._nextVal)===null||n===void 0?void 0:n.element)===null||o===void 0?void 0:o.get(),s&&r.contains(s)&&delete t._nextVal,i=t._lastVal,s=i&&i.get(),s&&r.contains(s)&&delete t._lastVal}getFocusedElement(){return this.getVal()}getLastFocusedElement(){var t;let r=(t=this._lastVal)===null||t===void 0?void 0:t.get();return(!r||r&&!Hb(r.ownerDocument,r))&&(this._lastVal=r=void 0),r}focus(t,r,n){return this._tabster.focusable.isFocusable(t,r,!1,n)?(t.focus(),!0):!1}focusDefault(t){const r=this._tabster.focusable.findDefault({container:t});return r?(this._tabster.focusedElement.focus(r),!0):!1}getFirstOrLastTabbable(t,r){var n;const{container:o,ignoreAccessibility:i}=r;let s;if(o){const a=wt.getTabsterContext(this._tabster,o);a&&(s=(n=Rt.findNextTabbable(this._tabster,a,o,void 0,void 0,!t,i))===null||n===void 0?void 0:n.element)}return s&&!(o!=null&&o.contains(s))&&(s=void 0),s||void 0}_focusFirstOrLast(t,r){const n=this.getFirstOrLastTabbable(t,r);return n?(this.focus(n,!1,!0),!0):!1}focusFirst(t){return this._focusFirstOrLast(!0,t)}focusLast(t){return this._focusFirstOrLast(!1,t)}resetFocus(t){if(!this._tabster.focusable.isVisible(t))return!1;if(this._tabster.focusable.isFocusable(t,!0,!0,!0))this.focus(t);else{const r=t.getAttribute("tabindex"),n=t.getAttribute("aria-hidden");t.tabIndex=-1,t.setAttribute("aria-hidden","true"),Rt._lastResetElement=new pn(this._win,t),this.focus(t,!0,!0),this._setOrRemoveAttribute(t,"tabindex",r),this._setOrRemoveAttribute(t,"aria-hidden",n)}return!0}_setOrRemoveAttribute(t,r,n){n===null?t.removeAttribute(r):t.setAttribute(r,n)}_setFocusedElement(t,r,n){var o,i;if(this._tabster._noop)return;const s={relatedTarget:r};if(t){const l=(o=Rt._lastResetElement)===null||o===void 0?void 0:o.get();if(Rt._lastResetElement=void 0,l===t||kA(t))return;s.isFocusedProgrammatically=n;const c=wt.getTabsterContext(this._tabster,t),u=(i=c==null?void 0:c.modalizer)===null||i===void 0?void 0:i.userId;u&&(s.modalizerId=u)}const a=this._nextVal={element:t?new pn(this._win,t):void 0,details:s};t&&t!==this._val&&this._validateFocusedElement(t),this._nextVal===a&&this.setVal(t,s),this._nextVal=void 0}setVal(t,r){super.setVal(t,r),t&&(this._lastVal=new pn(this._win,t))}static findNextTabbable(t,r,n,o,i,s,a){const l=n||r.root.getElement();if(!l)return null;let c=null;const u=Rt._isTabbingTimer,d=t.getWindow();u&&d.clearTimeout(u),Rt.isTabbing=!0,Rt._isTabbingTimer=d.setTimeout(()=>{delete Rt._isTabbingTimer,Rt.isTabbing=!1},0);const f=r.modalizer,p=r.groupper,h=r.mover,v=y=>{var g;if(c=y.findNextTabbable(o,i,s,a),o&&!(c!=null&&c.element)){const m=y!==f&&((g=y.getElement())===null||g===void 0?void 0:g.parentElement);if(m){const b=wt.getTabsterContext(t,o,{referenceElement:m});if(b){const C=y.getElement(),k=s?C:C&&RA(C)||C;k&&(c=Rt.findNextTabbable(t,b,n,k,m,s,a),c&&(c.outOfDOMOrder=!0))}}}};if(p&&h)v(r.groupperBeforeMover?p:h);else if(p)v(p);else if(h)v(h);else if(f)v(f);else{const y={container:l,currentElement:o,referenceElement:i,ignoreAccessibility:a,useActiveModalizer:!0},g={};c={element:t.focusable[s?"findPrev":"findNext"](y,g),outOfDOMOrder:g.outOfDOMOrder,uncontrolled:g.uncontrolled}}return c}}Rt.isTabbing=!1;/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */class aW extends Ul{constructor(t,r,n,o){super(n,t,_v.Groupper,o,!0),this._setHandlers((i,s,a)=>{var l,c;const u=t.get(),d=i.input;if(u&&d){const f=wt.getTabsterContext(n,d);if(f){let p;p=(l=r.findNextTabbable(a||void 0,void 0,s,!0))===null||l===void 0?void 0:l.element,p||(p=(c=Rt.findNextTabbable(n,f,void 0,i.isOutside?d:tW(u,!s),void 0,s,!0))===null||c===void 0?void 0:c.element),p&&Ao(p)}}})}}class lW extends cf{constructor(t,r,n,o,i){super(t,r,o),this._shouldTabInside=!1,this.makeTabbable(!1),this._onDispose=n,t.controlTab||(this.dummyManager=new aW(this._element,this,t,i))}dispose(){var t;this._onDispose(this),this._element.get(),(t=this.dummyManager)===null||t===void 0||t.dispose(),delete this.dummyManager,delete this._first}findNextTabbable(t,r,n,o){var i;const s=this.getElement();if(!s)return null;const a=((i=t==null?void 0:t.__tabsterDummyContainer)===null||i===void 0?void 0:i.get())===s;if(!this._shouldTabInside&&t&&s.contains(t)&&!a)return{element:void 0,outOfDOMOrder:!0};const l=this.getFirst(!0);if(!t||!s.contains(t)||a)return{element:l,outOfDOMOrder:!0};const c=this._tabster;let u=null,d=!1,f;if(this._shouldTabInside&&l){const p={container:s,currentElement:t,referenceElement:r,ignoreAccessibility:o,useActiveModalizer:!0},h={};u=c.focusable[n?"findPrev":"findNext"](p,h),d=!!h.outOfDOMOrder,!u&&this._props.tabbability===yA.LimitedTrapFocus&&(u=c.focusable[n?"findLast":"findFirst"]({container:s,ignoreAccessibility:o,useActiveModalizer:!0},h),d=!0),f=h.uncontrolled}return{element:u,uncontrolled:f,outOfDOMOrder:d}}makeTabbable(t){this._shouldTabInside=t||!this._props.tabbability}isActive(t){var r;const n=this.getElement()||null;let o=!0;for(let s=n==null?void 0:n.parentElement;s;s=s.parentElement){const a=(r=Mr(this._tabster,s))===null||r===void 0?void 0:r.groupper;a&&(a._shouldTabInside||(o=!1))}let i=o?this._props.tabbability?this._shouldTabInside:!1:void 0;if(i&&t){const s=this._tabster.focusedElement.getFocusedElement();s&&(i=s!==this.getFirst(!0))}return i}getFirst(t){var r;const n=this.getElement();let o;if(n){if(t&&this._tabster.focusable.isFocusable(n))return n;o=(r=this._first)===null||r===void 0?void 0:r.get(),o||(o=this._tabster.focusable.findFirst({container:n,useActiveModalizer:!0})||void 0,o&&this.setFirst(o))}return o}setFirst(t){t?this._first=new pn(this._tabster.getWindow,t):delete this._first}acceptElement(t,r){var n;const o=r.cachedGrouppers,i=(n=this.getElement())===null||n===void 0?void 0:n.parentElement,s=i&&wt.getTabsterContext(this._tabster,i),a=s==null?void 0:s.groupper,l=s!=null&&s.groupperBeforeMover?a:void 0;let c;const u=p=>{let h=o[p.id],v;return h?v=h.isActive:(v=this.isActive(!0),h=o[p.id]={isActive:v}),v};if(l&&(c=l.getElement(),!u(l)&&c&&r.container!==c&&r.container.contains(c)))return r.skippedFocusable=!0,NodeFilter.FILTER_REJECT;const d=u(this),f=this.getElement();if(f&&d!==!0){if(f===t&&a&&(c||(c=a.getElement()),c&&!u(a)&&r.container.contains(c)&&c!==r.container)||f!==t&&f.contains(t))return r.skippedFocusable=!0,NodeFilter.FILTER_REJECT;const p=o[this.id];let h;if("first"in p?h=p.first:h=p.first=this.getFirst(!0),h&&r.acceptCondition(h))return r.rejectElementsFrom=f,r.skippedFocusable=!0,h!==r.from?(r.found=!0,r.foundElement=h,NodeFilter.FILTER_ACCEPT):NodeFilter.FILTER_REJECT}}}class cW{constructor(t,r){this._current={},this._grouppers={},this._init=()=>{const n=this._win();this._tabster.focusedElement.subscribeFirst(this._onFocus),n.document.addEventListener("mousedown",this._onMouseDown,!0),n.addEventListener("keydown",this._onKeyDown,!0)},this._onGroupperDispose=n=>{delete this._grouppers[n.id]},this._onFocus=n=>{n&&this._updateCurrent(n,!0,!0)},this._onMouseDown=n=>{n.target&&this._updateCurrent(n.target,!0)},this._onKeyDown=n=>{if(n.keyCode!==He.Enter&&n.keyCode!==He.Esc||n.ctrlKey||n.altKey||n.shiftKey||n.metaKey)return;const o=this._tabster.focusedElement.getFocusedElement();o&&this.handleKeyPress(o,n)},this._tabster=t,this._win=r,t.queueInit(this._init)}dispose(){const t=this._win();this._handleKeyPressTimer&&(t.clearTimeout(this._handleKeyPressTimer),delete this._handleKeyPressTimer),this._current={},this._updateTimer&&(t.clearTimeout(this._updateTimer),delete this._updateTimer),this._tabster.focusedElement.unsubscribe(this._onFocus),t.document.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("keydown",this._onKeyDown,!0),Object.keys(this._grouppers).forEach(r=>{this._grouppers[r]&&(this._grouppers[r].dispose(),delete this._grouppers[r])})}createGroupper(t,r,n){const o=new lW(this._tabster,t,this._onGroupperDispose,r,n);this._grouppers[o.id]=o;const i=this._tabster.focusedElement.getFocusedElement();return i&&t.contains(i)&&!this._updateTimer&&(this._updateTimer=this._win().setTimeout(()=>{delete this._updateTimer,i===this._tabster.focusedElement.getFocusedElement()&&this._updateCurrent(i,!0,!0)},0)),o}forgetCurrentGrouppers(){this._current={}}_updateCurrent(t,r,n){var o;this._updateTimer&&(this._win().clearTimeout(this._updateTimer),delete this._updateTimer);const i={};let s=!0;for(let a=t;a;a=a.parentElement){const l=(o=Mr(this._tabster,a))===null||o===void 0?void 0:o.groupper;if(l){if(i[l.id]=!0,s&&n&&a!==t&&(s=!1),r||!s){this._current[l.id]=l;const c=l.isActive()||t!==a&&(!l.getProps().delegated||l.getFirst(!1)!==t);l.makeTabbable(c)}s=!1}}for(const a of Object.keys(this._current)){const l=this._current[a];l.id in i||(l.makeTabbable(!1),l.setFirst(void 0),delete this._current[a])}}handleKeyPress(t,r,n){const o=this._tabster,i=wt.getTabsterContext(o,t),s=i==null?void 0:i.modalizerInGroupper;let a=(i==null?void 0:i.groupper)||s;if(i&&a){const l=this._win();if(this._handleKeyPressTimer&&(l.clearTimeout(this._handleKeyPressTimer),delete this._handleKeyPressTimer),i.ignoreKeydown(r))return;let c;const u=a.getElement();if(r.keyCode===He.Enter)u&&(t===u||a.getProps().delegated&&t===a.getFirst(!1))&&(c=o.focusable.findNext({container:u,currentElement:t,useActiveModalizer:!0})),c&&u&&Xi({by:"groupper",owner:u,next:c,relatedEvent:r})&&(r.preventDefault(),r.stopImmediatePropagation(),c.focus());else if(r.keyCode===He.Esc){const d=o.focusedElement.getFocusedElement();this._handleKeyPressTimer=l.setTimeout(()=>{var f;if(delete this._handleKeyPressTimer,!(d!==o.focusedElement.getFocusedElement()&&(n&&!d||!n))&&a&&u&&u.contains(t)){if(t!==u||n)c=a.getFirst(!0);else{const p=u.parentElement,h=p?wt.getTabsterContext(o,p):void 0;a=h==null?void 0:h.groupper,c=a==null?void 0:a.getFirst(!0)}c&&Xi({by:"groupper",owner:u,next:c,relatedEvent:r})&&(a&&(a.makeTabbable(!1),s&&((f=o.modalizer)===null||f===void 0||f.setActive(void 0))),c.focus())}},0)}}}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */class uW extends AA{constructor(t){super(),this._onChange=r=>{this.setVal(r,void 0)},this._keyborg=zb(t()),this._keyborg.subscribe(this._onChange)}dispose(){super.dispose(),this._keyborg&&(this._keyborg.unsubscribe(this._onChange),Lb(this._keyborg),delete this._keyborg)}setNavigatingWithKeyboard(t){var r;(r=this._keyborg)===null||r===void 0||r.setVal(t)}isNavigatingWithKeyboard(){var t;return!!(!((t=this._keyborg)===null||t===void 0)&&t.isNavigatingWithKeyboard())}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */let dW=0;const E0="aria-hidden";class fW extends Ul{constructor(t,r,n){super(r,t,_v.Modalizer,n),this._setHandlers((o,i)=>{var s,a,l;const c=t.get(),u=c&&((s=wt.getRoot(r,c))===null||s===void 0?void 0:s.getElement()),d=o.input;let f;if(u&&d){const p=(a=d.__tabsterDummyContainer)===null||a===void 0?void 0:a.get(),h=wt.getTabsterContext(r,p||d);h&&(f=(l=Rt.findNextTabbable(r,h,u,d,void 0,i,!0))===null||l===void 0?void 0:l.element),f&&Ao(f)}})}}class hW extends cf{constructor(t,r,n,o,i,s){super(t,r,o),this._wasFocused=0,this.userId=o.id,this._onDispose=n,this._activeElements=s,t.controlTab||(this.dummyManager=new fW(this._element,t,i))}makeActive(t){if(this._isActive!==t){this._isActive=t;const r=this.getElement();if(r){const n=this._activeElements,o=n.map(i=>i.get()).indexOf(r);t?o<0&&n.push(new pn(this._tabster.getWindow,r)):o>=0&&n.splice(o,1)}this.triggerFocusEvent(t?hA:pA)}}focused(t){return t||(this._wasFocused=++dW),this._wasFocused}setProps(t){t.id&&(this.userId=t.id),this._props={...t}}dispose(){var t;this.makeActive(!1),this._onDispose(this),(t=this.dummyManager)===null||t===void 0||t.dispose(),delete this.dummyManager,this._activeElements=[],this._remove()}isActive(){return!!this._isActive}contains(t){var r;return!!(!((r=this.getElement())===null||r===void 0)&&r.contains(t))}findNextTabbable(t,r,n,o){var i,s;if(!this.getElement())return null;const l=this._tabster;let c=null,u=!1,d;const f=t&&((i=wt.getRoot(l,t))===null||i===void 0?void 0:i.getElement());if(f){const p={container:f,currentElement:t,referenceElement:r,ignoreAccessibility:o,useActiveModalizer:!0},h={};c=l.focusable[n?"findPrev":"findNext"](p,h),!c&&this._props.isTrapped&&(!((s=l.modalizer)===null||s===void 0)&&s.activeId)?(c=l.focusable[n?"findLast":"findFirst"]({container:f,ignoreAccessibility:o,useActiveModalizer:!0},h),u=!0):u=!!h.outOfDOMOrder,d=h.uncontrolled}return{element:c,uncontrolled:d,outOfDOMOrder:u}}triggerFocusEvent(t,r){const n=this.getElement();let o=!1;if(n){const i=r?this._activeElements.map(s=>s.get()):[n];for(const s of i)s&&!rs(s,t,{id:this.userId,element:n,eventName:t})&&(o=!0)}return o}_remove(){}}class pW{constructor(t,r,n){this._onModalizerDispose=i=>{const s=i.id,a=i.userId,l=this._parts[a];delete this._modalizers[s],l&&(delete l[s],Object.keys(l).length===0&&(delete this._parts[a],this.activeId===a&&this.setActive(void 0)))},this._onKeyDown=i=>{var s;if(i.keyCode!==He.Esc)return;const a=this._tabster,l=a.focusedElement.getFocusedElement();if(l){const c=wt.getTabsterContext(a,l),u=c==null?void 0:c.modalizer;if(c&&!c.groupper&&(u!=null&&u.isActive())&&!c.ignoreKeydown(i)){const d=u.userId;if(d){const f=this._parts[d];if(f){const p=Object.keys(f).map(h=>{var v;const y=f[h],g=y.getElement();let m;return g&&(m=(v=Mr(this._tabster,g))===null||v===void 0?void 0:v.groupper),y&&g&&m?{el:g,focusedSince:y.focused(!0)}:{focusedSince:0}}).filter(h=>h.focusedSince>0).sort((h,v)=>h.focusedSince>v.focusedSince?-1:h.focusedSince{var a,l;const c=i&&wt.getTabsterContext(this._tabster,i);if(!c||!i)return;const u=this._augMap;for(let f=i;f;f=f.parentElement)u.has(f)&&(u.delete(f),T0(this._tabster,f,E0));const d=c.modalizer;if((l=d||((a=Mr(this._tabster,i))===null||a===void 0?void 0:a.modalizer))===null||l===void 0||l.focused(),(d==null?void 0:d.userId)===this.activeId){this.currentIsOthersAccessible=d==null?void 0:d.getProps().isOthersAccessible;return}if(s.isFocusedProgrammatically||this.currentIsOthersAccessible||d!=null&&d.getProps().isAlwaysAccessible)this.setActive(d);else{const f=this._win();f.clearTimeout(this._restoreModalizerFocusTimer),this._restoreModalizerFocusTimer=f.setTimeout(()=>this._restoreModalizerFocus(i),100)}},this._tabster=t,this._win=t.getWindow,this._modalizers={},this._parts={},this._augMap=new WeakMap,this._aug=[],this._alwaysAccessibleSelector=r,this._accessibleCheck=n,this.activeElements=[],t.controlTab||t.root.addDummyInputs(),this._win().addEventListener("keydown",this._onKeyDown,!0),t.queueInit(()=>{this._tabster.focusedElement.subscribe(this._onFocus)})}dispose(){const t=this._win();t.removeEventListener("keydown",this._onKeyDown,!0),Object.keys(this._modalizers).forEach(r=>{this._modalizers[r]&&(this._modalizers[r].dispose(),delete this._modalizers[r])}),t.clearTimeout(this._restoreModalizerFocusTimer),t.clearTimeout(this._hiddenUpdateTimer),this._parts={},delete this.activeId,this.activeElements=[],this._augMap=new WeakMap,this._aug=[],this._tabster.focusedElement.unsubscribe(this._onFocus)}createModalizer(t,r,n){var o;const i=new hW(this._tabster,t,this._onModalizerDispose,r,n,this.activeElements),s=i.id,a=r.id;this._modalizers[s]=i;let l=this._parts[a];return l||(l=this._parts[a]={}),l[s]=i,t.contains((o=this._tabster.focusedElement.getFocusedElement())!==null&&o!==void 0?o:null)&&(a!==this.activeId?this.setActive(i):i.makeActive(!0)),i}isAugmented(t){return this._augMap.has(t)}hiddenUpdate(){this._hiddenUpdateTimer||(this._hiddenUpdateTimer=this._win().setTimeout(()=>{delete this._hiddenUpdateTimer,this._hiddenUpdate()},250))}setActive(t){const r=t==null?void 0:t.userId,n=this.activeId;if(n!==r){if(this.activeId=r,n){const o=this._parts[n];if(o)for(const i of Object.keys(o))o[i].makeActive(!1)}if(r){const o=this._parts[r];if(o)for(const i of Object.keys(o))o[i].makeActive(!0)}this.currentIsOthersAccessible=t==null?void 0:t.getProps().isOthersAccessible,this.hiddenUpdate()}}focus(t,r,n){const o=wt.getTabsterContext(this._tabster,t),i=o==null?void 0:o.modalizer;if(i){this.setActive(i);const s=i.getProps(),a=i.getElement();if(a){if(r===void 0&&(r=s.isNoFocusFirst),!r&&this._tabster.keyboardNavigation.isNavigatingWithKeyboard()&&this._tabster.focusedElement.focusFirst({container:a})||(n===void 0&&(n=s.isNoFocusDefault),!n&&this._tabster.focusedElement.focusDefault(a)))return!0;this._tabster.focusedElement.resetFocus(a)}}return!1}acceptElement(t,r){var n;const o=r.modalizerUserId,i=(n=r.currentCtx)===null||n===void 0?void 0:n.modalizer;if(o)for(const a of this.activeElements){const l=a.get();if(l&&(t.contains(l)||l===t))return NodeFilter.FILTER_SKIP}const s=o===(i==null?void 0:i.userId)||!o&&(i!=null&&i.getProps().isAlwaysAccessible)?void 0:NodeFilter.FILTER_SKIP;return s!==void 0&&(r.skippedFocusable=!0),s}_hiddenUpdate(){var t;const r=this._tabster,n=r.getWindow().document.body,o=this.activeId,i=this._parts,s=[],a=[],l=this._alwaysAccessibleSelector,c=l?Array.from(n.querySelectorAll(l)):[],u=[];for(const g of Object.keys(i)){const m=i[g];for(const b of Object.keys(m)){const C=m[b],k=C.getElement(),w=C.getProps().isAlwaysAccessible;k&&(g===o?(u.push(k),this.currentIsOthersAccessible||s.push(k)):w?c.push(k):a.push(k))}}const d=this._augMap,f=s.length>0?[...s,...c]:void 0,p=[],h=new WeakMap,v=(g,m)=>{var b;const C=g.tagName;if(C==="SCRIPT"||C==="STYLE")return;let k=!1;d.has(g)?m?k=!0:(d.delete(g),T0(r,g,E0)):m&&!(!((b=this._accessibleCheck)===null||b===void 0)&&b.call(this,g,u))&&T0(r,g,E0,"true")&&(d.set(g,!0),k=!0),k&&(p.push(new pn(r.getWindow,g)),h.set(g,!0))},y=g=>{for(let m=g.firstElementChild;m;m=m.nextElementSibling){let b=!1,C=!1;if(f){for(const k of f){if(m===k){b=!0;break}if(m.contains(k)){C=!0;break}}C?y(m):b||v(m,!0)}else v(m,!1)}};f||c.forEach(g=>v(g,!1)),a.forEach(g=>v(g,!0)),n&&y(n),(t=this._aug)===null||t===void 0||t.map(g=>g.get()).forEach(g=>{g&&!h.get(g)&&v(g,!1)}),this._aug=p,this._augMap=h}_restoreModalizerFocus(t){const r=t==null?void 0:t.ownerDocument;if(!t||!r)return;const n=wt.getTabsterContext(this._tabster,t),o=n==null?void 0:n.modalizer,i=this.activeId;if(!o&&!i||o&&i===o.userId)return;const s=n==null?void 0:n.root.getElement();if(s){let a=this._tabster.focusable.findFirst({container:s,useActiveModalizer:!0});if(a){if(t.compareDocumentPosition(a)&document.DOCUMENT_POSITION_PRECEDING&&(a=this._tabster.focusable.findLast({container:s,useActiveModalizer:!0}),!a))throw new Error("Something went wrong.");this._tabster.focusedElement.focus(a);return}}t.blur()}}/*!
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License.
+ */const gW=["input","textarea","*[contenteditable]"].join(", ");class vW extends Ul{constructor(t,r,n,o){super(r,t,_v.Mover,o),this._onFocusDummyInput=i=>{var s,a;const l=this._element.get(),c=i.input;if(l&&c){const u=wt.getTabsterContext(this._tabster,l);let d;u&&(d=(s=Rt.findNextTabbable(this._tabster,u,void 0,c,void 0,!i.isFirst,!0))===null||s===void 0?void 0:s.element);const f=(a=this._getMemorized())===null||a===void 0?void 0:a.get();f&&(d=f),d&&Ao(d)}},this._tabster=r,this._getMemorized=n,this._setHandlers(this._onFocusDummyInput)}}const w0=1,a4=2,l4=3;class mW extends cf{constructor(t,r,n,o,i){var s;super(t,r,o),this._visible={},this._onIntersection=l=>{for(const c of l){const u=c.target,d=Lh(this._win,u);let f,p=this._fullyVisible;if(c.intersectionRatio>=.25?(f=c.intersectionRatio>=.75?Wo.Visible:Wo.PartiallyVisible,f===Wo.Visible&&(p=d)):f=Wo.Invisible,this._visible[d]!==f){f===void 0?(delete this._visible[d],p===d&&delete this._fullyVisible):(this._visible[d]=f,this._fullyVisible=p);const h=this.getState(u);h&&rs(u,IS,h)}}},this._win=t.getWindow,this.visibilityTolerance=(s=o.visibilityTolerance)!==null&&s!==void 0?s:.8,(this._props.trackState||this._props.visibilityAware)&&(this._intersectionObserver=new IntersectionObserver(this._onIntersection,{threshold:[0,.25,.5,.75,1]}),this._observeState()),this._onDispose=n;const a=()=>o.memorizeCurrent?this._current:void 0;t.controlTab||(this.dummyManager=new vW(this._element,t,a,i))}dispose(){var t;this._onDispose(this),this._intersectionObserver&&(this._intersectionObserver.disconnect(),delete this._intersectionObserver),delete this._current,delete this._fullyVisible,delete this._allElements,delete this._updateQueue,this._unobserve&&(this._unobserve(),delete this._unobserve);const r=this._win();this._setCurrentTimer&&(r.clearTimeout(this._setCurrentTimer),delete this._setCurrentTimer),this._updateTimer&&(r.clearTimeout(this._updateTimer),delete this._updateTimer),(t=this.dummyManager)===null||t===void 0||t.dispose(),delete this.dummyManager}setCurrent(t){t?this._current=new pn(this._win,t):this._current=void 0,(this._props.trackState||this._props.visibilityAware)&&!this._setCurrentTimer&&(this._setCurrentTimer=this._win().setTimeout(()=>{var r;delete this._setCurrentTimer;const n=[];this._current!==this._prevCurrent&&(n.push(this._current),n.push(this._prevCurrent),this._prevCurrent=this._current);for(const o of n){const i=o==null?void 0:o.get();if(i&&((r=this._allElements)===null||r===void 0?void 0:r.get(i))===this){const s=this._props;if(i&&(s.visibilityAware!==void 0||s.trackState)){const a=this.getState(i);a&&rs(i,IS,a)}}}}))}getCurrent(){var t;return((t=this._current)===null||t===void 0?void 0:t.get())||null}findNextTabbable(t,r,n,o){var i;const s=this.getElement(),a=s&&((i=t==null?void 0:t.__tabsterDummyContainer)===null||i===void 0?void 0:i.get())===s;if(!s)return null;let l=null,c=!1,u;if(this._props.tabbable||a||t&&!s.contains(t)){const d={currentElement:t,referenceElement:r,container:s,ignoreAccessibility:o,useActiveModalizer:!0},f={};l=this._tabster.focusable[n?"findPrev":"findNext"](d,f),c=!!f.outOfDOMOrder,u=f.uncontrolled}return{element:l,uncontrolled:u,outOfDOMOrder:c}}acceptElement(t,r){var n,o,i;if(!Rt.isTabbing)return!((n=r.currentCtx)===null||n===void 0)&&n.excludedFromMover?NodeFilter.FILTER_REJECT:void 0;const{memorizeCurrent:s,visibilityAware:a,hasDefault:l=!0}=this._props,c=this.getElement();if(c&&(s||a||l)&&(!c.contains(r.from)||((o=r.from.__tabsterDummyContainer)===null||o===void 0?void 0:o.get())===c)){let u;if(s){const d=(i=this._current)===null||i===void 0?void 0:i.get();d&&r.acceptCondition(d)&&(u=d)}if(!u&&l&&(u=this._tabster.focusable.findDefault({container:c,useActiveModalizer:!0})),!u&&a&&(u=this._tabster.focusable.findElement({container:c,useActiveModalizer:!0,isBackward:r.isBackward,acceptCondition:d=>{var f;const p=Lh(this._win,d),h=this._visible[p];return c!==d&&!!(!((f=this._allElements)===null||f===void 0)&&f.get(d))&&r.acceptCondition(d)&&(h===Wo.Visible||h===Wo.PartiallyVisible&&(a===Wo.PartiallyVisible||!this._fullyVisible))}})),u)return r.found=!0,r.foundElement=u,r.rejectElementsFrom=c,r.skippedFocusable=!0,NodeFilter.FILTER_ACCEPT}}_observeState(){const t=this.getElement();if(this._unobserve||!t||typeof MutationObserver>"u")return;const r=this._win(),n=this._allElements=new WeakMap,o=this._tabster.focusable;let i=this._updateQueue=[];const s=new MutationObserver(p=>{for(const h of p){const v=h.target,y=h.removedNodes,g=h.addedNodes;if(h.type==="attributes")h.attributeName==="tabindex"&&i.push({element:v,type:a4});else{for(let m=0;m{var v,y;const g=n.get(p);g&&h&&((v=this._intersectionObserver)===null||v===void 0||v.unobserve(p),n.delete(p)),!g&&!h&&(n.set(p,this),(y=this._intersectionObserver)===null||y===void 0||y.observe(p))},l=p=>{const h=o.isFocusable(p);n.get(p)?h||a(p,!0):h&&a(p)},c=p=>{const{mover:h}=f(p);if(h&&h!==this)if(h.getElement()===p&&o.isFocusable(p))a(p);else return;const v=jb(r.document,p,y=>{const{mover:g,groupper:m}=f(y);if(g&&g!==this)return NodeFilter.FILTER_REJECT;const b=m==null?void 0:m.getFirst(!0);return m&&m.getElement()!==y&&b&&b!==y?NodeFilter.FILTER_REJECT:(o.isFocusable(y)&&a(y),NodeFilter.FILTER_SKIP)});if(v)for(v.currentNode=p;v.nextNode(););},u=p=>{n.get(p)&&a(p,!0);for(let v=p.firstElementChild;v;v=v.nextElementSibling)u(v)},d=()=>{!this._updateTimer&&i.length&&(this._updateTimer=r.setTimeout(()=>{delete this._updateTimer;for(const{element:p,type:h}of i)switch(h){case a4:l(p);break;case w0:c(p);break;case l4:u(p);break}i=this._updateQueue=[]},0))},f=p=>{const h={};for(let v=p;v;v=v.parentElement){const y=Mr(this._tabster,v);if(y&&(y.groupper&&!h.groupper&&(h.groupper=y.groupper),y.mover)){h.mover=y.mover;break}}return h};i.push({element:t,type:w0}),d(),s.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["tabindex"]}),this._unobserve=()=>{s.disconnect()}}getState(t){const r=Lh(this._win,t);if(r in this._visible){const n=this._visible[r]||Wo.Invisible;return{isCurrent:this._current?this._current.get()===t:void 0,visibility:n}}}}function yW(e,t,r,n,o,i,s,a){const l=r{this._win().addEventListener("keydown",this._onKeyDown,!0),this._tabster.focusedElement.subscribe(this._onFocus)},this._onMoverDispose=n=>{delete this._movers[n.id]},this._onFocus=n=>{var o;let i=n,s=n;for(let a=n==null?void 0:n.parentElement;a;a=a.parentElement){const l=(o=Mr(this._tabster,a))===null||o===void 0?void 0:o.mover;l&&(l.setCurrent(s),i=void 0),!i&&this._tabster.focusable.isFocusable(a)&&(i=s=a)}},this._onKeyDown=async n=>{var o,i,s,a;this._ignoredInputTimer&&(this._win().clearTimeout(this._ignoredInputTimer),delete this._ignoredInputTimer),(o=this._ignoredInputResolve)===null||o===void 0||o.call(this,!1);let l=n.keyCode;if(n.ctrlKey||n.altKey||n.shiftKey||n.metaKey)return;switch(l){case He.Down:case He.Right:case He.Up:case He.Left:case He.PageDown:case He.PageUp:case He.Home:case He.End:break;default:return}const c=this._tabster,u=c.focusedElement.getFocusedElement();if(!u||await this._isIgnoredInput(u,l))return;const d=wt.getTabsterContext(c,u,{checkRtl:!0});if(!d||!d.mover||d.excludedFromMover||d.ignoreKeydown(n))return;const f=d.mover,p=f.getElement();if(d.groupperBeforeMover){const B=d.groupper;if(B&&!B.isActive(!0)){for(let F=(i=B.getElement())===null||i===void 0?void 0:i.parentElement;F&&F!==p;F=F.parentElement)if(!((a=(s=Mr(c,F))===null||s===void 0?void 0:s.groupper)===null||a===void 0)&&a.isActive(!0))return}else return}if(!p)return;const h=c.focusable,v=f.getProps(),y=v.direction||Qs.Both,g=y===Qs.Both,m=g||y===Qs.Vertical,b=g||y===Qs.Horizontal,C=y===Qs.GridLinear,k=C||y===Qs.Grid,E=v.cyclic;let w,A,D,I=0,M=0;if(k&&(D=u.getBoundingClientRect(),I=Math.ceil(D.left),M=Math.floor(D.right)),d.rtl&&(l===He.Right?l=He.Left:l===He.Left&&(l=He.Right)),l===He.Down&&m||l===He.Right&&(b||k))if(w=h.findNext({currentElement:u,container:p,useActiveModalizer:!0}),w&&k){const B=Math.ceil(w.getBoundingClientRect().left);!C&&M>B&&(w=void 0)}else!w&&E&&(w=h.findFirst({container:p,useActiveModalizer:!0}));else if(l===He.Up&&m||l===He.Left&&(b||k))if(w=h.findPrev({currentElement:u,container:p,useActiveModalizer:!0}),w&&k){const B=Math.floor(w.getBoundingClientRect().right);!C&&B>I&&(w=void 0)}else!w&&E&&(w=h.findLast({container:p,useActiveModalizer:!0}));else if(l===He.Home)k?h.findElement({container:p,currentElement:u,useActiveModalizer:!0,isBackward:!0,acceptCondition:B=>{var F;if(!h.isFocusable(B))return!1;const se=Math.ceil((F=B.getBoundingClientRect().left)!==null&&F!==void 0?F:0);return B!==u&&I<=se?!0:(w=B,!1)}}):w=h.findFirst({container:p,useActiveModalizer:!0});else if(l===He.End)k?h.findElement({container:p,currentElement:u,useActiveModalizer:!0,acceptCondition:B=>{var F;if(!h.isFocusable(B))return!1;const se=Math.ceil((F=B.getBoundingClientRect().left)!==null&&F!==void 0?F:0);return B!==u&&I>=se?!0:(w=B,!1)}}):w=h.findLast({container:p,useActiveModalizer:!0});else if(l===He.PageUp){if(h.findElement({currentElement:u,container:p,useActiveModalizer:!0,isBackward:!0,acceptCondition:B=>h.isFocusable(B)?o4(this._win,B,f.visibilityTolerance)?(w=B,!1):!0:!1}),k&&w){const B=Math.ceil(w.getBoundingClientRect().left);h.findElement({currentElement:w,container:p,useActiveModalizer:!0,acceptCondition:F=>{if(!h.isFocusable(F))return!1;const se=Math.ceil(F.getBoundingClientRect().left);return I