sudmgp-sdk-js 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SudMGP=t():e.SudMGP=t()}(this,(()=>(()=>{var e={560:function(e,t,i){var n;!function(r){"use strict";function s(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function o(e,t,i,n,r,o){return s((a=s(s(t,e),s(n,o)))<<(c=r)|a>>>32-c,i);var a,c}function a(e,t,i,n,r,s,a){return o(t&i|~t&n,e,t,r,s,a)}function c(e,t,i,n,r,s,a){return o(t&n|i&~n,e,t,r,s,a)}function u(e,t,i,n,r,s,a){return o(t^i^n,e,t,r,s,a)}function p(e,t,i,n,r,s,a){return o(i^(t|~n),e,t,r,s,a)}function d(e,t){var i,n,r,o,d;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,l=-271733879,v=-1732584194,f=271733878;for(i=0;i<e.length;i+=16)n=h,r=l,o=v,d=f,h=a(h,l,v,f,e[i],7,-680876936),f=a(f,h,l,v,e[i+1],12,-389564586),v=a(v,f,h,l,e[i+2],17,606105819),l=a(l,v,f,h,e[i+3],22,-1044525330),h=a(h,l,v,f,e[i+4],7,-176418897),f=a(f,h,l,v,e[i+5],12,1200080426),v=a(v,f,h,l,e[i+6],17,-1473231341),l=a(l,v,f,h,e[i+7],22,-45705983),h=a(h,l,v,f,e[i+8],7,1770035416),f=a(f,h,l,v,e[i+9],12,-1958414417),v=a(v,f,h,l,e[i+10],17,-42063),l=a(l,v,f,h,e[i+11],22,-1990404162),h=a(h,l,v,f,e[i+12],7,1804603682),f=a(f,h,l,v,e[i+13],12,-40341101),v=a(v,f,h,l,e[i+14],17,-1502002290),h=c(h,l=a(l,v,f,h,e[i+15],22,1236535329),v,f,e[i+1],5,-165796510),f=c(f,h,l,v,e[i+6],9,-1069501632),v=c(v,f,h,l,e[i+11],14,643717713),l=c(l,v,f,h,e[i],20,-373897302),h=c(h,l,v,f,e[i+5],5,-701558691),f=c(f,h,l,v,e[i+10],9,38016083),v=c(v,f,h,l,e[i+15],14,-660478335),l=c(l,v,f,h,e[i+4],20,-405537848),h=c(h,l,v,f,e[i+9],5,568446438),f=c(f,h,l,v,e[i+14],9,-1019803690),v=c(v,f,h,l,e[i+3],14,-187363961),l=c(l,v,f,h,e[i+8],20,1163531501),h=c(h,l,v,f,e[i+13],5,-1444681467),f=c(f,h,l,v,e[i+2],9,-51403784),v=c(v,f,h,l,e[i+7],14,1735328473),h=u(h,l=c(l,v,f,h,e[i+12],20,-1926607734),v,f,e[i+5],4,-378558),f=u(f,h,l,v,e[i+8],11,-2022574463),v=u(v,f,h,l,e[i+11],16,1839030562),l=u(l,v,f,h,e[i+14],23,-35309556),h=u(h,l,v,f,e[i+1],4,-1530992060),f=u(f,h,l,v,e[i+4],11,1272893353),v=u(v,f,h,l,e[i+7],16,-155497632),l=u(l,v,f,h,e[i+10],23,-1094730640),h=u(h,l,v,f,e[i+13],4,681279174),f=u(f,h,l,v,e[i],11,-358537222),v=u(v,f,h,l,e[i+3],16,-722521979),l=u(l,v,f,h,e[i+6],23,76029189),h=u(h,l,v,f,e[i+9],4,-640364487),f=u(f,h,l,v,e[i+12],11,-421815835),v=u(v,f,h,l,e[i+15],16,530742520),h=p(h,l=u(l,v,f,h,e[i+2],23,-995338651),v,f,e[i],6,-198630844),f=p(f,h,l,v,e[i+7],10,1126891415),v=p(v,f,h,l,e[i+14],15,-1416354905),l=p(l,v,f,h,e[i+5],21,-57434055),h=p(h,l,v,f,e[i+12],6,1700485571),f=p(f,h,l,v,e[i+3],10,-1894986606),v=p(v,f,h,l,e[i+10],15,-1051523),l=p(l,v,f,h,e[i+1],21,-2054922799),h=p(h,l,v,f,e[i+8],6,1873313359),f=p(f,h,l,v,e[i+15],10,-30611744),v=p(v,f,h,l,e[i+6],15,-1560198380),l=p(l,v,f,h,e[i+13],21,1309151649),h=p(h,l,v,f,e[i+4],6,-145523070),f=p(f,h,l,v,e[i+11],10,-1120210379),v=p(v,f,h,l,e[i+2],15,718787259),l=p(l,v,f,h,e[i+9],21,-343485551),h=s(h,n),l=s(l,r),v=s(v,o),f=s(f,d);return[h,l,v,f]}function h(e){var t,i="",n=32*e.length;for(t=0;t<n;t+=8)i+=String.fromCharCode(e[t>>5]>>>t%32&255);return i}function l(e){var t,i=[];for(i[(e.length>>2)-1]=void 0,t=0;t<i.length;t+=1)i[t]=0;var n=8*e.length;for(t=0;t<n;t+=8)i[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return i}function v(e){var t,i,n="0123456789abcdef",r="";for(i=0;i<e.length;i+=1)t=e.charCodeAt(i),r+=n.charAt(t>>>4&15)+n.charAt(15&t);return r}function f(e){return unescape(encodeURIComponent(e))}function g(e){return function(e){return h(d(l(e),8*e.length))}(f(e))}function m(e,t){return function(e,t){var i,n,r=l(e),s=[],o=[];for(s[15]=o[15]=void 0,r.length>16&&(r=d(r,8*e.length)),i=0;i<16;i+=1)s[i]=909522486^r[i],o[i]=1549556828^r[i];return n=d(s.concat(l(t)),512+8*t.length),h(d(o.concat(n),640))}(f(e),f(t))}function S(e,t,i){return t?i?m(t,e):v(m(t,e)):i?g(e):v(g(e))}void 0===(n=function(){return S}.call(t,i,t,e))||(e.exports=n)}()},249:function(e,t,i){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==i.g&&i.g.crypto&&(n=i.g.crypto),!n)try{n=i(480)}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var i;return e.prototype=t,i=new e,e.prototype=null,i}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<r;s++){var o=i[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var a=0;a<r;a+=4)t[n+a>>>2]=i[a>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(r());return new u.init(t,e)}}),p=o.enc={},d=p.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var s=t[r>>>2]>>>24-r%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(i,t/2)}},h=p.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var s=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(i,t)}},l=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,n=this._data,r=n.words,s=n.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,p=e.min(4*c,s);if(c){for(var d=0;d<c;d+=o)this._doProcessBlock(r,d);i=r.splice(0,c),n.sigBytes-=p}return new u.init(i,p)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(a.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new f.HMAC.init(e,i).finalize(t)}}}),o.algo={});return o}(Math),n)},465:function(e,t,i){e.exports=i(249).enc.Hex},398:function(e,t,i){var n;e.exports=(n=i(249),i(783),i(824),n.HmacSHA1)},824:function(e,t,i){var n,r,s;e.exports=(r=(n=i(249)).lib.Base,s=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var i=e.blockSize,n=4*i;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),o=this._iKey=t.clone(),a=r.words,c=o.words,u=0;u<i;u++)a[u]^=1549556828,c[u]^=909522486;r.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})))},783:function(e,t,i){var n,r,s,o,a,c,u,p;e.exports=(r=(n=p=i(249)).lib,s=r.WordArray,o=r.Hasher,a=n.algo,c=[],u=a.SHA1=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var p=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=p<<1|p>>>31}var d=(n<<5|n>>>27)+a+c[u];d+=u<20?1518500249+(r&s|~r&o):u<40?1859775393+(r^s^o):u<60?(r&s|r&o|s&o)-1894007588:(r^s^o)-899497514,a=o,o=s,s=r<<30|r>>>2,r=n,n=d}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+s|0,i[3]=i[3]+o|0,i[4]=i[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(n+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=o._createHelper(u),n.HmacSHA1=o._createHmacHelper(u),p.SHA1)},480:()=>{},339:()=>{},108:()=>{},275:()=>{},505:()=>{},146:()=>{},173:()=>{},137:()=>{},592:()=>{}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";i.r(n),i.d(n,{ISudAPPD:()=>M,SudMGP:()=>ir});var e,t=function(){function e(){this._showLoadingGameBg=!0,this._showCustomLoading=!1,this._touchEnable=!1,this.advancedConfigMap=new Map}return e.prototype.getShowLoadingGameBg=function(){return this._showLoadingGameBg},e.prototype.setShowLoadingGameBg=function(e){this._showLoadingGameBg=e},e.prototype.getShowCustomLoading=function(){return this._showCustomLoading},e.prototype.setShowCustomLoading=function(e){this._showCustomLoading=e},e.prototype.getTouchEnable=function(){return this._touchEnable},e.prototype.setTouchEnable=function(e){this._touchEnable=e},e.prototype.getAdvancedConfigMap=function(){return this.advancedConfigMap},e}(),r=function(){function e(){}return e.getCfg=function(){return e._impl},e._impl=new t,e}(),s=function(){function e(){this._curId=0}return e.prototype.genId=function(){return++this._curId},e}(),o=function(){function e(){}return e.VERBOSE=2,e.DEBUG=3,e.INFO=4,e.WARN=5,e.ERROR=6,e.ASSERT=7,e}(),a=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},c=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r<s;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},u=function(){function e(){this.kTag="SudMGP",this._logLevel=o.DEBUG}return e.prototype.setLogLevel=function(e){this._logLevel=e},e.prototype.log=function(e,t,i){for(var n=[],r=3;r<arguments.length;r++)n[r-3]=arguments[r];var s=this.kTag;o.VERBOSE===e&&this._logLevel<=o.VERBOSE||o.DEBUG===e&&this._logLevel<=o.DEBUG?console.log.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.INFO===e&&this._logLevel<=o.INFO?console.info.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.WARN===e&&this._logLevel<=o.WARN?console.warn.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.ERROR===e&&this._logLevel<=o.ERROR?console.error.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.ASSERT===e&&this._logLevel<=o.ASSERT&&console.assert.apply(console,c([s+" "+t,i],a(n),!1))},e}(),p=function(){function e(){}return e.setLogLevel=function(t){e._impl.setLogLevel(t)},e.setLogger=function(t){null!=t&&(e._impl=t)},e.v=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e._impl.log(o.VERBOSE,t,i,n)},e.d=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e._impl.log(o.DEBUG,t,i,n)},e.i=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e._impl.log(o.INFO,t,i,n)},e.w=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e._impl.log(o.WARN,t,i,n)},e.e=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];e._impl.log(o.ERROR,t,i,n)},e._impl=new u,e}(),d=i(560),h=i.n(d),l=function(){return l=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l.apply(this,arguments)},v=function(e){var t=e.url,i=e.method,n=e.data,r=e.params,s=e.success,o=e.fail,a=e.beforeSend,c=i.toLowerCase(),u=t,p=new XMLHttpRequest;if(p=new XMLHttpRequest){if(p){if(p.addHeader=function(e,t){p.setRequestHeader(e,t)},"get"===c&&r){var d=function(e){var t="",i=Object.keys(e).length,n=0;for(var r in e)t+=r+"="+e[r],t+=n<i-1?"&":"",n++;return t}(r);u+="?"+d}p.open(c,u,!0),p.setRequestHeader("content-type","application/json"),a&&a(p),"post"===c&&n?p.send(JSON.stringify(n)):p.send(),p.onreadystatechange=function(){var e=null==p?void 0:p.responseText;4===p.readyState&&(200===p.status?s&&s(e):o&&o(e))}}}else console.error("浏览器不支持XMLHttpRequest")},f=function(e){v(l({method:"get"},e))},g=new Uint8Array(16);function m(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(g)}const S=/^(?:[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,y=function(e){return"string"==typeof e&&S.test(e)};for(var A=[],b=0;b<256;++b)A.push((b+256).toString(16).substr(1));const C=function(e,t,i){var n=(e=e||{}).random||(e.rng||m)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(A[e[t+0]]+A[e[t+1]]+A[e[t+2]]+A[e[t+3]]+"-"+A[e[t+4]]+A[e[t+5]]+"-"+A[e[t+6]]+A[e[t+7]]+"-"+A[e[t+8]]+A[e[t+9]]+"-"+A[e[t+10]]+A[e[t+11]]+A[e[t+12]]+A[e[t+13]]+A[e[t+14]]+A[e[t+15]]).toLowerCase();if(!y(i))throw TypeError("Stringified UUID is invalid");return i}(n)};var I=function(){function e(){}return e.kVersion="1.2.0",e.kVersionAlias="0.0.0.0-h5",e}(),w=function(){function e(){}return e.getNetworkType=function(){try{var e=navigator.userAgent;if(!e)return this.NETWORK_UNKNOWN;var t="NetType/other",i=navigator.connection||navigator.mozConnection||navigator.webkitConnection;i&&(t=i.type?i.type:i.effectiveType);var n=e.match(/NetType\/\w+/);switch(n&&n.length&&(t=n[0]),t=t.toLowerCase().replace("nettype/","")){case"wifi":return this.NETWORK_WIFI;case"4g":return this.NETWORK_4G;case"3g":case"3gnet":return this.NETWORK_3G;case"2g":case"slow-2":return this.NETWORK_2G;default:return this.NETWORK_UNKNOWN}}catch(e){return this.NETWORK_UNKNOWN}},e.NETWORK_UNKNOWN=0,e.NETWORK_ETHERNET=1,e.NETWORK_2G=2,e.NETWORK_3G=3,e.NETWORK_4G=4,e.NETWORK_5G=5,e.NETWORK_WIFI=100,e.NETWORK_NO=999,e}(),R=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},_=function(){function e(e){this._tag="SudMGP",this._event="",this._event_id="",this._request_id="",this._user_id="",this._resp="",this._ret_code=0,this._ret_msg="success",this._mgId="",this._start_timestamp=0,this._extras=new Map,this.local_pkg=!1,this.local_core=!1,this.timeout_code=0,this.setEvent(e),this._start_timestamp=Date.now(),this.buildNewRequestId()}return e.prototype.getEvent=function(){return this._event},e.prototype.setEvent=function(e){this._event=e,this._event_id=T.event2EventId(e)},e.prototype.getRequestId=function(){return this._request_id},e.prototype.buildNewRequestId=function(){this._request_id=h()(C())},e.prototype.setResp=function(e){null!=e&&(this._resp=e)},e.prototype.getRetCode=function(){return this._ret_code},e.prototype.setRetCode=function(e){this._ret_code=e},e.prototype.setRetMsg=function(e){null!=e&&(this._ret_msg=e)},e.prototype.setMgId=function(e){this._mgId=e},e.prototype.putExtra=function(e,t){null!=e&&null!=t&&this._extras.set(e,t)},e.prototype.toString=function(){var e,t,i=Date.now(),n={tag:this._tag,app_id:O.getAppId(),mg_id:this._mgId,is_test_env:O.getIsTestEnv(),env_type:O.getEnvType(),sdk_version:I.kVersion,sdk_version_alias:I.kVersionAlias,et_is_dynamic:!1,sud_is_dynamic:!1,event:this._event,event_id:this._event_id,trace_id:O.getTraceId(),span_id:T.getSpanId(this._mgId),request_id:this._request_id,user_id:T.getUserId(),platform:O.kPlatformH5,bundle_id:O.getBundleID(),start_timestamp:this._start_timestamp,end_timestamp:i,cost_time:i-this._start_timestamp},r={};try{for(var s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this._extras),o=s.next();!o.done;o=s.next()){var a=R(o.value,2),c=a[0],u=a[1];r[c]=u}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return r.ret_msg=this._ret_msg,r.ret_code=this._ret_code,r.resp=this._resp,n.extras=r,n.ret_msg=this._ret_msg,n.ret_code=this._ret_code,n.device_brand=this.getUserAgent(),n.os_version=this.getUserAgent(),n.device_id=this.getUserAgent(),n.net_type=w.getNetworkType(),null!=this.local_core&&(n.local_pkg=this.local_pkg),null!=this.local_core&&(n.local_core=this.local_core),null!=this.timeout_code&&(n.timeout_code=this.timeout_code),JSON.stringify(n)},e.prototype.getUserAgent=function(){try{return navigator.userAgent}catch(e){return""}},e.prototype.setLocal_pkg=function(e){this.local_pkg=e},e.prototype.setLocal_core=function(e){this.local_core=e},e.prototype.setTimeout_code=function(e){this.timeout_code=e},e.kStatsEventGetFQSInfo="getFQSInfo",e.kStatsEventGetSDKToken="getSDKToken",e.kStatsEventGetMGInfo="getMGInfo",e.kStatsEventGetAuthMGInfo="getAuthMGInfo",e.kStatsEventGetMGList="getMGList",e.kStatsEventDownloadGameRuntime="checkoutGameRuntime",e.kStatsEventDownloadGamePkg="checkoutGamePkg",e.kStatsEventLoadGameFinished="loadGameFinished",e.kStatsEventMatchASRInfo="matchASRInfo",e.kStatsEventLoadGameTimeout="loadGameTimeout",e.kStatsEventGetGateToken="getGateToken",e.kStatsEventGetDoubaoToken="getDoubaoToken",e.kStatsEventIdGetFQSInfo="1d12a87cbee567f5764efeea2bc240dc",e.kStatsEventIdGetSDKToken="8ae34dba26951ae65f9d0a0559debc10",e.kStatsEventIdGetMGInfo="b7743119f3b53930606d342105bf928d",e.kStatsEventIdGetAuthMGInfo="0fd2883dc4033c0dfe50e3fd9a6770e5",e.kStatsEventIdGetMGList="53e30b7d1de26629170dfe2ff82272b8",e.kStatsEventIdDownloadGameRuntime="efe18913246663006e71b97c7f6b8f5d",e.kStatsEventIdDownloadGamePkg="0386896a3155b50ca86f8e7a5d6f7af2",e.kStatsEventIdLoadGameFinished="bf55eb46d866f04e98c2da2e4984b015",e.kStatsEventIdMatchASRInfo="378ee04c16891a9016931fdda9bedabd",e.kStatsEventIdLoadGameTimeout="0550fa93143b0bb01c512435af4b6e3c",e}(),T=function(){function e(){}return e.event2EventId=function(e){var t="";return e&&(t=this._statsEventIdMap.get(e)||""),t||(t="UNSPECIFIED"),t},e.genSpanId=function(e){var t=h()(C());this._statsSpanIdMap.set(e.toString(),t)},e.getSpanId=function(e){if(!e)return"";var t=this._statsSpanIdMap.get(e)||"";return null==t&&(t=""),t},e.removeSpanId=function(e){this._statsSpanIdMap.delete(e.toString())},e.getUserId=function(){return e.userId},e.setUserId=function(t){e.userId=t},e.setReportStatsEventListener=function(e){this._listener=e},e.report=function(e){this.runReport(e.getEvent(),e.getRetCode(),e.toString())},e.runReport=function(e,t,i){O.reportStats(i),null!=this._listener&&this._listener.onReportStatsEvent(e,t,i)},e.userId="",e._statsEventIdMap=(new Map).set(_.kStatsEventGetFQSInfo,_.kStatsEventIdGetFQSInfo).set(_.kStatsEventGetSDKToken,_.kStatsEventIdGetSDKToken).set(_.kStatsEventGetMGInfo,_.kStatsEventIdGetMGInfo).set(_.kStatsEventGetAuthMGInfo,_.kStatsEventIdGetAuthMGInfo).set(_.kStatsEventGetMGList,_.kStatsEventIdGetMGList).set(_.kStatsEventDownloadGameRuntime,_.kStatsEventIdDownloadGameRuntime).set(_.kStatsEventDownloadGamePkg,_.kStatsEventIdDownloadGamePkg).set(_.kStatsEventLoadGameFinished,_.kStatsEventIdLoadGameFinished).set(_.kStatsEventMatchASRInfo,_.kStatsEventIdMatchASRInfo).set(_.kStatsEventLoadGameTimeout,_.kStatsEventIdLoadGameTimeout),e._statsSpanIdMap=new Map,e}(),E=function(){function e(){}return e.toJson=function(e,t){return JSON.stringify({retCode:e,retMsg:t})},e.kSuccessJson='{"retCode":0, "retMsg":"success"}',e.kFailNotImplementJson='{"retCode":-1, "retMsg":"not implement"}',e.kSuccess=0,e.kFail=-1,e.EngineNotSupported=-10100,e.DOWNLOAD_TIMEOUT=-10302,e.ENGINE_LOAD_TIMEOUT=-10303,e.GAME_LOAD_TIMEOUT=-10304,e.DestroyGame=-10301,e}();var P=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},k=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r<s;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},D=function(){function e(){this.kTag="HttpService",this.reportStatsUrl="",this.getGateTokenUrl="",this.getDoubaoAsrUrl=null,this.reportFailedStatsCacheList=[],this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.getGateTokenUrl="",this.mgIdGameInfoMap=new Map}return e.prototype.getFQSInfoSize=function(){var t=O.getEnvType();return t===O.kEnvTypeDev?e.kGetFQSInfoDevBaseUrls.length:t===O.kEnvTypeFat?e.kGetFQSInfoFatBaseUrls.length:t===O.kEnvTypeSim?e.kGetFQSInfoSimBaseUrls.length:e.kGetFQSInfoProBaseUrls.length},e.prototype.getSDKToken=function(e,t,i,n){var r=this.getFQSInfoSize();this.getSDKTokenStepGetFQSInfo(e,t,i,n,1,r)},e.prototype.getSDKTokenStepGetFQSInfo=function(e,t,i,n,r,s){var o=this;this.getFQSInfo(e,i,r,{onSuccess:function(r){o.getSDKTokenUrl=r,o.getSDKTokenInternal(e,t,i,n)},onFailure:function(a,c){s>0&&r<s?o.getSDKTokenStepGetFQSInfo(e,t,i,n,r+1,s):n.onFailure(a,c)}})},e.prototype.getMGList=function(e){if(this.isInitSdkOk){var t={sdk_token:this.sdkToken,platform:O.getPlatform()},i=new _(_.kStatsEventGetMGList);this.doSudPost(this.getMGListUrl,t,i.getRequestId(),{onSuccess:function(t){var n=JSON.parse(t),r=n.ret_code,s=n.ret_msg,o=t;i.setRetCode(r),i.setRetMsg(s),T.report(i),e&&o&&r&&s&&(E.kSuccess===r?e.onSuccess(o):e.onFailure(r,s))},onFailure:function(t){var n=E.kFail,r=t.toString();i.setRetCode(n),i.setRetMsg(r),T.report(i),e.onFailure(n,r)}})}else e&&e.onFailure(-1,"请先调用initSDK成功")},e.prototype.getMGInfo=function(e,t){if(this.isInitSdkOk){var i=this,n=this.getCacheMGInfo(e),r=0;n||(r=n.clientVersion);var s={sdk_token:this.sdkToken,mg_id:Number(e),mg_id_str:e,client_version:r,platform:O.getPlatform()},o=this,a=new _(_.kStatsEventGetMGInfo);a.setMgId(e),this.doSudPost(this.getMGInfoUrl,s,a.getRequestId(),{onSuccess:function(n){var r=JSON.parse(n),s=r.ret_code,c=r.ret_msg;if(r.data&&r.data.mg_info){var u=r.data.mg_info,d={mgId:u.mg_id_str,name:O.getLocalizationData(u.name,O.getLanguage()),version:u.version,orientation:u.orientation,screenMode:u.screen_mode,url:u.url,h5url:u.h5url,appID:u.game_app_id,hash:u.hash,h5engine:u.h5engine,engine:u.engine,bigLoadingPic:O.getLocalizationData(u.big_loading_pic,O.getLanguage()),clientVersion:u.client_version,dynamic_config:u.dynamic_config,gameLargeModelCfg:u.game_large_model_cfg};if(r.data.log_id&&(d.log_id=r.data.log_id),a.setRetCode(s),a.setRetMsg(c),T.report(a),t)if(E.kSuccess===s)o.setCacheMGInfo(e,d),t.onSuccess(d);else{var h=o.getCacheMGInfo(e);h?t.onSuccess(h):t.onFailure(s,c)}}else p.e(i.kTag,"getMGInfo error: mgId ".concat(e),"errCode: "+s,"errMsg: "+c),t.onFailure(s,c)},onFailure:function(i){var n=E.kFail,r=i.toString();if(a.setRetCode(n),a.setRetMsg(r),T.report(a),t){var s=o.getCacheMGInfo(e);s?t.onSuccess(s):t.onFailure(n,r)}}})}else t&&t.onFailure(-1,"请先调用initSDK成功")},e.prototype.reportStats=function(e){var t=this;if(!t.reportStatsUrl)return p.w(this.kTag,"reportStats reportStatsUrl is null or empty"),void this.reportFailedStatsCacheList.push(e);var i=[];i.push(e),this.reportFailedStatsCacheList.length>0&&(i=k(k([],P(i),!1),P(this.reportFailedStatsCacheList),!1),this.reportFailedStatsCacheList=[]);for(var n=function(e){var n=i[e],s=h()(C());r.doSudPost(t.reportStatsUrl,JSON.parse(n),s,{onSuccess:function(e){var i=JSON.parse(e).ret_code;i!==E.kSuccess&&p.e(t.kTag,"reportStats server errcode="+i,"")},onFailure:function(){t.reportFailedStatsCacheList.push(n)}})},r=this,s=0;s<i.length;s++)n(s)},e.prototype.addHeaders=function(t){var i=t.xhr,n=t.sudSDKRequestId;i.addHeader(e.kHeaderSudMGPSDKVersion,I.kVersion),i.addHeader(e.kHeaderSudMGPSDKVersionAlias,I.kVersionAlias),i.addHeader(e.kHeaderSudMGPSDKPlatform,O.getPlatform()),i.addHeader(e.kHeaderSudMGPSDKAppId,O.getAppId()),i.addHeader(e.kHeaderSudMGPSDKBundleId,O.getBundleID()),i.addHeader(e.kHeaderSudMGPSDKTraceId,O.getTraceId()),i.addHeader(e.kHeaderSudMGPSDKRequestId,n),i.addHeader(e.kHeaderSudMGPSDKUserId,T.getUserId()),i.addHeader(e.kHeaderSudMGPSDKEtIsDynamic,!0)},e.prototype.commonPost=function(e,t,i,n){var r=h()(C());this.doSudPost(e,t,r,i,n)},e.prototype.doSudPost=function(e,t,i,n,r){var s=this,o=(r||{}).beforeSend;v(l({method:"post"},{data:t,url:e,beforeSend:function(e){o&&o(e),s.addHeaders({xhr:e,sudSDKRequestId:i})},success:function(e){p.v(s.kTag,"post success res:",e),n.onSuccess(e)},fail:function(e){p.v(s.kTag,"post fail res:",e),n.onFailure(e)}}))},e.prototype.doSudGet=function(e,t,i){var n=this;f({url:e,beforeSend:function(e){n.addHeaders({xhr:e,sudSDKRequestId:t})},success:function(e){p.v(n.kTag,"get success res:",e),i.onSuccess(e)},fail:function(e){p.v(n.kTag,"get fail res:",e),i.onFailure(e)}})},e.prototype.doUpload=function(e){var t=this,i=e.url,n=e.formData,r=e.requestId,s=e.beforeSend,o=e.listener;(function(e){var t=e.url,i=e.formData,n=e.success,r=e.fail,s=e.beforeSend,o=new XMLHttpRequest;o?(o.addHeader=function(e,t){o.setRequestHeader(e,t)},o.open("POST",t,!0),s&&s(o),o.onreadystatechange=function(){var e=null==o?void 0:o.responseText;4===o.readyState&&(200===o.status?n&&n(e):r&&r(e))},o.send(i)):console.error("浏览器不支持XMLHttpRequest")})(l({},{formData:n,url:i,beforeSend:function(e){s&&s(e),t.addHeaders({xhr:e,sudSDKRequestId:r})},success:function(e){p.v(t.kTag,"upload success res:",e),o.onSuccess(e)},fail:function(e){p.v(t.kTag,"upload fail res:",e),o.onFailure(e)}}))},e.prototype.clearCache=function(){this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.reportStatsUrl="",this.getGateTokenUrl="",this.mgIdGameInfoMap.clear()},e.prototype.getFQSInfoBaseUrl=function(t){var i=O.getEnvType();return i===O.kEnvTypeDev?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoDevBaseUrls,t):i===O.kEnvTypeFat?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoFatBaseUrls,t):i===O.kEnvTypeSim?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoSimBaseUrls,t):this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoProBaseUrls,t)},e.prototype.getFQSInfoBaseUrlByArray=function(e,t){if(null==e||0===e.length)return null;var i=0;return t>0&&(i=t-1),i<e.length?e[i]:null},e.prototype.getFQSInfo=function(e,t,i,n){if(this.getSDKTokenUrl.length>0)n.onSuccess(this.getSDKTokenUrl);else{O.genTraceId();var r=this.getFQSInfoBaseUrl(i)+h()(e),s=new _(_.kStatsEventGetFQSInfo),o=this;this.doSudGet(r,s.getRequestId(),{onSuccess:function(e){var t={ret_code:E.kSuccess,ret_msg:"success",url:JSON.parse(e).url};s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),T.report(s),o.handleGetFQSInfoResp(t,t.url,n)},onFailure:function(e){var t={ret_code:E.kFail,ret_msg:e.toString()};s.setResp(""),s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),T.report(s),o.handleGetFQSInfoResp(t,"",n)}})}},e.prototype.handleGetFQSInfoResp=function(e,t,i){if(void 0!==i)if(t.length>0)i.onSuccess(t);else{var n="getFQSInfo fail appId=".concat(O.getAppId()," isTestEnv=",O.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," null == getSDKTokenUrl || getSDKTokenUrl.isEmpty() ",e.ret_msg);i.onFailure(e.ret_code,n)}},e.prototype.getSDKTokenInternal=function(e,t,i,n){if(this.isInitSdkOk)n&&n.onSuccess();else{var r=this.getSDKTokenUrl,s=O.getBundleID(),o=new _(_.kStatsEventGetSDKToken),a={app_id:e,app_key:t,bundle_id:s,platform:O.getPlatform(),is_test_env:i,sdk_version:I.kVersion},c=this;this.doSudPost(r,a,o.getRequestId(),{onSuccess:function(e){var t=JSON.parse(e);c.handleInitSDKCb(t,n),o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),T.report(o)},onFailure:function(e){var t={ret_code:E.kFail,ret_msg:e.toString()};o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),c.handleInitSDKCb(t,n),T.report(o)}})}},e.prototype.handleInitSDKCb=function(e,t){if(t)if(0===e.ret_code){var i=e.data;this.sdkToken=i.sdk_token,this.getMGListUrl=i.sdk_api_cfg.mg_list_url,this.getMGInfoUrl=i.sdk_api_cfg.mg_info_url,this.reportStatsUrl=i.sdk_api_cfg.report_url,this.getGateTokenUrl=i.sdk_api_cfg.gate_token_url;var n=i.large_model_cfg;n&&n.dou_bao_rtss_cfg&&(i.large_model_cfg.dou_bao_rtss_cfg.access_key=function(e){if(!e)return e;try{var t=function(e){if("function"==typeof atob){for(var t=atob(e),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}return Buffer.from(e,"base64")}(e),i=function(e){if(!e||0===e.length)return e;for(var t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e[i]^255&i;return t}(t);return new TextDecoder("utf-8").decode(i)}catch(t){return e}}(i.large_model_cfg.dou_bao_rtss_cfg.access_key)),i.model_api_cfg&&i.model_api_cfg.volc_sts_token_url&&(this.getDoubaoAsrUrl=i.model_api_cfg.volc_sts_token_url),O.setGetSDKTokenResp(e),this.isInitSdkOk=!0,t.onSuccess()}else{var r="getSDKToken fail appId=".concat(O.getAppId()," isTestEnv=",O.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," ",e.ret_msg);t.onFailure(e.ret_code,r)}},e.prototype.getCacheMGInfo=function(e){return this.mgIdGameInfoMap.get(e)||{}},e.prototype.setCacheMGInfo=function(e,t){this.mgIdGameInfoMap.set(e,t)},e.prototype.setHeaderAuthorization=function(e){e.addHeader("Authorization","Bearer "+this.sdkToken)},e.prototype.getDoubaoAsrToken=function(e){if(null!==e){var t=new _(_.kStatsEventGetDoubaoToken);if(this.getDoubaoAsrUrl){var i=this;this.doSudPost(this.getDoubaoAsrUrl,null,t.getRequestId(),{onSuccess:function(i){var n=JSON.parse(i),r=n.ret_code,s=n.ret_msg;t.setRetCode(r),t.setRetMsg(s),T.report(t),e&&e.onSuccess(n)},onFailure:function(i){var n=E.kFail,r=i.toString();t.setRetCode(n),t.setRetMsg(r),T.report(t),e.onFailure(i)}},{beforeSend:function(e){i.setHeaderAuthorization(e)}})}else p.e(this.kTag,"getDoubaoAsrToken url is no config")}},e.prototype.getGateToken=function(e,t){if(null!==e&&null!==t){var i=new _(_.kStatsEventGetGateToken),n={app_id:e.app_id,uid:e.uid},r=this;this.doSudPost(this.getGateTokenUrl,n,i.getRequestId(),{onSuccess:function(e){var n=JSON.parse(e),r=n.ret_code,s=n.ret_msg;i.setRetCode(r),i.setRetMsg(s),T.report(i),t&&t.onSuccess(n)},onFailure:function(e){var n=E.kFail,r=e.toString();i.setRetCode(n),i.setRetMsg(r),T.report(i),t.onFailure(n,r)}},{beforeSend:function(e){r.setHeaderAuthorization(e)}})}},e.prototype.sendRoomMessage=function(e,t){if(null!=e&&null!=t){var i=h()(C()),n=e.metrics,r={message_id:i,mg_id:e.mgId,room_id:e.roomId,message_type:e.messageType,sender:{uid:e.senderUserId,nickname:e.senderNickName},content:e.content,timestamp:Date.now(),metrics:n?{asr_duration:n.asr_duration,end_time:n.end_time,log_id:n.log_id,start_time:n.start_time}:null},s=this,o=O.getRoomMessageUrl(),a=h()(C());this.doSudPost(o,r,a,{onSuccess:function(){t&&t.onSuccess()},onFailure:function(e){var i=E.kFail,n=e.toString();t&&t.onFailure(i,n)}},{beforeSend:function(e){s.setHeaderAuthorization(e)}})}},e.kGetFQSInfoDevBaseUrls=["https://dev-fqs.sudden.ltd/","https://dev-fqs.sud.ltd/","https://dev-fqs.sudcdn.cloud/"],e.kGetFQSInfoFatBaseUrls=["https://fat-fqs.sudden.ltd/","https://fat-fqs.sud.ltd/","https://fat-fqs.sudcdn.cloud/"],e.kGetFQSInfoSimBaseUrls=["https://sim-fqs.sudden.ltd/","https://sim-fqs.sud.ltd/","https://sim-fqs.sudcdn.cloud/"],e.kGetFQSInfoProBaseUrls=["https://fqs.sudden.ltd/","https://fqs.sud.ltd/","https://fqs.sudcdn.cloud/"],e.kHeaderSudMGPSDKVersion="sud-sdk-version",e.kHeaderSudMGPSDKVersionAlias="sud-sdk-version-alias",e.kHeaderSudMGPSDKPlatform="sud-sdk-platform",e.kHeaderSudMGPSDKAppId="sud-sdk-app-id",e.kHeaderSudMGPSDKBundleId="sud-sdk-bundle-id",e.kHeaderSudMGPSDKRequestId="sud-sdk-request-id",e.kHeaderSudMGPSDKTraceId="sud-sdk-trace-id",e.kHeaderSudMGPSDKUserId="sud-sdk-user-id",e.kHeaderSudMGPSDKEtIsDynamic="sud-sdk-et-is-dynamic",e.kHeaderSudMGPSDKSignature="sud-sdk-signature",e}(),M=function(){function e(){}return e.e=function(e){O.getEnvType()!==e&&O.clearCache(),O.setEnvType(e)},e}(),O=function(){function e(){}return e.initSDK=function(t,i,n,r,s){if(t&&0!==t.length&&i&&0!==i.length){var o=e.getEnvType(),a=e.getIsTestEnv();e.setIsTestEnv(r);var c=e.getEnvType();e.sAppId===t&&e.sAppKey===i&&o===c&&a===r||e.httpService.clearCache(),e.sAppId=t,e.sAppKey=i,e.sBundleId=n,e.sBundleId||(e.sBundleId=""),e.httpService.getSDKToken(t,i,r,s)}else s&&s.onFailure(1,"Parameters cannot be null or empty")},e.uninitSDK=function(t){e.httpService.clearCache(),t&&t.onSuccess()},e.clearCache=function(){e.httpService.clearCache()},e.getMGList=function(t){e.httpService.getMGList(t)},e.getMGInfo=function(t,i){e.httpService.getMGInfo(t,i)},e.reportStats=function(t){e.httpService.reportStats(t)},e.getIsTestEnv=function(){return e.sIsTestEnv},e.setIsTestEnv=function(t){e.sIsTestEnv=t,(e.getEnvType()===e.kEnvTypePro||e.getEnvType()===e.kEnvTypeSim)&&(t?e.setEnvType(e.kEnvTypeSim):e.setEnvType(e.kEnvTypePro))},e.getEnvType=function(){return e.sEnvType},e.setEnvType=function(t){e.sEnvType=t},e.setLanguage=function(t){e.sLangCountryCode=t},e.getLanguage=function(){return e.sLangCountryCode},e.getAppId=function(){return e.sAppId},e.getPlatform=function(){return e.kPlatformH5},e.getBundleID=function(){return e.sBundleId},e.setGetSDKTokenResp=function(t){e.sGetSDKTokenResp=t},e.getSdkLocalizationCfg=function(){return e.sGetSDKTokenResp.data.sdk_localization_cfg},e.getMgApiCfg=function(){return e.sGetSDKTokenResp.data.mg_api_cfg},e.getMgApiCfgJson=function(){return JSON.stringify(e.sGetSDKTokenResp.data.mg_api_cfg)},e.getOnlyTestText=function(){return null!=this.sLangCountryCode&&"zh"===this.sLangCountryCode.substring(0,2)?"zh-CN"===this.sLangCountryCode?"仅供测试":"僅供測試":"Only Test"},e.genTraceId=function(){e.sTraceId=h()(C())},e.getTraceId=function(){return e.sTraceId},e.getAppKey=function(){return e.sAppKey},e.getLocalizationData=function(e,t){if(void 0===t&&(t="default"),!e||!e.hasOwnProperty(t))return"";var i=e[t];return void 0!==i?i:""},e.getAsrLoadList=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_rtss_cfg&&null!=this.sGetSDKTokenResp.data.sdk_rtss_cfg.asr_load_list?this.sGetSDKTokenResp.data.sdk_rtss_cfg.asr_load_list:[]},e.getAzureASRTextLanguageList=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data&&null!=e.data.sdk_rtss_cfg&&null!=e.data.sdk_rtss_cfg.microsoft_rtss_cfg?e.data.sdk_rtss_cfg.microsoft_rtss_cfg.asr_text_language_list:["zh-CN"]},e.getAzureASRNumberLanguageList=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data&&null!=e.data.sdk_rtss_cfg&&null!=e.data.sdk_rtss_cfg.microsoft_rtss_cfg?e.data.sdk_rtss_cfg.microsoft_rtss_cfg.asr_number_language_list:["zh-CN"]},e.getSdkRtssCfg=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data?e.data.sdk_rtss_cfg:null},e.getLoadMgPkgTimeout=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data?this.sGetSDKTokenResp.data.load_mg_pkg_time_out:10},e.getGateWsUrl=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_api_cfg?this.sGetSDKTokenResp.data.sdk_api_cfg.gate_ws_url:null},e.getUploadUrl=function(){return null!=this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_api_cfg?this.sGetSDKTokenResp.data.sdk_api_cfg.upload_url:null},e.getRoomMessageUrl=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.model_api_cfg?this.sGetSDKTokenResp.data.model_api_cfg.room_message_url:null},e.getReportLargeModelDurationUrl=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.report_api_cfg&&null!=this.sGetSDKTokenResp.data.report_api_cfg.report_llm_asr_url?this.sGetSDKTokenResp.data.report_api_cfg.report_llm_asr_url:null},e.getDoubaoRtssCfg=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.large_model_cfg?this.sGetSDKTokenResp.data.large_model_cfg.dou_bao_rtss_cfg:null},e.sendRoomMessage=function(e,t,i,n,r,s,o){var a={mgId:e,roomId:t,messageType:i,senderUserId:n,senderNickName:r,content:s,metrics:o};this.httpService.sendRoomMessage(a,{onSuccess:function(){},onFailure:function(){}})},e.getHttpService=function(){return this.httpService},e.httpService=new D,e.sIsTestEnv=!1,e.sLangCountryCode="zh-CN",e.kEnvTypePro=1,e.kEnvTypeSim=2,e.kEnvTypeFat=3,e.kEnvTypeDev=4,e.kPlatformIOS=1,e.kPlatformAndroid=2,e.kPlatformH5=3,e.sEnvType=e.kEnvTypePro,e.sAppId="",e.sAppKey="",e.sBundleId="",e.sTraceId="",e}(),L=function(){function e(e,t,i,n,r,s){this.isHit=e,this.keyWord=t,this.text=i,this.wordType=n,this.keyWordList=r,this.numberList=s}return e.prototype.toJson=function(){return JSON.stringify({isHit:this.isHit,keyWord:this.keyWord,text:this.text,wordType:this.wordType,keyWordList:this.keyWordList,numberList:this.numberList})},e.getState=function(){return"app_common_self_text_hit"},e}(),x=function(){return x=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},x.apply(this,arguments)},G=function(){function e(e,t){this.WORD_TYPE_TEXT="text",this.WORD_TYPE_NUMBER="number",this.mgCommonGameASR={WORD_TYPE_TEXT:this.WORD_TYPE_TEXT,WORD_TYPE_NUMBER:this.WORD_TYPE_NUMBER,isOpen:!1,wordList:[],wordLanguage:"",wordType:this.WORD_TYPE_TEXT,isCloseConnHitted:!0,enableIsHit:!0,enableIsReturnText:!0},this.hitKeywordSet=new Set,this.paramModel=e,this.context=t}return e.prototype.startASR=function(e){this.hitKeywordSet.clear(),this.context&&this.context.startASR(e)},e.prototype.stopASR=function(){this.hitKeywordSet.clear(),this.context&&this.context.stopASR()},e.prototype.handleGameASR=function(t){var i;if(p.d(e._TAG,"handleGameASR:",t),!t)return this.mgCommonGameASR=null,void this.stopASR();var n=JSON.parse(t);if(t)if(this.mgCommonGameASR=x(x({},this.mgCommonGameASR),n),null===(i=this.mgCommonGameASR)||void 0===i?void 0:i.isOpen){if(!this.isSupportWordType(n.wordType))return;if(n.wordType===this.WORD_TYPE_TEXT&&!this.isValidLanguage(this.paramModel.supportTextLanguageList,n.wordLanguage))return;if(n.wordType===this.WORD_TYPE_NUMBER&&!this.isValidLanguage(this.paramModel.supportNumberLanguageList,n.wordLanguage))return;this.startASR(n.wordLanguage)}else this.stopASR();else this.stopASR()},e.prototype.isSupportWordType=function(e){return this.WORD_TYPE_TEXT===e||this.WORD_TYPE_NUMBER===e},e.prototype.isValidLanguage=function(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n&&n===t)return!0}return!1},e.prototype.onRecognizedResult=function(e){if(e){var t=this.mgCommonGameASR;null!==t&&t.isOpen&&(t.wordType===this.WORD_TYPE_TEXT?(t.enableIsHit&&this.textMatch(e,t),t.enableIsReturnText&&this.notifyAppCommonSelfTextHit(!1,null,e,t.wordType,null,null)):t.wordType===this.WORD_TYPE_NUMBER&&(t.enableIsHit&&this.numberMatch(e,t),t.enableIsReturnText&&this.numberConver(e,t)))}},e.prototype.numberConver=function(e,t){var i=e.match(/[0-9]+/g),n=null==i?void 0:i.map(Number);n&&(null==n?void 0:n.length)&&this.notifyAppCommonSelfTextHit(!1,null,null,t.wordType,null,n)},e.prototype.textMatch=function(e,t){var i=this;if(null!==t.wordList&&0!==t.wordList.length&&null!=e){var n=e.toLowerCase();t.wordList.map((function(e){if(null!==e&&n.includes(e.toLowerCase())){i.hitKeywordSet.add(e);var r=[e];i.notifyAppCommonSelfTextHit(!0,e,null,t.wordType,r,null)}}));for(var r=!0,s=0;s<t.wordList.length;s++){var o=t.wordList[s];if(!this.hitKeywordSet.has(o)){r=!1;break}}r&&this.stopASR()}},e.prototype.numberMatch=function(e,t){var i=this;if(null!==t.wordList&&0!==t.wordList.length&&null!=e){t.wordList.map((function(n){if(null!==n&&e.includes(n)){i.hitKeywordSet.add(n);var r=[n],s=[parseInt(n)];i.notifyAppCommonSelfTextHit(!0,n,null,t.wordType,r,s)}}));for(var n=!0,r=0;r<t.wordList.length;r++){var s=t.wordList[r];if(!this.hitKeywordSet.has(s)){n=!1;break}}n&&this.stopASR()}},e.prototype.notifyAppCommonSelfTextHit=function(t,i,n,r,s,o){var a=new L(t,i,n,r,s,o),c=this.paramModel.iSudFSTAPP;null!==c&&(c.notifyStateChange(L.getState(),a.toJson(),{onSuccess:function(){},onFailure:function(){}}),p.d(e._TAG,"notifyAppCommonSelfTextHit: ",a.toJson()))},e._TAG="BaseRealSudASRImpl",e}();const z="OutputFormat",B="CancellationErrorCode",N="ServiceProperties",U="ForceDictation";class F{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(F.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfNullOrTooLong(e,t,i){if(F.throwIfNullOrUndefined(e,t),(""+e).length>i)throw new Error("throwIfNullOrTooLong:"+t+" (more than "+i.toString()+" characters)")}static throwIfNullOrTooShort(e,t,i){if(F.throwIfNullOrUndefined(e,t),(""+e).length<i)throw new Error("throwIfNullOrTooShort:"+t+" (less than "+i.toString()+" characters)")}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(F.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const i of e)F.throwIfNullOrWhitespace(i,t)}static throwIfFileDoesNotExist(e,t){F.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}var H,K,j,q,V,W,X,J;!function(e){e[e.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",e[e.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",e[e.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",e[e.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",e[e.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",e[e.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",e[e.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",e[e.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",e[e.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",e[e.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",e[e.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",e[e.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",e[e.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",e[e.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",e[e.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",e[e.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",e[e.Speech_SessionId=16]="Speech_SessionId",e[e.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",e[e.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",e[e.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",e[e.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",e[e.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",e[e.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",e[e.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",e[e.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",e[e.CancellationDetails_Reason=25]="CancellationDetails_Reason",e[e.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",e[e.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",e[e.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",e[e.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",e[e.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",e[e.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",e[e.Speech_SegmentationSilenceTimeoutMs=32]="Speech_SegmentationSilenceTimeoutMs",e[e.SpeechServiceConnection_EnableAudioLogging=33]="SpeechServiceConnection_EnableAudioLogging",e[e.SpeechServiceConnection_LanguageIdMode=34]="SpeechServiceConnection_LanguageIdMode",e[e.SpeechServiceConnection_RecognitionEndpointVersion=35]="SpeechServiceConnection_RecognitionEndpointVersion",e[e.SpeechServiceConnection_SpeakerIdMode=36]="SpeechServiceConnection_SpeakerIdMode",e[e.SpeechServiceResponse_ProfanityOption=37]="SpeechServiceResponse_ProfanityOption",e[e.SpeechServiceResponse_PostProcessingOption=38]="SpeechServiceResponse_PostProcessingOption",e[e.SpeechServiceResponse_RequestWordLevelTimestamps=39]="SpeechServiceResponse_RequestWordLevelTimestamps",e[e.SpeechServiceResponse_StablePartialResultThreshold=40]="SpeechServiceResponse_StablePartialResultThreshold",e[e.SpeechServiceResponse_OutputFormatOption=41]="SpeechServiceResponse_OutputFormatOption",e[e.SpeechServiceResponse_TranslationRequestStablePartialResult=42]="SpeechServiceResponse_TranslationRequestStablePartialResult",e[e.SpeechServiceResponse_RequestWordBoundary=43]="SpeechServiceResponse_RequestWordBoundary",e[e.SpeechServiceResponse_RequestPunctuationBoundary=44]="SpeechServiceResponse_RequestPunctuationBoundary",e[e.SpeechServiceResponse_RequestSentenceBoundary=45]="SpeechServiceResponse_RequestSentenceBoundary",e[e.Conversation_ApplicationId=46]="Conversation_ApplicationId",e[e.Conversation_DialogType=47]="Conversation_DialogType",e[e.Conversation_Initial_Silence_Timeout=48]="Conversation_Initial_Silence_Timeout",e[e.Conversation_From_Id=49]="Conversation_From_Id",e[e.Conversation_Conversation_Id=50]="Conversation_Conversation_Id",e[e.Conversation_Custom_Voice_Deployment_Ids=51]="Conversation_Custom_Voice_Deployment_Ids",e[e.Conversation_Speech_Activity_Template=52]="Conversation_Speech_Activity_Template",e[e.Conversation_Request_Bot_Status_Messages=53]="Conversation_Request_Bot_Status_Messages",e[e.Conversation_Agent_Connection_Id=54]="Conversation_Agent_Connection_Id",e[e.SpeechServiceConnection_Host=55]="SpeechServiceConnection_Host",e[e.ConversationTranslator_Host=56]="ConversationTranslator_Host",e[e.ConversationTranslator_Name=57]="ConversationTranslator_Name",e[e.ConversationTranslator_CorrelationId=58]="ConversationTranslator_CorrelationId",e[e.ConversationTranslator_Token=59]="ConversationTranslator_Token",e[e.PronunciationAssessment_ReferenceText=60]="PronunciationAssessment_ReferenceText",e[e.PronunciationAssessment_GradingSystem=61]="PronunciationAssessment_GradingSystem",e[e.PronunciationAssessment_Granularity=62]="PronunciationAssessment_Granularity",e[e.PronunciationAssessment_EnableMiscue=63]="PronunciationAssessment_EnableMiscue",e[e.PronunciationAssessment_Json=64]="PronunciationAssessment_Json",e[e.PronunciationAssessment_Params=65]="PronunciationAssessment_Params",e[e.SpeakerRecognition_Api_Version=66]="SpeakerRecognition_Api_Version"}(H||(H={}));class Q{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let i;i="string"==typeof e?e:H[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===i)return this.privValues[e];if(void 0!==t)return String(t)}setProperty(e,t){let i;i="string"==typeof e?e:H[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===i)return void(this.privValues[e]=t);this.privKeys.push(i),this.privValues.push(t)}clone(){const e=new Q;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const i=this.getProperty(t);e.setProperty(t,i)}}))}get keys(){return this.privKeys}}!function(e){e[e.Simple=0]="Simple",e[e.Detailed=1]="Detailed"}(K||(K={})),function(e){e[e.Masked=0]="Masked",e[e.Removed=1]="Removed",e[e.Raw=2]="Raw"}(j||(j={})),function(e){e[e.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",e[e.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",e[e.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",e[e.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",e[e.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",e[e.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",e[e.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",e[e.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",e[e.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",e[e.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",e[e.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",e[e.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",e[e.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",e[e.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",e[e.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",e[e.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",e[e.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",e[e.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",e[e.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",e[e.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",e[e.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",e[e.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",e[e.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",e[e.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",e[e.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",e[e.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",e[e.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",e[e.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",e[e.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",e[e.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",e[e.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",e[e.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",e[e.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",e[e.Raw22050Hz16BitMonoPcm=33]="Raw22050Hz16BitMonoPcm",e[e.Riff22050Hz16BitMonoPcm=34]="Riff22050Hz16BitMonoPcm",e[e.Raw44100Hz16BitMonoPcm=35]="Raw44100Hz16BitMonoPcm",e[e.Riff44100Hz16BitMonoPcm=36]="Riff44100Hz16BitMonoPcm"}(q||(q={}));class Z{constructor(){}static fromSubscription(e,t){F.throwIfNullOrWhitespace(e,"subscriptionKey"),F.throwIfNullOrWhitespace(t,"region");const i=new Y;return i.setProperty(H.SpeechServiceConnection_Region,t),i.setProperty(H.SpeechServiceConnection_IntentRegion,t),i.setProperty(H.SpeechServiceConnection_Key,e),i}static fromEndpoint(e,t){F.throwIfNull(e,"endpoint");const i=new Y;return i.setProperty(H.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&i.setProperty(H.SpeechServiceConnection_Key,t),i}static fromHost(e,t){F.throwIfNull(e,"hostName");const i=new Y;return i.setProperty(H.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&i.setProperty(H.SpeechServiceConnection_Key,t),i}static fromAuthorizationToken(e,t){F.throwIfNull(e,"authorizationToken"),F.throwIfNullOrWhitespace(t,"region");const i=new Y;return i.setProperty(H.SpeechServiceConnection_Region,t),i.setProperty(H.SpeechServiceConnection_IntentRegion,t),i.authorizationToken=e,i}close(){}}class Y extends Z{constructor(){super(),this.privProperties=new Q,this.speechRecognitionLanguage="en-US",this.outputFormat=K.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(H.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(H.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(H.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(H.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(H.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(H.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(H.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(H.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(H.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return K[this.privProperties.getProperty(z,void 0)]}set outputFormat(e){this.privProperties.setProperty(z,K[e])}get endpointId(){return this.privProperties.getProperty(H.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(H.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){F.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,i,n){this.setProperty(H[H.SpeechServiceConnection_ProxyHostName],e),this.setProperty(H[H.SpeechServiceConnection_ProxyPort],t),this.setProperty(H[H.SpeechServiceConnection_ProxyUserName],i),this.setProperty(H[H.SpeechServiceConnection_ProxyPassword],n)}setServiceProperty(e,t){const i=JSON.parse(this.privProperties.getProperty(N,"{}"));i[e]=t,this.privProperties.setProperty(N,JSON.stringify(i))}setProfanity(e){this.privProperties.setProperty(H.SpeechServiceResponse_ProfanityOption,j[e])}enableAudioLogging(){this.privProperties.setProperty(H.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(H.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty(U,"true")}clone(){const e=new Y;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(H.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(H.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(H.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(H.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return q[this.privProperties.getProperty(H.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(H.SpeechServiceConnection_SynthOutputFormat,q[e])}}class ${constructor(e,t){this.privActualSampleRate=e,this.privDesiredSampleRate=t}encode(e){const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const i=2*t.length,n=new ArrayBuffer(i),r=new DataView(n);return this.floatTo16BitPCM(r,0,t),n}setString(e,t,i){for(let n=0;n<i.length;n++)e.setUint8(t+n,i.charCodeAt(n))}floatTo16BitPCM(e,t,i){for(let n=0;n<i.length;n++,t+=2){const r=Math.max(-1,Math.min(1,i[n]));e.setInt16(t,r<0?32768*r:32767*r,!0)}}downSampleAudioFrame(e,t,i){if(!e)return null;if(i===t||i>t)return e;const n=t/i,r=Math.round(e.length/n),s=new Float32Array(r);let o=0,a=0;for(;a<r;){const t=Math.round((a+1)*n);let i=0,r=0;for(;o<t&&o<e.length;)i+=e[o++],r++;s[a++]=i/r}return s}}class ee{constructor(e){this.privStopInputOnRelease=e}record(e,t,i){const n=new $(e.sampleRate,16e3),r=e.createMediaStreamSource(t),s=()=>{const s=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(i){t=2048;let n=e.sampleRate;for(;t<16384&&n>=32e3;)t<<=1,n>>=1;return e.createScriptProcessor(t,1,1)}})();s.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(i&&!i.isClosed){const e=n.encode(t);e&&i.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},r.connect(s),s.connect(e.destination),this.privMediaResources={scriptProcessorNode:s,source:r,stream:t}};if(e.audioWorklet){if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const s=new AudioWorkletNode(e,"speech-processor");s.port.onmessage=e=>{const t=e.data;if(i&&!i.isClosed){const e=n.encode(t);e&&i.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},r.connect(s),s.connect(e.destination),this.privMediaResources={scriptProcessorNode:s,source:r,stream:t}})).catch((()=>{s()}))}else try{s()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}}releaseMediaResources(e){this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))}setWorkletUrl(e){this.privSpeechProcessorScript=e}}!function(e){e[e.Interactive=0]="Interactive",e[e.Conversation=1]="Conversation",e[e.Dictation=2]="Dictation"}(V||(V={})),function(e){e[e.Simple=0]="Simple",e[e.Detailed=1]="Detailed"}(W||(W={}));class te{constructor(e,t){this.privSpeechServiceConfig=e||new ie(new ne(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10),this.privLanguageIdMode=t.getProperty(H.SpeechServiceConnection_LanguageIdMode,void 0)}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===V.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=V[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==V.Interactive}get languageIdMode(){return this.privLanguageIdMode}get autoDetectSourceLanguages(){return this.parameters.getProperty(H.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get recognitionEndpointVersion(){return this.parameters.getProperty(H.SpeechServiceConnection_RecognitionEndpointVersion,void 0)}get sourceLanguageModels(){const e=[];let t=!1;if(void 0!==this.autoDetectSourceLanguages)for(const i of this.autoDetectSourceLanguages.split(",")){const n=i+H.SpeechServiceConnection_EndpointId.toString(),r=this.parameters.getProperty(n,void 0);void 0!==r?(e.push({language:i,endpoint:r}),t=!0):e.push({language:i,endpoint:""})}return t?e:void 0}get maxRetryCount(){return this.privMaxRetryCount}}class ie{constructor(e){this.context=e}serialize(){return JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const i in t)Object.hasOwnProperty.call(t,i)&&(e[i&&i.charAt(0).toLowerCase()+i.substring(1)]=t[i]);return e}return t}))}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class ne{constructor(e){this.system=new re,this.os=e}}class re{constructor(){this.name="SpeechSDK",this.version="1.27.0",this.build="JavaScript",this.lang="JavaScript"}}class se{constructor(e,t,i){this.platform=e,this.name=t,this.version=i}}!function(e){e.Bluetooth="Bluetooth",e.Wired="Wired",e.WiFi="WiFi",e.Cellular="Cellular",e.InBuilt="InBuilt",e.Unknown="Unknown"}(X||(X={})),function(e){e.Phone="Phone",e.Speaker="Speaker",e.Car="Car",e.Headset="Headset",e.Thermostat="Thermostat",e.Microphones="Microphones",e.Deskphone="Deskphone",e.RemoteControl="RemoteControl",e.Unknown="Unknown",e.File="File",e.Stream="Stream"}(J||(J={}));const oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ae;const ce=new Uint8Array(16);function ue(){if(!ae&&(ae="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(ce)}const pe=[];for(let e=0;e<256;++e)pe.push((e+256).toString(16).slice(1));const de=function(e,t,i){if(oe.randomUUID&&!t&&!e)return oe.randomUUID();const n=(e=e||{}).random||(e.rng||ue)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return(pe[e[t+0]]+pe[e[t+1]]+pe[e[t+2]]+pe[e[t+3]]+"-"+pe[e[t+4]]+pe[e[t+5]]+"-"+pe[e[t+6]]+pe[e[t+7]]+"-"+pe[e[t+8]]+pe[e[t+9]]+"-"+pe[e[t+10]]+pe[e[t+11]]+pe[e[t+12]]+pe[e[t+13]]+pe[e[t+14]]+pe[e[t+15]]).toLowerCase()}(n)},he=()=>de().replace(new RegExp("-","g"),"").toUpperCase();class le extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class ve extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class fe extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}class ge{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=e}onEvent(e){if(this.isDisposed())throw new fe("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)}attach(e){const t=he();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}}attachListener(e){return this.attach((t=>e.onEvent(t)))}attachConsoleListener(e){return this.privConsoleListener&&this.privConsoleListener.detach(),this.privConsoleListener=this.attach((t=>e.onEvent(t))),this.privConsoleListener}isDisposed(){return this.privIsDisposed}dispose(){this.privEventListeners=null,this.privIsDisposed=!0}get metadata(){return this.privMetadata}}var me,Se,ye;!function(e){e[e.None=0]="None",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(me||(me={}));class Ae{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function be(e,t,i){e.then((e=>{try{t&&t(e)}catch(e){if(i)try{if(e instanceof Error){const t=e;i(t.name+": "+t.message)}else i(e)}catch(e){}}}),(e=>{if(i)try{if(e instanceof Error){const t=e;i(t.name+": "+t.message)}else i(e)}catch(e){}}))}(ye=Se||(Se={}))[ye.Debug=0]="Debug",ye[ye.Info=1]="Info",ye[ye.Warning=2]="Warning",ye[ye.Error=3]="Error",ye[ye.None=4]="None";class Ce{constructor(e,t){this.privName=e,this.privEventId=he(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,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}}class Ie extends Ce{constructor(e,t,i=Se.Info){super(e,i),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class we extends Ie{constructor(e){super("AudioSourceInitializingEvent",e)}}class Re extends Ie{constructor(e){super("AudioSourceReadyEvent",e)}}class _e extends Ie{constructor(e){super("AudioSourceOffEvent",e)}}class Te extends Ie{constructor(e,t){super("AudioSourceErrorEvent",e,Se.Error),this.privError=t}get error(){return this.privError}}class Ee extends Ie{constructor(e,t,i){super(e,t),this.privAudioNodeId=i}get audioNodeId(){return this.privAudioNodeId}}class Pe extends Ee{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class ke extends Ee{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class De extends Ee{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class Me extends Ee{constructor(e,t,i){super("AudioStreamNodeErrorEvent",e,t),this.privError=i}get error(){return this.privError}}class Oe{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.privList=[],e)for(const t of e)this.privList.push(t)}get(e){return this.throwIfDisposed(),this.privList[e]}first(){return this.get(0)}last(){return this.get(this.length()-1)}add(e){this.throwIfDisposed(),this.insertAt(this.privList.length,e)}insertAt(e,t){this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)}removeFirst(){return this.throwIfDisposed(),this.removeAt(0)}removeLast(){return this.throwIfDisposed(),this.removeAt(this.length()-1)}removeAt(e){return this.throwIfDisposed(),this.remove(e,1)[0]}remove(e,t){this.throwIfDisposed();const i=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),i}clear(){this.throwIfDisposed(),this.remove(0,this.length())}length(){return this.throwIfDisposed(),this.privList.length}onAdded(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}}onRemoved(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}}onDisposed(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}}join(e){return this.throwIfDisposed(),this.privList.join(e)}toArray(){const e=Array();return this.privList.forEach((t=>{e.push(t)})),e}any(e){return this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0}all(e){return this.throwIfDisposed(),this.where(e).length()===this.length()}forEach(e){this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)}select(e){this.throwIfDisposed();const t=[];for(let i=0;i<this.privList.length;i++)t.push(e(this.privList[i],i));return new Oe(t)}where(e){this.throwIfDisposed();const t=new Oe;for(let i=0;i<this.privList.length;i++)e(this.privList[i],i)&&t.add(this.privList[i]);return t}orderBy(e){this.throwIfDisposed();const t=this.toArray().sort(e);return new Oe(t)}orderByDesc(e){return this.throwIfDisposed(),this.orderBy(((t,i)=>e(i,t)))}clone(){return this.throwIfDisposed(),new Oe(this.toArray())}concat(e){return this.throwIfDisposed(),new Oe(this.privList.concat(e.toArray()))}concatArray(e){return this.throwIfDisposed(),new Oe(this.privList.concat(e))}isDisposed(){return null==this.privList}dispose(e){this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))}throwIfDisposed(){if(this.isDisposed())throw new fe("List",this.privDisposeReason)}triggerSubscriptions(e){if(e)for(const t in e)t&&e[t]()}}var Le,xe=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};!function(e){e[e.Dequeue=0]="Dequeue",e[e.Peek=1]="Peek"}(Le||(Le={}));class Ge{constructor(e){this.privPromiseStore=new Oe,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=e||new Oe,this.privDetachables=[],this.privSubscribers=new Oe,this.privDetachables.push(this.privList.onAdded((()=>this.drain())))}enqueue(e){this.throwIfDispose(),this.enqueueFromPromise(new Promise((t=>t(e))))}enqueueFromPromise(e){this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(()=>{}))}dequeue(){this.throwIfDispose();const e=new Ae;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Le.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new Ae;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Le.Peek}),this.drain()),e.promise}length(){return this.throwIfDispose(),this.privList.length()}isDisposed(){return null==this.privSubscribers}drainAndDispose(e,t){return xe(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const i=this.privSubscribers;if(i){for(;i.length()>0;)i.removeFirst().deferral.resolve(void 0);this.privSubscribers===i&&(this.privSubscribers=i)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach((t=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return xe(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}drain(){if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const i=e.removeFirst();if(i.type===Le.Peek)i.deferral.resolve(t.first());else{const e=t.removeFirst();i.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}}throwIfDispose(){if(this.isDisposed()){if(this.privDisposeReason)throw new ve(this.privDisposeReason);throw new fe("Queue")}if(this.privIsDisposing)throw new ve("Queue disposing")}}var ze;class Be{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||he(),this.privReaderQueue=new Ge}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}read(){if(this.privIsReadEnded)throw new ve("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>{return t=this,i=void 0,r=function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new Ge)}throwIfClosed(){if(this.privIsWriteEnded)throw new ve("Stream closed")}}class Ne extends Be{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const i=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),n=new Uint8Array(this.privNextBufferToWrite),r=new Uint8Array(e.buffer.slice(t,i+t));n.set(r,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=i,t+=i,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class Ue{static setEventSource(e){if(!e)throw new le("eventSource");Ue.privInstance=e}static get instance(){return Ue.privInstance}}Ue.privInstance=new ge,function(e){e[e.PCM=1]="PCM",e[e.MuLaw=2]="MuLaw",e[e.Siren=3]="Siren",e[e.MP3=4]="MP3",e[e.SILKSkype=5]="SILKSkype",e[e.OGG_OPUS=6]="OGG_OPUS",e[e.WEBM_OPUS=7]="WEBM_OPUS",e[e.ALaw=8]="ALaw",e[e.FLAC=9]="FLAC",e[e.OPUS=10]="OPUS"}(ze||(ze={}));class Fe{static getDefaultInputFormat(){return He.getDefaultInputFormat()}static getWaveFormat(e,t,i,n){return new He(e,t,i,n)}static getWaveFormatPCM(e,t,i){return new He(e,t,i)}}class He extends Fe{constructor(e=16e3,t=16,i=1,n=ze.PCM){super();let r=!0;switch(n){case ze.PCM:this.formatTag=1;break;case ze.ALaw:this.formatTag=6;break;case ze.MuLaw:this.formatTag=7;break;default:r=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=i,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),r){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new He}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}setString(e,t,i){for(let n=0;n<i.length;n++)e.setUint8(t+n,i.charCodeAt(n))}}var Ke=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class je{constructor(e,t,i,n){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.privOutputChunkSize=je.AUDIOFORMAT.avgBytesPerSec/10,this.privId=i||he(),this.privEvents=new ge,this.privMediaStream=n||null,this.privIsClosing=!1}get format(){return Promise.resolve(je.AUDIOFORMAT)}turnOn(){if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new Ae;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,i,n)=>{e.mediaDevices.getUserMedia(t).then(i).catch(n)}),t){const e=()=>{this.onEvent(new we(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Re(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Re(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Te(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new Te(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new Pe(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new ke(this.privId,e)),{detach:()=>Ke(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new De(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new De(this.privId,e)))}turnOff(){return Ke(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new _e(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:je.AUDIOFORMAT.bitsPerSample,channelcount:je.AUDIOFORMAT.channels,connectivity:X.Unknown,manufacturer:"Speech SDK",model:e,samplerate:je.AUDIOFORMAT.samplesPerSec,type:J.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const i=new Ae;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const i of e)if(i.deviceId===t){this.privMicrophoneLabel=i.label;break}i.resolve(this.privMicrophoneLabel)}),(()=>i.resolve(this.privMicrophoneLabel))),i.promise}listen(e){return Ke(this,void 0,void 0,(function*(){yield this.turnOn();const t=new Ne(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new Me(this.privId,e,t)),t}return t}))}onEvent(e){this.privEvents.onEvent(e),Ue.instance.onEvent(e)}createAudioContext(){this.privContext||(this.privContext=He.getAudioContext(je.AUDIOFORMAT.samplesPerSec))}destroyAudioContext(){return Ke(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}je.AUDIOFORMAT=Fe.getDefaultInputFormat();var qe=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Ve{constructor(e,t,i){this.privStreams={},this.privHeaderEnd=44,this.privId=i||he(),this.privEvents=new ge,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}turnOn(){if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new Te(e,"")),Promise.reject(e)}this.onEvent(new we(this.privId)),this.onEvent(new Re(this.privId))}id(){return this.privId}attach(e){return qe(this,void 0,void 0,(function*(){this.onEvent(new Pe(this.privId,e));const t=yield this.upload(e);return this.onEvent(new ke(this.privId,e)),Promise.resolve({detach:()=>qe(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new De(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})}))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new De(this.privId,e)))}turnOff(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new _e(this.privId)),Promise.resolve()}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:X.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:J.File})))}readHeader(){const e=this.privSource.slice(0,4296),t=new Ae,i=e=>{const i=new DataView(e),n=e=>String.fromCharCode(i.getUint8(e),i.getUint8(e+1),i.getUint8(e+2),i.getUint8(e+3));if("RIFF"!==n(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==n(8)||"fmt "!==n(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const r=i.getInt32(16,!0),s=i.getUint16(22,!0),o=i.getUint32(24,!0),a=i.getUint16(34,!0);let c=36+Math.max(r-16,0);for(;"data"!==n(c);c+=2)if(c>4288)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=c+8,t.resolve(Fe.getWaveFormatPCM(o,a,s))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;i(t)},t.readAsArrayBuffer(e)}else{const t=e;i(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return qe(this,void 0,void 0,(function*(){const t=t=>{const i=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new Me(this.privId,e,i)),new Error(i)};try{yield this.turnOn();const i=yield this.privAudioFormatPromise,n=new Ne(i.avgBytesPerSec/10,e);this.privStreams[e]=n;const r=this.privSource.slice(this.privHeaderEnd),s=e=>{n.isClosed||(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),n.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&r instanceof Blob){const e=new FileReader;e.onerror=e=>t(e.toString()),e.onload=e=>{const t=e.target.result;s(t)},e.readAsArrayBuffer(r)}else{const e=r;s(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return n}catch(e){t(e)}}))}onEvent(e){this.privEvents.onEvent(e),Ue.instance.onEvent(e)}}var We,Xe,Je,Qe,Ze,Ye=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class $e{constructor(){}static createPushStream(e){return et.create(e)}static createPullStream(e,t){return it.create(e,t)}}class et extends $e{static create(e){return new tt(e)}}class tt extends et{constructor(e){super(),this.privFormat=void 0===e?He.getDefaultInputFormat():e,this.privEvents=new ge,this.privId=he(),this.privStream=new Ne(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}turnOn(){this.onEvent(new we(this.privId)),this.onEvent(new Re(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){this.onEvent(new Pe(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new ke(this.privId,e)),{detach:()=>Ye(this,void 0,void 0,(function*(){return this.onEvent(new De(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new De(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:X.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:J.Stream})}onEvent(e){this.privEvents.onEvent(e),Ue.instance.onEvent(e)}toBuffer(e){const t=Buffer.alloc(e.byteLength),i=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=i[e];return t}}class it extends $e{constructor(){super()}static create(e,t){return new nt(e,t)}}class nt extends it{constructor(e,t){super(),this.privFormat=void 0===t?Fe.getDefaultInputFormat():t,this.privEvents=new ge,this.privId=he(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}turnOn(){this.onEvent(new we(this.privId)),this.onEvent(new Re(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){return this.onEvent(new Pe(this.privId,e)),yield this.turnOn(),this.onEvent(new ke(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new De(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const i=new ArrayBuffer(this.privBufferSize-t),n=this.privCallback.read(i);if(void 0===e?e=i:new Int8Array(e).set(new Int8Array(i),t),0===n)break;t+=n}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new De(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:X.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:J.Stream})}onEvent(e){this.privEvents.onEvent(e),Ue.instance.onEvent(e)}}!function(e){e[e.Text=0]="Text",e[e.Binary=1]="Binary"}(We||(We={}));class rt{constructor(e,t,i,n){if(this.privBody=null,e===We.Text&&t&&"string"!=typeof t)throw new ve("Payload must be a string");if(e===We.Binary&&t&&!(t instanceof ArrayBuffer))throw new ve("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=i||{},this.privId=n||he(),this.messageType){case We.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case We.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===We.Binary)throw new ve("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===We.Text)throw new ve("Not supported for text message");return this.privBody}get id(){return this.privId}}class st extends Ce{constructor(e,t,i=Se.Info){super(e,i),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class ot extends Ce{constructor(e,t,i=Se.Info){super(e,i),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class at extends ot{constructor(e,t,i){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=i}get uri(){return this.privUri}get headers(){return this.privHeaders}}class ct extends ot{constructor(e){super("ConnectionEstablishedEvent",e)}}class ut extends ot{constructor(e,t,i){super("ConnectionClosedEvent",e,Se.Debug),this.privReason=i,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class pt extends ot{constructor(e,t,i){super("ConnectionErrorEvent",e,Se.Debug),this.privMessage=t,this.privType=i}get message(){return this.privMessage}get type(){return this.privType}}class dt extends ot{constructor(e,t,i){super("ConnectionEstablishErrorEvent",e,Se.Error),this.privStatusCode=t,this.privReason=i}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ht extends ot{constructor(e,t,i){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=i}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class lt extends ot{constructor(e,t,i){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=i}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}!function(e){e[e.None=0]="None",e[e.Connected=1]="Connected",e[e.Connecting=2]="Connecting",e[e.Disconnected=3]="Disconnected"}(Xe||(Xe={})),function(e){e[e.Error=0]="Error",e[e.EndOfStream=1]="EndOfStream"}(Je||(Je={})),function(e){e[e.NoError=0]="NoError",e[e.AuthenticationFailure=1]="AuthenticationFailure",e[e.BadRequestParameters=2]="BadRequestParameters",e[e.TooManyRequests=3]="TooManyRequests",e[e.ConnectionFailure=4]="ConnectionFailure",e[e.ServiceTimeout=5]="ServiceTimeout",e[e.ServiceError=6]="ServiceError",e[e.RuntimeError=7]="RuntimeError",e[e.Forbidden=8]="Forbidden"}(Qe||(Qe={}));class vt{constructor(e){this.privResult=e}get result(){return this.privResult}}class ft extends class{constructor(e,t,i,n){this.privResultId=e,this.privReason=t,this.privErrorDetails=i,this.privProperties=n}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}{constructor(e,t,i,n,r,s){super(e,t,n,r),this.privAudioData=i,this.privAudioDuration=s}get audioData(){return this.privAudioData}get audioDuration(){return this.privAudioDuration}}!function(e){e[e.NoMatch=0]="NoMatch",e[e.Canceled=1]="Canceled",e[e.RecognizingSpeech=2]="RecognizingSpeech",e[e.RecognizedSpeech=3]="RecognizedSpeech",e[e.RecognizedKeyword=4]="RecognizedKeyword",e[e.RecognizingIntent=5]="RecognizingIntent",e[e.RecognizedIntent=6]="RecognizedIntent",e[e.TranslatingSpeech=7]="TranslatingSpeech",e[e.TranslatedSpeech=8]="TranslatedSpeech",e[e.SynthesizingAudio=9]="SynthesizingAudio",e[e.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",e[e.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",e[e.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",e[e.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",e[e.RecognizedSpeakers=14]="RecognizedSpeakers",e[e.RecognizedSpeaker=15]="RecognizedSpeaker",e[e.ResetVoiceProfile=16]="ResetVoiceProfile",e[e.DeletedVoiceProfile=17]="DeletedVoiceProfile",e[e.VoicesListRetrieved=18]="VoicesListRetrieved"}(Ze||(Ze={}));class gt{constructor(e,t,i,n,r,s){this.privAudioOffset=e,this.privDuration=t,this.privText=i,this.privWordLength=n,this.privTextOffset=r,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}}class mt{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class St{constructor(e,t,i){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=i}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}class yt extends He{constructor(e,t,i,n,r,s,o,a,c){super(i,s,t,e),this.formatTag=e,this.avgBytesPerSec=n,this.blockAlign=r,this.priAudioFormatString=o,this.priRequestAudioFormatString=a,this.priHasHeader=c}static fromSpeechSynthesisOutputFormat(e){return void 0===e?yt.getDefaultOutputFormat():yt.fromSpeechSynthesisOutputFormatString(yt.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new yt(ze.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new yt(ze.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new yt(ze.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new yt(ze.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new yt(ze.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new yt(ze.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new yt(ze.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new yt(ze.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new yt(ze.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new yt(ze.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new yt(ze.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new yt(ze.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new yt(ze.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new yt(ze.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new yt(ze.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new yt(ze.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new yt(ze.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new yt(ze.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new yt(ze.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new yt(ze.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new yt(ze.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new yt(ze.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new yt(ze.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new yt(ze.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new yt(ze.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new yt(ze.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new yt(ze.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new yt(ze.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new yt(ze.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new yt(ze.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new yt(ze.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new yt(ze.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new yt(ze.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new yt(ze.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new yt(ze.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new yt(ze.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new yt(ze.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new yt(ze.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new yt(ze.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return yt.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){const t=new DataView(this.privHeader);t.setUint32(4,e+this.privHeader.byteLength-8,!0),t.setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}yt.SpeechSynthesisOutputFormatToString={[q.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[q.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[q.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[q.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[q.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[q.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[q.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[q.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[q.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[q.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[q.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[q.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[q.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[q.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[q.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[q.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[q.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[q.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[q.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[q.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[q.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[q.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[q.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[q.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[q.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[q.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[q.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[q.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[q.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[q.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[q.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[q.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[q.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus",[q.Raw22050Hz16BitMonoPcm]:"raw-22050hz-16bit-mono-pcm",[q.Riff22050Hz16BitMonoPcm]:"riff-22050hz-16bit-mono-pcm",[q.Raw44100Hz16BitMonoPcm]:"raw-44100hz-16bit-mono-pcm",[q.Riff44100Hz16BitMonoPcm]:"riff-44100hz-16bit-mono-pcm"};var At;class bt{constructor(){}static createPullStream(){return Ct.create()}}class Ct extends bt{static create(){return new It}}class It extends Ct{constructor(){super(),this.privId=he(),this.privStream=new Be}set format(e){null==e&&(this.privFormat=yt.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return t=this,i=void 0,r=function*(){const t=new Int8Array(e);let i=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),i=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;i<e.byteLength&&!this.privStream.isReadEnded;){const n=yield this.privStream.read();if(void 0===n||n.isEnd)this.privStream.readEnded();else{let r;n.buffer.byteLength>e.byteLength-i?(r=n.buffer.slice(0,e.byteLength-i),this.privLastChunkView=new Int8Array(n.buffer.slice(e.byteLength-i))):r=n.buffer,t.set(new Int8Array(r),i),i+=r.byteLength}}return i},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}write(e){F.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class wt extends bt{constructor(){super()}static create(e){return new Rt(e)}}class Rt extends wt{constructor(e){super(),this.privId=he(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}!function(e){e.WordBoundary="WordBoundary",e.Bookmark="Bookmark",e.Viseme="Viseme",e.SentenceBoundary="SentenceBoundary",e.SessionEnd="SessionEnd"}(At||(At={}));class _t{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new _t(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}class Tt extends Ce{constructor(e,t,i=Se.Info){super(e,i),this.privRequestId=t}get requestId(){return this.privRequestId}}class Et extends Tt{constructor(e,t,i){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=i}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Pt extends Tt{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class kt extends Tt{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var Dt=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Mt{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=he(),this.privTurnDeferral=new Ae,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}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}getAllReceivedAudio(){return Dt(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return Dt(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Bt.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,i,n){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=i,this.privAudioOutputStream=new It,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="",void 0!==n&&(this.privTurnAudioDestination=n,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new Et(this.requestId,void 0,void 0===n?void 0:n.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Pt(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new kt(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()}onServiceResponseMessage(e){const t=JSON.parse(e);this.streamId=t.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}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 Ae}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onTextBoundaryEvent(e){this.updateTextOffset(e.Data.text.Text,e.Type)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onSessionEnd(e){this.privAudioDuration=e.Data.Offset}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}onEvent(e){Ue.instance.onEvent(e)}static isXmlTag(e){return e.length>=2&&"<"===e[0]&&">"===e[e.length-1]}updateTextOffset(e,t){t===At.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!Mt.isXmlTag(e)&&this.updateTextOffset(e,t))):(this.privSentenceOffset=this.privRawText.indexOf(e,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!Mt.isXmlTag(e)&&this.updateTextOffset(e,t)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}readAllAudioFromStream(){return Dt(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}withinXmlTag(e){return this.privRawText.indexOf("<",e+1)>this.privRawText.indexOf(">",e+1)}}class Ot{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,punctuationBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(H.SpeechServiceResponse_RequestPunctuationBoundary,!!this.privSpeechSynthesizer.wordBoundary),sentenceBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(H.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(H.SpeechServiceResponse_RequestWordBoundary,!!this.privSpeechSynthesizer.wordBoundary)},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}class Lt{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}class xt{}xt.AuthKey="Ocp-Apim-Subscription-Key",xt.Authorization="Authorization",xt.SpIDAuthKey="Apim-Subscription-Id",xt.ConnectionId="X-ConnectionId",xt.ContentType="Content-Type",xt.CustomCommandsAppId="X-CommandsAppId",xt.Path="Path",xt.RequestId="X-RequestId",xt.RequestStreamId="X-StreamId",xt.RequestTimestamp="X-Timestamp";class Gt extends rt{constructor(e,t,i,n,r,s,o,a){if(!t)throw new le("path");if(!i)throw new le("requestId");const c={};if(c[xt.Path]=t,c[xt.RequestId]=i,c[xt.RequestTimestamp]=(new Date).toISOString(),n&&(c[xt.ContentType]=n),s&&(c[xt.RequestStreamId]=s),o)for(const e in o)e&&(c[e]=o[e]);a?super(e,r,c,a):super(e,r,c),this.privPath=t,this.privRequestId=i,this.privContentType=n,this.privStreamId=s,this.privAdditionalHeaders=o}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(e){let t=null,i=null,n=null,r=null;const s={};if(e.headers)for(const o in e.headers)o&&(o.toLowerCase()===xt.Path.toLowerCase()?t=e.headers[o]:o.toLowerCase()===xt.RequestId.toLowerCase()?i=e.headers[o]:o.toLowerCase()===xt.ContentType.toLowerCase()?n=e.headers[o]:o.toLowerCase()===xt.RequestStreamId.toLowerCase()?r=e.headers[o]:s[o]=e.headers[o]);return new Gt(e.messageType,t,i,n,e.body,r,s,e.id)}}var zt=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Bt{constructor(e,t,i,n,r){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!e)throw new le("authentication");if(!t)throw new le("connectionFactory");if(!i)throw new le("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=i,this.privIsDisposed=!1,this.privSpeechSynthesizer=n,this.privSessionAudioDestination=r,this.privSynthesisTurn=new Mt,this.privConnectionEvents=new ge,this.privServiceEvents=new ge,this.privSynthesisContext=new Ot(this.privSpeechSynthesizer),this.privAgentConfig=new Lt,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(Je.Error,1007===t.statusCode?Qe.BadRequestParameters:Qe.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const i=new Uint8Array(e.byteLength+t.header.byteLength);return i.set(new Uint8Array(t.header),0),i.set(new Uint8Array(e),t.header.byteLength),i.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return zt(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),void 0!==this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return zt(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return zt(this,void 0,void 0,(function*(){const i="string"==typeof t?We.Text:We.Binary,n="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new Gt(i,e,this.privSynthesisTurn.requestId,n,t))}))}Speak(e,t,i,n,r,s){return zt(this,void 0,void 0,(function*(){let o;if(o=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(o,i,n,r);this.privSuccessCallback=n,this.privErrorCallback=r,this.privSynthesisTurn.startNewSynthesis(i,e,t,s);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,o,i);const t=new vt(new ft(i,Ze.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(Je.Error,Qe.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,i,n){const r=new Q;r.setProperty(B,Qe[i]);const s=new ft(e,Ze.Canceled,void 0,n,r);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new vt(s);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(s)}catch(e){}}cancelSynthesisLocal(e,t,i){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,i))}processTypeSpecificMessages(e){return!0}receiveMessage(){return zt(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const i=Gt.fromConnectionMessage(t);if(i.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(i.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(i.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===i.streamId.toLowerCase()&&i.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(i.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Bt.addHeader(i.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new vt(new ft(this.privSynthesisTurn.requestId,Ze.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(i.binaryBody)}break;case"audio.metadata":const e=_t.fromJSON(i.textBody).Metadata;for(const t of e)switch(t.Type){case At.WordBoundary:case At.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(t);const e=new gt(t.Data.Offset,t.Data.Duration,t.Data.text.Text,t.Data.text.Length,t.Type===At.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,t.Data.text.BoundaryType);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case At.Bookmark:const i=new mt(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch(e){}break;case At.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new St(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case At.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new ft(this.privSynthesisTurn.requestId,Ze.SynthesizingAudioCompleted,e,void 0,void 0,this.privSynthesisTurn.audioDuration),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new vt(t))}catch(e){}break;default:this.processTypeSpecificMessages(i)||this.privServiceEvents&&this.serviceEvents.onEvent(new st(i.path.toLowerCase(),i.textBody))}return this.receiveMessage()}catch(e){}}))}sendSynthesisContext(e){const t=this.synthesisContext.toJSON();if(t)return e.send(new Gt(We.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))}connectImpl(e=!1){if(null!=this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===Xe.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl())));this.privAuthFetchEventId=he(),this.privConnectionId=he(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>zt(this,void 0,void 0,(function*(){this.privSynthesisTurn.onAuthCompleted(!1);const i=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);i.events.attach((e=>{this.connectionEvents.onEvent(e)}));const n=yield i.open();return 200===n.statusCode?(this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode),Promise.resolve(i)):403!==n.statusCode||e?(this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${n.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(H.SpeechServiceConnection_Endpoint)} Reason: ${n.reason}`)):this.connectImpl(!0)}))),(e=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(e)})),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}sendSpeechServiceConfig(e,t){if(t)return e.send(new Gt(We.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,i){return e.send(new Gt(We.Text,"ssml",i,"application/ssml+xml",t))}fetchConnection(){return zt(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Xe.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(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return zt(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Bt.telemetryDataEnabled=!0;class Nt extends Ce{constructor(e){super("BackgroundEvent",Se.Error),this.privError=e}get error(){return this.privError}}var Ut=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const Ft={[ze.PCM]:"audio/wav",[ze.MuLaw]:"audio/x-wav",[ze.MP3]:"audio/mpeg",[ze.OGG_OPUS]:"audio/ogg",[ze.WEBM_OPUS]:"audio/webm; codecs=opus",[ze.ALaw]:"audio/x-wav",[ze.FLAC]:"audio/flac"};class Ht{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||he(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,i){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{i&&i(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream&&"undefined"!=typeof window)if(this.privFormat.formatTag!==ze.PCM&&this.privFormat.formatTag!==ze.MuLaw&&this.privFormat.formatTag!==ze.ALaw||!1!==this.privFormat.hasHeader){let i=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(i).then((()=>{i=Bt.addHeader(i,this.privFormat);const n=new Blob([i],{type:Ft[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(n),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||"undefined"!=typeof window&&void 0!==window.webkitAudioContext){this.privFormat=e;const t=Ft[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${ze[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(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=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=()=>{this.updateSourceBuffer().catch((e=>{Ue.instance.onEvent(new Nt(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{Ue.instance.onEvent(new Nt(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{Ue.instance.onEvent(new Nt(e))}))):(console.warn(`Format ${ze[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new It,this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){var e,t;return null!==(t=null===(e=this.privAudio)||void 0===e?void 0:e.volume)&&void 0!==t?t:-1}set volume(e){this.privAudio&&(this.privAudio.volume=e)}mute(){this.privAudio&&(this.privAudio.muted=!0)}unmute(){this.privAudio&&(this.privAudio.muted=!1)}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return Ut(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return Ut(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return Ut(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}var Kt=i(592);class jt{constructor(e){F.throwIfNullOrUndefined(Kt.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=Kt.openSync(e,"w")}set format(e){F.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=Kt.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){F.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),Kt.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),Kt.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}id(){return this.privId}}class qt{static fromDefaultMicrophoneInput(){const e=new ee(!0);return new Vt(new je(e))}static fromMicrophoneInput(e){const t=new ee(!0);return new Vt(new je(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new Vt(new Ve(e,t))}static fromStreamInput(e){if(e instanceof class{})return new Vt(new nt(e));if(e instanceof $e)return new Vt(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new ee(!1);return new Vt(new je(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new Wt(new Ht)}static fromSpeakerOutput(e){if(void 0===e)return qt.fromDefaultSpeakerOutput();if(e instanceof Ht)return new Wt(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new Wt(new jt(e))}static fromStreamOutput(e){if(e instanceof class{})return new Wt(new Rt(e));if(e instanceof wt)return new Wt(e);if(e instanceof Ct)return new Wt(e);throw new Error("Not Supported Type")}}class Vt extends qt{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(F.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class Wt extends qt{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}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.")}}var Xt=i(137),Jt=i.n(Xt);class Qt{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class Zt{constructor(e,t,i){if(this.privPayload=null,!t)throw new le("payload");if(e===We.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new ve("Payload must be ArrayBuffer");if(e===We.Text&&"string"!=typeof t)throw new ve("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=i||he()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===We.Binary)throw new ve("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===We.Text)throw new ve("Not supported for text message");return this.privPayload}get id(){return this.privId}}var Yt=i(173),$t=i(339);class ei extends Ce{constructor(e,t,i){super(e,t),this.privSignature=i}}class ti extends ei{constructor(e){super("OCSPMemoryCacheHitEvent",Se.Debug,e)}}class ii extends ei{constructor(e){super("OCSPCacheMissEvent",Se.Debug,e)}}class ni extends ei{constructor(e){super("OCSPDiskCacheHitEvent",Se.Debug,e)}}class ri extends ei{constructor(e){super("OCSPCacheUpdateNeededEvent",Se.Debug,e)}}class si extends ei{constructor(e){super("OCSPMemoryCacheStoreEvent",Se.Debug,e)}}class oi extends ei{constructor(e){super("OCSPDiskCacheStoreEvent",Se.Debug,e)}}class ai extends ei{constructor(e){super("OCSPCacheUpdateCompleteEvent",Se.Debug,e)}}class ci extends ei{constructor(){super("OCSPStapleReceivedEvent",Se.Debug,"")}}class ui extends ei{constructor(e,t){super("OCSPCacheEntryExpiredEvent",Se.Debug,e),this.privExpireTime=t}}class pi extends ei{constructor(e,t,i){super("OCSPCacheEntryNeedsRefreshEvent",Se.Debug,e),this.privExpireTime=i,this.privStartTime=t}}class di extends ei{constructor(e,t,i){super("OCSPCacheHitEvent",Se.Debug,e),this.privExpireTime=i,this.privExpireTimeString=new Date(i).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class hi extends ei{constructor(e,t){super("OCSPVerificationFailedEvent",Se.Debug,e),this.privError=t}}class li extends ei{constructor(e,t){super("OCSPCacheFetchErrorEvent",Se.Debug,e),this.privError=t}}class vi extends ei{constructor(e){super("OCSPResponseRetrievedEvent",Se.Debug,e)}}class fi extends ei{constructor(e,t){super("OCSPCacheUpdateErrorEvent",Se.Debug,e),this.privError=t}}var gi=i(108),mi=i.n(gi),Si=i(275),yi=i.n(Si),Ai=i(505),bi=i.n(Ai),Ci=i(146),Ii=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class wi{constructor(e){e&&(this.privProxyInfo=e),wi.privDiskCache||(wi.privDiskCache=new(yi())("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:"undefined"!=typeof process&&{WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.103.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_home:"https://www.npmjs.org",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.PAUpEUMynl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"58927DB5-826E-49E5-A9EC-F76093D97E11",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.8.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.2.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.8.2 node/v20.19.5 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",SECURITYSESSIONID:"186a1",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.2.0"}.SPEECH_OCSP_CACHE_ROOT?{WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.103.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_home:"https://www.npmjs.org",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.PAUpEUMynl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"58927DB5-826E-49E5-A9EC-F76093D97E11",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.8.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.2.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.8.2 node/v20.19.5 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",SECURITYSESSIONID:"186a1",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.2.0"}.SPEECH_OCSP_CACHE_ROOT:void 0}))}static forceReinitDiskCache(){wi.privDiskCache=void 0,wi.privMemCache={}}GetAgent(e){const t=new(mi().Agent)(this.CreateConnection);return void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0&&(t.privProxyInfo=this.privProxyInfo),t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};return e.UserName?t.headers={"Proxy-Authentication":"Basic "+new Buffer(`${e.UserName}:${void 0===e.Password?"":e.Password}`).toString("base64")}:t.headers={},t.headers.requestOCSP="true",new(bi())(t)}static OCSPCheck(e,t){return Ii(this,void 0,void 0,(function*(){let i,n,r=!1;const s=yield e;s.cork();const o=s;return new Promise(((e,a)=>{s.on("OCSPResponse",(e=>{e&&(this.onEvent(new ci),n=e)})),s.on("error",(e=>{r||(r=!0,s.destroy(),a(e))})),o.on("secure",(()=>Ii(this,void 0,void 0,(function*(){const c=o.getPeerCertificate(!0);try{const o=yield this.GetIssuer(c);i=$t.request.generate(c.raw,o.raw);const a=i.id.toString("hex");if(!n){const e=yield wi.GetResponseFromCache(a,i,t);n=e}yield this.VerifyOCSPResponse(n,i,t),s.uncork(),r=!0,e(s)}catch(e){s.destroy(),r=!0,a(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,i)=>{new $t.Agent({}).fetchIssuer(e,null,((e,n)=>{e?i(e):t(n)}))}))}static GetResponseFromCache(e,t,i){return Ii(this,void 0,void 0,(function*(){let n=wi.privMemCache[e];if(n&&this.onEvent(new ti(e)),!n)try{const t=yield wi.privDiskCache.get(e);t.isCached&&(wi.onEvent(new ni(e)),wi.StoreMemoryCacheEntry(e,t.value),n=t.value)}catch(e){n=null}if(!n)return n;try{const r=$t.utils.parseResponse(n).value.tbsResponseData;if(r.responses.length<1)return void this.onEvent(new li(e,"Not enough data in cached response"));const s=r.responses[0].thisUpdate,o=r.responses[0].nextUpdate;if(o<Date.now()+this.testTimeOffset-6e4)this.onEvent(new ui(e,o)),n=null;else{const n=Math.min(864e5,(o-s)/2);o-(Date.now()+this.testTimeOffset)<n?(this.onEvent(new pi(e,s,o)),this.UpdateCache(t,i).catch((t=>{this.onEvent(new fi(e,t.toString()))}))):this.onEvent(new di(e,s,o))}}catch(t){this.onEvent(new li(e,t)),n=null}return n||this.onEvent(new ii(e)),n}))}static VerifyOCSPResponse(e,t,i){return Ii(this,void 0,void 0,(function*(){let n=e;return n||(n=yield wi.GetOCSPResponse(t,i)),new Promise(((r,s)=>{$t.verify({request:t,response:n},(o=>{o?(wi.onEvent(new hi(t.id.toString("hex"),o)),e?this.VerifyOCSPResponse(null,t,i).then((()=>{r()}),(e=>{s(e)})):s(o)):(e||wi.StoreCacheEntry(t.id.toString("hex"),n),r())}))}))}))}static UpdateCache(e,t){return Ii(this,void 0,void 0,(function*(){const i=e.id.toString("hex");this.onEvent(new ri(i));const n=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(i,n),this.onEvent(new ai(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new si(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new oi(e))}))}static GetOCSPResponse(e,t){let i={};if(t){const e=wi.GetProxyAgent(t);i.agent=e}return new Promise(((t,n)=>{$t.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((r,s)=>{if(r)return void n(r);const o=new URL(s);i=Object.assign(Object.assign({},i),{host:o.host,protocol:o.protocol,port:o.port,path:o.pathname,hostname:o.host}),$t.utils.getResponse(i,e.data,((i,r)=>{if(i)return void n(i);const s=e.certID;this.onEvent(new vi(s.toString("hex"))),t(r)}))}))}))}static onEvent(e){Ue.instance.onEvent(e)}CreateConnection(e,t){const i="undefined"!=typeof process&&"0"!=={WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.103.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_home:"https://www.npmjs.org",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.PAUpEUMynl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"58927DB5-826E-49E5-A9EC-F76093D97E11",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.8.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.2.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.8.2 node/v20.19.5 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",SECURITYSESSIONID:"186a1",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.2.0"}.NODE_TLS_REJECT_UNAUTHORIZED&&"0"!=={WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.103.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_home:"https://www.npmjs.org",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.PAUpEUMynl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"58927DB5-826E-49E5-A9EC-F76093D97E11",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.8.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.2.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.8.2 node/v20.19.5 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",SECURITYSESSIONID:"186a1",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.2.0"}.SPEECH_CONDUCT_OCSP_CHECK&&t.secureEndpoint;let n;if(t=Object.assign(Object.assign({},t),{requestOCSP:!wi.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const i=wi.GetProxyAgent(this.privProxyInfo);n=new Promise(((n,r)=>{i.callback(e,t,((e,t)=>{e?r(e):n(t)}))}))}else n=t.secureEndpoint?Promise.resolve(Yt.connect(t)):Promise.resolve(Ci.connect(t));return i?wi.OCSPCheck(n,this.privProxyInfo):n}}wi.testTimeOffset=0,wi.forceDisableOCSPStapling=!1,wi.privMemCache={};var Ri=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class _i{constructor(e,t,i,n,r,s){if(!e)throw new le("uri");if(!i)throw new le("messageFormatter");this.proxyInfo=n,this.privConnectionEvents=new ge,this.privConnectionId=t,this.privMessageFormatter=i,this.privConnectionState=Xe.None,this.privUri=e,this.privHeaders=r,this.privEnableCompression=s,this.privHeaders[xt.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}open(){if(this.privConnectionState===Xe.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new Ae,this.privCertificateValidatedDeferral=new Ae,this.privConnectionState=Xe.Connecting;try{if("undefined"==typeof WebSocket||_i.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new wi(this.proxyInfo);e.agent=t.GetAgent();let i=new URL(this.privUri).protocol;"wss:"===(null==i?void 0:i.toLocaleLowerCase())?i="https:":"ws:"===(null==i?void 0:i.toLocaleLowerCase())&&(i="http:"),e.agent.protocol=i,this.privWebsocketClient=new(Jt())(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new Ge,this.privDisconnectDeferral=new Ae,this.privSendMessageQueue=new Ge,this.processSendQueue().catch((e=>{Ue.instance.onEvent(new Nt(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new Qt(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new at(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=()=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=Xe.Connected,this.onEvent(new ct(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new Qt(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new pt(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===Xe.Connecting?(this.privConnectionState=Xe.Disconnected,this.privConnectionEstablishDeferral.resolve(new Qt(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Xe.Disconnected,this.privWebsocketClient=null,this.onEvent(new ut(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{Ue.instance.onEvent(new Nt(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===Xe.Connected){const i=new Ae;if(this.privReceivingMessageQueue.enqueueFromPromise(i.promise),e.data instanceof ArrayBuffer){const n=new Zt(We.Binary,e.data);this.privMessageFormatter.toConnectionMessage(n).then((e=>{this.onEvent(new ht(this.privConnectionId,t,e)),i.resolve(e)}),(e=>{i.reject(`Invalid binary message format. Error: ${e}`)}))}else{const n=new Zt(We.Text,e.data);this.privMessageFormatter.toConnectionMessage(n).then((e=>{this.onEvent(new ht(this.privConnectionId,t,e)),i.resolve(e)}),(e=>{i.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise}send(e){if(this.privConnectionState!==Xe.Connected)return Promise.reject(`Cannot send on connection that is in ${Xe[this.privConnectionState]} state`);const t=new Ae,i=new Ae;return this.privSendMessageQueue.enqueueFromPromise(i.promise),this.privMessageFormatter.fromConnectionMessage(e).then((n=>{i.resolve({Message:e,RawWebsocketMessage:n,sendStatusDeferral:t})}),(e=>{i.reject(`Error formatting the message. ${e}`)})),t.promise}read(){return this.privConnectionState!==Xe.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue()}close(e){return this.privWebsocketClient?(this.privConnectionState!==Xe.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve()}get events(){return this.privConnectionEvents}sendRawMessage(e){try{return e?(this.onEvent(new lt(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}}onClose(e,t){return Ri(this,void 0,void 0,(function*(){const i=`Connection closed. ${e}: ${t}`;this.privConnectionState=Xe.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((()=>{}),i),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(i)}),i)}))}processSendQueue(){return Ri(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}onEvent(e){this.privConnectionEvents.onEvent(e),Ue.instance.onEvent(e)}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}_i.forceNpmWebSocket=!1;var Ti;class Ei{constructor(e,t,i,n,r,s=!1,o){if(this.privIsDisposed=!1,!e)throw new le("uri");if(!n)throw new le("messageFormatter");this.privMessageFormatter=n;let a="",c=0;if(t)for(const i in t)if(i){a+=0===c&&-1===e.indexOf("?")?"?":"&",a+=encodeURIComponent(i);let n=t[i];n&&(n=encodeURIComponent(n),a+=`=${n}`),c++}if(i)for(const t in i)t&&(a+=0===c&&-1===e.indexOf("?")?"?":"&",a+=`${t}=${encodeURIComponent(i[t])}`,c++);this.privUri=e+a,this.privId=o||he(),this.privConnectionMessageAdapter=new _i(this.privUri,this.id,this.privMessageFormatter,r,i,s)}dispose(){return e=this,t=void 0,n=function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())},new((i=void 0)||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}));var e,t,i,n}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(e){return this.privConnectionMessageAdapter.send(e)}read(){return this.privConnectionMessageAdapter.read()}get events(){return this.privConnectionMessageAdapter.events}}class Pi{constructor(e,t,i,n){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=i,this.privProxyPassword=n}static fromParameters(e){return new Pi(e.getProperty(H.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(H.SpeechServiceConnection_ProxyPort),10),e.getProperty(H.SpeechServiceConnection_ProxyUserName),e.getProperty(H.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}class ki{}ki.BotId="botid",ki.CustomSpeechDeploymentId="cid",ki.CustomVoiceDeploymentId="deploymentId",ki.EnableAudioLogging="storeAudio",ki.EnableLanguageId="lidEnabled",ki.EnableWordLevelTimestamps="wordLevelTimestamps",ki.EndSilenceTimeoutMs="endSilenceTimeoutMs",ki.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",ki.Format="format",ki.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",ki.Language="language",ki.Profanity="profanity",ki.RequestBotStatusMessages="enableBotMessageStatus",ki.StableIntermediateThreshold="stableIntermediateThreshold",ki.StableTranslation="stableTranslation",ki.TestHooks="testhooks",ki.Postprocessing="postprocessing",ki.CtsMeetingId="meetingId",ki.CtsDeviceId="deviceId",ki.CtsIsParticipant="isParticipant";class Di{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,i){new Map([[H.Speech_SegmentationSilenceTimeoutMs,ki.SegmentationSilenceTimeoutMs],[H.SpeechServiceConnection_EnableAudioLogging,ki.EnableAudioLogging],[H.SpeechServiceConnection_EndSilenceTimeoutMs,ki.EndSilenceTimeoutMs],[H.SpeechServiceConnection_InitialSilenceTimeoutMs,ki.InitialSilenceTimeoutMs],[H.SpeechServiceResponse_PostProcessingOption,ki.Postprocessing],[H.SpeechServiceResponse_ProfanityOption,ki.Profanity],[H.SpeechServiceResponse_RequestWordLevelTimestamps,ki.EnableWordLevelTimestamps],[H.SpeechServiceResponse_StablePartialResultThreshold,ki.StableIntermediateThreshold]]).forEach(((n,r)=>{this.setUrlParameter(r,n,e,t,i)}));const n=JSON.parse(e.parameters.getProperty(N,"{}"));Object.keys(n).forEach((e=>{t[e]=n[e]}))}setUrlParameter(e,t,i,n,r){const s=i.parameters.getProperty(e,void 0);!s||r&&-1!==r.search(t)||(n[t]=s.toLocaleLowerCase())}}class Mi{toConnectionMessage(e){const t=new Ae;try{if(e.messageType===We.Text){const i=e.textContent;let n={},r=null;if(i){const e=i.split("\r\n\r\n");e&&e.length>0&&(n=this.parseHeaders(e[0]),e.length>1&&(r=e[1]))}t.resolve(new rt(e.messageType,r,n,e.id))}else if(e.messageType===We.Binary){const i=e.binaryContent;let n={},r=null;if(!i||i.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const s=new DataView(i),o=s.getInt16(0);if(i.byteLength<o+2)throw new Error("Invalid binary message format. Header content missing.");let a="";for(let e=0;e<o;e++)a+=String.fromCharCode(s.getInt8(e+2));n=this.parseHeaders(a),i.byteLength>o+2&&(r=i.slice(2+o)),t.resolve(new rt(e.messageType,r,n,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise}fromConnectionMessage(e){const t=new Ae;try{if(e.messageType===We.Text){const i=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new Zt(We.Text,i,e.id))}else if(e.messageType===We.Binary){const i=this.makeHeaders(e),n=e.binaryBody,r=this.stringToArrayBuffer(i),s=new Int8Array(r),o=s.byteLength,a=new Int8Array(2+o+(n?n.byteLength:0));if(a[0]=o>>8&255,a[1]=255&o,a.set(s,2),n){const e=new Int8Array(n);a.set(e,2+o)}const c=a.buffer;t.resolve(new Zt(We.Binary,c,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise}makeHeaders(e){let t="";if(e.headers)for(const i in e.headers)i&&(t+=`${i}: ${e.headers[i]}\r\n`);return t}parseHeaders(e){const t={};if(e){const i=e.match(/[^\r\n]+/g);if(t)for(const e of i)if(e){const i=e.indexOf(":"),n=i>0?e.substr(0,i).trim().toLowerCase():e,r=i>0&&e.length>i+1?e.substr(i+1).trim():"";t[n]=r}}return t}stringToArrayBuffer(e){const t=new ArrayBuffer(e.length),i=new DataView(t);for(let t=0;t<e.length;t++)i.setUint8(t,e.charCodeAt(t));return t}}class Oi extends Di{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.universalUri="/speech/universal/v"}create(e,t,i){let n=e.parameters.getProperty(H.SpeechServiceConnection_Endpoint,void 0);const r=e.parameters.getProperty(H.SpeechServiceConnection_Region,void 0),s=Di.getHostSuffix(r),o=e.parameters.getProperty(H.SpeechServiceConnection_Host,"wss://"+r+".stt.speech"+s),a={},c=e.parameters.getProperty(H.SpeechServiceConnection_EndpointId,void 0),u=e.parameters.getProperty(H.SpeechServiceConnection_RecoLanguage,void 0);if(c?n&&-1!==n.search(ki.CustomSpeechDeploymentId)||(a[ki.CustomSpeechDeploymentId]=c):u&&(n&&-1!==n.search(ki.Language)||(a[ki.Language]=u)),n&&-1!==n.search(ki.Format)||(a[ki.Format]=e.parameters.getProperty(z,K[K.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(a[ki.EnableLanguageId]="true"),this.setCommonUrlParams(e,a,n),!n)switch(e.recognitionMode){case V.Conversation:n="true"===e.parameters.getProperty(U,"false")?o+this.dictationRelativeUri:void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${o}${this.universalUri}${e.recognitionEndpointVersion}`:o+this.conversationRelativeUri;break;case V.Dictation:n=o+this.dictationRelativeUri;break;default:n=void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${o}${this.universalUri}${e.recognitionEndpointVersion}`:o+this.interactiveRelativeUri}const p={};void 0!==t.token&&""!==t.token&&(p[t.headerName]=t.token),p[xt.ConnectionId]=i;const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false"),h=new Ei(n,a,p,new Mi,Pi.fromRecognizerConfig(e),d,i),l=h.uri;return e.parameters.setProperty(H.SpeechServiceConnection_Url,l),h}}class Li extends class{constructor(e,t,i,n,r,s,o,a,c,u){this.privResultId=e,this.privReason=t,this.privText=i,this.privDuration=n,this.privOffset=r,this.privLanguage=s,this.privLanguageDetectionConfidence=o,this.privErrorDetails=a,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}}{constructor(e,t,i,n,r,s,o,a,c,u,p){super(e,t,i,n,r,s,o,c,u,p),this.privSpeakerId=a}get speakerId(){return this.privSpeakerId}}class xi{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class Gi extends xi{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class zi extends Gi{constructor(e,t,i){super(t,i),this.privResult=e}get result(){return this.privResult}}class Bi extends Gi{constructor(e,t,i,n,r){super(n,r),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=i}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class Ni extends Bi{}class Ui{constructor(e,t){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=e,this.privBytesPerSecond=t}id(){return this.privAudioNode.id()}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let i=0;for(;i<this.privBuffers.length&&t>=this.privBuffers[i].chunk.buffer.byteLength;)t-=this.privBuffers[i++].chunk.buffer.byteLength;if(i<this.privBuffers.length){const e=this.privBuffers[i].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,i===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[i].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new Fi(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let i=Math.round(t*this.privBytesPerSecond*1e-7),n=0;for(;n<this.privBuffers.length&&i>=this.privBuffers[n].chunk.buffer.byteLength;)i-=this.privBuffers[n++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-i/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(n)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const i=t.byteOffset/this.privBytesPerSecond*1e7,n=i+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=i&&e<=n)return t.chunk.timeReceived}return 0}}class Fi{constructor(e,t,i){this.chunk=e,this.serial=t,this.byteOffset=i}}class Hi{static load(){const e=new Map([[0,()=>{}]]),t=new Map,i="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})}})}]);'),n=new Worker(i);return n.addEventListener("message",(({data:i})=>{if(Hi.isCallNotification(i)){const{params:{timerId:n}}=i,r=e.get(n);if("number"==typeof r){const e=t.get(r);if(void 0===e||e!==n)throw new Error("The timer is in an undefined state.")}else{if(void 0===r)throw new Error("The timer is in an undefined state.");r(),e.delete(n)}}else{if(!Hi.isClearResponse(i)){const{error:{message:e}}=i;throw new Error(e)}{const{id:n}=i,r=t.get(n);if(void 0===r)throw new Error("The timer is in an undefined state.");t.delete(n),e.delete(r)}}})),{clearTimeout:i=>{const r=Math.random();t.set(r,i),e.set(i,r),n.postMessage({id:r,method:"clear",params:{timerId:i}})},setTimeout:(t,i)=>{const r=Math.random();return e.set(r,t),n.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:r}}),r}}}static loadWorkerTimers(){return()=>(null!==Hi.workerTimers||(Hi.workerTimers=Hi.load()),Hi.workerTimers)}static isCallNotification(e){return void 0!==e.method&&"call"===e.method}static isClearResponse(e){return null===e.error&&"number"==typeof e.id}}Hi.workerTimers=null,Hi.clearTimeout=e=>Hi.timers().clearTimeout(e),Hi.setTimeout=(e,t)=>Hi.timers().setTimeout(e,t),Hi.timers=Hi.loadWorkerTimers();class Ki extends Ce{constructor(e,t,i,n=Se.Info){super(e,n),this.privRequestId=t,this.privSessionId=i}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class ji extends Ki{constructor(e,t,i,n){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=i,this.privAudioNodeId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class qi extends Ki{constructor(e,t,i,n){super("ListeningStartedEvent",e,t),this.privAudioSourceId=i,this.privAudioNodeId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class Vi extends Ki{constructor(e,t,i){super("ConnectingToServiceEvent",e,i),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class Wi extends Ki{constructor(e,t,i,n,r){super("RecognitionStartedEvent",e,r),this.privAudioSourceId=t,this.privAudioNodeId=i,this.privAuthFetchEventId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}!function(e){e[e.Success=0]="Success",e[e.AudioSourceError=1]="AudioSourceError",e[e.AudioSourceTimeout=2]="AudioSourceTimeout",e[e.AuthTokenFetchError=3]="AuthTokenFetchError",e[e.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",e[e.UnAuthorized=5]="UnAuthorized",e[e.ConnectTimeout=6]="ConnectTimeout",e[e.ConnectError=7]="ConnectError",e[e.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",e[e.UnknownError=9]="UnknownError"}(Ti||(Ti={}));class Xi{constructor(e,t,i){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=i,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}onEvent(e){if(!this.privIsDisposed&&(e instanceof ji&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof Pe&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof ke&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Te&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Me&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof De&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Vi&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof at&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof ct&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof dt&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof ht&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}}getTelemetry(){const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},i=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],i}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}dispose(){this.privIsDisposed=!0}getConnectionError(e){switch(e){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:"+e.toString()}}}var Ji=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Qi{constructor(e){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.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=e,this.privRequestId=he(),this.privAudioNodeId=he(),this.privTurnDeferral=new Ae,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}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new Xi(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new ji(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t){return Ji(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new qi(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onPreConnectionStart(e,t){this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new Vi(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}onAuthCompleted(e){return Ji(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return Ji(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new Wi(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return Ji(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onSpeechContext(){this.privRequestId=he()}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 Ae}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(){return Ji(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}))}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}onStopRecognizing(){return Ji(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(e){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),Ue.instance.onEvent(e)}onComplete(){return Ji(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return Ji(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class Zi{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach((e=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}class Yi{constructor(e){this.privContext={},this.privDynamicGrammar=e}getSection(e){return this.privContext[e]||{}}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}setWordLevelTimings(){void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),void 0===this.privContext.phraseOutput.detailed&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed",-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();return this.setSection("dgi",e),JSON.stringify(this.privContext)}}class $i{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new $i(e)}get Offset(){return this.privSpeechStartDetected.Offset}}var en,tn,nn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class rn{constructor(e,t,i,n,r){if(this.privConnectionConfigurationPromise=void 0,this.privConnectionPromise=void 0,this.privSetTimeout=setTimeout,this.privIsLiveAudio=!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,!e)throw new le("authentication");if(!t)throw new le("connectionFactory");if(!i)throw new le("audioSource");if(!n)throw new le("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=i,this.privRecognizerConfig=n,this.privIsDisposed=!1,this.privRecognizer=r,this.privRequestSession=new Qi(this.privAudioSource.id()),this.privConnectionEvents=new ge,this.privServiceEvents=new ge,this.privDynamicGrammar=new Zi,this.privSpeechContext=new Yi(this.privDynamicGrammar),this.privAgentConfig=new Lt,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=Hi.setTimeout),this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&this.cancelRecognitionLocal(Je.Error,1007===t.statusCode?Qe.BadRequestParameters:Qe.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(H.ConversationTranslator_Token,e)}set voiceProfileType(e){this.privRecognizerConfig.parameters.setProperty(H.SpeechServiceConnection_SpeakerIdMode,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return nn(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,i){return nn(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return void(yield this.recognizeOverride(e,t,i));this.privConnectionConfigurationPromise=void 0,this.privRecognizerConfig.recognitionMode=e,this.setSpeechSegmentationTimeout(),this.privSuccessCallback=t,this.privErrorCallback=i,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const n=this.connectImpl();let r;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,i=yield this.audioSource.deviceInfo;this.privIsLiveAudio=i.type&&i.type===J.Microphones,r=new Ui(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(r,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:i}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield n}catch(e){return void(yield this.cancelRecognitionLocal(Je.Error,Qe.ConnectionFailure,e))}const s=new xi(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,s),this.receiveMessage(),this.sendAudio(r).catch((e=>nn(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(Je.Error,Qe.RuntimeError,e)}))))}))}stopRecognizing(){return nn(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return nn(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((()=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return nn(this,void 0,void 0,(function*(){if(yield this.cancelRecognitionLocal(Je.Error,Qe.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride()),void 0!==this.privConnectionPromise)try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=void 0}))}sendMessage(e){}sendNetworkMessage(e,t){return nn(this,void 0,void 0,(function*(){const i="string"==typeof t?We.Text:We.Binary,n="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new Gt(i,e,this.privRequestSession.requestId,n,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return nn(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==rn.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(rn.telemetryData)try{rn.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new Gt(We.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,i){return nn(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,i))}))}receiveMessage(){return nn(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const i=Gt.fromConnectionMessage(t);if(i.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(i.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=$i.fromJSON(i.textBody),n=new Gi(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,n);break;case"speech.enddetected":let r;r=i.textBody.length>0?i.textBody:"{ Offset: 0 }";const s=$i.fromJSON(r);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(s.Offset+this.privRequestSession.currentTurnAudioOffset);const o=new Gi(s.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,o);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(Je.EndOfStream,Qe.NoError,void 0));const a=new xi(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,a));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(i))||this.privServiceEvents&&this.serviceEvents.onEvent(new st(i.path.toLowerCase(),i.textBody))}return this.receiveMessage()}catch(e){return null}}))}setSpeechSegmentationTimeout(){}sendSpeechContext(e,t){const i=this.speechContext.toJSON();if(t&&this.privRequestSession.onSpeechContext(),i)return e.send(new Gt(We.Text,"speech.context",this.privRequestSession.requestId,"application/json",i))}noOp(){}sendPrePayloadJSON(e,t=!0){return nn(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e,t),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return nn(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new Gt(We.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return void 0!==this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===Xe.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((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}sendSpeechServiceConfig(e,t,i){if(t.onSpeechContext(),!0!==rn.telemetryDataEnabled){const e={context:{system:JSON.parse(i).context.system}};i=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("f0f5debc-f8c9-4892-ac4b-90a7ab359fd2","false").toLowerCase()){const e=JSON.parse(i);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",i=JSON.stringify(e)}if(i)return e.send(new Gt(We.Text,"speech.config",t.requestId,"application/json",i))}fetchConnection(){return nn(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Xe.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(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return nn(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let i=Date.now();const n=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),r=t.avgBytesPerSec/1e3*parseInt(n,10),s=this.privRequestSession.recogNumber,o=()=>nn(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===s){const n=yield this.fetchConnection(),a=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let c,u;if(!a||a.isEnd?(c=null,u=0):(c=a.buffer,this.privRequestSession.onAudioSent(c.byteLength),u=r>=this.privRequestSession.bytesSent?0:Math.max(0,i-Date.now())),0!==u&&(yield this.delay(u)),null!==c&&(i=Date.now()+1e3*c.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===s){if(n.send(new Gt(We.Binary,"audio",this.privRequestSession.requestId,null,c)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==a?void 0:a.isEnd))return o();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return o()}))}retryableConnect(){return nn(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=he();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:he(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let i=0,n="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),r=yield t;yield this.privRequestSession.onAuthCompleted(!1);const s=this.privConnectionFactory.create(this.privRecognizerConfig,r,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(s.events),s.events.attach((e=>{this.connectionEvents.onEvent(e)}));const o=yield s.open();if(200===o.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(o.statusCode),Promise.resolve(s);1006===o.statusCode&&(e=!0),i=o.statusCode,n=o.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(i,n),Promise.reject(`Unable to contact server. StatusCode: ${i}, ${this.privRecognizerConfig.parameters.getProperty(H.SpeechServiceConnection_Endpoint)} Reason: ${n}`)}))}delay(e){return new Promise((t=>this.privSetTimeout(t,e)))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const i=new Uint8Array(e);t+=`${e.byteLength}\r\n`;for(let n=0;n<e.byteLength;n++)t+=i[n].toString(16).padStart(2,"0")+" ",(n+1)%16==0&&(console.info(t),t="")}console.info(t)}sendFinalAudio(){return nn(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new Gt(We.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return nn(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e,!1),e)}))}}rn.telemetryDataEnabled=!0;class sn{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new sn(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}!function(e){e[e.Success=0]="Success",e[e.SynthesisEnd=1]="SynthesisEnd",e[e.Error=2]="Error"}(en||(en={})),function(e){e[e.Success=0]="Success",e[e.NoMatch=1]="NoMatch",e[e.InitialSilenceTimeout=2]="InitialSilenceTimeout",e[e.BabbleTimeout=3]="BabbleTimeout",e[e.Error=4]="Error",e[e.EndOfDictation=5]="EndOfDictation",e[e.TooManyRequests=6]="TooManyRequests",e[e.BadRequest=7]="BadRequest",e[e.Forbidden=8]="Forbidden"}(tn||(tn={}));class on{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=tn[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new on(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}class an{static implTranslateRecognitionResult(e){let t=Ze.Canceled;switch(e){case tn.Success:t=Ze.RecognizedSpeech;break;case tn.NoMatch:case tn.InitialSilenceTimeout:case tn.BabbleTimeout:case tn.EndOfDictation:t=Ze.NoMatch;break;case tn.Error:case tn.BadRequest:case tn.Forbidden:default:t=Ze.Canceled}return t}static implTranslateCancelResult(e){let t=Je.EndOfStream;switch(e){case tn.Success:case tn.EndOfDictation:case tn.NoMatch:t=Je.EndOfStream;break;case tn.InitialSilenceTimeout:case tn.BabbleTimeout:case tn.Error:case tn.BadRequest:case tn.Forbidden:default:t=Je.Error}return t}static implTranslateCancelErrorCode(e){let t=Qe.NoError;switch(e){case tn.Error:t=Qe.ServiceError;break;case tn.TooManyRequests:t=Qe.TooManyRequests;break;case tn.BadRequest:t=Qe.BadRequestParameters;break;case tn.Forbidden:t=Qe.Forbidden;break;default:t=Qe.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case Qe.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case Qe.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case Qe.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}class cn{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=tn[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new cn(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const i=e-t;for(const e of this.privDetailedSpeechPhrase.NBest){if(e.Words)for(const t of e.Words)t.Offset+=i;if(e.DisplayWords)for(const t of e.DisplayWords)t.Offset+=i}}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display||this.privDetailedSpeechPhrase.NBest[0].DisplayText:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class un extends rn{constructor(e,t,i,n,r){super(e,t,i,n,r),this.privSpeechRecognizer=r;const s={};if(void 0!==n.autoDetectSourceLanguages){const e=n.autoDetectSourceLanguages.split(",");let t;t="Continuous"===n.languageIdMode?"DetectContinuous":"DetectAtAudioStart",this.privSpeechContext.setSection("languageId",{Priority:"PrioritizeLatency",languages:e,mode:t,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}});const i=n.sourceLanguageModels;void 0!==i&&(s.customModels=i,s.onInterim={action:"None"},s.onSuccess={action:"None"})}(e=>{for(const t in e)return!1;return!0})(s)||this.privSpeechContext.setSection("phraseDetection",s)}setSpeechSegmentationTimeout(){const e=this.privRecognizerConfig.parameters.getProperty(H.Speech_SegmentationSilenceTimeoutMs,void 0);if(void 0!==e){const t=this.recognitionMode===V.Conversation?"CONVERSATION":this.recognitionMode===V.Dictation?"DICTATION":"INTERACTIVE",i=parseInt(e,10),n=this.privSpeechContext.getSection("phraseDetection");n.mode=t,n[t]={segmentation:{mode:"Custom",segmentationSilenceTimeoutMs:i}},this.privSpeechContext.setSection("phraseDetection",n)}}processTypeSpecificMessages(e){return t=this,i=void 0,r=function*(){let t;const i=new Q;i.setProperty(H.SpeechServiceResponse_JsonResult,e.textBody);let n=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const r=sn.fromJSON(e.textBody),s=r.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Li(this.privRequestSession.requestId,Ze.RecognizingSpeech,r.Text,r.Duration,s,r.Language,r.LanguageDetectionConfidence,void 0,void 0,e.textBody,i),this.privRequestSession.onHypothesis(s);const o=new zi(t,r.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,o)}catch(e){}n=!0;break;case"speech.phrase":const a=on.fromJSON(e.textBody),c=an.implTranslateRecognitionResult(a.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+a.Offset+a.Duration),Ze.Canceled===c){const e=an.implTranslateCancelResult(a.RecognitionStatus),t=an.implTranslateCancelErrorCode(a.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,an.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||c!==Ze.NoMatch||a.RecognitionStatus===tn.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(z)===K[K.Simple])t=new Li(this.privRequestSession.requestId,c,a.DisplayText,a.Duration,a.Offset+this.privRequestSession.currentTurnAudioOffset,a.Language,a.LanguageDetectionConfidence,void 0,void 0,e.textBody,i);else{const n=cn.fromJSON(e.textBody),r=n.Offset+this.privRequestSession.currentTurnAudioOffset,s=n.getJsonWithCorrectedOffsets(r);t=new Li(this.privRequestSession.requestId,c,n.RecognitionStatus===tn.Success?n.NBest[0].Display:void 0,n.Duration,r,n.Language,n.LanguageDetectionConfidence,void 0,void 0,s,i)}const n=new zi(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,n)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}n=!0}return n},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}cancelRecognition(e,t,i,n,r){const s=new Q;if(s.setProperty(B,Qe[n]),this.privSpeechRecognizer.canceled){const t=new Ni(i,r,n,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Li(t,Ze.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,r,void 0,s);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class pn{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class dn{constructor(e){if(!e)throw new le("subscriptionKey");this.privAuthInfo=new pn(xt.AuthKey,e)}fetch(e){return Promise.resolve(this.privAuthInfo)}fetchOnExpiry(e){return Promise.resolve(this.privAuthInfo)}}class hn{constructor(e,t){if(!e)throw new le("fetchCallback");if(!t)throw new le("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}fetch(e){return this.privFetchCallback(e).then((e=>new pn(xt.Authorization,void 0===e?void 0:hn.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new pn(xt.Authorization,void 0===e?void 0:hn.privTokenPrefix+e)))}}hn.privTokenPrefix="bearer ";var ln=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class vn{constructor(e,t,i){this.audioConfig=void 0!==e?e:qt.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=i,this.implCommonRecognizerSetup()}close(e,t){F.throwIfDisposed(this.privDisposed),be(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return ln(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return rn.telemetryDataEnabled}static enableTelemetry(e){rn.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",i="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,i=navigator.appVersion);const n=this.createRecognizerConfig(new ie(new ne(new se(e,t,i))));this.privReco=this.createServiceRecognizer(vn.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,n)}recognizeOnceAsyncImpl(e){return ln(this,void 0,void 0,(function*(){F.throwIfDisposed(this.privDisposed);const t=new Ae;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const i=yield t.promise;return yield this.implRecognizerStop(),i}))}startContinuousRecognitionAsyncImpl(e){return ln(this,void 0,void 0,(function*(){F.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return ln(this,void 0,void 0,(function*(){F.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return ln(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(H.SpeechServiceConnection_Key,void 0);return t&&""!==t?new dn(t):new hn((()=>{const t=e.getProperty(H.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(()=>{const t=e.getProperty(H.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}))}}class fn extends vn{constructor(e,t){const i=e;F.throwIfNull(i,"speechConfig"),F.throwIfNullOrWhitespace(i.properties.getProperty(H.SpeechServiceConnection_RecoLanguage),H[H.SpeechServiceConnection_RecoLanguage]),super(t,i.properties,new Oi),this.privDisposedRecognizer=!1}static FromConfig(e,t,i){const n=e;return t.properties.mergeTo(n.properties),new fn(e,i)}get endpointId(){return F.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(H.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(H.SpeechServiceAuthorization_Token)}set authorizationToken(e){F.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(H.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return F.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(H.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return F.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(z,K[K.Simple])===K[K.Simple]?K.Simple:K.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){be(this.recognizeOnceAsyncImpl(V.Interactive),e,t)}startContinuousRecognitionAsync(e,t){be(this.startContinuousRecognitionAsyncImpl(V.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){be(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,i){F.throwIfNull(e,"model"),i&&i("Not yet implemented.")}stopKeywordRecognitionAsync(e){e&&e()}close(e,t){F.throwIfDisposed(this.privDisposedRecognizer),be(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return i=this,n=void 0,s=function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(o,a)}c((s=s.apply(i,n||[])).next())}));var i,n,r,s}createRecognizerConfig(e){return new te(e,this.privProperties)}createServiceRecognizer(e,t,i,n){return new un(e,t,i,n,this)}}var gn,mn=function(){function e(t,i,n){this.isRunning=!1,this.baseSudASR=new G(n,this),p.d(e._TAG,"speechRegion:",i),this.speechConfig=Z.fromSubscription(t,i)}return e.prototype.startASR=function(t){var i=this;if(p.d(e._TAG,"startASR language: "+t+" isRunning: "+this.isRunning),!this.isRunning){this.isRunning=!0;var n=qt.fromStreamInput(this.createMicrophoneStream());this.speechConfig.speechRecognitionLanguage=t,this.reco=new fn(this.speechConfig,n),this.reco.recognized=function(t,n){if(p.d(e._TAG,"onRecognizedResult",n.result),n.result.reason===Ze.RecognizedSpeech){var r=n.result.text;i.baseSudASR.onRecognizedResult(r)}},this.reco.startContinuousRecognitionAsync()}},e.prototype.stopASR=function(){p.d(e._TAG,"stopASR:",this.isRunning),this.isRunning&&(this.isRunning=!1,this.reco&&(this.releaseMicrophoneStream(),this.reco.stopContinuousRecognitionAsync()))},e.prototype.pushAudio=function(e,t){this.microphoneStream&&e&&t>0&&this.microphoneStream.write(e.slice())},e.prototype.handleGameASR=function(e){this.baseSudASR.handleGameASR(e)},e.prototype.createMicrophoneStream=function(){return this.releaseMicrophoneStream(),this.microphoneStream=$e.createPushStream(),this.microphoneStream},e.prototype.releaseMicrophoneStream=function(){this.microphoneStream&&(this.microphoneStream.close(),this.microphoneStream=null)},e._TAG="AzureRealSudASRImpl",e}();!function(e){e[e.UNDEFINED=-1]="UNDEFINED",e[e.AZURE=1]="AZURE",e[e.SHU_MEI=2]="SHU_MEI"}(gn||(gn={}));var Sn,yn=function(){function e(e){this._iSudASR=this.createASRImpl(e)}return e.prototype.createASRImpl=function(t){t.supportNumberLanguageList=e.getASRTextLanguageList(),t.supportTextLanguageList=e.getASRNumberLanguageList();var i=e.getUseASRType();if(p.d(e._TAG,"asrType:"+i),p.d(e._TAG,"asrLoadList:"+O.getAsrLoadList()),i===gn.AZURE){var n=O.getSdkRtssCfg();if(null!=n&&null!=n.microsoft_rtss_cfg){var r=n.microsoft_rtss_cfg;return new mn(r.speech_subscription_key,r.speech_region,t)}return null}return null},e.prototype.startASR=function(e){null!=this._iSudASR&&this._iSudASR.startASR(e)},e.prototype.stopASR=function(){null!=this._iSudASR&&this._iSudASR.stopASR()},e.prototype.handleGameASR=function(e){null!=this._iSudASR&&this._iSudASR.handleGameASR(e)},e.prototype.pushAudio=function(e,t){null!=this._iSudASR&&this._iSudASR.pushAudio(e,t)},e.getASRTextLanguageList=function(){switch(this.getUseASRType()){case gn.AZURE:return O.getAzureASRTextLanguageList();case gn.SHU_MEI:default:return[]}},e.getASRNumberLanguageList=function(){switch(this.getUseASRType()){case gn.AZURE:return O.getAzureASRNumberLanguageList();case gn.SHU_MEI:default:return[]}},e.getUseASRType=function(){var e=O.getAsrLoadList();if(!e.length)return gn.UNDEFINED;for(var t=0;t<e.length;t++){var i=e[t];if(i===gn.AZURE)return i;if(i===gn.SHU_MEI)return i}return gn.UNDEFINED},e._TAG="ProxyASRImpl",e}(),An=function(){function e(e,t,i,n,r){this.kTag="SudFSMMGStateHandlerImpl",this._mgLogListener=null,this._fsmMG=e,this._userId=t,this._roomId=i,this._code=n,this._mgId=r,this._dynamicConfig="",this._GameCustomStateListener={onGameLoadStarted:function(){},onGameLoadCompleted:function(){},onGameStarted:function(){},onGameASR:function(){},onGameLoadPercent:function(e){},onPlayerSelfInfo:function(e){},onGameLlmASR:function(e){}},this._gameStateMap=new Map,this._playerStateMap=new Map,this._appStateMap=new Map}return e.prototype.getGameState=function(e){return""},e.prototype.getPlayerState=function(e,t){return""},e.prototype.setCode=function(e){},e.prototype.setGameCustomStateListener=function(e){this._GameCustomStateListener=e},e.prototype.setDynamicConfig=function(e){this._dynamicConfig=e},e.prototype.handleCmd=function(e,t,i,n,r){null!=e?null!=t?"game"===e?"m2as-set-debug"===i?this.handleSetDebug(r,i,n):"m2as-mg-log"===i?this.handleMgLog(r,i,n):"m2as-get-net-status"===i?this.handleGetNetStatus(r,i,n):"m2as-get-game-view-info"===i?this.handleGetGameViewInfo(r,i,n):"m2as-get-game-cfg"===i?this.handleGetGameCfg(r,i,n):"m2as-vibrate"===i?this.handleVibrate(r,i,n):"m2as-get-sdk-info"===i?this.handleGetSDKInfo(r,i,n):"m2as-get-state"===i?this.handleGetState(r,i,n):"m2as-notify-game-load-started"===i?this.handleNotifyGameLoadStarted(r,i,n):"m2as-notify-game-load-completed"===i?this.handleNotifyGameLoadCompleted(r,i,n):"m2as-notify-game-started"===i?this.handleNotifyGameStarted(r,i,n):"mg_common_game_load_percent"===i?this.handleNotifyGameLoadPercent(r,i,n):"m2as-expire-code"===i?this.handleExpireCode(r,i,n):"mg_common_game_asr"===i?this.handleGameASR(r,i,n):"m2as-login"===i?this.handleLogin(r,i,n):"mg_common_game_player_self_info"===i?this.handleSelfInfo(r,i,n):"mg_common_game_llm_asr"===i?this.handleGameLlmAsr(r,i,n):this.handleGameNotifyStateChange(r,i,n):"player"===e?this.handlePlayerNotifyStateChange(r,t,i,n):"gameLog"===e||"gameError"===e?this._mgLogListener&&this._mgLogListener(e,n):r.fail(E.toJson(E.kFail,"param invalid cmd is not game or player")):r.fail(E.toJson(E.kFail,"param invalid param is null")):r.fail(E.toJson(E.kFail,"param invalid cmd is null"))},e.prototype.handleSetDebug=function(e,t,i){p.d(this.kTag,"handleSetDebug {0} = {1}",t,i),e.success(E.kSuccessJson)},e.prototype.setMgLogListener=function(e){this._mgLogListener=e},e.prototype.handleMgLog=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGameLog(i),e.success(E.kSuccessJson)},e.prototype.handleGetNetStatus=function(e,t,i){p.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success('{"retCode":0, "retMsg":"success", "net_type":1}')},e.prototype.handleGetGameViewInfo=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGetGameViewInfo(e,i)},e.prototype.handleGetGameCfg=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGetGameCfg(e,i)},e.prototype.handleNotifyGameLoadPercent=function(e,t,i){p.d(this.kTag,"handleNotifyGameLoadPercent {0} = {1}",t,i),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLoadPercent(i),e.success(E.kSuccessJson)},e.prototype.handleGameLlmAsr=function(e,t,i){console.log(t,"handleGameLlmAsr"),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLlmASR(i),e.success(E.kSuccessJson)},e.prototype.handleVibrate=function(e,t,i){p.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success(E.kSuccessJson)},e.prototype.handleGetSDKInfo=function(e,t,i){var n={ret_code:E.kSuccess,ret_msg:"success",env_type:O.getEnvType(),language:O.getLanguage(),wordLanguage:O.getLanguage(),asr_text_language_list:yn.getASRTextLanguageList(),asr_number_language_list:yn.getASRNumberLanguageList(),sdk_version:I.kVersion,app_id:O.getAppId(),platform:O.getPlatform(),bundle_id:O.getBundleID(),sud_sdk_trace_id:O.genTraceId(),mg_id:Number(this._mgId),mg_id_str:this._mgId,mg_api_cfg:O.getMgApiCfgJson(),app_server_info_url:"",game_login_url:"",dynamic_config:this._dynamicConfig};null==O.getSdkRtssCfg()||null==O.getSdkRtssCfg().sm_game_word_language||O.getSdkRtssCfg().sm_game_word_language||(n.wordLanguage=O.getSdkRtssCfg().sm_game_word_language);var r=O.getMgApiCfg();n.app_server_info_url=r.app_server_info_url,n.game_login_url=r.game_login_url,p.d(this.kTag,"getSDKInfo",n),e.success(JSON.stringify(n))},e.prototype.handleGetState=function(e,t,i){p.d(this.kTag,"handleGetState {0} = {1}",t,i),e.success("{}")},e.prototype.handleNotifyGameLoadStarted=function(e,t,i){var n;p.d(this.kTag,"onGameLoadStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadStarted(),null===(n=this._fsmMG)||void 0===n||n.onGameLoadingProgress(2,E.kSuccess,99),e.success(E.kSuccessJson)},e.prototype.handleNotifyGameLoadCompleted=function(e,t,i){p.d(this.kTag,"onGameLoadCompleted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadCompleted(),e.success(E.kSuccessJson)},e.prototype.handleNotifyGameStarted=function(e,t,i){var n,r;p.d(this.kTag,"onGameStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameStarted(),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStarted)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStarted()),e.success(E.kSuccessJson)},e.prototype.handleLogin=function(e,t,i){p.d(this.kTag,"handleLogin {0} = {1}",t,i);var n={ret_code:E.kSuccess,ret_msg:"success",user_id:this._userId,room_id:this._roomId,mg_id:Number(this._mgId),mg_id_str:this._mgId,code:this._code,app_id:O.getAppId(),platform:O.getPlatform(),bundle_id:O.getBundleID(),sud_sdk_trace_id:O.genTraceId()};e.success(JSON.stringify(n))},e.prototype.handleExpireCode=function(e,t,i){var n,r;(null===(n=this._fsmMG)||void 0===n?void 0:n.onExpireCode)&&(null===(r=this._fsmMG)||void 0===r||r.onExpireCode(e,i))},e.prototype.handleGameASR=function(e,t,i){var n,r;p.d(this.kTag,"onGameASR {0} = {1}",t,i),this._GameCustomStateListener.onGameASR(i),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e.prototype.handleGameNotifyStateChange=function(e,t,i){var n,r;(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e.prototype.handlePlayerNotifyStateChange=function(e,t,i,n){var r,s;(null===(r=this._fsmMG)||void 0===r?void 0:r.onPlayerStateChange)&&(null===(s=this._fsmMG)||void 0===s||s.onPlayerStateChange(e,t,i,n))},e.prototype.handleSelfInfo=function(e,t,i){var n,r;null!=this._GameCustomStateListener.onPlayerSelfInfo&&this._GameCustomStateListener.onPlayerSelfInfo(i),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e}();!function(e){e[e.START=1]="START",e[e.LOADING=2]="LOADING",e[e.END=3]="END"}(Sn||(Sn={}));var bn="SudMGP",Cn=function(){function e(){}return e.sendAppCustomCommandEvent=function(e,t,i,n){e.contentWindow&&e.contentWindow.postMessage({msgTag:bn,msgType:11,ctxId:t,state:i,dataJson:n},"*")},e.sendGameCustomCommandCallback=function(e,t,i,n,r){e.contentWindow&&e.contentWindow.postMessage({msgTag:bn,msgType:12,ctxId:t,isSuccess:i,state:n,dataJson:r},"*")},e}(),In=function(){function e(e,t,i){this._isCalled=!1,this._window=e,this._ctxId=t,this._state=i}return e.prototype.success=function(e){this._isCalled||(Cn.sendGameCustomCommandCallback(this._window,this._ctxId,!0,this._state,e),this._isCalled=!0)},e.prototype.fail=function(e){this._isCalled||(Cn.sendGameCustomCommandCallback(this._window,this._ctxId,!1,this._state,e),this._isCalled=!0)},e}(),wn=function(){function e(){}return e.create=function(e,t){var i={iSudFSTAPP:t,language:e.language,supportTextLanguageList:[],supportNumberLanguageList:[]};return new yn(i)},e}(),Rn=function(){function e(){this._statsEvent=null,this.steps=[],this.loadTimestamp=Date.now()}return e.prototype.startLoad=function(e){this._statsEvent=new _(_.kStatsEventLoadGameFinished),this._statsEvent.setTimeout_code(0),this.steps=[],this._statsEvent.setLocal_core(!0),this._statsEvent.setLocal_pkg(!0),this._statsEvent.setMgId(e.mgId),this.loadTimestamp=Date.now()},e.prototype.reportStats=function(){null!=this._statsEvent&&(this._statsEvent.getEvent()!==_.kStatsEventLoadGameFinished&&(this._statsEvent.setEvent(_.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()),this._statsEvent.putExtra("loadGame",this.steps),T.report(this._statsEvent),this._statsEvent=null)},e.prototype.reportTimeoutEvent=function(e){if(null!==this._statsEvent){if(80===e)this._statsEvent.setRetCode(E.ENGINE_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(E.ENGINE_LOAD_TIMEOUT),this._statsEvent.setRetMsg("引擎加载超时");else{if(!(e>=85&&e<100))return;this._statsEvent.setRetCode(E.GAME_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(E.GAME_LOAD_TIMEOUT),this._statsEvent.setRetMsg("游戏加载超时")}this._statsEvent.setEvent(_.kStatsEventLoadGameTimeout),this._statsEvent.putExtra("loadGame",this.steps),T.report(this._statsEvent),this._statsEvent.setEvent(_.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()}},e.prototype.setLocal_pkg=function(e){null!=this._statsEvent&&this._statsEvent.setLocal_pkg(e)},e.prototype.setLocal_core=function(e){null!=this._statsEvent&&this._statsEvent.setLocal_core(e)},e.prototype.setRetCode=function(e){null!=this._statsEvent&&this._statsEvent.setRetCode(e)},e.prototype.setRetMsg=function(e){null!=this._statsEvent&&this._statsEvent.setRetMsg(e)},e.prototype.putStatsEvent=function(e,t,i){if(null!=this.steps){var n=Date.now(),r={step:e,percent:t,extra:i,cost_time:n-this.loadTimestamp};this.steps.push(r),this.loadTimestamp=n}},e}(),_n=function(){function e(){}return e.GET_MG_INFO="getMgInfo",e.DOWNLOAD_CORE="downloadCore",e.DOWNLOAD_GAME_PACKAGE="checkoutGamePackage",e.LOAD_GAME_RUNTIME="loadGameRuntime",e.LOAD_GAME_PERCENT="loadGamePercent",e}(),Tn=function(){function e(){this.url="",this.appId="",this.token="",this.resourceId="",this.uid=""}return e.prototype.getUrl=function(){return this.url},e.prototype.getAppId=function(){return this.appId},e.prototype.getToken=function(){return this.token},e.prototype.getResourceId=function(){return this.resourceId},e.prototype.getUid=function(){return this.uid},e.prototype.getLanguage=function(){return this.language},e.prototype.getModelName=function(){return this.modelName},e.prototype.getMgId=function(){return this.mgId},e.prototype.getRoomId=function(){return this.roomId},e.prototype.setUrl=function(e){return this.url=e,this},e.prototype.setAppId=function(e){return this.appId=e,this},e.prototype.setToken=function(e){return this.token=e,this},e.prototype.setResourceId=function(e){return this.resourceId=e,this},e.prototype.setUid=function(e){return this.uid=e,this},e.prototype.setLanguage=function(e){return this.language=e,this},e.prototype.setModelName=function(e){return this.modelName=e,this},e.prototype.setMgId=function(e){return this.mgId=e,this},e.prototype.setRoomId=function(e){return this.roomId=e,this},e.prototype.setDoubaoRtssCfg=function(e){return e?(this.url=e.url||"",this.appId=e.app_key||"",this.token=e.access_key||"",this.resourceId=e.resource_id||"",this.modelName=e.model_name,this):this},e}(),En=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},Pn=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},kn=0;function Dn(e){var t=new ArrayBuffer(4);return new DataView(t).setInt32(0,e,!1),new Uint8Array(t)}var Mn=function(e){var t=e.requestData,i=e.isLast,n=e.isGzip;return En(void 0,void 0,void 0,(function(){var e,r,s,o,a,c,u,d;return Pn(this,(function(h){switch(h.label){case 0:if(!n)return[3,5];kn++,i&&(kn=-Math.abs(kn)),h.label=1;case 1:return h.trys.push([1,3,,4]),e=xn({message_type:2,message_type_specific_flags:i?3:1,compression_type:1}),r=Dn(kn),[4,Ln(t)];case 2:return s=h.sent(),o=Dn(s.length),a=e.length+r.length+o.length+s.length,c=new Uint8Array(a),u=0,c.set(e,u),u+=e.length,c.set(r,u),u+=r.length,c.set(o,u),u+=o.length,c.set(s,u),[2,c];case 3:return d=h.sent(),p.w("DoubaoAsrClient","encodeAudioOnlyRequest gzip error",d),[2,On({requestData:t,isLast:i,isGzip:!1})];case 4:return[3,6];case 5:return[2,On({requestData:t,isLast:i,isGzip:!1})];case 6:return[2]}}))}))},On=function(e){var t=e.requestData,i=e.isLast,n=Gn(i?{message_type:2,message_type_specific_flags:2}:{message_type:2}),r=t instanceof Blob?t.size:new Blob([t]).size;return n.setUint32(4,r,!1),new Blob([n,t])};function Ln(e){return En(this,void 0,void 0,(function(){var t,i,n,r;return Pn(this,(function(s){switch(s.label){case 0:return t=e instanceof Blob?e.stream():new ReadableStream({start:function(t){t.enqueue(e),t.close()}}),i=new CompressionStream("gzip"),n=t.pipeThrough(i),[4,new Response(n).arrayBuffer()];case 1:return r=s.sent(),[2,new Uint8Array(r)]}}))}))}var xn=function(e){var t=e.message_type,i=void 0===t?1:t,n=e.version,r=void 0===n?1:n,s=e.message_type_specific_flags,o=void 0===s?0:s,a=e.serial_method,c=void 0===a?1:a,u=e.compression_type,p=void 0===u?0:u,d=e.reserved_data,h=void 0===d?0:d,l=e.extension_header,v=void 0===l?new ArrayBuffer(0):l,f=new ArrayBuffer(4),g=new DataView(f),m=Math.trunc(v.byteLength/4)+1;return g.setUint8(0,r<<4|m),g.setUint8(1,i<<4|o),g.setUint8(2,c<<4|p),g.setUint8(3,h),new Uint8Array(f)},Gn=function(e){var t=e.message_type,i=void 0===t?1:t,n=e.version,r=void 0===n?1:n,s=e.message_type_specific_flags,o=void 0===s?0:s,a=e.serial_method,c=void 0===a?1:a,u=e.compression_type,p=void 0===u?0:u,d=e.reserved_data,h=void 0===d?0:d,l=e.extension_header,v=void 0===l?new ArrayBuffer(0):l,f=new ArrayBuffer(8),g=new DataView(f),m=Math.trunc(v.byteLength/4)+1;return g.setUint8(0,r<<4|m),g.setUint8(1,i<<4|o),g.setUint8(2,c<<4|p),g.setUint8(3,h),g},zn=function(){function e(e,t,i,n,r){this.seq_no=0,this.session_id="",this.isRunning=!1,this.startMs=0,this.durationMillisecond=0,this.billingTimer=null,this.mg_id=e,this.csp=t,this.user_id=i,this.room_id=n,this.mIAsrBillingListener=r}return e.prototype.startBilling=function(){this.isRunning||(this.isRunning=!0,this.seq_no=0,this.session_id=this.generateMD5UUID(),this.startMs=Date.now(),this.startHeartbeat())},e.prototype.stopBilling=function(){this.isRunning&&(this.isRunning=!1,this.billingTimer&&(clearTimeout(this.billingTimer),this.billingTimer=null),this.reportBilling())},e.prototype.startHeartbeat=function(){var e=this;this.billingTimer&&clearTimeout(this.billingTimer),this.billingTimer=window.setTimeout((function(){e.reportBilling(),e.startHeartbeat()}),1e4)},e.prototype.reportBilling=function(){var e=Date.now()-this.startMs;if(this.startMs=Date.now(),!(e>6e4)){this.durationMillisecond+=e;var t=Math.ceil(this.durationMillisecond/1e3),i={seq_no:++this.seq_no,session_id:this.session_id,mg_id:this.mg_id,csp:this.csp,user_id:this.user_id,room_id:this.room_id,duration:t};this.mIAsrBillingListener.onReportDuration(i)}},e.prototype.generateMD5UUID=function(){return h()(C())},e}(),Bn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},Nn=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},Un=function(){function e(e){this._TAG="DoubaoAsrClient",this.webSocket=null,this.mIAsrBillingListener=null,this.isRunning=!1,this.mgId="",this.roomId="",this.userId="",this.doubaoPcmDataSource=[],this.sendLastPackageCompleted=!1,this.mLastText=null,this.canGzip=!1,this.mCommonAsrBillingManager=null,this.canGzip=this.canGzipCompress(),p.d(this._TAG,"gzip canGzipCompress",this.canGzip),this.mIAsrBillingListener=e}return e.prototype.canGzipCompress=function(){try{return"undefined"!=typeof CompressionStream}catch(e){return!1}},e.prototype.startRecognize=function(e,t){if(!this.isRunning&&(this.isRunning=!0,e)){p.d(this._TAG,"startRecognize");var i=this;this.mgId=e.getMgId(),this.roomId=e.getRoomId(),this.userId=e.getUid();var n=e.getUrl(),r=e.getAppId(),s=e.getLanguage(),o={user:{uid:this.userId},audio:{format:"pcm",sample_rate:16e3,bits:16,channel:1,codec:"raw",language:s||"zh-CN"},request:{model_name:"bigmodel",enable_punc:!0,enable_itn:!0,end_window_size:800,force_to_speech_time:1e3,result_type:"single"}},a={};O.getHttpService().getDoubaoAsrToken({onSuccess:function(s){var c=s.data.token;c&&(a.api_resource_id=e.getResourceId(),a.api_app_key=r,a.api_access_key="Jwt; ".concat(c));var u=function(e,t){var i=[];for(var n in t)i.push("".concat(n,"=").concat(encodeURIComponent(t[n])));return"".concat(e,"?").concat(i.join("&"))}(n,a);i.connect({url:u,config:o,listener:t})},onFailure:function(e){p.e(i._TAG,"getDoubaoAsrToken err",e),t.onFailure(e)}})}},e.prototype.connect=function(e){var t=this,i=e.url,n=e.config,r=e.listener;this.webSocket=new WebSocket(i);var s=this.webSocket,o=this;s.onopen=function(){return Bn(t,void 0,void 0,(function(){var e;return Nn(this,(function(t){switch(t.label){case 0:return o.startBilling(),p.d(o._TAG,"webSocket open"),[4,(i=n,a=this.canGzip,En(void 0,void 0,void 0,(function(){var e,t,n,r,s,o,c,u,p,d,h;return Pn(this,(function(l){switch(l.label){case 0:return e=JSON.stringify(i),a?(kn=1,t=xn({message_type:1,message_type_specific_flags:1,compression_type:1}),n=new TextEncoder,r=n.encode(e),s=Dn(kn),[4,Ln(r)]):[3,2];case 1:return o=l.sent(),c=Dn(o.length),u=t.length+s.length+c.length+o.length,p=new Uint8Array(u),d=0,p.set(t,d),d+=t.length,p.set(s,d),d+=s.length,p.set(c,d),d+=c.length,p.set(o,d),[2,p];case 2:return(h=Gn({message_type:1})).setUint32(4,e.length,!1),[2,new Blob([h.buffer,e])]}}))})))];case 1:return e=t.sent(),s.send(e),r.onRecognizeSuccess(),[2]}var i,a}))}))},s.onmessage=function(e){return Bn(t,void 0,void 0,(function(){var t,i,s,a;return Nn(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),t="bigmodel"===(null===(a=n.request)||void 0===a?void 0:a.model_name),[4,this.parseResponse(e.data,{hasSequence:t},r)];case 1:if(i=c.sent(),t){if(i.code!==E.kSuccess)return r.onFailure(i),o.stopRecognize(),[2];if(i.isLasrPackage)return this.sendLastPackageCompleted=!0,p.d(o._TAG,"服务器返回了最后一个包,关闭asr识别"),o.stopRecognize(),[2];if(o.sendLastPackageCompleted)return p.d(o._TAG,"已经发了最后一个包,不再发送数据包"),o.stopRecognize(),[2];o.checkIfNeedToSendPcmData()}return[3,3];case 2:return s=c.sent(),p.e(o._TAG,"onmessage error",s),[3,3];case 3:return[2]}}))}))},s.onclose=function(){t.stopBilling(),r.onClosed&&r.onClosed()},s.onerror=function(e){r.onFailure&&r.onFailure(e)}},e.prototype.sendData=function(e){return Bn(this,void 0,void 0,(function(){var t;return Nn(this,(function(i){switch(i.label){case 0:return this.webSocket?[4,Mn({requestData:e,isGzip:this.canGzip})]:[2,!1];case 1:return t=i.sent(),this.webSocket.readyState===this.webSocket.OPEN&&this.webSocket.send(t),[2]}}))}))},e.prototype.pauseRecognize=function(){return Bn(this,void 0,void 0,(function(){var e;return Nn(this,(function(t){switch(t.label){case 0:return p.d(this._TAG,"pauseRecognize"),null==this.webSocket?[3,2]:(p.d(this._TAG,"发送最后一个包"),[4,Mn({requestData:new Blob,isLast:!0,isGzip:this.canGzip})]);case 1:e=t.sent(),this.webSocket.send(e),t.label=2;case 2:return[2]}}))}))},e.prototype.stopRecognize=function(){return Bn(this,void 0,void 0,(function(){return Nn(this,(function(e){return this.isRunning&&this.webSocket?(this.stopBilling(),p.d(this._TAG,"stopRecognize"),this.isRunning=!1,this.webSocket.close(),this.webSocket=null,this.doubaoPcmDataSource=[],this.mLastText=null,[2]):[2]}))}))},e.prototype.sendPcmData=function(e){this.doubaoPcmDataSource.push(e),this.checkIfNeedToSendPcmData()},e.prototype.checkIfNeedToSendPcmData=function(){if(this.webSocket&&0!==this.doubaoPcmDataSource.length&&this.webSocket.readyState===this.webSocket.OPEN){var e=this.doubaoPcmDataSource.shift();this.sendData(e)}},e.prototype.parseResponse=function(e,t,i){return Bn(this,void 0,void 0,(function(){var n,r,s,o,a,c,u,d,h,l,v,f,g,m;return Nn(this,(function(S){switch(S.label){case 0:return n={code:E.kFail,msg:"",sequence:-1,isLasrPackage:!1},null===e||0===e.size?[2,n]:[4,(y=e,new Promise((function(e){var t=new FileReader;t.onload=function(){return e(t.result)},t.readAsArrayBuffer(y)})))];case 1:r=S.sent(),s=new DataView(r),o=15&s.getUint8(0),a=s.getUint8(1)>>4,c=15&s.getUint8(1),n.isLasrPackage=3===c,u=15===a?8:4,d=(null==t?void 0:t.hasSequence)?4:0,h=4*o+u+d,l=r.slice(h),v=new Uint8Array(l),f=new TextDecoder("utf-8"),g=f.decode(v),m=null;try{m=JSON.parse(g)}catch(e){p.d(this._TAG,"parseResponse parse error",e)}return n.sequence=d,9===a?(this.exeResultText(i,m),n.code=E.kSuccess,n.msg=null):11===a?(n.code=E.kSuccess,n.msg=null):15===a&&(p.d(this._TAG,"doubao error code:"+d+" msg:"+g),n.code=d,n.msg=g),[2,n]}var y}))}))},e.prototype.exeResultText=function(e,t){if(t){var i=t.result;if(i){var n=i.text,r=!1,s=i.utterances;null!=s&&s.length>0&&(r=s[0].definite),(n&&n!==this.mLastText||r)&&(p.d(this._TAG,"exeResultText success ===> ",n),this.mLastText=n,e.onText(r,n,t))}}},e.prototype.startBilling=function(){this.stopBilling(),this.mCommonAsrBillingManager=new zn(this.mgId,"volc",this.userId,this.roomId,this.mIAsrBillingListener),this.mCommonAsrBillingManager.startBilling()},e.prototype.stopBilling=function(){null!=this.mCommonAsrBillingManager&&(this.mCommonAsrBillingManager.stopBilling(),this.mCommonAsrBillingManager=null)},e}(),Fn=function(){function e(){this._TAG="SudGIP_AiAgentImpl",this.mgId="",this.roomId="",this.senderUserId="",this.senderNickName="",this.isRunning=!1,this.language="",this.mDoubaoAsrClient=null,this.mISudListenerAiAgent=null,this.enable_asr=!1,this.enable_tts=!1,this.mAiAsrTextObserver=null}return e.prototype.pushAudio=function(e,t){this.enable_asr?this.innerPushAudio(e,t):p.e(this._TAG,"pushAudio enable_asr is",this.enable_asr)},e.prototype.innerPushAudio=function(e,t){var i;null!=e&&0!==t&&(this.isRunning||this.startASR(this.language),null===(i=this.mDoubaoAsrClient)||void 0===i||i.sendPcmData(e))},e.prototype.startASR=function(e){p.d(this._TAG,"startASR: "+e+" currentIsRunning:"+this.isRunning),this.isRunning||(this.isRunning=!0,this.startAudioRecognize(e))},e.prototype.stopASR=function(){this.isRunning&&(this.isRunning=!1,null!==this.mDoubaoAsrClient&&(this.mDoubaoAsrClient.stopRecognize(),this.mDoubaoAsrClient=null))},e.prototype.canRecognitionLanguage=function(e,t){return!!t&&!!(e&&e.languages.indexOf(t)>-1)},e.prototype.startAudioRecognize=function(e){var t=O.getDoubaoRtssCfg();if(null!=t)if(this.canRecognitionLanguage(t,e)){var i=this;this.mDoubaoAsrClient=new Un({onReportDuration:function(e){if(e){var t={seq_no:e.seq_no,session_id:e.session_id,mg_id:e.mg_id,csp:e.csp,user_id:e.user_id,room_id:e.room_id,duration:e.duration,app_id:O.getAppId(),platform:O.getPlatform()},n=O.getReportLargeModelDurationUrl();n?O.getHttpService().commonPost(n,t,{onSuccess:function(){},onFailure:function(){}}):p.w(i._TAG,"error onReportDuration error because url is null")}}});var n=new Tn;n.setDoubaoRtssCfg(t),n.setUid(this.senderUserId),n.setLanguage(e),n.setMgId(this.mgId),n.setRoomId(this.roomId),this.mDoubaoAsrClient.startRecognize(n,{onRecognizeSuccess:function(){p.d(i._TAG,"onRecognizeSuccess:")},onText:function(e,t,n){p.d(i._TAG,"onText: definite:",e," text:"+t,"res_json",n),i.onRecognizingResult(e,t,n)},onFailure:function(e){p.d(i._TAG,"db asr onFailure:",e),i.stopASR()},onClosed:function(){p.d(i._TAG,"db asr client onClosed"),i.stopASR()}})}else p.e(this._TAG,"无法开启asr识别,因为当前语言不在于后台给的语言配置列表当中");else p.e(this._TAG,"无法开启asr识别,因为后台没有给DoubaoRtssCfg配置")},e.prototype.onRecognizingResult=function(e,t,i){e&&(p.d(this._TAG,"onRecognizingResult sendText",t,i),this.innerSendText(t,this.parseMetrics(i)))},e.prototype.parseMetrics=function(e){try{var t=e,i=t.result;if(null===i)return null;var n=t.additions,r={asr_duration:0,end_time:0,log_id:n?n.log_id:"",start_time:0},s=i.utterances;if(null!==s&&s.length>0){var o=s[0];r.end_time=o.end_time,r.start_time=o.start_time,r.asr_duration=r.end_time-r.start_time}return r}catch(e){p.e(this._TAG,"parseMetrics parserResponse error:",e)}return null},e.prototype.sendText=function(e){this.innerSendText(e,null)},e.prototype.innerSendText=function(e,t){p.d(this._TAG,"enable_tts",this.enable_tts,"innerSendText",e,"metrics",t),this.enable_tts&&(null!=this.mAiAsrTextObserver&&this.mAiAsrTextObserver.onText(e),O.sendRoomMessage(this.mgId,this.roomId,1,this.senderUserId,this.senderNickName,e,t))},e.prototype.pauseAudio=function(){null!=this.mDoubaoAsrClient&&this.mDoubaoAsrClient.pauseRecognize()},e.prototype.stopAudio=function(){null!=this.mDoubaoAsrClient&&this.stopASR()},e.prototype.setISudListenerAiAgent=function(e){this.mISudListenerAiAgent=e},e.prototype.onRoomChatMessage=function(e){null!==this.mISudListenerAiAgent&&this.mISudListenerAiAgent.onRoomChatMessage(e)},e.prototype.setMgId=function(e){this.mgId=e},e.prototype.setRoomId=function(e){this.roomId=e},e.prototype.setSenderUserId=function(e){this.senderUserId=e},e.prototype.setSenderNickName=function(e){this.senderNickName=e},e.prototype.setLanguage=function(e){this.language=e},e.prototype.setGameLargeModelCfg=function(e){null!=e&&(this.enable_asr=e.enable_asr,this.enable_tts=e.enable_tts)},e.prototype.setAiAsrTextObserver=function(e){this.mAiAsrTextObserver=e},e}(),Hn=i(398),Kn=i.n(Hn),jn=i(465),qn=i.n(jn),Vn=function(){function e(){}return e.buildSignature=function(e,t){var i=e+"&"+t+"&"+O.getPlatform()+"&"+O.getBundleID();return Kn()(i,O.getAppKey()).toString(qn())},e.setLogId=function(e){this.logId=e},e.saveLogIdToLocal=function(){localStorage.setItem(e.SaveLogTag,this.logId)},e.getLocalLogId=function(){return localStorage.getItem(e.SaveLogTag)},e.getLogId=function(){return this.logId},e.uploadFile=function(e,t,i,n,r){var s=this;null===t&&(t=""),null===n&&(n=""),null===r&&(r="");var o=new FormData;o.append("file",i,"".concat(this.logId)),o.append("app_id",n),o.append("mg_id",r),p.d(this.kTag,"upload Id",this.getLogId(),this.getLocalLogId()),this.getLogId()!==this.getLocalLogId()&&O.getHttpService().doUpload({url:e,formData:o,requestId:t,beforeSend:function(e){e.setRequestHeader(D.kHeaderSudMGPSDKSignature,s.buildSignature(t,n))},listener:{onSuccess:function(){s.saveLogIdToLocal()},onFailure:function(){}}})},e.uploadSdkLog=function(e){var t=O.getUploadUrl();if(!t)return!1;this.uploadFile(t,e.requestId,e.file,e.appId,e.mgId+"")},e.kTag="SudReportLogUtils",e.SaveLogTag="SudReportLog_LogId",e.logId=localStorage.getItem(e.SaveLogTag)||"",e}(),Wn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},Xn=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},Jn=function(){function e(){}return e.collectLog=function(t){var i=e.formatValue(t);this._logData.push(i+"\n")},e.formatValue=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Error)return"Error: ".concat(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e.formatValue).join(" ");try{return JSON.stringify(t,(function(e,t){return"bigint"==typeof t?t.toString()+"n":t instanceof RegExp?t.toString():t}))}catch(e){return"[Unserializable Object: ".concat(e,"]")}},e.getLogFile=function(){return Wn(this,void 0,void 0,(function(){return Xn(this,(function(e){return[2,new Blob(this._logData,{type:"application/octet-stream"})]}))}))},e.uploadLog=function(e){return Wn(this,void 0,void 0,(function(){var t,i,n;return Xn(this,(function(r){switch(r.label){case 0:return[4,this.getLogFile()];case 1:return t=r.sent(),i=O.getAppId(),n=h()(C()),Vn.uploadSdkLog({requestId:n,file:t,appId:i,mgId:e}),[2]}}))}))},e.KTag="ReportLogTask",e._logData=[],e}(),Qn=function(){function e(){}return e.bytesToInt=function(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},e.bytesToShort=function(e,t){return void 0===t&&(t=0),e[t]<<8|e[t+1]},e}(),Zn=function(){function e(){}return e.ROOM_CHAT_MESSAGE_NOTIFY=1001,e}(),Yn=function(){function e(e,t,i,n,r){this._TAG="SudGIPWebSocket",this.isRunning=!1,this.mWebSocket=null,this.delayGetGateTokenTimer=null,this.appId=e,this.userId=t,this.roomId=i,this.mgId=n,this.listener=r}return e.prototype.start=function(){p.d(this._TAG,"start curIsRunning:"+this.isRunning),this.isRunning||(this.isRunning=!0,this.getGateToken())},e.prototype.getGateToken=function(){if(p.d(this._TAG,"getGateToken curIsRunning:"+this.isRunning),this.isRunning){var e={app_id:this.appId,uid:this.userId},t=this;O.getHttpService().getGateToken(e,{onSuccess:function(e){var i=e?e.data:null;null!==i&&i.access_token?t.connectWebSocket(i.access_token):t.delayGetGateToken()},onFailure:function(e,i){p.d(t._TAG,"onFailure:"+i+"("+e+")"),t.delayGetGateToken()}})}},e.prototype.connectWebSocket=function(e){if(p.d(this._TAG,"connectWebSocket curIsRunning:"+this.isRunning),this.isRunning)if(null==this.mWebSocket){var t=O.getGateWsUrl();if(t){var i,n=this,r=null;t="".concat(t,"?mgid=").concat(this.mgId,"&roomid=").concat(this.roomId,"&token=").concat(e),this.mWebSocket=new WebSocket(t),this.mWebSocket.binaryType="arraybuffer",this.mWebSocket.onopen=function(){p.d(n._TAG,"websocket onOpen"),r=setInterval((function(){n.mWebSocket&&n.mWebSocket.readyState===WebSocket.OPEN&&n.mWebSocket.send("ping")}),1e4)},this.mWebSocket.onclose=function(e){p.d(n._TAG,"===> onClosed: code:".concat(e.code," reason:").concat(e.reason)),r&&clearInterval(r),i||(i=!0,s())},this.mWebSocket.onerror=function(e){p.d(n._TAG,"===> onFailure: Throwable:".concat(e," Response:null")),i||(i=!0,s())},this.mWebSocket.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=new Uint8Array(e.data);try{n.parseWebSocketMessage(t)}catch(e){console.log("WebSocket解析数据发生了异常:".concat(e.toString()))}}}}else this.delayGetGateToken()}else p.d(this._TAG,"connectWebSocket 已存在WebSocket无需重复连接");function s(){null!==n.mWebSocket&&(n.mWebSocket=null,n.innerDelayGetGateToken(1e3))}},e.prototype.delayGetGateToken=function(){this.innerDelayGetGateToken(3e3)},e.prototype.innerDelayGetGateToken=function(e){var t=this;p.d(this._TAG,"delayGetGateToken curIsRunning:"+this.isRunning),this.isRunning&&(this.delayGetGateTokenTimer=setTimeout((function(){t.delayGetGateTokenTimer&&clearTimeout(t.delayGetGateTokenTimer),t.getGateToken()}),e))},e.prototype.destroy=function(){p.d(this._TAG,"destroy curIsRunning:"+this.isRunning),this.isRunning&&(this.isRunning=!1,this.delayGetGateTokenTimer&&clearTimeout(this.delayGetGateTokenTimer),null!==this.mWebSocket&&(this.mWebSocket.close(),this.mWebSocket=null))},e.prototype.parseWebSocketMessage=function(e){var t;if(e&&0!==e.length)if(e.length<12)p.d(this._TAG,"WebSocket后端发的数组长度不对, length:".concat(e.length));else{var i=Qn.bytesToInt(e.subarray(0,4)),n=Qn.bytesToShort(e.subarray(4,6)),r=Qn.bytesToShort(e.subarray(6,8));if(p.d(this._TAG,"parseWebSocketMessage magic:".concat(i," version:").concat(n," cmd:").concat(r)),r===Zn.ROOM_CHAT_MESSAGE_NOTIFY)if(e.length>12){var s=e.subarray(12),o=new TextDecoder("utf-8").decode(s);this.listener&&(null===(t=this.listener)||void 0===t||t.onRoomChatMessage(o))}else console.debug("WebSocket后端发的数组长度不对, length:".concat(e.length))}else p.d(this._TAG,"WebSocket后端发的数组为空")},e}(),$n=function(){function e(e,t){this._kTag="H5SudFSTAPPImpl",this.isCanReportTimeoutEvent=!0,this._gameLoadPercent=0,this._startDelayOnGameLoadCompletedTimer=null,this.loadGameStatsEvent=new Rn,this.mGameInfo=null,this.mISudAiAgent=null,this.mGameLargeModelCfg=null,this.mSudGIPWebSocket=null;var i=e.parentElm,n=e.fstAppCtxId,r=e.userId,o=e.roomId,a=e.code,c=e.mgId,u=e.language;this._loadMgParamModel=e,this._fstAppCtxId=n,this._userId=r,this._roomId=o,this._code=a,this._mgId=c,this._fsmMg=t,this._loadingFailed=!1,this._isCalledDestroyMG=!1,this._gameLayerView={},this._window=null,this._iframeUrl="",this._rootElm=i,this._gameCompeleted=!1,this._bigLoadingPicUrl="",this.receiveGameLoading=!1,this._ctxIdListenerNotifyStateChangeMap=new Map,this._idIDGenerator=new s,this._sudFSMMGStateHandler=function(e,t,i,n,r){return new An(e,t,i,n,r)}(t,r,o,a,c),this._sudASR=wn.create({language:u},this),T.genSpanId(c),this.initGameCustomStateListener(),this.loadGame(i)}return e.prototype.initGameCustomStateListener=function(){var e=this;this._sudFSMMGStateHandler.setGameCustomStateListener({onGameLoadStarted:function(){},onGameLoadCompleted:function(){e._loading(e._rootElm,Sn.END,E.kSuccess,100),e.loadGameStatsEvent.setRetCode(E.kSuccess),e.loadGameStatsEvent.setRetMsg("success"),e.loadGameStatsEvent.reportStats(),O.getEnvType()===O.kEnvTypeSim&&e._createSimInfo(e._rootElm),e._gameCompeleted=!0,e.hideLoading(),Vn.getLogId()&&Jn.uploadLog(e._mgId)},onGameStarted:function(){e._loadingFailed=!1},onGameLoadPercent:function(t){e.receiveGameLoading=!0;try{var i=JSON.parse(t),n=i.percent,r=85+Math.floor(15*n/100);e._gameLoadPercent=r,e.startDelayOnGameLoadCompletedTask(),0===n?(e.loadGameStatsEvent.putStatsEvent(_n.DOWNLOAD_GAME_PACKAGE,80,i),e.loadGameStatsEvent.putStatsEvent(_n.LOAD_GAME_RUNTIME,r,i)):e.loadGameStatsEvent.putStatsEvent(_n.LOAD_GAME_PERCENT,r,i),e._loading(e._rootElm,Sn.LOADING,E.kSuccess,r)}catch(t){p.w(e._kTag,"onGameLoadPercent json parse error",t)}},onGameASR:function(t){e._sudASR.handleGameASR(t)},onPlayerSelfInfo:function(t){if(null!==e.mISudAiAgent){var i=JSON.parse(t),n=i.name,r=i.uid;e.mISudAiAgent.setSenderUserId(r),e.mISudAiAgent.setSenderNickName(n)}},onGameLlmASR:function(t){JSON.parse(t).isOpen&&e.mISudAiAgent&&e.mISudAiAgent.setAiAsrTextObserver({onText:function(t){e.notifyStateChange("app_common_game_llm_asr_content",JSON.stringify({content:t}),{onSuccess:function(){},onFailure:function(){}})}})}})},e.prototype._createSimInfo=function(e){var t=document.createDocumentFragment(),i=document.createElement("div"),n=document.createElement("span"),r=document.createElement("img");r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL4AAAA9CAYAAAATUNPrAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAvqADAAQAAAABAAAAPQAAAADYD5vDAAAqeElEQVR4Ae2dCbhUxbWo+wzM86AiqBzFEUXBIaKggonRaBxv1OdAnJOY3KjJzVOTlyh6kxhjBqPXJE7EecBoMBpfPo3oNYIi4IA4IKiIgiLIPHOG+/9FV7tP031Od58+iO+lvq96T1Wr1lSrVq2qvbsiVcb0pz/9qX1tbW235cuX9+7atevAbt267dSuXbt+nTt37rHlllt27NGjR6p79+51HTp0qK+oqKim6cqGhoba9evX169Zs6YduW41iXvz161b90FdXd0bq1atmsFxSVVV1bJ99913fRnR/Reo/485UFEI7Xfcccd2KOouKPGzKOQe1NmG63pSg/Wrq6tTKPzWXA/r2LHjUJR+p169eqVQ9lTPnj1TnTp1KqSZTJm1a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AKQ1ABL/xMnh9zkmYVScWqt4OT16LsK6Hbf0WZB70zuTeD60/Y1LaUvNHW6lJw/VedjTnwPylTiR6yTo9wAAAAAElFTkSuQmCC",r.setAttribute("style","width: 40px;height: 12.842px"),n.innerHTML=O.getOnlyTestText(),n.setAttribute("style","font-size: 12px;color: #fff;margin-left: 4px;"),i.append(r),i.append(n),i.setAttribute("style","position: absolute;bottom: 0;right: 0"),t.append(i),e.append(t)},e.prototype.loadGame=function(e){var t=this;e.style.setProperty("position","relative"),e.innerHTML="",this.isCanReportTimeoutEvent=!0,t.loadGameStatsEvent.startLoad({mgId:this._mgId}),t._loading(e,Sn.START,E.kSuccess,10),O.getMGInfo(this._mgId,{onSuccess:function(i){if(t.loadGameStatsEvent.putStatsEvent(_n.GET_MG_INFO,20,{}),t._loading(e,Sn.START,E.kSuccess,20),1===i.h5engine){if(!i.h5url)return p.e(t._kTag,"gameInfo no h5url",""),t.loadGameStatsEvent.putStatsEvent(_n.GET_MG_INFO,20,{desc:"gameInfo no h5url"}),t._loading(e,Sn.LOADING,E.kFail,20),void t.loadGameStatsEvent.reportStats();t.mGameInfo=i,t.mGameLargeModelCfg=i.gameLargeModelCfg,null!=t.mISudAiAgent&&t.mISudAiAgent.setGameLargeModelCfg(i.gameLargeModelCfg);var n=O.getAppId(),s=Date.now(),o="appId=".concat(n,"&userId=").concat(t._userId),a=h()(o),c="".concat(i.h5url,"?fstAppCtxId=").concat(t._fstAppCtxId,"&sid=").concat(a,"&t=").concat(s);r.getCfg().getTouchEnable()&&(c="".concat(c,"&touch=1"));var u=r.getCfg().getAdvancedConfigMap().get("enable_debug_game_log");(u||i.log_id)&&(i.log_id&&Vn.setLogId(i.log_id),t._sudFSMMGStateHandler.setMgLogListener((function(e,n){i.log_id&&Jn.collectLog(n),"gameError"===e&&i.log_id&&Jn.uploadLog(t._mgId),u&&t._fsmMg.onGameLog(n)})),c="".concat(c,"&log=1")),t._iframeUrl=c,t._bigLoadingPicUrl=i.bigLoadingPic,t._initIframe(e),t._sudFSMMGStateHandler.setDynamicConfig(JSON.stringify(i.dynamic_config))}else p.e(t._kTag,"This game does not support web engine",i),t._loading(e,Sn.START,E.kFail,20,(function(e){var t=document.createElement("div");t.setAttribute("style","\n position: absolute;\n top: 42%;\n left: 50%;\n color: #000;\n width: 200px;\n height: 30px;\n line-height: 30px;\n text-align: center;\n transform: translateX(-50%);\n background-color: #fff;\n border-radius: 4px;\n "),t.innerHTML="Please upgrade",e.append(t)})),t.loadGameStatsEvent.putStatsEvent(_n.GET_MG_INFO,20,{desc:"This game does not support web engine"}),t.loadGameStatsEvent.reportStats()},onFailure:function(i,n){t._loading(e,Sn.LOADING,E.kFail,20,null)}})},e.prototype.hideLoading=function(){var e,t="".concat(this._kTag,"_wrap_parent_loading"),i=document.getElementById(t);i&&(null===(e=i.parentNode)||void 0===e||e.removeChild(i))},e.prototype._loading=function(e,t,i,n,s){this._loadingFailed=i===E.kFail,this._gameCompeleted||(r.getCfg().getShowCustomLoading()?this.fsmMgOnGameLoadingProgress(t,i,n):this._createDefaultLoading(e,i,n,s))},e.prototype.fsmMgOnGameLoadingProgress=function(e,t,i){this._fsmMg.onGameLoadingProgress&&this._fsmMg.onGameLoadingProgress(e,t,i)},e.prototype._createDefaultLoading=function(e,t,i,n){var s="".concat(this._kTag,"_wrap_parent_loading"),o="".concat(this._kTag,"_wrap_loading"),a="".concat(this._kTag,"_loading"),c="".concat(this._kTag,"_loading_text"),u="".concat(this._kTag,"_bgloading"),p=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_loading,O.getLanguage()),d=this,h=document.getElementById(s);if(h){var l=document.getElementById(a),v=document.getElementById(c),f=document.getElementById(o);if(n&&n(h),t===E.kFail){if(v){var g=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_fail,O.getLanguage());v.style.color="#ff1a1a",v&&(v.innerHTML="".concat(g," (").concat(i,"%)").concat(E.kFail))}return f&&this._createReloadButton(f),d.loadGameStatsEvent.setRetCode(E.kFail),d.loadGameStatsEvent.setRetMsg(JSON.stringify({tag:"_createDefaultLoading",loading:"failed"})),void d.loadGameStatsEvent.reportStats()}if(r.getCfg().getShowLoadingGameBg()&&this._bigLoadingPicUrl&&!document.getElementById(u)){var m=document.createElement("img");m.id=u,m.src=this._bigLoadingPicUrl,m.setAttribute("style","\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n "),h.append(m)}l&&(l.style.left=-(100-i)+"%"),v&&(v.innerHTML="".concat(p,"(").concat(i,"%)"))}else{var S=document.createDocumentFragment();h=document.createElement("div");var y=document.createElement("div"),A=document.createElement("img"),b=document.createElement("img"),C=(v=document.createElement("div"),document.createElement("div"));y.id=o,A.id=a,h.id=s,h.setAttribute("style","\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n -webkit-transform:translateZ(1px);\n -moz-transform:translateZ(1px);\n -o-transform:translateZ(1px);\n transform:translateZ(1px);\n "),y.setAttribute("style","\n z-index: 100000;\n position: absolute;\n top: 50%; \n left: 50%;\n transform: translate(-50%, -50%);\n width: 270px;\n height: 56px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n "),C.setAttribute("style","\n z-index: 100001;\n position: absolute;\n height: 22px;\n top: 50%; \n transform: translateY(-50%);\n left: 17px;\n right: 17px;\n border-radius: 26px;\n overflow: hidden;\n "),C.append(A),b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAAC0CAMAAAAO0FvMAAAC/VBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzOjn34AAAAAAAAAAABLSELTzIeemna1spoAAADKw4Li26+bl3EAAADWzYjg15WcmXTZ0YlhX0hiX0kbGhk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xbeIruA4P1vk3pdPsvQaAK+3tX/DP6ofoOuok9GBYIACe2BBArxQnrZxmekeCNpFzoMlRrwUemGwxc4pIfTQhHYCAUazj3XtzqCwfm8oAaBo4BjgbOAXeDpPD/ehZorOschLodcB3oIEEmCKrKjc090zpZLJyxCSuDZ/IsCz4WSe0Ea7twN8YlV4wAOOQ+IE9FaTotzdZ0CgRxQwi0FWljN+UYagkEcNA78rJQesA+XgSAKsnCusrdsjQiBEkhBLySdC52FUg1cB3LAOtBDgggRaYIunKtpzYggHBCCJIBCWEgKsiAKhRj0t72rhuTAfYgXUxOh1s5VRAJkgPBDSwlJgbOgc0EUyjAoaUgOXIfmgSBIIlmEDOdq+ohIgAwIAe1yFXQsdBaIoXwbxCHnQR4IIkw4N6gXOiAEbEKTkMeCLFQOgzj0HqAhIgd6AAiICBJEES6cK+8dbckA4XGUEtDUIoVeQjmG1JAc5OEiYkcR6t25gra3BYPDFQJqq5ASxsyCNPQcUHKI0kN0aO2cK+/Q2kerCA6ijSj0EmhhMAftw4Yg0ErtnStulUGBHOSl0FkQhWIMqtNADgkCIpwb2Gtr1iZEPQVhqK3nIBASgWb16lxxswIDOZAEUegsDNcgDgKBZudGtWGTJNDCeAzS0HsQCDbJRJ+duH+3edTE/nQgCGM1yINAqMm5McmAJIy30Hcfg0CYhBvZXQakUIChaB1kwv20TwcnAINAAAQV0n/NgTyUIII+Yg6dqWGXL12tvPaE+kPrgjXCjFBucAQR5IcZ4P8ZXj84g6XqABFGKDJEk8aYgf2lCY5gVymKDKP23cAOzNj/BGfQd17/ZqDj8BkAAAAAAAAAAIDD3bPYHKSsGOBgAAAAAElFTkSuQmCC",b.setAttribute("style","z-index: 1;width: 100%; height: 56px; position: absolute;top: 0;left: 0;bottom: 0;right: 0"),v.setAttribute("style","z-index: 100002;font-family: PingFangSC-Medium, PingFang SC;\n width: 100%; font-size: 14px; height: 34px;line-height: 34px; position: absolute;top: 50%; left: 50%; transform: translate(-50%, -50%);text-align: center;color: #fff;"),v.innerHTML="".concat(p,"(").concat(i,"%)"),v.id=c,A.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAABACAMAAAAZDo5fAAAB2lBMVEX0nTb/zSbxmjz/00b/1EfsjCLpfhPwlCf/0DbznDn6uyr5uiXvjivzmzPwky7skjHujCnsjSzsiSjuojrsiSbxlTD6yEjsmjXsiynwkS3tiifylzL5xEfuiyjvlDXzmDLlagDxli/sljL2uEHwpjrsmDT9z0v4wEXslDL3vUPxqz32ukL0s0D4wUbxqDz+0Uz1tUHlcAT8zUvrkS/snDjwkCz8y0rzsUDymDHldAfyrT/lfgv0nDXrgR3skC/sjy7rgx/qfxrpexXlbALshCHqfRjmgAzwlzjsnTjpeRPpeBHmgw3ncAjncgrrkhDldgjvoBLmbgXukjL5vhn4uBjshiPocwz1shbunRLtnjnyqBTtmRH+yxz2tRbxpBP8xRvrlhDnhw39yBv5vBjoiw30rhXpjw77wRnkewnlcgbuji3leAnkcgXodg/mbAPlbQLskC7ujy/wkSzyljDlbgPzqxTznDXshyTkbgPsmzflewrodQ7ukDDzqhXyrT7zsD78y0jleQnqjCXphR3kawDunirqkiXtmh38yTLwpi3ngRbnhhX9zT/6xTz5wCz4vznpjh33uST0rx32uDHwpB/yqyT6wSL1tTnzsDLyrDf1syn8xyTojBX+yyiWqXNJAAAADHRSTlPVzsnV1Vh6fNLQW39CFizgAAAXPklEQVR42sSSsY7bMBBEL5AK49KrUu3OOMCFf8RXBjCQK/IbLFmQNNywEfSv2RxWSbijAWiCQYaV5Qfu45Avr18wwzhIxmGUDJ9r+3IAVP81PKCHYVTM8gqWqAR4QLdRyB/IiZAHTUWAH5QoUMkOD5qszwPuyfocSm6/H9DU8aRPozmwPlFzpH3CTe72yR6SBPnXl6/fIP6N5bgadH2jWQvuSLlgxweOtmp6rukLsJNm/zb9P2/z2PHSNaGLprzR7zZLOLKEVtRTzimBKGYtZnPO99cMi9lzrdV0FZqaDm0urW1WzO6neX6iTS9v9GbjzyzuCXT5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3a7WlfxKZ26iGvZr4wDIc007gT3VrGEPyJR9Q1nFa5Z0rMn7sEN4n2BNAPbhmuyDNdnHa7Jv4JF8O/09Wc5/mpzCeHqOIUQ3je/+8TXPMe11v3PNt/9cbbcRwgWLMgAAAABJRU5ErkJggg==",A.setAttribute("style","position: absolute;top: 50%; transform: translateY(-50%); left: -".concat(100-i,"%;border-radius: 26px;")),A.style.width="100%",S.append(v),S.append(b),S.append(C),y.append(S),h.append(y),e.append(h)}},e.prototype._createReloadButton=function(e){var t=this,i=document.createElement("button");i.setAttribute("style","\n cursor: pointer;\n border: 2px solid #000;\n font-family: PingFangSC-Medium, PingFang SC;\n background-color: #fff;\n border-radius: 36px;\n z-index: 100002;\n width: 104px;\n height: 36px;\n color: #1A1A1A;\n position: absolute;\n bottom: -60px;\n left: 50%;\n transform: translateX(-50%);\n touch-action: manipulation;\n outline: none;\n -webkit-tap-highlight-color:rgba(0,0,0,0);\n ");var n=O.getLocalizationData(O.getSdkLocalizationCfg().load_reload,O.getLanguage());i.onclick=function(){t.loadGame(t._rootElm)},i.innerHTML=n,e.append(i)},e.prototype._initIframe=function(e){var t=this,i=40;if(t._loading(e,Sn.START,E.kSuccess,i),t.loadGameStatsEvent.putStatsEvent(_n.DOWNLOAD_CORE,i,{desc:"_initIframe start"}),e&&e instanceof HTMLElement){var n=document.createElement("iframe");n.src=this._iframeUrl,n.width="100%",n.height="100%",n.setAttribute("referrerpolicy","origin-when-cross-origin"),n.onerror=function(){t.loadGameStatsEvent.setRetCode(E.kFail),t.loadGameStatsEvent.setRetMsg("onerror"),t.loadGameStatsEvent.reportStats(),t._loading(e,Sn.LOADING,E.kFail,85)},f({url:this._iframeUrl,fail:function(e){t.loadGameStatsEvent.setRetCode(E.kFail),t.loadGameStatsEvent.setRetMsg("iframe load failed"),t.loadGameStatsEvent.reportStats(),p.e(t._kTag,"iframe load failed",e)}}),e.appendChild(n),t.startDelayOnGameLoadCompletedTask(),t.startAi(),this._window=n;var r=setInterval((function(){if(t.receiveGameLoading)clearTimeout(r);else{var n=Math.floor(5*(Math.random()+1));(i+=n)>=85&&(i=85,clearTimeout(r)),t._loading(e,Sn.LOADING,E.kSuccess,i)}}),100)}else p.w(this._kTag,"不存在挂载元素,请传入挂载元素","")},e.prototype.startAi=function(){if(null===this.mSudGIPWebSocket){var e=!1;null!=this.mGameInfo.gameLargeModelCfg&&(e=this.mGameInfo.gameLargeModelCfg.enable_channel),p.d(this._kTag,"startAi enableChannel",e);var t=this;e&&(this.mSudGIPWebSocket=new Yn(O.getAppId(),this._userId,this._roomId,this._mgId,{onRoomChatMessage:function(e){null!=t.mISudAiAgent&&t.mISudAiAgent.onRoomChatMessage(e)}}),this.mSudGIPWebSocket.start())}},e.prototype._getFstAppCtxId=function(){return this._fstAppCtxId},e.prototype._onGameCustomCommand=function(e,t,i,n,r){if(this._window){var s=new In(this._window,e,n);this._sudFSMMGStateHandler.handleCmd(t,i,n,r,s)}else p.w(this._kTag,"H5SudFSTAPPImpl游戏iframe对象不存在","")},e.prototype._onAppCustomCommandEventCallback=function(e,t,i){var n=this._ctxIdListenerNotifyStateChangeMap.get(e);null!=n&&(n.onSuccess(i),this._ctxIdListenerNotifyStateChangeMap.delete(e))},e.prototype.getGameView=function(){return this._gameLayerView},e.prototype.startDelayOnGameLoadCompletedTask=function(){var e,t=this,i="".concat(this._kTag,"_loadGameTimeout"),n=document.getElementById(i);n&&(null===(e=n.parentNode)||void 0===e||e.removeChild(n));var r=1e3*O.getLoadMgPkgTimeout();this._startDelayOnGameLoadCompletedTimer&&clearTimeout(this._startDelayOnGameLoadCompletedTimer),this._startDelayOnGameLoadCompletedTimer=window.setTimeout((function(){t._startDelayOnGameLoadCompletedTimer&&clearTimeout(t._startDelayOnGameLoadCompletedTimer),t.delayOnGameLoadCompletedTask()}),r)},e.prototype.delayOnGameLoadCompletedTask=function(){var e=this._gameLoadPercent;this.isCanReportTimeoutEvent&&(this.isCanReportTimeoutEvent=!1,this.loadGameStatsEvent.reportTimeoutEvent(e)),this._createTimeoutView()},e.prototype._createTimeoutView=function(){var e=this,t="".concat(this._kTag,"_wrap_loading"),i="".concat(this._kTag,"_loadGameTimeout"),n=document.getElementById(t);if(n){var r=document.createElement("div");r.id=i,r.setAttribute("style","\n position: absolute;\n left: 0;\n right: 0;\n padding-top: 56px;\n width: 100%;\n ");var s=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_timeout,O.getLanguage()),o=document.createElement("div");o.setAttribute("style","\n position: absolute;\n bottom: -10px;\n left: 50%;\n transform: translateX(-50%);\n font-family: PingFangSC-Regular,PingFang SC;\n touch-action: manipulation;\n outline: none;\n z-index: 100002;\n color: #fff;\n width: 100%;\n text-align: center;\n "),o.innerHTML=s,r.append(o);var a=document.createElement("div");a.setAttribute("style","\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n bottom: -70px;\n display: table;\n width: 300px;\n ");var c=document.createElement("div");c.setAttribute("style","\n display: table-cell; \n text-align: center;\n ");var u=document.createElement("button");u.setAttribute("style","\n cursor: pointer;\n border: 1px solid #fff;\n width: 110px;\n height: 36px;\n font-size: 14px;\n font-family: PingFangSC-Regular,PingFang SC;\n background-color: transparent;\n border-radius: 0;\n z-index: 100002;\n color: #fff;\n margin: 0;\n padding: 4px 20px;\n touch-action: manipulation;\n outline: none;\n margin-right: 60px;\n ");var p=O.getLocalizationData(O.getSdkLocalizationCfg().load_reload,O.getLanguage());u.onclick=function(){e.receiveGameLoading=!1,e.loadGame(e._rootElm)},u.innerHTML=p,c.append(u);var d=document.createElement("button");d.setAttribute("style","\n cursor: pointer;\n width: 110px;\n height: 36px;\n font-size: 14px;\n font-family: PingFangSC-Regular,PingFang SC;\n background-color: #fff;\n border-radius: 0;\n z-index: 100002;\n color: #000;\n margin: 0;\n padding: 4px 20px;\n touch-action: manipulation;\n outline: none;\n ");var h=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_continue_wait,O.getLanguage());d.onclick=function(){var t;null===(t=r.parentNode)||void 0===t||t.removeChild(r),e.startDelayOnGameLoadCompletedTask()},d.innerHTML=h,c.append(d),a.append(c),r.append(a),n.append(r)}},e.prototype.destroyMG=function(){this._sudASR.stopASR(),this.notifyStateChange("a2ms-notify-destroy-game","{}",{onSuccess:function(){},onFailure:function(){}}),this.loadGameStatsEvent.setRetCode(E.DestroyGame),this.loadGameStatsEvent.setRetMsg("销毁游戏"),this.loadGameStatsEvent.reportStats();var e=this.mISudAiAgent;return null!=e&&(e.stopASR(),this.mISudAiAgent=null),!0},e.prototype.updateCode=function(e,t){this.notifyStateChange("a2ms-update-code",JSON.stringify({code:e}),t)},e.prototype.pushAudio=function(e,t){this._window&&null!=e&&t>0&&this._sudASR.pushAudio(e,t)},e.prototype.notifyStateChange=function(e,t,i){var n=this._idIDGenerator.genId();this._ctxIdListenerNotifyStateChangeMap.set(n,i),this._window&&Cn.sendAppCustomCommandEvent(this._window,n,e,t)},e.prototype.reloadMG=function(){r.getCfg().getShowCustomLoading()&&!0===this._loadingFailed&&(this.loadGameStatsEvent.reportStats(),this.loadGame(this._rootElm))},e.prototype.getAiAgent=function(){return null===this.mISudAiAgent&&(this.mISudAiAgent=new Fn,null!=this.mGameLargeModelCfg&&this.mISudAiAgent.setGameLargeModelCfg(this.mGameLargeModelCfg),this.mISudAiAgent.setMgId(this._mgId),this.mISudAiAgent.setRoomId(this._roomId),this.mISudAiAgent.setSenderUserId(this._userId),null!==this._loadMgParamModel&&this.mISudAiAgent.setLanguage(this._loadMgParamModel.language)),this.mISudAiAgent},e}(),er=function(){function e(){}return e.create=function(e,t){return function(e,t){return new $n(e,t)}(e,t)},e}(),tr=function(){function e(){this.kTag="Detector",this.step=1}return e.prototype.AddStep=function(){this.step++},e.prototype.isWebGLAvailable=function(){try{if(!window.WebGL2RenderingContext||!window.WebGLRenderingContext)return p.d(this.kTag,"WebGL is not supported",this.step),!1;this.AddStep();var e=document.createElement("canvas");return e.width=1,e.height=1,e.getContext("webgl")||e.getContext("experimental-webgl")?(p.d(this.kTag,"WebGL is supported",this.step),!0):(this.AddStep(),e.getContext("webgl2")||e.getContext("experimental-webgl2")?(p.d(this.kTag,"WebGL is supported",this.step),!0):(this.AddStep(),p.w(this.kTag,"WebGL not supported",this.step),!1))}catch(e){return p.w(this.kTag,"WebGL detection failed: error",e),!1}},e}(),ir=function(){function e(){}return e.handleMessageEvent=function(t){if(null!=t&&null!=t.data){var i=t.data;e.broadcastWindowOnMessage(i)}else e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&e.appSelfOnMeessage.map((function(e){return e(t)}))},e._registerCustomCommandEvent=function(){e.isRegisterEvent=!0,p.d(this.kTag,"_registerCustomCommandEvent",e.isRegisterEvent),window.onmessage&&e.appSelfOnMeessage.push(window.onmessage),window.addEventListener("message",e.handleMessageEvent)},e._destoryCommandEvent=function(){window.removeEventListener("message",e.handleMessageEvent),e.isRegisterEvent=!1,p.d(this.kTag,"destoryCommandEvent",e.isRegisterEvent),e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&window.addEventListener("message",(function(t){e.appSelfOnMeessage.map((function(e){return e(t)}))}))},e.getVersion=function(){return I.kVersion},e.getVersionAlias=function(){return I.kVersionAlias},e.getSudCfg=function(){return r.getCfg()},e.initSDK=function(e,t,i,n,r){p.i(this.kTag,"initSDK Parameters:","appId: ",e,"appKey: ",t,"bundleId: ",i,"isTestEnv: ",n),O.initSDK(e,t,i,n,r)},e.uninitSDK=function(e){O.uninitSDK(e)},e.getMGList=function(e){O.getMGList(e)},e.loadMG=function(e,t,i,n,r,s,o){if(p.i(this.kTag,"loadMG Parameters","userId: ",e,"roomId: ",t,"mgId: ",n,"code: ",i),null==e||null==t||null==i||null==n||null==s)return p.w(this.kTag,"Parameters cannot be null"),null;if("string"!=typeof e||"string"!=typeof t||"string"!=typeof n)return p.w(this.kTag,"userId, roomId, and mgId must be of string type. Please check if their types are correct"),null;if(""===e||""===t||""===i||""===n)return p.w(this.kTag,"Parameters cannot be empty string","userId: ".concat(e),"roomId: ".concat(t),"code: ".concat(i),"mgId: ".concat(n)),null;T.setUserId(e),O.setLanguage(r);var a=this._idIDGenerator.genId().toString(),c=er.create({parentElm:o,fstAppCtxId:a,userId:e,roomId:t,code:i,mgId:n,language:r},s);return this._ctxIdFSTAPPMap.set(a,c),this.isRegisterEvent||this._registerCustomCommandEvent(),c},e.destroyMG=function(t){if(null==t)return p.w(this.kTag,"destroyMG fstApp is invalid"),!1;var i=t._getFstAppCtxId();return e._ctxIdFSTAPPMap.delete(i),t.destroyMG(),e._destoryCommandEvent(),!0},e.prototype.setUserId=function(e){T.setUserId(e)},e.setLogLevel=function(e){p.setLogLevel(e)},e.setLogger=function(e){p.setLogger(e)},e.isWebGLAvailable=function(){return this._detector.isWebGLAvailable()},e.broadcastWindowOnMessage=function(t){if(t.msgTag===bn){var i=t.fstAppCtxId,n=e._ctxIdFSTAPPMap.get(i);null!=n?1===t.msgType?n._onGameCustomCommand(t.ctxId,t.cmd,t.param,t.state,t.dataJson):2===t.msgType&&n._onAppCustomCommandEventCallback(t.ctxId,t.state,t.dataJson):p.e(this.kTag,"No fstAPP")}else e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&e.appSelfOnMeessage.map((function(e){return e(t)}))},e.kTag="SudMGP",e._idIDGenerator=new s,e._detector=new tr,e._ctxIdFSTAPPMap=new Map,e.appSelfOnMeessage=[],e.isRegisterEvent=!1,e}();window.SudMGP=ir})(),n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SudMGP=t():e.SudMGP=t()}(this,(()=>(()=>{var e={560:function(e,t,i){var n;!function(r){"use strict";function s(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function o(e,t,i,n,r,o){return s((a=s(s(t,e),s(n,o)))<<(c=r)|a>>>32-c,i);var a,c}function a(e,t,i,n,r,s,a){return o(t&i|~t&n,e,t,r,s,a)}function c(e,t,i,n,r,s,a){return o(t&n|i&~n,e,t,r,s,a)}function u(e,t,i,n,r,s,a){return o(t^i^n,e,t,r,s,a)}function p(e,t,i,n,r,s,a){return o(i^(t|~n),e,t,r,s,a)}function h(e,t){var i,n,r,o,h;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var d=1732584193,l=-271733879,v=-1732584194,f=271733878;for(i=0;i<e.length;i+=16)n=d,r=l,o=v,h=f,d=a(d,l,v,f,e[i],7,-680876936),f=a(f,d,l,v,e[i+1],12,-389564586),v=a(v,f,d,l,e[i+2],17,606105819),l=a(l,v,f,d,e[i+3],22,-1044525330),d=a(d,l,v,f,e[i+4],7,-176418897),f=a(f,d,l,v,e[i+5],12,1200080426),v=a(v,f,d,l,e[i+6],17,-1473231341),l=a(l,v,f,d,e[i+7],22,-45705983),d=a(d,l,v,f,e[i+8],7,1770035416),f=a(f,d,l,v,e[i+9],12,-1958414417),v=a(v,f,d,l,e[i+10],17,-42063),l=a(l,v,f,d,e[i+11],22,-1990404162),d=a(d,l,v,f,e[i+12],7,1804603682),f=a(f,d,l,v,e[i+13],12,-40341101),v=a(v,f,d,l,e[i+14],17,-1502002290),d=c(d,l=a(l,v,f,d,e[i+15],22,1236535329),v,f,e[i+1],5,-165796510),f=c(f,d,l,v,e[i+6],9,-1069501632),v=c(v,f,d,l,e[i+11],14,643717713),l=c(l,v,f,d,e[i],20,-373897302),d=c(d,l,v,f,e[i+5],5,-701558691),f=c(f,d,l,v,e[i+10],9,38016083),v=c(v,f,d,l,e[i+15],14,-660478335),l=c(l,v,f,d,e[i+4],20,-405537848),d=c(d,l,v,f,e[i+9],5,568446438),f=c(f,d,l,v,e[i+14],9,-1019803690),v=c(v,f,d,l,e[i+3],14,-187363961),l=c(l,v,f,d,e[i+8],20,1163531501),d=c(d,l,v,f,e[i+13],5,-1444681467),f=c(f,d,l,v,e[i+2],9,-51403784),v=c(v,f,d,l,e[i+7],14,1735328473),d=u(d,l=c(l,v,f,d,e[i+12],20,-1926607734),v,f,e[i+5],4,-378558),f=u(f,d,l,v,e[i+8],11,-2022574463),v=u(v,f,d,l,e[i+11],16,1839030562),l=u(l,v,f,d,e[i+14],23,-35309556),d=u(d,l,v,f,e[i+1],4,-1530992060),f=u(f,d,l,v,e[i+4],11,1272893353),v=u(v,f,d,l,e[i+7],16,-155497632),l=u(l,v,f,d,e[i+10],23,-1094730640),d=u(d,l,v,f,e[i+13],4,681279174),f=u(f,d,l,v,e[i],11,-358537222),v=u(v,f,d,l,e[i+3],16,-722521979),l=u(l,v,f,d,e[i+6],23,76029189),d=u(d,l,v,f,e[i+9],4,-640364487),f=u(f,d,l,v,e[i+12],11,-421815835),v=u(v,f,d,l,e[i+15],16,530742520),d=p(d,l=u(l,v,f,d,e[i+2],23,-995338651),v,f,e[i],6,-198630844),f=p(f,d,l,v,e[i+7],10,1126891415),v=p(v,f,d,l,e[i+14],15,-1416354905),l=p(l,v,f,d,e[i+5],21,-57434055),d=p(d,l,v,f,e[i+12],6,1700485571),f=p(f,d,l,v,e[i+3],10,-1894986606),v=p(v,f,d,l,e[i+10],15,-1051523),l=p(l,v,f,d,e[i+1],21,-2054922799),d=p(d,l,v,f,e[i+8],6,1873313359),f=p(f,d,l,v,e[i+15],10,-30611744),v=p(v,f,d,l,e[i+6],15,-1560198380),l=p(l,v,f,d,e[i+13],21,1309151649),d=p(d,l,v,f,e[i+4],6,-145523070),f=p(f,d,l,v,e[i+11],10,-1120210379),v=p(v,f,d,l,e[i+2],15,718787259),l=p(l,v,f,d,e[i+9],21,-343485551),d=s(d,n),l=s(l,r),v=s(v,o),f=s(f,h);return[d,l,v,f]}function d(e){var t,i="",n=32*e.length;for(t=0;t<n;t+=8)i+=String.fromCharCode(e[t>>5]>>>t%32&255);return i}function l(e){var t,i=[];for(i[(e.length>>2)-1]=void 0,t=0;t<i.length;t+=1)i[t]=0;var n=8*e.length;for(t=0;t<n;t+=8)i[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return i}function v(e){var t,i,n="0123456789abcdef",r="";for(i=0;i<e.length;i+=1)t=e.charCodeAt(i),r+=n.charAt(t>>>4&15)+n.charAt(15&t);return r}function f(e){return unescape(encodeURIComponent(e))}function g(e){return function(e){return d(h(l(e),8*e.length))}(f(e))}function m(e,t){return function(e,t){var i,n,r=l(e),s=[],o=[];for(s[15]=o[15]=void 0,r.length>16&&(r=h(r,8*e.length)),i=0;i<16;i+=1)s[i]=909522486^r[i],o[i]=1549556828^r[i];return n=h(s.concat(l(t)),512+8*t.length),d(h(o.concat(n),640))}(f(e),f(t))}function S(e,t,i){return t?i?m(t,e):v(m(t,e)):i?g(e):v(g(e))}void 0===(n=function(){return S}.call(t,i,t,e))||(e.exports=n)}()},249:function(e,t,i){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==i.g&&i.g.crypto&&(n=i.g.crypto),!n)try{n=i(480)}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var i;return e.prototype=t,i=new e,e.prototype=null,i}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,i=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<r;s++){var o=i[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var a=0;a<r;a+=4)t[n+a>>>2]=i[a>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(r());return new u.init(t,e)}}),p=o.enc={},h=p.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var s=t[r>>>2]>>>24-r%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n+=2)i[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(i,t/2)}},d=p.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,n=[],r=0;r<i;r++){var s=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(i,t)}},l=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},v=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,n=this._data,r=n.words,s=n.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,p=e.min(4*c,s);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(r,h);i=r.splice(0,c),n.sigBytes-=p}return new u.init(i,p)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(a.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new f.HMAC.init(e,i).finalize(t)}}}),o.algo={});return o}(Math),n)},465:function(e,t,i){e.exports=i(249).enc.Hex},398:function(e,t,i){var n;e.exports=(n=i(249),i(783),i(824),n.HmacSHA1)},824:function(e,t,i){var n,r,s;e.exports=(r=(n=i(249)).lib.Base,s=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var i=e.blockSize,n=4*i;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),o=this._iKey=t.clone(),a=r.words,c=o.words,u=0;u<i;u++)a[u]^=1549556828,c[u]^=909522486;r.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})))},783:function(e,t,i){var n,r,s,o,a,c,u,p;e.exports=(r=(n=p=i(249)).lib,s=r.WordArray,o=r.Hasher,a=n.algo,c=[],u=a.SHA1=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var p=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=p<<1|p>>>31}var h=(n<<5|n>>>27)+a+c[u];h+=u<20?1518500249+(r&s|~r&o):u<40?1859775393+(r^s^o):u<60?(r&s|r&o|s&o)-1894007588:(r^s^o)-899497514,a=o,o=s,s=r<<30|r>>>2,r=n,n=h}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+s|0,i[3]=i[3]+o|0,i[4]=i[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(n+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=o._createHelper(u),n.HmacSHA1=o._createHmacHelper(u),p.SHA1)},480:()=>{},339:()=>{},108:()=>{},275:()=>{},505:()=>{},146:()=>{},173:()=>{},137:()=>{},592:()=>{}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";i.r(n),i.d(n,{ISudAPPD:()=>M,SudMGP:()=>ar});var e,t=function(){function e(){this._showLoadingGameBg=!0,this._showCustomLoading=!1,this._touchEnable=!1,this.advancedConfigMap=new Map}return e.prototype.getShowLoadingGameBg=function(){return this._showLoadingGameBg},e.prototype.setShowLoadingGameBg=function(e){this._showLoadingGameBg=e},e.prototype.getShowCustomLoading=function(){return this._showCustomLoading},e.prototype.setShowCustomLoading=function(e){this._showCustomLoading=e},e.prototype.getTouchEnable=function(){return this._touchEnable},e.prototype.setTouchEnable=function(e){this._touchEnable=e},e.prototype.getAdvancedConfigMap=function(){return this.advancedConfigMap},e}(),r=function(){function e(){}return e.getCfg=function(){return e._impl},e._impl=new t,e}(),s=function(){function e(){this._curId=0}return e.prototype.genId=function(){return++this._curId},e}(),o=function(){function e(){}return e.VERBOSE=2,e.DEBUG=3,e.INFO=4,e.WARN=5,e.ERROR=6,e.ASSERT=7,e}(),a=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},c=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r<s;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},u=function(){function e(){this.kTag="SudMGP",this._logLevel=o.DEBUG}return e.prototype.setLogLevel=function(e){this._logLevel=e},e.prototype.log=function(e,t,i){for(var n=[],r=3;r<arguments.length;r++)n[r-3]=arguments[r];var s=this.kTag;o.VERBOSE===e&&this._logLevel<=o.VERBOSE||o.DEBUG===e&&this._logLevel<=o.DEBUG?console.log.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.INFO===e&&this._logLevel<=o.INFO?console.info.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.WARN===e&&this._logLevel<=o.WARN?console.warn.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.ERROR===e&&this._logLevel<=o.ERROR?console.error.apply(console,c([s+" "+t+" "+i],a(n),!1)):o.ASSERT===e&&this._logLevel<=o.ASSERT&&console.assert.apply(console,c([s+" "+t,i],a(n),!1))},e}(),p=i(560),h=i.n(p),d=function(){return d=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},d.apply(this,arguments)},l=function(e){var t=e.url,i=e.method,n=e.data,r=e.params,s=e.success,o=e.fail,a=e.beforeSend,c=i.toLowerCase(),u=t,p=new XMLHttpRequest;if(p=new XMLHttpRequest){if(p){if(p.addHeader=function(e,t){p.setRequestHeader(e,t)},"get"===c&&r){var h=function(e){var t="",i=Object.keys(e).length,n=0;for(var r in e)t+=r+"="+e[r],t+=n<i-1?"&":"",n++;return t}(r);u+="?"+h}p.open(c,u,!0),p.setRequestHeader("content-type","application/json"),a&&a(p),"post"===c&&n?p.send(JSON.stringify(n)):p.send(),p.onreadystatechange=function(){var e=null==p?void 0:p.responseText;4===p.readyState&&(200===p.status?s&&s(e):o&&o(e))}}}else console.error("浏览器不支持XMLHttpRequest")},v=function(e){l(d({method:"get"},e))},f=new Uint8Array(16);function g(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(f)}const m=/^(?:[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,S=function(e){return"string"==typeof e&&m.test(e)};for(var y=[],b=0;b<256;++b)y.push((b+256).toString(16).substr(1));const A=function(e,t,i){var n=(e=e||{}).random||(e.rng||g)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(y[e[t+0]]+y[e[t+1]]+y[e[t+2]]+y[e[t+3]]+"-"+y[e[t+4]]+y[e[t+5]]+"-"+y[e[t+6]]+y[e[t+7]]+"-"+y[e[t+8]]+y[e[t+9]]+"-"+y[e[t+10]]+y[e[t+11]]+y[e[t+12]]+y[e[t+13]]+y[e[t+14]]+y[e[t+15]]).toLowerCase();if(!S(i))throw TypeError("Stringified UUID is invalid");return i}(n)};var w=function(){function e(){}return e.kVersion="1.3.0",e.kVersionAlias="0.0.0.0-h5",e}(),C=function(){function e(){}return e.getNetworkType=function(){try{var e=navigator.userAgent;if(!e)return this.NETWORK_UNKNOWN;var t="NetType/other",i=navigator.connection||navigator.mozConnection||navigator.webkitConnection;i&&(t=i.type?i.type:i.effectiveType);var n=e.match(/NetType\/\w+/);switch(n&&n.length&&(t=n[0]),t=t.toLowerCase().replace("nettype/","")){case"wifi":return this.NETWORK_WIFI;case"4g":return this.NETWORK_4G;case"3g":case"3gnet":return this.NETWORK_3G;case"2g":case"slow-2":return this.NETWORK_2G;default:return this.NETWORK_UNKNOWN}}catch(e){return this.NETWORK_UNKNOWN}},e.NETWORK_UNKNOWN=0,e.NETWORK_ETHERNET=1,e.NETWORK_2G=2,e.NETWORK_3G=3,e.NETWORK_4G=4,e.NETWORK_5G=5,e.NETWORK_WIFI=100,e.NETWORK_NO=999,e}(),I=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},R=function(){function e(e){this._tag="SudMGP",this._event="",this._event_id="",this._request_id="",this._user_id="",this._resp="",this._ret_code=0,this._ret_msg="success",this._mgId="",this._start_timestamp=0,this._extras=new Map,this.local_pkg=!1,this.local_core=!1,this.timeout_code=0,this.setEvent(e),this._start_timestamp=Date.now(),this.buildNewRequestId()}return e.prototype.getEvent=function(){return this._event},e.prototype.setEvent=function(e){this._event=e,this._event_id=T.event2EventId(e)},e.prototype.getRequestId=function(){return this._request_id},e.prototype.buildNewRequestId=function(){this._request_id=h()(A())},e.prototype.setResp=function(e){null!=e&&(this._resp=e)},e.prototype.getRetCode=function(){return this._ret_code},e.prototype.setRetCode=function(e){this._ret_code=e},e.prototype.setRetMsg=function(e){null!=e&&(this._ret_msg=e)},e.prototype.setMgId=function(e){this._mgId=e},e.prototype.putExtra=function(e,t){null!=e&&null!=t&&this._extras.set(e,t)},e.prototype.toString=function(){var e,t,i=Date.now(),n={tag:this._tag,app_id:O.getAppId(),mg_id:this._mgId,is_test_env:O.getIsTestEnv(),env_type:O.getEnvType(),sdk_version:w.kVersion,sdk_version_alias:w.kVersionAlias,et_is_dynamic:!1,sud_is_dynamic:!1,event:this._event,event_id:this._event_id,trace_id:O.getTraceId(),span_id:T.getSpanId(this._mgId),request_id:this._request_id,user_id:T.getUserId(),platform:O.kPlatformH5,bundle_id:O.getBundleID(),start_timestamp:this._start_timestamp,end_timestamp:i,cost_time:i-this._start_timestamp},r={};try{for(var s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this._extras),o=s.next();!o.done;o=s.next()){var a=I(o.value,2),c=a[0],u=a[1];r[c]=u}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return r.ret_msg=this._ret_msg,r.ret_code=this._ret_code,r.resp=this._resp,n.extras=r,n.ret_msg=this._ret_msg,n.ret_code=this._ret_code,n.device_brand=this.getUserAgent(),n.os_version=this.getUserAgent(),n.device_id=this.getUserAgent(),n.net_type=C.getNetworkType(),null!=this.local_core&&(n.local_pkg=this.local_pkg),null!=this.local_core&&(n.local_core=this.local_core),null!=this.timeout_code&&(n.timeout_code=this.timeout_code),JSON.stringify(n)},e.prototype.getUserAgent=function(){try{return navigator.userAgent}catch(e){return""}},e.prototype.setLocal_pkg=function(e){this.local_pkg=e},e.prototype.setLocal_core=function(e){this.local_core=e},e.prototype.setTimeout_code=function(e){this.timeout_code=e},e.kStatsEventGetFQSInfo="getFQSInfo",e.kStatsEventGetSDKToken="getSDKToken",e.kStatsEventGetMGInfo="getMGInfo",e.kStatsEventGetAuthMGInfo="getAuthMGInfo",e.kStatsEventGetMGList="getMGList",e.kStatsEventDownloadGameRuntime="checkoutGameRuntime",e.kStatsEventDownloadGamePkg="checkoutGamePkg",e.kStatsEventLoadGameFinished="loadGameFinished",e.kStatsEventMatchASRInfo="matchASRInfo",e.kStatsEventLoadGameTimeout="loadGameTimeout",e.kStatsEventGetGateToken="getGateToken",e.kStatsEventGetDoubaoToken="getDoubaoToken",e.kStatsEventIdGetFQSInfo="1d12a87cbee567f5764efeea2bc240dc",e.kStatsEventIdGetSDKToken="8ae34dba26951ae65f9d0a0559debc10",e.kStatsEventIdGetMGInfo="b7743119f3b53930606d342105bf928d",e.kStatsEventIdGetAuthMGInfo="0fd2883dc4033c0dfe50e3fd9a6770e5",e.kStatsEventIdGetMGList="53e30b7d1de26629170dfe2ff82272b8",e.kStatsEventIdDownloadGameRuntime="efe18913246663006e71b97c7f6b8f5d",e.kStatsEventIdDownloadGamePkg="0386896a3155b50ca86f8e7a5d6f7af2",e.kStatsEventIdLoadGameFinished="bf55eb46d866f04e98c2da2e4984b015",e.kStatsEventIdMatchASRInfo="378ee04c16891a9016931fdda9bedabd",e.kStatsEventIdLoadGameTimeout="0550fa93143b0bb01c512435af4b6e3c",e}(),T=function(){function e(){}return e.event2EventId=function(e){var t="";return e&&(t=this._statsEventIdMap.get(e)||""),t||(t="UNSPECIFIED"),t},e.genSpanId=function(e){var t=h()(A());this._statsSpanIdMap.set(e.toString(),t)},e.getSpanId=function(e){if(!e)return"";var t=this._statsSpanIdMap.get(e)||"";return null==t&&(t=""),t},e.removeSpanId=function(e){this._statsSpanIdMap.delete(e.toString())},e.getUserId=function(){return e.userId},e.setUserId=function(t){e.userId=t},e.setReportStatsEventListener=function(e){this._listener=e},e.report=function(e){this.runReport(e.getEvent(),e.getRetCode(),e.toString())},e.runReport=function(e,t,i){O.reportStats(i),null!=this._listener&&this._listener.onReportStatsEvent(e,t,i)},e.userId="",e._statsEventIdMap=(new Map).set(R.kStatsEventGetFQSInfo,R.kStatsEventIdGetFQSInfo).set(R.kStatsEventGetSDKToken,R.kStatsEventIdGetSDKToken).set(R.kStatsEventGetMGInfo,R.kStatsEventIdGetMGInfo).set(R.kStatsEventGetAuthMGInfo,R.kStatsEventIdGetAuthMGInfo).set(R.kStatsEventGetMGList,R.kStatsEventIdGetMGList).set(R.kStatsEventDownloadGameRuntime,R.kStatsEventIdDownloadGameRuntime).set(R.kStatsEventDownloadGamePkg,R.kStatsEventIdDownloadGamePkg).set(R.kStatsEventLoadGameFinished,R.kStatsEventIdLoadGameFinished).set(R.kStatsEventMatchASRInfo,R.kStatsEventIdMatchASRInfo).set(R.kStatsEventLoadGameTimeout,R.kStatsEventIdLoadGameTimeout),e._statsSpanIdMap=new Map,e}(),_=function(){function e(){}return e.toJson=function(e,t){return JSON.stringify({retCode:e,retMsg:t})},e.kSuccessJson='{"retCode":0, "retMsg":"success"}',e.kFailNotImplementJson='{"retCode":-1, "retMsg":"not implement"}',e.kSuccess=0,e.kFail=-1,e.EngineNotSupported=-10100,e.DOWNLOAD_TIMEOUT=-10302,e.ENGINE_LOAD_TIMEOUT=-10303,e.GAME_LOAD_TIMEOUT=-10304,e.DestroyGame=-10301,e}();function E(){try{return"undefined"!=typeof CompressionStream}catch(e){return!1}}var P=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,s=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},k=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r<s;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},D=function(){function e(){this.kTag="HttpService",this.reportStatsUrl="",this.getGateTokenUrl="",this.getDoubaoAsrUrl=null,this.reportFailedStatsCacheList=[],this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.getGateTokenUrl="",this.mgIdGameInfoMap=new Map}return e.prototype.getFQSInfoSize=function(){var t=O.getEnvType();return t===O.kEnvTypeDev?e.kGetFQSInfoDevBaseUrls.length:t===O.kEnvTypeFat?e.kGetFQSInfoFatBaseUrls.length:t===O.kEnvTypeSim?e.kGetFQSInfoSimBaseUrls.length:e.kGetFQSInfoProBaseUrls.length},e.prototype.getSDKToken=function(e,t,i,n){var r=this.getFQSInfoSize();this.getSDKTokenStepGetFQSInfo(e,t,i,n,1,r)},e.prototype.getSDKTokenStepGetFQSInfo=function(e,t,i,n,r,s){var o=this;this.getFQSInfo(e,i,r,{onSuccess:function(r){o.getSDKTokenUrl=r,o.getSDKTokenInternal(e,t,i,n)},onFailure:function(a,c){s>0&&r<s?o.getSDKTokenStepGetFQSInfo(e,t,i,n,r+1,s):n.onFailure(a,c)}})},e.prototype.getMGList=function(e){if(this.isInitSdkOk){var t={sdk_token:this.sdkToken,platform:O.getPlatform()},i=new R(R.kStatsEventGetMGList);this.doSudPost(this.getMGListUrl,t,i.getRequestId(),{onSuccess:function(t){var n=JSON.parse(t),r=n.ret_code,s=n.ret_msg,o=t;i.setRetCode(r),i.setRetMsg(s),T.report(i),e&&o&&r&&s&&(_.kSuccess===r?e.onSuccess(o):e.onFailure(r,s))},onFailure:function(t){var n=_.kFail,r=t.toString();i.setRetCode(n),i.setRetMsg(r),T.report(i),e.onFailure(n,r)}})}else e&&e.onFailure(-1,"请先调用initSDK成功")},e.prototype.getMGInfo=function(e,t){if(this.isInitSdkOk){var i=this,n=this.getCacheMGInfo(e),r=0;n||(r=n.clientVersion);var s={sdk_token:this.sdkToken,mg_id:Number(e),mg_id_str:e,client_version:r,platform:O.getPlatform()},o=this,a=new R(R.kStatsEventGetMGInfo);a.setMgId(e),this.doSudPost(this.getMGInfoUrl,s,a.getRequestId(),{onSuccess:function(n){var r=JSON.parse(n),s=r.ret_code,c=r.ret_msg;if(r.data&&r.data.mg_info){var u=r.data.mg_info,p={mgId:u.mg_id_str,name:O.getLocalizationData(u.name,O.getLanguage()),version:u.version,orientation:u.orientation,screenMode:u.screen_mode,url:u.url,h5url:u.h5url,appID:u.game_app_id,hash:u.hash,h5engine:u.h5engine,engine:u.engine,bigLoadingPic:O.getLocalizationData(u.big_loading_pic,O.getLanguage()),clientVersion:u.client_version,dynamic_config:u.dynamic_config,gameLargeModelCfg:u.game_large_model_cfg};if(r.data.log_id&&(p.log_id=r.data.log_id),a.setRetCode(s),a.setRetMsg(c),T.report(a),t)if(_.kSuccess===s)o.setCacheMGInfo(e,p),t.onSuccess(p);else{var h=o.getCacheMGInfo(e);h?t.onSuccess(h):t.onFailure(s,c)}}else V.e(i.kTag,"getMGInfo error: mgId ".concat(e),"errCode: "+s,"errMsg: "+c),t.onFailure(s,c)},onFailure:function(i){var n=_.kFail,r=i.toString();if(a.setRetCode(n),a.setRetMsg(r),T.report(a),t){var s=o.getCacheMGInfo(e);s?t.onSuccess(s):t.onFailure(n,r)}}})}else t&&t.onFailure(-1,"请先调用initSDK成功")},e.prototype.reportStats=function(e){var t=this;if(t.reportStatsUrl){var i=[];i.push(e),this.reportFailedStatsCacheList.length>0&&(i=k(k([],P(i),!1),P(this.reportFailedStatsCacheList),!1),this.reportFailedStatsCacheList=[]);for(var n=function(e){var n=i[e],s=h()(A());r.doSudPost(t.reportStatsUrl,JSON.parse(n),s,{onSuccess:function(e){var i=JSON.parse(e).ret_code;i!==_.kSuccess&&V.e(t.kTag,"reportStats server errcode="+i,"")},onFailure:function(){t.reportFailedStatsCacheList.push(n)}})},r=this,s=0;s<i.length;s++)n(s)}else this.reportFailedStatsCacheList.push(e)},e.prototype.addHeaders=function(t){var i=t.xhr,n=t.sudSDKRequestId;i.addHeader(e.kHeaderSudMGPSDKVersion,w.kVersion),i.addHeader(e.kHeaderSudMGPSDKVersionAlias,w.kVersionAlias),i.addHeader(e.kHeaderSudMGPSDKPlatform,O.getPlatform()),i.addHeader(e.kHeaderSudMGPSDKAppId,O.getAppId()),i.addHeader(e.kHeaderSudMGPSDKBundleId,O.getBundleID()),i.addHeader(e.kHeaderSudMGPSDKTraceId,O.getTraceId()),i.addHeader(e.kHeaderSudMGPSDKRequestId,n),i.addHeader(e.kHeaderSudMGPSDKUserId,T.getUserId()),i.addHeader(e.kHeaderSudMGPSDKEtIsDynamic,!0)},e.prototype.commonPost=function(e,t,i,n){var r=h()(A());this.doSudPost(e,t,r,i,n)},e.prototype.doSudPost=function(e,t,i,n,r){var s=this,o=(r||{}).beforeSend;l(d({method:"post"},{data:t,url:e,beforeSend:function(e){o&&o(e),s.addHeaders({xhr:e,sudSDKRequestId:i})},success:function(e){V.v(s.kTag,"post success res:",e),n.onSuccess(e)},fail:function(e){V.v(s.kTag,"post fail res:",e),n.onFailure(e)}}))},e.prototype.doSudGet=function(e,t,i){var n=this;v({url:e,beforeSend:function(e){n.addHeaders({xhr:e,sudSDKRequestId:t})},success:function(e){V.v(n.kTag,"get success res:",e),i.onSuccess(e)},fail:function(e){V.v(n.kTag,"get fail res:",e),i.onFailure(e)}})},e.prototype.doUpload=function(e){var t=this,i=e.url,n=e.formData,r=e.requestId,s=e.beforeSend,o=e.listener;(function(e){var t=e.url,i=e.formData,n=e.success,r=e.fail,s=e.beforeSend,o=new XMLHttpRequest;o?(o.addHeader=function(e,t){o.setRequestHeader(e,t)},o.open("POST",t,!0),s&&s(o),o.onreadystatechange=function(){var e=null==o?void 0:o.responseText;4===o.readyState&&(200===o.status?n&&n(e):r&&r(e))},o.send(i)):console.error("浏览器不支持XMLHttpRequest")})(d({},{formData:n,url:i,beforeSend:function(e){s&&s(e),t.addHeaders({xhr:e,sudSDKRequestId:r})},success:function(e){V.v(t.kTag,"upload success res:",e),o.onSuccess(e)},fail:function(e){V.v(t.kTag,"upload fail res:",e),o.onFailure(e)}}))},e.prototype.clearCache=function(){this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.reportStatsUrl="",this.getGateTokenUrl="",this.mgIdGameInfoMap.clear()},e.prototype.getFQSInfoBaseUrl=function(t){var i=O.getEnvType();return i===O.kEnvTypeDev?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoDevBaseUrls,t):i===O.kEnvTypeFat?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoFatBaseUrls,t):i===O.kEnvTypeSim?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoSimBaseUrls,t):this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoProBaseUrls,t)},e.prototype.getFQSInfoBaseUrlByArray=function(e,t){if(null==e||0===e.length)return null;var i=0;return t>0&&(i=t-1),i<e.length?e[i]:null},e.prototype.getFQSInfo=function(e,t,i,n){if(this.getSDKTokenUrl.length>0)n.onSuccess(this.getSDKTokenUrl);else{O.genTraceId();var r=this.getFQSInfoBaseUrl(i)+h()(e),s=new R(R.kStatsEventGetFQSInfo),o=this;this.doSudGet(r,s.getRequestId(),{onSuccess:function(e){var t={ret_code:_.kSuccess,ret_msg:"success",url:JSON.parse(e).url};s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),T.report(s),o.handleGetFQSInfoResp(t,t.url,n)},onFailure:function(e){var t={ret_code:_.kFail,ret_msg:e.toString()};s.setResp(""),s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),T.report(s),o.handleGetFQSInfoResp(t,"",n)}})}},e.prototype.handleGetFQSInfoResp=function(e,t,i){if(void 0!==i)if(t.length>0)i.onSuccess(t);else{var n="getFQSInfo fail appId=".concat(O.getAppId()," isTestEnv=",O.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," null == getSDKTokenUrl || getSDKTokenUrl.isEmpty() ",e.ret_msg);i.onFailure(e.ret_code,n)}},e.prototype.getSDKTokenInternal=function(e,t,i,n){if(this.isInitSdkOk)n&&n.onSuccess();else{var r=this.getSDKTokenUrl,s=O.getBundleID(),o=new R(R.kStatsEventGetSDKToken),a={app_id:e,app_key:t,bundle_id:s,platform:O.getPlatform(),is_test_env:i,sdk_version:w.kVersion},c=this;this.doSudPost(r,a,o.getRequestId(),{onSuccess:function(e){var t=JSON.parse(e);c.handleInitSDKCb(t,n),o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),T.report(o)},onFailure:function(e){var t={ret_code:_.kFail,ret_msg:e.toString()};o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),c.handleInitSDKCb(t,n),T.report(o)}})}},e.prototype.handleInitSDKCb=function(e,t){if(t)if(0===e.ret_code){var i=e.data;this.sdkToken=i.sdk_token,this.getMGListUrl=i.sdk_api_cfg.mg_list_url,this.getMGInfoUrl=i.sdk_api_cfg.mg_info_url,this.reportStatsUrl=i.sdk_api_cfg.report_url,this.getGateTokenUrl=i.sdk_api_cfg.gate_token_url;var n=i.large_model_cfg;n&&n.dou_bao_rtss_cfg&&(i.large_model_cfg.dou_bao_rtss_cfg.access_key=function(e){if(!e)return e;try{var t=function(e){if("function"==typeof atob){for(var t=atob(e),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}return Buffer.from(e,"base64")}(e),i=function(e){if(!e||0===e.length)return e;for(var t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e[i]^255&i;return t}(t);return new TextDecoder("utf-8").decode(i)}catch(t){return e}}(i.large_model_cfg.dou_bao_rtss_cfg.access_key)),i.model_api_cfg&&i.model_api_cfg.volc_sts_token_url&&(this.getDoubaoAsrUrl=i.model_api_cfg.volc_sts_token_url),O.setGetSDKTokenResp(e),this.isInitSdkOk=!0,t.onSuccess()}else{var r="getSDKToken fail appId=".concat(O.getAppId()," isTestEnv=",O.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," ",e.ret_msg);t.onFailure(e.ret_code,r)}},e.prototype.getCacheMGInfo=function(e){return this.mgIdGameInfoMap.get(e)||{}},e.prototype.setCacheMGInfo=function(e,t){this.mgIdGameInfoMap.set(e,t)},e.prototype.setHeaderAuthorization=function(e){e.addHeader("Authorization","Bearer "+this.sdkToken)},e.prototype.getDoubaoAsrToken=function(e){if(null!==e){var t=new R(R.kStatsEventGetDoubaoToken);if(this.getDoubaoAsrUrl){var i=this;this.doSudPost(this.getDoubaoAsrUrl,null,t.getRequestId(),{onSuccess:function(i){var n=JSON.parse(i),r=n.ret_code,s=n.ret_msg;t.setRetCode(r),t.setRetMsg(s),T.report(t),e&&e.onSuccess(n)},onFailure:function(i){var n=_.kFail,r=i.toString();t.setRetCode(n),t.setRetMsg(r),T.report(t),e.onFailure(i)}},{beforeSend:function(e){i.setHeaderAuthorization(e)}})}else V.e(this.kTag,"getDoubaoAsrToken url is no config")}},e.prototype.getGateToken=function(e,t){if(null!==e&&null!==t){var i=new R(R.kStatsEventGetGateToken),n={app_id:e.app_id,uid:e.uid},r=this;this.doSudPost(this.getGateTokenUrl,n,i.getRequestId(),{onSuccess:function(e){var n=JSON.parse(e),r=n.ret_code,s=n.ret_msg;i.setRetCode(r),i.setRetMsg(s),T.report(i),t&&t.onSuccess(n)},onFailure:function(e){var n=_.kFail,r=e.toString();i.setRetCode(n),i.setRetMsg(r),T.report(i),t.onFailure(n,r)}},{beforeSend:function(e){r.setHeaderAuthorization(e)}})}},e.prototype.sendRoomMessage=function(e,t){if(null!=e&&null!=t){var i=h()(A()),n=e.metrics,r={message_id:i,mg_id:e.mgId,room_id:e.roomId,message_type:e.messageType,sender:{uid:e.senderUserId,nickname:e.senderNickName},content:e.content,timestamp:Date.now(),metrics:n?{asr_duration:n.asr_duration,end_time:n.end_time,log_id:n.log_id,start_time:n.start_time}:null},s=this,o=O.getRoomMessageUrl(),a=h()(A());this.doSudPost(o,r,a,{onSuccess:function(){t&&t.onSuccess()},onFailure:function(e){var i=_.kFail,n=e.toString();t&&t.onFailure(i,n)}},{beforeSend:function(e){s.setHeaderAuthorization(e)}})}},e.kGetFQSInfoDevBaseUrls=["https://dev-fqs.sudden.ltd/","https://dev-fqs.sud.ltd/","https://dev-fqs.sudcdn.cloud/"],e.kGetFQSInfoFatBaseUrls=["https://fat-fqs.sudden.ltd/","https://fat-fqs.sud.ltd/","https://fat-fqs.sudcdn.cloud/"],e.kGetFQSInfoSimBaseUrls=["https://sim-fqs.sudden.ltd/","https://sim-fqs.sud.ltd/","https://sim-fqs.sudcdn.cloud/"],e.kGetFQSInfoProBaseUrls=["https://fqs.sudden.ltd/","https://fqs.sud.ltd/","https://fqs.sudcdn.cloud/"],e.kHeaderSudMGPSDKVersion="sud-sdk-version",e.kHeaderSudMGPSDKVersionAlias="sud-sdk-version-alias",e.kHeaderSudMGPSDKPlatform="sud-sdk-platform",e.kHeaderSudMGPSDKAppId="sud-sdk-app-id",e.kHeaderSudMGPSDKBundleId="sud-sdk-bundle-id",e.kHeaderSudMGPSDKRequestId="sud-sdk-request-id",e.kHeaderSudMGPSDKTraceId="sud-sdk-trace-id",e.kHeaderSudMGPSDKUserId="sud-sdk-user-id",e.kHeaderSudMGPSDKEtIsDynamic="sud-sdk-et-is-dynamic",e.kHeaderSudMGPSDKSignature="sud-sdk-signature",e}(),M=function(){function e(){}return e.e=function(e){O.getEnvType()!==e&&O.clearCache(),O.setEnvType(e)},e}(),O=function(){function e(){}return e.initSDK=function(t,i,n,r,s){if(t&&0!==t.length&&i&&0!==i.length){var o=e.getEnvType(),a=e.getIsTestEnv();e.setIsTestEnv(r);var c=e.getEnvType();e.sAppId===t&&e.sAppKey===i&&o===c&&a===r||e.httpService.clearCache(),e.sAppId=t,e.sAppKey=i,e.sBundleId=n,e.sBundleId||(e.sBundleId=""),e.httpService.getSDKToken(t,i,r,s)}else s&&s.onFailure(1,"Parameters cannot be null or empty")},e.uninitSDK=function(t){e.httpService.clearCache(),t&&t.onSuccess()},e.clearCache=function(){e.httpService.clearCache()},e.getMGList=function(t){e.httpService.getMGList(t)},e.getMGInfo=function(t,i){e.httpService.getMGInfo(t,i)},e.reportStats=function(t){e.httpService.reportStats(t)},e.getIsTestEnv=function(){return e.sIsTestEnv},e.setIsTestEnv=function(t){e.sIsTestEnv=t,(e.getEnvType()===e.kEnvTypePro||e.getEnvType()===e.kEnvTypeSim)&&(t?e.setEnvType(e.kEnvTypeSim):e.setEnvType(e.kEnvTypePro))},e.getEnvType=function(){return e.sEnvType},e.setEnvType=function(t){e.sEnvType=t},e.setLanguage=function(t){e.sLangCountryCode=t},e.getLanguage=function(){return e.sLangCountryCode},e.getAppId=function(){return e.sAppId},e.getPlatform=function(){return e.kPlatformH5},e.getBundleID=function(){return e.sBundleId},e.setGetSDKTokenResp=function(t){e.sGetSDKTokenResp=t},e.getSdkLocalizationCfg=function(){return e.sGetSDKTokenResp.data.sdk_localization_cfg},e.getMgApiCfg=function(){return e.sGetSDKTokenResp.data.mg_api_cfg},e.getMgApiCfgJson=function(){return JSON.stringify(e.sGetSDKTokenResp.data.mg_api_cfg)},e.getOnlyTestText=function(){return null!=this.sLangCountryCode&&"zh"===this.sLangCountryCode.substring(0,2)?"zh-CN"===this.sLangCountryCode?"仅供测试":"僅供測試":"Only Test"},e.genTraceId=function(){e.sTraceId=h()(A())},e.getTraceId=function(){return e.sTraceId},e.getAppKey=function(){return e.sAppKey},e.getLocalizationData=function(e,t){if(void 0===t&&(t="default"),!e||!e.hasOwnProperty(t))return"";var i=e[t];return void 0!==i?i:""},e.getAsrLoadList=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_rtss_cfg&&null!=this.sGetSDKTokenResp.data.sdk_rtss_cfg.asr_load_list?this.sGetSDKTokenResp.data.sdk_rtss_cfg.asr_load_list:[]},e.getAzureASRTextLanguageList=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data&&null!=e.data.sdk_rtss_cfg&&null!=e.data.sdk_rtss_cfg.microsoft_rtss_cfg?e.data.sdk_rtss_cfg.microsoft_rtss_cfg.asr_text_language_list:["zh-CN"]},e.getAzureASRNumberLanguageList=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data&&null!=e.data.sdk_rtss_cfg&&null!=e.data.sdk_rtss_cfg.microsoft_rtss_cfg?e.data.sdk_rtss_cfg.microsoft_rtss_cfg.asr_number_language_list:["zh-CN"]},e.getSdkRtssCfg=function(){var e=this.sGetSDKTokenResp;return null!=e&&null!=e.data?e.data.sdk_rtss_cfg:null},e.getLoadMgPkgTimeout=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data?this.sGetSDKTokenResp.data.load_mg_pkg_time_out:10},e.getGateWsUrl=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_api_cfg?this.sGetSDKTokenResp.data.sdk_api_cfg.gate_ws_url:null},e.getUploadUrl=function(){return null!=this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.sdk_api_cfg?this.sGetSDKTokenResp.data.sdk_api_cfg.upload_url:null},e.getRoomMessageUrl=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.model_api_cfg?this.sGetSDKTokenResp.data.model_api_cfg.room_message_url:null},e.getReportLargeModelDurationUrl=function(){return null!=this.sGetSDKTokenResp&&null!=this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.report_api_cfg&&null!=this.sGetSDKTokenResp.data.report_api_cfg.report_llm_asr_url?this.sGetSDKTokenResp.data.report_api_cfg.report_llm_asr_url:null},e.getDoubaoRtssCfg=function(){return null!==this.sGetSDKTokenResp&&null!==this.sGetSDKTokenResp.data&&null!=this.sGetSDKTokenResp.data.large_model_cfg?this.sGetSDKTokenResp.data.large_model_cfg.dou_bao_rtss_cfg:null},e.sendRoomMessage=function(e,t,i,n,r,s,o){var a={mgId:e,roomId:t,messageType:i,senderUserId:n,senderNickName:r,content:s,metrics:o};this.httpService.sendRoomMessage(a,{onSuccess:function(){},onFailure:function(){}})},e.getHttpService=function(){return this.httpService},e.httpService=new D,e.sIsTestEnv=!1,e.sLangCountryCode="zh-CN",e.kEnvTypePro=1,e.kEnvTypeSim=2,e.kEnvTypeFat=3,e.kEnvTypeDev=4,e.kPlatformIOS=1,e.kPlatformAndroid=2,e.kPlatformH5=3,e.sEnvType=e.kEnvTypePro,e.sAppId="",e.sAppKey="",e.sBundleId="",e.sTraceId="",e}(),L=i(398),x=i.n(L),G=i(465),z=i.n(G),N=function(){function e(){}return e.buildSignature=function(e,t){var i=e+"&"+t+"&"+O.getPlatform()+"&"+O.getBundleID();return x()(i,O.getAppKey()).toString(z())},e.setLogId=function(e){this.logId=e},e.saveLogIdToLocal=function(){localStorage.setItem(e.SaveLogTag,this.logId)},e.getLocalLogId=function(){return localStorage.getItem(e.SaveLogTag)},e.getLogId=function(){return this.logId},e.isLogIdUpload=function(){return this.getLogId()===this.getLocalLogId()},e.uploadFile=function(e,t,i,n,r){var s=this;null===t&&(t=""),null===n&&(n=""),null===r&&(r="");var o=new FormData;o.append("file",i,"".concat(this.logId)),o.append("app_id",n),o.append("mg_id",r),V.d(this.kTag,"upload Id",this.getLogId(),this.getLocalLogId()),this.isLogIdUpload()||O.getHttpService().doUpload({url:e,formData:o,requestId:t,beforeSend:function(e){e.setRequestHeader(D.kHeaderSudMGPSDKSignature,s.buildSignature(t,n))},listener:{onSuccess:function(){s.saveLogIdToLocal()},onFailure:function(){}}})},e.uploadSdkLog=function(e){var t=O.getUploadUrl();if(!t)return!1;this.uploadFile(t,e.requestId,e.file,e.appId,e.mgId+"")},e.kTag="SudReportLogUtils",e.SaveLogTag="SudReportLog_LogId",e.logId=localStorage.getItem(e.SaveLogTag)||"",e}(),U=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},B=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};const F=function(){function e(){}return e.withLock=function(e){return U(this,void 0,void 0,(function(){var t,i;return B(this,(function(n){switch(n.label){case 0:return t=this.lock,this.lock=new Promise((function(e){return i=e})),[4,t];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,e()];case 3:return[2,n.sent()];case 4:return i(),[7];case 5:return[2]}}))}))},e.isSupported=function(){return!!window.indexedDB},e.init=function(){return U(this,void 0,void 0,(function(){var e,t,i=this;return B(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.isSupported()?((e=indexedDB.open(this.dbName,1)).onupgradeneeded=function(){try{var t=e.result;t.objectStoreNames.contains(i.logStore)||t.createObjectStore(i.logStore,{keyPath:"id",autoIncrement:!0}),t.objectStoreNames.contains(i.metaStore)||t.createObjectStore(i.metaStore,{keyPath:"key"}).add({key:"totalSize",value:0})}catch(e){V.w(i.kTag,"onupgradeneeded 异常",e)}},[4,new Promise((function(t){e.onsuccess=function(){return U(i,void 0,void 0,(function(){var i,n,r,s,o,a,c,u;return B(this,(function(p){switch(p.label){case 0:return p.trys.push([0,10,11,12]),this.db=e.result,i=this,[4,this.getMetaSize()];case 1:i.totalSize=p.sent(),this.initialized=!0,p.label=2;case 2:p.trys.push([2,7,8,9]),n=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.queue),r=n.next(),p.label=3;case 3:return r.done?[3,6]:(s=r.value,[4,this.addLog(s.level,s.message,s.timestamp)]);case 4:p.sent(),p.label=5;case 5:return r=n.next(),[3,3];case 6:return[3,9];case 7:return o=p.sent(),c={error:o},[3,9];case 8:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(c)throw c.error}return[7];case 9:return this.queue=[],[3,12];case 10:return a=p.sent(),V.w(this.kTag,"init flush 内存队列异常",a),[3,12];case 11:return t(),[7];case 12:return[2]}}))}))},e.onerror=function(){V.w(i.kTag,"init 失败",e.error),t()}}))]):(V.d(this.kTag,"当前浏览器不支持 IndexedDB,日志功能不可用"),[2]);case 1:return n.sent(),[3,3];case 2:return t=n.sent(),V.w(this.kTag,"init 异常",t),[3,3];case 3:return[2]}}))}))},e.addLog=function(e,t,i){return U(this,void 0,void 0,(function(){var n,r,s,o,a=this;return B(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),n=null!=i?i:Date.now(),r={level:e,message:t,timestamp:n},this.initialized?this.db?(s=new Blob([JSON.stringify(r)]).size)>this.maxSize?[2]:[4,this.withLock((function(){return U(a,void 0,void 0,(function(){var e,t,i=this;return B(this,(function(n){switch(n.label){case 0:return n.trys.push([0,12,,13]),this.totalSize+s>this.maxSize?[4,this.deleteOldestUntilFreeSpace(s).catch((function(){}))]:[3,2];case 1:n.sent(),n.label=2;case 2:e=0,n.label=3;case 3:if(!(e<2))return[3,11];n.label=4;case 4:return n.trys.push([4,6,,10]),[4,new Promise((function(e,t){var n=i.db.transaction([i.logStore,i.metaStore],"readwrite"),o=n.objectStore(i.logStore),a=n.objectStore(i.metaStore);o.add({level:r.level,message:r.message,timestamp:Date.now()}),a.put({key:"totalSize",value:i.totalSize+s}),n.oncomplete=function(){i.totalSize+=s,e()},n.onabort=function(){return t(n.error||new Error("Transaction aborted"))},n.onerror=function(){return t(n.error||new Error("Transaction error"))}}))];case 5:return n.sent(),[3,11];case 6:return t=n.sent(),0!==e||"AbortError"!==(null==t?void 0:t.name)&&"QuotaExceededError"!==(null==t?void 0:t.name)&&!/quota|abort|quotaexceeded/i.test((null==t?void 0:t.message)||"")?[3,8]:[4,this.deleteOldestUntilFreeSpace(s).catch((function(){}))];case 7:return n.sent(),[3,10];case 8:return[3,11];case 9:return[3,10];case 10:return e++,[3,3];case 11:return[3,13];case 12:return n.sent(),[3,13];case 13:return[2]}}))}))}))]:[2]:(this.queue.push(r),[2]);case 1:return c.sent(),[3,3];case 2:return o=c.sent(),V.d(this.kTag,"addLog 外部异常",o),[3,3];case 3:return[2]}}))}))},e.deleteOldestUntilFreeSpace=function(e){return U(this,void 0,void 0,(function(){var t,i=this;return B(this,(function(n){return this.db?(t=0,[2,new Promise((function(n,r){var s=i.db.transaction([i.logStore,i.metaStore],"readwrite"),o=s.objectStore(i.logStore),a=s.objectStore(i.metaStore),c=o.openCursor();c.onsuccess=function(r){var u=r.target.result,p=function(){if(!u||i.totalSize+e-t<=i.maxSize){var r=Math.max(0,i.totalSize-t);return a.put({key:"totalSize",value:r}),void(s.oncomplete=function(){i.totalSize=r,n(t)})}var c=u.value,p=new Blob([JSON.stringify(c)]).size;o.delete(u.primaryKey),t+=p,u.continue()};u&&p(),c.onsuccess=function(e){u=e.target.result,p()}},c.onerror=function(){return r(c.error)}}))]):[2,0]}))}))},e.getAllLogs=function(){return U(this,void 0,void 0,(function(){var e=this;return B(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.initialized?[3,2]:[4,this.init()];case 1:t.sent(),t.label=2;case 2:return this.db?[4,new Promise((function(t){var i=e.db.transaction(e.logStore,"readonly").objectStore(e.logStore).getAll();i.onsuccess=function(){V.d(e.kTag,"当前日志大小: ".concat((e.totalSize/1024).toFixed(2)," KB")),t(i.result)},i.onerror=function(){return t([])}}))]:[2,[]];case 3:return[2,t.sent()];case 4:return t.sent(),[2,[]];case 5:return[2]}}))}))},e.getMetaSize=function(){return U(this,void 0,void 0,(function(){var e=this;return B(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.db?[4,new Promise((function(t){var i=e.db.transaction(e.metaStore,"readonly").objectStore(e.metaStore).get("totalSize");i.onsuccess=function(){var e,n;return t(null!==(n=null===(e=i.result)||void 0===e?void 0:e.value)&&void 0!==n?n:0)},i.onerror=function(){return t(0)}}))]:[2,0];case 1:return[2,t.sent()];case 2:return t.sent(),[2,0];case 3:return[2]}}))}))},e.setMetaSize=function(e){return U(this,void 0,void 0,(function(){var t=this;return B(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.db?[4,new Promise((function(i){var n=t.db.transaction(t.metaStore,"readwrite");n.objectStore(t.metaStore).put({key:"totalSize",value:e}),n.oncomplete=function(){return i()},n.onerror=function(){return i()}}))]:[2];case 1:case 2:return i.sent(),[3,3];case 3:return[2]}}))}))},e.clearLogs=function(){return U(this,void 0,void 0,(function(){var e=this;return B(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.db?[4,new Promise((function(t){var i=e.db.transaction([e.logStore,e.metaStore],"readwrite").objectStore(e.logStore).clear();i.onsuccess=function(){return U(e,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return this.totalSize=0,[4,this.setMetaSize(0)];case 1:return e.sent(),t(),[2]}}))}))},i.onerror=function(){return t()}}))]:[2];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},e.kTag="LogSystem",e.dbName="SudLogDB",e.logStore="logs",e.metaStore="meta",e.db=null,e.maxSize=5242880,e.totalSize=0,e.initialized=!1,e.queue=[],e.lock=Promise.resolve(),e}();var H=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},K=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},j=function(){function e(){}return e.init=function(){F.init()},e.collectLog=function(e,t){F.addLog(e,t)},e.compressBlob=function(e){return H(this,void 0,void 0,(function(){var t,i,n,r;return K(this,(function(s){switch(s.label){case 0:if(t=E(),V.i(this.KTag,"compressBlob canGzipCompress",t),!t)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),i=new CompressionStream("gzip"),n=e.stream().pipeThrough(i),[4,new Response(n).blob()];case 2:return r=s.sent(),V.d(this.KTag,"compressBlob success"),[2,r];case 3:return s.sent(),V.d(this.KTag,"compressBlob fail"),[2,e];case 4:return[3,6];case 5:return[2,e];case 6:return[2]}}))}))},e.formatValue=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Error)return"Error: ".concat(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e.formatValue).join(" ");try{return JSON.stringify(t,(function(e,t){return"bigint"==typeof t?t.toString()+"n":t instanceof RegExp?t.toString():t}))}catch(e){return"[Unserializable Object: ".concat(e,"]")}},e.getLogFile=function(){return H(this,void 0,void 0,(function(){var e;return K(this,(function(t){switch(t.label){case 0:return[4,F.getAllLogs()];case 1:return e=t.sent(),[2,new Blob([JSON.stringify(e)],{type:"application/octet-stream"})]}}))}))},e.uploadLog=function(e){return H(this,void 0,void 0,(function(){var t,i,n,r;return K(this,(function(s){switch(s.label){case 0:return N.isLogIdUpload()?[2]:[4,this.getLogFile()];case 1:return t=s.sent(),[4,this.compressBlob(t)];case 2:return i=s.sent(),n=O.getAppId(),r=h()(A()),N.uploadSdkLog({requestId:r,file:i,appId:n,mgId:e}),[2]}}))}))},e.KTag="ReportLogTask",e}(),q=function(){return q=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},q.apply(this,arguments)},V=function(){function e(){}return e.setLogLevel=function(t){e._impl.setLogLevel(t)},e.setLogger=function(t){null!=t&&(e._impl=t)},e.v=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];j.collectLog("".concat(this.Tag," VERBOSE"),q({tag:t,msg:i},n)),e._impl.log(o.VERBOSE,t,i,n)},e.d=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];j.collectLog("".concat(this.Tag," DEBUG"),q({tag:t,msg:i},n)),e._impl.log(o.DEBUG,t,i,n)},e.i=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];j.collectLog("".concat(this.Tag," INFO"),q({tag:t,msg:i},n)),e._impl.log(o.INFO,t,i,n)},e.w=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];j.collectLog("".concat(this.Tag," WARN"),q({tag:t,msg:i},n)),e._impl.log(o.WARN,t,i,n)},e.e=function(t,i){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];j.collectLog("".concat(this.Tag," ERROR"),q({tag:t,msg:i},n)),e._impl.log(o.ERROR,t,i,n)},e.Tag="SudMGP",e._impl=new u,e}(),W=function(){function e(e,t,i,n,r,s){this.isHit=e,this.keyWord=t,this.text=i,this.wordType=n,this.keyWordList=r,this.numberList=s}return e.prototype.toJson=function(){return JSON.stringify({isHit:this.isHit,keyWord:this.keyWord,text:this.text,wordType:this.wordType,keyWordList:this.keyWordList,numberList:this.numberList})},e.getState=function(){return"app_common_self_text_hit"},e}(),X=function(){return X=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},X.apply(this,arguments)},J=function(){function e(e,t){this.WORD_TYPE_TEXT="text",this.WORD_TYPE_NUMBER="number",this.mgCommonGameASR={WORD_TYPE_TEXT:this.WORD_TYPE_TEXT,WORD_TYPE_NUMBER:this.WORD_TYPE_NUMBER,isOpen:!1,wordList:[],wordLanguage:"",wordType:this.WORD_TYPE_TEXT,isCloseConnHitted:!0,enableIsHit:!0,enableIsReturnText:!0},this.hitKeywordSet=new Set,this.paramModel=e,this.context=t}return e.prototype.startASR=function(e){this.hitKeywordSet.clear(),this.context&&this.context.startASR(e)},e.prototype.stopASR=function(){this.hitKeywordSet.clear(),this.context&&this.context.stopASR()},e.prototype.handleGameASR=function(t){var i;if(V.d(e._TAG,"handleGameASR:",t),!t)return this.mgCommonGameASR=null,void this.stopASR();var n=JSON.parse(t);if(t)if(this.mgCommonGameASR=X(X({},this.mgCommonGameASR),n),null===(i=this.mgCommonGameASR)||void 0===i?void 0:i.isOpen){if(!this.isSupportWordType(n.wordType))return;if(n.wordType===this.WORD_TYPE_TEXT&&!this.isValidLanguage(this.paramModel.supportTextLanguageList,n.wordLanguage))return;if(n.wordType===this.WORD_TYPE_NUMBER&&!this.isValidLanguage(this.paramModel.supportNumberLanguageList,n.wordLanguage))return;this.startASR(n.wordLanguage)}else this.stopASR();else this.stopASR()},e.prototype.isSupportWordType=function(e){return this.WORD_TYPE_TEXT===e||this.WORD_TYPE_NUMBER===e},e.prototype.isValidLanguage=function(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n&&n===t)return!0}return!1},e.prototype.onRecognizedResult=function(e){if(e){var t=this.mgCommonGameASR;null!==t&&t.isOpen&&(t.wordType===this.WORD_TYPE_TEXT?(t.enableIsHit&&this.textMatch(e,t),t.enableIsReturnText&&this.notifyAppCommonSelfTextHit(!1,null,e,t.wordType,null,null)):t.wordType===this.WORD_TYPE_NUMBER&&(t.enableIsHit&&this.numberMatch(e,t),t.enableIsReturnText&&this.numberConver(e,t)))}},e.prototype.numberConver=function(e,t){var i=e.match(/[0-9]+/g),n=null==i?void 0:i.map(Number);n&&(null==n?void 0:n.length)&&this.notifyAppCommonSelfTextHit(!1,null,null,t.wordType,null,n)},e.prototype.textMatch=function(e,t){var i=this;if(null!==t.wordList&&0!==t.wordList.length&&null!=e){var n=e.toLowerCase();t.wordList.map((function(e){if(null!==e&&n.includes(e.toLowerCase())){i.hitKeywordSet.add(e);var r=[e];i.notifyAppCommonSelfTextHit(!0,e,null,t.wordType,r,null)}}));for(var r=!0,s=0;s<t.wordList.length;s++){var o=t.wordList[s];if(!this.hitKeywordSet.has(o)){r=!1;break}}r&&this.stopASR()}},e.prototype.numberMatch=function(e,t){var i=this;if(null!==t.wordList&&0!==t.wordList.length&&null!=e){t.wordList.map((function(n){if(null!==n&&e.includes(n)){i.hitKeywordSet.add(n);var r=[n],s=[parseInt(n)];i.notifyAppCommonSelfTextHit(!0,n,null,t.wordType,r,s)}}));for(var n=!0,r=0;r<t.wordList.length;r++){var s=t.wordList[r];if(!this.hitKeywordSet.has(s)){n=!1;break}}n&&this.stopASR()}},e.prototype.notifyAppCommonSelfTextHit=function(t,i,n,r,s,o){var a=new W(t,i,n,r,s,o),c=this.paramModel.iSudFSTAPP;null!==c&&(c.notifyStateChange(W.getState(),a.toJson(),{onSuccess:function(){},onFailure:function(){}}),V.d(e._TAG,"notifyAppCommonSelfTextHit: ",a.toJson()))},e._TAG="BaseRealSudASRImpl",e}();const Q="OutputFormat",Z="CancellationErrorCode",Y="ServiceProperties",$="ForceDictation";class ee{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(ee.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfNullOrTooLong(e,t,i){if(ee.throwIfNullOrUndefined(e,t),(""+e).length>i)throw new Error("throwIfNullOrTooLong:"+t+" (more than "+i.toString()+" characters)")}static throwIfNullOrTooShort(e,t,i){if(ee.throwIfNullOrUndefined(e,t),(""+e).length<i)throw new Error("throwIfNullOrTooShort:"+t+" (less than "+i.toString()+" characters)")}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(ee.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const i of e)ee.throwIfNullOrWhitespace(i,t)}static throwIfFileDoesNotExist(e,t){ee.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}var te,ie,ne,re,se,oe,ae,ce;!function(e){e[e.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",e[e.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",e[e.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",e[e.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",e[e.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",e[e.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",e[e.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",e[e.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",e[e.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",e[e.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",e[e.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",e[e.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",e[e.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",e[e.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",e[e.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",e[e.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",e[e.Speech_SessionId=16]="Speech_SessionId",e[e.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",e[e.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",e[e.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",e[e.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",e[e.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",e[e.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",e[e.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",e[e.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",e[e.CancellationDetails_Reason=25]="CancellationDetails_Reason",e[e.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",e[e.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",e[e.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",e[e.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",e[e.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",e[e.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",e[e.Speech_SegmentationSilenceTimeoutMs=32]="Speech_SegmentationSilenceTimeoutMs",e[e.SpeechServiceConnection_EnableAudioLogging=33]="SpeechServiceConnection_EnableAudioLogging",e[e.SpeechServiceConnection_LanguageIdMode=34]="SpeechServiceConnection_LanguageIdMode",e[e.SpeechServiceConnection_RecognitionEndpointVersion=35]="SpeechServiceConnection_RecognitionEndpointVersion",e[e.SpeechServiceConnection_SpeakerIdMode=36]="SpeechServiceConnection_SpeakerIdMode",e[e.SpeechServiceResponse_ProfanityOption=37]="SpeechServiceResponse_ProfanityOption",e[e.SpeechServiceResponse_PostProcessingOption=38]="SpeechServiceResponse_PostProcessingOption",e[e.SpeechServiceResponse_RequestWordLevelTimestamps=39]="SpeechServiceResponse_RequestWordLevelTimestamps",e[e.SpeechServiceResponse_StablePartialResultThreshold=40]="SpeechServiceResponse_StablePartialResultThreshold",e[e.SpeechServiceResponse_OutputFormatOption=41]="SpeechServiceResponse_OutputFormatOption",e[e.SpeechServiceResponse_TranslationRequestStablePartialResult=42]="SpeechServiceResponse_TranslationRequestStablePartialResult",e[e.SpeechServiceResponse_RequestWordBoundary=43]="SpeechServiceResponse_RequestWordBoundary",e[e.SpeechServiceResponse_RequestPunctuationBoundary=44]="SpeechServiceResponse_RequestPunctuationBoundary",e[e.SpeechServiceResponse_RequestSentenceBoundary=45]="SpeechServiceResponse_RequestSentenceBoundary",e[e.Conversation_ApplicationId=46]="Conversation_ApplicationId",e[e.Conversation_DialogType=47]="Conversation_DialogType",e[e.Conversation_Initial_Silence_Timeout=48]="Conversation_Initial_Silence_Timeout",e[e.Conversation_From_Id=49]="Conversation_From_Id",e[e.Conversation_Conversation_Id=50]="Conversation_Conversation_Id",e[e.Conversation_Custom_Voice_Deployment_Ids=51]="Conversation_Custom_Voice_Deployment_Ids",e[e.Conversation_Speech_Activity_Template=52]="Conversation_Speech_Activity_Template",e[e.Conversation_Request_Bot_Status_Messages=53]="Conversation_Request_Bot_Status_Messages",e[e.Conversation_Agent_Connection_Id=54]="Conversation_Agent_Connection_Id",e[e.SpeechServiceConnection_Host=55]="SpeechServiceConnection_Host",e[e.ConversationTranslator_Host=56]="ConversationTranslator_Host",e[e.ConversationTranslator_Name=57]="ConversationTranslator_Name",e[e.ConversationTranslator_CorrelationId=58]="ConversationTranslator_CorrelationId",e[e.ConversationTranslator_Token=59]="ConversationTranslator_Token",e[e.PronunciationAssessment_ReferenceText=60]="PronunciationAssessment_ReferenceText",e[e.PronunciationAssessment_GradingSystem=61]="PronunciationAssessment_GradingSystem",e[e.PronunciationAssessment_Granularity=62]="PronunciationAssessment_Granularity",e[e.PronunciationAssessment_EnableMiscue=63]="PronunciationAssessment_EnableMiscue",e[e.PronunciationAssessment_Json=64]="PronunciationAssessment_Json",e[e.PronunciationAssessment_Params=65]="PronunciationAssessment_Params",e[e.SpeakerRecognition_Api_Version=66]="SpeakerRecognition_Api_Version"}(te||(te={}));class ue{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let i;i="string"==typeof e?e:te[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===i)return this.privValues[e];if(void 0!==t)return String(t)}setProperty(e,t){let i;i="string"==typeof e?e:te[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===i)return void(this.privValues[e]=t);this.privKeys.push(i),this.privValues.push(t)}clone(){const e=new ue;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const i=this.getProperty(t);e.setProperty(t,i)}}))}get keys(){return this.privKeys}}!function(e){e[e.Simple=0]="Simple",e[e.Detailed=1]="Detailed"}(ie||(ie={})),function(e){e[e.Masked=0]="Masked",e[e.Removed=1]="Removed",e[e.Raw=2]="Raw"}(ne||(ne={})),function(e){e[e.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",e[e.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",e[e.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",e[e.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",e[e.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",e[e.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",e[e.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",e[e.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",e[e.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",e[e.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",e[e.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",e[e.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",e[e.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",e[e.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",e[e.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",e[e.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",e[e.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",e[e.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",e[e.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",e[e.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",e[e.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",e[e.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",e[e.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",e[e.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",e[e.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",e[e.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",e[e.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",e[e.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",e[e.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",e[e.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",e[e.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",e[e.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",e[e.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",e[e.Raw22050Hz16BitMonoPcm=33]="Raw22050Hz16BitMonoPcm",e[e.Riff22050Hz16BitMonoPcm=34]="Riff22050Hz16BitMonoPcm",e[e.Raw44100Hz16BitMonoPcm=35]="Raw44100Hz16BitMonoPcm",e[e.Riff44100Hz16BitMonoPcm=36]="Riff44100Hz16BitMonoPcm"}(re||(re={}));class pe{constructor(){}static fromSubscription(e,t){ee.throwIfNullOrWhitespace(e,"subscriptionKey"),ee.throwIfNullOrWhitespace(t,"region");const i=new he;return i.setProperty(te.SpeechServiceConnection_Region,t),i.setProperty(te.SpeechServiceConnection_IntentRegion,t),i.setProperty(te.SpeechServiceConnection_Key,e),i}static fromEndpoint(e,t){ee.throwIfNull(e,"endpoint");const i=new he;return i.setProperty(te.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&i.setProperty(te.SpeechServiceConnection_Key,t),i}static fromHost(e,t){ee.throwIfNull(e,"hostName");const i=new he;return i.setProperty(te.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&i.setProperty(te.SpeechServiceConnection_Key,t),i}static fromAuthorizationToken(e,t){ee.throwIfNull(e,"authorizationToken"),ee.throwIfNullOrWhitespace(t,"region");const i=new he;return i.setProperty(te.SpeechServiceConnection_Region,t),i.setProperty(te.SpeechServiceConnection_IntentRegion,t),i.authorizationToken=e,i}close(){}}class he extends pe{constructor(){super(),this.privProperties=new ue,this.speechRecognitionLanguage="en-US",this.outputFormat=ie.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(te.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(te.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(te.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(te.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(te.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(te.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(te.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(te.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(te.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return ie[this.privProperties.getProperty(Q,void 0)]}set outputFormat(e){this.privProperties.setProperty(Q,ie[e])}get endpointId(){return this.privProperties.getProperty(te.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(te.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){ee.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,i,n){this.setProperty(te[te.SpeechServiceConnection_ProxyHostName],e),this.setProperty(te[te.SpeechServiceConnection_ProxyPort],t),this.setProperty(te[te.SpeechServiceConnection_ProxyUserName],i),this.setProperty(te[te.SpeechServiceConnection_ProxyPassword],n)}setServiceProperty(e,t){const i=JSON.parse(this.privProperties.getProperty(Y,"{}"));i[e]=t,this.privProperties.setProperty(Y,JSON.stringify(i))}setProfanity(e){this.privProperties.setProperty(te.SpeechServiceResponse_ProfanityOption,ne[e])}enableAudioLogging(){this.privProperties.setProperty(te.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(te.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty($,"true")}clone(){const e=new he;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(te.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(te.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(te.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(te.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return re[this.privProperties.getProperty(te.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(te.SpeechServiceConnection_SynthOutputFormat,re[e])}}class de{constructor(e,t){this.privActualSampleRate=e,this.privDesiredSampleRate=t}encode(e){const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const i=2*t.length,n=new ArrayBuffer(i),r=new DataView(n);return this.floatTo16BitPCM(r,0,t),n}setString(e,t,i){for(let n=0;n<i.length;n++)e.setUint8(t+n,i.charCodeAt(n))}floatTo16BitPCM(e,t,i){for(let n=0;n<i.length;n++,t+=2){const r=Math.max(-1,Math.min(1,i[n]));e.setInt16(t,r<0?32768*r:32767*r,!0)}}downSampleAudioFrame(e,t,i){if(!e)return null;if(i===t||i>t)return e;const n=t/i,r=Math.round(e.length/n),s=new Float32Array(r);let o=0,a=0;for(;a<r;){const t=Math.round((a+1)*n);let i=0,r=0;for(;o<t&&o<e.length;)i+=e[o++],r++;s[a++]=i/r}return s}}class le{constructor(e){this.privStopInputOnRelease=e}record(e,t,i){const n=new de(e.sampleRate,16e3),r=e.createMediaStreamSource(t),s=()=>{const s=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(i){t=2048;let n=e.sampleRate;for(;t<16384&&n>=32e3;)t<<=1,n>>=1;return e.createScriptProcessor(t,1,1)}})();s.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(i&&!i.isClosed){const e=n.encode(t);e&&i.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},r.connect(s),s.connect(e.destination),this.privMediaResources={scriptProcessorNode:s,source:r,stream:t}};if(e.audioWorklet){if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const s=new AudioWorkletNode(e,"speech-processor");s.port.onmessage=e=>{const t=e.data;if(i&&!i.isClosed){const e=n.encode(t);e&&i.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},r.connect(s),s.connect(e.destination),this.privMediaResources={scriptProcessorNode:s,source:r,stream:t}})).catch((()=>{s()}))}else try{s()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}}releaseMediaResources(e){this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))}setWorkletUrl(e){this.privSpeechProcessorScript=e}}!function(e){e[e.Interactive=0]="Interactive",e[e.Conversation=1]="Conversation",e[e.Dictation=2]="Dictation"}(se||(se={})),function(e){e[e.Simple=0]="Simple",e[e.Detailed=1]="Detailed"}(oe||(oe={}));class ve{constructor(e,t){this.privSpeechServiceConfig=e||new fe(new ge(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10),this.privLanguageIdMode=t.getProperty(te.SpeechServiceConnection_LanguageIdMode,void 0)}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===se.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=se[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==se.Interactive}get languageIdMode(){return this.privLanguageIdMode}get autoDetectSourceLanguages(){return this.parameters.getProperty(te.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get recognitionEndpointVersion(){return this.parameters.getProperty(te.SpeechServiceConnection_RecognitionEndpointVersion,void 0)}get sourceLanguageModels(){const e=[];let t=!1;if(void 0!==this.autoDetectSourceLanguages)for(const i of this.autoDetectSourceLanguages.split(",")){const n=i+te.SpeechServiceConnection_EndpointId.toString(),r=this.parameters.getProperty(n,void 0);void 0!==r?(e.push({language:i,endpoint:r}),t=!0):e.push({language:i,endpoint:""})}return t?e:void 0}get maxRetryCount(){return this.privMaxRetryCount}}class fe{constructor(e){this.context=e}serialize(){return JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const i in t)Object.hasOwnProperty.call(t,i)&&(e[i&&i.charAt(0).toLowerCase()+i.substring(1)]=t[i]);return e}return t}))}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class ge{constructor(e){this.system=new me,this.os=e}}class me{constructor(){this.name="SpeechSDK",this.version="1.27.0",this.build="JavaScript",this.lang="JavaScript"}}class Se{constructor(e,t,i){this.platform=e,this.name=t,this.version=i}}!function(e){e.Bluetooth="Bluetooth",e.Wired="Wired",e.WiFi="WiFi",e.Cellular="Cellular",e.InBuilt="InBuilt",e.Unknown="Unknown"}(ae||(ae={})),function(e){e.Phone="Phone",e.Speaker="Speaker",e.Car="Car",e.Headset="Headset",e.Thermostat="Thermostat",e.Microphones="Microphones",e.Deskphone="Deskphone",e.RemoteControl="RemoteControl",e.Unknown="Unknown",e.File="File",e.Stream="Stream"}(ce||(ce={}));const ye={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let be;const Ae=new Uint8Array(16);function we(){if(!be&&(be="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return be(Ae)}const Ce=[];for(let e=0;e<256;++e)Ce.push((e+256).toString(16).slice(1));const Ie=function(e,t,i){if(ye.randomUUID&&!t&&!e)return ye.randomUUID();const n=(e=e||{}).random||(e.rng||we)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return function(e,t=0){return(Ce[e[t+0]]+Ce[e[t+1]]+Ce[e[t+2]]+Ce[e[t+3]]+"-"+Ce[e[t+4]]+Ce[e[t+5]]+"-"+Ce[e[t+6]]+Ce[e[t+7]]+"-"+Ce[e[t+8]]+Ce[e[t+9]]+"-"+Ce[e[t+10]]+Ce[e[t+11]]+Ce[e[t+12]]+Ce[e[t+13]]+Ce[e[t+14]]+Ce[e[t+15]]).toLowerCase()}(n)},Re=()=>Ie().replace(new RegExp("-","g"),"").toUpperCase();class Te extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class _e extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class Ee extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}class Pe{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=e}onEvent(e){if(this.isDisposed())throw new Ee("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)}attach(e){const t=Re();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}}attachListener(e){return this.attach((t=>e.onEvent(t)))}attachConsoleListener(e){return this.privConsoleListener&&this.privConsoleListener.detach(),this.privConsoleListener=this.attach((t=>e.onEvent(t))),this.privConsoleListener}isDisposed(){return this.privIsDisposed}dispose(){this.privEventListeners=null,this.privIsDisposed=!0}get metadata(){return this.privMetadata}}var ke,De,Me;!function(e){e[e.None=0]="None",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(ke||(ke={}));class Oe{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function Le(e,t,i){e.then((e=>{try{t&&t(e)}catch(e){if(i)try{if(e instanceof Error){const t=e;i(t.name+": "+t.message)}else i(e)}catch(e){}}}),(e=>{if(i)try{if(e instanceof Error){const t=e;i(t.name+": "+t.message)}else i(e)}catch(e){}}))}(Me=De||(De={}))[Me.Debug=0]="Debug",Me[Me.Info=1]="Info",Me[Me.Warning=2]="Warning",Me[Me.Error=3]="Error",Me[Me.None=4]="None";class xe{constructor(e,t){this.privName=e,this.privEventId=Re(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,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}}class Ge extends xe{constructor(e,t,i=De.Info){super(e,i),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class ze extends Ge{constructor(e){super("AudioSourceInitializingEvent",e)}}class Ne extends Ge{constructor(e){super("AudioSourceReadyEvent",e)}}class Ue extends Ge{constructor(e){super("AudioSourceOffEvent",e)}}class Be extends Ge{constructor(e,t){super("AudioSourceErrorEvent",e,De.Error),this.privError=t}get error(){return this.privError}}class Fe extends Ge{constructor(e,t,i){super(e,t),this.privAudioNodeId=i}get audioNodeId(){return this.privAudioNodeId}}class He extends Fe{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class Ke extends Fe{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class je extends Fe{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class qe extends Fe{constructor(e,t,i){super("AudioStreamNodeErrorEvent",e,t),this.privError=i}get error(){return this.privError}}class Ve{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.privList=[],e)for(const t of e)this.privList.push(t)}get(e){return this.throwIfDisposed(),this.privList[e]}first(){return this.get(0)}last(){return this.get(this.length()-1)}add(e){this.throwIfDisposed(),this.insertAt(this.privList.length,e)}insertAt(e,t){this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)}removeFirst(){return this.throwIfDisposed(),this.removeAt(0)}removeLast(){return this.throwIfDisposed(),this.removeAt(this.length()-1)}removeAt(e){return this.throwIfDisposed(),this.remove(e,1)[0]}remove(e,t){this.throwIfDisposed();const i=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),i}clear(){this.throwIfDisposed(),this.remove(0,this.length())}length(){return this.throwIfDisposed(),this.privList.length}onAdded(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}}onRemoved(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}}onDisposed(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}}join(e){return this.throwIfDisposed(),this.privList.join(e)}toArray(){const e=Array();return this.privList.forEach((t=>{e.push(t)})),e}any(e){return this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0}all(e){return this.throwIfDisposed(),this.where(e).length()===this.length()}forEach(e){this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)}select(e){this.throwIfDisposed();const t=[];for(let i=0;i<this.privList.length;i++)t.push(e(this.privList[i],i));return new Ve(t)}where(e){this.throwIfDisposed();const t=new Ve;for(let i=0;i<this.privList.length;i++)e(this.privList[i],i)&&t.add(this.privList[i]);return t}orderBy(e){this.throwIfDisposed();const t=this.toArray().sort(e);return new Ve(t)}orderByDesc(e){return this.throwIfDisposed(),this.orderBy(((t,i)=>e(i,t)))}clone(){return this.throwIfDisposed(),new Ve(this.toArray())}concat(e){return this.throwIfDisposed(),new Ve(this.privList.concat(e.toArray()))}concatArray(e){return this.throwIfDisposed(),new Ve(this.privList.concat(e))}isDisposed(){return null==this.privList}dispose(e){this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))}throwIfDisposed(){if(this.isDisposed())throw new Ee("List",this.privDisposeReason)}triggerSubscriptions(e){if(e)for(const t in e)t&&e[t]()}}var We,Xe=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};!function(e){e[e.Dequeue=0]="Dequeue",e[e.Peek=1]="Peek"}(We||(We={}));class Je{constructor(e){this.privPromiseStore=new Ve,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=e||new Ve,this.privDetachables=[],this.privSubscribers=new Ve,this.privDetachables.push(this.privList.onAdded((()=>this.drain())))}enqueue(e){this.throwIfDispose(),this.enqueueFromPromise(new Promise((t=>t(e))))}enqueueFromPromise(e){this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(()=>{}))}dequeue(){this.throwIfDispose();const e=new Oe;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:We.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new Oe;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:We.Peek}),this.drain()),e.promise}length(){return this.throwIfDispose(),this.privList.length()}isDisposed(){return null==this.privSubscribers}drainAndDispose(e,t){return Xe(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const i=this.privSubscribers;if(i){for(;i.length()>0;)i.removeFirst().deferral.resolve(void 0);this.privSubscribers===i&&(this.privSubscribers=i)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach((t=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return Xe(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}drain(){if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const i=e.removeFirst();if(i.type===We.Peek)i.deferral.resolve(t.first());else{const e=t.removeFirst();i.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}}throwIfDispose(){if(this.isDisposed()){if(this.privDisposeReason)throw new _e(this.privDisposeReason);throw new Ee("Queue")}if(this.privIsDisposing)throw new _e("Queue disposing")}}var Qe;class Ze{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||Re(),this.privReaderQueue=new Je}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}read(){if(this.privIsReadEnded)throw new _e("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>{return t=this,i=void 0,r=function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new Je)}throwIfClosed(){if(this.privIsWriteEnded)throw new _e("Stream closed")}}class Ye extends Ze{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const i=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),n=new Uint8Array(this.privNextBufferToWrite),r=new Uint8Array(e.buffer.slice(t,i+t));n.set(r,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=i,t+=i,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class $e{static setEventSource(e){if(!e)throw new Te("eventSource");$e.privInstance=e}static get instance(){return $e.privInstance}}$e.privInstance=new Pe,function(e){e[e.PCM=1]="PCM",e[e.MuLaw=2]="MuLaw",e[e.Siren=3]="Siren",e[e.MP3=4]="MP3",e[e.SILKSkype=5]="SILKSkype",e[e.OGG_OPUS=6]="OGG_OPUS",e[e.WEBM_OPUS=7]="WEBM_OPUS",e[e.ALaw=8]="ALaw",e[e.FLAC=9]="FLAC",e[e.OPUS=10]="OPUS"}(Qe||(Qe={}));class et{static getDefaultInputFormat(){return tt.getDefaultInputFormat()}static getWaveFormat(e,t,i,n){return new tt(e,t,i,n)}static getWaveFormatPCM(e,t,i){return new tt(e,t,i)}}class tt extends et{constructor(e=16e3,t=16,i=1,n=Qe.PCM){super();let r=!0;switch(n){case Qe.PCM:this.formatTag=1;break;case Qe.ALaw:this.formatTag=6;break;case Qe.MuLaw:this.formatTag=7;break;default:r=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=i,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),r){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new tt}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}setString(e,t,i){for(let n=0;n<i.length;n++)e.setUint8(t+n,i.charCodeAt(n))}}var it=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class nt{constructor(e,t,i,n){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.privOutputChunkSize=nt.AUDIOFORMAT.avgBytesPerSec/10,this.privId=i||Re(),this.privEvents=new Pe,this.privMediaStream=n||null,this.privIsClosing=!1}get format(){return Promise.resolve(nt.AUDIOFORMAT)}turnOn(){if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new Oe;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,i,n)=>{e.mediaDevices.getUserMedia(t).then(i).catch(n)}),t){const e=()=>{this.onEvent(new ze(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Ne(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Ne(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Be(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new Be(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new He(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new Ke(this.privId,e)),{detach:()=>it(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new je(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new je(this.privId,e)))}turnOff(){return it(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new Ue(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:nt.AUDIOFORMAT.bitsPerSample,channelcount:nt.AUDIOFORMAT.channels,connectivity:ae.Unknown,manufacturer:"Speech SDK",model:e,samplerate:nt.AUDIOFORMAT.samplesPerSec,type:ce.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const i=new Oe;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const i of e)if(i.deviceId===t){this.privMicrophoneLabel=i.label;break}i.resolve(this.privMicrophoneLabel)}),(()=>i.resolve(this.privMicrophoneLabel))),i.promise}listen(e){return it(this,void 0,void 0,(function*(){yield this.turnOn();const t=new Ye(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new qe(this.privId,e,t)),t}return t}))}onEvent(e){this.privEvents.onEvent(e),$e.instance.onEvent(e)}createAudioContext(){this.privContext||(this.privContext=tt.getAudioContext(nt.AUDIOFORMAT.samplesPerSec))}destroyAudioContext(){return it(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}nt.AUDIOFORMAT=et.getDefaultInputFormat();var rt=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class st{constructor(e,t,i){this.privStreams={},this.privHeaderEnd=44,this.privId=i||Re(),this.privEvents=new Pe,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}turnOn(){if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new Be(e,"")),Promise.reject(e)}this.onEvent(new ze(this.privId)),this.onEvent(new Ne(this.privId))}id(){return this.privId}attach(e){return rt(this,void 0,void 0,(function*(){this.onEvent(new He(this.privId,e));const t=yield this.upload(e);return this.onEvent(new Ke(this.privId,e)),Promise.resolve({detach:()=>rt(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new je(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})}))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new je(this.privId,e)))}turnOff(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new Ue(this.privId)),Promise.resolve()}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:ae.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:ce.File})))}readHeader(){const e=this.privSource.slice(0,4296),t=new Oe,i=e=>{const i=new DataView(e),n=e=>String.fromCharCode(i.getUint8(e),i.getUint8(e+1),i.getUint8(e+2),i.getUint8(e+3));if("RIFF"!==n(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==n(8)||"fmt "!==n(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const r=i.getInt32(16,!0),s=i.getUint16(22,!0),o=i.getUint32(24,!0),a=i.getUint16(34,!0);let c=36+Math.max(r-16,0);for(;"data"!==n(c);c+=2)if(c>4288)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=c+8,t.resolve(et.getWaveFormatPCM(o,a,s))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;i(t)},t.readAsArrayBuffer(e)}else{const t=e;i(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return rt(this,void 0,void 0,(function*(){const t=t=>{const i=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new qe(this.privId,e,i)),new Error(i)};try{yield this.turnOn();const i=yield this.privAudioFormatPromise,n=new Ye(i.avgBytesPerSec/10,e);this.privStreams[e]=n;const r=this.privSource.slice(this.privHeaderEnd),s=e=>{n.isClosed||(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),n.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&r instanceof Blob){const e=new FileReader;e.onerror=e=>t(e.toString()),e.onload=e=>{const t=e.target.result;s(t)},e.readAsArrayBuffer(r)}else{const e=r;s(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return n}catch(e){t(e)}}))}onEvent(e){this.privEvents.onEvent(e),$e.instance.onEvent(e)}}var ot,at,ct,ut,pt,ht=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class dt{constructor(){}static createPushStream(e){return lt.create(e)}static createPullStream(e,t){return ft.create(e,t)}}class lt extends dt{static create(e){return new vt(e)}}class vt extends lt{constructor(e){super(),this.privFormat=void 0===e?tt.getDefaultInputFormat():e,this.privEvents=new Pe,this.privId=Re(),this.privStream=new Ye(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}turnOn(){this.onEvent(new ze(this.privId)),this.onEvent(new Ne(this.privId))}attach(e){return ht(this,void 0,void 0,(function*(){this.onEvent(new He(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new Ke(this.privId,e)),{detach:()=>ht(this,void 0,void 0,(function*(){return this.onEvent(new je(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new je(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ae.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:ce.Stream})}onEvent(e){this.privEvents.onEvent(e),$e.instance.onEvent(e)}toBuffer(e){const t=Buffer.alloc(e.byteLength),i=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=i[e];return t}}class ft extends dt{constructor(){super()}static create(e,t){return new gt(e,t)}}class gt extends ft{constructor(e,t){super(),this.privFormat=void 0===t?et.getDefaultInputFormat():t,this.privEvents=new Pe,this.privId=Re(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}turnOn(){this.onEvent(new ze(this.privId)),this.onEvent(new Ne(this.privId))}attach(e){return ht(this,void 0,void 0,(function*(){return this.onEvent(new He(this.privId,e)),yield this.turnOn(),this.onEvent(new Ke(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new je(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const i=new ArrayBuffer(this.privBufferSize-t),n=this.privCallback.read(i);if(void 0===e?e=i:new Int8Array(e).set(new Int8Array(i),t),0===n)break;t+=n}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new je(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ae.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:ce.Stream})}onEvent(e){this.privEvents.onEvent(e),$e.instance.onEvent(e)}}!function(e){e[e.Text=0]="Text",e[e.Binary=1]="Binary"}(ot||(ot={}));class mt{constructor(e,t,i,n){if(this.privBody=null,e===ot.Text&&t&&"string"!=typeof t)throw new _e("Payload must be a string");if(e===ot.Binary&&t&&!(t instanceof ArrayBuffer))throw new _e("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=i||{},this.privId=n||Re(),this.messageType){case ot.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case ot.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===ot.Binary)throw new _e("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===ot.Text)throw new _e("Not supported for text message");return this.privBody}get id(){return this.privId}}class St extends xe{constructor(e,t,i=De.Info){super(e,i),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class yt extends xe{constructor(e,t,i=De.Info){super(e,i),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class bt extends yt{constructor(e,t,i){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=i}get uri(){return this.privUri}get headers(){return this.privHeaders}}class At extends yt{constructor(e){super("ConnectionEstablishedEvent",e)}}class wt extends yt{constructor(e,t,i){super("ConnectionClosedEvent",e,De.Debug),this.privReason=i,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class Ct extends yt{constructor(e,t,i){super("ConnectionErrorEvent",e,De.Debug),this.privMessage=t,this.privType=i}get message(){return this.privMessage}get type(){return this.privType}}class It extends yt{constructor(e,t,i){super("ConnectionEstablishErrorEvent",e,De.Error),this.privStatusCode=t,this.privReason=i}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class Rt extends yt{constructor(e,t,i){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=i}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class Tt extends yt{constructor(e,t,i){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=i}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}!function(e){e[e.None=0]="None",e[e.Connected=1]="Connected",e[e.Connecting=2]="Connecting",e[e.Disconnected=3]="Disconnected"}(at||(at={})),function(e){e[e.Error=0]="Error",e[e.EndOfStream=1]="EndOfStream"}(ct||(ct={})),function(e){e[e.NoError=0]="NoError",e[e.AuthenticationFailure=1]="AuthenticationFailure",e[e.BadRequestParameters=2]="BadRequestParameters",e[e.TooManyRequests=3]="TooManyRequests",e[e.ConnectionFailure=4]="ConnectionFailure",e[e.ServiceTimeout=5]="ServiceTimeout",e[e.ServiceError=6]="ServiceError",e[e.RuntimeError=7]="RuntimeError",e[e.Forbidden=8]="Forbidden"}(ut||(ut={}));class _t{constructor(e){this.privResult=e}get result(){return this.privResult}}class Et extends class{constructor(e,t,i,n){this.privResultId=e,this.privReason=t,this.privErrorDetails=i,this.privProperties=n}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}{constructor(e,t,i,n,r,s){super(e,t,n,r),this.privAudioData=i,this.privAudioDuration=s}get audioData(){return this.privAudioData}get audioDuration(){return this.privAudioDuration}}!function(e){e[e.NoMatch=0]="NoMatch",e[e.Canceled=1]="Canceled",e[e.RecognizingSpeech=2]="RecognizingSpeech",e[e.RecognizedSpeech=3]="RecognizedSpeech",e[e.RecognizedKeyword=4]="RecognizedKeyword",e[e.RecognizingIntent=5]="RecognizingIntent",e[e.RecognizedIntent=6]="RecognizedIntent",e[e.TranslatingSpeech=7]="TranslatingSpeech",e[e.TranslatedSpeech=8]="TranslatedSpeech",e[e.SynthesizingAudio=9]="SynthesizingAudio",e[e.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",e[e.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",e[e.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",e[e.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",e[e.RecognizedSpeakers=14]="RecognizedSpeakers",e[e.RecognizedSpeaker=15]="RecognizedSpeaker",e[e.ResetVoiceProfile=16]="ResetVoiceProfile",e[e.DeletedVoiceProfile=17]="DeletedVoiceProfile",e[e.VoicesListRetrieved=18]="VoicesListRetrieved"}(pt||(pt={}));class Pt{constructor(e,t,i,n,r,s){this.privAudioOffset=e,this.privDuration=t,this.privText=i,this.privWordLength=n,this.privTextOffset=r,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}}class kt{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class Dt{constructor(e,t,i){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=i}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}class Mt extends tt{constructor(e,t,i,n,r,s,o,a,c){super(i,s,t,e),this.formatTag=e,this.avgBytesPerSec=n,this.blockAlign=r,this.priAudioFormatString=o,this.priRequestAudioFormatString=a,this.priHasHeader=c}static fromSpeechSynthesisOutputFormat(e){return void 0===e?Mt.getDefaultOutputFormat():Mt.fromSpeechSynthesisOutputFormatString(Mt.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new Mt(Qe.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new Mt(Qe.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new Mt(Qe.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new Mt(Qe.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new Mt(Qe.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new Mt(Qe.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new Mt(Qe.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new Mt(Qe.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new Mt(Qe.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new Mt(Qe.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new Mt(Qe.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new Mt(Qe.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new Mt(Qe.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new Mt(Qe.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new Mt(Qe.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new Mt(Qe.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new Mt(Qe.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new Mt(Qe.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new Mt(Qe.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new Mt(Qe.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new Mt(Qe.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new Mt(Qe.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new Mt(Qe.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new Mt(Qe.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new Mt(Qe.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new Mt(Qe.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new Mt(Qe.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new Mt(Qe.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new Mt(Qe.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new Mt(Qe.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new Mt(Qe.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new Mt(Qe.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new Mt(Qe.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return Mt.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){const t=new DataView(this.privHeader);t.setUint32(4,e+this.privHeader.byteLength-8,!0),t.setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}Mt.SpeechSynthesisOutputFormatToString={[re.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[re.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[re.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[re.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[re.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[re.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[re.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[re.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[re.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[re.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[re.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[re.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[re.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[re.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[re.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[re.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[re.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[re.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[re.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[re.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[re.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[re.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[re.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[re.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[re.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[re.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[re.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[re.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[re.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[re.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[re.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[re.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[re.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus",[re.Raw22050Hz16BitMonoPcm]:"raw-22050hz-16bit-mono-pcm",[re.Riff22050Hz16BitMonoPcm]:"riff-22050hz-16bit-mono-pcm",[re.Raw44100Hz16BitMonoPcm]:"raw-44100hz-16bit-mono-pcm",[re.Riff44100Hz16BitMonoPcm]:"riff-44100hz-16bit-mono-pcm"};var Ot;class Lt{constructor(){}static createPullStream(){return xt.create()}}class xt extends Lt{static create(){return new Gt}}class Gt extends xt{constructor(){super(),this.privId=Re(),this.privStream=new Ze}set format(e){null==e&&(this.privFormat=Mt.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return t=this,i=void 0,r=function*(){const t=new Int8Array(e);let i=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),i=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;i<e.byteLength&&!this.privStream.isReadEnded;){const n=yield this.privStream.read();if(void 0===n||n.isEnd)this.privStream.readEnded();else{let r;n.buffer.byteLength>e.byteLength-i?(r=n.buffer.slice(0,e.byteLength-i),this.privLastChunkView=new Int8Array(n.buffer.slice(e.byteLength-i))):r=n.buffer,t.set(new Int8Array(r),i),i+=r.byteLength}}return i},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}write(e){ee.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class zt extends Lt{constructor(){super()}static create(e){return new Nt(e)}}class Nt extends zt{constructor(e){super(),this.privId=Re(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}!function(e){e.WordBoundary="WordBoundary",e.Bookmark="Bookmark",e.Viseme="Viseme",e.SentenceBoundary="SentenceBoundary",e.SessionEnd="SessionEnd"}(Ot||(Ot={}));class Ut{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new Ut(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}class Bt extends xe{constructor(e,t,i=De.Info){super(e,i),this.privRequestId=t}get requestId(){return this.privRequestId}}class Ft extends Bt{constructor(e,t,i){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=i}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Ht extends Bt{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class Kt extends Bt{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var jt=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class qt{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=Re(),this.privTurnDeferral=new Oe,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}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}getAllReceivedAudio(){return jt(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return jt(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Zt.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,i,n){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=i,this.privAudioOutputStream=new Gt,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="",void 0!==n&&(this.privTurnAudioDestination=n,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new Ft(this.requestId,void 0,void 0===n?void 0:n.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Ht(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new Kt(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()}onServiceResponseMessage(e){const t=JSON.parse(e);this.streamId=t.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}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 Oe}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onTextBoundaryEvent(e){this.updateTextOffset(e.Data.text.Text,e.Type)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onSessionEnd(e){this.privAudioDuration=e.Data.Offset}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}onEvent(e){$e.instance.onEvent(e)}static isXmlTag(e){return e.length>=2&&"<"===e[0]&&">"===e[e.length-1]}updateTextOffset(e,t){t===Ot.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!qt.isXmlTag(e)&&this.updateTextOffset(e,t))):(this.privSentenceOffset=this.privRawText.indexOf(e,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!qt.isXmlTag(e)&&this.updateTextOffset(e,t)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}readAllAudioFromStream(){return jt(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}withinXmlTag(e){return this.privRawText.indexOf("<",e+1)>this.privRawText.indexOf(">",e+1)}}class Vt{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,punctuationBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(te.SpeechServiceResponse_RequestPunctuationBoundary,!!this.privSpeechSynthesizer.wordBoundary),sentenceBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(te.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(te.SpeechServiceResponse_RequestWordBoundary,!!this.privSpeechSynthesizer.wordBoundary)},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}class Wt{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}class Xt{}Xt.AuthKey="Ocp-Apim-Subscription-Key",Xt.Authorization="Authorization",Xt.SpIDAuthKey="Apim-Subscription-Id",Xt.ConnectionId="X-ConnectionId",Xt.ContentType="Content-Type",Xt.CustomCommandsAppId="X-CommandsAppId",Xt.Path="Path",Xt.RequestId="X-RequestId",Xt.RequestStreamId="X-StreamId",Xt.RequestTimestamp="X-Timestamp";class Jt extends mt{constructor(e,t,i,n,r,s,o,a){if(!t)throw new Te("path");if(!i)throw new Te("requestId");const c={};if(c[Xt.Path]=t,c[Xt.RequestId]=i,c[Xt.RequestTimestamp]=(new Date).toISOString(),n&&(c[Xt.ContentType]=n),s&&(c[Xt.RequestStreamId]=s),o)for(const e in o)e&&(c[e]=o[e]);a?super(e,r,c,a):super(e,r,c),this.privPath=t,this.privRequestId=i,this.privContentType=n,this.privStreamId=s,this.privAdditionalHeaders=o}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(e){let t=null,i=null,n=null,r=null;const s={};if(e.headers)for(const o in e.headers)o&&(o.toLowerCase()===Xt.Path.toLowerCase()?t=e.headers[o]:o.toLowerCase()===Xt.RequestId.toLowerCase()?i=e.headers[o]:o.toLowerCase()===Xt.ContentType.toLowerCase()?n=e.headers[o]:o.toLowerCase()===Xt.RequestStreamId.toLowerCase()?r=e.headers[o]:s[o]=e.headers[o]);return new Jt(e.messageType,t,i,n,e.body,r,s,e.id)}}var Qt=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Zt{constructor(e,t,i,n,r){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!e)throw new Te("authentication");if(!t)throw new Te("connectionFactory");if(!i)throw new Te("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=i,this.privIsDisposed=!1,this.privSpeechSynthesizer=n,this.privSessionAudioDestination=r,this.privSynthesisTurn=new qt,this.privConnectionEvents=new Pe,this.privServiceEvents=new Pe,this.privSynthesisContext=new Vt(this.privSpeechSynthesizer),this.privAgentConfig=new Wt,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(ct.Error,1007===t.statusCode?ut.BadRequestParameters:ut.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const i=new Uint8Array(e.byteLength+t.header.byteLength);return i.set(new Uint8Array(t.header),0),i.set(new Uint8Array(e),t.header.byteLength),i.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return Qt(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),void 0!==this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return Qt(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Qt(this,void 0,void 0,(function*(){const i="string"==typeof t?ot.Text:ot.Binary,n="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new Jt(i,e,this.privSynthesisTurn.requestId,n,t))}))}Speak(e,t,i,n,r,s){return Qt(this,void 0,void 0,(function*(){let o;if(o=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(o,i,n,r);this.privSuccessCallback=n,this.privErrorCallback=r,this.privSynthesisTurn.startNewSynthesis(i,e,t,s);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,o,i);const t=new _t(new Et(i,pt.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(ct.Error,ut.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,i,n){const r=new ue;r.setProperty(Z,ut[i]);const s=new Et(e,pt.Canceled,void 0,n,r);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new _t(s);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(s)}catch(e){}}cancelSynthesisLocal(e,t,i){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,i))}processTypeSpecificMessages(e){return!0}receiveMessage(){return Qt(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const i=Jt.fromConnectionMessage(t);if(i.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(i.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(i.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===i.streamId.toLowerCase()&&i.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(i.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Zt.addHeader(i.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new _t(new Et(this.privSynthesisTurn.requestId,pt.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(i.binaryBody)}break;case"audio.metadata":const e=Ut.fromJSON(i.textBody).Metadata;for(const t of e)switch(t.Type){case Ot.WordBoundary:case Ot.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(t);const e=new Pt(t.Data.Offset,t.Data.Duration,t.Data.text.Text,t.Data.text.Length,t.Type===Ot.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,t.Data.text.BoundaryType);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case Ot.Bookmark:const i=new kt(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch(e){}break;case Ot.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new Dt(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case Ot.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new Et(this.privSynthesisTurn.requestId,pt.SynthesizingAudioCompleted,e,void 0,void 0,this.privSynthesisTurn.audioDuration),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new _t(t))}catch(e){}break;default:this.processTypeSpecificMessages(i)||this.privServiceEvents&&this.serviceEvents.onEvent(new St(i.path.toLowerCase(),i.textBody))}return this.receiveMessage()}catch(e){}}))}sendSynthesisContext(e){const t=this.synthesisContext.toJSON();if(t)return e.send(new Jt(ot.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))}connectImpl(e=!1){if(null!=this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===at.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl())));this.privAuthFetchEventId=Re(),this.privConnectionId=Re(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>Qt(this,void 0,void 0,(function*(){this.privSynthesisTurn.onAuthCompleted(!1);const i=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);i.events.attach((e=>{this.connectionEvents.onEvent(e)}));const n=yield i.open();return 200===n.statusCode?(this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode),Promise.resolve(i)):403!==n.statusCode||e?(this.privSynthesisTurn.onConnectionEstablishCompleted(n.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${n.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(te.SpeechServiceConnection_Endpoint)} Reason: ${n.reason}`)):this.connectImpl(!0)}))),(e=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(e)})),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}sendSpeechServiceConfig(e,t){if(t)return e.send(new Jt(ot.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,i){return e.send(new Jt(ot.Text,"ssml",i,"application/ssml+xml",t))}fetchConnection(){return Qt(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===at.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(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return Qt(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Zt.telemetryDataEnabled=!0;class Yt extends xe{constructor(e){super("BackgroundEvent",De.Error),this.privError=e}get error(){return this.privError}}var $t=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const ei={[Qe.PCM]:"audio/wav",[Qe.MuLaw]:"audio/x-wav",[Qe.MP3]:"audio/mpeg",[Qe.OGG_OPUS]:"audio/ogg",[Qe.WEBM_OPUS]:"audio/webm; codecs=opus",[Qe.ALaw]:"audio/x-wav",[Qe.FLAC]:"audio/flac"};class ti{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||Re(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,i){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{i&&i(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream&&"undefined"!=typeof window)if(this.privFormat.formatTag!==Qe.PCM&&this.privFormat.formatTag!==Qe.MuLaw&&this.privFormat.formatTag!==Qe.ALaw||!1!==this.privFormat.hasHeader){let i=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(i).then((()=>{i=Zt.addHeader(i,this.privFormat);const n=new Blob([i],{type:ei[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(n),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||"undefined"!=typeof window&&void 0!==window.webkitAudioContext){this.privFormat=e;const t=ei[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${Qe[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(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=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=()=>{this.updateSourceBuffer().catch((e=>{$e.instance.onEvent(new Yt(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{$e.instance.onEvent(new Yt(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{$e.instance.onEvent(new Yt(e))}))):(console.warn(`Format ${Qe[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new Gt,this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){var e,t;return null!==(t=null===(e=this.privAudio)||void 0===e?void 0:e.volume)&&void 0!==t?t:-1}set volume(e){this.privAudio&&(this.privAudio.volume=e)}mute(){this.privAudio&&(this.privAudio.muted=!0)}unmute(){this.privAudio&&(this.privAudio.muted=!1)}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return $t(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return $t(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return $t(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}var ii=i(592);class ni{constructor(e){ee.throwIfNullOrUndefined(ii.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=ii.openSync(e,"w")}set format(e){ee.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=ii.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){ee.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),ii.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),ii.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}id(){return this.privId}}class ri{static fromDefaultMicrophoneInput(){const e=new le(!0);return new si(new nt(e))}static fromMicrophoneInput(e){const t=new le(!0);return new si(new nt(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new si(new st(e,t))}static fromStreamInput(e){if(e instanceof class{})return new si(new gt(e));if(e instanceof dt)return new si(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new le(!1);return new si(new nt(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new oi(new ti)}static fromSpeakerOutput(e){if(void 0===e)return ri.fromDefaultSpeakerOutput();if(e instanceof ti)return new oi(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new oi(new ni(e))}static fromStreamOutput(e){if(e instanceof class{})return new oi(new Nt(e));if(e instanceof zt)return new oi(e);if(e instanceof xt)return new oi(e);throw new Error("Not Supported Type")}}class si extends ri{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(ee.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class oi extends ri{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}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.")}}var ai=i(137),ci=i.n(ai);class ui{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class pi{constructor(e,t,i){if(this.privPayload=null,!t)throw new Te("payload");if(e===ot.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new _e("Payload must be ArrayBuffer");if(e===ot.Text&&"string"!=typeof t)throw new _e("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=i||Re()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===ot.Binary)throw new _e("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===ot.Text)throw new _e("Not supported for text message");return this.privPayload}get id(){return this.privId}}var hi=i(173),di=i(339);class li extends xe{constructor(e,t,i){super(e,t),this.privSignature=i}}class vi extends li{constructor(e){super("OCSPMemoryCacheHitEvent",De.Debug,e)}}class fi extends li{constructor(e){super("OCSPCacheMissEvent",De.Debug,e)}}class gi extends li{constructor(e){super("OCSPDiskCacheHitEvent",De.Debug,e)}}class mi extends li{constructor(e){super("OCSPCacheUpdateNeededEvent",De.Debug,e)}}class Si extends li{constructor(e){super("OCSPMemoryCacheStoreEvent",De.Debug,e)}}class yi extends li{constructor(e){super("OCSPDiskCacheStoreEvent",De.Debug,e)}}class bi extends li{constructor(e){super("OCSPCacheUpdateCompleteEvent",De.Debug,e)}}class Ai extends li{constructor(){super("OCSPStapleReceivedEvent",De.Debug,"")}}class wi extends li{constructor(e,t){super("OCSPCacheEntryExpiredEvent",De.Debug,e),this.privExpireTime=t}}class Ci extends li{constructor(e,t,i){super("OCSPCacheEntryNeedsRefreshEvent",De.Debug,e),this.privExpireTime=i,this.privStartTime=t}}class Ii extends li{constructor(e,t,i){super("OCSPCacheHitEvent",De.Debug,e),this.privExpireTime=i,this.privExpireTimeString=new Date(i).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class Ri extends li{constructor(e,t){super("OCSPVerificationFailedEvent",De.Debug,e),this.privError=t}}class Ti extends li{constructor(e,t){super("OCSPCacheFetchErrorEvent",De.Debug,e),this.privError=t}}class _i extends li{constructor(e){super("OCSPResponseRetrievedEvent",De.Debug,e)}}class Ei extends li{constructor(e,t){super("OCSPCacheUpdateErrorEvent",De.Debug,e),this.privError=t}}var Pi=i(108),ki=i.n(Pi),Di=i(275),Mi=i.n(Di),Oi=i(505),Li=i.n(Oi),xi=i(146),Gi=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class zi{constructor(e){e&&(this.privProxyInfo=e),zi.privDiskCache||(zi.privDiskCache=new(Mi())("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:"undefined"!=typeof process&&{ELECTRON_MIRROR:"https://npmmirror.com/mirrors/electron/",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",PYTHON_PATH:"/Library/Frameworks/Python.framework/Versions/2.7/bin/python",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.106.1",VSCODE_PYTHON_AUTOACTIVATE_GUARD:"1",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.rJ6wYLhhsl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",CLAUDE_CODE_SSE_PORT:"52729",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.9.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.3.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.9.2 node/v22.17.1 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.3.0"}.SPEECH_OCSP_CACHE_ROOT?{ELECTRON_MIRROR:"https://npmmirror.com/mirrors/electron/",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",PYTHON_PATH:"/Library/Frameworks/Python.framework/Versions/2.7/bin/python",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.106.1",VSCODE_PYTHON_AUTOACTIVATE_GUARD:"1",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.rJ6wYLhhsl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",CLAUDE_CODE_SSE_PORT:"52729",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.9.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.3.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.9.2 node/v22.17.1 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.3.0"}.SPEECH_OCSP_CACHE_ROOT:void 0}))}static forceReinitDiskCache(){zi.privDiskCache=void 0,zi.privMemCache={}}GetAgent(e){const t=new(ki().Agent)(this.CreateConnection);return void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0&&(t.privProxyInfo=this.privProxyInfo),t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};return e.UserName?t.headers={"Proxy-Authentication":"Basic "+new Buffer(`${e.UserName}:${void 0===e.Password?"":e.Password}`).toString("base64")}:t.headers={},t.headers.requestOCSP="true",new(Li())(t)}static OCSPCheck(e,t){return Gi(this,void 0,void 0,(function*(){let i,n,r=!1;const s=yield e;s.cork();const o=s;return new Promise(((e,a)=>{s.on("OCSPResponse",(e=>{e&&(this.onEvent(new Ai),n=e)})),s.on("error",(e=>{r||(r=!0,s.destroy(),a(e))})),o.on("secure",(()=>Gi(this,void 0,void 0,(function*(){const c=o.getPeerCertificate(!0);try{const o=yield this.GetIssuer(c);i=di.request.generate(c.raw,o.raw);const a=i.id.toString("hex");if(!n){const e=yield zi.GetResponseFromCache(a,i,t);n=e}yield this.VerifyOCSPResponse(n,i,t),s.uncork(),r=!0,e(s)}catch(e){s.destroy(),r=!0,a(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,i)=>{new di.Agent({}).fetchIssuer(e,null,((e,n)=>{e?i(e):t(n)}))}))}static GetResponseFromCache(e,t,i){return Gi(this,void 0,void 0,(function*(){let n=zi.privMemCache[e];if(n&&this.onEvent(new vi(e)),!n)try{const t=yield zi.privDiskCache.get(e);t.isCached&&(zi.onEvent(new gi(e)),zi.StoreMemoryCacheEntry(e,t.value),n=t.value)}catch(e){n=null}if(!n)return n;try{const r=di.utils.parseResponse(n).value.tbsResponseData;if(r.responses.length<1)return void this.onEvent(new Ti(e,"Not enough data in cached response"));const s=r.responses[0].thisUpdate,o=r.responses[0].nextUpdate;if(o<Date.now()+this.testTimeOffset-6e4)this.onEvent(new wi(e,o)),n=null;else{const n=Math.min(864e5,(o-s)/2);o-(Date.now()+this.testTimeOffset)<n?(this.onEvent(new Ci(e,s,o)),this.UpdateCache(t,i).catch((t=>{this.onEvent(new Ei(e,t.toString()))}))):this.onEvent(new Ii(e,s,o))}}catch(t){this.onEvent(new Ti(e,t)),n=null}return n||this.onEvent(new fi(e)),n}))}static VerifyOCSPResponse(e,t,i){return Gi(this,void 0,void 0,(function*(){let n=e;return n||(n=yield zi.GetOCSPResponse(t,i)),new Promise(((r,s)=>{di.verify({request:t,response:n},(o=>{o?(zi.onEvent(new Ri(t.id.toString("hex"),o)),e?this.VerifyOCSPResponse(null,t,i).then((()=>{r()}),(e=>{s(e)})):s(o)):(e||zi.StoreCacheEntry(t.id.toString("hex"),n),r())}))}))}))}static UpdateCache(e,t){return Gi(this,void 0,void 0,(function*(){const i=e.id.toString("hex");this.onEvent(new mi(i));const n=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(i,n),this.onEvent(new bi(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new Si(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new yi(e))}))}static GetOCSPResponse(e,t){let i={};if(t){const e=zi.GetProxyAgent(t);i.agent=e}return new Promise(((t,n)=>{di.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((r,s)=>{if(r)return void n(r);const o=new URL(s);i=Object.assign(Object.assign({},i),{host:o.host,protocol:o.protocol,port:o.port,path:o.pathname,hostname:o.host}),di.utils.getResponse(i,e.data,((i,r)=>{if(i)return void n(i);const s=e.certID;this.onEvent(new _i(s.toString("hex"))),t(r)}))}))}))}static onEvent(e){$e.instance.onEvent(e)}CreateConnection(e,t){const i="undefined"!=typeof process&&"0"!=={ELECTRON_MIRROR:"https://npmmirror.com/mirrors/electron/",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",PYTHON_PATH:"/Library/Frameworks/Python.framework/Versions/2.7/bin/python",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.106.1",VSCODE_PYTHON_AUTOACTIVATE_GUARD:"1",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.rJ6wYLhhsl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",CLAUDE_CODE_SSE_PORT:"52729",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.9.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.3.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.9.2 node/v22.17.1 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.3.0"}.NODE_TLS_REJECT_UNAUTHORIZED&&"0"!=={ELECTRON_MIRROR:"https://npmmirror.com/mirrors/electron/",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",PYTHON_PATH:"/Library/Frameworks/Python.framework/Versions/2.7/bin/python",npm_config_global_prefix:"/Users/reber/n",TERM_PROGRAM_VERSION:"1.106.1",VSCODE_PYTHON_AUTOACTIVATE_GUARD:"1",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",COLOR:"1",npm_config_noproxy:"",npm_config_local_prefix:"/Users/reber/project/sudmgp-web-sdk",USER:"reber",N_PREFIX:"/Users/reber/n",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.rJ6wYLhhsl/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",CLAUDE_CODE_SSE_PORT:"52729",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",PATH:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/Users/reber/project/node_modules/.bin:/Users/reber/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/reber/n/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin:/usr/local/mysql/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/copilotCli:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/mysql/bin:/Users/reber/n/bin",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",npm_package_json:"/Users/reber/project/sudmgp-web-sdk/package.json",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_command:"run-script",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_lifecycle_event:"build",EDITOR:"vi",npm_package_name:"sudmgp-sdk-js",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",LANG:"zh_CN.UTF-8",npm_config_npm_version:"10.9.2",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/Users/reber/n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_package_version:"1.3.0",XPC_SERVICE_NAME:"0",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_cache:"/Users/reber/.npm",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_user_agent:"npm/10.9.2 node/v22.17.1 darwin x64 workspaces/false",GIT_ASKPASS:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",VSCODE_GIT_ASKPASS_NODE:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",COLORTERM:"truecolor",SDK_VERSION:"1.3.0"}.SPEECH_CONDUCT_OCSP_CHECK&&t.secureEndpoint;let n;if(t=Object.assign(Object.assign({},t),{requestOCSP:!zi.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const i=zi.GetProxyAgent(this.privProxyInfo);n=new Promise(((n,r)=>{i.callback(e,t,((e,t)=>{e?r(e):n(t)}))}))}else n=t.secureEndpoint?Promise.resolve(hi.connect(t)):Promise.resolve(xi.connect(t));return i?zi.OCSPCheck(n,this.privProxyInfo):n}}zi.testTimeOffset=0,zi.forceDisableOCSPStapling=!1,zi.privMemCache={};var Ni=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class Ui{constructor(e,t,i,n,r,s){if(!e)throw new Te("uri");if(!i)throw new Te("messageFormatter");this.proxyInfo=n,this.privConnectionEvents=new Pe,this.privConnectionId=t,this.privMessageFormatter=i,this.privConnectionState=at.None,this.privUri=e,this.privHeaders=r,this.privEnableCompression=s,this.privHeaders[Xt.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}open(){if(this.privConnectionState===at.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new Oe,this.privCertificateValidatedDeferral=new Oe,this.privConnectionState=at.Connecting;try{if("undefined"==typeof WebSocket||Ui.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new zi(this.proxyInfo);e.agent=t.GetAgent();let i=new URL(this.privUri).protocol;"wss:"===(null==i?void 0:i.toLocaleLowerCase())?i="https:":"ws:"===(null==i?void 0:i.toLocaleLowerCase())&&(i="http:"),e.agent.protocol=i,this.privWebsocketClient=new(ci())(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new Je,this.privDisconnectDeferral=new Oe,this.privSendMessageQueue=new Je,this.processSendQueue().catch((e=>{$e.instance.onEvent(new Yt(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new ui(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new bt(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=()=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=at.Connected,this.onEvent(new At(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new ui(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new Ct(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===at.Connecting?(this.privConnectionState=at.Disconnected,this.privConnectionEstablishDeferral.resolve(new ui(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=at.Disconnected,this.privWebsocketClient=null,this.onEvent(new wt(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{$e.instance.onEvent(new Yt(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===at.Connected){const i=new Oe;if(this.privReceivingMessageQueue.enqueueFromPromise(i.promise),e.data instanceof ArrayBuffer){const n=new pi(ot.Binary,e.data);this.privMessageFormatter.toConnectionMessage(n).then((e=>{this.onEvent(new Rt(this.privConnectionId,t,e)),i.resolve(e)}),(e=>{i.reject(`Invalid binary message format. Error: ${e}`)}))}else{const n=new pi(ot.Text,e.data);this.privMessageFormatter.toConnectionMessage(n).then((e=>{this.onEvent(new Rt(this.privConnectionId,t,e)),i.resolve(e)}),(e=>{i.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise}send(e){if(this.privConnectionState!==at.Connected)return Promise.reject(`Cannot send on connection that is in ${at[this.privConnectionState]} state`);const t=new Oe,i=new Oe;return this.privSendMessageQueue.enqueueFromPromise(i.promise),this.privMessageFormatter.fromConnectionMessage(e).then((n=>{i.resolve({Message:e,RawWebsocketMessage:n,sendStatusDeferral:t})}),(e=>{i.reject(`Error formatting the message. ${e}`)})),t.promise}read(){return this.privConnectionState!==at.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue()}close(e){return this.privWebsocketClient?(this.privConnectionState!==at.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve()}get events(){return this.privConnectionEvents}sendRawMessage(e){try{return e?(this.onEvent(new Tt(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}}onClose(e,t){return Ni(this,void 0,void 0,(function*(){const i=`Connection closed. ${e}: ${t}`;this.privConnectionState=at.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((()=>{}),i),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(i)}),i)}))}processSendQueue(){return Ni(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}onEvent(e){this.privConnectionEvents.onEvent(e),$e.instance.onEvent(e)}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}Ui.forceNpmWebSocket=!1;var Bi;class Fi{constructor(e,t,i,n,r,s=!1,o){if(this.privIsDisposed=!1,!e)throw new Te("uri");if(!n)throw new Te("messageFormatter");this.privMessageFormatter=n;let a="",c=0;if(t)for(const i in t)if(i){a+=0===c&&-1===e.indexOf("?")?"?":"&",a+=encodeURIComponent(i);let n=t[i];n&&(n=encodeURIComponent(n),a+=`=${n}`),c++}if(i)for(const t in i)t&&(a+=0===c&&-1===e.indexOf("?")?"?":"&",a+=`${t}=${encodeURIComponent(i[t])}`,c++);this.privUri=e+a,this.privId=o||Re(),this.privConnectionMessageAdapter=new Ui(this.privUri,this.id,this.privMessageFormatter,r,i,s)}dispose(){return e=this,t=void 0,n=function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())},new((i=void 0)||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}));var e,t,i,n}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(e){return this.privConnectionMessageAdapter.send(e)}read(){return this.privConnectionMessageAdapter.read()}get events(){return this.privConnectionMessageAdapter.events}}class Hi{constructor(e,t,i,n){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=i,this.privProxyPassword=n}static fromParameters(e){return new Hi(e.getProperty(te.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(te.SpeechServiceConnection_ProxyPort),10),e.getProperty(te.SpeechServiceConnection_ProxyUserName),e.getProperty(te.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}class Ki{}Ki.BotId="botid",Ki.CustomSpeechDeploymentId="cid",Ki.CustomVoiceDeploymentId="deploymentId",Ki.EnableAudioLogging="storeAudio",Ki.EnableLanguageId="lidEnabled",Ki.EnableWordLevelTimestamps="wordLevelTimestamps",Ki.EndSilenceTimeoutMs="endSilenceTimeoutMs",Ki.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",Ki.Format="format",Ki.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",Ki.Language="language",Ki.Profanity="profanity",Ki.RequestBotStatusMessages="enableBotMessageStatus",Ki.StableIntermediateThreshold="stableIntermediateThreshold",Ki.StableTranslation="stableTranslation",Ki.TestHooks="testhooks",Ki.Postprocessing="postprocessing",Ki.CtsMeetingId="meetingId",Ki.CtsDeviceId="deviceId",Ki.CtsIsParticipant="isParticipant";class ji{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,i){new Map([[te.Speech_SegmentationSilenceTimeoutMs,Ki.SegmentationSilenceTimeoutMs],[te.SpeechServiceConnection_EnableAudioLogging,Ki.EnableAudioLogging],[te.SpeechServiceConnection_EndSilenceTimeoutMs,Ki.EndSilenceTimeoutMs],[te.SpeechServiceConnection_InitialSilenceTimeoutMs,Ki.InitialSilenceTimeoutMs],[te.SpeechServiceResponse_PostProcessingOption,Ki.Postprocessing],[te.SpeechServiceResponse_ProfanityOption,Ki.Profanity],[te.SpeechServiceResponse_RequestWordLevelTimestamps,Ki.EnableWordLevelTimestamps],[te.SpeechServiceResponse_StablePartialResultThreshold,Ki.StableIntermediateThreshold]]).forEach(((n,r)=>{this.setUrlParameter(r,n,e,t,i)}));const n=JSON.parse(e.parameters.getProperty(Y,"{}"));Object.keys(n).forEach((e=>{t[e]=n[e]}))}setUrlParameter(e,t,i,n,r){const s=i.parameters.getProperty(e,void 0);!s||r&&-1!==r.search(t)||(n[t]=s.toLocaleLowerCase())}}class qi{toConnectionMessage(e){const t=new Oe;try{if(e.messageType===ot.Text){const i=e.textContent;let n={},r=null;if(i){const e=i.split("\r\n\r\n");e&&e.length>0&&(n=this.parseHeaders(e[0]),e.length>1&&(r=e[1]))}t.resolve(new mt(e.messageType,r,n,e.id))}else if(e.messageType===ot.Binary){const i=e.binaryContent;let n={},r=null;if(!i||i.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const s=new DataView(i),o=s.getInt16(0);if(i.byteLength<o+2)throw new Error("Invalid binary message format. Header content missing.");let a="";for(let e=0;e<o;e++)a+=String.fromCharCode(s.getInt8(e+2));n=this.parseHeaders(a),i.byteLength>o+2&&(r=i.slice(2+o)),t.resolve(new mt(e.messageType,r,n,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise}fromConnectionMessage(e){const t=new Oe;try{if(e.messageType===ot.Text){const i=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new pi(ot.Text,i,e.id))}else if(e.messageType===ot.Binary){const i=this.makeHeaders(e),n=e.binaryBody,r=this.stringToArrayBuffer(i),s=new Int8Array(r),o=s.byteLength,a=new Int8Array(2+o+(n?n.byteLength:0));if(a[0]=o>>8&255,a[1]=255&o,a.set(s,2),n){const e=new Int8Array(n);a.set(e,2+o)}const c=a.buffer;t.resolve(new pi(ot.Binary,c,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise}makeHeaders(e){let t="";if(e.headers)for(const i in e.headers)i&&(t+=`${i}: ${e.headers[i]}\r\n`);return t}parseHeaders(e){const t={};if(e){const i=e.match(/[^\r\n]+/g);if(t)for(const e of i)if(e){const i=e.indexOf(":"),n=i>0?e.substr(0,i).trim().toLowerCase():e,r=i>0&&e.length>i+1?e.substr(i+1).trim():"";t[n]=r}}return t}stringToArrayBuffer(e){const t=new ArrayBuffer(e.length),i=new DataView(t);for(let t=0;t<e.length;t++)i.setUint8(t,e.charCodeAt(t));return t}}class Vi extends ji{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.universalUri="/speech/universal/v"}create(e,t,i){let n=e.parameters.getProperty(te.SpeechServiceConnection_Endpoint,void 0);const r=e.parameters.getProperty(te.SpeechServiceConnection_Region,void 0),s=ji.getHostSuffix(r),o=e.parameters.getProperty(te.SpeechServiceConnection_Host,"wss://"+r+".stt.speech"+s),a={},c=e.parameters.getProperty(te.SpeechServiceConnection_EndpointId,void 0),u=e.parameters.getProperty(te.SpeechServiceConnection_RecoLanguage,void 0);if(c?n&&-1!==n.search(Ki.CustomSpeechDeploymentId)||(a[Ki.CustomSpeechDeploymentId]=c):u&&(n&&-1!==n.search(Ki.Language)||(a[Ki.Language]=u)),n&&-1!==n.search(Ki.Format)||(a[Ki.Format]=e.parameters.getProperty(Q,ie[ie.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(a[Ki.EnableLanguageId]="true"),this.setCommonUrlParams(e,a,n),!n)switch(e.recognitionMode){case se.Conversation:n="true"===e.parameters.getProperty($,"false")?o+this.dictationRelativeUri:void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${o}${this.universalUri}${e.recognitionEndpointVersion}`:o+this.conversationRelativeUri;break;case se.Dictation:n=o+this.dictationRelativeUri;break;default:n=void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${o}${this.universalUri}${e.recognitionEndpointVersion}`:o+this.interactiveRelativeUri}const p={};void 0!==t.token&&""!==t.token&&(p[t.headerName]=t.token),p[Xt.ConnectionId]=i;const h="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false"),d=new Fi(n,a,p,new qi,Hi.fromRecognizerConfig(e),h,i),l=d.uri;return e.parameters.setProperty(te.SpeechServiceConnection_Url,l),d}}class Wi extends class{constructor(e,t,i,n,r,s,o,a,c,u){this.privResultId=e,this.privReason=t,this.privText=i,this.privDuration=n,this.privOffset=r,this.privLanguage=s,this.privLanguageDetectionConfidence=o,this.privErrorDetails=a,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}}{constructor(e,t,i,n,r,s,o,a,c,u,p){super(e,t,i,n,r,s,o,c,u,p),this.privSpeakerId=a}get speakerId(){return this.privSpeakerId}}class Xi{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class Ji extends Xi{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class Qi extends Ji{constructor(e,t,i){super(t,i),this.privResult=e}get result(){return this.privResult}}class Zi extends Ji{constructor(e,t,i,n,r){super(n,r),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=i}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class Yi extends Zi{}class $i{constructor(e,t){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=e,this.privBytesPerSecond=t}id(){return this.privAudioNode.id()}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let i=0;for(;i<this.privBuffers.length&&t>=this.privBuffers[i].chunk.buffer.byteLength;)t-=this.privBuffers[i++].chunk.buffer.byteLength;if(i<this.privBuffers.length){const e=this.privBuffers[i].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,i===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[i].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new en(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let i=Math.round(t*this.privBytesPerSecond*1e-7),n=0;for(;n<this.privBuffers.length&&i>=this.privBuffers[n].chunk.buffer.byteLength;)i-=this.privBuffers[n++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-i/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(n)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const i=t.byteOffset/this.privBytesPerSecond*1e7,n=i+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=i&&e<=n)return t.chunk.timeReceived}return 0}}class en{constructor(e,t,i){this.chunk=e,this.serial=t,this.byteOffset=i}}class tn{static load(){const e=new Map([[0,()=>{}]]),t=new Map,i="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})}})}]);'),n=new Worker(i);return n.addEventListener("message",(({data:i})=>{if(tn.isCallNotification(i)){const{params:{timerId:n}}=i,r=e.get(n);if("number"==typeof r){const e=t.get(r);if(void 0===e||e!==n)throw new Error("The timer is in an undefined state.")}else{if(void 0===r)throw new Error("The timer is in an undefined state.");r(),e.delete(n)}}else{if(!tn.isClearResponse(i)){const{error:{message:e}}=i;throw new Error(e)}{const{id:n}=i,r=t.get(n);if(void 0===r)throw new Error("The timer is in an undefined state.");t.delete(n),e.delete(r)}}})),{clearTimeout:i=>{const r=Math.random();t.set(r,i),e.set(i,r),n.postMessage({id:r,method:"clear",params:{timerId:i}})},setTimeout:(t,i)=>{const r=Math.random();return e.set(r,t),n.postMessage({id:null,method:"set",params:{delay:i,now:performance.now(),timerId:r}}),r}}}static loadWorkerTimers(){return()=>(null!==tn.workerTimers||(tn.workerTimers=tn.load()),tn.workerTimers)}static isCallNotification(e){return void 0!==e.method&&"call"===e.method}static isClearResponse(e){return null===e.error&&"number"==typeof e.id}}tn.workerTimers=null,tn.clearTimeout=e=>tn.timers().clearTimeout(e),tn.setTimeout=(e,t)=>tn.timers().setTimeout(e,t),tn.timers=tn.loadWorkerTimers();class nn extends xe{constructor(e,t,i,n=De.Info){super(e,n),this.privRequestId=t,this.privSessionId=i}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class rn extends nn{constructor(e,t,i,n){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=i,this.privAudioNodeId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class sn extends nn{constructor(e,t,i,n){super("ListeningStartedEvent",e,t),this.privAudioSourceId=i,this.privAudioNodeId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class on extends nn{constructor(e,t,i){super("ConnectingToServiceEvent",e,i),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class an extends nn{constructor(e,t,i,n,r){super("RecognitionStartedEvent",e,r),this.privAudioSourceId=t,this.privAudioNodeId=i,this.privAuthFetchEventId=n}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}!function(e){e[e.Success=0]="Success",e[e.AudioSourceError=1]="AudioSourceError",e[e.AudioSourceTimeout=2]="AudioSourceTimeout",e[e.AuthTokenFetchError=3]="AuthTokenFetchError",e[e.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",e[e.UnAuthorized=5]="UnAuthorized",e[e.ConnectTimeout=6]="ConnectTimeout",e[e.ConnectError=7]="ConnectError",e[e.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",e[e.UnknownError=9]="UnknownError"}(Bi||(Bi={}));class cn{constructor(e,t,i){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=i,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}onEvent(e){if(!this.privIsDisposed&&(e instanceof rn&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof He&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Ke&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Be&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof qe&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof je&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof on&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof bt&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof At&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof It&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof Rt&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}}getTelemetry(){const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},i=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],i}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}dispose(){this.privIsDisposed=!0}getConnectionError(e){switch(e){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:"+e.toString()}}}var un=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class pn{constructor(e){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.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=e,this.privRequestId=Re(),this.privAudioNodeId=Re(),this.privTurnDeferral=new Oe,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}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new cn(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new rn(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t){return un(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new sn(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onPreConnectionStart(e,t){this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new on(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}onAuthCompleted(e){return un(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return un(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new an(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return un(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onSpeechContext(){this.privRequestId=Re()}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 Oe}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(){return un(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}))}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}onStopRecognizing(){return un(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(e){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),$e.instance.onEvent(e)}onComplete(){return un(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return un(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class hn{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach((e=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}class dn{constructor(e){this.privContext={},this.privDynamicGrammar=e}getSection(e){return this.privContext[e]||{}}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}setWordLevelTimings(){void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),void 0===this.privContext.phraseOutput.detailed&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed",-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();return this.setSection("dgi",e),JSON.stringify(this.privContext)}}class ln{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new ln(e)}get Offset(){return this.privSpeechStartDetected.Offset}}var vn,fn,gn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class mn{constructor(e,t,i,n,r){if(this.privConnectionConfigurationPromise=void 0,this.privConnectionPromise=void 0,this.privSetTimeout=setTimeout,this.privIsLiveAudio=!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,!e)throw new Te("authentication");if(!t)throw new Te("connectionFactory");if(!i)throw new Te("audioSource");if(!n)throw new Te("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=i,this.privRecognizerConfig=n,this.privIsDisposed=!1,this.privRecognizer=r,this.privRequestSession=new pn(this.privAudioSource.id()),this.privConnectionEvents=new Pe,this.privServiceEvents=new Pe,this.privDynamicGrammar=new hn,this.privSpeechContext=new dn(this.privDynamicGrammar),this.privAgentConfig=new Wt,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=tn.setTimeout),this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&this.cancelRecognitionLocal(ct.Error,1007===t.statusCode?ut.BadRequestParameters:ut.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(te.ConversationTranslator_Token,e)}set voiceProfileType(e){this.privRecognizerConfig.parameters.setProperty(te.SpeechServiceConnection_SpeakerIdMode,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return gn(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,i){return gn(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return void(yield this.recognizeOverride(e,t,i));this.privConnectionConfigurationPromise=void 0,this.privRecognizerConfig.recognitionMode=e,this.setSpeechSegmentationTimeout(),this.privSuccessCallback=t,this.privErrorCallback=i,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const n=this.connectImpl();let r;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,i=yield this.audioSource.deviceInfo;this.privIsLiveAudio=i.type&&i.type===ce.Microphones,r=new $i(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(r,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:i}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield n}catch(e){return void(yield this.cancelRecognitionLocal(ct.Error,ut.ConnectionFailure,e))}const s=new Xi(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,s),this.receiveMessage(),this.sendAudio(r).catch((e=>gn(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(ct.Error,ut.RuntimeError,e)}))))}))}stopRecognizing(){return gn(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return gn(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((()=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return gn(this,void 0,void 0,(function*(){if(yield this.cancelRecognitionLocal(ct.Error,ut.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride()),void 0!==this.privConnectionPromise)try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=void 0}))}sendMessage(e){}sendNetworkMessage(e,t){return gn(this,void 0,void 0,(function*(){const i="string"==typeof t?ot.Text:ot.Binary,n="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new Jt(i,e,this.privRequestSession.requestId,n,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return gn(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==mn.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(mn.telemetryData)try{mn.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new Jt(ot.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,i){return gn(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,i))}))}receiveMessage(){return gn(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const i=Jt.fromConnectionMessage(t);if(i.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(i.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=ln.fromJSON(i.textBody),n=new Ji(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,n);break;case"speech.enddetected":let r;r=i.textBody.length>0?i.textBody:"{ Offset: 0 }";const s=ln.fromJSON(r);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(s.Offset+this.privRequestSession.currentTurnAudioOffset);const o=new Ji(s.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,o);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(ct.EndOfStream,ut.NoError,void 0));const a=new Xi(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,a));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(i))||this.privServiceEvents&&this.serviceEvents.onEvent(new St(i.path.toLowerCase(),i.textBody))}return this.receiveMessage()}catch(e){return null}}))}setSpeechSegmentationTimeout(){}sendSpeechContext(e,t){const i=this.speechContext.toJSON();if(t&&this.privRequestSession.onSpeechContext(),i)return e.send(new Jt(ot.Text,"speech.context",this.privRequestSession.requestId,"application/json",i))}noOp(){}sendPrePayloadJSON(e,t=!0){return gn(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e,t),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return gn(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new Jt(ot.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return void 0!==this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===at.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((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}sendSpeechServiceConfig(e,t,i){if(t.onSpeechContext(),!0!==mn.telemetryDataEnabled){const e={context:{system:JSON.parse(i).context.system}};i=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("f0f5debc-f8c9-4892-ac4b-90a7ab359fd2","false").toLowerCase()){const e=JSON.parse(i);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",i=JSON.stringify(e)}if(i)return e.send(new Jt(ot.Text,"speech.config",t.requestId,"application/json",i))}fetchConnection(){return gn(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===at.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(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return gn(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let i=Date.now();const n=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),r=t.avgBytesPerSec/1e3*parseInt(n,10),s=this.privRequestSession.recogNumber,o=()=>gn(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===s){const n=yield this.fetchConnection(),a=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let c,u;if(!a||a.isEnd?(c=null,u=0):(c=a.buffer,this.privRequestSession.onAudioSent(c.byteLength),u=r>=this.privRequestSession.bytesSent?0:Math.max(0,i-Date.now())),0!==u&&(yield this.delay(u)),null!==c&&(i=Date.now()+1e3*c.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===s){if(n.send(new Jt(ot.Binary,"audio",this.privRequestSession.requestId,null,c)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==a?void 0:a.isEnd))return o();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return o()}))}retryableConnect(){return gn(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=Re();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:Re(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let i=0,n="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),r=yield t;yield this.privRequestSession.onAuthCompleted(!1);const s=this.privConnectionFactory.create(this.privRecognizerConfig,r,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(s.events),s.events.attach((e=>{this.connectionEvents.onEvent(e)}));const o=yield s.open();if(200===o.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(o.statusCode),Promise.resolve(s);1006===o.statusCode&&(e=!0),i=o.statusCode,n=o.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(i,n),Promise.reject(`Unable to contact server. StatusCode: ${i}, ${this.privRecognizerConfig.parameters.getProperty(te.SpeechServiceConnection_Endpoint)} Reason: ${n}`)}))}delay(e){return new Promise((t=>this.privSetTimeout(t,e)))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const i=new Uint8Array(e);t+=`${e.byteLength}\r\n`;for(let n=0;n<e.byteLength;n++)t+=i[n].toString(16).padStart(2,"0")+" ",(n+1)%16==0&&(console.info(t),t="")}console.info(t)}sendFinalAudio(){return gn(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new Jt(ot.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return gn(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e,!1),e)}))}}mn.telemetryDataEnabled=!0;class Sn{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new Sn(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}!function(e){e[e.Success=0]="Success",e[e.SynthesisEnd=1]="SynthesisEnd",e[e.Error=2]="Error"}(vn||(vn={})),function(e){e[e.Success=0]="Success",e[e.NoMatch=1]="NoMatch",e[e.InitialSilenceTimeout=2]="InitialSilenceTimeout",e[e.BabbleTimeout=3]="BabbleTimeout",e[e.Error=4]="Error",e[e.EndOfDictation=5]="EndOfDictation",e[e.TooManyRequests=6]="TooManyRequests",e[e.BadRequest=7]="BadRequest",e[e.Forbidden=8]="Forbidden"}(fn||(fn={}));class yn{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=fn[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new yn(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}class bn{static implTranslateRecognitionResult(e){let t=pt.Canceled;switch(e){case fn.Success:t=pt.RecognizedSpeech;break;case fn.NoMatch:case fn.InitialSilenceTimeout:case fn.BabbleTimeout:case fn.EndOfDictation:t=pt.NoMatch;break;case fn.Error:case fn.BadRequest:case fn.Forbidden:default:t=pt.Canceled}return t}static implTranslateCancelResult(e){let t=ct.EndOfStream;switch(e){case fn.Success:case fn.EndOfDictation:case fn.NoMatch:t=ct.EndOfStream;break;case fn.InitialSilenceTimeout:case fn.BabbleTimeout:case fn.Error:case fn.BadRequest:case fn.Forbidden:default:t=ct.Error}return t}static implTranslateCancelErrorCode(e){let t=ut.NoError;switch(e){case fn.Error:t=ut.ServiceError;break;case fn.TooManyRequests:t=ut.TooManyRequests;break;case fn.BadRequest:t=ut.BadRequestParameters;break;case fn.Forbidden:t=ut.Forbidden;break;default:t=ut.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case ut.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case ut.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case ut.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}class An{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=fn[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new An(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const i=e-t;for(const e of this.privDetailedSpeechPhrase.NBest){if(e.Words)for(const t of e.Words)t.Offset+=i;if(e.DisplayWords)for(const t of e.DisplayWords)t.Offset+=i}}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display||this.privDetailedSpeechPhrase.NBest[0].DisplayText:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class wn extends mn{constructor(e,t,i,n,r){super(e,t,i,n,r),this.privSpeechRecognizer=r;const s={};if(void 0!==n.autoDetectSourceLanguages){const e=n.autoDetectSourceLanguages.split(",");let t;t="Continuous"===n.languageIdMode?"DetectContinuous":"DetectAtAudioStart",this.privSpeechContext.setSection("languageId",{Priority:"PrioritizeLatency",languages:e,mode:t,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}});const i=n.sourceLanguageModels;void 0!==i&&(s.customModels=i,s.onInterim={action:"None"},s.onSuccess={action:"None"})}(e=>{for(const t in e)return!1;return!0})(s)||this.privSpeechContext.setSection("phraseDetection",s)}setSpeechSegmentationTimeout(){const e=this.privRecognizerConfig.parameters.getProperty(te.Speech_SegmentationSilenceTimeoutMs,void 0);if(void 0!==e){const t=this.recognitionMode===se.Conversation?"CONVERSATION":this.recognitionMode===se.Dictation?"DICTATION":"INTERACTIVE",i=parseInt(e,10),n=this.privSpeechContext.getSection("phraseDetection");n.mode=t,n[t]={segmentation:{mode:"Custom",segmentationSilenceTimeoutMs:i}},this.privSpeechContext.setSection("phraseDetection",n)}}processTypeSpecificMessages(e){return t=this,i=void 0,r=function*(){let t;const i=new ue;i.setProperty(te.SpeechServiceResponse_JsonResult,e.textBody);let n=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const r=Sn.fromJSON(e.textBody),s=r.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Wi(this.privRequestSession.requestId,pt.RecognizingSpeech,r.Text,r.Duration,s,r.Language,r.LanguageDetectionConfidence,void 0,void 0,e.textBody,i),this.privRequestSession.onHypothesis(s);const o=new Qi(t,r.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,o)}catch(e){}n=!0;break;case"speech.phrase":const a=yn.fromJSON(e.textBody),c=bn.implTranslateRecognitionResult(a.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+a.Offset+a.Duration),pt.Canceled===c){const e=bn.implTranslateCancelResult(a.RecognitionStatus),t=bn.implTranslateCancelErrorCode(a.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,bn.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||c!==pt.NoMatch||a.RecognitionStatus===fn.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(Q)===ie[ie.Simple])t=new Wi(this.privRequestSession.requestId,c,a.DisplayText,a.Duration,a.Offset+this.privRequestSession.currentTurnAudioOffset,a.Language,a.LanguageDetectionConfidence,void 0,void 0,e.textBody,i);else{const n=An.fromJSON(e.textBody),r=n.Offset+this.privRequestSession.currentTurnAudioOffset,s=n.getJsonWithCorrectedOffsets(r);t=new Wi(this.privRequestSession.requestId,c,n.RecognitionStatus===fn.Success?n.NBest[0].Display:void 0,n.Duration,r,n.Language,n.LanguageDetectionConfidence,void 0,void 0,s,i)}const n=new Qi(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,n)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}n=!0}return n},new((n=void 0)||(n=Promise))((function(e,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}cancelRecognition(e,t,i,n,r){const s=new ue;if(s.setProperty(Z,ut[n]),this.privSpeechRecognizer.canceled){const t=new Yi(i,r,n,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Wi(t,pt.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,r,void 0,s);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class Cn{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class In{constructor(e){if(!e)throw new Te("subscriptionKey");this.privAuthInfo=new Cn(Xt.AuthKey,e)}fetch(e){return Promise.resolve(this.privAuthInfo)}fetchOnExpiry(e){return Promise.resolve(this.privAuthInfo)}}class Rn{constructor(e,t){if(!e)throw new Te("fetchCallback");if(!t)throw new Te("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}fetch(e){return this.privFetchCallback(e).then((e=>new Cn(Xt.Authorization,void 0===e?void 0:Rn.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new Cn(Xt.Authorization,void 0===e?void 0:Rn.privTokenPrefix+e)))}}Rn.privTokenPrefix="bearer ";var Tn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};class _n{constructor(e,t,i){this.audioConfig=void 0!==e?e:ri.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=i,this.implCommonRecognizerSetup()}close(e,t){ee.throwIfDisposed(this.privDisposed),Le(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return Tn(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return mn.telemetryDataEnabled}static enableTelemetry(e){mn.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",i="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,i=navigator.appVersion);const n=this.createRecognizerConfig(new fe(new ge(new Se(e,t,i))));this.privReco=this.createServiceRecognizer(_n.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,n)}recognizeOnceAsyncImpl(e){return Tn(this,void 0,void 0,(function*(){ee.throwIfDisposed(this.privDisposed);const t=new Oe;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const i=yield t.promise;return yield this.implRecognizerStop(),i}))}startContinuousRecognitionAsyncImpl(e){return Tn(this,void 0,void 0,(function*(){ee.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return Tn(this,void 0,void 0,(function*(){ee.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return Tn(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(te.SpeechServiceConnection_Key,void 0);return t&&""!==t?new In(t):new Rn((()=>{const t=e.getProperty(te.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(()=>{const t=e.getProperty(te.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}))}}class En extends _n{constructor(e,t){const i=e;ee.throwIfNull(i,"speechConfig"),ee.throwIfNullOrWhitespace(i.properties.getProperty(te.SpeechServiceConnection_RecoLanguage),te[te.SpeechServiceConnection_RecoLanguage]),super(t,i.properties,new Vi),this.privDisposedRecognizer=!1}static FromConfig(e,t,i){const n=e;return t.properties.mergeTo(n.properties),new En(e,i)}get endpointId(){return ee.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(te.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(te.SpeechServiceAuthorization_Token)}set authorizationToken(e){ee.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(te.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return ee.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(te.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return ee.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Q,ie[ie.Simple])===ie[ie.Simple]?ie.Simple:ie.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){Le(this.recognizeOnceAsyncImpl(se.Interactive),e,t)}startContinuousRecognitionAsync(e,t){Le(this.startContinuousRecognitionAsyncImpl(se.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){Le(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,i){ee.throwIfNull(e,"model"),i&&i("Not yet implemented.")}stopKeywordRecognitionAsync(e){e&&e()}close(e,t){ee.throwIfDisposed(this.privDisposedRecognizer),Le(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return i=this,n=void 0,s=function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))},new((r=void 0)||(r=Promise))((function(e,t){function o(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(o,a)}c((s=s.apply(i,n||[])).next())}));var i,n,r,s}createRecognizerConfig(e){return new ve(e,this.privProperties)}createServiceRecognizer(e,t,i,n){return new wn(e,t,i,n,this)}}var Pn,kn=function(){function e(t,i,n){this.isRunning=!1,this.baseSudASR=new J(n,this),V.d(e._TAG,"speechRegion:",i),this.speechConfig=pe.fromSubscription(t,i)}return e.prototype.startASR=function(t){var i=this;if(V.d(e._TAG,"startASR language: "+t+" isRunning: "+this.isRunning),!this.isRunning){this.isRunning=!0;var n=ri.fromStreamInput(this.createMicrophoneStream());this.speechConfig.speechRecognitionLanguage=t,this.reco=new En(this.speechConfig,n),this.reco.recognized=function(t,n){if(V.d(e._TAG,"onRecognizedResult",n.result),n.result.reason===pt.RecognizedSpeech){var r=n.result.text;i.baseSudASR.onRecognizedResult(r)}},this.reco.startContinuousRecognitionAsync()}},e.prototype.stopASR=function(){V.d(e._TAG,"stopASR:",this.isRunning),this.isRunning&&(this.isRunning=!1,this.reco&&(this.releaseMicrophoneStream(),this.reco.stopContinuousRecognitionAsync()))},e.prototype.pushAudio=function(e,t){this.microphoneStream&&e&&t>0&&this.microphoneStream.write(e.slice())},e.prototype.handleGameASR=function(e){this.baseSudASR.handleGameASR(e)},e.prototype.createMicrophoneStream=function(){return this.releaseMicrophoneStream(),this.microphoneStream=dt.createPushStream(),this.microphoneStream},e.prototype.releaseMicrophoneStream=function(){this.microphoneStream&&(this.microphoneStream.close(),this.microphoneStream=null)},e._TAG="AzureRealSudASRImpl",e}();!function(e){e[e.UNDEFINED=-1]="UNDEFINED",e[e.AZURE=1]="AZURE",e[e.SHU_MEI=2]="SHU_MEI"}(Pn||(Pn={}));var Dn,Mn=function(){function e(e){this._iSudASR=this.createASRImpl(e)}return e.prototype.createASRImpl=function(t){t.supportNumberLanguageList=e.getASRTextLanguageList(),t.supportTextLanguageList=e.getASRNumberLanguageList();var i=e.getUseASRType();if(V.d(e._TAG,"asrType:"+i),V.d(e._TAG,"asrLoadList:"+O.getAsrLoadList()),i===Pn.AZURE){var n=O.getSdkRtssCfg();if(null!=n&&null!=n.microsoft_rtss_cfg){var r=n.microsoft_rtss_cfg;return new kn(r.speech_subscription_key,r.speech_region,t)}return null}return null},e.prototype.startASR=function(e){null!=this._iSudASR&&this._iSudASR.startASR(e)},e.prototype.stopASR=function(){null!=this._iSudASR&&this._iSudASR.stopASR()},e.prototype.handleGameASR=function(e){null!=this._iSudASR&&this._iSudASR.handleGameASR(e)},e.prototype.pushAudio=function(e,t){null!=this._iSudASR&&this._iSudASR.pushAudio(e,t)},e.getASRTextLanguageList=function(){switch(this.getUseASRType()){case Pn.AZURE:return O.getAzureASRTextLanguageList();case Pn.SHU_MEI:default:return[]}},e.getASRNumberLanguageList=function(){switch(this.getUseASRType()){case Pn.AZURE:return O.getAzureASRNumberLanguageList();case Pn.SHU_MEI:default:return[]}},e.getUseASRType=function(){var e=O.getAsrLoadList();if(!e.length)return Pn.UNDEFINED;for(var t=0;t<e.length;t++){var i=e[t];if(i===Pn.AZURE)return i;if(i===Pn.SHU_MEI)return i}return Pn.UNDEFINED},e._TAG="ProxyASRImpl",e}(),On=function(){function e(e,t,i,n,r){this.kTag="SudFSMMGStateHandlerImpl",this._mgLogListener=null,this._fsmMG=e,this._userId=t,this._roomId=i,this._code=n,this._mgId=r,this._dynamicConfig="",this._GameCustomStateListener={onGameLoadStarted:function(){},onGameLoadCompleted:function(){},onGameStarted:function(){},onGameASR:function(){},onGameLoadPercent:function(e){},onPlayerSelfInfo:function(e){},onGameLlmASR:function(e){}},this._gameStateMap=new Map,this._playerStateMap=new Map,this._appStateMap=new Map}return e.prototype.getGameState=function(e){return""},e.prototype.getPlayerState=function(e,t){return""},e.prototype.setCode=function(e){},e.prototype.setGameCustomStateListener=function(e){this._GameCustomStateListener=e},e.prototype.setDynamicConfig=function(e){this._dynamicConfig=e},e.prototype.handleCmd=function(e,t,i,n,r){null!=e?null!=t?"game"===e?"m2as-set-debug"===i?this.handleSetDebug(r,i,n):"m2as-mg-log"===i?this.handleMgLog(r,i,n):"m2as-get-net-status"===i?this.handleGetNetStatus(r,i,n):"m2as-get-game-view-info"===i?this.handleGetGameViewInfo(r,i,n):"m2as-get-game-cfg"===i?this.handleGetGameCfg(r,i,n):"m2as-vibrate"===i?this.handleVibrate(r,i,n):"m2as-get-sdk-info"===i?this.handleGetSDKInfo(r,i,n):"m2as-get-state"===i?this.handleGetState(r,i,n):"m2as-notify-game-load-started"===i?this.handleNotifyGameLoadStarted(r,i,n):"m2as-notify-game-load-completed"===i?this.handleNotifyGameLoadCompleted(r,i,n):"m2as-notify-game-started"===i?this.handleNotifyGameStarted(r,i,n):"mg_common_game_load_percent"===i?this.handleNotifyGameLoadPercent(r,i,n):"m2as-expire-code"===i?this.handleExpireCode(r,i,n):"mg_common_game_asr"===i?this.handleGameASR(r,i,n):"m2as-login"===i?this.handleLogin(r,i,n):"mg_common_game_player_self_info"===i?this.handleSelfInfo(r,i,n):"mg_common_game_llm_asr"===i?this.handleGameLlmAsr(r,i,n):this.handleGameNotifyStateChange(r,i,n):"player"===e?this.handlePlayerNotifyStateChange(r,t,i,n):"gameLog"===e||"gameError"===e?this._mgLogListener&&this._mgLogListener(e,n):r.fail(_.toJson(_.kFail,"param invalid cmd is not game or player")):r.fail(_.toJson(_.kFail,"param invalid param is null")):r.fail(_.toJson(_.kFail,"param invalid cmd is null"))},e.prototype.handleSetDebug=function(e,t,i){V.d(this.kTag,"handleSetDebug {0} = {1}",t,i),e.success(_.kSuccessJson)},e.prototype.setMgLogListener=function(e){this._mgLogListener=e},e.prototype.handleMgLog=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGameLog(i),e.success(_.kSuccessJson)},e.prototype.handleGetNetStatus=function(e,t,i){V.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success('{"retCode":0, "retMsg":"success", "net_type":1}')},e.prototype.handleGetGameViewInfo=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGetGameViewInfo(e,i)},e.prototype.handleGetGameCfg=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGetGameCfg(e,i)},e.prototype.handleNotifyGameLoadPercent=function(e,t,i){V.d(this.kTag,"handleNotifyGameLoadPercent {0} = {1}",t,i),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLoadPercent(i),e.success(_.kSuccessJson)},e.prototype.handleGameLlmAsr=function(e,t,i){console.log(t,"handleGameLlmAsr"),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLlmASR(i),e.success(_.kSuccessJson)},e.prototype.handleVibrate=function(e,t,i){V.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success(_.kSuccessJson)},e.prototype.handleGetSDKInfo=function(e,t,i){var n={ret_code:_.kSuccess,ret_msg:"success",env_type:O.getEnvType(),language:O.getLanguage(),wordLanguage:O.getLanguage(),asr_text_language_list:Mn.getASRTextLanguageList(),asr_number_language_list:Mn.getASRNumberLanguageList(),sdk_version:w.kVersion,app_id:O.getAppId(),platform:O.getPlatform(),bundle_id:O.getBundleID(),sud_sdk_trace_id:O.genTraceId(),mg_id:Number(this._mgId),mg_id_str:this._mgId,mg_api_cfg:O.getMgApiCfgJson(),app_server_info_url:"",game_login_url:"",dynamic_config:this._dynamicConfig};null==O.getSdkRtssCfg()||null==O.getSdkRtssCfg().sm_game_word_language||O.getSdkRtssCfg().sm_game_word_language||(n.wordLanguage=O.getSdkRtssCfg().sm_game_word_language);var r=O.getMgApiCfg();n.app_server_info_url=r.app_server_info_url,n.game_login_url=r.game_login_url,V.d(this.kTag,"getSDKInfo",n),e.success(JSON.stringify(n))},e.prototype.handleGetState=function(e,t,i){V.d(this.kTag,"handleGetState {0} = {1}",t,i),e.success("{}")},e.prototype.handleNotifyGameLoadStarted=function(e,t,i){var n;V.d(this.kTag,"onGameLoadStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadStarted(),null===(n=this._fsmMG)||void 0===n||n.onGameLoadingProgress(2,_.kSuccess,99),e.success(_.kSuccessJson)},e.prototype.handleNotifyGameLoadCompleted=function(e,t,i){V.d(this.kTag,"onGameLoadCompleted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadCompleted(),e.success(_.kSuccessJson)},e.prototype.handleNotifyGameStarted=function(e,t,i){var n,r;V.d(this.kTag,"onGameStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameStarted(),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStarted)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStarted()),e.success(_.kSuccessJson)},e.prototype.handleLogin=function(e,t,i){V.d(this.kTag,"handleLogin {0} = {1}",t,i);var n={ret_code:_.kSuccess,ret_msg:"success",user_id:this._userId,room_id:this._roomId,mg_id:Number(this._mgId),mg_id_str:this._mgId,code:this._code,app_id:O.getAppId(),platform:O.getPlatform(),bundle_id:O.getBundleID(),sud_sdk_trace_id:O.genTraceId()};e.success(JSON.stringify(n))},e.prototype.handleExpireCode=function(e,t,i){var n,r;(null===(n=this._fsmMG)||void 0===n?void 0:n.onExpireCode)&&(null===(r=this._fsmMG)||void 0===r||r.onExpireCode(e,i))},e.prototype.handleGameASR=function(e,t,i){var n,r;V.d(this.kTag,"onGameASR {0} = {1}",t,i),this._GameCustomStateListener.onGameASR(i),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e.prototype.handleGameNotifyStateChange=function(e,t,i){var n,r;(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e.prototype.handlePlayerNotifyStateChange=function(e,t,i,n){var r,s;(null===(r=this._fsmMG)||void 0===r?void 0:r.onPlayerStateChange)&&(null===(s=this._fsmMG)||void 0===s||s.onPlayerStateChange(e,t,i,n))},e.prototype.handleSelfInfo=function(e,t,i){var n,r;null!=this._GameCustomStateListener.onPlayerSelfInfo&&this._GameCustomStateListener.onPlayerSelfInfo(i),(null===(n=this._fsmMG)||void 0===n?void 0:n.onGameStateChange)&&(null===(r=this._fsmMG)||void 0===r||r.onGameStateChange(e,t,i))},e}();!function(e){e[e.START=1]="START",e[e.LOADING=2]="LOADING",e[e.END=3]="END"}(Dn||(Dn={}));var Ln="SudMGP",xn=function(){function e(){}return e.sendAppCustomCommandEvent=function(e,t,i,n){e.contentWindow&&e.contentWindow.postMessage({msgTag:Ln,msgType:11,ctxId:t,state:i,dataJson:n},"*")},e.sendGameCustomCommandCallback=function(e,t,i,n,r){e.contentWindow&&e.contentWindow.postMessage({msgTag:Ln,msgType:12,ctxId:t,isSuccess:i,state:n,dataJson:r},"*")},e}(),Gn=function(){function e(e,t,i){this._isCalled=!1,this._window=e,this._ctxId=t,this._state=i}return e.prototype.success=function(e){this._isCalled||(xn.sendGameCustomCommandCallback(this._window,this._ctxId,!0,this._state,e),this._isCalled=!0)},e.prototype.fail=function(e){this._isCalled||(xn.sendGameCustomCommandCallback(this._window,this._ctxId,!1,this._state,e),this._isCalled=!0)},e}(),zn=function(){function e(){}return e.create=function(e,t){var i={iSudFSTAPP:t,language:e.language,supportTextLanguageList:[],supportNumberLanguageList:[]};return new Mn(i)},e}(),Nn=function(){function e(){this._statsEvent=null,this.steps=[],this.loadTimestamp=Date.now()}return e.prototype.startLoad=function(e){this._statsEvent=new R(R.kStatsEventLoadGameFinished),this._statsEvent.setTimeout_code(0),this.steps=[],this._statsEvent.setLocal_core(!0),this._statsEvent.setLocal_pkg(!0),this._statsEvent.setMgId(e.mgId),this.loadTimestamp=Date.now()},e.prototype.reportStats=function(){null!=this._statsEvent&&(this._statsEvent.getEvent()!==R.kStatsEventLoadGameFinished&&(this._statsEvent.setEvent(R.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()),this._statsEvent.putExtra("loadGame",this.steps),T.report(this._statsEvent),this._statsEvent=null)},e.prototype.reportTimeoutEvent=function(e){if(null!==this._statsEvent){if(80===e)this._statsEvent.setRetCode(_.ENGINE_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(_.ENGINE_LOAD_TIMEOUT),this._statsEvent.setRetMsg("引擎加载超时");else{if(!(e>=85&&e<100))return;this._statsEvent.setRetCode(_.GAME_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(_.GAME_LOAD_TIMEOUT),this._statsEvent.setRetMsg("游戏加载超时")}this._statsEvent.setEvent(R.kStatsEventLoadGameTimeout),this._statsEvent.putExtra("loadGame",this.steps),T.report(this._statsEvent),this._statsEvent.setEvent(R.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()}},e.prototype.setLocal_pkg=function(e){null!=this._statsEvent&&this._statsEvent.setLocal_pkg(e)},e.prototype.setLocal_core=function(e){null!=this._statsEvent&&this._statsEvent.setLocal_core(e)},e.prototype.setRetCode=function(e){null!=this._statsEvent&&this._statsEvent.setRetCode(e)},e.prototype.setRetMsg=function(e){null!=this._statsEvent&&this._statsEvent.setRetMsg(e)},e.prototype.putStatsEvent=function(e,t,i){if(null!=this.steps){var n=Date.now(),r={step:e,percent:t,extra:i,cost_time:n-this.loadTimestamp};this.steps.push(r),this.loadTimestamp=n}},e}(),Un=function(){function e(){}return e.GET_MG_INFO="getMgInfo",e.DOWNLOAD_CORE="downloadCore",e.DOWNLOAD_GAME_PACKAGE="checkoutGamePackage",e.LOAD_GAME_RUNTIME="loadGameRuntime",e.LOAD_GAME_PERCENT="loadGamePercent",e}(),Bn=function(){function e(){this.url="",this.appId="",this.token="",this.resourceId="",this.uid=""}return e.prototype.getUrl=function(){return this.url},e.prototype.getAppId=function(){return this.appId},e.prototype.getToken=function(){return this.token},e.prototype.getResourceId=function(){return this.resourceId},e.prototype.getUid=function(){return this.uid},e.prototype.getLanguage=function(){return this.language},e.prototype.getModelName=function(){return this.modelName},e.prototype.getMgId=function(){return this.mgId},e.prototype.getRoomId=function(){return this.roomId},e.prototype.setUrl=function(e){return this.url=e,this},e.prototype.setAppId=function(e){return this.appId=e,this},e.prototype.setToken=function(e){return this.token=e,this},e.prototype.setResourceId=function(e){return this.resourceId=e,this},e.prototype.setUid=function(e){return this.uid=e,this},e.prototype.setLanguage=function(e){return this.language=e,this},e.prototype.setModelName=function(e){return this.modelName=e,this},e.prototype.setMgId=function(e){return this.mgId=e,this},e.prototype.setRoomId=function(e){return this.roomId=e,this},e.prototype.setDoubaoRtssCfg=function(e){return e?(this.url=e.url||"",this.appId=e.app_key||"",this.token=e.access_key||"",this.resourceId=e.resource_id||"",this.modelName=e.model_name,this):this},e}(),Fn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},Hn=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},Kn=0;function jn(e){var t=new ArrayBuffer(4);return new DataView(t).setInt32(0,e,!1),new Uint8Array(t)}var qn=function(e){var t=e.requestData,i=e.isLast,n=e.isGzip;return Fn(void 0,void 0,void 0,(function(){var e,r,s,o,a,c,u,p;return Hn(this,(function(h){switch(h.label){case 0:if(!n)return[3,5];Kn++,i&&(Kn=-Math.abs(Kn)),h.label=1;case 1:return h.trys.push([1,3,,4]),e=Xn({message_type:2,message_type_specific_flags:i?3:1,compression_type:1}),r=jn(Kn),[4,Wn(t)];case 2:return s=h.sent(),o=jn(s.length),a=e.length+r.length+o.length+s.length,c=new Uint8Array(a),u=0,c.set(e,u),u+=e.length,c.set(r,u),u+=r.length,c.set(o,u),u+=o.length,c.set(s,u),[2,c];case 3:return p=h.sent(),V.w("DoubaoAsrClient","encodeAudioOnlyRequest gzip error",p),[2,Vn({requestData:t,isLast:i,isGzip:!1})];case 4:return[3,6];case 5:return[2,Vn({requestData:t,isLast:i,isGzip:!1})];case 6:return[2]}}))}))},Vn=function(e){var t=e.requestData,i=e.isLast,n=Jn(i?{message_type:2,message_type_specific_flags:2}:{message_type:2}),r=t instanceof Blob?t.size:new Blob([t]).size;return n.setUint32(4,r,!1),new Blob([n,t])};function Wn(e){return Fn(this,void 0,void 0,(function(){var t,i,n,r;return Hn(this,(function(s){switch(s.label){case 0:return t=e instanceof Blob?e.stream():new ReadableStream({start:function(t){t.enqueue(e),t.close()}}),i=new CompressionStream("gzip"),n=t.pipeThrough(i),[4,new Response(n).arrayBuffer()];case 1:return r=s.sent(),[2,new Uint8Array(r)]}}))}))}var Xn=function(e){var t=e.message_type,i=void 0===t?1:t,n=e.version,r=void 0===n?1:n,s=e.message_type_specific_flags,o=void 0===s?0:s,a=e.serial_method,c=void 0===a?1:a,u=e.compression_type,p=void 0===u?0:u,h=e.reserved_data,d=void 0===h?0:h,l=e.extension_header,v=void 0===l?new ArrayBuffer(0):l,f=new ArrayBuffer(4),g=new DataView(f),m=Math.trunc(v.byteLength/4)+1;return g.setUint8(0,r<<4|m),g.setUint8(1,i<<4|o),g.setUint8(2,c<<4|p),g.setUint8(3,d),new Uint8Array(f)},Jn=function(e){var t=e.message_type,i=void 0===t?1:t,n=e.version,r=void 0===n?1:n,s=e.message_type_specific_flags,o=void 0===s?0:s,a=e.serial_method,c=void 0===a?1:a,u=e.compression_type,p=void 0===u?0:u,h=e.reserved_data,d=void 0===h?0:h,l=e.extension_header,v=void 0===l?new ArrayBuffer(0):l,f=new ArrayBuffer(8),g=new DataView(f),m=Math.trunc(v.byteLength/4)+1;return g.setUint8(0,r<<4|m),g.setUint8(1,i<<4|o),g.setUint8(2,c<<4|p),g.setUint8(3,d),g},Qn=function(){function e(e,t,i,n,r){this.seq_no=0,this.session_id="",this.isRunning=!1,this.startMs=0,this.durationMillisecond=0,this.billingTimer=null,this.mg_id=e,this.csp=t,this.user_id=i,this.room_id=n,this.mIAsrBillingListener=r}return e.prototype.startBilling=function(){this.isRunning||(this.isRunning=!0,this.seq_no=0,this.session_id=this.generateMD5UUID(),this.startMs=Date.now(),this.startHeartbeat())},e.prototype.stopBilling=function(){this.isRunning&&(this.isRunning=!1,this.billingTimer&&(clearTimeout(this.billingTimer),this.billingTimer=null),this.reportBilling())},e.prototype.startHeartbeat=function(){var e=this;this.billingTimer&&clearTimeout(this.billingTimer),this.billingTimer=window.setTimeout((function(){e.reportBilling(),e.startHeartbeat()}),1e4)},e.prototype.reportBilling=function(){var e=Date.now()-this.startMs;if(this.startMs=Date.now(),!(e>6e4)){this.durationMillisecond+=e;var t=Math.ceil(this.durationMillisecond/1e3),i={seq_no:++this.seq_no,session_id:this.session_id,mg_id:this.mg_id,csp:this.csp,user_id:this.user_id,room_id:this.room_id,duration:t};this.mIAsrBillingListener.onReportDuration(i)}},e.prototype.generateMD5UUID=function(){return h()(A())},e}(),Zn=function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},Yn=function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},$n=function(){function e(e){this._TAG="DoubaoAsrClient",this.webSocket=null,this.mIAsrBillingListener=null,this.isRunning=!1,this.mgId="",this.roomId="",this.userId="",this.doubaoPcmDataSource=[],this.sendLastPackageCompleted=!1,this.mLastText=null,this.canGzip=!1,this.mCommonAsrBillingManager=null,this.canGzip=this.canGzipCompress(),V.d(this._TAG,"gzip canGzipCompress",this.canGzip),this.mIAsrBillingListener=e}return e.prototype.canGzipCompress=function(){return E()},e.prototype.startRecognize=function(e,t){if(!this.isRunning&&(this.isRunning=!0,e)){V.d(this._TAG,"startRecognize");var i=this;this.mgId=e.getMgId(),this.roomId=e.getRoomId(),this.userId=e.getUid();var n=e.getUrl(),r=e.getAppId(),s=e.getLanguage(),o={user:{uid:this.userId},audio:{format:"pcm",sample_rate:16e3,bits:16,channel:1,codec:"raw",language:s||"zh-CN"},request:{model_name:"bigmodel",enable_punc:!0,enable_itn:!0,end_window_size:800,force_to_speech_time:1e3,result_type:"single"}},a={};O.getHttpService().getDoubaoAsrToken({onSuccess:function(s){var c=s.data.token;c&&(a.api_resource_id=e.getResourceId(),a.api_app_key=r,a.api_access_key="Jwt; ".concat(c));var u=function(e,t){var i=[];for(var n in t)i.push("".concat(n,"=").concat(encodeURIComponent(t[n])));return"".concat(e,"?").concat(i.join("&"))}(n,a);i.connect({url:u,config:o,listener:t})},onFailure:function(e){V.e(i._TAG,"getDoubaoAsrToken err",e),t.onFailure(e)}})}},e.prototype.connect=function(e){var t=this,i=e.url,n=e.config,r=e.listener;this.webSocket=new WebSocket(i);var s=this.webSocket,o=this;s.onopen=function(){return Zn(t,void 0,void 0,(function(){var e;return Yn(this,(function(t){switch(t.label){case 0:return o.startBilling(),V.d(o._TAG,"webSocket open"),[4,(i=n,a=this.canGzip,Fn(void 0,void 0,void 0,(function(){var e,t,n,r,s,o,c,u,p,h,d;return Hn(this,(function(l){switch(l.label){case 0:return e=JSON.stringify(i),a?(Kn=1,t=Xn({message_type:1,message_type_specific_flags:1,compression_type:1}),n=new TextEncoder,r=n.encode(e),s=jn(Kn),[4,Wn(r)]):[3,2];case 1:return o=l.sent(),c=jn(o.length),u=t.length+s.length+c.length+o.length,p=new Uint8Array(u),h=0,p.set(t,h),h+=t.length,p.set(s,h),h+=s.length,p.set(c,h),h+=c.length,p.set(o,h),[2,p];case 2:return(d=Jn({message_type:1})).setUint32(4,e.length,!1),[2,new Blob([d.buffer,e])]}}))})))];case 1:return e=t.sent(),s.send(e),r.onRecognizeSuccess(),[2]}var i,a}))}))},s.onmessage=function(e){return Zn(t,void 0,void 0,(function(){var t,i,s,a;return Yn(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),t="bigmodel"===(null===(a=n.request)||void 0===a?void 0:a.model_name),[4,this.parseResponse(e.data,{hasSequence:t},r)];case 1:if(i=c.sent(),t){if(i.code!==_.kSuccess)return r.onFailure(i),o.stopRecognize(),[2];if(i.isLasrPackage)return this.sendLastPackageCompleted=!0,V.d(o._TAG,"服务器返回了最后一个包,关闭asr识别"),o.stopRecognize(),[2];if(o.sendLastPackageCompleted)return V.d(o._TAG,"已经发了最后一个包,不再发送数据包"),o.stopRecognize(),[2];o.checkIfNeedToSendPcmData()}return[3,3];case 2:return s=c.sent(),V.e(o._TAG,"onmessage error",s),[3,3];case 3:return[2]}}))}))},s.onclose=function(){t.stopBilling(),r.onClosed&&r.onClosed()},s.onerror=function(e){r.onFailure&&r.onFailure(e)}},e.prototype.sendData=function(e){return Zn(this,void 0,void 0,(function(){var t;return Yn(this,(function(i){switch(i.label){case 0:return this.webSocket?[4,qn({requestData:e,isGzip:this.canGzip})]:[2,!1];case 1:return t=i.sent(),this.webSocket.readyState===this.webSocket.OPEN&&this.webSocket.send(t),[2]}}))}))},e.prototype.pauseRecognize=function(){return Zn(this,void 0,void 0,(function(){var e;return Yn(this,(function(t){switch(t.label){case 0:return V.d(this._TAG,"pauseRecognize"),null==this.webSocket?[3,2]:(V.d(this._TAG,"发送最后一个包"),[4,qn({requestData:new Blob,isLast:!0,isGzip:this.canGzip})]);case 1:e=t.sent(),this.webSocket.send(e),t.label=2;case 2:return[2]}}))}))},e.prototype.stopRecognize=function(){return Zn(this,void 0,void 0,(function(){return Yn(this,(function(e){return this.isRunning&&this.webSocket?(this.stopBilling(),V.d(this._TAG,"stopRecognize"),this.isRunning=!1,this.webSocket.close(),this.webSocket=null,this.doubaoPcmDataSource=[],this.mLastText=null,[2]):[2]}))}))},e.prototype.sendPcmData=function(e){this.doubaoPcmDataSource.push(e),this.checkIfNeedToSendPcmData()},e.prototype.checkIfNeedToSendPcmData=function(){if(this.webSocket&&0!==this.doubaoPcmDataSource.length&&this.webSocket.readyState===this.webSocket.OPEN){var e=this.doubaoPcmDataSource.shift();this.sendData(e)}},e.prototype.parseResponse=function(e,t,i){return Zn(this,void 0,void 0,(function(){var n,r,s,o,a,c,u,p,h,d,l,v,f,g;return Yn(this,(function(m){switch(m.label){case 0:return n={code:_.kFail,msg:"",sequence:-1,isLasrPackage:!1},null===e||0===e.size?[2,n]:[4,(S=e,new Promise((function(e){var t=new FileReader;t.onload=function(){return e(t.result)},t.readAsArrayBuffer(S)})))];case 1:r=m.sent(),s=new DataView(r),o=15&s.getUint8(0),a=s.getUint8(1)>>4,c=15&s.getUint8(1),n.isLasrPackage=3===c,u=15===a?8:4,p=(null==t?void 0:t.hasSequence)?4:0,h=4*o+u+p,d=r.slice(h),l=new Uint8Array(d),v=new TextDecoder("utf-8"),f=v.decode(l),g=null;try{g=JSON.parse(f)}catch(e){V.d(this._TAG,"parseResponse parse error",e)}return n.sequence=p,9===a?(this.exeResultText(i,g),n.code=_.kSuccess,n.msg=null):11===a?(n.code=_.kSuccess,n.msg=null):15===a&&(V.d(this._TAG,"doubao error code:"+p+" msg:"+f),n.code=p,n.msg=f),[2,n]}var S}))}))},e.prototype.exeResultText=function(e,t){if(t){var i=t.result;if(i){var n=i.text,r=!1,s=i.utterances;null!=s&&s.length>0&&(r=s[0].definite),(n&&n!==this.mLastText||r)&&(V.d(this._TAG,"exeResultText success ===> ",n),this.mLastText=n,e.onText(r,n,t))}}},e.prototype.startBilling=function(){this.stopBilling(),this.mCommonAsrBillingManager=new Qn(this.mgId,"volc",this.userId,this.roomId,this.mIAsrBillingListener),this.mCommonAsrBillingManager.startBilling()},e.prototype.stopBilling=function(){null!=this.mCommonAsrBillingManager&&(this.mCommonAsrBillingManager.stopBilling(),this.mCommonAsrBillingManager=null)},e}(),er=function(){function e(){this._TAG="SudGIP_AiAgentImpl",this.mgId="",this.roomId="",this.senderUserId="",this.senderNickName="",this.isRunning=!1,this.language="",this.mDoubaoAsrClient=null,this.mISudListenerAiAgent=null,this.enable_asr=!1,this.enable_tts=!1,this.mAiAsrTextObserver=null}return e.prototype.pushAudio=function(e,t){this.enable_asr?this.innerPushAudio(e,t):V.e(this._TAG,"pushAudio enable_asr is",this.enable_asr)},e.prototype.innerPushAudio=function(e,t){var i;null!=e&&0!==t&&(this.isRunning||this.startASR(this.language),null===(i=this.mDoubaoAsrClient)||void 0===i||i.sendPcmData(e))},e.prototype.startASR=function(e){V.d(this._TAG,"startASR: "+e+" currentIsRunning:"+this.isRunning),this.isRunning||(this.isRunning=!0,this.startAudioRecognize(e))},e.prototype.stopASR=function(){this.isRunning&&(this.isRunning=!1,null!==this.mDoubaoAsrClient&&(this.mDoubaoAsrClient.stopRecognize(),this.mDoubaoAsrClient=null))},e.prototype.canRecognitionLanguage=function(e,t){return!!t&&!!(e&&e.languages.indexOf(t)>-1)},e.prototype.startAudioRecognize=function(e){var t=O.getDoubaoRtssCfg();if(null!=t)if(this.canRecognitionLanguage(t,e)){var i=this;this.mDoubaoAsrClient=new $n({onReportDuration:function(e){if(e){var t={seq_no:e.seq_no,session_id:e.session_id,mg_id:e.mg_id,csp:e.csp,user_id:e.user_id,room_id:e.room_id,duration:e.duration,app_id:O.getAppId(),platform:O.getPlatform()},n=O.getReportLargeModelDurationUrl();n?O.getHttpService().commonPost(n,t,{onSuccess:function(){},onFailure:function(){}}):V.w(i._TAG,"error onReportDuration error because url is null")}}});var n=new Bn;n.setDoubaoRtssCfg(t),n.setUid(this.senderUserId),n.setLanguage(e),n.setMgId(this.mgId),n.setRoomId(this.roomId),this.mDoubaoAsrClient.startRecognize(n,{onRecognizeSuccess:function(){V.d(i._TAG,"onRecognizeSuccess:")},onText:function(e,t,n){V.d(i._TAG,"onText: definite:",e," text:"+t,"res_json",n),i.onRecognizingResult(e,t,n)},onFailure:function(e){V.d(i._TAG,"db asr onFailure:",e),i.stopASR()},onClosed:function(){V.d(i._TAG,"db asr client onClosed"),i.stopASR()}})}else V.e(this._TAG,"无法开启asr识别,因为当前语言不在于后台给的语言配置列表当中");else V.e(this._TAG,"无法开启asr识别,因为后台没有给DoubaoRtssCfg配置")},e.prototype.onRecognizingResult=function(e,t,i){e&&(V.d(this._TAG,"onRecognizingResult sendText",t,i),this.innerSendText(t,this.parseMetrics(i)))},e.prototype.parseMetrics=function(e){try{var t=e,i=t.result;if(null===i)return null;var n=t.additions,r={asr_duration:0,end_time:0,log_id:n?n.log_id:"",start_time:0},s=i.utterances;if(null!==s&&s.length>0){var o=s[0];r.end_time=o.end_time,r.start_time=o.start_time,r.asr_duration=r.end_time-r.start_time}return r}catch(e){V.e(this._TAG,"parseMetrics parserResponse error:",e)}return null},e.prototype.sendText=function(e){this.innerSendText(e,null)},e.prototype.innerSendText=function(e,t){V.d(this._TAG,"enable_tts",this.enable_tts,"innerSendText",e,"metrics",t),this.enable_tts&&(null!=this.mAiAsrTextObserver&&this.mAiAsrTextObserver.onText(e),O.sendRoomMessage(this.mgId,this.roomId,1,this.senderUserId,this.senderNickName,e,t))},e.prototype.pauseAudio=function(){null!=this.mDoubaoAsrClient&&this.mDoubaoAsrClient.pauseRecognize()},e.prototype.stopAudio=function(){null!=this.mDoubaoAsrClient&&this.stopASR()},e.prototype.setISudListenerAiAgent=function(e){this.mISudListenerAiAgent=e},e.prototype.onRoomChatMessage=function(e){null!==this.mISudListenerAiAgent&&this.mISudListenerAiAgent.onRoomChatMessage(e)},e.prototype.setMgId=function(e){this.mgId=e},e.prototype.setRoomId=function(e){this.roomId=e},e.prototype.setSenderUserId=function(e){this.senderUserId=e},e.prototype.setSenderNickName=function(e){this.senderNickName=e},e.prototype.setLanguage=function(e){this.language=e},e.prototype.setGameLargeModelCfg=function(e){null!=e&&(this.enable_asr=e.enable_asr,this.enable_tts=e.enable_tts)},e.prototype.setAiAsrTextObserver=function(e){this.mAiAsrTextObserver=e},e}(),tr=function(){function e(){}return e.bytesToInt=function(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},e.bytesToShort=function(e,t){return void 0===t&&(t=0),e[t]<<8|e[t+1]},e}(),ir=function(){function e(){}return e.ROOM_CHAT_MESSAGE_NOTIFY=1001,e}(),nr=function(){function e(e,t,i,n,r){this._TAG="SudGIPWebSocket",this.isRunning=!1,this.mWebSocket=null,this.delayGetGateTokenTimer=null,this.appId=e,this.userId=t,this.roomId=i,this.mgId=n,this.listener=r}return e.prototype.start=function(){V.d(this._TAG,"start curIsRunning:"+this.isRunning),this.isRunning||(this.isRunning=!0,this.getGateToken())},e.prototype.getGateToken=function(){if(V.d(this._TAG,"getGateToken curIsRunning:"+this.isRunning),this.isRunning){var e={app_id:this.appId,uid:this.userId},t=this;O.getHttpService().getGateToken(e,{onSuccess:function(e){var i=e?e.data:null;null!==i&&i.access_token?t.connectWebSocket(i.access_token):t.delayGetGateToken()},onFailure:function(e,i){V.d(t._TAG,"onFailure:"+i+"("+e+")"),t.delayGetGateToken()}})}},e.prototype.connectWebSocket=function(e){if(V.d(this._TAG,"connectWebSocket curIsRunning:"+this.isRunning),this.isRunning)if(null==this.mWebSocket){var t=O.getGateWsUrl();if(t){var i,n=this,r=null;t="".concat(t,"?mgid=").concat(this.mgId,"&roomid=").concat(this.roomId,"&token=").concat(e),this.mWebSocket=new WebSocket(t),this.mWebSocket.binaryType="arraybuffer",this.mWebSocket.onopen=function(){V.d(n._TAG,"websocket onOpen"),r=setInterval((function(){n.mWebSocket&&n.mWebSocket.readyState===WebSocket.OPEN&&n.mWebSocket.send("ping")}),1e4)},this.mWebSocket.onclose=function(e){V.d(n._TAG,"===> onClosed: code:".concat(e.code," reason:").concat(e.reason)),r&&clearInterval(r),i||(i=!0,s())},this.mWebSocket.onerror=function(e){V.d(n._TAG,"===> onFailure: Throwable:".concat(e," Response:null")),i||(i=!0,s())},this.mWebSocket.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=new Uint8Array(e.data);try{n.parseWebSocketMessage(t)}catch(e){console.log("WebSocket解析数据发生了异常:".concat(e.toString()))}}}}else this.delayGetGateToken()}else V.d(this._TAG,"connectWebSocket 已存在WebSocket无需重复连接");function s(){null!==n.mWebSocket&&(n.mWebSocket=null,n.innerDelayGetGateToken(1e3))}},e.prototype.delayGetGateToken=function(){this.innerDelayGetGateToken(3e3)},e.prototype.innerDelayGetGateToken=function(e){var t=this;V.d(this._TAG,"delayGetGateToken curIsRunning:"+this.isRunning),this.isRunning&&(this.delayGetGateTokenTimer=setTimeout((function(){t.delayGetGateTokenTimer&&clearTimeout(t.delayGetGateTokenTimer),t.getGateToken()}),e))},e.prototype.destroy=function(){V.d(this._TAG,"destroy curIsRunning:"+this.isRunning),this.isRunning&&(this.isRunning=!1,this.delayGetGateTokenTimer&&clearTimeout(this.delayGetGateTokenTimer),null!==this.mWebSocket&&(this.mWebSocket.close(),this.mWebSocket=null))},e.prototype.parseWebSocketMessage=function(e){var t;if(e&&0!==e.length)if(e.length<12)V.d(this._TAG,"WebSocket后端发的数组长度不对, length:".concat(e.length));else{var i=tr.bytesToInt(e.subarray(0,4)),n=tr.bytesToShort(e.subarray(4,6)),r=tr.bytesToShort(e.subarray(6,8));if(V.d(this._TAG,"parseWebSocketMessage magic:".concat(i," version:").concat(n," cmd:").concat(r)),r===ir.ROOM_CHAT_MESSAGE_NOTIFY)if(e.length>12){var s=e.subarray(12),o=new TextDecoder("utf-8").decode(s);this.listener&&(null===(t=this.listener)||void 0===t||t.onRoomChatMessage(o))}else console.debug("WebSocket后端发的数组长度不对, length:".concat(e.length))}else V.d(this._TAG,"WebSocket后端发的数组为空")},e}(),rr=function(){function e(e,t){this._kTag="H5SudFSTAPPImpl",this.isCanReportTimeoutEvent=!0,this._gameLoadPercent=0,this._startDelayOnGameLoadCompletedTimer=null,this.loadGameStatsEvent=new Nn,this.mGameInfo=null,this.mISudAiAgent=null,this.mGameLargeModelCfg=null,this.mSudGIPWebSocket=null;var i=e.parentElm,n=e.fstAppCtxId,r=e.userId,o=e.roomId,a=e.code,c=e.mgId,u=e.language;this._loadMgParamModel=e,this._fstAppCtxId=n,this._userId=r,this._roomId=o,this._code=a,this._mgId=c,this._fsmMg=t,this._loadingFailed=!1,this._isCalledDestroyMG=!1,this._gameLayerView={},this._window=null,this._iframeUrl="",this._rootElm=i,this._gameCompeleted=!1,this._bigLoadingPicUrl="",this.receiveGameLoading=!1,this._ctxIdListenerNotifyStateChangeMap=new Map,this._idIDGenerator=new s,this._sudFSMMGStateHandler=function(e,t,i,n,r){return new On(e,t,i,n,r)}(t,r,o,a,c),this._sudASR=zn.create({language:u},this),T.genSpanId(c),this.initGameCustomStateListener(),this.loadGame(i)}return e.prototype.initGameCustomStateListener=function(){var e=this;this._sudFSMMGStateHandler.setGameCustomStateListener({onGameLoadStarted:function(){},onGameLoadCompleted:function(){e._loading(e._rootElm,Dn.END,_.kSuccess,100),e.loadGameStatsEvent.setRetCode(_.kSuccess),e.loadGameStatsEvent.setRetMsg("success"),e.loadGameStatsEvent.reportStats(),O.getEnvType()===O.kEnvTypeSim&&e._createSimInfo(e._rootElm),e._gameCompeleted=!0,e.hideLoading()},onGameStarted:function(){e._loadingFailed=!1},onGameLoadPercent:function(t){e.receiveGameLoading=!0;try{var i=JSON.parse(t),n=i.percent,r=85+Math.floor(15*n/100);e._gameLoadPercent=r,e.startDelayOnGameLoadCompletedTask(),0===n?(e.loadGameStatsEvent.putStatsEvent(Un.DOWNLOAD_GAME_PACKAGE,80,i),e.loadGameStatsEvent.putStatsEvent(Un.LOAD_GAME_RUNTIME,r,i)):e.loadGameStatsEvent.putStatsEvent(Un.LOAD_GAME_PERCENT,r,i),e._loading(e._rootElm,Dn.LOADING,_.kSuccess,r)}catch(t){V.w(e._kTag,"onGameLoadPercent json parse error",t)}},onGameASR:function(t){e._sudASR.handleGameASR(t)},onPlayerSelfInfo:function(t){if(null!==e.mISudAiAgent){var i=JSON.parse(t),n=i.name,r=i.uid;e.mISudAiAgent.setSenderUserId(r),e.mISudAiAgent.setSenderNickName(n)}},onGameLlmASR:function(t){JSON.parse(t).isOpen&&e.mISudAiAgent&&e.mISudAiAgent.setAiAsrTextObserver({onText:function(t){e.notifyStateChange("app_common_game_llm_asr_content",JSON.stringify({content:t}),{onSuccess:function(){},onFailure:function(){}})}})}})},e.prototype._createSimInfo=function(e){var t=document.createDocumentFragment(),i=document.createElement("div"),n=document.createElement("span"),r=document.createElement("img");r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL4AAAA9CAYAAAATUNPrAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAvqADAAQAAAABAAAAPQAAAADYD5vDAAAqeElEQVR4Ae2dCbhUxbWo+wzM86AiqBzFEUXBIaKggonRaBxv1OdAnJOY3KjJzVOTlyh6kxhjBqPXJE7EecBoMBpfPo3oNYIi4IA4IKiIgiLIPHOG+/9FV7tP031Od58+iO+lvq96T1Wr1lSrVq2qvbsiVcb0pz/9qX1tbW235cuX9+7atevAbt267dSuXbt+nTt37rHlllt27NGjR6p79+51HTp0qK+oqKim6cqGhoba9evX169Zs6YduW41iXvz161b90FdXd0bq1atmsFxSVVV1bJ99913fRnR/Reo/485UFEI7Xfcccd2KOouKPGzKOQe1NmG63pSg/Wrq6tTKPzWXA/r2LHjUJR+p169eqVQ9lTPnj1TnTp1KqSZTJm1a9emzLSVQvFX0yFeozNMoc3nOb5GR5i2++67r8tU+NdJURy48cYbu2GM9oOX7ZXjVlttVYlRad+2bdsAB/6qF5XFAMUwBV1IHz2vB04DelGHYVtHXo8s1y1ZsmQ195fT9tKFCxcuPvLII9cW0065ymp1m00o/DA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BMbzMPWHtLPlRD6l4j/1sRclKEgx8MpRVlqlWdo1PND7AnKZloRNGT+XFxZykvc/b+cquR6GWZcb3XsXuaroYTcgR+XcOdKVlnWV14TdKyjvn0rn1OtYx2NOi58swMvBbVhwGQhTz4LhJ2L9t2J1s8q//nQRxtFABWzNBHEhYmPv1wVByL5E/Dr5evI4mLSMmHkGCSY+FezVrxs5cuSnpqIEBHmNbU9g+WHV4+joXVzPMMYv3Zui46sEri2YpRvL/CEd+loU4naOvsyfSdJM5/QNqw37CDJP8p+wkvsscIYlLb4rrZ9FQmHt3A3IdgV65kslE+HxWGh9gQXOBXT6nHQl6UYX1IFq/l3dP5pucrKbUZZCiEUR+sGo4yn7ZY7+k0mNltBlfldfC13uLqQtyzjcKXyF7mQOBXDH4asI90GiTvcWuPW30ObyliPqdQhCOAPGHogB2MUtBi7H2xHc7lDORBuBZq2dVg9/XtftZdp4gjyGies75WoPxX8Ouoaq+EbyMBTxK8PlaqIRnLQ862lvHXJdhYKvgM6lKPVCrudB+3RkOwmap+b7+6BGAFtwUZTiJ9uhE+wMortCzJ4wbSj7XAahBNu59dSlePf3lNIR7PkquoKHIas5OqRPpq1JtPUyc43pSTw25TkdYDsUfwiC249294fmIdDaS3rt/NJcyhxIxZNeXRppJ89BKSarBLQzhTanEr3YELQvI8H333//MBSuN3xtcBsFb3+1hY5K8UknP81RsI6AZyYEmDhX0Q2210FjLXSto0P7N0UruV5B20uYQ/l/ADktekSk3MeCiWqqYd6n7UyoqQvDTncUfyDHAbhAfVH83ljFTihIJXk919UwRNcIPQ7//uG/dujHVcCI1VoAGDQfZryH0s/gfDZwlhNZWdZSt6Up/Et55h84MDR3pW5faNyVEW97lL4Pk6tu8KATnaAKQ1ABL/xMnh9zkmYVScWqt4OT16LsK6Hbf0WZB70zuTeD60/Y1LaUvNHW6lJw/VedjTnwPylTiR6yTo9wAAAAAElFTkSuQmCC",r.setAttribute("style","width: 40px;height: 12.842px"),n.innerHTML=O.getOnlyTestText(),n.setAttribute("style","font-size: 12px;color: #fff;margin-left: 4px;"),i.append(r),i.append(n),i.setAttribute("style","position: absolute;bottom: 0;right: 0"),t.append(i),e.append(t)},e.prototype.loadGame=function(e){var t=this;e.style.setProperty("position","relative"),e.innerHTML="",this.isCanReportTimeoutEvent=!0,t.loadGameStatsEvent.startLoad({mgId:this._mgId}),t._loading(e,Dn.START,_.kSuccess,10),O.getMGInfo(this._mgId,{onSuccess:function(i){if(t.loadGameStatsEvent.putStatsEvent(Un.GET_MG_INFO,20,{}),V.d(t._kTag,"loadGame getMGInfo"),t._loading(e,Dn.START,_.kSuccess,20),1===i.h5engine){if(!i.h5url)return V.e(t._kTag,"gameInfo no h5url",""),t.loadGameStatsEvent.putStatsEvent(Un.GET_MG_INFO,20,{desc:"gameInfo no h5url"}),t._loading(e,Dn.LOADING,_.kFail,20),void t.loadGameStatsEvent.reportStats();t.mGameInfo=i,t.mGameLargeModelCfg=i.gameLargeModelCfg,null!=t.mISudAiAgent&&t.mISudAiAgent.setGameLargeModelCfg(i.gameLargeModelCfg);var n=O.getAppId(),s=Date.now(),o="appId=".concat(n,"&userId=").concat(t._userId),a=h()(o),c="".concat(i.h5url,"?fstAppCtxId=").concat(t._fstAppCtxId,"&sid=").concat(a,"&t=").concat(s);r.getCfg().getTouchEnable()&&(c="".concat(c,"&touch=1"));var u=r.getCfg().getAdvancedConfigMap().get("enable_debug_game_log");i.log_id&&(N.setLogId(i.log_id),j.uploadLog(t._mgId)),t._sudFSMMGStateHandler.setMgLogListener((function(e,i){j.collectLog(e,i),u&&t._fsmMg.onGameLog(i)})),c="".concat(c,"&log=1"),t._iframeUrl=c,t._bigLoadingPicUrl=i.bigLoadingPic,t.loadGameStatsEvent.putStatsEvent(Un.GET_MG_INFO,20,{sid:a,desc:"before _initIframe"}),t._initIframe(e),t._sudFSMMGStateHandler.setDynamicConfig(JSON.stringify(i.dynamic_config))}else V.e(t._kTag,"This game does not support web engine",i),t._loading(e,Dn.START,_.kFail,20,(function(e){var t=document.createElement("div");t.setAttribute("style","\n position: absolute;\n top: 42%;\n left: 50%;\n color: #000;\n width: 200px;\n height: 30px;\n line-height: 30px;\n text-align: center;\n transform: translateX(-50%);\n background-color: #fff;\n border-radius: 4px;\n "),t.innerHTML="Please upgrade",e.append(t)})),t.loadGameStatsEvent.putStatsEvent(Un.GET_MG_INFO,20,{desc:"This game does not support web engine"}),t.loadGameStatsEvent.reportStats()},onFailure:function(i,n){t._loading(e,Dn.LOADING,_.kFail,20,null)}})},e.prototype.hideLoading=function(){var e,t="".concat(this._kTag,"_wrap_parent_loading"),i=document.getElementById(t);i&&(null===(e=i.parentNode)||void 0===e||e.removeChild(i))},e.prototype._loading=function(e,t,i,n,s){this._loadingFailed=i===_.kFail,this._gameCompeleted||(r.getCfg().getShowCustomLoading()?this.fsmMgOnGameLoadingProgress(t,i,n):this._createDefaultLoading(e,i,n,s))},e.prototype.fsmMgOnGameLoadingProgress=function(e,t,i){this._fsmMg.onGameLoadingProgress&&this._fsmMg.onGameLoadingProgress(e,t,i)},e.prototype._createDefaultLoading=function(e,t,i,n){var s="".concat(this._kTag,"_wrap_parent_loading"),o="".concat(this._kTag,"_wrap_loading"),a="".concat(this._kTag,"_loading"),c="".concat(this._kTag,"_loading_text"),u="".concat(this._kTag,"_bgloading"),p=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_loading,O.getLanguage()),h=this,d=document.getElementById(s);if(d){var l=document.getElementById(a),v=document.getElementById(c),f=document.getElementById(o);if(n&&n(d),t===_.kFail){if(v){var g=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_fail,O.getLanguage());v.style.color="#ff1a1a",v&&(v.innerHTML="".concat(g," (").concat(i,"%)").concat(_.kFail))}return f&&this._createReloadButton(f),h.loadGameStatsEvent.setRetCode(_.kFail),h.loadGameStatsEvent.setRetMsg(JSON.stringify({tag:"_createDefaultLoading",loading:"failed"})),void h.loadGameStatsEvent.reportStats()}if(r.getCfg().getShowLoadingGameBg()&&this._bigLoadingPicUrl&&!document.getElementById(u)){var m=document.createElement("img");m.id=u,m.src=this._bigLoadingPicUrl,m.setAttribute("style","\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n "),d.append(m)}l&&(l.style.left=-(100-i)+"%"),v&&(v.innerHTML="".concat(p,"(").concat(i,"%)"))}else{var S=document.createDocumentFragment();d=document.createElement("div");var y=document.createElement("div"),b=document.createElement("img"),A=document.createElement("img"),w=(v=document.createElement("div"),document.createElement("div"));y.id=o,b.id=a,d.id=s,d.setAttribute("style","\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n -webkit-transform:translateZ(1px);\n -moz-transform:translateZ(1px);\n -o-transform:translateZ(1px);\n transform:translateZ(1px);\n "),y.setAttribute("style","\n z-index: 100000;\n position: absolute;\n top: 50%; \n left: 50%;\n transform: translate(-50%, -50%);\n width: 270px;\n height: 56px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n "),w.setAttribute("style","\n z-index: 100001;\n position: absolute;\n height: 22px;\n top: 50%; \n transform: translateY(-50%);\n left: 17px;\n right: 17px;\n border-radius: 26px;\n overflow: hidden;\n "),w.append(b),A.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAAC0CAMAAAAO0FvMAAAC/VBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzOjn34AAAAAAAAAAABLSELTzIeemna1spoAAADKw4Li26+bl3EAAADWzYjg15WcmXTZ0YlhX0hiX0kbGhkAAAABAQDWz4jYz4mdmXMZGRfg2ZYaGhkAAADa0YsAAAAAAADi3K3KwYIAAACblXGdl3MAAADe15UAAAAaGRgZGRjb04yhnXcDAwLCu4YxMTHSyov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gbOAXeDpPD/ehZorOschLodcB3oIEEmCKrKjc090zpZLJyxCSuDZ/IsCz4WSe0Ea7twN8YlV4wAOOQ+IE9FaTotzdZ0CgRxQwi0FWljN+UYagkEcNA78rJQesA+XgSAKsnCusrdsjQiBEkhBLySdC52FUg1cB3LAOtBDgggRaYIunKtpzYggHBCCJIBCWEgKsiAKhRj0t72rhuTAfYgXUxOh1s5VRAJkgPBDSwlJgbOgc0EUyjAoaUgOXIfmgSBIIlmEDOdq+ohIgAwIAe1yFXQsdBaIoXwbxCHnQR4IIkw4N6gXOiAEbEKTkMeCLFQOgzj0HqAhIgd6AAiICBJEES6cK+8dbckA4XGUEtDUIoVeQjmG1JAc5OEiYkcR6t25gra3BYPDFQJqq5ASxsyCNPQcUHKI0kN0aO2cK+/Q2kerCA6ijSj0EmhhMAftw4Yg0ErtnStulUGBHOSl0FkQhWIMqtNADgkCIpwb2Gtr1iZEPQVhqK3nIBASgWb16lxxswIDOZAEUegsDNcgDgKBZudGtWGTJNDCeAzS0HsQCDbJRJ+duH+3edTE/nQgCGM1yINAqMm5McmAJIy30Hcfg0CYhBvZXQakUIChaB1kwv20TwcnAINAAAQV0n/NgTyUIII+Yg6dqWGXL12tvPaE+kPrgjXCjFBucAQR5IcZ4P8ZXj84g6XqABFGKDJEk8aYgf2lCY5gVymKDKP23cAOzNj/BGfQd17/ZqDj8BkAAAAAAAAAAIDD3bPYHKSsGOBgAAAAAElFTkSuQmCC",A.setAttribute("style","z-index: 1;width: 100%; height: 56px; position: absolute;top: 0;left: 0;bottom: 0;right: 0"),v.setAttribute("style","z-index: 100002;font-family: PingFangSC-Medium, PingFang SC;\n width: 100%; font-size: 14px; height: 34px;line-height: 34px; position: absolute;top: 50%; left: 50%; transform: translate(-50%, -50%);text-align: center;color: #fff;"),v.innerHTML="".concat(p,"(").concat(i,"%)"),v.id=c,b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAABACAMAAAAZDo5fAAAB2lBMVEX0nTb/zS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PMe11v3PNt/9cbbcRwgWLMgAAAABJRU5ErkJggg==",b.setAttribute("style","position: absolute;top: 50%; transform: translateY(-50%); left: -".concat(100-i,"%;border-radius: 26px;")),b.style.width="100%",S.append(v),S.append(A),S.append(w),y.append(S),d.append(y),e.append(d)}},e.prototype._createReloadButton=function(e){var t=this,i=document.createElement("button");i.setAttribute("style","\n cursor: pointer;\n border: 2px solid #000;\n font-family: PingFangSC-Medium, PingFang SC;\n background-color: #fff;\n border-radius: 36px;\n z-index: 100002;\n width: 104px;\n height: 36px;\n color: #1A1A1A;\n position: absolute;\n bottom: -60px;\n left: 50%;\n transform: translateX(-50%);\n touch-action: manipulation;\n outline: none;\n -webkit-tap-highlight-color:rgba(0,0,0,0);\n ");var n=O.getLocalizationData(O.getSdkLocalizationCfg().load_reload,O.getLanguage());i.onclick=function(){t.loadGame(t._rootElm)},i.innerHTML=n,e.append(i)},e.prototype._initIframe=function(e){var t=this,i=40;if(V.d(t._kTag,"_initIframe start"),t._loading(e,Dn.START,_.kSuccess,i),t.loadGameStatsEvent.putStatsEvent(Un.DOWNLOAD_CORE,i,{desc:"_initIframe start"}),e&&e instanceof HTMLElement){var n=document.createElement("iframe");n.src=this._iframeUrl,n.width="100%",n.height="100%",n.setAttribute("referrerpolicy","origin-when-cross-origin"),n.onerror=function(){V.e(t._kTag,"iframe onerror"),t.loadGameStatsEvent.putStatsEvent(Un.DOWNLOAD_CORE,i,{desc:"iframe onerror"}),t.loadGameStatsEvent.setRetCode(_.kFail),t.loadGameStatsEvent.setRetMsg("onerror"),t.loadGameStatsEvent.reportStats(),t._loading(e,Dn.LOADING,_.kFail,85)},v({url:this._iframeUrl,fail:function(e){t.loadGameStatsEvent.putStatsEvent(Un.DOWNLOAD_CORE,i,{desc:"get iframe url failed"}),t.loadGameStatsEvent.setRetCode(_.kFail),t.loadGameStatsEvent.setRetMsg("load iframe failed"),t.loadGameStatsEvent.reportStats(),V.e(t._kTag,"load iframe failed",e)}}),e.appendChild(n),t.startDelayOnGameLoadCompletedTask(),t.startAi(),this._window=n;var r=setInterval((function(){if(t.receiveGameLoading)clearTimeout(r);else{var n=Math.floor(5*(Math.random()+1));(i+=n)>=85&&(i=85,clearTimeout(r)),t._loading(e,Dn.LOADING,_.kSuccess,i)}}),100)}else V.w(this._kTag,"不存在挂载元素,请传入挂载元素","")},e.prototype.startAi=function(){if(null===this.mSudGIPWebSocket){var e=!1;null!=this.mGameInfo.gameLargeModelCfg&&(e=this.mGameInfo.gameLargeModelCfg.enable_channel),V.d(this._kTag,"startAi enableChannel",e);var t=this;e&&(this.mSudGIPWebSocket=new nr(O.getAppId(),this._userId,this._roomId,this._mgId,{onRoomChatMessage:function(e){null!=t.mISudAiAgent&&t.mISudAiAgent.onRoomChatMessage(e)}}),this.mSudGIPWebSocket.start())}},e.prototype._getFstAppCtxId=function(){return this._fstAppCtxId},e.prototype._onGameCustomCommand=function(e,t,i,n,r){if(this._window){var s=new Gn(this._window,e,n);this._sudFSMMGStateHandler.handleCmd(t,i,n,r,s)}else V.w(this._kTag,"H5SudFSTAPPImpl游戏iframe对象不存在","")},e.prototype._onAppCustomCommandEventCallback=function(e,t,i){var n=this._ctxIdListenerNotifyStateChangeMap.get(e);null!=n&&(n.onSuccess(i),this._ctxIdListenerNotifyStateChangeMap.delete(e))},e.prototype.getGameView=function(){return this._gameLayerView},e.prototype.startDelayOnGameLoadCompletedTask=function(){var e,t=this,i="".concat(this._kTag,"_loadGameTimeout"),n=document.getElementById(i);n&&(null===(e=n.parentNode)||void 0===e||e.removeChild(n));var r=1e3*O.getLoadMgPkgTimeout();this._startDelayOnGameLoadCompletedTimer&&clearTimeout(this._startDelayOnGameLoadCompletedTimer),this._startDelayOnGameLoadCompletedTimer=window.setTimeout((function(){t._startDelayOnGameLoadCompletedTimer&&clearTimeout(t._startDelayOnGameLoadCompletedTimer),t.delayOnGameLoadCompletedTask()}),r)},e.prototype.delayOnGameLoadCompletedTask=function(){var e=this._gameLoadPercent;this.isCanReportTimeoutEvent&&(this.isCanReportTimeoutEvent=!1,this.loadGameStatsEvent.reportTimeoutEvent(e)),this._createTimeoutView()},e.prototype._createTimeoutView=function(){var e=this,t="".concat(this._kTag,"_wrap_loading"),i="".concat(this._kTag,"_loadGameTimeout"),n=document.getElementById(t);if(n){var r=document.createElement("div");r.id=i,r.setAttribute("style","\n position: absolute;\n left: 0;\n right: 0;\n padding-top: 56px;\n width: 100%;\n ");var s=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_timeout,O.getLanguage()),o=document.createElement("div");o.setAttribute("style","\n position: absolute;\n bottom: -10px;\n left: 50%;\n transform: translateX(-50%);\n font-family: PingFangSC-Regular,PingFang SC;\n touch-action: manipulation;\n outline: none;\n z-index: 100002;\n color: #fff;\n width: 110%;\n font-size: 12px;\n text-align: center;\n "),o.innerHTML=s,r.append(o);var a=document.createElement("div");a.setAttribute("style","\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n bottom: -70px;\n display: table;\n width: 300px;\n ");var c=document.createElement("div");c.setAttribute("style","\n display: table-cell; \n text-align: center;\n ");var u=document.createElement("button");u.setAttribute("style","\n position: relative; \n cursor: pointer;\n border: 1px solid #fff;\n min-width: 110px;\n height: 36px;\n font-family: PingFangSC-Regular,PingFang SC;\n background-color: transparent;\n border-radius: 0;\n z-index: 100002;\n color: #fff;\n margin: 0;\n padding: 4px 4px;\n touch-action: manipulation;\n outline: none;\n font-size: 13px;\n margin-right: 40px;\n ");var p=O.getLocalizationData(O.getSdkLocalizationCfg().load_reload,O.getLanguage());u.onclick=function(){e.receiveGameLoading=!1,e.loadGame(e._rootElm)},u.innerHTML=p,c.append(u);var h=document.createElement("button");h.setAttribute("style","\n position: relative; \n cursor: pointer;\n min-width: 110px;\n height: 36px;\n font-family: PingFangSC-Regular,PingFang SC;\n background-color: #fff;\n border-radius: 0;\n z-index: 100002;\n color: #000;\n margin: 0;\n padding: 4px 4px;\n touch-action: manipulation;\n outline: none;\n font-size: 13px;\n ");var d=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_continue_wait,O.getLanguage());h.onclick=function(){var t;null===(t=r.parentNode)||void 0===t||t.removeChild(r),e.startDelayOnGameLoadCompletedTask()},h.innerHTML=d,c.append(h),a.append(c),r.append(a),n.append(r)}},e.prototype.destroyMG=function(){this._sudASR.stopASR(),this.notifyStateChange("a2ms-notify-destroy-game","{}",{onSuccess:function(){},onFailure:function(){}}),this.loadGameStatsEvent.setRetCode(_.DestroyGame),this.loadGameStatsEvent.setRetMsg("销毁游戏"),this.loadGameStatsEvent.reportStats();var e=this.mISudAiAgent;return null!=e&&(e.stopASR(),this.mISudAiAgent=null),!0},e.prototype.updateCode=function(e,t){this.notifyStateChange("a2ms-update-code",JSON.stringify({code:e}),t)},e.prototype.pushAudio=function(e,t){this._window&&null!=e&&t>0&&this._sudASR.pushAudio(e,t)},e.prototype.notifyStateChange=function(e,t,i){var n=this._idIDGenerator.genId();this._ctxIdListenerNotifyStateChangeMap.set(n,i),this._window&&xn.sendAppCustomCommandEvent(this._window,n,e,t)},e.prototype.reloadMG=function(){r.getCfg().getShowCustomLoading()&&!0===this._loadingFailed&&(this.loadGameStatsEvent.reportStats(),this.loadGame(this._rootElm))},e.prototype.getAiAgent=function(){return null===this.mISudAiAgent&&(this.mISudAiAgent=new er,null!=this.mGameLargeModelCfg&&this.mISudAiAgent.setGameLargeModelCfg(this.mGameLargeModelCfg),this.mISudAiAgent.setMgId(this._mgId),this.mISudAiAgent.setRoomId(this._roomId),this.mISudAiAgent.setSenderUserId(this._userId),null!==this._loadMgParamModel&&this.mISudAiAgent.setLanguage(this._loadMgParamModel.language)),this.mISudAiAgent},e}(),sr=function(){function e(){}return e.create=function(e,t){return function(e,t){return new rr(e,t)}(e,t)},e}(),or=function(){function e(){this.kTag="Detector",this.step=1}return e.prototype.AddStep=function(){this.step++},e.prototype.isWebGLAvailable=function(){try{if(!window.WebGL2RenderingContext||!window.WebGLRenderingContext)return V.d(this.kTag,"WebGL is not supported",this.step),!1;this.AddStep();var e=document.createElement("canvas");return e.width=1,e.height=1,e.getContext("webgl")||e.getContext("experimental-webgl")?(V.d(this.kTag,"WebGL is supported",this.step),!0):(this.AddStep(),e.getContext("webgl2")||e.getContext("experimental-webgl2")?(V.d(this.kTag,"WebGL is supported",this.step),!0):(this.AddStep(),V.w(this.kTag,"WebGL not supported",this.step),!1))}catch(e){return V.w(this.kTag,"WebGL detection failed: error",e),!1}},e}(),ar=function(){function e(){}return e.handleMessageEvent=function(t){if(null!=t&&null!=t.data){var i=t.data;e.broadcastWindowOnMessage(i)}else e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&e.appSelfOnMeessage.map((function(e){return e(t)}))},e._registerCustomCommandEvent=function(){e.isRegisterEvent=!0,V.d(this.kTag,"_registerCustomCommandEvent",e.isRegisterEvent),window.onmessage&&e.appSelfOnMeessage.push(window.onmessage),window.addEventListener("message",e.handleMessageEvent)},e._destoryCommandEvent=function(){window.removeEventListener("message",e.handleMessageEvent),e.isRegisterEvent=!1,V.d(this.kTag,"destoryCommandEvent",e.isRegisterEvent),e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&window.addEventListener("message",(function(t){e.appSelfOnMeessage.map((function(e){return e(t)}))}))},e.getVersion=function(){return w.kVersion},e.getVersionAlias=function(){return w.kVersionAlias},e.getSudCfg=function(){return r.getCfg()},e.initSDK=function(e,t,i,n,r){j.init(),V.i(this.kTag,"initSDK Parameters:","appId: ",e,"appKey: ",t,"bundleId: ",i,"isTestEnv: ",n),O.initSDK(e,t,i,n,r)},e.uninitSDK=function(e){O.uninitSDK(e)},e.getMGList=function(e){O.getMGList(e)},e.loadMG=function(e,t,i,n,r,s,o){if(V.i(this.kTag,"loadMG Parameters","userId: ",e,"roomId: ",t,"mgId: ",n,"code: ",i),null==e||null==t||null==i||null==n||null==s)return V.w(this.kTag,"Parameters cannot be null"),null;if("string"!=typeof e||"string"!=typeof t||"string"!=typeof n)return V.w(this.kTag,"userId, roomId, and mgId must be of string type. Please check if their types are correct"),null;if(""===e||""===t||""===i||""===n)return V.w(this.kTag,"Parameters cannot be empty string","userId: ".concat(e),"roomId: ".concat(t),"code: ".concat(i),"mgId: ".concat(n)),null;T.setUserId(e),O.setLanguage(r);var a=this._idIDGenerator.genId().toString(),c=sr.create({parentElm:o,fstAppCtxId:a,userId:e,roomId:t,code:i,mgId:n,language:r},s);return this._ctxIdFSTAPPMap.set(a,c),this.isRegisterEvent||this._registerCustomCommandEvent(),c},e.destroyMG=function(t){if(null==t)return V.w(this.kTag,"destroyMG fstApp is invalid"),!1;var i=t._getFstAppCtxId();return e._ctxIdFSTAPPMap.delete(i),t.destroyMG(),e._destoryCommandEvent(),!0},e.prototype.setUserId=function(e){T.setUserId(e)},e.setLogLevel=function(e){V.setLogLevel(e)},e.setLogger=function(e){V.setLogger(e)},e.isWebGLAvailable=function(){return this._detector.isWebGLAvailable()},e.broadcastWindowOnMessage=function(t){if(t.msgTag===Ln){var i=t.fstAppCtxId,n=e._ctxIdFSTAPPMap.get(i);null!=n?1===t.msgType?n._onGameCustomCommand(t.ctxId,t.cmd,t.param,t.state,t.dataJson):2===t.msgType&&n._onAppCustomCommandEventCallback(t.ctxId,t.state,t.dataJson):V.e(this.kTag,"No fstAPP")}else e.appSelfOnMeessage&&e.appSelfOnMeessage.length&&e.appSelfOnMeessage.map((function(e){return e(t)}))},e.kTag="SudMGP",e._idIDGenerator=new s,e._detector=new or,e._ctxIdFSTAPPMap=new Map,e.appSelfOnMeessage=[],e.isRegisterEvent=!1,e}();window.SudMGP=ar})(),n})()));