sudmgp-sdk-js 1.1.0 → 1.1.1
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.
- package/index.js +1 -1
- package/package.json +4 -1
- package/type.d.ts +6 -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 o(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function s(e,t,i,n,r,s){return o((a=o(o(t,e),o(n,s)))<<(c=r)|a>>>32-c,i);var a,c}function a(e,t,i,n,r,o,a){return s(t&i|~t&n,e,t,r,o,a)}function c(e,t,i,n,r,o,a){return s(t&n|i&~n,e,t,r,o,a)}function p(e,t,i,n,r,o,a){return s(t^i^n,e,t,r,o,a)}function u(e,t,i,n,r,o,a){return s(i^(t|~n),e,t,r,o,a)}function d(e,t){var i,n,r,s,d;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,l=-271733879,v=-1732584194,m=271733878;for(i=0;i<e.length;i+=16)n=h,r=l,s=v,d=m,h=a(h,l,v,m,e[i],7,-680876936),m=a(m,h,l,v,e[i+1],12,-389564586),v=a(v,m,h,l,e[i+2],17,606105819),l=a(l,v,m,h,e[i+3],22,-1044525330),h=a(h,l,v,m,e[i+4],7,-176418897),m=a(m,h,l,v,e[i+5],12,1200080426),v=a(v,m,h,l,e[i+6],17,-1473231341),l=a(l,v,m,h,e[i+7],22,-45705983),h=a(h,l,v,m,e[i+8],7,1770035416),m=a(m,h,l,v,e[i+9],12,-1958414417),v=a(v,m,h,l,e[i+10],17,-42063),l=a(l,v,m,h,e[i+11],22,-1990404162),h=a(h,l,v,m,e[i+12],7,1804603682),m=a(m,h,l,v,e[i+13],12,-40341101),v=a(v,m,h,l,e[i+14],17,-1502002290),h=c(h,l=a(l,v,m,h,e[i+15],22,1236535329),v,m,e[i+1],5,-165796510),m=c(m,h,l,v,e[i+6],9,-1069501632),v=c(v,m,h,l,e[i+11],14,643717713),l=c(l,v,m,h,e[i],20,-373897302),h=c(h,l,v,m,e[i+5],5,-701558691),m=c(m,h,l,v,e[i+10],9,38016083),v=c(v,m,h,l,e[i+15],14,-660478335),l=c(l,v,m,h,e[i+4],20,-405537848),h=c(h,l,v,m,e[i+9],5,568446438),m=c(m,h,l,v,e[i+14],9,-1019803690),v=c(v,m,h,l,e[i+3],14,-187363961),l=c(l,v,m,h,e[i+8],20,1163531501),h=c(h,l,v,m,e[i+13],5,-1444681467),m=c(m,h,l,v,e[i+2],9,-51403784),v=c(v,m,h,l,e[i+7],14,1735328473),h=p(h,l=c(l,v,m,h,e[i+12],20,-1926607734),v,m,e[i+5],4,-378558),m=p(m,h,l,v,e[i+8],11,-2022574463),v=p(v,m,h,l,e[i+11],16,1839030562),l=p(l,v,m,h,e[i+14],23,-35309556),h=p(h,l,v,m,e[i+1],4,-1530992060),m=p(m,h,l,v,e[i+4],11,1272893353),v=p(v,m,h,l,e[i+7],16,-155497632),l=p(l,v,m,h,e[i+10],23,-1094730640),h=p(h,l,v,m,e[i+13],4,681279174),m=p(m,h,l,v,e[i],11,-358537222),v=p(v,m,h,l,e[i+3],16,-722521979),l=p(l,v,m,h,e[i+6],23,76029189),h=p(h,l,v,m,e[i+9],4,-640364487),m=p(m,h,l,v,e[i+12],11,-421815835),v=p(v,m,h,l,e[i+15],16,530742520),h=u(h,l=p(l,v,m,h,e[i+2],23,-995338651),v,m,e[i],6,-198630844),m=u(m,h,l,v,e[i+7],10,1126891415),v=u(v,m,h,l,e[i+14],15,-1416354905),l=u(l,v,m,h,e[i+5],21,-57434055),h=u(h,l,v,m,e[i+12],6,1700485571),m=u(m,h,l,v,e[i+3],10,-1894986606),v=u(v,m,h,l,e[i+10],15,-1051523),l=u(l,v,m,h,e[i+1],21,-2054922799),h=u(h,l,v,m,e[i+8],6,1873313359),m=u(m,h,l,v,e[i+15],10,-30611744),v=u(v,m,h,l,e[i+6],15,-1560198380),l=u(l,v,m,h,e[i+13],21,1309151649),h=u(h,l,v,m,e[i+4],6,-145523070),m=u(m,h,l,v,e[i+11],10,-1120210379),v=u(v,m,h,l,e[i+2],15,718787259),l=u(l,v,m,h,e[i+9],21,-343485551),h=o(h,n),l=o(l,r),v=o(v,s),m=o(m,d);return[h,l,v,m]}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 m(e){return unescape(encodeURIComponent(e))}function g(e){return function(e){return h(d(l(e),8*e.length))}(m(e))}function f(e,t){return function(e,t){var i,n,r=l(e),o=[],s=[];for(o[15]=s[15]=void 0,r.length>16&&(r=d(r,8*e.length)),i=0;i<16;i+=1)o[i]=909522486^r[i],s[i]=1549556828^r[i];return n=d(o.concat(l(t)),512+8*t.length),h(d(s.concat(n),640))}(m(e),m(t))}function _(e,t,i){return t?i?f(t,e):v(f(t,e)):i?g(e):v(g(e))}void 0===(n=function(){return _}.call(t,i,t,e))||(e.exports=n)}()},339:()=>{},108:()=>{},275:()=>{},505:()=>{},146:()=>{},173:()=>{},137:()=>{},592:()=>{}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.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.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:()=>O,SudMGP:()=>Tn});var e,t=function(){function e(){this._showLoadingGameBg=!0,this._showCustomLoading=!1,this._touchEnable=!1}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}(),r=function(){function e(){}return e.getCfg=function(){return e._impl},e._impl=new t,e}(),o=function(){function e(){this._curId=0}return e.prototype.genId=function(){return++this._curId},e}(),s=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,o=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s},c=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;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))},p=function(){function e(){this.kTag="SudMGP",this._logLevel=s.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 o=this.kTag;s.VERBOSE===e&&this._logLevel<=s.VERBOSE||s.DEBUG===e&&this._logLevel<=s.DEBUG?console.log.apply(console,c([o+" "+t+" "+i],a(n),!1)):s.INFO===e&&this._logLevel<=s.INFO?console.info(o+" "+t+" "+i,n):s.WARN===e&&this._logLevel<=s.WARN?console.warn(o+" "+t+" "+i,n):s.ERROR===e&&this._logLevel<=s.ERROR?console.error(o+" "+t+" "+i,n):s.ASSERT===e&&this._logLevel<=s.ASSERT&&console.assert(o+" "+t,i,n)},e}(),u=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(s.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(s.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(s.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(s.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(s.ERROR,t,i,n)},e._impl=new p,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,o=e.success,s=e.fail,a=e.beforeSend,c=i.toLowerCase(),p=t,u=new XMLHttpRequest;if(u=new XMLHttpRequest){if(u){if(u.addHeader=function(e,t){u.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);p+="?"+d}u.open(c,p,!0),u.setRequestHeader("content-type","application/json"),a&&a(u),"post"===c&&n?u.send(JSON.stringify(n)):u.send(),u.onreadystatechange=function(){var e=null==u?void 0:u.responseText;4===u.readyState&&(200===u.status?o&&o(e):s&&s(e))}}}else console.error("浏览器不支持XMLHttpRequest")},m=function(e){v(l({method:"get"},e))},g=new Uint8Array(16);function f(){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 _=/^(?:[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&&_.test(e)};for(var y=[],A=0;A<256;++A)y.push((A+256).toString(16).substr(1));const w=function(e,t,i){var n=(e=e||{}).random||(e.rng||f)();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 C=function(){function e(){}return e.kVersion="1.1.0",e.kVersionAlias="0.0.0.0-h5",e}(),b=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,o=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s},E=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=R.event2EventId(e)},e.prototype.getRequestId=function(){return this._request_id},e.prototype.buildNewRequestId=function(){this._request_id=h()(w())},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:M.getAppId(),mg_id:this._mgId,is_test_env:M.getIsTestEnv(),env_type:M.getEnvType(),sdk_version:C.kVersion,sdk_version_alias:C.kVersionAlias,et_is_dynamic:!1,sud_is_dynamic:!1,event:this._event,event_id:this._event_id,trace_id:M.getTraceId(),span_id:R.getSpanId(this._mgId),request_id:this._request_id,user_id:R.getUserId(),platform:M.kPlatformH5,bundle_id:M.getBundleID(),start_timestamp:this._start_timestamp,end_timestamp:i,cost_time:i-this._start_timestamp},r={};try{for(var o=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),s=o.next();!s.done;s=o.next()){var a=I(s.value,2),c=a[0],p=a[1];r[c]=p}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}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=b.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.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}(),R=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()(w());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){M.reportStats(i),null!=this._listener&&this._listener.onReportStatsEvent(e,t,i)},e.userId="",e._statsEventIdMap=(new Map).set(E.kStatsEventGetFQSInfo,E.kStatsEventIdGetFQSInfo).set(E.kStatsEventGetSDKToken,E.kStatsEventIdGetSDKToken).set(E.kStatsEventGetMGInfo,E.kStatsEventIdGetMGInfo).set(E.kStatsEventGetAuthMGInfo,E.kStatsEventIdGetAuthMGInfo).set(E.kStatsEventGetMGList,E.kStatsEventIdGetMGList).set(E.kStatsEventDownloadGameRuntime,E.kStatsEventIdDownloadGameRuntime).set(E.kStatsEventDownloadGamePkg,E.kStatsEventIdDownloadGamePkg).set(E.kStatsEventLoadGameFinished,E.kStatsEventIdLoadGameFinished).set(E.kStatsEventMatchASRInfo,E.kStatsEventIdMatchASRInfo).set(E.kStatsEventLoadGameTimeout,E.kStatsEventIdLoadGameTimeout),e._statsSpanIdMap=new Map,e}(),k=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}(),T=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s},P=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;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.reportFailedStatsCacheList=[],this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.mgIdGameInfoMap=new Map}return e.prototype.getFQSInfoSize=function(){var t=M.getEnvType();return t===M.kEnvTypeDev?e.kGetFQSInfoDevBaseUrls.length:t===M.kEnvTypeFat?e.kGetFQSInfoFatBaseUrls.length:t===M.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,o){var s=this;this.getFQSInfo(e,i,r,{onSuccess:function(r){s.getSDKTokenUrl=r,s.getSDKTokenInternal(e,t,i,n)},onFailure:function(a,c){o>0&&r<o?s.getSDKTokenStepGetFQSInfo(e,t,i,n,r+1,o):n.onFailure(a,c)}})},e.prototype.getMGList=function(e){if(this.isInitSdkOk){var t={sdk_token:this.sdkToken,platform:M.getPlatform()},i=new E(E.kStatsEventGetMGList);this.doSudPost(this.getMGListUrl,t,i.getRequestId(),{onSuccess:function(t){var n=JSON.parse(t),r=n.ret_code,o=n.ret_msg,s=t;i.setRetCode(r),i.setRetMsg(o),R.report(i),e&&s&&r&&o&&(k.kSuccess===r?e.onSuccess(s):e.onFailure(r,o))},onFailure:function(t){var n=k.kFail,r=t.toString();i.setRetCode(n),i.setRetMsg(r),R.report(i),e.onFailure(n,r)}})}else e&&e.onFailure(-1,"请先调用initSDK成功")},e.prototype.getMGInfo=function(e,t){if(this.isInitSdkOk){var i=this.getCacheMGInfo(e),n=0;i||(n=i.clientVersion);var r={sdk_token:this.sdkToken,mg_id:Number(e),mg_id_str:e,client_version:n,platform:M.getPlatform()},o=this,s=new E(E.kStatsEventGetMGInfo);s.setMgId(e),this.doSudPost(this.getMGInfoUrl,r,s.getRequestId(),{onSuccess:function(i){var n=JSON.parse(i),r=n.ret_code,a=n.ret_msg,c=n.data.mg_info,p={mgId:c.mg_id_str,name:M.getLocalizationData(c.name,M.getLanguage()),version:c.version,orientation:c.orientation,screenMode:c.screen_mode,url:c.url,h5url:c.h5url,appID:c.game_app_id,hash:c.hash,h5engine:c.h5engine,engine:c.engine,bigLoadingPic:M.getLocalizationData(c.big_loading_pic,M.getLanguage()),clientVersion:c.client_version,dynamic_config:c.dynamic_config};if(s.setRetCode(r),s.setRetMsg(a),R.report(s),t)if(k.kSuccess===r)o.setCacheMGInfo(e,p),t.onSuccess(p);else{var u=o.getCacheMGInfo(e);u?t.onSuccess(u):t.onFailure(r,a)}},onFailure:function(i){var n=k.kFail,r=i.toString();if(s.setRetCode(n),s.setRetMsg(r),R.report(s),t){var a=o.getCacheMGInfo(e);a?t.onSuccess(a):t.onFailure(n,r)}}})}else t&&t.onFailure(-1,"请先调用initSDK成功")},e.prototype.reportStats=function(e){var t=this;if(!t.reportStatsUrl)return u.w(this.kTag,"reportStats reportStatsUrl is null or empty"),void this.reportFailedStatsCacheList.push(e);var i=[];i.push(e),this.reportFailedStatsCacheList.length>0&&(i=P(P([],T(i),!1),T(this.reportFailedStatsCacheList),!1),this.reportFailedStatsCacheList=[]);for(var n=function(e){var n=i[e],o=h()(w());r.doSudPost(t.reportStatsUrl,JSON.parse(n),o,{onSuccess:function(e){var i=JSON.parse(e).ret_code;i!==k.kSuccess&&u.e(t.kTag,"reportStats server errcode="+i,"")},onFailure:function(){t.reportFailedStatsCacheList.push(n)}})},r=this,o=0;o<i.length;o++)n(o)},e.prototype.doSudPost=function(t,i,n,r){var o=this;v(l({method:"post"},{data:i,url:t,beforeSend:function(t){t.addHeader(e.kHeaderSudMGPSDKVersion,C.kVersion),t.addHeader(e.kHeaderSudMGPSDKVersionAlias,C.kVersionAlias),t.addHeader(e.kHeaderSudMGPSDKPlatform,M.getPlatform()),t.addHeader(e.kHeaderSudMGPSDKAppId,M.getAppId()),t.addHeader(e.kHeaderSudMGPSDKBundleId,M.getBundleID()),t.addHeader(e.kHeaderSudMGPSDKTraceId,M.getTraceId()),t.addHeader(e.kHeaderSudMGPSDKRequestId,n),t.addHeader(e.kHeaderSudMGPSDKUserId,R.getUserId()),t.addHeader(e.kHeaderSudMGPSDKEtIsDynamic,!0)},success:function(e){u.v(o.kTag,"post success res:",e),r.onSuccess(e)},fail:function(e){u.v(o.kTag,"post fail res:",e),r.onFailure(e)}}))},e.prototype.doSudGet=function(t,i,n){var r=this;m({url:t,beforeSend:function(t){t.addHeader(e.kHeaderSudMGPSDKVersion,C.kVersion),t.addHeader(e.kHeaderSudMGPSDKVersionAlias,C.kVersionAlias),t.addHeader(e.kHeaderSudMGPSDKPlatform,M.getPlatform()),t.addHeader(e.kHeaderSudMGPSDKAppId,M.getAppId()),t.addHeader(e.kHeaderSudMGPSDKBundleId,M.getBundleID()),t.addHeader(e.kHeaderSudMGPSDKTraceId,M.getTraceId()),t.addHeader(e.kHeaderSudMGPSDKRequestId,i),t.addHeader(e.kHeaderSudMGPSDKUserId,R.getUserId()),t.addHeader(e.kHeaderSudMGPSDKEtIsDynamic,!0)},success:function(e){u.v(r.kTag,"get success res:",e),n.onSuccess(e)},fail:function(e){u.v(r.kTag,"get fail res:",e),n.onFailure(e)}})},e.prototype.clearCache=function(){this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",this.reportStatsUrl="",this.mgIdGameInfoMap.clear()},e.prototype.getFQSInfoBaseUrl=function(t){var i=M.getEnvType();return i===M.kEnvTypeDev?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoDevBaseUrls,t):i===M.kEnvTypeFat?this.getFQSInfoBaseUrlByArray(e.kGetFQSInfoFatBaseUrls,t):i===M.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{M.genTraceId();var r=this.getFQSInfoBaseUrl(i)+h()(e),o=new E(E.kStatsEventGetFQSInfo),s=this;this.doSudGet(r,o.getRequestId(),{onSuccess:function(e){var t={ret_code:k.kSuccess,ret_msg:"success",url:JSON.parse(e).url};o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),R.report(o),s.handleGetFQSInfoResp(t,t.url,n)},onFailure:function(e){var t={ret_code:k.kFail,ret_msg:e.toString()};o.setResp(""),o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),R.report(o),s.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(M.getAppId()," isTestEnv=",M.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,o=M.getBundleID(),s=new E(E.kStatsEventGetSDKToken),a={app_id:e,app_key:t,bundle_id:o,platform:M.getPlatform(),is_test_env:i,sdk_version:C.kVersion},c=this;this.doSudPost(r,a,s.getRequestId(),{onSuccess:function(e){var t=JSON.parse(e);c.handleInitSDKCb(t,n),s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),R.report(s)},onFailure:function(e){var t={ret_code:k.kFail,ret_msg:e.toString()};s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),c.handleInitSDKCb(t,n),R.report(s)}})}},e.prototype.handleInitSDKCb=function(e,t){if(t)if(0===e.ret_code)this.sdkToken=e.data.sdk_token,this.getMGListUrl=e.data.sdk_api_cfg.mg_list_url,this.getMGInfoUrl=e.data.sdk_api_cfg.mg_info_url,this.reportStatsUrl=e.data.sdk_api_cfg.report_url,M.setGetSDKTokenResp(e),this.isInitSdkOk=!0,t.onSuccess();else{var i="getSDKToken fail appId=".concat(M.getAppId()," isTestEnv=",M.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," ",e.ret_msg);t.onFailure(e.ret_code,i)}},e.prototype.getCacheMGInfo=function(e){return this.mgIdGameInfoMap.get(e)||{}},e.prototype.setCacheMGInfo=function(e,t){this.mgIdGameInfoMap.set(e,t)},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}(),O=function(){function e(){}return e.e=function(e){M.getEnvType()!==e&&M.clearCache(),M.setEnvType(e)},e}(),M=function(){function e(){}return e.initSDK=function(t,i,n,r,o){if(t&&0!==t.length&&i&&0!==i.length){var s=e.getEnvType(),a=e.getIsTestEnv();e.setIsTestEnv(r);var c=e.getEnvType();e.sAppId===t&&e.sAppKey===i&&s===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,o)}else o&&o.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()(w())},e.getTraceId=function(){return e.sTraceId},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.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,o){this.isHit=e,this.keyWord=t,this.text=i,this.wordType=n,this.keyWordList=r,this.numberList=o}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)},z=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(u.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,o=0;o<t.wordList.length;o++){var s=t.wordList[o];if(!this.hitKeywordSet.has(s)){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],o=[parseInt(n)];i.notifyAppCommonSelfTextHit(!0,n,null,t.wordType,r,o)}}));for(var n=!0,r=0;r<t.wordList.length;r++){var o=t.wordList[r];if(!this.hitKeywordSet.has(o)){n=!1;break}}n&&this.stopASR()}},e.prototype.notifyAppCommonSelfTextHit=function(t,i,n,r,o,s){var a=new L(t,i,n,r,o,s),c=this.paramModel.iSudFSTAPP;null!==c&&(c.notifyStateChange(L.getState(),a.toJson(),{onSuccess:function(){},onFailure:function(){}}),u.d(e._TAG,"notifyAppCommonSelfTextHit: ",a.toJson()))},e._TAG="BaseRealSudASRImpl",e}();const N="OutputFormat",B="CancellationErrorCode",G="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,Q;!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 J{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 J;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 J,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(N,void 0)]}set outputFormat(e){this.privProperties.setProperty(N,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(G,"{}"));i[e]=t,this.privProperties.setProperty(G,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),o=new Float32Array(r);let s=0,a=0;for(;a<r;){const t=Math.round((a+1)*n);let i=0,r=0;for(;s<t&&s<e.length;)i+=e[s++],r++;o[a++]=i/r}return o}}class ee{constructor(e){this.privStopInputOnRelease=e}record(e,t,i){const n=new $(e.sampleRate,16e3),r=e.createMediaStreamSource(t),o=()=>{const o=(()=>{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)}})();o.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(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,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 o=new AudioWorkletNode(e,"speech-processor");o.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(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,source:r,stream:t}})).catch((()=>{o()}))}else try{o()}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 oe{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"}(Q||(Q={}));const se={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ae;const ce=new Uint8Array(16);function pe(){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 ue=[];for(let e=0;e<256;++e)ue.push((e+256).toString(16).slice(1));const de=function(e,t,i){if(se.randomUUID&&!t&&!e)return se.randomUUID();const n=(e=e||{}).random||(e.rng||pe)();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(ue[e[t+0]]+ue[e[t+1]]+ue[e[t+2]]+ue[e[t+3]]+"-"+ue[e[t+4]]+ue[e[t+5]]+"-"+ue[e[t+6]]+ue[e[t+7]]+"-"+ue[e[t+8]]+ue[e[t+9]]+"-"+ue[e[t+10]]+ue[e[t+11]]+ue[e[t+12]]+ue[e[t+13]]+ue[e[t+14]]+ue[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 me 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 me("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 fe,_e,Se;!function(e){e[e.None=0]="None",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(fe||(fe={}));class ye{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 Ae(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){}}))}(Se=_e||(_e={}))[Se.Debug=0]="Debug",Se[Se.Info=1]="Info",Se[Se.Warning=2]="Warning",Se[Se.Error=3]="Error",Se[Se.None=4]="None";class we{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 Ce extends we{constructor(e,t,i=_e.Info){super(e,i),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class be extends Ce{constructor(e){super("AudioSourceInitializingEvent",e)}}class Ie extends Ce{constructor(e){super("AudioSourceReadyEvent",e)}}class Ee extends Ce{constructor(e){super("AudioSourceOffEvent",e)}}class Re extends Ce{constructor(e,t){super("AudioSourceErrorEvent",e,_e.Error),this.privError=t}get error(){return this.privError}}class ke extends Ce{constructor(e,t,i){super(e,t),this.privAudioNodeId=i}get audioNodeId(){return this.privAudioNodeId}}class Te extends ke{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class Pe extends ke{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class De extends ke{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class Oe extends ke{constructor(e,t,i){super("AudioStreamNodeErrorEvent",e,t),this.privError=i}get error(){return this.privError}}class Me{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 Me(t)}where(e){this.throwIfDisposed();const t=new Me;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 Me(t)}orderByDesc(e){return this.throwIfDisposed(),this.orderBy(((t,i)=>e(i,t)))}clone(){return this.throwIfDisposed(),new Me(this.toArray())}concat(e){return this.throwIfDisposed(),new Me(this.privList.concat(e.toArray()))}concatArray(e){return this.throwIfDisposed(),new Me(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 me("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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};!function(e){e[e.Dequeue=0]="Dequeue",e[e.Peek=1]="Peek"}(Le||(Le={}));class ze{constructor(e){this.privPromiseStore=new Me,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=e||new Me,this.privDetachables=[],this.privSubscribers=new Me,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 ye;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Le.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new ye;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 me("Queue")}if(this.privIsDisposing)throw new ve("Queue disposing")}}var Ne;class Be{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||he(),this.privReaderQueue=new ze}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,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(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(s,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new ze)}throwIfClosed(){if(this.privIsWriteEnded)throw new ve("Stream closed")}}class Ge 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"}(Ne||(Ne={}));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=Ne.PCM){super();let r=!0;switch(n){case Ne.PCM:this.formatTag=1;break;case Ne.ALaw:this.formatTag=6;break;case Ne.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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 ye;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 be(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Ie(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Ie(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Re(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 Re(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new Te(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new Pe(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 Ee(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:Q.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 ye;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 Ge(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new Oe(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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 Re(e,"")),Promise.reject(e)}this.onEvent(new be(this.privId)),this.onEvent(new Ie(this.privId))}id(){return this.privId}attach(e){return qe(this,void 0,void 0,(function*(){this.onEvent(new Te(this.privId,e));const t=yield this.upload(e);return this.onEvent(new Pe(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 Ee(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:Q.File})))}readHeader(){const e=this.privSource.slice(0,4296),t=new ye,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),o=i.getUint16(22,!0),s=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(s,a,o))};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 Oe(this.privId,e,i)),new Error(i)};try{yield this.turnOn();const i=yield this.privAudioFormatPromise,n=new Ge(i.avgBytesPerSec/10,e);this.privStreams[e]=n;const r=this.privSource.slice(this.privHeaderEnd),o=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;o(t)},e.readAsArrayBuffer(r)}else{const e=r;o(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,Qe,Je,Ze,Ye=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 Ge(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 be(this.privId)),this.onEvent(new Ie(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){this.onEvent(new Te(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new Pe(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:Q.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 be(this.privId)),this.onEvent(new Ie(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){return this.onEvent(new Te(this.privId,e)),yield this.turnOn(),this.onEvent(new Pe(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:Q.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 ot extends we{constructor(e,t,i=_e.Info){super(e,i),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class st extends we{constructor(e,t,i=_e.Info){super(e,i),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class at extends st{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 st{constructor(e){super("ConnectionEstablishedEvent",e)}}class pt extends st{constructor(e,t,i){super("ConnectionClosedEvent",e,_e.Debug),this.privReason=i,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ut extends st{constructor(e,t,i){super("ConnectionErrorEvent",e,_e.Debug),this.privMessage=t,this.privType=i}get message(){return this.privMessage}get type(){return this.privType}}class dt extends st{constructor(e,t,i){super("ConnectionEstablishErrorEvent",e,_e.Error),this.privStatusCode=t,this.privReason=i}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ht extends st{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 st{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"}(Qe||(Qe={})),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"}(Je||(Je={}));class vt{constructor(e){this.privResult=e}get result(){return this.privResult}}class mt 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,o){super(e,t,n,r),this.privAudioData=i,this.privAudioDuration=o}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,o){this.privAudioOffset=e,this.privDuration=t,this.privText=i,this.privWordLength=n,this.privTextOffset=r,this.privBoundaryType=o}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 ft{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class _t{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 St extends He{constructor(e,t,i,n,r,o,s,a,c){super(i,o,t,e),this.formatTag=e,this.avgBytesPerSec=n,this.blockAlign=r,this.priAudioFormatString=s,this.priRequestAudioFormatString=a,this.priHasHeader=c}static fromSpeechSynthesisOutputFormat(e){return void 0===e?St.getDefaultOutputFormat():St.fromSpeechSynthesisOutputFormatString(St.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new St(Ne.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new St(Ne.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new St(Ne.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new St(Ne.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new St(Ne.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new St(Ne.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new St(Ne.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new St(Ne.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new St(Ne.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new St(Ne.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new St(Ne.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new St(Ne.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new St(Ne.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new St(Ne.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new St(Ne.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new St(Ne.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new St(Ne.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new St(Ne.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new St(Ne.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new St(Ne.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new St(Ne.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new St(Ne.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new St(Ne.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new St(Ne.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new St(Ne.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new St(Ne.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new St(Ne.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new St(Ne.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new St(Ne.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new St(Ne.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return St.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}}St.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 yt;class At{constructor(){}static createPullStream(){return wt.create()}}class wt extends At{static create(){return new Ct}}class Ct extends wt{constructor(){super(),this.privId=he(),this.privStream=new Be}set format(e){null==e&&(this.privFormat=St.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,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(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(s,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 bt extends At{constructor(){super()}static create(e){return new It(e)}}class It extends bt{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"}(yt||(yt={}));class Et{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new Et(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}class Rt extends we{constructor(e,t,i=_e.Info){super(e,i),this.privRequestId=t}get requestId(){return this.privRequestId}}class kt extends Rt{constructor(e,t,i){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=i}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Tt extends Rt{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class Pt extends Rt{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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};class Ot{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 ye,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 Ct,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 kt(this.requestId,void 0,void 0===n?void 0:n.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Tt(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new Pt(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 ye}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===yt.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!Ot.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)&&!Ot.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 Mt{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 zt extends rt{constructor(e,t,i,n,r,o,s,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),o&&(c[xt.RequestStreamId]=o),s)for(const e in s)e&&(c[e]=s[e]);a?super(e,r,c,a):super(e,r,c),this.privPath=t,this.privRequestId=i,this.privContentType=n,this.privStreamId=o,this.privAdditionalHeaders=s}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 o={};if(e.headers)for(const s in e.headers)s&&(s.toLowerCase()===xt.Path.toLowerCase()?t=e.headers[s]:s.toLowerCase()===xt.RequestId.toLowerCase()?i=e.headers[s]:s.toLowerCase()===xt.ContentType.toLowerCase()?n=e.headers[s]:s.toLowerCase()===xt.RequestStreamId.toLowerCase()?r=e.headers[s]:o[s]=e.headers[s]);return new zt(e.messageType,t,i,n,e.body,r,o,e.id)}}var Nt=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 Ot,this.privConnectionEvents=new ge,this.privServiceEvents=new ge,this.privSynthesisContext=new Mt(this.privSpeechSynthesizer),this.privAgentConfig=new Lt,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(Qe.Error,1007===t.statusCode?Je.BadRequestParameters:Je.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 Nt(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 Nt(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Nt(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 zt(i,e,this.privSynthesisTurn.requestId,n,t))}))}Speak(e,t,i,n,r,o){return Nt(this,void 0,void 0,(function*(){let s;if(s=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(s,i,n,r);this.privSuccessCallback=n,this.privErrorCallback=r,this.privSynthesisTurn.startNewSynthesis(i,e,t,o);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,s,i);const t=new vt(new mt(i,Ze.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(Qe.Error,Je.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,i,n){const r=new J;r.setProperty(B,Je[i]);const o=new mt(e,Ze.Canceled,void 0,n,r);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new vt(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(o)}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 Nt(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=zt.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 mt(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=Et.fromJSON(i.textBody).Metadata;for(const t of e)switch(t.Type){case yt.WordBoundary:case yt.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===yt.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 yt.Bookmark:const i=new ft(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch(e){}break;case yt.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new _t(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case yt.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new mt(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 ot(i.path.toLowerCase(),i.textBody))}return this.receiveMessage()}catch(e){}}))}sendSynthesisContext(e){const t=this.synthesisContext.toJSON();if(t)return e.send(new zt(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=>Nt(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 zt(We.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,i){return e.send(new zt(We.Text,"ssml",i,"application/ssml+xml",t))}fetchConnection(){return Nt(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 Nt(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 Gt extends we{constructor(e){super("BackgroundEvent",_e.Error),this.privError=e}get error(){return this.privError}}var Ut=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};const Ft={[Ne.PCM]:"audio/wav",[Ne.MuLaw]:"audio/x-wav",[Ne.MP3]:"audio/mpeg",[Ne.OGG_OPUS]:"audio/ogg",[Ne.WEBM_OPUS]:"audio/webm; codecs=opus",[Ne.ALaw]:"audio/x-wav",[Ne.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!==Ne.PCM&&this.privFormat.formatTag!==Ne.MuLaw&&this.privFormat.formatTag!==Ne.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 ${Ne[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 Gt(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{Ue.instance.onEvent(new Gt(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{Ue.instance.onEvent(new Gt(e))}))):(console.warn(`Format ${Ne[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new Ct,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 It(e));if(e instanceof bt)return new Wt(e);if(e instanceof wt)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),Qt=i.n(Xt);class Jt{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 we{constructor(e,t,i){super(e,t),this.privSignature=i}}class ti extends ei{constructor(e){super("OCSPMemoryCacheHitEvent",_e.Debug,e)}}class ii extends ei{constructor(e){super("OCSPCacheMissEvent",_e.Debug,e)}}class ni extends ei{constructor(e){super("OCSPDiskCacheHitEvent",_e.Debug,e)}}class ri extends ei{constructor(e){super("OCSPCacheUpdateNeededEvent",_e.Debug,e)}}class oi extends ei{constructor(e){super("OCSPMemoryCacheStoreEvent",_e.Debug,e)}}class si extends ei{constructor(e){super("OCSPDiskCacheStoreEvent",_e.Debug,e)}}class ai extends ei{constructor(e){super("OCSPCacheUpdateCompleteEvent",_e.Debug,e)}}class ci extends ei{constructor(){super("OCSPStapleReceivedEvent",_e.Debug,"")}}class pi extends ei{constructor(e,t){super("OCSPCacheEntryExpiredEvent",_e.Debug,e),this.privExpireTime=t}}class ui extends ei{constructor(e,t,i){super("OCSPCacheEntryNeedsRefreshEvent",_e.Debug,e),this.privExpireTime=i,this.privStartTime=t}}class di extends ei{constructor(e,t,i){super("OCSPCacheHitEvent",_e.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",_e.Debug,e),this.privError=t}}class li extends ei{constructor(e,t){super("OCSPCacheFetchErrorEvent",_e.Debug,e),this.privError=t}}class vi extends ei{constructor(e){super("OCSPResponseRetrievedEvent",_e.Debug,e)}}class mi extends ei{constructor(e,t){super("OCSPCacheUpdateErrorEvent",_e.Debug,e),this.privError=t}}var gi=i(108),fi=i.n(gi),_i=i(275),Si=i.n(_i),yi=i(505),Ai=i.n(yi),wi=i(146),Ci=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};class bi{constructor(e){e&&(this.privProxyInfo=e),bi.privDiskCache||(bi.privDiskCache=new(Si())("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:"undefined"!=typeof process&&{npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"d098940d7ec6706c4815248f03f154d29246aef4",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/usr/local/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/usr/local/etc/npmignore",TERM:"xterm-256color",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",SHELL:"/bin/zsh",npm_config_shell:"/bin/zsh",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",HOMEBREW_REPOSITORY:"/opt/homebrew",TMPDIR:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.99.3",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",MallocNanoZone:"0",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/usr/local/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.lEq2WKNGKq/Listeners",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/usr/local/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",PATH:"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",npm_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"98A4089C-EC11-4A9B-8875-453C239E5443",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"",npm_config_node_version:"14.16.1",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",npm_package_name:"sudmgp-sdk-js",LANG:"zh_CN.UTF-8",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",npm_config_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",XPC_FLAGS:"0x0",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.0",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"2",HOME:"/Users/reber",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",HOMEBREW_PREFIX:"/opt/homebrew",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",VSCODE_GIT_IPC_HANDLE:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/vscode-git-3ae67a71ea.sock",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.12 node/v14.16.1 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",VSCODE_GIT_ASKPASS_NODE:"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",GIT_ASKPASS:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",INFOPATH:"/opt/homebrew/share/info:/opt/homebrew/share/info:",HOMEBREW_CELLAR:"/opt/homebrew/Cellar",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a5",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/usr/local/bin/node",npm_config_prefix:"/usr/local",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.0"}.SPEECH_OCSP_CACHE_ROOT?{npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"d098940d7ec6706c4815248f03f154d29246aef4",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/usr/local/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/usr/local/etc/npmignore",TERM:"xterm-256color",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",SHELL:"/bin/zsh",npm_config_shell:"/bin/zsh",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",HOMEBREW_REPOSITORY:"/opt/homebrew",TMPDIR:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.99.3",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",MallocNanoZone:"0",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/usr/local/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.lEq2WKNGKq/Listeners",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/usr/local/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",PATH:"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",npm_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"98A4089C-EC11-4A9B-8875-453C239E5443",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"",npm_config_node_version:"14.16.1",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",npm_package_name:"sudmgp-sdk-js",LANG:"zh_CN.UTF-8",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",npm_config_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",XPC_FLAGS:"0x0",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.0",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"2",HOME:"/Users/reber",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",HOMEBREW_PREFIX:"/opt/homebrew",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",VSCODE_GIT_IPC_HANDLE:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/vscode-git-3ae67a71ea.sock",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.12 node/v14.16.1 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",VSCODE_GIT_ASKPASS_NODE:"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",GIT_ASKPASS:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",INFOPATH:"/opt/homebrew/share/info:/opt/homebrew/share/info:",HOMEBREW_CELLAR:"/opt/homebrew/Cellar",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a5",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/usr/local/bin/node",npm_config_prefix:"/usr/local",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.0"}.SPEECH_OCSP_CACHE_ROOT:void 0}))}static forceReinitDiskCache(){bi.privDiskCache=void 0,bi.privMemCache={}}GetAgent(e){const t=new(fi().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(Ai())(t)}static OCSPCheck(e,t){return Ci(this,void 0,void 0,(function*(){let i,n,r=!1;const o=yield e;o.cork();const s=o;return new Promise(((e,a)=>{o.on("OCSPResponse",(e=>{e&&(this.onEvent(new ci),n=e)})),o.on("error",(e=>{r||(r=!0,o.destroy(),a(e))})),s.on("secure",(()=>Ci(this,void 0,void 0,(function*(){const c=s.getPeerCertificate(!0);try{const s=yield this.GetIssuer(c);i=$t.request.generate(c.raw,s.raw);const a=i.id.toString("hex");if(!n){const e=yield bi.GetResponseFromCache(a,i,t);n=e}yield this.VerifyOCSPResponse(n,i,t),o.uncork(),r=!0,e(o)}catch(e){o.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 Ci(this,void 0,void 0,(function*(){let n=bi.privMemCache[e];if(n&&this.onEvent(new ti(e)),!n)try{const t=yield bi.privDiskCache.get(e);t.isCached&&(bi.onEvent(new ni(e)),bi.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 o=r.responses[0].thisUpdate,s=r.responses[0].nextUpdate;if(s<Date.now()+this.testTimeOffset-6e4)this.onEvent(new pi(e,s)),n=null;else{const n=Math.min(864e5,(s-o)/2);s-(Date.now()+this.testTimeOffset)<n?(this.onEvent(new ui(e,o,s)),this.UpdateCache(t,i).catch((t=>{this.onEvent(new mi(e,t.toString()))}))):this.onEvent(new di(e,o,s))}}catch(t){this.onEvent(new li(e,t)),n=null}return n||this.onEvent(new ii(e)),n}))}static VerifyOCSPResponse(e,t,i){return Ci(this,void 0,void 0,(function*(){let n=e;return n||(n=yield bi.GetOCSPResponse(t,i)),new Promise(((r,o)=>{$t.verify({request:t,response:n},(s=>{s?(bi.onEvent(new hi(t.id.toString("hex"),s)),e?this.VerifyOCSPResponse(null,t,i).then((()=>{r()}),(e=>{o(e)})):o(s)):(e||bi.StoreCacheEntry(t.id.toString("hex"),n),r())}))}))}))}static UpdateCache(e,t){return Ci(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 oi(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new si(e))}))}static GetOCSPResponse(e,t){let i={};if(t){const e=bi.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,o)=>{if(r)return void n(r);const s=new URL(o);i=Object.assign(Object.assign({},i),{host:s.host,protocol:s.protocol,port:s.port,path:s.pathname,hostname:s.host}),$t.utils.getResponse(i,e.data,((i,r)=>{if(i)return void n(i);const o=e.certID;this.onEvent(new vi(o.toString("hex"))),t(r)}))}))}))}static onEvent(e){Ue.instance.onEvent(e)}CreateConnection(e,t){const i="undefined"!=typeof process&&"0"!=={npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"d098940d7ec6706c4815248f03f154d29246aef4",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/usr/local/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/usr/local/etc/npmignore",TERM:"xterm-256color",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",SHELL:"/bin/zsh",npm_config_shell:"/bin/zsh",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",HOMEBREW_REPOSITORY:"/opt/homebrew",TMPDIR:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.99.3",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",MallocNanoZone:"0",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/usr/local/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.lEq2WKNGKq/Listeners",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/usr/local/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",PATH:"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",npm_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"98A4089C-EC11-4A9B-8875-453C239E5443",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"",npm_config_node_version:"14.16.1",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",npm_package_name:"sudmgp-sdk-js",LANG:"zh_CN.UTF-8",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",npm_config_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",XPC_FLAGS:"0x0",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.0",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"2",HOME:"/Users/reber",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",HOMEBREW_PREFIX:"/opt/homebrew",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",VSCODE_GIT_IPC_HANDLE:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/vscode-git-3ae67a71ea.sock",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.12 node/v14.16.1 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",VSCODE_GIT_ASKPASS_NODE:"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",GIT_ASKPASS:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",INFOPATH:"/opt/homebrew/share/info:/opt/homebrew/share/info:",HOMEBREW_CELLAR:"/opt/homebrew/Cellar",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a5",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/usr/local/bin/node",npm_config_prefix:"/usr/local",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.0"}.NODE_TLS_REJECT_UNAUTHORIZED&&"0"!=={npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"d098940d7ec6706c4815248f03f154d29246aef4",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/usr/local/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/usr/local/etc/npmignore",TERM:"xterm-256color",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",SHELL:"/bin/zsh",npm_config_shell:"/bin/zsh",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",HOMEBREW_REPOSITORY:"/opt/homebrew",TMPDIR:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.99.3",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",MallocNanoZone:"0",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/usr/local/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.lEq2WKNGKq/Listeners",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/usr/local/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",DEVECOSTUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/devecostudio.vmoptions",PATH:"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/reber/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand",npm_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"98A4089C-EC11-4A9B-8875-453C239E5443",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"",npm_config_node_version:"14.16.1",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",npm_package_name:"sudmgp-sdk-js",LANG:"zh_CN.UTF-8",CLION_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/clion.vmoptions",IDEA_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/idea.vmoptions",npm_config_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",XPC_FLAGS:"0x0",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",npm_config_electron_mirror:"https://cdn.npmmirror.com/binaries/electron/",DATASPELL_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/dataspell.vmoptions",npm_config_node_gyp:"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",npm_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.0",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"2",HOME:"/Users/reber",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",HOMEBREW_PREFIX:"/opt/homebrew",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",VSCODE_GIT_IPC_HANDLE:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T/vscode-git-3ae67a71ea.sock",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.12 node/v14.16.1 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",VSCODE_GIT_ASKPASS_NODE:"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",GIT_ASKPASS:"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",INFOPATH:"/opt/homebrew/share/info:/opt/homebrew/share/info:",HOMEBREW_CELLAR:"/opt/homebrew/Cellar",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a5",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/g5/9m38hlpj0kz8txb2h14w5bmh0000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/usr/local/bin/node",npm_config_prefix:"/usr/local",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.0"}.SPEECH_CONDUCT_OCSP_CHECK&&t.secureEndpoint;let n;if(t=Object.assign(Object.assign({},t),{requestOCSP:!bi.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const i=bi.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(wi.connect(t));return i?bi.OCSPCheck(n,this.privProxyInfo):n}}bi.testTimeOffset=0,bi.forceDisableOCSPStapling=!1,bi.privMemCache={};var Ii=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};class Ei{constructor(e,t,i,n,r,o){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=o,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 ye,this.privCertificateValidatedDeferral=new ye,this.privConnectionState=Xe.Connecting;try{if("undefined"==typeof WebSocket||Ei.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new bi(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(Qt())(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new ze,this.privDisconnectDeferral=new ye,this.privSendMessageQueue=new ze,this.processSendQueue().catch((e=>{Ue.instance.onEvent(new Gt(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new Jt(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 Jt(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new ut(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 Jt(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Xe.Disconnected,this.privWebsocketClient=null,this.onEvent(new pt(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{Ue.instance.onEvent(new Gt(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===Xe.Connected){const i=new ye;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 ye,i=new ye;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 Ii(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 Ii(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}}Ei.forceNpmWebSocket=!1;var Ri;class ki{constructor(e,t,i,n,r,o=!1,s){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=s||he(),this.privConnectionMessageAdapter=new Ei(this.privUri,this.id,this.privMessageFormatter,r,i,o)}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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 Ti{constructor(e,t,i,n){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=i,this.privProxyPassword=n}static fromParameters(e){return new Ti(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 Pi{}Pi.BotId="botid",Pi.CustomSpeechDeploymentId="cid",Pi.CustomVoiceDeploymentId="deploymentId",Pi.EnableAudioLogging="storeAudio",Pi.EnableLanguageId="lidEnabled",Pi.EnableWordLevelTimestamps="wordLevelTimestamps",Pi.EndSilenceTimeoutMs="endSilenceTimeoutMs",Pi.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",Pi.Format="format",Pi.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",Pi.Language="language",Pi.Profanity="profanity",Pi.RequestBotStatusMessages="enableBotMessageStatus",Pi.StableIntermediateThreshold="stableIntermediateThreshold",Pi.StableTranslation="stableTranslation",Pi.TestHooks="testhooks",Pi.Postprocessing="postprocessing",Pi.CtsMeetingId="meetingId",Pi.CtsDeviceId="deviceId",Pi.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,Pi.SegmentationSilenceTimeoutMs],[H.SpeechServiceConnection_EnableAudioLogging,Pi.EnableAudioLogging],[H.SpeechServiceConnection_EndSilenceTimeoutMs,Pi.EndSilenceTimeoutMs],[H.SpeechServiceConnection_InitialSilenceTimeoutMs,Pi.InitialSilenceTimeoutMs],[H.SpeechServiceResponse_PostProcessingOption,Pi.Postprocessing],[H.SpeechServiceResponse_ProfanityOption,Pi.Profanity],[H.SpeechServiceResponse_RequestWordLevelTimestamps,Pi.EnableWordLevelTimestamps],[H.SpeechServiceResponse_StablePartialResultThreshold,Pi.StableIntermediateThreshold]]).forEach(((n,r)=>{this.setUrlParameter(r,n,e,t,i)}));const n=JSON.parse(e.parameters.getProperty(G,"{}"));Object.keys(n).forEach((e=>{t[e]=n[e]}))}setUrlParameter(e,t,i,n,r){const o=i.parameters.getProperty(e,void 0);!o||r&&-1!==r.search(t)||(n[t]=o.toLocaleLowerCase())}}class Oi{toConnectionMessage(e){const t=new ye;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 o=new DataView(i),s=o.getInt16(0);if(i.byteLength<s+2)throw new Error("Invalid binary message format. Header content missing.");let a="";for(let e=0;e<s;e++)a+=String.fromCharCode(o.getInt8(e+2));n=this.parseHeaders(a),i.byteLength>s+2&&(r=i.slice(2+s)),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 ye;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),o=new Int8Array(r),s=o.byteLength,a=new Int8Array(2+s+(n?n.byteLength:0));if(a[0]=s>>8&255,a[1]=255&s,a.set(o,2),n){const e=new Int8Array(n);a.set(e,2+s)}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 Mi 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),o=Di.getHostSuffix(r),s=e.parameters.getProperty(H.SpeechServiceConnection_Host,"wss://"+r+".stt.speech"+o),a={},c=e.parameters.getProperty(H.SpeechServiceConnection_EndpointId,void 0),p=e.parameters.getProperty(H.SpeechServiceConnection_RecoLanguage,void 0);if(c?n&&-1!==n.search(Pi.CustomSpeechDeploymentId)||(a[Pi.CustomSpeechDeploymentId]=c):p&&(n&&-1!==n.search(Pi.Language)||(a[Pi.Language]=p)),n&&-1!==n.search(Pi.Format)||(a[Pi.Format]=e.parameters.getProperty(N,K[K.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(a[Pi.EnableLanguageId]="true"),this.setCommonUrlParams(e,a,n),!n)switch(e.recognitionMode){case V.Conversation:n="true"===e.parameters.getProperty(U,"false")?s+this.dictationRelativeUri:void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${s}${this.universalUri}${e.recognitionEndpointVersion}`:s+this.conversationRelativeUri;break;case V.Dictation:n=s+this.dictationRelativeUri;break;default:n=void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${s}${this.universalUri}${e.recognitionEndpointVersion}`:s+this.interactiveRelativeUri}const u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[xt.ConnectionId]=i;const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false"),h=new ki(n,a,u,new Oi,Ti.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,o,s,a,c,p){this.privResultId=e,this.privReason=t,this.privText=i,this.privDuration=n,this.privOffset=r,this.privLanguage=o,this.privLanguageDetectionConfidence=s,this.privErrorDetails=a,this.privJson=c,this.privProperties=p}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,o,s,a,c,p,u){super(e,t,i,n,r,o,s,c,p,u),this.privSpeakerId=a}get speakerId(){return this.privSpeakerId}}class xi{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class zi extends xi{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class Ni extends zi{constructor(e,t,i){super(t,i),this.privResult=e}get result(){return this.privResult}}class Bi extends zi{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 Gi 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 we{constructor(e,t,i,n=_e.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"}(Ri||(Ri={}));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 Te&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Pe&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Re&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Oe&&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 Qi=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};class Ji{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 ye,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 Qi(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 Qi(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return Qi(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 Qi(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 ye}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 Qi(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 Qi(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 Qi(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return Qi(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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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 Ji(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(Qe.Error,1007===t.statusCode?Je.BadRequestParameters:Je.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===Q.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(Qe.Error,Je.ConnectionFailure,e))}const o=new xi(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,o),this.receiveMessage(),this.sendAudio(r).catch((e=>nn(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(Qe.Error,Je.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(Qe.Error,Je.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 zt(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 zt(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=zt.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 zi(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 o=$i.fromJSON(r);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(o.Offset+this.privRequestSession.currentTurnAudioOffset);const s=new zi(o.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,s);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(Qe.EndOfStream,Je.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 ot(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 zt(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 zt(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 zt(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),o=this.privRequestSession.recogNumber,s=()=>nn(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){const n=yield this.fetchConnection(),a=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let c,p;if(!a||a.isEnd?(c=null,p=0):(c=a.buffer,this.privRequestSession.onAudioSent(c.byteLength),p=r>=this.privRequestSession.bytesSent?0:Math.max(0,i-Date.now())),0!==p&&(yield this.delay(p)),null!==c&&(i=Date.now()+1e3*c.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){if(n.send(new zt(We.Binary,"audio",this.privRequestSession.requestId,null,c)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==a?void 0:a.isEnd))return s();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return s()}))}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 o=this.privConnectionFactory.create(this.privRecognizerConfig,r,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(o.events),o.events.attach((e=>{this.connectionEvents.onEvent(e)}));const s=yield o.open();if(200===s.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(s.statusCode),Promise.resolve(o);1006===s.statusCode&&(e=!0),i=s.statusCode,n=s.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 zt(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 on{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new on(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 sn{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=tn[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new sn(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=Qe.EndOfStream;switch(e){case tn.Success:case tn.EndOfDictation:case tn.NoMatch:t=Qe.EndOfStream;break;case tn.InitialSilenceTimeout:case tn.BabbleTimeout:case tn.Error:case tn.BadRequest:case tn.Forbidden:default:t=Qe.Error}return t}static implTranslateCancelErrorCode(e){let t=Je.NoError;switch(e){case tn.Error:t=Je.ServiceError;break;case tn.TooManyRequests:t=Je.TooManyRequests;break;case tn.BadRequest:t=Je.BadRequestParameters;break;case tn.Forbidden:t=Je.Forbidden;break;default:t=Je.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case Je.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case Je.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case Je.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 pn extends rn{constructor(e,t,i,n,r){super(e,t,i,n,r),this.privSpeechRecognizer=r;const o={};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&&(o.customModels=i,o.onInterim={action:"None"},o.onSuccess={action:"None"})}(e=>{for(const t in e)return!1;return!0})(o)||this.privSpeechContext.setSection("phraseDetection",o)}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 J;i.setProperty(H.SpeechServiceResponse_JsonResult,e.textBody);let n=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const r=on.fromJSON(e.textBody),o=r.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Li(this.privRequestSession.requestId,Ze.RecognizingSpeech,r.Text,r.Duration,o,r.Language,r.LanguageDetectionConfidence,void 0,void 0,e.textBody,i),this.privRequestSession.onHypothesis(o);const s=new Ni(t,r.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,s)}catch(e){}n=!0;break;case"speech.phrase":const a=sn.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(N)===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,o=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,o,i)}const n=new Ni(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,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(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(s,a)}c((r=r.apply(t,i||[])).next())}));var t,i,n,r}cancelRecognition(e,t,i,n,r){const o=new J;if(o.setProperty(B,Je[n]),this.privSpeechRecognizer.canceled){const t=new Gi(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,o);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class un{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 un(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 un(xt.Authorization,void 0===e?void 0:hn.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new un(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,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(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(s,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),Ae(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 oe(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 ye;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 mn 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 Mi),this.privDisposedRecognizer=!1}static FromConfig(e,t,i){const n=e;return t.properties.mergeTo(n.properties),new mn(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(N,K[K.Simple])===K[K.Simple]?K.Simple:K.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){Ae(this.recognizeOnceAsyncImpl(V.Interactive),e,t)}startContinuousRecognitionAsync(e,t){Ae(this.startContinuousRecognitionAsyncImpl(V.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){Ae(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),Ae(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return i=this,n=void 0,o=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 s(e){try{c(o.next(e))}catch(e){t(e)}}function a(e){try{c(o.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(s,a)}c((o=o.apply(i,n||[])).next())}));var i,n,r,o}createRecognizerConfig(e){return new te(e,this.privProperties)}createServiceRecognizer(e,t,i,n){return new pn(e,t,i,n,this)}}var gn,fn=function(){function e(t,i,n){this.isRunning=!1,this.baseSudASR=new z(n,this),u.d(e._TAG,"speechRegion:",i),this.speechConfig=Z.fromSubscription(t,i)}return e.prototype.startASR=function(t){var i=this;if(u.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 mn(this.speechConfig,n),this.reco.recognized=function(t,n){if(u.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(){u.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 _n,Sn=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(u.d(e._TAG,"asrType:"+i),u.d(e._TAG,"asrLoadList:"+M.getAsrLoadList()),i===gn.AZURE){var n=M.getSdkRtssCfg();if(null!=n&&null!=n.microsoft_rtss_cfg){var r=n.microsoft_rtss_cfg;return new fn(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 M.getAzureASRTextLanguageList();case gn.SHU_MEI:default:return[]}},e.getASRNumberLanguageList=function(){switch(this.getUseASRType()){case gn.AZURE:return M.getAzureASRNumberLanguageList();case gn.SHU_MEI:default:return[]}},e.getUseASRType=function(){var e=M.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}(),yn=function(){function e(e,t,i,n,r){this.kTag="SudFSMMGStateHandlerImpl",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){}},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):this.handleGameNotifyStateChange(r,i,n):"player"===e?this.handlePlayerNotifyStateChange(r,t,i,n):r.fail(k.toJson(k.kFail,"param invalid cmd is not game or player")):r.fail(k.toJson(k.kFail,"param invalid param is null")):r.fail(k.toJson(k.kFail,"param invalid cmd is null"))},e.prototype.handleSetDebug=function(e,t,i){u.d(this.kTag,"handleSetDebug {0} = {1}",t,i),e.success(k.kSuccessJson)},e.prototype.handleMgLog=function(e,t,i){var n;null===(n=this._fsmMG)||void 0===n||n.onGameLog(i),e.success(k.kSuccessJson)},e.prototype.handleGetNetStatus=function(e,t,i){u.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){u.d(this.kTag,"handleNotifyGameLoadPercent {0} = {1}",t,i),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLoadPercent(i),e.success(k.kSuccessJson)},e.prototype.handleVibrate=function(e,t,i){u.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success(k.kSuccessJson)},e.prototype.handleGetSDKInfo=function(e,t,i){var n={ret_code:k.kSuccess,ret_msg:"success",env_type:M.getEnvType(),language:M.getLanguage(),wordLanguage:M.getLanguage(),asr_text_language_list:Sn.getASRTextLanguageList(),asr_number_language_list:Sn.getASRNumberLanguageList(),sdk_version:C.kVersion,app_id:M.getAppId(),platform:M.getPlatform(),bundle_id:M.getBundleID(),sud_sdk_trace_id:M.genTraceId(),mg_id:Number(this._mgId),mg_id_str:this._mgId,mg_api_cfg:M.getMgApiCfgJson(),app_server_info_url:"",game_login_url:"",dynamic_config:this._dynamicConfig};null==M.getSdkRtssCfg()||null==M.getSdkRtssCfg().sm_game_word_language||M.getSdkRtssCfg().sm_game_word_language||(n.wordLanguage=M.getSdkRtssCfg().sm_game_word_language);var r=M.getMgApiCfg();n.app_server_info_url=r.app_server_info_url,n.game_login_url=r.game_login_url,u.d(this.kTag,"getSDKInfo",n),e.success(JSON.stringify(n))},e.prototype.handleGetState=function(e,t,i){u.d(this.kTag,"handleGetState {0} = {1}",t,i),e.success("{}")},e.prototype.handleNotifyGameLoadStarted=function(e,t,i){var n;u.d(this.kTag,"onGameLoadStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadStarted(),null===(n=this._fsmMG)||void 0===n||n.onGameLoadingProgress(2,k.kSuccess,99),e.success(k.kSuccessJson)},e.prototype.handleNotifyGameLoadCompleted=function(e,t,i){u.d(this.kTag,"onGameLoadCompleted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadCompleted(),e.success(k.kSuccessJson)},e.prototype.handleNotifyGameStarted=function(e,t,i){var n,r;u.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(k.kSuccessJson)},e.prototype.handleLogin=function(e,t,i){u.d(this.kTag,"handleLogin {0} = {1}",t,i);var n={ret_code:k.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:M.getAppId(),platform:M.getPlatform(),bundle_id:M.getBundleID(),sud_sdk_trace_id:M.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;u.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,o;(null===(r=this._fsmMG)||void 0===r?void 0:r.onPlayerStateChange)&&(null===(o=this._fsmMG)||void 0===o||o.onPlayerStateChange(e,t,i,n))},e}();!function(e){e[e.START=1]="START",e[e.LOADING=2]="LOADING",e[e.END=3]="END"}(_n||(_n={}));var An="SudMGP",wn=function(){function e(){}return e.sendAppCustomCommandEvent=function(e,t,i,n){e.contentWindow&&e.contentWindow.postMessage({msgTag:An,msgType:11,ctxId:t,state:i,dataJson:n},"*")},e.sendGameCustomCommandCallback=function(e,t,i,n,r){e.contentWindow&&e.contentWindow.postMessage({msgTag:An,msgType:12,ctxId:t,isSuccess:i,state:n,dataJson:r},"*")},e}(),Cn=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||(wn.sendGameCustomCommandCallback(this._window,this._ctxId,!0,this._state,e),this._isCalled=!0)},e.prototype.fail=function(e){this._isCalled||(wn.sendGameCustomCommandCallback(this._window,this._ctxId,!1,this._state,e),this._isCalled=!0)},e}(),bn=function(){function e(){}return e.create=function(e,t){var i={iSudFSTAPP:t,language:e.language,supportTextLanguageList:[],supportNumberLanguageList:[]};return new Sn(i)},e}(),In=function(){function e(){this._statsEvent=null,this.steps=[],this.loadTimestamp=Date.now()}return e.prototype.startLoad=function(e){this._statsEvent=new E(E.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()!==E.kStatsEventLoadGameFinished&&(this._statsEvent.setEvent(E.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()),this._statsEvent.putExtra("loadGame",this.steps),R.report(this._statsEvent),this._statsEvent=null)},e.prototype.reportTimeoutEvent=function(e){if(null!==this._statsEvent){if(80===e)this._statsEvent.setRetCode(k.ENGINE_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(k.ENGINE_LOAD_TIMEOUT),this._statsEvent.setRetMsg("引擎加载超时");else{if(!(e>=85&&e<100))return;this._statsEvent.setRetCode(k.GAME_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(k.GAME_LOAD_TIMEOUT),this._statsEvent.setRetMsg("游戏加载超时")}this._statsEvent.setEvent(E.kStatsEventLoadGameTimeout),this._statsEvent.putExtra("loadGame",this.steps),R.report(this._statsEvent),this._statsEvent.setEvent(E.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}(),En=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}(),Rn=function(){function e(e,t){this._kTag="H5SudFSTAPPImpl",this.isCanReportTimeoutEvent=!0,this._gameLoadPercent=0,this._startDelayOnGameLoadCompletedTimer=null,this.loadGameStatsEvent=new In;var i=e.parentElm,n=e.fstAppCtxId,r=e.userId,s=e.roomId,a=e.code,c=e.mgId,p=e.language;this._fstAppCtxId=n,this._userId=r,this._roomId=s,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.revceiveGameLoading=!1,this._ctxIdListenerNotifyStateChangeMap=new Map,this._idIDGenerator=new o,this._sudFSMMGStateHandler=function(e,t,i,n,r){return new yn(e,t,i,n,r)}(t,r,s,a,c),this._sudASR=bn.create({language:p},this),R.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,_n.END,k.kSuccess,100),e.loadGameStatsEvent.setRetCode(k.kSuccess),e.loadGameStatsEvent.setRetMsg("success"),e.loadGameStatsEvent.reportStats(),M.getEnvType()===M.kEnvTypeSim&&e._createSimInfo(e._rootElm),e._gameCompeleted=!0,e.hideLoading()},onGameStarted:function(){e._loadingFailed=!1},onGameLoadPercent:function(t){e.revceiveGameLoading=!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(En.DOWNLOAD_GAME_PACKAGE,80,i),e.loadGameStatsEvent.putStatsEvent(En.LOAD_GAME_RUNTIME,r,i)):e.loadGameStatsEvent.putStatsEvent(En.LOAD_GAME_PERCENT,r,i),e._loading(e._rootElm,_n.LOADING,k.kSuccess,r)}catch(t){u.w(e._kTag,"onGameLoadPercent json parse error",t)}},onGameASR:function(t){e._sudASR.handleGameASR(t)}})},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/DAI+AGKeCyM+ib5OCp1hlHtICDU15r3798/1bdv31SXLl1Sbdq0aRZuvgK0lzKb6EwdYNS+tL3v0qVLv8Vo8kllZeX0N95441HwuGfXXXedlw9Ovvt33313D/BrB00B+SFDhnQDZhA09zztEK+TMBBqPXSupm699+mcDQsWLFjWvn17R7AKcKx95Z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L5E/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=M.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,_n.START,k.kSuccess,10),M.getMGInfo(this._mgId,{onSuccess:function(i){if(t.loadGameStatsEvent.putStatsEvent(En.GET_MG_INFO,20,{}),t._loading(e,_n.START,k.kSuccess,20),1===i.h5engine){if(!i.h5url)return u.e(t._kTag,"gameInfo no h5url",""),t.loadGameStatsEvent.putStatsEvent(En.GET_MG_INFO,20,{desc:"gameInfo no h5url"}),t._loading(e,_n.LOADING,k.kFail,20),void t.loadGameStatsEvent.reportStats();var n=M.getAppId(),o=Date.now(),s="appId=".concat(n,"&userId=").concat(t._userId),a=h()(s),c="".concat(i.h5url,"?fstAppCtxId=").concat(t._fstAppCtxId,"&sid=").concat(a,"&t=").concat(o);r.getCfg().getTouchEnable()&&(c="".concat(c,"&touch=1")),t._iframeUrl=c,t._bigLoadingPicUrl=i.bigLoadingPic,t._initIframe(e),t._sudFSMMGStateHandler.setDynamicConfig(JSON.stringify(i.dynamic_config))}else u.e(t._kTag,"This game does not support web engine",i),t._loading(e,_n.START,k.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(En.GET_MG_INFO,20,{desc:"This game does not support web engine"}),t.loadGameStatsEvent.reportStats()},onFailure:function(i,n){t._loading(e,_n.LOADING,k.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,o){this._loadingFailed=i===k.kFail,this._gameCompeleted||(r.getCfg().getShowCustomLoading()?this.fsmMgOnGameLoadingProgress(t,i,n):this._createDefaultLoading(e,i,n,o))},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 o="".concat(this._kTag,"_wrap_parent_loading"),s="".concat(this._kTag,"_wrap_loading"),a="".concat(this._kTag,"_loading"),c="".concat(this._kTag,"_loading_text"),p="".concat(this._kTag,"_bgloading"),u=M.getLocalizationData(M.getSdkLocalizationCfg().load_tip_loading,M.getLanguage()),d=this,h=document.getElementById(o);if(h){var l=document.getElementById(a),v=document.getElementById(c),m=document.getElementById(s);if(n&&n(h),t===k.kFail){if(v){var g=M.getLocalizationData(M.getSdkLocalizationCfg().load_tip_fail,M.getLanguage());v.style.color="#ff1a1a",v&&(v.innerHTML="".concat(g," (").concat(i,"%)").concat(k.kFail))}return m&&this._createReloadButton(m),d.loadGameStatsEvent.setRetCode(k.kFail),d.loadGameStatsEvent.setRetMsg(JSON.stringify({tag:"_createDefaultLoading",loading:"failed"})),void d.loadGameStatsEvent.reportStats()}if(r.getCfg().getShowLoadingGameBg()&&this._bigLoadingPicUrl&&!document.getElementById(p)){var f=document.createElement("img");f.id=p,f.src=this._bigLoadingPicUrl,f.setAttribute("style","\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n "),h.append(f)}l&&(l.style.left=-(100-i)+"%"),v&&(v.innerHTML="".concat(u,"(").concat(i,"%)"))}else{var _=document.createDocumentFragment();h=document.createElement("div");var S=document.createElement("div"),y=document.createElement("img"),A=document.createElement("img"),w=(v=document.createElement("div"),document.createElement("div"));S.id=s,y.id=a,h.id=o,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 "),S.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(y),A.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAAC0CAMAAAAO0FvMAAAC/VBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzOjn34AAAAAAAAAAABLSELTzIeemna1spoAAADKw4Li26+bl3EAAADWzYjg15WcmXTZ0YlhX0hiX0kbGhkAAAABAQDWz4jYz4mdmXMZGRfg2ZYaGhkAAADa0YsAAAAAAADi3K3KwYIAAACblXGdl3MAAADe15UAAAAaGRgZGRjb04yhnXcDAwLCu4YxMTHSyovGv4i7tYOqpn/Z0Y/PyIqoo3u+uIfb0ou4tJ2vqYDe1o/Xz4uyrYTLw4izroC3soKjn3nVzo+fm3WloXlgX0iuqH5jYEnOx5LKw4qoo3tNS0MaGhrVzYsbGhnc1Zedm3YAAAAWFhUmJiXe2KYcHBsnJyXU0K3MyKrh2ZYuLSwMDAsODg3l4K/BvaK5t560sIlAQDkKCgqIg2PBvJnFwJW4tJEpKScuLSYSEhEYGBYQDw/IxJ/d2bGln3nIxKeUk302Ni4zMzI4ODU0My4gIB5MSz9va1Pl3qbj3Jzj3bFhX1Q9PDgtLSogIB0YGBYKCgmalmqRjGrW0ayjoY/Lx6SsqY0+Pjk/PTdEQjklJCFiX0tDQTWemW/k3Z/Y0qDRy5uHhXi3tJeNi3IVFBRUUUB1cld9eVzDvIHFwqezr5za1a3Gw6fEwqGZl4VZWE9QT0SMiGN9elu4sXnLxIamoHWwrH3SzaxwbmR9e25ua1s2NjUXFx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xswIDOZAEUegsDNcgDgKBZudGtWGTJNDCeAzS0HsQCDbJRJ+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(u,"(").concat(i,"%)"),v.id=c,y.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAABACAMAAAAZDo5fAAAB2lBMVEX0nTb/zSbxmjz/00b/1EfsjCLpfhPwlCf/0DbznDn6uyr5uiXvjivzmzPwky7skjHujCnsjSzsiSjuojrsiSbxlTD6yEjsmjXsiynwkS3tiifylzL5xEfuiyjvlDXzmDLlagDxli/sljL2uEHwpjrsmDT9z0v4wEXslDL3vUPxqz32ukL0s0D4wUbxqDz+0Uz1tUHlcAT8zUvrkS/snDjwkCz8y0rzsUDymDHldAfyrT/lfgv0nDXrgR3skC/sjy7rgx/qfxrpexXlbALshCHqfRjmgAzwlzjsnTjpeRPpeBHmgw3ncAjncgrrkhDldgjvoBLmbgXukjL5vhn4uBjshiPocwz1shbunRLtnjnyqBTtmRH+yxz2tRbxpBP8xRvrlhDnhw39yBv5vBjoiw30rhXpjw77wRnkewnlcgbuji3leAnkcgXodg/mbAPlbQLskC7ujy/wkSzyljDlbgPzqxTznDXshyTkbgPsmzflewrodQ7ukDDzqhXyrT7zsD78y0jleQnqjCXphR3kawDunirqkiXt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q+rMXd7tYf/JqxPzA+yCa3UTWnzyveUd/9tKuGeypCxo+rRntudeEz9af/WCnmVf0Zy/uduF9tmc0pYSu4zgtllyyZBytuBv/lEiuDlrsEPKal/rK2Wg1B77QIuGnrU+tyX5CvQU+j+jPfqoK/p9af/KarSG84Dr2OlUAPykY+eIQeEV/9vp0e1092tP2MS8wB74C85P1Zy8Z9eCz3cVe3NcRK8Y+40Ck0GDPcVfw+WCf7Rm9PKJTE71Q0hEV+4Bz3UU2ejXHXiowr3RxXBOfsU/OXb+t6UM1g+s7ajLlmtmtSRdTTfN0MdHo7tRf03yiieKaRJHUvya8f0avbS5htN/5aGy7XZtv6E+smWLYXzN1390mvVDzhTWjmv4ZVRo1zo0qRM7n1knZcc3+37S/puX1mmv/kYnOfH1N7Xc++vpXh3jQtbdm8Ix+WdZbm3Vdv47j3a7WlfxKZ26iGvZr4wDIc007gT3VrGEPyJR9Q1nFa5Z0rMn7sEN4n2BNAPbhmuyDNdnHa7Jv4JF8O/09Wc5/mpzCeHqOIUQ3je/+8TXPMe11v3PNt/9cbbcRwgWLMgAAAABJRU5ErkJggg==",y.setAttribute("style","position: absolute;top: 50%; transform: translateY(-50%); left: -".concat(100-i,"%;border-radius: 26px;")),y.style.width="100%",_.append(v),_.append(A),_.append(w),S.append(_),h.append(S),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=M.getLocalizationData(M.getSdkLocalizationCfg().load_reload,M.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,_n.START,k.kSuccess,i),t.loadGameStatsEvent.putStatsEvent(En.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(k.kFail),t.loadGameStatsEvent.setRetMsg("onerror"),t.loadGameStatsEvent.reportStats(),t._loading(e,_n.LOADING,k.kFail,85)},m({url:this._iframeUrl,fail:function(e){t.loadGameStatsEvent.setRetCode(k.kFail),t.loadGameStatsEvent.setRetMsg("iframe load failed"),t.loadGameStatsEvent.reportStats(),u.e(t._kTag,"iframe load failed",e)}}),e.appendChild(n),t.startDelayOnGameLoadCompletedTask(),this._window=n;var r=setInterval((function(){if(t.revceiveGameLoading)clearTimeout(r);else{var n=Math.floor(5*(Math.random()+1));(i+=n)>=85&&(i=85,clearTimeout(r)),t._loading(e,_n.LOADING,k.kSuccess,i)}}),100)}else u.w(this._kTag,"不存在挂载元素,请传入挂载元素","")},e.prototype._getFstAppCtxId=function(){return this._fstAppCtxId},e.prototype._onGameCustomCommand=function(e,t,i,n,r){if(this._window){var o=new Cn(this._window,e,n);this._sudFSMMGStateHandler.handleCmd(t,i,n,r,o)}else u.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*M.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 o=M.getLocalizationData(M.getSdkLocalizationCfg().load_tip_timeout,M.getLanguage()),s=document.createElement("div");s.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 "),s.innerHTML=o,r.append(s);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 p=document.createElement("button");p.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 u=M.getLocalizationData(M.getSdkLocalizationCfg().load_reload,M.getLanguage());p.onclick=function(){e.revceiveGameLoading=!1,e.loadGame(e._rootElm)},p.innerHTML=u,c.append(p);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=M.getLocalizationData(M.getSdkLocalizationCfg().load_tip_continue_wait,M.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(){return this._sudASR.stopASR(),this.notifyStateChange("a2ms-notify-destroy-game","{}",{onSuccess:function(){},onFailure:function(){}}),this.loadGameStatsEvent.setRetCode(k.DestroyGame),this.loadGameStatsEvent.setRetMsg("销毁游戏"),this.loadGameStatsEvent.reportStats(),!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&&wn.sendAppCustomCommandEvent(this._window,n,e,t)},e.prototype.reloadMG=function(){r.getCfg().getShowCustomLoading()&&!0===this._loadingFailed&&(this.loadGameStatsEvent.reportStats(),this.loadGame(this._rootElm))},e}(),kn=function(){function e(){}return e.create=function(e,t){return function(e,t){return new Rn(e,t)}(e,t)},e}(),Tn=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,u.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,u.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 C.kVersion},e.getVersionAlias=function(){return C.kVersionAlias},e.getSudCfg=function(){return r.getCfg()},e.initSDK=function(e,t,i,n,r){M.initSDK(e,t,i,n,r)},e.uninitSDK=function(e){M.uninitSDK(e)},e.getMGList=function(e){M.getMGList(e)},e.loadMG=function(e,t,i,n,r,o,s){if(null==e||null==t||null==i||null==n||null==o)return u.w(this.kTag,"Parameters cannot be null"),null;if(""===e||""===t||""===i||""===n)return u.w(this.kTag,"Parameters cannot be empty string","userId: ".concat(e),"roomId: ".concat(t),"code: ".concat(i),"mgId: ".concat(n)),null;R.setUserId(e),M.setLanguage(r);var a=this._idIDGenerator.genId().toString(),c=kn.create({parentElm:s,fstAppCtxId:a,userId:e,roomId:t,code:i,mgId:n,language:r},o);return this._ctxIdFSTAPPMap.set(a,c),this.isRegisterEvent||this._registerCustomCommandEvent(),c},e.destroyMG=function(t){if(null==t)return u.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){R.setUserId(e)},e.setLogLevel=function(e){u.setLogLevel(e)},e.setLogger=function(e){u.setLogger(e)},e.broadcastWindowOnMessage=function(t){if(t.msgTag===An){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):u.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 o,e._ctxIdFSTAPPMap=new Map,e.appSelfOnMeessage=[],e.isRegisterEvent=!1,e}();window.SudMGP=Tn})(),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 p(e,t,i,n,r,s,a){return o(t^i^n,e,t,r,s,a)}function u(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,g=271733878;for(i=0;i<e.length;i+=16)n=h,r=l,o=v,d=g,h=a(h,l,v,g,e[i],7,-680876936),g=a(g,h,l,v,e[i+1],12,-389564586),v=a(v,g,h,l,e[i+2],17,606105819),l=a(l,v,g,h,e[i+3],22,-1044525330),h=a(h,l,v,g,e[i+4],7,-176418897),g=a(g,h,l,v,e[i+5],12,1200080426),v=a(v,g,h,l,e[i+6],17,-1473231341),l=a(l,v,g,h,e[i+7],22,-45705983),h=a(h,l,v,g,e[i+8],7,1770035416),g=a(g,h,l,v,e[i+9],12,-1958414417),v=a(v,g,h,l,e[i+10],17,-42063),l=a(l,v,g,h,e[i+11],22,-1990404162),h=a(h,l,v,g,e[i+12],7,1804603682),g=a(g,h,l,v,e[i+13],12,-40341101),v=a(v,g,h,l,e[i+14],17,-1502002290),h=c(h,l=a(l,v,g,h,e[i+15],22,1236535329),v,g,e[i+1],5,-165796510),g=c(g,h,l,v,e[i+6],9,-1069501632),v=c(v,g,h,l,e[i+11],14,643717713),l=c(l,v,g,h,e[i],20,-373897302),h=c(h,l,v,g,e[i+5],5,-701558691),g=c(g,h,l,v,e[i+10],9,38016083),v=c(v,g,h,l,e[i+15],14,-660478335),l=c(l,v,g,h,e[i+4],20,-405537848),h=c(h,l,v,g,e[i+9],5,568446438),g=c(g,h,l,v,e[i+14],9,-1019803690),v=c(v,g,h,l,e[i+3],14,-187363961),l=c(l,v,g,h,e[i+8],20,1163531501),h=c(h,l,v,g,e[i+13],5,-1444681467),g=c(g,h,l,v,e[i+2],9,-51403784),v=c(v,g,h,l,e[i+7],14,1735328473),h=p(h,l=c(l,v,g,h,e[i+12],20,-1926607734),v,g,e[i+5],4,-378558),g=p(g,h,l,v,e[i+8],11,-2022574463),v=p(v,g,h,l,e[i+11],16,1839030562),l=p(l,v,g,h,e[i+14],23,-35309556),h=p(h,l,v,g,e[i+1],4,-1530992060),g=p(g,h,l,v,e[i+4],11,1272893353),v=p(v,g,h,l,e[i+7],16,-155497632),l=p(l,v,g,h,e[i+10],23,-1094730640),h=p(h,l,v,g,e[i+13],4,681279174),g=p(g,h,l,v,e[i],11,-358537222),v=p(v,g,h,l,e[i+3],16,-722521979),l=p(l,v,g,h,e[i+6],23,76029189),h=p(h,l,v,g,e[i+9],4,-640364487),g=p(g,h,l,v,e[i+12],11,-421815835),v=p(v,g,h,l,e[i+15],16,530742520),h=u(h,l=p(l,v,g,h,e[i+2],23,-995338651),v,g,e[i],6,-198630844),g=u(g,h,l,v,e[i+7],10,1126891415),v=u(v,g,h,l,e[i+14],15,-1416354905),l=u(l,v,g,h,e[i+5],21,-57434055),h=u(h,l,v,g,e[i+12],6,1700485571),g=u(g,h,l,v,e[i+3],10,-1894986606),v=u(v,g,h,l,e[i+10],15,-1051523),l=u(l,v,g,h,e[i+1],21,-2054922799),h=u(h,l,v,g,e[i+8],6,1873313359),g=u(g,h,l,v,e[i+15],10,-30611744),v=u(v,g,h,l,e[i+6],15,-1560198380),l=u(l,v,g,h,e[i+13],21,1309151649),h=u(h,l,v,g,e[i+4],6,-145523070),g=u(g,h,l,v,e[i+11],10,-1120210379),v=u(v,g,h,l,e[i+2],15,718787259),l=u(l,v,g,h,e[i+9],21,-343485551),h=s(h,n),l=s(l,r),v=s(v,o),g=s(g,d);return[h,l,v,g]}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 g(e){return unescape(encodeURIComponent(e))}function m(e){return function(e){return h(d(l(e),8*e.length))}(g(e))}function f(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))}(g(e),g(t))}function _(e,t,i){return t?i?f(t,e):v(f(t,e)):i?m(e):v(m(e))}void 0===(n=function(){return _}.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)}},p=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 p.init(t,e)}}),u=o.enc={},d=u.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 p.init(i,t/2)}},h=u.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 p.init(i,t)}},l=u.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 p.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,u=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-=u}return new p.init(i,u)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),g=(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 g.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,p=0;p<i;p++)a[p]^=1549556828,c[p]^=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,p,u;e.exports=(r=(n=u=i(249)).lib,s=r.WordArray,o=r.Hasher,a=n.algo,c=[],p=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],p=0;p<80;p++){if(p<16)c[p]=0|e[t+p];else{var u=c[p-3]^c[p-8]^c[p-14]^c[p-16];c[p]=u<<1|u>>>31}var d=(n<<5|n>>>27)+a+c[p];d+=p<20?1518500249+(r&s|~r&o):p<40?1859775393+(r^s^o):p<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(p),n.HmacSHA1=o._createHmacHelper(p),u.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:()=>Bn});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))},p=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}(),u=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 p,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(),p=t,u=new XMLHttpRequest;if(u=new XMLHttpRequest){if(u){if(u.addHeader=function(e,t){u.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);p+="?"+d}u.open(c,p,!0),u.setRequestHeader("content-type","application/json"),a&&a(u),"post"===c&&n?u.send(JSON.stringify(n)):u.send(),u.onreadystatechange=function(){var e=null==u?void 0:u.responseText;4===u.readyState&&(200===u.status?s&&s(e):o&&o(e))}}}else console.error("浏览器不支持XMLHttpRequest")},g=function(e){v(l({method:"get"},e))},m=new Uint8Array(16);function f(){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(m)}const _=/^(?:[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&&_.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||f)();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.1.1",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},E=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=R.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:R.getSpanId(this._mgId),request_id:this._request_id,user_id:R.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],p=a[1];r[c]=p}}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.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}(),R=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(E.kStatsEventGetFQSInfo,E.kStatsEventIdGetFQSInfo).set(E.kStatsEventGetSDKToken,E.kStatsEventIdGetSDKToken).set(E.kStatsEventGetMGInfo,E.kStatsEventIdGetMGInfo).set(E.kStatsEventGetAuthMGInfo,E.kStatsEventIdGetAuthMGInfo).set(E.kStatsEventGetMGList,E.kStatsEventIdGetMGList).set(E.kStatsEventDownloadGameRuntime,E.kStatsEventIdDownloadGameRuntime).set(E.kStatsEventDownloadGamePkg,E.kStatsEventIdDownloadGamePkg).set(E.kStatsEventLoadGameFinished,E.kStatsEventIdLoadGameFinished).set(E.kStatsEventMatchASRInfo,E.kStatsEventIdMatchASRInfo).set(E.kStatsEventLoadGameTimeout,E.kStatsEventIdLoadGameTimeout),e._statsSpanIdMap=new Map,e}(),k=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}(),T=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},P=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.reportFailedStatsCacheList=[],this.isInitSdkOk=!1,this.getSDKTokenUrl="",this.getMGListUrl="",this.getMGInfoUrl="",this.sdkToken="",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 E(E.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),R.report(i),e&&o&&r&&s&&(k.kSuccess===r?e.onSuccess(o):e.onFailure(r,s))},onFailure:function(t){var n=k.kFail,r=t.toString();i.setRetCode(n),i.setRetMsg(r),R.report(i),e.onFailure(n,r)}})}else e&&e.onFailure(-1,"请先调用initSDK成功")},e.prototype.getMGInfo=function(e,t){if(this.isInitSdkOk){var i=this.getCacheMGInfo(e),n=0;i||(n=i.clientVersion);var r={sdk_token:this.sdkToken,mg_id:Number(e),mg_id_str:e,client_version:n,platform:O.getPlatform()},s=this,o=new E(E.kStatsEventGetMGInfo);o.setMgId(e),this.doSudPost(this.getMGInfoUrl,r,o.getRequestId(),{onSuccess:function(i){var n=JSON.parse(i),r=n.ret_code,a=n.ret_msg,c=n.data.mg_info,p={mgId:c.mg_id_str,name:O.getLocalizationData(c.name,O.getLanguage()),version:c.version,orientation:c.orientation,screenMode:c.screen_mode,url:c.url,h5url:c.h5url,appID:c.game_app_id,hash:c.hash,h5engine:c.h5engine,engine:c.engine,bigLoadingPic:O.getLocalizationData(c.big_loading_pic,O.getLanguage()),clientVersion:c.client_version,dynamic_config:c.dynamic_config};if(n.data.log_id&&(p.log_id=n.data.log_id),o.setRetCode(r),o.setRetMsg(a),R.report(o),t)if(k.kSuccess===r)s.setCacheMGInfo(e,p),t.onSuccess(p);else{var u=s.getCacheMGInfo(e);u?t.onSuccess(u):t.onFailure(r,a)}},onFailure:function(i){var n=k.kFail,r=i.toString();if(o.setRetCode(n),o.setRetMsg(r),R.report(o),t){var a=s.getCacheMGInfo(e);a?t.onSuccess(a):t.onFailure(n,r)}}})}else t&&t.onFailure(-1,"请先调用initSDK成功")},e.prototype.reportStats=function(e){var t=this;if(!t.reportStatsUrl)return u.w(this.kTag,"reportStats reportStatsUrl is null or empty"),void this.reportFailedStatsCacheList.push(e);var i=[];i.push(e),this.reportFailedStatsCacheList.length>0&&(i=P(P([],T(i),!1),T(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!==k.kSuccess&&u.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,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,R.getUserId()),i.addHeader(e.kHeaderSudMGPSDKEtIsDynamic,!0)},e.prototype.doSudPost=function(e,t,i,n){var r=this;v(l({method:"post"},{data:t,url:e,beforeSend:function(e){r.addHeaders({xhr:e,sudSDKRequestId:i})},success:function(e){u.v(r.kTag,"post success res:",e),n.onSuccess(e)},fail:function(e){u.v(r.kTag,"post fail res:",e),n.onFailure(e)}}))},e.prototype.doSudGet=function(e,t,i){var n=this;g({url:e,beforeSend:function(e){n.addHeaders({xhr:e,sudSDKRequestId:t})},success:function(e){u.v(n.kTag,"get success res:",e),i.onSuccess(e)},fail:function(e){u.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){u.v(t.kTag,"upload success res:",e),o.onSuccess(e)},fail:function(e){u.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.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 E(E.kStatsEventGetFQSInfo),o=this;this.doSudGet(r,s.getRequestId(),{onSuccess:function(e){var t={ret_code:k.kSuccess,ret_msg:"success",url:JSON.parse(e).url};s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),R.report(s),o.handleGetFQSInfoResp(t,t.url,n)},onFailure:function(e){var t={ret_code:k.kFail,ret_msg:e.toString()};s.setResp(""),s.setRetCode(t.ret_code),s.setRetMsg(t.ret_msg),R.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 E(E.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),R.report(o)},onFailure:function(e){var t={ret_code:k.kFail,ret_msg:e.toString()};o.setRetCode(t.ret_code),o.setRetMsg(t.ret_msg),c.handleInitSDKCb(t,n),R.report(o)}})}},e.prototype.handleInitSDKCb=function(e,t){if(t)if(0===e.ret_code)this.sdkToken=e.data.sdk_token,this.getMGListUrl=e.data.sdk_api_cfg.mg_list_url,this.getMGInfoUrl=e.data.sdk_api_cfg.mg_info_url,this.reportStatsUrl=e.data.sdk_api_cfg.report_url,O.setGetSDKTokenResp(e),this.isInitSdkOk=!0,t.onSuccess();else{var i="getSDKToken fail appId=".concat(O.getAppId()," isTestEnv=",O.getIsTestEnv().toString()," ret_code=",e.ret_code.toString()," ",e.ret_msg);t.onFailure(e.ret_code,i)}},e.prototype.getCacheMGInfo=function(e){return this.mgIdGameInfoMap.get(e)||{}},e.prototype.setCacheMGInfo=function(e,t){this.mgIdGameInfoMap.set(e,t)},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.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.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)},z=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(u.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(){}}),u.d(e._TAG,"notifyAppCommonSelfTextHit: ",a.toJson()))},e._TAG="BaseRealSudASRImpl",e}();const N="OutputFormat",B="CancellationErrorCode",G="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,j,K,q,V,W,X,Q;!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 J{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 J;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"}(j||(j={})),function(e){e[e.Masked=0]="Masked",e[e.Removed=1]="Removed",e[e.Raw=2]="Raw"}(K||(K={})),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 J,this.speechRecognitionLanguage="en-US",this.outputFormat=j.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 j[this.privProperties.getProperty(N,void 0)]}set outputFormat(e){this.privProperties.setProperty(N,j[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(G,"{}"));i[e]=t,this.privProperties.setProperty(G,JSON.stringify(i))}setProfanity(e){this.privProperties.setProperty(H.SpeechServiceResponse_ProfanityOption,K[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"}(Q||(Q={}));const oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ae;const ce=new Uint8Array(16);function pe(){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 ue=[];for(let e=0;e<256;++e)ue.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||pe)();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(ue[e[t+0]]+ue[e[t+1]]+ue[e[t+2]]+ue[e[t+3]]+"-"+ue[e[t+4]]+ue[e[t+5]]+"-"+ue[e[t+6]]+ue[e[t+7]]+"-"+ue[e[t+8]]+ue[e[t+9]]+"-"+ue[e[t+10]]+ue[e[t+11]]+ue[e[t+12]]+ue[e[t+13]]+ue[e[t+14]]+ue[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 ge extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}class me{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=e}onEvent(e){if(this.isDisposed())throw new ge("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 fe,_e,Se;!function(e){e[e.None=0]="None",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(fe||(fe={}));class ye{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){}}))}(Se=_e||(_e={}))[Se.Debug=0]="Debug",Se[Se.Info=1]="Info",Se[Se.Warning=2]="Warning",Se[Se.Error=3]="Error",Se[Se.None=4]="None";class Ae{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 we extends Ae{constructor(e,t,i=_e.Info){super(e,i),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class Ce extends we{constructor(e){super("AudioSourceInitializingEvent",e)}}class Ie extends we{constructor(e){super("AudioSourceReadyEvent",e)}}class Ee extends we{constructor(e){super("AudioSourceOffEvent",e)}}class Re extends we{constructor(e,t){super("AudioSourceErrorEvent",e,_e.Error),this.privError=t}get error(){return this.privError}}class ke extends we{constructor(e,t,i){super(e,t),this.privAudioNodeId=i}get audioNodeId(){return this.privAudioNodeId}}class Te extends ke{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class Pe extends ke{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class De extends ke{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class Me extends ke{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 ge("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 ze{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 ye;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Le.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new ye;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 ge("Queue")}if(this.privIsDisposing)throw new ve("Queue disposing")}}var Ne;class Be{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||he(),this.privReaderQueue=new ze}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 ze)}throwIfClosed(){if(this.privIsWriteEnded)throw new ve("Stream closed")}}class Ge 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 me,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"}(Ne||(Ne={}));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=Ne.PCM){super();let r=!0;switch(n){case Ne.PCM:this.formatTag=1;break;case Ne.ALaw:this.formatTag=6;break;case Ne.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 je=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 Ke{constructor(e,t,i,n){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.privOutputChunkSize=Ke.AUDIOFORMAT.avgBytesPerSec/10,this.privId=i||he(),this.privEvents=new me,this.privMediaStream=n||null,this.privIsClosing=!1}get format(){return Promise.resolve(Ke.AUDIOFORMAT)}turnOn(){if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new ye;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 Ce(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Ie(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Ie(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Re(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 Re(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new Te(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new Pe(this.privId,e)),{detach:()=>je(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 je(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 Ee(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:Ke.AUDIOFORMAT.bitsPerSample,channelcount:Ke.AUDIOFORMAT.channels,connectivity:X.Unknown,manufacturer:"Speech SDK",model:e,samplerate:Ke.AUDIOFORMAT.samplesPerSec,type:Q.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 ye;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 je(this,void 0,void 0,(function*(){yield this.turnOn();const t=new Ge(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(Ke.AUDIOFORMAT.samplesPerSec))}destroyAudioContext(){return je(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())}))}}Ke.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 me,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 Re(e,"")),Promise.reject(e)}this.onEvent(new Ce(this.privId)),this.onEvent(new Ie(this.privId))}id(){return this.privId}attach(e){return qe(this,void 0,void 0,(function*(){this.onEvent(new Te(this.privId,e));const t=yield this.upload(e);return this.onEvent(new Pe(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 Ee(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:Q.File})))}readHeader(){const e=this.privSource.slice(0,4296),t=new ye,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 Ge(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,Qe,Je,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 me,this.privId=he(),this.privStream=new Ge(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 Ce(this.privId)),this.onEvent(new Ie(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){this.onEvent(new Te(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new Pe(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:Q.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 me,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 Ce(this.privId)),this.onEvent(new Ie(this.privId))}attach(e){return Ye(this,void 0,void 0,(function*(){return this.onEvent(new Te(this.privId,e)),yield this.turnOn(),this.onEvent(new Pe(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:Q.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 Ae{constructor(e,t,i=_e.Info){super(e,i),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class ot extends Ae{constructor(e,t,i=_e.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 pt extends ot{constructor(e,t,i){super("ConnectionClosedEvent",e,_e.Debug),this.privReason=i,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ut extends ot{constructor(e,t,i){super("ConnectionErrorEvent",e,_e.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,_e.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"}(Qe||(Qe={})),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"}(Je||(Je={}));class vt{constructor(e){this.privResult=e}get result(){return this.privResult}}class gt 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 mt{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 ft{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class _t{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 St 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?St.getDefaultOutputFormat():St.fromSpeechSynthesisOutputFormatString(St.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new St(Ne.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new St(Ne.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new St(Ne.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new St(Ne.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new St(Ne.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new St(Ne.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new St(Ne.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new St(Ne.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new St(Ne.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new St(Ne.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new St(Ne.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new St(Ne.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new St(Ne.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new St(Ne.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new St(Ne.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new St(Ne.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new St(Ne.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new St(Ne.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new St(Ne.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new St(Ne.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new St(Ne.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new St(Ne.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new St(Ne.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new St(Ne.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new St(Ne.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new St(Ne.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new St(Ne.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new St(Ne.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new St(Ne.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new St(Ne.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new St(Ne.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new St(Ne.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new St(Ne.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return St.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}}St.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 yt;class bt{constructor(){}static createPullStream(){return At.create()}}class At extends bt{static create(){return new wt}}class wt extends At{constructor(){super(),this.privId=he(),this.privStream=new Be}set format(e){null==e&&(this.privFormat=St.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 Ct extends bt{constructor(){super()}static create(e){return new It(e)}}class It extends Ct{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"}(yt||(yt={}));class Et{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new Et(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}class Rt extends Ae{constructor(e,t,i=_e.Info){super(e,i),this.privRequestId=t}get requestId(){return this.privRequestId}}class kt extends Rt{constructor(e,t,i){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=i}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Tt extends Rt{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class Pt extends Rt{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 ye,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 wt,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 kt(this.requestId,void 0,void 0===n?void 0:n.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Tt(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new Pt(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 ye}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===yt.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 zt 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 zt(e.messageType,t,i,n,e.body,r,s,e.id)}}var Nt=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 me,this.privServiceEvents=new me,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(Qe.Error,1007===t.statusCode?Je.BadRequestParameters:Je.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 Nt(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 Nt(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Nt(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 zt(i,e,this.privSynthesisTurn.requestId,n,t))}))}Speak(e,t,i,n,r,s){return Nt(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 gt(i,Ze.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(Qe.Error,Je.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,i,n){const r=new J;r.setProperty(B,Je[i]);const s=new gt(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 Nt(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=zt.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 gt(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=Et.fromJSON(i.textBody).Metadata;for(const t of e)switch(t.Type){case yt.WordBoundary:case yt.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(t);const e=new mt(t.Data.Offset,t.Data.Duration,t.Data.text.Text,t.Data.text.Length,t.Type===yt.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 yt.Bookmark:const i=new ft(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch(e){}break;case yt.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new _t(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case yt.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new gt(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 zt(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=>Nt(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 zt(We.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,i){return e.send(new zt(We.Text,"ssml",i,"application/ssml+xml",t))}fetchConnection(){return Nt(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 Nt(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 Gt extends Ae{constructor(e){super("BackgroundEvent",_e.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={[Ne.PCM]:"audio/wav",[Ne.MuLaw]:"audio/x-wav",[Ne.MP3]:"audio/mpeg",[Ne.OGG_OPUS]:"audio/ogg",[Ne.WEBM_OPUS]:"audio/webm; codecs=opus",[Ne.ALaw]:"audio/x-wav",[Ne.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!==Ne.PCM&&this.privFormat.formatTag!==Ne.MuLaw&&this.privFormat.formatTag!==Ne.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 ${Ne[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 Gt(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{Ue.instance.onEvent(new Gt(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{Ue.instance.onEvent(new Gt(e))}))):(console.warn(`Format ${Ne[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new wt,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 jt=i(592);class Kt{constructor(e){F.throwIfNullOrUndefined(jt.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=jt.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=jt.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),jt.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),jt.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 Ke(e))}static fromMicrophoneInput(e){const t=new ee(!0);return new Vt(new Ke(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 Ke(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 Kt(e))}static fromStreamOutput(e){if(e instanceof class{})return new Wt(new It(e));if(e instanceof Ct)return new Wt(e);if(e instanceof At)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),Qt=i.n(Xt);class Jt{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 Ae{constructor(e,t,i){super(e,t),this.privSignature=i}}class ti extends ei{constructor(e){super("OCSPMemoryCacheHitEvent",_e.Debug,e)}}class ii extends ei{constructor(e){super("OCSPCacheMissEvent",_e.Debug,e)}}class ni extends ei{constructor(e){super("OCSPDiskCacheHitEvent",_e.Debug,e)}}class ri extends ei{constructor(e){super("OCSPCacheUpdateNeededEvent",_e.Debug,e)}}class si extends ei{constructor(e){super("OCSPMemoryCacheStoreEvent",_e.Debug,e)}}class oi extends ei{constructor(e){super("OCSPDiskCacheStoreEvent",_e.Debug,e)}}class ai extends ei{constructor(e){super("OCSPCacheUpdateCompleteEvent",_e.Debug,e)}}class ci extends ei{constructor(){super("OCSPStapleReceivedEvent",_e.Debug,"")}}class pi extends ei{constructor(e,t){super("OCSPCacheEntryExpiredEvent",_e.Debug,e),this.privExpireTime=t}}class ui extends ei{constructor(e,t,i){super("OCSPCacheEntryNeedsRefreshEvent",_e.Debug,e),this.privExpireTime=i,this.privStartTime=t}}class di extends ei{constructor(e,t,i){super("OCSPCacheHitEvent",_e.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",_e.Debug,e),this.privError=t}}class li extends ei{constructor(e,t){super("OCSPCacheFetchErrorEvent",_e.Debug,e),this.privError=t}}class vi extends ei{constructor(e){super("OCSPResponseRetrievedEvent",_e.Debug,e)}}class gi extends ei{constructor(e,t){super("OCSPCacheUpdateErrorEvent",_e.Debug,e),this.privError=t}}var mi=i(108),fi=i.n(mi),_i=i(275),Si=i.n(_i),yi=i(505),bi=i.n(yi),Ai=i(146),wi=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 Ci{constructor(e){e&&(this.privProxyInfo=e),Ci.privDiskCache||(Ci.privDiskCache=new(Si())("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:"undefined"!=typeof process&&{npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"57f8adfe22dd74935d24f0e93abe9d863dfab56b",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/Users/reber/n/etc/npmignore",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",npm_config_shell:"/bin/bash",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.102.1",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",npm_package_devDependencies__types_crypto_js:"^4.2.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",N_PREFIX:"/Users/reber/n",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.kYsNNjvk2r/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",PATH:"/Users/reber/n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.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_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"D131E2AF-83CE-4E28-A26C-BE078AE45C3D",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"501",npm_config_node_version:"14.21.3",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",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_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",npm_package_dependencies_crypto_js:"^4.2.0",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",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_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.1",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_package_dependencies_jsencrypt:"^3.3.2",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.18 node/v14.21.3 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",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)",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a1",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.1"}.SPEECH_OCSP_CACHE_ROOT?{npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"57f8adfe22dd74935d24f0e93abe9d863dfab56b",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/Users/reber/n/etc/npmignore",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",npm_config_shell:"/bin/bash",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.102.1",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",npm_package_devDependencies__types_crypto_js:"^4.2.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",N_PREFIX:"/Users/reber/n",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.kYsNNjvk2r/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",PATH:"/Users/reber/n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.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_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"D131E2AF-83CE-4E28-A26C-BE078AE45C3D",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"501",npm_config_node_version:"14.21.3",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",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_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",npm_package_dependencies_crypto_js:"^4.2.0",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",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_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.1",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_package_dependencies_jsencrypt:"^3.3.2",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.18 node/v14.21.3 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",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)",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a1",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.1"}.SPEECH_OCSP_CACHE_ROOT:void 0}))}static forceReinitDiskCache(){Ci.privDiskCache=void 0,Ci.privMemCache={}}GetAgent(e){const t=new(fi().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 wi(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",(()=>wi(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 Ci.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 wi(this,void 0,void 0,(function*(){let n=Ci.privMemCache[e];if(n&&this.onEvent(new ti(e)),!n)try{const t=yield Ci.privDiskCache.get(e);t.isCached&&(Ci.onEvent(new ni(e)),Ci.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 pi(e,o)),n=null;else{const n=Math.min(864e5,(o-s)/2);o-(Date.now()+this.testTimeOffset)<n?(this.onEvent(new ui(e,s,o)),this.UpdateCache(t,i).catch((t=>{this.onEvent(new gi(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 wi(this,void 0,void 0,(function*(){let n=e;return n||(n=yield Ci.GetOCSPResponse(t,i)),new Promise(((r,s)=>{$t.verify({request:t,response:n},(o=>{o?(Ci.onEvent(new hi(t.id.toString("hex"),o)),e?this.VerifyOCSPResponse(null,t,i).then((()=>{r()}),(e=>{s(e)})):s(o)):(e||Ci.StoreCacheEntry(t.id.toString("hex"),n),r())}))}))}))}static UpdateCache(e,t){return wi(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=Ci.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"!=={npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"57f8adfe22dd74935d24f0e93abe9d863dfab56b",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/Users/reber/n/etc/npmignore",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",npm_config_shell:"/bin/bash",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.102.1",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",npm_package_devDependencies__types_crypto_js:"^4.2.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",N_PREFIX:"/Users/reber/n",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.kYsNNjvk2r/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",PATH:"/Users/reber/n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.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_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"D131E2AF-83CE-4E28-A26C-BE078AE45C3D",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"501",npm_config_node_version:"14.21.3",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",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_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",npm_package_dependencies_crypto_js:"^4.2.0",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",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_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.1",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_package_dependencies_jsencrypt:"^3.3.2",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.18 node/v14.21.3 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",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)",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a1",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.1"}.NODE_TLS_REJECT_UNAUTHORIZED&&"0"!=={npm_config_save_dev:"",npm_config_legacy_bundling:"",npm_config_dry_run:"",npm_config_viewer:"man",npm_config_only:"",npm_config_commit_hooks:"true",npm_config_browser:"",npm_package_gitHead:"57f8adfe22dd74935d24f0e93abe9d863dfab56b",WEBIDE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webide.vmoptions",PYCHARM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/pycharm.vmoptions",npm_config_also:"",npm_package_dependencies_microsoft_cognitiveservices_speech_sdk:"^1.27.0",npm_config_sign_git_commit:"",npm_config_rollback:"true",TERM_PROGRAM:"vscode",NODE:"/Users/reber/n/bin/node",npm_config_usage:"",npm_config_audit:"true",INIT_CWD:"/Users/reber/project/sudmgp-web-sdk",npm_package_devDependencies_typescript:"^4.7.4",npm_config_globalignorefile:"/Users/reber/n/etc/npmignore",SHELL:"/bin/bash",JETBRAINSCLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrainsclient.vmoptions",TERM:"xterm-256color",npm_config_shell:"/bin/bash",npm_config_maxsockets:"50",npm_config_init_author_url:"",npm_config_shrinkwrap:"true",npm_config_parseable:"",npm_config_metrics_registry:"https://registry.npmjs.org/",npm_package_devDependencies_webpack_merge:"^5.8.0",npm_package_devDependencies_eslint_config_standard:"^17.0.0",TMPDIR:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/",npm_config_timing:"",npm_config_init_license:"ISC",npm_package_scripts_lint:"eslint --ext .js,.ts,.tsx src/",npm_config_if_present:"",TERM_PROGRAM_VERSION:"1.102.1",npm_config_sign_git_tag:"",npm_config_init_author_email:"",npm_config_cache_max:"Infinity",npm_package_devDependencies__types_crypto_js:"^4.2.2",MallocNanoZone:"0",ORIGINAL_XDG_CURRENT_DESKTOP:"undefined",npm_config_preid:"",npm_config_long:"",npm_config_local_address:"",npm_config_git_tag_version:"true",npm_config_cert:"",npm_config_noproxy:"",npm_config_fetch_retries:"2",npm_config_home:"https://www.npmjs.org",npm_config_registry:"https://registry.npmjs.org/",npm_package_devDependencies_clean_webpack_plugin:"^4.0.0",npm_config_versions:"",npm_config_message:"%s",npm_config_key:"",npm_package_readmeFilename:"README.md",npm_package_devDependencies_ignore_loader:"^0.1.2",npm_package_devDependencies_webpack:"^5.73.0",npm_package_description:"",USER:"reber",N_PREFIX:"/Users/reber/n",npm_package_devDependencies_webpack_cli:"^4.10.0",npm_package_license:"ISC",COMMAND_MODE:"unix2003",npm_config_globalconfig:"/Users/reber/n/etc/npmrc",npm_config_prefer_online:"",npm_config_logs_max:"10",npm_config_always_auth:"",npm_package_devDependencies_webpack_dev_server:"^4.9.2",SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.kYsNNjvk2r/Listeners",PHPSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/phpstorm.vmoptions",npm_package_devDependencies_eslint:"^8.18.0",__CF_USER_TEXT_ENCODING:"0x1F5:0x19:0x34",npm_execpath:"/Users/reber/n/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_style:"",npm_config_cache_lock_retries:"10",npm_package_devDependencies__typescript_eslint_eslint_plugin:"^5.29.0",GOLAND_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/goland.vmoptions",npm_config_update_notifier:"true",npm_config_cafile:"",APPCODE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/appcode.vmoptions",npm_package_author_name:"SudMGP",npm_config_heading:"npm",npm_config_audit_level:"low",npm_package_devDependencies_copy_webpack_plugin:"^11.0.0",npm_config_searchlimit:"20",npm_config_read_only:"",npm_config_offline:"",npm_config_fetch_retry_mintimeout:"10000",npm_package_devDependencies__typescript_eslint_parser:"^5.29.0",npm_config_json:"",npm_config_access:"",npm_config_argv:'{"remain":[],"cooked":["run","build"],"original":["run","build"]}',npm_package_devDependencies_uuid:"^8.3.2",PATH:"/Users/reber/n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/reber/project/sudmgp-web-sdk/node_modules/.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_config_allow_same_version:"",npm_config_https_proxy:"",npm_config_engine_strict:"",npm_config_description:"true",_:"/Users/reber/project/sudmgp-web-sdk/node_modules/.bin/webpack",LaunchInstanceID:"D131E2AF-83CE-4E28-A26C-BE078AE45C3D",npm_config_userconfig:"/Users/reber/.npmrc",npm_config_init_module:"/Users/reber/.npm-init.js",__CFBundleIdentifier:"com.microsoft.VSCode",npm_config_cidr:"",PWD:"/Users/reber/project/sudmgp-web-sdk",npm_config_user:"501",npm_config_node_version:"14.21.3",npm_lifecycle_event:"build",npm_package_scripts_pub:"npm publish ./lib",npm_config_save:"true",npm_config_ignore_prepublish:"",npm_config_editor:"vi",npm_config_auth_type:"legacy",npm_package_keywords_0:"SudMGP",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_tag:"latest",npm_config_script_shell:"",npm_package_devDependencies_eslint_plugin_import:"^2.26.0",npm_package_devDependencies__babel_preset_env:"^7.18.6",npm_package_devDependencies__babel_plugin_transform_modules_umd:"^7.18.6",npm_package_keywords_1:"sdk",npm_config_progress:"true",npm_config_global:"",npm_config_before:"",npm_package_scripts_build:"webpack --mode production",npm_package_scripts_start:"webpack-dev-server --mode development --open --config webpack.config.demo.js",npm_config_searchstaleness:"900",npm_config_optional:"true",npm_config_ham_it_up:"",npm_config_electron_builder_binaries_mirror:"https://npmmirror.com/mirrors/electron-builder-binaries/",npm_package_devDependencies_ts_loader:"^9.3.0",npm_package_devDependencies_blueimp_md5:"^2.19.0",XPC_FLAGS:"0x0",VSCODE_GIT_ASKPASS_EXTRA_ARGS:"",npm_config_save_prod:"",npm_config_force:"",npm_config_bin_links:"true",npm_package_dependencies_crypto_js:"^4.2.0",WEBSTORM_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/webstorm.vmoptions",npm_config_searchopts:"",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_config_depth:"Infinity",npm_package_devDependencies_eslint_plugin_node:"^11.1.0",npm_package_main:"index.js",npm_config_sso_poll_frequency:"500",npm_config_rebuild_bundle:"true",npm_package_version:"1.1.1",XPC_SERVICE_NAME:"0",npm_config_unicode:"true",npm_package_devDependencies_eslint_plugin_n:"^15.2.3",HOME:"/Users/reber",STUDIO_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/studio.vmoptions",SHLVL:"3",npm_config_fetch_retry_maxtimeout:"60000",VSCODE_GIT_ASKPASS_MAIN:"/Users/reber/Desktop/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",npm_config_tag_version_prefix:"v",npm_config_strict_ssl:"true",npm_config_sso_type:"oauth",npm_config_scripts_prepend_node_path:"warn-only",npm_config_save_prefix:"^",npm_config_loglevel:"notice",npm_config_ca:"",npm_package_dependencies_jsencrypt:"^3.3.2",npm_config_save_exact:"",npm_config_group:"20",npm_config_fetch_retry_factor:"10",npm_config_dev:"",npm_config_version:"",npm_config_prefer_offline:"",npm_config_cache_lock_stale:"60000",npm_package_devDependencies_eslint_plugin_promise:"^6.0.0",npm_config_otp:"",npm_config_cache_min:"10",npm_config_searchexclude:"",npm_config_cache:"/Users/reber/.npm",npm_package_devDependencies_html_webpack_plugin:"^5.5.0",LOGNAME:"reber",npm_lifecycle_script:"webpack --mode production",npm_config_color:"true",npm_package_devDependencies__types_blueimp_md5:"^2.18.0",npm_config_package_lock:"true",npm_config_proxy:"",GATEWAY_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/gateway.vmoptions",VSCODE_GIT_IPC_HANDLE:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T/vscode-git-3ae67a71ea.sock",npm_config_package_lock_only:"",npm_config_fund:"true",npm_config_save_optional:"",npm_package_eslintConfig_extends_0:"prettier",DATAGRIP_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/datagrip.vmoptions",npm_config_ignore_scripts:"",npm_config_user_agent:"npm/6.14.18 node/v14.21.3 darwin x64",npm_package_devDependencies__types_uuid:"^8.3.4",npm_config_cache_lock_wait:"10000",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)",npm_config_production:"",npm_config_send_metrics:"",npm_config_save_bundle:"",npm_package_scripts_local:"webpack --mode development",JETBRAINS_CLIENT_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/jetbrains_client.vmoptions",RIDER_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rider.vmoptions",npm_config_umask:"0022",npm_config_node_options:"",npm_config_init_version:"1.0.0",RUBYMINE_VM_OPTIONS:"/Users/reber/Downloads/jetbra/vmoptions/rubymine.vmoptions",npm_config_init_author_name:"",npm_config_git:"git",npm_config_scope:"",SECURITYSESSIONID:"186a1",npm_config_unsafe_perm:"true",npm_config_tmp:"/var/folders/_w/qtxjdmx55w94xl1zjjgprk_80000gn/T",npm_config_onload_script:"",npm_package_scripts_check:"npm pack",npm_node_execpath:"/Users/reber/n/bin/node",npm_config_prefix:"/Users/reber/n",npm_config_link:"",npm_config_format_package_lock:"true",COLORTERM:"truecolor",SDK_VERSION:"1.1.1"}.SPEECH_CONDUCT_OCSP_CHECK&&t.secureEndpoint;let n;if(t=Object.assign(Object.assign({},t),{requestOCSP:!Ci.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const i=Ci.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(Ai.connect(t));return i?Ci.OCSPCheck(n,this.privProxyInfo):n}}Ci.testTimeOffset=0,Ci.forceDisableOCSPStapling=!1,Ci.privMemCache={};var 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 Ei{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 me,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 ye,this.privCertificateValidatedDeferral=new ye,this.privConnectionState=Xe.Connecting;try{if("undefined"==typeof WebSocket||Ei.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new Ci(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(Qt())(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new ze,this.privDisconnectDeferral=new ye,this.privSendMessageQueue=new ze,this.processSendQueue().catch((e=>{Ue.instance.onEvent(new Gt(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new Jt(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 Jt(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new ut(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 Jt(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Xe.Disconnected,this.privWebsocketClient=null,this.onEvent(new pt(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{Ue.instance.onEvent(new Gt(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===Xe.Connected){const i=new ye;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 ye,i=new ye;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 Ii(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 Ii(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}}Ei.forceNpmWebSocket=!1;var Ri;class ki{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 Ei(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 Ti{constructor(e,t,i,n){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=i,this.privProxyPassword=n}static fromParameters(e){return new Ti(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 Pi{}Pi.BotId="botid",Pi.CustomSpeechDeploymentId="cid",Pi.CustomVoiceDeploymentId="deploymentId",Pi.EnableAudioLogging="storeAudio",Pi.EnableLanguageId="lidEnabled",Pi.EnableWordLevelTimestamps="wordLevelTimestamps",Pi.EndSilenceTimeoutMs="endSilenceTimeoutMs",Pi.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",Pi.Format="format",Pi.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",Pi.Language="language",Pi.Profanity="profanity",Pi.RequestBotStatusMessages="enableBotMessageStatus",Pi.StableIntermediateThreshold="stableIntermediateThreshold",Pi.StableTranslation="stableTranslation",Pi.TestHooks="testhooks",Pi.Postprocessing="postprocessing",Pi.CtsMeetingId="meetingId",Pi.CtsDeviceId="deviceId",Pi.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,Pi.SegmentationSilenceTimeoutMs],[H.SpeechServiceConnection_EnableAudioLogging,Pi.EnableAudioLogging],[H.SpeechServiceConnection_EndSilenceTimeoutMs,Pi.EndSilenceTimeoutMs],[H.SpeechServiceConnection_InitialSilenceTimeoutMs,Pi.InitialSilenceTimeoutMs],[H.SpeechServiceResponse_PostProcessingOption,Pi.Postprocessing],[H.SpeechServiceResponse_ProfanityOption,Pi.Profanity],[H.SpeechServiceResponse_RequestWordLevelTimestamps,Pi.EnableWordLevelTimestamps],[H.SpeechServiceResponse_StablePartialResultThreshold,Pi.StableIntermediateThreshold]]).forEach(((n,r)=>{this.setUrlParameter(r,n,e,t,i)}));const n=JSON.parse(e.parameters.getProperty(G,"{}"));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 ye;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 ye;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),p=e.parameters.getProperty(H.SpeechServiceConnection_RecoLanguage,void 0);if(c?n&&-1!==n.search(Pi.CustomSpeechDeploymentId)||(a[Pi.CustomSpeechDeploymentId]=c):p&&(n&&-1!==n.search(Pi.Language)||(a[Pi.Language]=p)),n&&-1!==n.search(Pi.Format)||(a[Pi.Format]=e.parameters.getProperty(N,j[j.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(a[Pi.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 u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[xt.ConnectionId]=i;const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false"),h=new ki(n,a,u,new Mi,Ti.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,p){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=p}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,p,u){super(e,t,i,n,r,s,o,c,p,u),this.privSpeakerId=a}get speakerId(){return this.privSpeakerId}}class xi{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class zi extends xi{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class Ni extends zi{constructor(e,t,i){super(t,i),this.privResult=e}get result(){return this.privResult}}class Bi extends zi{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 Gi 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 ji extends Ae{constructor(e,t,i,n=_e.Info){super(e,n),this.privRequestId=t,this.privSessionId=i}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class Ki extends ji{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 ji{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 ji{constructor(e,t,i){super("ConnectingToServiceEvent",e,i),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class Wi extends ji{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"}(Ri||(Ri={}));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 Ki&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof Te&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Pe&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Re&&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 Qi=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 Ji{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 ye,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 Ki(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t){return Qi(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 Qi(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return Qi(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 Qi(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 ye}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 Qi(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 Qi(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 Qi(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return Qi(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 Ji(this.privAudioSource.id()),this.privConnectionEvents=new me,this.privServiceEvents=new me,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(Qe.Error,1007===t.statusCode?Je.BadRequestParameters:Je.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===Q.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(Qe.Error,Je.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(Qe.Error,Je.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(Qe.Error,Je.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 zt(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 zt(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=zt.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 zi(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 zi(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(Qe.EndOfStream,Je.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 zt(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 zt(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 zt(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,p;if(!a||a.isEnd?(c=null,p=0):(c=a.buffer,this.privRequestSession.onAudioSent(c.byteLength),p=r>=this.privRequestSession.bytesSent?0:Math.max(0,i-Date.now())),0!==p&&(yield this.delay(p)),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 zt(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 zt(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=Qe.EndOfStream;switch(e){case tn.Success:case tn.EndOfDictation:case tn.NoMatch:t=Qe.EndOfStream;break;case tn.InitialSilenceTimeout:case tn.BabbleTimeout:case tn.Error:case tn.BadRequest:case tn.Forbidden:default:t=Qe.Error}return t}static implTranslateCancelErrorCode(e){let t=Je.NoError;switch(e){case tn.Error:t=Je.ServiceError;break;case tn.TooManyRequests:t=Je.TooManyRequests;break;case tn.BadRequest:t=Je.BadRequestParameters;break;case tn.Forbidden:t=Je.Forbidden;break;default:t=Je.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case Je.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case Je.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case Je.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 pn 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 J;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 Ni(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(N)===j[j.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 Ni(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 J;if(s.setProperty(B,Je[n]),this.privSpeechRecognizer.canceled){const t=new Gi(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 un{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 un(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 un(xt.Authorization,void 0===e?void 0:hn.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new un(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 ye;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 gn 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 gn(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(N,j[j.Simple])===j[j.Simple]?j.Simple:j.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 pn(e,t,i,n,this)}}var mn,fn=function(){function e(t,i,n){this.isRunning=!1,this.baseSudASR=new z(n,this),u.d(e._TAG,"speechRegion:",i),this.speechConfig=Z.fromSubscription(t,i)}return e.prototype.startASR=function(t){var i=this;if(u.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 gn(this.speechConfig,n),this.reco.recognized=function(t,n){if(u.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(){u.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"}(mn||(mn={}));var _n,Sn=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(u.d(e._TAG,"asrType:"+i),u.d(e._TAG,"asrLoadList:"+O.getAsrLoadList()),i===mn.AZURE){var n=O.getSdkRtssCfg();if(null!=n&&null!=n.microsoft_rtss_cfg){var r=n.microsoft_rtss_cfg;return new fn(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 mn.AZURE:return O.getAzureASRTextLanguageList();case mn.SHU_MEI:default:return[]}},e.getASRNumberLanguageList=function(){switch(this.getUseASRType()){case mn.AZURE:return O.getAzureASRNumberLanguageList();case mn.SHU_MEI:default:return[]}},e.getUseASRType=function(){var e=O.getAsrLoadList();if(!e.length)return mn.UNDEFINED;for(var t=0;t<e.length;t++){var i=e[t];if(i===mn.AZURE)return i;if(i===mn.SHU_MEI)return i}return mn.UNDEFINED},e._TAG="ProxyASRImpl",e}(),yn=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){}},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):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(k.toJson(k.kFail,"param invalid cmd is not game or player")):r.fail(k.toJson(k.kFail,"param invalid param is null")):r.fail(k.toJson(k.kFail,"param invalid cmd is null"))},e.prototype.handleSetDebug=function(e,t,i){u.d(this.kTag,"handleSetDebug {0} = {1}",t,i),e.success(k.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(k.kSuccessJson)},e.prototype.handleGetNetStatus=function(e,t,i){u.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){u.d(this.kTag,"handleNotifyGameLoadPercent {0} = {1}",t,i),null!=this._GameCustomStateListener&&this._GameCustomStateListener.onGameLoadPercent(i),e.success(k.kSuccessJson)},e.prototype.handleVibrate=function(e,t,i){u.d(this.kTag,"handleGetNetStatus {0} = {1}",t,i),e.success(k.kSuccessJson)},e.prototype.handleGetSDKInfo=function(e,t,i){var n={ret_code:k.kSuccess,ret_msg:"success",env_type:O.getEnvType(),language:O.getLanguage(),wordLanguage:O.getLanguage(),asr_text_language_list:Sn.getASRTextLanguageList(),asr_number_language_list:Sn.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,u.d(this.kTag,"getSDKInfo",n),e.success(JSON.stringify(n))},e.prototype.handleGetState=function(e,t,i){u.d(this.kTag,"handleGetState {0} = {1}",t,i),e.success("{}")},e.prototype.handleNotifyGameLoadStarted=function(e,t,i){var n;u.d(this.kTag,"onGameLoadStarted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadStarted(),null===(n=this._fsmMG)||void 0===n||n.onGameLoadingProgress(2,k.kSuccess,99),e.success(k.kSuccessJson)},e.prototype.handleNotifyGameLoadCompleted=function(e,t,i){u.d(this.kTag,"onGameLoadCompleted {0} = {1}",t,i),this._GameCustomStateListener.onGameLoadCompleted(),e.success(k.kSuccessJson)},e.prototype.handleNotifyGameStarted=function(e,t,i){var n,r;u.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(k.kSuccessJson)},e.prototype.handleLogin=function(e,t,i){u.d(this.kTag,"handleLogin {0} = {1}",t,i);var n={ret_code:k.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;u.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}();!function(e){e[e.START=1]="START",e[e.LOADING=2]="LOADING",e[e.END=3]="END"}(_n||(_n={}));var bn="SudMGP",An=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}(),wn=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||(An.sendGameCustomCommandCallback(this._window,this._ctxId,!0,this._state,e),this._isCalled=!0)},e.prototype.fail=function(e){this._isCalled||(An.sendGameCustomCommandCallback(this._window,this._ctxId,!1,this._state,e),this._isCalled=!0)},e}(),Cn=function(){function e(){}return e.create=function(e,t){var i={iSudFSTAPP:t,language:e.language,supportTextLanguageList:[],supportNumberLanguageList:[]};return new Sn(i)},e}(),In=function(){function e(){this._statsEvent=null,this.steps=[],this.loadTimestamp=Date.now()}return e.prototype.startLoad=function(e){this._statsEvent=new E(E.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()!==E.kStatsEventLoadGameFinished&&(this._statsEvent.setEvent(E.kStatsEventLoadGameFinished),this._statsEvent.buildNewRequestId()),this._statsEvent.putExtra("loadGame",this.steps),R.report(this._statsEvent),this._statsEvent=null)},e.prototype.reportTimeoutEvent=function(e){if(null!==this._statsEvent){if(80===e)this._statsEvent.setRetCode(k.ENGINE_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(k.ENGINE_LOAD_TIMEOUT),this._statsEvent.setRetMsg("引擎加载超时");else{if(!(e>=85&&e<100))return;this._statsEvent.setRetCode(k.GAME_LOAD_TIMEOUT),this._statsEvent.setTimeout_code(k.GAME_LOAD_TIMEOUT),this._statsEvent.setRetMsg("游戏加载超时")}this._statsEvent.setEvent(E.kStatsEventLoadGameTimeout),this._statsEvent.putExtra("loadGame",this.steps),R.report(this._statsEvent),this._statsEvent.setEvent(E.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}(),En=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}(),Rn=i(398),kn=i.n(Rn),Tn=i(465),Pn=i.n(Tn),Dn=function(){function e(){}return e.buildSignature=function(e,t){var i=e+"&"+t+"&"+O.getPlatform()+"&"+O.getBundleID();return kn()(i,O.getAppKey()).toString(Pn())},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),u.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}(),Mn=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())}))},On=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])}}},Ln=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 Mn(this,void 0,void 0,(function(){return On(this,(function(e){return[2,new Blob(this._logData,{type:"application/octet-stream"})]}))}))},e.uploadLog=function(e){return Mn(this,void 0,void 0,(function(){var t,i,n;return On(this,(function(r){switch(r.label){case 0:return[4,this.getLogFile()];case 1:return t=r.sent(),i=O.getAppId(),n=h()(A()),Dn.uploadSdkLog({requestId:n,file:t,appId:i,mgId:e}),[2]}}))}))},e.KTag="ReportLogTask",e._logData=[],e}(),xn=function(){function e(e,t){this._kTag="H5SudFSTAPPImpl",this.isCanReportTimeoutEvent=!0,this._gameLoadPercent=0,this._startDelayOnGameLoadCompletedTimer=null,this.loadGameStatsEvent=new In;var i=e.parentElm,n=e.fstAppCtxId,r=e.userId,o=e.roomId,a=e.code,c=e.mgId,p=e.language;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.revceiveGameLoading=!1,this._ctxIdListenerNotifyStateChangeMap=new Map,this._idIDGenerator=new s,this._sudFSMMGStateHandler=function(e,t,i,n,r){return new yn(e,t,i,n,r)}(t,r,o,a,c),this._sudASR=Cn.create({language:p},this),R.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,_n.END,k.kSuccess,100),e.loadGameStatsEvent.setRetCode(k.kSuccess),e.loadGameStatsEvent.setRetMsg("success"),e.loadGameStatsEvent.reportStats(),O.getEnvType()===O.kEnvTypeSim&&e._createSimInfo(e._rootElm),e._gameCompeleted=!0,e.hideLoading(),Dn.getLogId()&&Ln.uploadLog(e._mgId)},onGameStarted:function(){e._loadingFailed=!1},onGameLoadPercent:function(t){e.revceiveGameLoading=!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(En.DOWNLOAD_GAME_PACKAGE,80,i),e.loadGameStatsEvent.putStatsEvent(En.LOAD_GAME_RUNTIME,r,i)):e.loadGameStatsEvent.putStatsEvent(En.LOAD_GAME_PERCENT,r,i),e._loading(e._rootElm,_n.LOADING,k.kSuccess,r)}catch(t){u.w(e._kTag,"onGameLoadPercent json parse error",t)}},onGameASR:function(t){e._sudASR.handleGameASR(t)}})},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/DAI+AGKeCyM+ib5OCp1hlHtICDU15r3798/1bdv31SXLl1Sbdq0aRZuvgK0lzKb6EwdYNS+tL3v0qVLv8Vo8kllZeX0N95441HwuGfXXXedlw9Ovvt33313D/BrB00B+SFDhnQ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hwGQhTz4LhJ2L9t2J1s8q//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,_n.START,k.kSuccess,10),O.getMGInfo(this._mgId,{onSuccess:function(i){if(t.loadGameStatsEvent.putStatsEvent(En.GET_MG_INFO,20,{}),t._loading(e,_n.START,k.kSuccess,20),1===i.h5engine){if(!i.h5url)return u.e(t._kTag,"gameInfo no h5url",""),t.loadGameStatsEvent.putStatsEvent(En.GET_MG_INFO,20,{desc:"gameInfo no h5url"}),t._loading(e,_n.LOADING,k.kFail,20),void t.loadGameStatsEvent.reportStats();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 p=r.getCfg().getAdvancedConfigMap().get("enable_debug_game_log");(p||i.log_id)&&(i.log_id&&Dn.setLogId(i.log_id),t._sudFSMMGStateHandler.setMgLogListener((function(e,n){i.log_id&&Ln.collectLog(n),"gameError"===e&&i.log_id&&Ln.uploadLog(t._mgId),p&&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 u.e(t._kTag,"This game does not support web engine",i),t._loading(e,_n.START,k.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(En.GET_MG_INFO,20,{desc:"This game does not support web engine"}),t.loadGameStatsEvent.reportStats()},onFailure:function(i,n){t._loading(e,_n.LOADING,k.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===k.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"),p="".concat(this._kTag,"_bgloading"),u=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),g=document.getElementById(o);if(n&&n(h),t===k.kFail){if(v){var m=O.getLocalizationData(O.getSdkLocalizationCfg().load_tip_fail,O.getLanguage());v.style.color="#ff1a1a",v&&(v.innerHTML="".concat(m," (").concat(i,"%)").concat(k.kFail))}return g&&this._createReloadButton(g),d.loadGameStatsEvent.setRetCode(k.kFail),d.loadGameStatsEvent.setRetMsg(JSON.stringify({tag:"_createDefaultLoading",loading:"failed"})),void d.loadGameStatsEvent.reportStats()}if(r.getCfg().getShowLoadingGameBg()&&this._bigLoadingPicUrl&&!document.getElementById(p)){var f=document.createElement("img");f.id=p,f.src=this._bigLoadingPicUrl,f.setAttribute("style","\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n "),h.append(f)}l&&(l.style.left=-(100-i)+"%"),v&&(v.innerHTML="".concat(u,"(").concat(i,"%)"))}else{var _=document.createDocumentFragment();h=document.createElement("div");var S=document.createElement("div"),y=document.createElement("img"),b=document.createElement("img"),A=(v=document.createElement("div"),document.createElement("div"));S.id=o,y.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 "),S.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 "),A.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 "),A.append(y),b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwwAAAC0CAMAAAAO0FvMAAAC/VBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzOjn34AAAAAAAAAAABLSELTzIeemna1spoAAADKw4Li26+bl3EAAADWzYjg15WcmXTZ0YlhX0hiX0kbGhkAAAABAQDWz4jYz4mdmXMZGRfg2ZYaGhkAAADa0YsAAAAAAADi3K3KwYIAAACblXGdl3MAAADe15UAAAAaGRgZGRjb04yhnXcDAwLCu4YxMTHSyovGv4i7tYOqpn/Z0Y/PyIqoo3u+uIfb0ou4tJ2vqYDe1o/Xz4uyrYTLw4izroC3soKjn3nVzo+fm3WloXlgX0iuqH5jYEnOx5LKw4qoo3tNS0MaGhrVzYsbGhnc1Zedm3YAAAAWFhUmJiXe2KYcHBsnJyXU0K3MyKrh2ZYuLSwMDAsODg3l4K/BvaK5t560sIlAQDkKCgqIg2PBvJnFwJW4tJEpKScuLSYSEhEYGBYQDw/IxJ/d2bGln3nIxKeUk302Ni4zMz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1yFXQsdBaIoXwbxCHnQR4IIkw4N6gXOiAEbEKTkMeCLFQOgzj0HqAhIgd6AAiICBJEES6cK+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(u,"(").concat(i,"%)"),v.id=c,y.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAABACAMAAAAZDo5fAAAB2lBMVEX0nTb/zSbxmjz/00b/1EfsjCLpfhPwlCf/0DbznDn6uyr5uiXvjivzmzPwky7skjHujCnsjSzsiSjuojrsiSbxlTD6yEjsmjXsiynwkS3tiifylzL5xEfuiyjvlDXzmDLlagDxli/sljL2uEHwpjrsmDT9z0v4wEXslDL3vUPxqz32ukL0s0D4wUbxqDz+0Uz1tUHlcAT8zUvrkS/snDjwkCz8y0rzsUDymDHldAfyrT/lfgv0nDXrgR3skC/sjy7rgx/qfxrpexXlbALshCHqfRjmgAzwlz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LEixRVjwkX+hIrzWvX6GOmFQdT/+6U6z2HujDQeuQsYQgv1xNx5LVUdV/P14byL6iJM6ODfY++SlPfLDJPv52c13RchTzU98Sp5q4n3yMlNNGPKezp+KkB/MGBUw8lwz2PNOa0KyvzdrHu8T/+hHXnxN3ocnsuth2IdrwmzP6LgnlZcsc8l7fZUMaf9Ay6v898hcA7+MWtgW8sPss9T3D72nMiaY1suChpYB/dmr+0Z5RMj7msUq+rMXd7tYf/JqxPzA+yCa3UTWnzyveUd/9tKuGeypCxo+rRntudeEz9af/WCnmVf0Zy/uduF9tmc0pYSu4zgtllyyZBytuBv/lEiuDlrsEPKal/rK2Wg1B77QIuGnrU+tyX5CvQU+j+jPfqoK/p9af/KarSG84Dr2OlUAPykY+eIQeEV/9vp0e1092tP2MS8wB74C85P1Zy8Z9eCz3cVe3NcRK8Y+40Ck0GDPcVfw+WCf7Rm9PKJTE71Q0hEV+4Bz3UU2ejXHXiowr3RxXBOfsU/OXb+t6UM1g+s7ajLlmtmtSRdTTfN0MdHo7tRf03yiieKaRJHUvya8f0avbS5htN/5aGy7XZtv6E+smWLYXzN1390mvVDzhTWjmv4ZVRo1zo0qRM7n1knZcc3+37S/puX1mmv/kYnOfH1N7Xc++vpXh3jQtbdm8Ix+WdZbm3Vdv47j3a7WlfxKZ26iGvZr4wDIc007gT3VrGEPyJR9Q1nFa5Z0rMn7sEN4n2BNAPbhmuyDNdnHa7Jv4JF8O/09Wc5/mpzCeHqOIUQ3je/+8TXPMe11v3PNt/9cbbcRwgWLMgAAAABJRU5ErkJggg==",y.setAttribute("style","position: absolute;top: 50%; transform: translateY(-50%); left: -".concat(100-i,"%;border-radius: 26px;")),y.style.width="100%",_.append(v),_.append(b),_.append(A),S.append(_),h.append(S),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,_n.START,k.kSuccess,i),t.loadGameStatsEvent.putStatsEvent(En.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(k.kFail),t.loadGameStatsEvent.setRetMsg("onerror"),t.loadGameStatsEvent.reportStats(),t._loading(e,_n.LOADING,k.kFail,85)},g({url:this._iframeUrl,fail:function(e){t.loadGameStatsEvent.setRetCode(k.kFail),t.loadGameStatsEvent.setRetMsg("iframe load failed"),t.loadGameStatsEvent.reportStats(),u.e(t._kTag,"iframe load failed",e)}}),e.appendChild(n),t.startDelayOnGameLoadCompletedTask(),this._window=n;var r=setInterval((function(){if(t.revceiveGameLoading)clearTimeout(r);else{var n=Math.floor(5*(Math.random()+1));(i+=n)>=85&&(i=85,clearTimeout(r)),t._loading(e,_n.LOADING,k.kSuccess,i)}}),100)}else u.w(this._kTag,"不存在挂载元素,请传入挂载元素","")},e.prototype._getFstAppCtxId=function(){return this._fstAppCtxId},e.prototype._onGameCustomCommand=function(e,t,i,n,r){if(this._window){var s=new wn(this._window,e,n);this._sudFSMMGStateHandler.handleCmd(t,i,n,r,s)}else u.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 p=document.createElement("button");p.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 u=O.getLocalizationData(O.getSdkLocalizationCfg().load_reload,O.getLanguage());p.onclick=function(){e.revceiveGameLoading=!1,e.loadGame(e._rootElm)},p.innerHTML=u,c.append(p);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(){return this._sudASR.stopASR(),this.notifyStateChange("a2ms-notify-destroy-game","{}",{onSuccess:function(){},onFailure:function(){}}),this.loadGameStatsEvent.setRetCode(k.DestroyGame),this.loadGameStatsEvent.setRetMsg("销毁游戏"),this.loadGameStatsEvent.reportStats(),!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&&An.sendAppCustomCommandEvent(this._window,n,e,t)},e.prototype.reloadMG=function(){r.getCfg().getShowCustomLoading()&&!0===this._loadingFailed&&(this.loadGameStatsEvent.reportStats(),this.loadGame(this._rootElm))},e}(),zn=function(){function e(){}return e.create=function(e,t){return function(e,t){return new xn(e,t)}(e,t)},e}(),Nn=function(){function e(){this.kTag="Detector"}return e.prototype.isWebGLAvailable=function(){var e=!0;try{var t=document.createElement("canvas"),i={alpha:!0,antialias:!0,depth:!0,stencil:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};return t.getContext("webgl",i)||t.getContext("experimental-webgl",i)?(e=!0,u.d(this.kTag,"WebGL is supported",e)):(e=!1,u.e(this.kTag,"This device does not support WebGL.",e)),e}catch(t){return e=!1,u.e(this.kTag,"isWebGLAvailable detect fail",t),e}},e}(),Bn=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,u.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,u.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){u.i(this.kTag,"initSDK Parameters:","appId: ".concat(e),"appKey: ".concat(t),"bundleId: ".concat(i),"isTestEnv: ".concat(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(u.i(this.kTag,"loadMG Parameters","userId: ",e,"roomId: ",t,"mgId: ",n,"code: ",i),null==e||null==t||null==i||null==n||null==s)return u.w(this.kTag,"Parameters cannot be null"),null;if(""===e||""===t||""===i||""===n)return u.w(this.kTag,"Parameters cannot be empty string","userId: ".concat(e),"roomId: ".concat(t),"code: ".concat(i),"mgId: ".concat(n)),null;R.setUserId(e),O.setLanguage(r);var a=this._idIDGenerator.genId().toString(),c=zn.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 u.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){R.setUserId(e)},e.setLogLevel=function(e){u.setLogLevel(e)},e.setLogger=function(e){u.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):u.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 Nn,e._ctxIdFSTAPPMap=new Map,e.appSelfOnMeessage=[],e.isRegisterEvent=!1,e}();window.SudMGP=Bn})(),n})()));
|