@genpact/genome.mfe.mgtwin-app 1.1.348-alpha → 1.1.349-alpha
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/dist/{AssessmentAMA-3566d155.mjs → AssessmentAMA-a639d05a.mjs} +4 -4
- package/dist/{AssessmentSimulation-51d07c06.mjs → AssessmentSimulation-bee31b95.mjs} +7 -7
- package/dist/{EditSkillAdminData-73c08030.mjs → EditSkillAdminData-9ee33207.mjs} +2 -2
- package/dist/{EditSkillData-192a91df.mjs → EditSkillData-db3f1cf1.mjs} +2 -2
- package/dist/{HomeView-865e317d.mjs → HomeView-aa7907fd.mjs} +5 -5
- package/dist/{Loading-07ce3b1b.mjs → Loading-98ae0af9.mjs} +1 -1
- package/dist/{LoadingSimulation-dce891d9.mjs → LoadingSimulation-68b64ca8.mjs} +1 -1
- package/dist/{Modal-4162753a.mjs → Modal-62b0904c.mjs} +1 -1
- package/dist/{PaperAirplaneIcon-f7d5d4e6.mjs → PaperAirplaneIcon-5b4a34f1.mjs} +1 -1
- package/dist/{PromptTesting-3ad7b8b3.mjs → PromptTesting-60ba7e73.mjs} +3 -3
- package/dist/{SkillAutomation-77a250ee.mjs → SkillAutomation-5ec82873.mjs} +3 -3
- package/dist/{SkillData-0d3b5bd0.mjs → SkillData-6f08346a.mjs} +3 -3
- package/dist/{Testcase-ae40937c.mjs → Testcase-e2c895b5.mjs} +3 -3
- package/dist/{UnderMaintenance-3817557a.mjs → UnderMaintenance-7274085e.mjs} +1 -1
- package/dist/{VoiceTestcase-7753ab7e.mjs → VoiceTestcase-1b8f73a7.mjs} +3 -3
- package/dist/{XMarkIcon-ff96d5fc.mjs → XMarkIcon-6140beee.mjs} +1 -1
- package/dist/{api-86787a21.mjs → api-e935536c.mjs} +1 -1
- package/dist/{index.es-fb6fdd67.mjs → index.es-badce34e.mjs} +7 -7
- package/dist/{main-3fbf1bdd.mjs → main-01847ec5.mjs} +1403 -1403
- package/dist/mgtwin.es.min.js +1 -1
- package/dist/mgtwin.umd.min.js +1 -1
- package/dist/{voiceServices-a03cae88.mjs → voiceServices-bd2599b9.mjs} +11 -10
- package/package.json +1 -1
package/dist/mgtwin.umd.min.js
CHANGED
|
@@ -32,7 +32,7 @@ File System access not available, please use Push or PullAudioOutputStream`),thi
|
|
|
32
32
|
`;class t${toConnectionMessage(e){const A=new Pn.Deferred;try{if(e.messageType===Pn.MessageType.Text){const r=e.textContent;let i={},n=null;if(r){const o=r.split(`\r
|
|
33
33
|
\r
|
|
34
34
|
`);o&&o.length>0&&(i=this.parseHeaders(o[0]),o.length>1&&(n=o[1]))}A.resolve(new Pn.ConnectionMessage(e.messageType,n,i,e.id))}else if(e.messageType===Pn.MessageType.Binary){const r=e.binaryContent;let i={},n=null;if(!r||r.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const o=new DataView(r),s=o.getInt16(0);if(r.byteLength<s+2)throw new Error("Invalid binary message format. Header content missing.");let a="";for(let c=0;c<s;c++)a+=String.fromCharCode(o.getInt8(c+2));i=this.parseHeaders(a),r.byteLength>s+2&&(n=r.slice(2+s)),A.resolve(new Pn.ConnectionMessage(e.messageType,n,i,e.id))}}catch(r){A.reject(`Error formatting the message. Error: ${r}`)}return A.promise}fromConnectionMessage(e){const A=new Pn.Deferred;try{if(e.messageType===Pn.MessageType.Text){const r=`${this.makeHeaders(e)}${hL}${e.textBody?e.textBody:""}`;A.resolve(new Pn.RawWebsocketMessage(Pn.MessageType.Text,r,e.id))}else if(e.messageType===Pn.MessageType.Binary){const r=this.makeHeaders(e),i=e.binaryBody,n=this.stringToArrayBuffer(r),o=new Int8Array(n),s=o.byteLength,a=new Int8Array(2+s+(i?i.byteLength:0));if(a[0]=s>>8&255,a[1]=s&255,a.set(o,2),i){const u=new Int8Array(i);a.set(u,2+s)}const c=a.buffer;A.resolve(new Pn.RawWebsocketMessage(Pn.MessageType.Binary,c,e.id))}}catch(r){A.reject(`Error formatting the message. ${r}`)}return A.promise}makeHeaders(e){let A="";if(e.headers)for(const r in e.headers)r&&(A+=`${r}: ${e.headers[r]}${hL}`);return A}parseHeaders(e){const A={};if(e){const r=e.match(/[^\r\n]+/g);if(A){for(const i of r)if(i){const n=i.indexOf(":"),o=n>0?i.substr(0,n).trim().toLowerCase():i,s=n>0&&i.length>n+1?i.substr(n+1).trim():"";A[o]=s}}}return A}stringToArrayBuffer(e){const A=new ArrayBuffer(e.length),r=new DataView(A);for(let i=0;i<e.length;i++)r.setUint8(i,e.charCodeAt(i));return A}}XC.WebsocketMessageFormatter=t$;var Td={},gL;function A$(){if(gL)return Td;gL=1,Object.defineProperty(Td,"__esModule",{value:!0}),Td.SpeechConnectionFactory=void 0;const t=qr(),e=ct(),A=Ve(),r=ls(),i=ct(),n=Jr,o=us,s=dn;let a=class extends r.ConnectionFactoryBase{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="/stt/speech/universal/v"}async create(u,l,g){let h=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Endpoint,void 0);const p=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Region,void 0),C=r.ConnectionFactoryBase.getHostSuffix(p),B=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Host,"wss://"+p+".stt.speech"+C),E={},v=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_EndpointId,void 0),m=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_RecoLanguage,void 0);if(v?(!h||h.search(o.QueryParameterNames.CustomSpeechDeploymentId)===-1)&&(E[o.QueryParameterNames.CustomSpeechDeploymentId]=v):m&&(!h||h.search(o.QueryParameterNames.Language)===-1)&&(E[o.QueryParameterNames.Language]=m),(!h||h.search(o.QueryParameterNames.Format)===-1)&&(E[o.QueryParameterNames.Format]=u.parameters.getProperty(e.OutputFormatPropertyName,A.OutputFormat[A.OutputFormat.Simple]).toLowerCase()),u.autoDetectSourceLanguages!==void 0&&(E[o.QueryParameterNames.EnableLanguageId]="true"),this.setCommonUrlParams(u,E,h),h){const D=new URL(h),T=D.pathname;(T===""||T==="/")&&(D.pathname=this.universalUri+u.recognitionEndpointVersion,h=await r.ConnectionFactoryBase.getRedirectUrlFromEndpoint(D.toString()))}if(!h)switch(u.recognitionMode){case s.RecognitionMode.Conversation:u.parameters.getProperty(e.ForceDictationPropertyName,"false")==="true"?h=B+this.dictationRelativeUri:u.recognitionEndpointVersion!==void 0&&parseInt(u.recognitionEndpointVersion,10)>1?h=`${B}${this.universalUri}${u.recognitionEndpointVersion}`:h=B+this.conversationRelativeUri;break;case s.RecognitionMode.Dictation:h=B+this.dictationRelativeUri;break;default:u.recognitionEndpointVersion!==void 0&&parseInt(u.recognitionEndpointVersion,10)>1?h=`${B}${this.universalUri}${u.recognitionEndpointVersion}`:h=B+this.interactiveRelativeUri;break}const S={};l.token!==void 0&&l.token!==""&&(S[l.headerName]=l.token),S[n.HeaderNames.ConnectionId]=g,S.connectionId=g;const O=u.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",N=new t.WebsocketConnection(h,E,S,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(u),O,g),P=N.uri;return u.parameters.setProperty(A.PropertyId.SpeechServiceConnection_Url,P),N}};return Td.SpeechConnectionFactory=a,Td}var Ud={},dL;function r$(){if(dL)return Ud;dL=1,Object.defineProperty(Ud,"__esModule",{value:!0}),Ud.ConversationTranscriberConnectionFactory=void 0;const t=qr(),e=Ve(),A=ct(),r=ls(),i=ct(),n=Jr,o=us;let s=class extends r.ConnectionFactoryBase{constructor(){super(...arguments),this.universalUri="/speech/universal/v2"}async create(c,u,l){let g=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Endpoint,void 0);const h=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Region,void 0),p=r.ConnectionFactoryBase.getHostSuffix(h),C=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Host,"wss://"+h+".stt.speech"+p),B={},E=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_EndpointId,void 0),v=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_RecoLanguage,void 0);if(E?(!g||g.search(o.QueryParameterNames.CustomSpeechDeploymentId)===-1)&&(B[o.QueryParameterNames.CustomSpeechDeploymentId]=E):v&&(!g||g.search(o.QueryParameterNames.Language)===-1)&&(B[o.QueryParameterNames.Language]=v),c.autoDetectSourceLanguages!==void 0&&(B[o.QueryParameterNames.EnableLanguageId]="true"),this.setV2UrlParams(c,B,g),g){const P=new URL(g),D=P.pathname;(D===""||D==="/")&&(P.pathname=this.universalUri,g=await r.ConnectionFactoryBase.getRedirectUrlFromEndpoint(P.toString()))}g||(g=`${C}${this.universalUri}`);const m={};u.token!==void 0&&u.token!==""&&(m[u.headerName]=u.token),m[n.HeaderNames.ConnectionId]=l;const S=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",O=new t.WebsocketConnection(g,B,m,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(c),S,l),N=O.uri;return c.parameters.setProperty(e.PropertyId.SpeechServiceConnection_Url,N),O}setV2UrlParams(c,u,l){new Map([[e.PropertyId.Speech_SegmentationSilenceTimeoutMs,o.QueryParameterNames.SegmentationSilenceTimeoutMs],[e.PropertyId.SpeechServiceConnection_EnableAudioLogging,o.QueryParameterNames.EnableAudioLogging],[e.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,o.QueryParameterNames.EndSilenceTimeoutMs],[e.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,o.QueryParameterNames.InitialSilenceTimeoutMs],[e.PropertyId.SpeechServiceResponse_PostProcessingOption,o.QueryParameterNames.Postprocessing],[e.PropertyId.SpeechServiceResponse_ProfanityOption,o.QueryParameterNames.Profanity],[e.PropertyId.SpeechServiceResponse_StablePartialResultThreshold,o.QueryParameterNames.StableIntermediateThreshold]]).forEach((p,C)=>{this.setUrlParameter(C,p,c,u,l)});const h=JSON.parse(c.parameters.getProperty(A.ServicePropertiesPropertyName,"{}"));Object.keys(h).forEach(p=>{u[p]=h[p]})}};return Ud.ConversationTranscriberConnectionFactory=s,Ud}var Ld={},pL;function i$(){if(pL)return Ld;pL=1,Object.defineProperty(Ld,"__esModule",{value:!0}),Ld.TranscriberConnectionFactory=void 0;const t=qr(),e=Ve(),A=ls(),r=ct(),i=Jr,n=us;let o=class extends A.ConnectionFactoryBase{constructor(){super(...arguments),this.multiaudioRelativeUri="/speech/recognition/multiaudio"}create(a,c,u){let l=a.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Endpoint,void 0);const g=a.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Region,"centralus"),h=A.ConnectionFactoryBase.getHostSuffix(g),p="wss://transcribe."+g+".cts.speech"+h+this.multiaudioRelativeUri,C=a.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Host,p),B={};this.setQueryParams(B,a,l),l||(l=C);const E={};c.token!==void 0&&c.token!==""&&(E[c.headerName]=c.token),E[i.HeaderNames.ConnectionId]=u,a.parameters.setProperty(e.PropertyId.SpeechServiceConnection_Url,l);const v=a.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return Promise.resolve(new t.WebsocketConnection(l,B,E,new r.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(a),v,u))}setQueryParams(a,c,u){const l=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_EndpointId,void 0),g=c.parameters.getProperty(e.PropertyId.SpeechServiceConnection_RecoLanguage,void 0);l&&!(n.QueryParameterNames.CustomSpeechDeploymentId in a)&&(a[n.QueryParameterNames.CustomSpeechDeploymentId]=l),g&&!(n.QueryParameterNames.Language in a)&&(a[n.QueryParameterNames.Language]=g);const h=c.parameters.getProperty(e.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,"false").toLowerCase()==="true",p=c.parameters.getProperty(r.OutputFormatPropertyName,e.OutputFormat[e.OutputFormat.Simple])!==e.OutputFormat[e.OutputFormat.Simple];(h||p)&&(a[n.QueryParameterNames.Format]=e.OutputFormat[e.OutputFormat.Detailed].toLowerCase()),this.setCommonUrlParams(c,a,u)}};return Ld.TranscriberConnectionFactory=o,Ld}var Fd={},fL;function n$(){if(fL)return Fd;fL=1,Object.defineProperty(Fd,"__esModule",{value:!0}),Fd.TranslationConnectionFactory=void 0;const t=qr(),e=ld,A=Ve(),r=ls(),i=ct(),n=Jr,o=us,s=dn;let a=class extends r.ConnectionFactoryBase{constructor(){super(...arguments),this.universalUri="/stt/speech/universal/v2",this.translationV1Uri="/speech/translation/cognitiveservices/v1"}async create(u,l,g){let h=this.getEndpointUrl(u);const p={};if(this.setQueryParams(p,u,h),h){const v=new URL(h),m=v.pathname;(m===""||m==="/")&&(v.pathname=this.universalUri,h=await r.ConnectionFactoryBase.getRedirectUrlFromEndpoint(v.toString()))}const C={};l.token!==void 0&&l.token!==""&&(C[l.headerName]=l.token),C[n.HeaderNames.ConnectionId]=g,u.parameters.setProperty(A.PropertyId.SpeechServiceConnection_Url,h);const B=u.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new t.WebsocketConnection(h,p,C,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(u),B,g)}getEndpointUrl(u,l){const g=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Region),h=r.ConnectionFactoryBase.getHostSuffix(g);let p=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Endpoint,void 0);return p?l===!0?p:e.StringUtils.formatString(p,{region:g}):(u.parameters.getProperty("SPEECH-ForceV1Endpoint","false")==="true"?p=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Host,"wss://{region}.s2s.speech"+h)+this.translationV1Uri:p=u.parameters.getProperty(A.PropertyId.SpeechServiceConnection_Host,"wss://{region}.stt.speech"+h)+this.universalUri,l===!0?p:e.StringUtils.formatString(p,{region:g}))}setQueryParams(u,l,g){u.from=l.parameters.getProperty(A.PropertyId.SpeechServiceConnection_RecoLanguage),u.to=l.parameters.getProperty(A.PropertyId.SpeechServiceConnection_TranslationToLanguages),u.scenario=l.recognitionMode===s.RecognitionMode.Interactive?"interactive":l.recognitionMode===s.RecognitionMode.Conversation?"conversation":"",this.setCommonUrlParams(l,u,g),this.setUrlParameter(A.PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult,o.QueryParameterNames.StableTranslation,l,u,g);const h=l.parameters.getProperty(A.PropertyId.SpeechServiceConnection_TranslationVoice,void 0);h!==void 0&&(u.voice=h,u.features="requireVoice")}};return Fd.TranslationConnectionFactory=a,Fd}var Od={},EL;function s$(){if(EL)return Od;EL=1,Object.defineProperty(Od,"__esModule",{value:!0}),Od.EnumTranslation=void 0;const t=Ve(),e=ct();let A=class{static implTranslateRecognitionResult(i,n=!1){let o=t.ResultReason.Canceled;switch(i){case e.RecognitionStatus.Success:o=t.ResultReason.RecognizedSpeech;break;case e.RecognitionStatus.EndOfDictation:o=n?t.ResultReason.RecognizedSpeech:t.ResultReason.NoMatch;break;case e.RecognitionStatus.NoMatch:case e.RecognitionStatus.InitialSilenceTimeout:case e.RecognitionStatus.BabbleTimeout:o=t.ResultReason.NoMatch;break;case e.RecognitionStatus.Error:case e.RecognitionStatus.BadRequest:case e.RecognitionStatus.Forbidden:default:o=t.ResultReason.Canceled;break}return o}static implTranslateCancelResult(i){let n=t.CancellationReason.EndOfStream;switch(i){case e.RecognitionStatus.Success:case e.RecognitionStatus.EndOfDictation:case e.RecognitionStatus.NoMatch:n=t.CancellationReason.EndOfStream;break;case e.RecognitionStatus.InitialSilenceTimeout:case e.RecognitionStatus.BabbleTimeout:case e.RecognitionStatus.Error:case e.RecognitionStatus.BadRequest:case e.RecognitionStatus.Forbidden:default:n=t.CancellationReason.Error;break}return n}static implTranslateCancelErrorCode(i){let n=t.CancellationErrorCode.NoError;switch(i){case e.RecognitionStatus.Error:n=t.CancellationErrorCode.ServiceError;break;case e.RecognitionStatus.TooManyRequests:n=t.CancellationErrorCode.TooManyRequests;break;case e.RecognitionStatus.BadRequest:n=t.CancellationErrorCode.BadRequestParameters;break;case e.RecognitionStatus.Forbidden:n=t.CancellationErrorCode.Forbidden;break;default:n=t.CancellationErrorCode.NoError;break}return n}static implTranslateErrorDetails(i){let n="The speech service encountered an internal error and could not continue.";switch(i){case t.CancellationErrorCode.Forbidden:n="The recognizer is using a free subscription that ran out of quota.";break;case t.CancellationErrorCode.BadRequestParameters:n="Invalid parameter or unsupported audio format in the request.";break;case t.CancellationErrorCode.TooManyRequests:n="The number of parallel requests exceeded the number of allowed concurrent transcriptions.";break}return n}};return Od.EnumTranslation=A,Od}var CL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RecognitionStatus=t.SynthesisStatus=void 0,function(e){e[e.Success=0]="Success",e[e.SynthesisEnd=1]="SynthesisEnd",e[e.Error=2]="Error"}(t.SynthesisStatus||(t.SynthesisStatus={})),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"}(t.RecognitionStatus||(t.RecognitionStatus={}))})(CL);var xd={},IL;function o$(){if(IL)return xd;IL=1,Object.defineProperty(xd,"__esModule",{value:!0}),xd.TranslationSynthesisEnd=void 0;const t=ct();let e=class VG{constructor(r){this.privSynthesisEnd=JSON.parse(r),this.privSynthesisEnd.SynthesisStatus&&(this.privSynthesisEnd.SynthesisStatus=t.SynthesisStatus[this.privSynthesisEnd.SynthesisStatus]),this.privSynthesisEnd.Status&&(this.privSynthesisEnd.SynthesisStatus=t.SynthesisStatus[this.privSynthesisEnd.Status])}static fromJSON(r){return new VG(r)}get SynthesisStatus(){return this.privSynthesisEnd.SynthesisStatus}get FailureReason(){return this.privSynthesisEnd.FailureReason}};return xd.TranslationSynthesisEnd=e,xd}var _C={};Object.defineProperty(_C,"__esModule",{value:!0}),_C.TranslationHypothesis=void 0;const a$=Lt,BL=CC;class $C{constructor(e,A){this.privTranslationHypothesis=e,this.privTranslationHypothesis.Offset+=A,this.privTranslationHypothesis.Translation.TranslationStatus=this.mapTranslationStatus(this.privTranslationHypothesis.Translation.TranslationStatus)}static fromJSON(e,A){return new $C(JSON.parse(e),A)}static fromTranslationResponse(e,A){a$.Contracts.throwIfNullOrUndefined(e,"translationHypothesis");const r=e.SpeechHypothesis;return e.SpeechHypothesis=void 0,r.Translation=e,new $C(r,A)}get Duration(){return this.privTranslationHypothesis.Duration}get Offset(){return this.privTranslationHypothesis.Offset}get Text(){return this.privTranslationHypothesis.Text}get Translation(){return this.privTranslationHypothesis.Translation}get Language(){var e;return(e=this.privTranslationHypothesis.PrimaryLanguage)==null?void 0:e.Language}asJson(){const e={...this.privTranslationHypothesis};return e.Translation!==void 0?JSON.stringify({...e,TranslationStatus:BL.TranslationStatus[e.Translation.TranslationStatus]}):JSON.stringify(e)}mapTranslationStatus(e){if(typeof e=="string")return BL.TranslationStatus[e];if(typeof e=="number")return e}}_C.TranslationHypothesis=$C;var bd={},vL;function c$(){if(vL)return bd;vL=1,Object.defineProperty(bd,"__esModule",{value:!0}),bd.TranslationPhrase=void 0;const t=Lt,e=ct(),A=CC;let r=class tR{constructor(n,o){this.privTranslationPhrase=n,this.privTranslationPhrase.Offset+=o,this.privTranslationPhrase.RecognitionStatus=this.mapRecognitionStatus(this.privTranslationPhrase.RecognitionStatus),this.privTranslationPhrase.Translation!==void 0&&(this.privTranslationPhrase.Translation.TranslationStatus=this.mapTranslationStatus(this.privTranslationPhrase.Translation.TranslationStatus))}static fromJSON(n,o){return new tR(JSON.parse(n),o)}static fromTranslationResponse(n,o){t.Contracts.throwIfNullOrUndefined(n,"translationResponse");const s=n.SpeechPhrase;return n.SpeechPhrase=void 0,s.Translation=n,s.Text=s.DisplayText,new tR(s,o)}get RecognitionStatus(){return this.privTranslationPhrase.RecognitionStatus}get Offset(){return this.privTranslationPhrase.Offset}get Duration(){return this.privTranslationPhrase.Duration}get Text(){return this.privTranslationPhrase.Text}get Language(){var n;return(n=this.privTranslationPhrase.PrimaryLanguage)==null?void 0:n.Language}get Confidence(){var n;return(n=this.privTranslationPhrase.PrimaryLanguage)==null?void 0:n.Confidence}get Translation(){return this.privTranslationPhrase.Translation}asJson(){const n={...this.privTranslationPhrase},o={...n,RecognitionStatus:e.RecognitionStatus[n.RecognitionStatus]};return n.Translation&&(o.Translation={...n.Translation,TranslationStatus:A.TranslationStatus[n.Translation.TranslationStatus]}),JSON.stringify(o)}mapRecognitionStatus(n){if(typeof n=="string")return e.RecognitionStatus[n];if(typeof n=="number")return n}mapTranslationStatus(n){if(typeof n=="string")return A.TranslationStatus[n];if(typeof n=="number")return n}};return bd.TranslationPhrase=r,bd}var Nd={},wL;function u$(){if(wL)return Nd;wL=1,Object.defineProperty(Nd,"__esModule",{value:!0}),Nd.TranslationServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ct();let r=class extends A.ConversationServiceRecognizer{constructor(n,o,s,a,c){super(n,o,s,a,c),this.privTranslationRecognizer=c,this.connectionEvents.attach(u=>{u.name==="ConnectionEstablishedEvent"&&this.privTranslationRecognizer.onConnection()})}async processTypeSpecificMessages(n){const o=new e.PropertyCollection;let s=await this.processSpeechMessages(n);if(s)return!0;const a=async u=>{if(o.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,u.asJson()),this.privRequestSession.onPhraseRecognized(u.Offset+u.Duration),u.RecognitionStatus===A.RecognitionStatus.Success){const l=this.fireEventForResult(u,o);if(this.privTranslationRecognizer.recognized)try{this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,l)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(l.result)}catch(g){this.privErrorCallback&&this.privErrorCallback(g)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}else{const l=A.EnumTranslation.implTranslateRecognitionResult(u.RecognitionStatus),g=new e.TranslationRecognitionResult(void 0,this.privRequestSession.requestId,l,u.Text,u.Duration,u.Offset,u.Language,u.Confidence,void 0,u.asJson(),o);if(l===e.ResultReason.Canceled){const h=A.EnumTranslation.implTranslateCancelResult(u.RecognitionStatus),p=A.EnumTranslation.implTranslateCancelErrorCode(u.RecognitionStatus);await this.cancelRecognitionLocal(h,p,A.EnumTranslation.implTranslateErrorDetails(p))}else if(u.RecognitionStatus!==A.RecognitionStatus.EndOfDictation){const h=new e.TranslationRecognitionEventArgs(g,g.offset,this.privRequestSession.sessionId);if(this.privTranslationRecognizer.recognized)try{this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,h)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(g)}catch(p){this.privErrorCallback&&this.privErrorCallback(p)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}s=!0}},c=u=>{o.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,u.asJson());const l=this.fireEventForResult(u,o);if(this.privRequestSession.onHypothesis(l.offset),this.privTranslationRecognizer.recognizing)try{this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer,l)}catch{}s=!0};switch(n.messageType===t.MessageType.Text&&o.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,n.textBody),n.path.toLowerCase()){case"translation.hypothesis":c(A.TranslationHypothesis.fromJSON(n.textBody,this.privRequestSession.currentTurnAudioOffset));break;case"translation.response":const u=JSON.parse(n.textBody);if(u.SpeechPhrase)await a(A.TranslationPhrase.fromTranslationResponse(u,this.privRequestSession.currentTurnAudioOffset));else{const g=JSON.parse(n.textBody);g.SpeechHypothesis&&c(A.TranslationHypothesis.fromTranslationResponse(g,this.privRequestSession.currentTurnAudioOffset))}break;case"translation.phrase":await a(A.TranslationPhrase.fromJSON(n.textBody,this.privRequestSession.currentTurnAudioOffset));break;case"translation.synthesis":case"audio":this.sendSynthesisAudio(n.binaryBody,this.privRequestSession.sessionId),s=!0;break;case"audio.end":case"translation.synthesis.end":const l=A.TranslationSynthesisEnd.fromJSON(n.textBody);switch(l.SynthesisStatus){case A.SynthesisStatus.Error:if(this.privTranslationRecognizer.synthesizing){const g=new e.TranslationSynthesisResult(e.ResultReason.Canceled,void 0),h=new e.TranslationSynthesisEventArgs(g,this.privRequestSession.sessionId);try{this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer,h)}catch{}}if(this.privTranslationRecognizer.canceled){const g=new e.TranslationRecognitionCanceledEventArgs(this.privRequestSession.sessionId,e.CancellationReason.Error,l.FailureReason,e.CancellationErrorCode.ServiceError,null);try{this.privTranslationRecognizer.canceled(this.privTranslationRecognizer,g)}catch{}}break;case A.SynthesisStatus.Success:this.sendSynthesisAudio(void 0,this.privRequestSession.sessionId);break}s=!0;break}return s}cancelRecognition(n,o,s,a,c){const u=new e.PropertyCollection;if(u.setProperty(A.CancellationErrorCodePropertyName,e.CancellationErrorCode[a]),this.privTranslationRecognizer.canceled){const l=new e.TranslationRecognitionCanceledEventArgs(n,s,c,a,void 0);try{this.privTranslationRecognizer.canceled(this.privTranslationRecognizer,l)}catch{}}if(this.privSuccessCallback){const l=new e.TranslationRecognitionResult(void 0,o,e.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,c,void 0,u);try{this.privSuccessCallback(l),this.privSuccessCallback=void 0}catch{}}}handleRecognizingCallback(n,o,s){try{const a=new e.TranslationRecognitionEventArgs(e.TranslationRecognitionResult.fromSpeechRecognitionResult(n),o,s);this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer,a)}catch{}}handleRecognizedCallback(n,o,s){try{const a=new e.TranslationRecognitionEventArgs(e.TranslationRecognitionResult.fromSpeechRecognitionResult(n),o,s);this.privTranslationRecognizer.recognized(this.privTranslationRecognizer,a)}catch{}}fireEventForResult(n,o){let s;if(n.Translation.Translations!==void 0){s=new e.Translations;for(const h of n.Translation.Translations)s.set(h.Language,h.Text||h.DisplayText)}let a,c;n instanceof A.TranslationPhrase?(n.Translation&&n.Translation.TranslationStatus===t.TranslationStatus.Success?a=e.ResultReason.TranslatedSpeech:a=e.ResultReason.RecognizedSpeech,c=n.Confidence):a=e.ResultReason.TranslatingSpeech;const u=n.Language,l=new e.TranslationRecognitionResult(s,this.privRequestSession.requestId,a,n.Text,n.Duration,n.Offset,u,c,n.Translation.FailureReason,n.asJson(),o);return new e.TranslationRecognitionEventArgs(l,n.Offset,this.privRequestSession.sessionId)}sendSynthesisAudio(n,o){const s=n===void 0?e.ResultReason.SynthesizingAudioCompleted:e.ResultReason.SynthesizingAudio,a=new e.TranslationSynthesisResult(s,n),c=new e.TranslationSynthesisEventArgs(a,o);if(this.privTranslationRecognizer.synthesizing)try{this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer,c)}catch{}}};return Nd.TranslationServiceRecognizer=r,Nd}var eI={};Object.defineProperty(eI,"__esModule",{value:!0}),eI.SpeechDetected=void 0;class M0{constructor(e,A){this.privSpeechStartDetected=JSON.parse(e),this.privSpeechStartDetected.Offset+=A}static fromJSON(e,A){return new M0(e,A)}get Offset(){return this.privSpeechStartDetected.Offset}}eI.SpeechDetected=M0;var tI={};Object.defineProperty(tI,"__esModule",{value:!0}),tI.SpeechHypothesis=void 0;class y0{constructor(e,A){this.privSpeechHypothesis=JSON.parse(e),this.updateOffset(A)}static fromJSON(e,A){return new y0(e,A)}updateOffset(e){this.privSpeechHypothesis.Offset+=e}asJson(){return JSON.stringify(this.privSpeechHypothesis)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return this.privSpeechHypothesis.PrimaryLanguage===void 0?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return this.privSpeechHypothesis.PrimaryLanguage===void 0?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}tI.SpeechHypothesis=y0;var AI={};Object.defineProperty(AI,"__esModule",{value:!0}),AI.SpeechKeyword=void 0;class Q0{constructor(e,A){this.privSpeechKeyword=JSON.parse(e),this.privSpeechKeyword.Offset+=A}static fromJSON(e,A){return new Q0(e,A)}get Status(){return this.privSpeechKeyword.Status}get Text(){return this.privSpeechKeyword.Text}get Offset(){return this.privSpeechKeyword.Offset}get Duration(){return this.privSpeechKeyword.Duration}asJson(){return JSON.stringify(this.privSpeechKeyword)}}AI.SpeechKeyword=Q0;var Kd={},SL;function l$(){if(SL)return Kd;SL=1,Object.defineProperty(Kd,"__esModule",{value:!0}),Kd.SpeechServiceRecognizer=void 0;const t=Ve(),e=ct();let A=class extends e.ServiceRecognizerBase{constructor(i,n,o,s,a){super(i,n,o,s,a),this.privSpeechRecognizer=a}async processTypeSpecificMessages(i){let n;const o=new t.PropertyCollection;let s=!1;switch(i.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const a=e.SpeechHypothesis.fromJSON(i.textBody,this.privRequestSession.currentTurnAudioOffset);o.setProperty(t.PropertyId.SpeechServiceResponse_JsonResult,a.asJson()),n=new t.SpeechRecognitionResult(this.privRequestSession.requestId,t.ResultReason.RecognizingSpeech,a.Text,a.Duration,a.Offset,a.Language,a.LanguageDetectionConfidence,void 0,void 0,a.asJson(),o),this.privRequestSession.onHypothesis(a.Offset);const c=new t.SpeechRecognitionEventArgs(n,a.Offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,c)}catch{}s=!0;break;case"speech.phrase":const u=e.SimpleSpeechPhrase.fromJSON(i.textBody,this.privRequestSession.currentTurnAudioOffset);o.setProperty(t.PropertyId.SpeechServiceResponse_JsonResult,u.asJson());const l=e.EnumTranslation.implTranslateRecognitionResult(u.RecognitionStatus,this.privExpectContentAssessmentResponse);if(this.privRequestSession.onPhraseRecognized(u.Offset+u.Duration),t.ResultReason.Canceled===l){const g=e.EnumTranslation.implTranslateCancelResult(u.RecognitionStatus),h=e.EnumTranslation.implTranslateCancelErrorCode(u.RecognitionStatus);await this.cancelRecognitionLocal(g,h,e.EnumTranslation.implTranslateErrorDetails(h))}else{if(u.RecognitionStatus===e.RecognitionStatus.EndOfDictation)break;if(this.privRecognizerConfig.parameters.getProperty(e.OutputFormatPropertyName)===t.OutputFormat[t.OutputFormat.Simple])n=new t.SpeechRecognitionResult(this.privRequestSession.requestId,l,u.DisplayText,u.Duration,u.Offset,u.Language,u.LanguageDetectionConfidence,void 0,void 0,u.asJson(),o);else{const h=e.DetailedSpeechPhrase.fromJSON(i.textBody,this.privRequestSession.currentTurnAudioOffset);o.setProperty(t.PropertyId.SpeechServiceResponse_JsonResult,h.asJson()),n=new t.SpeechRecognitionResult(this.privRequestSession.requestId,l,h.RecognitionStatus===e.RecognitionStatus.Success?h.NBest[0].Display:"",h.Duration,h.Offset,h.Language,h.LanguageDetectionConfidence,void 0,void 0,h.asJson(),o)}const g=new t.SpeechRecognitionEventArgs(n,n.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,g)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(n)}catch(h){this.privErrorCallback&&this.privErrorCallback(h)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}s=!0;break}return s}cancelRecognition(i,n,o,s,a){const c=new t.PropertyCollection;if(c.setProperty(e.CancellationErrorCodePropertyName,t.CancellationErrorCode[s]),this.privSpeechRecognizer.canceled){const u=new t.SpeechRecognitionCanceledEventArgs(o,a,s,void 0,i);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,u)}catch{}}if(this.privSuccessCallback){const u=new t.SpeechRecognitionResult(n,t.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,a,void 0,c);try{this.privSuccessCallback(u),this.privSuccessCallback=void 0}catch{}}}};return Kd.SpeechServiceRecognizer=A,Kd}var kd={},mL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityProvider=t.SpeakerDiarizationMode=void 0,function(e){e.None="None",e.Identity="Identity",e.Anonymous="Anonymous"}(t.SpeakerDiarizationMode||(t.SpeakerDiarizationMode={})),function(e){e.CallCenter="CallCenter"}(t.IdentityProvider||(t.IdentityProvider={}))})(mL);var ML;function h$(){if(ML)return kd;ML=1,Object.defineProperty(kd,"__esModule",{value:!0}),kd.ConversationTranscriptionServiceRecognizer=void 0;const t=Ve(),e=ct(),A=mL,r=dn;let i=class extends e.ServiceRecognizerBase{constructor(o,s,a,c,u){super(o,s,a,c,u),this.privConversationTranscriber=u,this.setSpeakerDiarizationJson()}setSpeakerDiarizationJson(){if(this.privEnableSpeakerId){const o=this.privSpeechContext.getContext().phraseDetection||{};o.mode=r.RecognitionMode.Conversation;const s={};s.mode=A.SpeakerDiarizationMode.Anonymous,s.audioSessionId=this.privDiarizationSessionId,s.audioOffsetMs=0,s.diarizeIntermediates=this.privRecognizerConfig.parameters.getProperty(t.PropertyId.SpeechServiceResponse_DiarizeIntermediateResults,"false")==="true",o.speakerDiarization=s,this.privSpeechContext.getContext().phraseDetection=o}}async processTypeSpecificMessages(o){let s;const a=new t.PropertyCollection;a.setProperty(t.PropertyId.SpeechServiceResponse_JsonResult,o.textBody);let c=!1;switch(o.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const u=e.SpeechHypothesis.fromJSON(o.textBody,this.privRequestSession.currentTurnAudioOffset);s=new t.ConversationTranscriptionResult(this.privRequestSession.requestId,t.ResultReason.RecognizingSpeech,u.Text,u.Duration,u.Offset,u.Language,u.LanguageDetectionConfidence,u.SpeakerId,void 0,u.asJson(),a),this.privRequestSession.onHypothesis(u.Offset);const l=new t.ConversationTranscriptionEventArgs(s,u.Duration,this.privRequestSession.sessionId);if(this.privConversationTranscriber.transcribing)try{this.privConversationTranscriber.transcribing(this.privConversationTranscriber,l)}catch{}c=!0;break;case"speech.phrase":const g=e.SimpleSpeechPhrase.fromJSON(o.textBody,this.privRequestSession.currentTurnAudioOffset),h=e.EnumTranslation.implTranslateRecognitionResult(g.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(g.Offset+g.Duration),t.ResultReason.Canceled===h){const p=e.EnumTranslation.implTranslateCancelResult(g.RecognitionStatus),C=e.EnumTranslation.implTranslateCancelErrorCode(g.RecognitionStatus);await this.cancelRecognitionLocal(p,C,e.EnumTranslation.implTranslateErrorDetails(C))}else if(!(this.privRequestSession.isSpeechEnded&&h===t.ResultReason.NoMatch&&g.RecognitionStatus!==e.RecognitionStatus.InitialSilenceTimeout)){if(this.privRecognizerConfig.parameters.getProperty(e.OutputFormatPropertyName)===t.OutputFormat[t.OutputFormat.Simple])s=new t.ConversationTranscriptionResult(this.privRequestSession.requestId,h,g.DisplayText,g.Duration,g.Offset,g.Language,g.LanguageDetectionConfidence,g.SpeakerId,void 0,g.asJson(),a);else{const C=e.DetailedSpeechPhrase.fromJSON(o.textBody,this.privRequestSession.currentTurnAudioOffset);s=new t.ConversationTranscriptionResult(this.privRequestSession.requestId,h,C.RecognitionStatus===e.RecognitionStatus.Success?C.NBest[0].Display:void 0,C.Duration,C.Offset,C.Language,C.LanguageDetectionConfidence,g.SpeakerId,void 0,C.asJson(),a)}const p=new t.ConversationTranscriptionEventArgs(s,s.offset,this.privRequestSession.sessionId);if(this.privConversationTranscriber.transcribed)try{this.privConversationTranscriber.transcribed(this.privConversationTranscriber,p)}catch{}}c=!0;break}return c}cancelRecognition(o,s,a,c,u){if(new t.PropertyCollection().setProperty(e.CancellationErrorCodePropertyName,t.CancellationErrorCode[c]),this.privConversationTranscriber.canceled){const g=new t.ConversationTranscriptionCanceledEventArgs(a,u,c,void 0,o);try{this.privConversationTranscriber.canceled(this.privConversationTranscriber,g)}catch{}}}};return kd.ConversationTranscriptionServiceRecognizer=i,kd}var Pd={},yL;function g$(){if(yL)return Pd;yL=1,Object.defineProperty(Pd,"__esModule",{value:!0}),Pd.TranscriptionServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ct(),r=ho;let i=class extends A.ConversationServiceRecognizer{constructor(o,s,a,c,u){super(o,s,a,c,u),this.privTranscriberRecognizer=u,this.sendPrePayloadJSONOverride=l=>this.sendTranscriptionStartJSON(l),this.privRecognizerConfig.parameters.getProperty(e.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps)==="true"&&this.privSpeechContext.setWordLevelTimings()}async sendSpeechEventAsync(o,s){if(this.privRequestSession.isRecognizing){const a=await this.fetchConnection();await this.sendSpeechEvent(a,this.createSpeechEventPayload(o,s))}}async sendMeetingSpeechEventAsync(o,s){if(this.privRequestSession.isRecognizing){const a=await this.fetchConnection();await this.sendSpeechEvent(a,this.createMeetingSpeechEventPayload(o,s))}}processTypeSpecificMessages(o){return this.processSpeechMessages(o)}handleRecognizedCallback(o,s,a){try{const c=new e.SpeechRecognitionEventArgs(o,s,a);if(this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer,c),this.privSuccessCallback){try{this.privSuccessCallback(o)}catch(u){this.privErrorCallback&&this.privErrorCallback(u)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}catch{}}handleRecognizingCallback(o,s,a){try{const c=new e.SpeechRecognitionEventArgs(o,s,a);this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer,c)}catch{}}cancelRecognition(o,s,a,c,u){const l=new e.PropertyCollection;if(l.setProperty(A.CancellationErrorCodePropertyName,e.CancellationErrorCode[c]),this.privTranscriberRecognizer.IsMeetingRecognizer()){if(this.privTranscriberRecognizer.canceled){const g=new e.MeetingTranscriptionCanceledEventArgs(a,u,c,void 0,o);try{this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer,g)}catch{}}}else if(this.privTranscriberRecognizer.canceled){const g=new e.ConversationTranscriptionCanceledEventArgs(a,u,c,void 0,o);try{this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer,g)}catch{}}if(this.privSuccessCallback){const g=new e.SpeechRecognitionResult(s,e.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,u,void 0,l);try{this.privSuccessCallback(g),this.privSuccessCallback=void 0}catch{}}}async sendTranscriptionStartJSON(o){if(await this.sendSpeechContext(o,!0),this.privTranscriberRecognizer.IsMeetingRecognizer()){const s=this.privTranscriberRecognizer.getMeetingInfo(),a=this.createMeetingSpeechEventPayload(s,"start");await this.sendSpeechEvent(o,a)}else{const s=this.privTranscriberRecognizer.getConversationInfo(),a=this.createSpeechEventPayload(s,"start");await this.sendSpeechEvent(o,a)}await this.sendWaveHeader(o)}sendSpeechEvent(o,s){const a=JSON.stringify(s);if(a)return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"speech.event",this.privRequestSession.requestId,"application/json",a))}createSpeechEventPayload(o,s){const a={id:"meeting",name:s,meeting:o.conversationProperties};return a.meeting.id=o.id,a.meeting.attendees=o.participants,a}createMeetingSpeechEventPayload(o,s){const a={id:"meeting",name:s,meeting:o.meetingProperties};return a.meeting.id=o.id,a.meeting.attendees=o.participants,a}};return Pd.TranscriptionServiceRecognizer=i,Pd}var Gd={},QL;function d$(){if(QL)return Gd;QL=1,Object.defineProperty(Gd,"__esModule",{value:!0}),Gd.DetailedSpeechPhrase=void 0;const t=ct();let e=class WG{constructor(r,i){this.privDetailedSpeechPhrase=JSON.parse(r),this.privDetailedSpeechPhrase.RecognitionStatus=this.mapRecognitionStatus(this.privDetailedSpeechPhrase.RecognitionStatus),this.updateOffsets(i)}static fromJSON(r,i){return new WG(r,i)}updateOffsets(r){if(this.privDetailedSpeechPhrase.Offset+=r,this.privDetailedSpeechPhrase.NBest)for(const i of this.privDetailedSpeechPhrase.NBest){if(i.Words)for(const n of i.Words)n.Offset+=r;if(i.DisplayWords)for(const n of i.DisplayWords)n.Offset+=r}}asJson(){const r={...this.privDetailedSpeechPhrase};return JSON.stringify({...r,RecognitionStatus:t.RecognitionStatus[r.RecognitionStatus]})}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 this.privDetailedSpeechPhrase.PrimaryLanguage===void 0?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return this.privDetailedSpeechPhrase.PrimaryLanguage===void 0?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}mapRecognitionStatus(r){if(typeof r=="string")return t.RecognitionStatus[r];if(typeof r=="number")return r}};return Gd.DetailedSpeechPhrase=e,Gd}var jd={},RL;function p$(){if(RL)return jd;RL=1,Object.defineProperty(jd,"__esModule",{value:!0}),jd.SimpleSpeechPhrase=void 0;const t=ct();let e=class ZG{constructor(r,i=0){this.privSimpleSpeechPhrase=JSON.parse(r),this.privSimpleSpeechPhrase.RecognitionStatus=this.mapRecognitionStatus(this.privSimpleSpeechPhrase.RecognitionStatus),this.updateOffset(i)}static fromJSON(r,i){return new ZG(r,i)}updateOffset(r){this.privSimpleSpeechPhrase.Offset+=r}asJson(){const r={...this.privSimpleSpeechPhrase};return JSON.stringify({...r,RecognitionStatus:t.RecognitionStatus[r.RecognitionStatus]})}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 this.privSimpleSpeechPhrase.PrimaryLanguage===void 0?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return this.privSimpleSpeechPhrase.PrimaryLanguage===void 0?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}mapRecognitionStatus(r){if(typeof r=="string")return t.RecognitionStatus[r];if(typeof r=="number")return r}};return jd.SimpleSpeechPhrase=e,jd}var rI={};Object.defineProperty(rI,"__esModule",{value:!0}),rI.AddedLmIntent=void 0;class f${constructor(e,A){this.modelImpl=e,this.intentName=A}}rI.AddedLmIntent=f$;var Yd={},DL;function E$(){if(DL)return Yd;DL=1,Object.defineProperty(Yd,"__esModule",{value:!0}),Yd.IntentServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ct();let r=class extends A.ServiceRecognizerBase{constructor(n,o,s,a,c){super(n,o,s,a,c),this.privIntentRecognizer=c,this.privIntentDataSent=!1,a.recognitionEndpointVersion="1"}setIntents(n,o){this.privAddedLmIntents=n,this.privUmbrellaIntent=o,this.privIntentDataSent=!0}processTypeSpecificMessages(n){let o,s,a=!1;const c=new e.PropertyCollection;switch(n.messageType===t.MessageType.Text&&c.setProperty(e.PropertyId.SpeechServiceResponse_JsonResult,n.textBody),n.path.toLowerCase()){case"speech.hypothesis":const l=A.SpeechHypothesis.fromJSON(n.textBody,this.privRequestSession.currentTurnAudioOffset);if(o=new e.IntentRecognitionResult(void 0,this.privRequestSession.requestId,e.ResultReason.RecognizingIntent,l.Text,l.Duration,l.Offset,l.Language,l.LanguageDetectionConfidence,void 0,l.asJson(),c),this.privRequestSession.onHypothesis(o.offset),s=new e.IntentRecognitionEventArgs(o,l.Offset,this.privRequestSession.sessionId),this.privIntentRecognizer.recognizing)try{this.privIntentRecognizer.recognizing(this.privIntentRecognizer,s)}catch{}a=!0;break;case"speech.phrase":const g=A.SimpleSpeechPhrase.fromJSON(n.textBody,this.privRequestSession.currentTurnAudioOffset);o=new e.IntentRecognitionResult(void 0,this.privRequestSession.requestId,A.EnumTranslation.implTranslateRecognitionResult(g.RecognitionStatus),g.DisplayText,g.Duration,g.Offset,g.Language,g.LanguageDetectionConfidence,void 0,g.asJson(),c),s=new e.IntentRecognitionEventArgs(o,o.offset,this.privRequestSession.sessionId);const h=()=>{if(this.privIntentRecognizer.recognized)try{this.privIntentRecognizer.recognized(this.privIntentRecognizer,s)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(o)}catch(C){this.privErrorCallback&&this.privErrorCallback(C)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}};this.privIntentDataSent===!1||e.ResultReason.NoMatch===s.result.reason?(this.privRequestSession.onPhraseRecognized(s.offset+s.result.duration),h()):this.privPendingIntentArgs=s,a=!0;break;case"response":if(s=this.privPendingIntentArgs,this.privPendingIntentArgs=void 0,s===void 0){if(n.textBody==="")return;s=new e.IntentRecognitionEventArgs(new e.IntentRecognitionResult,0,this.privRequestSession.sessionId)}const p=A.IntentResponse.fromJSON(n.textBody);if(p!==null&&p.topScoringIntent&&p.topScoringIntent.intent){let C=this.privAddedLmIntents[p.topScoringIntent.intent];if(this.privUmbrellaIntent!==void 0&&(C=this.privUmbrellaIntent),C){const B=C===void 0||C.intentName===void 0?p.topScoringIntent.intent:C.intentName;let E=s.result.reason;B!==void 0&&(E=e.ResultReason.RecognizedIntent);const v=s.result.properties!==void 0?s.result.properties:new e.PropertyCollection;v.setProperty(e.PropertyId.LanguageUnderstandingServiceResponse_JsonResult,n.textBody),s=new e.IntentRecognitionEventArgs(new e.IntentRecognitionResult(B,s.result.resultId,E,s.result.text,s.result.duration,s.result.offset,void 0,void 0,s.result.errorDetails,s.result.json,v),s.offset,s.sessionId)}}if(this.privRequestSession.onPhraseRecognized(s.offset+s.result.duration),this.privIntentRecognizer.recognized)try{this.privIntentRecognizer.recognized(this.privIntentRecognizer,s)}catch{}if(this.privSuccessCallback){try{this.privSuccessCallback(s.result)}catch(C){this.privErrorCallback&&this.privErrorCallback(C)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}a=!0;break}const u=new t.Deferred;return u.resolve(a),u.promise}cancelRecognition(n,o,s,a,c){const u=new e.PropertyCollection;if(u.setProperty(A.CancellationErrorCodePropertyName,e.CancellationErrorCode[a]),this.privIntentRecognizer.canceled){const l=new e.IntentRecognitionCanceledEventArgs(s,c,a,void 0,void 0,n);try{this.privIntentRecognizer.canceled(this.privIntentRecognizer,l)}catch{}}if(this.privSuccessCallback){const l=new e.IntentRecognitionResult(void 0,o,e.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,c,void 0,u);try{this.privSuccessCallback(l),this.privSuccessCallback=void 0}catch{}}}};return Yd.IntentServiceRecognizer=r,Yd}var iI={};Object.defineProperty(iI,"__esModule",{value:!0}),iI.IntentResponse=void 0;class R0{constructor(e){e===""?this.privIntentResponse={}:this.privIntentResponse=JSON.parse(e)}static fromJSON(e){return new R0(e)}get query(){return this.privIntentResponse.query}get topScoringIntent(){return this.privIntentResponse.topScoringIntent}get entities(){return this.privIntentResponse.entities}}iI.IntentResponse=R0;var TL={};Object.defineProperty(TL,"__esModule",{value:!0});var nI={},sI={};Object.defineProperty(sI,"__esModule",{value:!0}),sI.ServiceTelemetryListener=void 0;const po=Mt(),UL=ZC;class C${constructor(e,A,r){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=e,this.privAudioSourceId=A,this.privAudioNodeId=r,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 UL.RecognitionTriggeredEvent&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof po.AudioStreamNodeAttachingEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof po.AudioStreamNodeAttachedEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof po.AudioSourceErrorEvent&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof po.AudioStreamNodeErrorEvent&&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 po.AudioStreamNodeDetachedEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof UL.ConnectingToServiceEvent&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof po.ConnectionStartEvent&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof po.ConnectionEstablishedEvent&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof po.ConnectionEstablishErrorEvent&&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 po.ConnectionMessageReceivedEvent&&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 A=50;this.privReceivedMessages[e.message.headers.path].length<A&&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 A={Metrics:e,ReceivedMessages:this.privReceivedMessages},r=JSON.stringify(A);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],r}get hasTelemetry(){return Object.keys(this.privReceivedMessages).length!==0||this.privListeningTriggerMetric!==null||this.privMicMetric!==null||this.privConnectionEstablishMetric!==null||this.privPhraseLatencies.length!==0||this.privHypothesisLatencies.length!==0}dispose(){this.privIsDisposed=!0}getConnectionError(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()}}}sI.ServiceTelemetryListener=C$,Object.defineProperty(nI,"__esModule",{value:!0}),nI.RequestSession=void 0;const Il=Mt(),oI=ZC,I$=sI;class B${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.privRecognitionBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=e,this.privRequestId=(0,Il.createNoDashGuid)(),this.privAudioNodeId=(0,Il.createNoDashGuid)(),this.privTurnDeferral=new Il.Deferred,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}get recognitionBytesSent(){return this.privRecognitionBytesSent}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privRecognitionBytesSent=0,this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new I$.ServiceTelemetryListener(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new oI.RecognitionTriggeredEvent(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}async onAudioSourceAttachCompleted(e,A){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,A?await this.onComplete():this.onEvent(new oI.ListeningStartedEvent(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onPreConnectionStart(e,A){this.privAuthFetchEventId=e,this.privSessionId=A,this.onEvent(new oI.ConnectingToServiceEvent(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}async onAuthCompleted(e){e&&await this.onComplete()}async onConnectionEstablishCompleted(e,A){if(e===200){this.onEvent(new oI.RecognitionStartedEvent(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privBytesSent=0;return}else e===403&&await this.onComplete()}async onServiceTurnEndResponse(e){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(await this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}onSpeechContext(){this.privRequestId=(0,Il.createNoDashGuid)()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch(()=>{})),this.privInTurn=!0,this.privTurnDeferral=new Il.Deferred}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,this.privRecognitionBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}async dispose(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)await e.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}async onStopRecognizing(){await this.onComplete()}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(e){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),Il.Events.instance.onEvent(e)}async onComplete(){this.privIsRecognizing&&(this.privIsRecognizing=!1,await this.detachAudioNode())}async detachAudioNode(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&await this.privAudioNode.detach())}}nI.RequestSession=B$;var aI={},LL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TentativePhraseResultsOption=t.OutputFormat=t.PhraseExtension=t.PhraseOption=void 0,function(e){e.WordTimings="WordTimings",e.SNR="SNR",e.Pronunciation="Pronunciation",e.WordPronunciation="WordPronunciation",e.WordConfidence="WordConfidence",e.Words="Words",e.Sentiment="Sentiment",e.PronunciationAssessment="PronunciationAssessment",e.ContentAssessment="ContentAssessment",e.PhraseAMScore="PhraseAMScore",e.PhraseLMScore="PhraseLMScore",e.WordAMScore="WordAMScore",e.WordLMScore="WordLMScore",e.RuleTree="RuleTree",e.NBestTimings="NBestTimings",e.DecoderDiagnostics="DecoderDiagnostics",e.DisplayWordTimings="DisplayWordTimings",e.DisplayWords="DisplayWords"}(t.PhraseOption||(t.PhraseOption={})),function(e){e.Graph="Graph",e.Corrections="Corrections",e.Sentiment="Sentiment"}(t.PhraseExtension||(t.PhraseExtension={})),function(e){e.Simple="Simple",e.Detailed="Detailed"}(t.OutputFormat||(t.OutputFormat={})),function(e){e.None="None",e.Always="Always"}(t.TentativePhraseResultsOption||(t.TentativePhraseResultsOption={}))})(LL),Object.defineProperty(aI,"__esModule",{value:!0}),aI.SpeechContext=void 0;const v$=dn,Sa=LL;class w${constructor(e){this.privContext={},this.privDynamicGrammar=e}getContext(){return this.privContext}setPronunciationAssessmentParams(e,A,r=!1){this.privContext.phraseDetection===void 0&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment===void 0&&(this.privContext.phraseDetection.enrichment={pronunciationAssessment:{}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e)||{},r&&(this.privContext.phraseDetection.mode=v$.RecognitionMode.Conversation),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push(Sa.PhraseOption.PronunciationAssessment),this.privContext.phraseOutput.detailed.options.indexOf(Sa.PhraseOption.SNR)===-1&&this.privContext.phraseOutput.detailed.options.push(Sa.PhraseOption.SNR),A&&(this.privContext.phraseDetection.enrichment.contentAssessment={topic:A},this.privContext.phraseOutput.detailed.options.push(Sa.PhraseOption.ContentAssessment))}setDetailedOutputFormat(){this.privContext.phraseOutput===void 0&&(this.privContext.phraseOutput={detailed:{options:[]}}),this.privContext.phraseOutput.detailed===void 0&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format=Sa.OutputFormat.Detailed}setWordLevelTimings(){this.privContext.phraseOutput===void 0&&(this.privContext.phraseOutput={detailed:{options:[]}}),this.privContext.phraseOutput.detailed===void 0&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format=Sa.OutputFormat.Detailed,this.privContext.phraseOutput.detailed.options.indexOf(Sa.PhraseOption.WordTimings)===-1&&this.privContext.phraseOutput.detailed.options.push(Sa.PhraseOption.WordTimings)}setSpeakerDiarizationAudioOffsetMs(e){this.privContext.phraseDetection.speakerDiarization.audioOffsetMs=e}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();return this.privContext.dgi=e,JSON.stringify(this.privContext)}}aI.SpeechContext=w$;var cI={},FL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SubstringMatchType=t.GroupType=void 0,function(e){e.IntentText="IntentText",e.IntentEntity="IntentEntity",e.Generic="Generic",e.People="People",e.Place="Place",e.DynamicEntity="DynamicEntity"}(t.GroupType||(t.GroupType={})),function(e){e.None="None",e.LeftRooted="LeftRooted",e.PartialName="PartialName",e.MiddleOfSentence="MiddleOfSentence"}(t.SubstringMatchType||(t.SubstringMatchType={}))})(FL),Object.defineProperty(cI,"__esModule",{value:!0}),cI.DynamicGrammarBuilder=void 0;const S$=FL;class m${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(this.privGrammars===void 0&&this.privPhrases===void 0)return;const e={};if(e.referenceGrammars=this.privGrammars,this.privPhrases!==void 0&&this.privPhrases.length!==0){const A=[];this.privPhrases.forEach(r=>{A.push({text:r})}),e.groups=[{type:S$.GroupType.Generic,items:A}]}return e}}cI.DynamicGrammarBuilder=m$;var Hd={},uI={},lI={},D0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MessageDataStreamType=t.ActivityPayloadResponse=void 0;class e{constructor(r){this.privActivityResponse=JSON.parse(r)}static fromJSON(r){return new e(r)}get conversationId(){return this.privActivityResponse.conversationId}get messageDataStreamType(){return this.privActivityResponse.messageDataStreamType}get messagePayload(){return this.privActivityResponse.messagePayload}get version(){return this.privActivityResponse.version}}t.ActivityPayloadResponse=e,function(A){A[A.None=0]="None",A[A.TextToSpeechAudio=1]="TextToSpeechAudio"}(t.MessageDataStreamType||(t.MessageDataStreamType={}))})(D0),Object.defineProperty(lI,"__esModule",{value:!0}),lI.DialogServiceTurnState=void 0;const M$=va,y$=oi,Q$=D0;class R${constructor(e,A){this.privRequestId=A,this.privIsCompleted=!1,this.privAudioStream=null,this.privTurnManager=e,this.resetTurnEndTimeout()}get audioStream(){return this.resetTurnEndTimeout(),this.privAudioStream}processActivityPayload(e,A){return e.messageDataStreamType===Q$.MessageDataStreamType.TextToSpeechAudio&&(this.privAudioStream=y$.AudioOutputStream.createPullStream(),this.privAudioStream.format=A!==void 0?A:M$.AudioOutputFormatImpl.getDefaultOutputFormat()),this.privAudioStream}endAudioStream(){this.privAudioStream!==null&&!this.privAudioStream.isClosed&&this.privAudioStream.close()}complete(){this.privTimeoutToken!==void 0&&clearTimeout(this.privTimeoutToken),this.endAudioStream()}resetTurnEndTimeout(){this.privTimeoutToken!==void 0&&clearTimeout(this.privTimeoutToken),this.privTimeoutToken=setTimeout(()=>{this.privTurnManager.CompleteTurn(this.privRequestId)},2e3)}}lI.DialogServiceTurnState=R$,Object.defineProperty(uI,"__esModule",{value:!0}),uI.DialogServiceTurnStateManager=void 0;const OL=ii,D$=lI;class T${constructor(){this.privTurnMap=new Map}StartTurn(e){if(this.privTurnMap.has(e))throw new OL.InvalidOperationError("Service error: There is already a turn with id:"+e);const A=new D$.DialogServiceTurnState(this,e);return this.privTurnMap.set(e,A),this.privTurnMap.get(e)}GetTurn(e){return this.privTurnMap.get(e)}CompleteTurn(e){if(!this.privTurnMap.has(e))throw new OL.InvalidOperationError("Service error: Received turn end for an unknown turn id:"+e);const A=this.privTurnMap.get(e);return A.complete(),this.privTurnMap.delete(e),A}}uI.DialogServiceTurnStateManager=T$;var xL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvocationSource=void 0,function(e){e.None="None",e.VoiceActivationWithKeyword="VoiceActivationWithKeyword"}(t.InvocationSource||(t.InvocationSource={}))})(xL);var bL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.OnRejectAction=t.KeywordDetectionType=void 0,function(e){e.StartTrigger="StartTrigger"}(t.KeywordDetectionType||(t.KeywordDetectionType={})),function(e){e.EndOfTurn="EndOfTurn",e.Continue="Continue"}(t.OnRejectAction||(t.OnRejectAction={}))})(bL);var NL;function U$(){if(NL)return Hd;NL=1,Object.defineProperty(Hd,"__esModule",{value:!0}),Hd.DialogServiceAdapter=void 0;const t=qr(),e=Qc,A=Mt(),r=va,i=Ve(),n=uI,o=ct(),s=D0,a=xL,c=bL,u=ho;let l=class extends o.ServiceRecognizerBase{constructor(h,p,C,B,E){super(h,p,C,B,E),this.privEvents=new A.EventSource,this.privDialogServiceConnector=E,this.receiveMessageOverride=()=>this.receiveDialogMessageOverride(),this.privTurnStateManager=new n.DialogServiceTurnStateManager,this.recognizeOverride=(v,m,S)=>this.listenOnce(v,m,S),this.postConnectImplOverride=v=>this.dialogConnectImpl(v),this.configConnectionOverride=v=>this.configConnection(v),this.disconnectOverride=()=>this.privDisconnect(),this.privDialogAudioSource=C,this.agentConfigSent=!1,this.privLastResult=null,this.connectionEvents.attach(v=>{v.name==="ConnectionClosedEvent"&&(this.terminateMessageLoop=!0)})}async sendMessage(h){const p=(0,A.createGuid)(),C=(0,A.createNoDashGuid)(),B={context:{interactionId:p},messagePayload:JSON.parse(h),version:.5},E=JSON.stringify(B);await(await this.fetchConnection()).send(new u.SpeechConnectionMessage(A.MessageType.Text,"agent",C,"application/json",E))}async privDisconnect(){await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,i.CancellationReason.Error,i.CancellationErrorCode.NoError,"Disconnecting"),this.terminateMessageLoop=!0,this.agentConfigSent=!1}processTypeSpecificMessages(h){const p=new i.PropertyCollection;h.messageType===A.MessageType.Text&&p.setProperty(i.PropertyId.SpeechServiceResponse_JsonResult,h.textBody);let C,B;switch(h.path.toLowerCase()){case"speech.phrase":const v=o.SimpleSpeechPhrase.fromJSON(h.textBody,this.privRequestSession.currentTurnAudioOffset);if(this.privRequestSession.onPhraseRecognized(v.Offset+v.Duration),v.RecognitionStatus!==o.RecognitionStatus.TooManyRequests&&v.RecognitionStatus!==o.RecognitionStatus.Error){const P=this.fireEventForResult(v,p);if(this.privLastResult=P.result,this.privDialogServiceConnector.recognized)try{this.privDialogServiceConnector.recognized(this.privDialogServiceConnector,P)}catch{}}B=!0;break;case"speech.hypothesis":const m=o.SpeechHypothesis.fromJSON(h.textBody,this.privRequestSession.currentTurnAudioOffset);C=new i.SpeechRecognitionResult(this.privRequestSession.requestId,i.ResultReason.RecognizingSpeech,m.Text,m.Duration,m.Offset,m.Language,m.LanguageDetectionConfidence,void 0,void 0,m.asJson(),p),this.privRequestSession.onHypothesis(m.Offset);const S=new i.SpeechRecognitionEventArgs(C,m.Offset,this.privRequestSession.sessionId);if(this.privDialogServiceConnector.recognizing)try{this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector,S)}catch{}B=!0;break;case"speech.keyword":const O=o.SpeechKeyword.fromJSON(h.textBody,this.privRequestSession.currentTurnAudioOffset);C=new i.SpeechRecognitionResult(this.privRequestSession.requestId,O.Status==="Accepted"?i.ResultReason.RecognizedKeyword:i.ResultReason.NoMatch,O.Text,O.Duration,O.Offset,void 0,void 0,void 0,void 0,O.asJson(),p),O.Status!=="Accepted"&&(this.privLastResult=C);const N=new i.SpeechRecognitionEventArgs(C,C.duration,C.resultId);if(this.privDialogServiceConnector.recognized)try{this.privDialogServiceConnector.recognized(this.privDialogServiceConnector,N)}catch{}B=!0;break;case"audio":{const P=h.requestId.toUpperCase(),D=this.privTurnStateManager.GetTurn(P);try{h.binaryBody?D.audioStream.write(h.binaryBody):D.endAudioStream()}catch{}}B=!0;break;case"response":this.handleResponseMessage(h),B=!0;break}const E=new A.Deferred;return E.resolve(B),E.promise}async cancelRecognition(h,p,C,B,E){if(this.terminateMessageLoop=!0,this.privRequestSession.isRecognizing&&await this.privRequestSession.onStopRecognizing(),this.privDialogServiceConnector.canceled){const v=new i.PropertyCollection;v.setProperty(o.CancellationErrorCodePropertyName,i.CancellationErrorCode[B]);const m=new i.SpeechRecognitionCanceledEventArgs(C,E,B,void 0,h);try{this.privDialogServiceConnector.canceled(this.privDialogServiceConnector,m)}catch{}if(this.privSuccessCallback){const S=new i.SpeechRecognitionResult(void 0,i.ResultReason.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,E,void 0,v);try{this.privSuccessCallback(S),this.privSuccessCallback=void 0}catch{}}}}async listenOnce(h,p,C){this.privRecognizerConfig.recognitionMode=h,this.privSuccessCallback=p,this.privErrorCallback=C,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privDialogAudioSource.events),this.privRecognizerConfig.parameters.setProperty(i.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const B=this.connectImpl(),E=this.sendPreAudioMessages(),v=await this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId),m=await this.privDialogAudioSource.format,S=await this.privDialogAudioSource.deviceInfo,O=new t.ReplayableAudioNode(v,m.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(O,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:S};try{await B,await E}catch(D){return await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,i.CancellationReason.Error,i.CancellationErrorCode.ConnectionFailure,D),Promise.resolve()}const N=new i.SessionEventArgs(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,N),this.sendAudio(O).then(()=>{},async D=>{await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,i.CancellationReason.Error,i.CancellationErrorCode.RuntimeError,D)})}dialogConnectImpl(h){return this.privConnectionLoop=this.startMessageLoop(),h}receiveDialogMessageOverride(){const h=new A.Deferred,p=async()=>{try{const C=this.isDisposed(),B=!this.isDisposed()&&this.terminateMessageLoop;if(C||B){h.resolve(void 0);return}const v=await(await this.fetchConnection()).read();if(!v)return p();const m=u.SpeechConnectionMessage.fromConnectionMessage(v);switch(m.path.toLowerCase()){case"turn.start":{const z=m.requestId.toUpperCase(),Q=this.privRequestSession.requestId.toUpperCase();z!==Q?this.privTurnStateManager.StartTurn(z):this.privRequestSession.onServiceTurnStartResponse()}break;case"speech.startdetected":const O=o.SpeechDetected.fromJSON(m.textBody,this.privRequestSession.currentTurnAudioOffset),N=new i.RecognitionEventArgs(O.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,N);break;case"speech.enddetected":let P;m.textBody.length>0?P=m.textBody:P="{ Offset: 0 }";const D=o.SpeechDetected.fromJSON(P,this.privRequestSession.currentTurnAudioOffset);this.privRequestSession.onServiceRecognized(D.Offset);const T=new i.RecognitionEventArgs(D.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,T);break;case"turn.end":{const z=m.requestId.toUpperCase(),Q=this.privRequestSession.requestId.toUpperCase();if(z!==Q)this.privTurnStateManager.CompleteTurn(z);else{const R=new i.SessionEventArgs(this.privRequestSession.sessionId);if(await this.privRequestSession.onServiceTurnEndResponse(!1),(!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)&&this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,R),this.privSuccessCallback&&this.privLastResult){try{this.privSuccessCallback(this.privLastResult),this.privLastResult=null}catch(G){this.privErrorCallback&&this.privErrorCallback(G)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}}break;default:try{await this.processTypeSpecificMessages(m)||this.serviceEvents&&this.serviceEvents.onEvent(new A.ServiceEvent(m.path.toLowerCase(),m.textBody))}catch{}}return p()}catch{this.terminateMessageLoop=!0,h.resolve()}};return p().catch(C=>{A.Events.instance.onEvent(new A.BackgroundEvent(C))}),h.promise}async startMessageLoop(){this.terminateMessageLoop=!1;try{await this.receiveDialogMessageOverride()}catch(h){await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,i.CancellationReason.Error,i.CancellationErrorCode.RuntimeError,h)}return Promise.resolve()}async configConnection(h){return this.terminateMessageLoop?(this.terminateMessageLoop=!1,Promise.reject("Connection to service terminated.")):(await this.sendSpeechServiceConfig(h,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),await this.sendAgentConfig(h),h)}async sendPreAudioMessages(){const h=await this.fetchConnection();this.addKeywordContextData(),await this.sendSpeechContext(h,!0),await this.sendAgentContext(h),await this.sendWaveHeader(h)}sendAgentConfig(h){if(this.agentConfig&&!this.agentConfigSent){if(this.privRecognizerConfig.parameters.getProperty(i.PropertyId.Conversation_DialogType)===i.DialogServiceConfig.DialogTypes.CustomCommands){const C=this.agentConfig.get();C.botInfo.commandsCulture=this.privRecognizerConfig.parameters.getProperty(i.PropertyId.SpeechServiceConnection_RecoLanguage,"en-us"),this.agentConfig.set(C)}this.onEvent(new e.SendingAgentContextMessageEvent(this.agentConfig));const p=this.agentConfig.toJsonString();return this.agentConfigSent=!0,h.send(new u.SpeechConnectionMessage(A.MessageType.Text,"agent.config",this.privRequestSession.requestId,"application/json",p))}}sendAgentContext(h){const p=(0,A.createGuid)(),C=this.privDialogServiceConnector.properties.getProperty(i.PropertyId.Conversation_Speech_Activity_Template),E=JSON.stringify({channelData:"",context:{interactionId:p},messagePayload:typeof C===void 0?void 0:C,version:.5});return h.send(new u.SpeechConnectionMessage(A.MessageType.Text,"speech.agent.context",this.privRequestSession.requestId,"application/json",E))}fireEventForResult(h,p){const C=o.EnumTranslation.implTranslateRecognitionResult(h.RecognitionStatus),B=new i.SpeechRecognitionResult(this.privRequestSession.requestId,C,h.DisplayText,h.Duration,h.Offset,h.Language,h.LanguageDetectionConfidence,void 0,void 0,h.asJson(),p);return new i.SpeechRecognitionEventArgs(B,h.Offset,this.privRequestSession.sessionId)}handleResponseMessage(h){const p=JSON.parse(h.textBody);switch(p.messageType.toLowerCase()){case"message":const C=h.requestId.toUpperCase(),B=s.ActivityPayloadResponse.fromJSON(h.textBody),E=this.privTurnStateManager.GetTurn(C);if(B.conversationId){const S=this.agentConfig.get();S.botInfo.conversationId=B.conversationId,this.agentConfig.set(S)}const v=E.processActivityPayload(B,r.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(this.privDialogServiceConnector.properties.getProperty(i.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0))),m=new i.ActivityReceivedEventArgs(B.messagePayload,v);if(this.privDialogServiceConnector.activityReceived)try{this.privDialogServiceConnector.activityReceived(this.privDialogServiceConnector,m)}catch{}break;case"messagestatus":if(this.privDialogServiceConnector.turnStatusReceived)try{this.privDialogServiceConnector.turnStatusReceived(this.privDialogServiceConnector,new i.TurnStatusReceivedEventArgs(h.textBody))}catch{}break;default:A.Events.instance.onEvent(new A.BackgroundEvent(`Unexpected response of type ${p.messageType}. Ignoring.`));break}}onEvent(h){this.privEvents.onEvent(h),A.Events.instance.onEvent(h)}addKeywordContextData(){const h=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect");if(h===void 0)return;const p=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Offsets"),C=this.privRecognizerConfig.parameters.getProperty("SPEECH-KeywordsToDetect-Durations"),B=h.split(";"),E=p===void 0?[]:p.split(";"),v=C===void 0?[]:C.split(";"),m=[];for(let S=0;S<B.length;S++){const O={text:B[S]};S<E.length&&(O.startOffset=Number(E[S])),S<v.length&&(O.duration=Number(v[S])),m.push(O)}this.speechContext.getContext().invocationSource=a.InvocationSource.VoiceActivationWithKeyword,this.speechContext.getContext().keywordDetection=[{clientDetectedKeywords:m,onReject:{action:c.OnRejectAction.EndOfTurn},type:c.KeywordDetectionType.StartTrigger}]}};return Hd.DialogServiceAdapter=l,Hd}var hI={};Object.defineProperty(hI,"__esModule",{value:!0}),hI.AgentConfig=void 0;class L${toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}hI.AgentConfig=L$;var T0={},zd={},Bl={};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.ConversationConnectionConfig=void 0;const F$=Qd;class mi extends F$.RestConfigBase{static get host(){return mi.privHost}static get apiVersion(){return mi.privApiVersion}static get clientAppId(){return mi.privClientAppId}static get defaultLanguageCode(){return mi.privDefaultLanguageCode}static get restPath(){return mi.privRestPath}static get webSocketPath(){return mi.privWebSocketPath}static get transcriptionEventKeys(){return mi.privTranscriptionEventKeys}}Bl.ConversationConnectionConfig=mi,mi.privHost="dev.microsofttranslator.com",mi.privRestPath="/capito/room",mi.privApiVersion="2.0",mi.privDefaultLanguageCode="en-US",mi.privClientAppId="FC539C22-1767-4F1F-84BC-B4D811114F15",mi.privWebSocketPath="/capito/translate",mi.privTranscriptionEventKeys=["iCalUid","callId","organizer","FLAC","MTUri","DifferentiateGuestSpeakers","audiorecording","Threadid","OrganizerMri","OrganizerTenantId","UserToken"];var KL;function O$(){if(KL)return zd;KL=1,Object.defineProperty(zd,"__esModule",{value:!0}),zd.ConversationManager=void 0;const t=qr(),e=Lt,A=Ve(),r=Bl;let i=class{constructor(){this.privRequestParams=r.ConversationConnectionConfig.configParams,this.privErrors=r.ConversationConnectionConfig.restErrors,this.privHost=r.ConversationConnectionConfig.host,this.privApiVersion=r.ConversationConnectionConfig.apiVersion,this.privRestPath=r.ConversationConnectionConfig.restPath,this.privRestAdapter=new t.RestMessageAdapter({})}createOrJoin(o,s,a,c){try{e.Contracts.throwIfNullOrUndefined(o,"args");const u=o.getProperty(A.PropertyId.SpeechServiceConnection_RecoLanguage,r.ConversationConnectionConfig.defaultLanguageCode),l=o.getProperty(A.PropertyId.ConversationTranslator_Name,"conversation_host"),g=o.getProperty(A.PropertyId.ConversationTranslator_Host,this.privHost),h=o.getProperty(A.PropertyId.ConversationTranslator_CorrelationId),p=o.getProperty(A.PropertyId.SpeechServiceConnection_Key),C=o.getProperty(A.PropertyId.SpeechServiceConnection_Region),B=o.getProperty(A.PropertyId.SpeechServiceAuthorization_Token);e.Contracts.throwIfNullOrWhitespace(u,"languageCode"),e.Contracts.throwIfNullOrWhitespace(l,"nickname"),e.Contracts.throwIfNullOrWhitespace(g,"endpointHost");const E={};E[this.privRequestParams.apiVersion]=this.privApiVersion,E[this.privRequestParams.languageCode]=u,E[this.privRequestParams.nickname]=l;const v={};h&&(v[this.privRequestParams.correlationId]=h),v[this.privRequestParams.clientAppId]=r.ConversationConnectionConfig.clientAppId,s!==void 0?E[this.privRequestParams.roomId]=s:(e.Contracts.throwIfNullOrUndefined(C,this.privErrors.authInvalidSubscriptionRegion),v[this.privRequestParams.subscriptionRegion]=C,p?v[this.privRequestParams.subscriptionKey]=p:B?v[this.privRequestParams.authorization]=`Bearer ${B}`:e.Contracts.throwIfNullOrUndefined(p,this.privErrors.authInvalidSubscriptionKey));const m={};m.headers=v,this.privRestAdapter.options=m;const S=`https://${g}${this.privRestPath}`;this.privRestAdapter.request(t.RestRequestType.Post,S,E,null).then(O=>{const N=t.RestMessageAdapter.extractHeaderValue(this.privRequestParams.requestId,O.headers);if(!O.ok){if(c){let D=this.privErrors.invalidCreateJoinConversationResponse.replace("{status}",O.status.toString()),T;try{T=JSON.parse(O.data),D+=` [${T.error.code}: ${T.error.message}]`}catch{D+=` [${O.data}]`}N&&(D+=` ${N}`),c(D)}return}const P=JSON.parse(O.data);if(P&&(P.requestId=N),a){try{a(P)}catch(D){c&&c(D)}a=void 0}}).catch(()=>{})}catch(u){if(c)if(u instanceof Error){const l=u;c(l.name+": "+l.message)}else c(u)}}leave(o,s){return new Promise((a,c)=>{try{e.Contracts.throwIfNullOrUndefined(o,this.privErrors.invalidArgs.replace("{arg}","config")),e.Contracts.throwIfNullOrWhitespace(s,this.privErrors.invalidArgs.replace("{arg}","token"));const u=o.getProperty(A.PropertyId.ConversationTranslator_Host,this.privHost),l=o.getProperty(A.PropertyId.ConversationTranslator_CorrelationId),g={};g[this.privRequestParams.apiVersion]=this.privApiVersion,g[this.privRequestParams.sessionToken]=s;const h={};l&&(h[this.privRequestParams.correlationId]=l);const p={};p.headers=h,this.privRestAdapter.options=p;const C=`https://${u}${this.privRestPath}`;this.privRestAdapter.request(t.RestRequestType.Delete,C,g,null).then(B=>{B.ok,a()}).catch(()=>{})}catch(u){if(u instanceof Error){const l=u;c(l.name+": "+l.message)}else c(u)}})}};return zd.ConversationManager=i,zd}var jc={},Jd={},gI={},qd={};Object.defineProperty(qd,"__esModule",{value:!0}),qd.ConversationConnectionMessage=void 0;const x$=Mt();class b$ extends x$.ConnectionMessage{constructor(e,A,r,i){super(e,A,r,i);const n=JSON.parse(this.textBody);n.type!==void 0&&(this.privConversationMessageType=n.type)}get conversationMessageType(){return this.privConversationMessageType}}qd.ConversationConnectionMessage=b$,Object.defineProperty(gI,"__esModule",{value:!0}),gI.ConversationWebsocketMessageFormatter=void 0;const Yc=Mt(),kL=qd;class N${toConnectionMessage(e){const A=new Yc.Deferred;try{if(e.messageType===Yc.MessageType.Text){const r=new kL.ConversationConnectionMessage(e.messageType,e.textContent,{},e.id);A.resolve(r)}else e.messageType===Yc.MessageType.Binary&&A.resolve(new kL.ConversationConnectionMessage(e.messageType,e.binaryContent,void 0,e.id))}catch(r){A.reject(`Error formatting the message. Error: ${r}`)}return A.promise}fromConnectionMessage(e){const A=new Yc.Deferred;try{if(e.messageType===Yc.MessageType.Text){const r=`${e.textBody?e.textBody:""}`;A.resolve(new Yc.RawWebsocketMessage(Yc.MessageType.Text,r,e.id))}}catch(r){A.reject(`Error formatting the message. ${r}`)}return A.promise}}gI.ConversationWebsocketMessageFormatter=N$;var PL;function K$(){if(PL)return Jd;PL=1,Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.ConversationConnectionFactory=void 0;const t=qr(),e=Mt(),A=Lt,r=Ve(),i=ls(),n=Bl,o=gI;let s=class extends i.ConnectionFactoryBase{create(c,u,l){const g=c.parameters.getProperty(r.PropertyId.ConversationTranslator_Host,n.ConversationConnectionConfig.host),h=c.parameters.getProperty(r.PropertyId.ConversationTranslator_CorrelationId,(0,e.createGuid)()),p=`wss://${g}${n.ConversationConnectionConfig.webSocketPath}`,C=c.parameters.getProperty(r.PropertyId.ConversationTranslator_Token,void 0);A.Contracts.throwIfNullOrUndefined(C,"token");const B={};B[n.ConversationConnectionConfig.configParams.apiVersion]=n.ConversationConnectionConfig.apiVersion,B[n.ConversationConnectionConfig.configParams.token]=C,B[n.ConversationConnectionConfig.configParams.correlationId]=h;const E=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return Promise.resolve(new t.WebsocketConnection(p,B,{},new o.ConversationWebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(c),E,l))}};return Jd.ConversationConnectionFactory=s,Jd}var Vd={},dI={};Object.defineProperty(dI,"__esModule",{value:!0}),dI.ConversationRequestSession=void 0;const U0=Mt();class k${constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privSessionId=e,this.privRequestId=(0,U0.createNoDashGuid)(),this.privRequestCompletionDeferral=new U0.Deferred}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get completionPromise(){return this.privRequestCompletionDeferral.promise}onPreConnectionStart(e,A){this.privSessionId=A}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){e!==200&&e===403&&this.onComplete()}onServiceTurnEndResponse(e){e?this.privRequestId=(0,U0.createNoDashGuid)():this.onComplete()}async dispose(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)await e.detach()}}onComplete(){}}dI.ConversationRequestSession=k$;var Gi={},GL;function jL(){if(GL)return Gi;GL=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.ConversationReceivedTranslationEventArgs=Gi.ParticipantsListEventArgs=Gi.ParticipantAttributeEventArgs=Gi.ParticipantEventArgs=Gi.LockRoomEventArgs=Gi.MuteAllEventArgs=void 0;const t=Ve();class e extends t.SessionEventArgs{constructor(a,c){super(c),this.privIsMuted=a}get isMuted(){return this.privIsMuted}}Gi.MuteAllEventArgs=e;class A extends t.SessionEventArgs{constructor(a,c){super(c),this.privIsLocked=a}get isMuted(){return this.privIsLocked}}Gi.LockRoomEventArgs=A;class r extends t.SessionEventArgs{constructor(a,c){super(c),this.privParticipant=a}get participant(){return this.privParticipant}}Gi.ParticipantEventArgs=r;class i extends t.SessionEventArgs{constructor(a,c,u,l){super(l),this.privKey=c,this.privValue=u,this.privParticipantId=a}get value(){return this.privValue}get key(){return this.privKey}get id(){return this.privParticipantId}}Gi.ParticipantAttributeEventArgs=i;class n extends t.SessionEventArgs{constructor(a,c,u,l,g,h,p,C,B){super(B),this.privRoomId=a,this.privSessionToken=c,this.privTranslateTo=u,this.privProfanityFilter=l,this.privRoomProfanityFilter=g,this.privIsRoomLocked=h,this.privIsRoomLocked=p,this.privParticipants=C}get sessionToken(){return this.privSessionToken}get conversationId(){return this.privRoomId}get translateTo(){return this.privTranslateTo}get profanityFilter(){return this.privProfanityFilter}get roomProfanityFilter(){return this.privRoomProfanityFilter}get isRoomLocked(){return this.privIsRoomLocked}get isMuteAll(){return this.privIsMuteAll}get participants(){return this.privParticipants}}Gi.ParticipantsListEventArgs=n;class o{constructor(a,c,u){this.privPayload=c,this.privCommand=a,this.privSessionId=u}get payload(){return this.privPayload}get command(){return this.privCommand}get sessionId(){return this.privSessionId}}return Gi.ConversationReceivedTranslationEventArgs=o,Gi}var fo={};Object.defineProperty(fo,"__esModule",{value:!0}),fo.ConversationTranslatorCommandTypes=fo.ConversationTranslatorMessageTypes=fo.InternalParticipants=void 0;class P${constructor(e=[],A){this.participants=e,this.meId=A}addOrUpdateParticipant(e){if(e===void 0)return;const A=this.getParticipantIndex(e.id);return A>-1?this.participants.splice(A,1,e):this.participants.push(e),this.getParticipant(e.id)}getParticipantIndex(e){return this.participants.findIndex(A=>A.id===e)}getParticipant(e){return this.participants.find(A=>A.id===e)}deleteParticipant(e){this.participants=this.participants.filter(A=>A.id!==e)}get host(){return this.participants.find(e=>e.isHost===!0)}get me(){return this.getParticipant(this.meId)}}fo.InternalParticipants=P$,fo.ConversationTranslatorMessageTypes={command:"command",final:"final",info:"info",instantMessage:"instant_message",keepAlive:"keep_alive",partial:"partial",participantCommand:"participant_command",translatedMessage:"translated_message"},fo.ConversationTranslatorCommandTypes={changeNickname:"ChangeNickname",disconnectSession:"DisconnectSession",ejectParticipant:"EjectParticipant",instant_message:"instant_message",joinSession:"JoinSession",leaveSession:"LeaveSession",participantList:"ParticipantList",roomExpirationWarning:"RoomExpirationWarning",setLockState:"SetLockState",setMute:"SetMute",setMuteAll:"SetMuteAll",setProfanityFiltering:"SetProfanityFiltering",setTranslateToLanguages:"SetTranslateToLanguages",setUseTTS:"SetUseTTS"};var YL={},pI={};Object.defineProperty(pI,"__esModule",{value:!0}),pI.CommandResponsePayload=void 0;const G$=t=>JSON.parse(t);class L0{constructor(e){this.privCommandResponse=G$(e)}get type(){return this.privCommandResponse.type}get command(){return this.privCommandResponse.command}get id(){return this.privCommandResponse.id}get nickname(){return this.privCommandResponse.nickname}get participantId(){return this.privCommandResponse.participantId}get roomid(){return this.privCommandResponse.roomid}get value(){return this.privCommandResponse.value}get token(){return this.privCommandResponse.token}static fromJSON(e){return new L0(e)}}pI.CommandResponsePayload=L0;var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.ParticipantPayloadResponse=vl.ParticipantsListPayloadResponse=void 0;const j$=t=>JSON.parse(t),Y$=t=>JSON.parse(t);class F0{constructor(e){this.privParticipantsPayloadResponse=j$(e)}get roomid(){return this.privParticipantsPayloadResponse.roomid}get id(){return this.privParticipantsPayloadResponse.id}get command(){return this.privParticipantsPayloadResponse.command}get participants(){return this.privParticipantsPayloadResponse.participants}get token(){return this.privParticipantsPayloadResponse.token}get translateTo(){return this.privParticipantsPayloadResponse.translateTo}get profanityFilter(){return this.privParticipantsPayloadResponse.profanityFilter}get roomProfanityFilter(){return this.privParticipantsPayloadResponse.roomProfanityFilter}get roomLocked(){return this.privParticipantsPayloadResponse.roomLocked}get muteAll(){return this.privParticipantsPayloadResponse.muteAll}get type(){return this.privParticipantsPayloadResponse.type}static fromJSON(e){return new F0(e)}}vl.ParticipantsListPayloadResponse=F0;class O0{constructor(e){this.privParticipantPayloadResponse=Y$(e)}get nickname(){return this.privParticipantPayloadResponse.nickname}get locale(){return this.privParticipantPayloadResponse.locale}get usetts(){return this.privParticipantPayloadResponse.usetts}get ismuted(){return this.privParticipantPayloadResponse.ismuted}get ishost(){return this.privParticipantPayloadResponse.ishost}get participantId(){return this.privParticipantPayloadResponse.participantId}get avatar(){return this.privParticipantPayloadResponse.avatar}static fromJSON(e){return new O0(e)}}vl.ParticipantPayloadResponse=O0;var wl={};Object.defineProperty(wl,"__esModule",{value:!0}),wl.TextResponsePayload=wl.SpeechResponsePayload=void 0;const H$=t=>JSON.parse(t),z$=t=>JSON.parse(t);class x0{constructor(e){this.privSpeechResponse=H$(e)}get recognition(){return this.privSpeechResponse.recognition}get translations(){return this.privSpeechResponse.translations}get id(){return this.privSpeechResponse.id}get language(){return this.privSpeechResponse.language}get nickname(){return this.privSpeechResponse.nickname}get participantId(){return this.privSpeechResponse.participantId}get roomid(){return this.privSpeechResponse.roomid}get timestamp(){return this.privSpeechResponse.timestamp}get type(){return this.privSpeechResponse.type}get isFinal(){return this.privSpeechResponse.type==="final"}static fromJSON(e){return new x0(e)}}wl.SpeechResponsePayload=x0;class b0{constructor(e){this.privTextResponse=z$(e)}get originalText(){return this.privTextResponse.originalText}get translations(){return this.privTextResponse.translations}get id(){return this.privTextResponse.id}get language(){return this.privTextResponse.language}get nickname(){return this.privTextResponse.nickname}get participantId(){return this.privTextResponse.participantId}get roomid(){return this.privTextResponse.roomid}get timestamp(){return this.privTextResponse.timestamp}get type(){return this.privTextResponse.type}static fromJSON(e){return new b0(e)}}wl.TextResponsePayload=b0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TextResponsePayload=t.SpeechResponsePayload=t.ParticipantPayloadResponse=t.ParticipantsListPayloadResponse=t.CommandResponsePayload=void 0;var e=pI;Object.defineProperty(t,"CommandResponsePayload",{enumerable:!0,get:function(){return e.CommandResponsePayload}});var A=vl;Object.defineProperty(t,"ParticipantsListPayloadResponse",{enumerable:!0,get:function(){return A.ParticipantsListPayloadResponse}}),Object.defineProperty(t,"ParticipantPayloadResponse",{enumerable:!0,get:function(){return A.ParticipantPayloadResponse}});var r=wl;Object.defineProperty(t,"SpeechResponsePayload",{enumerable:!0,get:function(){return r.SpeechResponsePayload}}),Object.defineProperty(t,"TextResponsePayload",{enumerable:!0,get:function(){return r.TextResponsePayload}})}(YL);var HL;function J$(){if(HL)return Vd;HL=1,Object.defineProperty(Vd,"__esModule",{value:!0}),Vd.ConversationServiceAdapter=void 0;const t=Mt(),e=Ve(),A=ct(),r=qd,i=dI,n=jL(),o=fo,s=YL;let a=class extends A.ServiceRecognizerBase{constructor(u,l,g,h,p){super(u,l,g,h,p),this.privConnectionConfigPromise=void 0,this.privLastPartialUtteranceId="",this.privConversationServiceConnector=p,this.privConversationAuthentication=u,this.receiveMessageOverride=()=>this.receiveConversationMessageOverride(),this.recognizeOverride=()=>this.noOp(),this.postConnectImplOverride=C=>this.conversationConnectImpl(C),this.configConnectionOverride=()=>this.configConnection(),this.disconnectOverride=()=>this.privDisconnect(),this.privConversationRequestSession=new i.ConversationRequestSession((0,t.createNoDashGuid)()),this.privConversationConnectionFactory=l,this.privConversationIsDisposed=!1}isDisposed(){return super.isDisposed()||this.privConversationIsDisposed}async dispose(u){this.privConversationIsDisposed=!0,this.privConnectionConfigPromise!==void 0&&await(await this.privConnectionConfigPromise).dispose(u),await super.dispose(u)}async sendMessage(u){return(await this.fetchConnection()).send(new r.ConversationConnectionMessage(t.MessageType.Text,u))}async sendMessageAsync(u){await(await this.fetchConnection()).send(new r.ConversationConnectionMessage(t.MessageType.Text,u))}privDisconnect(){if(!this.terminateMessageLoop)return this.cancelRecognition(this.privConversationRequestSession.sessionId,this.privConversationRequestSession.requestId,e.CancellationReason.Error,e.CancellationErrorCode.NoError,"Disconnecting"),this.terminateMessageLoop=!0,Promise.resolve()}async processTypeSpecificMessages(){return!0}cancelRecognition(u,l,g,h,p){this.terminateMessageLoop=!0;const C=new e.ConversationTranslationCanceledEventArgs(g,p,h,void 0,u);try{this.privConversationServiceConnector.canceled&&this.privConversationServiceConnector.canceled(this.privConversationServiceConnector,C)}catch{}}async conversationConnectImpl(u){return this.privConnectionLoop=this.startMessageLoop(),u}async receiveConversationMessageOverride(){if(this.isDisposed()||this.terminateMessageLoop)return Promise.resolve();const u=new t.Deferred;try{const g=await(await this.fetchConnection()).read();if(this.isDisposed()||this.terminateMessageLoop)return u.resolve(),Promise.resolve();if(!g)return this.receiveConversationMessageOverride();const h=this.privConversationRequestSession.sessionId,p=g.conversationMessageType.toLowerCase();let C=!1;try{switch(p){case"info":case"participant_command":case"command":const B=s.CommandResponsePayload.fromJSON(g.textBody);switch(B.command.toLowerCase()){case"participantlist":const N=s.ParticipantsListPayloadResponse.fromJSON(g.textBody),P=N.participants.map(G=>({avatar:G.avatar,displayName:G.nickname,id:G.participantId,isHost:G.ishost,isMuted:G.ismuted,isUsingTts:G.usetts,preferredLanguage:G.locale}));this.privConversationServiceConnector.participantsListReceived&&this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector,new n.ParticipantsListEventArgs(N.roomid,N.token,N.translateTo,N.profanityFilter,N.roomProfanityFilter,N.roomLocked,N.muteAll,P,h));break;case"settranslatetolanguages":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(B.participantId,o.ConversationTranslatorCommandTypes.setTranslateToLanguages,B.value,h));break;case"setprofanityfiltering":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(B.participantId,o.ConversationTranslatorCommandTypes.setProfanityFiltering,B.value,h));break;case"setmute":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(B.participantId,o.ConversationTranslatorCommandTypes.setMute,B.value,h));break;case"setmuteall":this.privConversationServiceConnector.muteAllCommandReceived&&this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector,new n.MuteAllEventArgs(B.value,h));break;case"roomexpirationwarning":this.privConversationServiceConnector.conversationExpiration&&this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector,new e.ConversationExpirationEventArgs(B.value,this.privConversationRequestSession.sessionId));break;case"setusetts":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(B.participantId,o.ConversationTranslatorCommandTypes.setUseTTS,B.value,h));break;case"setlockstate":this.privConversationServiceConnector.lockRoomCommandReceived&&this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector,new n.LockRoomEventArgs(B.value,h));break;case"changenickname":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(B.participantId,o.ConversationTranslatorCommandTypes.changeNickname,B.value,h));break;case"joinsession":const D=s.ParticipantPayloadResponse.fromJSON(g.textBody),T={avatar:D.avatar,displayName:D.nickname,id:D.participantId,isHost:D.ishost,isMuted:D.ismuted,isUsingTts:D.usetts,preferredLanguage:D.locale};this.privConversationServiceConnector.participantJoinCommandReceived&&this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector,new n.ParticipantEventArgs(T,h));break;case"leavesession":const z={id:B.participantId};this.privConversationServiceConnector.participantLeaveCommandReceived&&this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector,new n.ParticipantEventArgs(z,h));break;case"disconnectsession":const Q={id:B.participantId};break;case"token":const R=new A.CognitiveTokenAuthentication(()=>{const G=B.token;return Promise.resolve(G)},()=>{const G=B.token;return Promise.resolve(G)});this.authentication=R,this.privConversationServiceConnector.onToken(R);break;default:break}break;case"partial":case"final":const E=s.SpeechResponsePayload.fromJSON(g.textBody),v=p==="final"?e.ResultReason.TranslatedParticipantSpeech:e.ResultReason.TranslatingParticipantSpeech,m=new e.ConversationTranslationResult(E.participantId,this.getTranslations(E.translations),E.language,E.id,v,E.recognition,void 0,void 0,g.textBody,void 0);E.isFinal?((m.text!==void 0&&m.text.length>0||E.id===this.privLastPartialUtteranceId)&&(C=!0),C&&this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new n.ConversationReceivedTranslationEventArgs(o.ConversationTranslatorMessageTypes.final,m,h))):m.text!==void 0&&(this.privLastPartialUtteranceId=E.id,this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new n.ConversationReceivedTranslationEventArgs(o.ConversationTranslatorMessageTypes.partial,m,h)));break;case"translated_message":const S=s.TextResponsePayload.fromJSON(g.textBody),O=new e.ConversationTranslationResult(S.participantId,this.getTranslations(S.translations),S.language,void 0,void 0,S.originalText,void 0,void 0,void 0,g.textBody,void 0);this.privConversationServiceConnector.translationReceived&&this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,new n.ConversationReceivedTranslationEventArgs(o.ConversationTranslatorMessageTypes.instantMessage,O,h));break;default:break}}catch{}return this.receiveConversationMessageOverride()}catch{this.terminateMessageLoop=!0}return u.promise}async startMessageLoop(){if(this.isDisposed())return Promise.resolve();this.terminateMessageLoop=!1;const u=this.receiveConversationMessageOverride();try{return await u}catch(l){return this.cancelRecognition(this.privRequestSession?this.privRequestSession.sessionId:"",this.privRequestSession?this.privRequestSession.requestId:"",e.CancellationReason.Error,e.CancellationErrorCode.RuntimeError,l),null}}configConnection(){return this.isDisposed()?Promise.resolve(void 0):this.privConnectionConfigPromise!==void 0?this.privConnectionConfigPromise.then(u=>u.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigPromise=void 0,this.configConnection()):this.privConnectionConfigPromise,()=>(this.privConnectionId=null,this.privConnectionConfigPromise=void 0,this.configConnection())):this.terminateMessageLoop?Promise.resolve(void 0):(this.privConnectionConfigPromise=this.connectImpl().then(u=>u),this.privConnectionConfigPromise)}getTranslations(u){let l;if(u!==void 0){l=new e.Translations;for(const g of u)l.set(g.lang,g.translation)}return l}};return Vd.ConversationServiceAdapter=a,Vd}var zL;function q$(){if(zL)return jc;zL=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.ConversationTranslatorRecognizer=jc.ConversationRecognizerFactory=void 0;const t=ct(),e=Mt(),A=Lt,r=Ve(),i=K$(),n=J$();class o{static fromConfig(c,u,l){return new s(c,u,l)}}jc.ConversationRecognizerFactory=o;let s=class extends r.Recognizer{constructor(c,u,l){const g=u;A.Contracts.throwIfNull(g,"speechConfig");const h=c;A.Contracts.throwIfNull(h,"conversationImpl"),super(l,g.properties,new i.ConversationConnectionFactory),this.privConversation=h,this.privIsDisposed=!1,this.privProperties=g.properties.clone(),this.privConnection=r.Connection.fromRecognizer(this),this.privProperties.getProperty(r.PropertyId.WebWorkerLoadType,"on").toLowerCase()==="on"&&typeof Blob<"u"&&typeof Worker<"u"?(this.privSetTimeout=e.Timeout.setTimeout,this.privClearTimeout=e.Timeout.clearTimeout):typeof window<"u"?(this.privSetTimeout=window.setTimeout.bind(window),this.privClearTimeout=window.clearTimeout.bind(window)):(this.privSetTimeout=setTimeout,this.privClearTimeout=clearTimeout)}set connected(c){this.privConnection.connected=c}set disconnected(c){this.privConnection.disconnected=c}get speechRecognitionLanguage(){return this.privSpeechRecognitionLanguage}get properties(){return this.privProperties}isDisposed(){return this.privIsDisposed}connect(c,u,l){try{A.Contracts.throwIfDisposed(this.privIsDisposed),A.Contracts.throwIfNullOrWhitespace(c,"token"),this.privReco.conversationTranslatorToken=c,this.resetConversationTimeout(),this.privReco.connectAsync(u,l)}catch(g){if(l)if(g instanceof Error){const h=g;l(h.name+": "+h.message)}else l(g)}}disconnect(c,u){try{A.Contracts.throwIfDisposed(this.privIsDisposed),this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privReco.disconnect().then(()=>{c&&c()},l=>{u&&u(l)})}catch(l){if(u)if(l instanceof Error){const g=l;u(g.name+": "+g.message)}else u(l);this.dispose(!0).catch(g=>{e.Events.instance.onEvent(new e.BackgroundEvent(g))})}}sendRequest(c,u,l){try{A.Contracts.throwIfDisposed(this.privIsDisposed),this.sendMessage(c,u,l)}catch(g){if(l)if(g instanceof Error){const h=g;l(h.name+": "+h.message)}else l(g);this.dispose(!0).catch(h=>{e.Events.instance.onEvent(new e.BackgroundEvent(h))})}}onToken(c){this.privConversation.onToken(c)}async close(){this.privIsDisposed||(this.privConnection&&(this.privConnection.closeConnection(),this.privConnection.close()),this.privConnection=void 0,await this.dispose(!0))}async dispose(c){this.privIsDisposed||c&&(this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privIsDisposed=!0,this.privConnection&&(this.privConnection.closeConnection(),this.privConnection.close(),this.privConnection=void 0),await super.dispose(c))}createRecognizerConfig(c){return new t.RecognizerConfig(c,this.privProperties)}createServiceRecognizer(c,u,l,g){const h=l;return new n.ConversationServiceAdapter(c,u,h,g,this)}sendMessage(c,u,l){const g=this.privReco;((p,C,B)=>{p!==void 0?p.then(()=>{try{C&&C()}catch(E){B&&B(`'Unhandled error on promise callback: ${E}'`)}},E=>{try{B&&B(E)}catch{}}):B&&B("Null promise")})(g.sendMessageAsync(c),u,l),this.resetConversationTimeout()}resetConversationTimeout(){this.privTimeoutToken!==void 0&&this.privClearTimeout(this.privTimeoutToken),this.privTimeoutToken=this.privSetTimeout(()=>{this.sendRequest(this.privConversation.getKeepAlive())},6e4)}};return jc.ConversationTranslatorRecognizer=s,jc}var Wd={},JL;function V$(){if(JL)return Wd;JL=1,Object.defineProperty(Wd,"__esModule",{value:!0}),Wd.TranscriberRecognizer=void 0;const t=Mt(),e=Lt,A=Ve(),r=ct(),i=dn;let n=class extends A.Recognizer{constructor(s,a){const c=s;e.Contracts.throwIfNull(c,"speechTranslationConfig");const u=a;e.Contracts.throwIfNull(u,"audioConfigImpl"),e.Contracts.throwIfNullOrWhitespace(c.speechRecognitionLanguage,A.PropertyId[A.PropertyId.SpeechServiceConnection_RecoLanguage]),super(a,c.properties,new r.TranscriberConnectionFactory),this.privDisposedRecognizer=!1,this.isMeetingRecognizer=!1}get speechRecognitionLanguage(){return e.Contracts.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(A.PropertyId.SpeechServiceConnection_RecoLanguage)}get properties(){return this.privProperties}get authorizationToken(){return this.properties.getProperty(A.PropertyId.SpeechServiceAuthorization_Token)}set authorizationToken(s){e.Contracts.throwIfNullOrWhitespace(s,"token"),this.properties.setProperty(A.PropertyId.SpeechServiceAuthorization_Token,s)}set conversation(s){e.Contracts.throwIfNullOrUndefined(s,"Conversation"),this.isMeetingRecognizer=!1,this.privConversation=s}getConversationInfo(){return e.Contracts.throwIfNullOrUndefined(this.privConversation,"Conversation"),this.privConversation.conversationInfo}set meeting(s){e.Contracts.throwIfNullOrUndefined(s,"Meeting"),this.isMeetingRecognizer=!0,this.privMeeting=s}getMeetingInfo(){return e.Contracts.throwIfNullOrUndefined(this.privMeeting,"Meeting"),this.privMeeting.meetingInfo}IsMeetingRecognizer(){return this.isMeetingRecognizer}startContinuousRecognitionAsync(s,a){(0,t.marshalPromiseToCallbacks)(this.startContinuousRecognitionAsyncImpl(i.RecognitionMode.Conversation),s,a)}stopContinuousRecognitionAsync(s,a){(0,t.marshalPromiseToCallbacks)(this.stopContinuousRecognitionAsyncImpl(),s,a)}async close(){this.privDisposedRecognizer||await this.dispose(!0)}async pushConversationEvent(s,a){const c=this.privReco;e.Contracts.throwIfNullOrUndefined(c,"serviceRecognizer"),await c.sendSpeechEventAsync(s,a)}async pushMeetingEvent(s,a){const c=this.privReco;e.Contracts.throwIfNullOrUndefined(c,"serviceRecognizer"),await c.sendMeetingSpeechEventAsync(s,a)}async enforceAudioGating(){const c=(await this.audioConfig.format).channels;if(c===1){if(this.properties.getProperty("f0f5debc-f8c9-4892-ac4b-90a7ab359fd2","false").toLowerCase()!=="true")throw new Error("Single channel audio configuration for MeetingTranscriber is currently under private preview, please contact diarizationrequest@microsoft.com for more details")}else if(c!==8)throw new Error(`Unsupported audio configuration: Detected ${c}-channel audio`)}connectMeetingCallbacks(s){this.isMeetingRecognizer=!0,this.canceled=(a,c)=>{s.canceled&&s.canceled(s,c)},this.recognizing=(a,c)=>{s.transcribing&&s.transcribing(s,c)},this.recognized=(a,c)=>{s.transcribed&&s.transcribed(s,c)},this.sessionStarted=(a,c)=>{s.sessionStarted&&s.sessionStarted(s,c)},this.sessionStopped=(a,c)=>{s.sessionStopped&&s.sessionStopped(s,c)}}disconnectCallbacks(){this.canceled=void 0,this.recognizing=void 0,this.recognized=void 0,this.sessionStarted=void 0,this.sessionStopped=void 0}async dispose(s){this.privDisposedRecognizer||(s&&(this.privDisposedRecognizer=!0,await this.implRecognizerStop()),await super.dispose(s))}createRecognizerConfig(s){return new r.RecognizerConfig(s,this.properties)}createServiceRecognizer(s,a,c,u){const l=c;return new r.TranscriptionServiceRecognizer(s,a,l,u,this)}};return Wd.TranscriberRecognizer=n,Wd}var qL;function W$(){return qL||(qL=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InternalParticipants=t.ConversationTranslatorMessageTypes=t.ConversationTranslatorCommandTypes=t.ParticipantsListEventArgs=t.ParticipantEventArgs=t.ParticipantAttributeEventArgs=t.MuteAllEventArgs=t.LockRoomEventArgs=t.ConversationReceivedTranslationEventArgs=t.TranscriberRecognizer=t.ConversationRecognizerFactory=t.ConversationConnectionConfig=t.ConversationManager=void 0;var e=O$();Object.defineProperty(t,"ConversationManager",{enumerable:!0,get:function(){return e.ConversationManager}});var A=Bl;Object.defineProperty(t,"ConversationConnectionConfig",{enumerable:!0,get:function(){return A.ConversationConnectionConfig}});var r=q$();Object.defineProperty(t,"ConversationRecognizerFactory",{enumerable:!0,get:function(){return r.ConversationRecognizerFactory}});var i=V$();Object.defineProperty(t,"TranscriberRecognizer",{enumerable:!0,get:function(){return i.TranscriberRecognizer}});var n=jL();Object.defineProperty(t,"ConversationReceivedTranslationEventArgs",{enumerable:!0,get:function(){return n.ConversationReceivedTranslationEventArgs}}),Object.defineProperty(t,"LockRoomEventArgs",{enumerable:!0,get:function(){return n.LockRoomEventArgs}}),Object.defineProperty(t,"MuteAllEventArgs",{enumerable:!0,get:function(){return n.MuteAllEventArgs}}),Object.defineProperty(t,"ParticipantAttributeEventArgs",{enumerable:!0,get:function(){return n.ParticipantAttributeEventArgs}}),Object.defineProperty(t,"ParticipantEventArgs",{enumerable:!0,get:function(){return n.ParticipantEventArgs}}),Object.defineProperty(t,"ParticipantsListEventArgs",{enumerable:!0,get:function(){return n.ParticipantsListEventArgs}});var o=fo;Object.defineProperty(t,"ConversationTranslatorCommandTypes",{enumerable:!0,get:function(){return o.ConversationTranslatorCommandTypes}}),Object.defineProperty(t,"ConversationTranslatorMessageTypes",{enumerable:!0,get:function(){return o.ConversationTranslatorMessageTypes}}),Object.defineProperty(t,"InternalParticipants",{enumerable:!0,get:function(){return o.InternalParticipants}})}(T0)),T0}var N0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SynthesisAudioMetadata=t.MetadataType=void 0,function(A){A.WordBoundary="WordBoundary",A.Bookmark="Bookmark",A.Viseme="Viseme",A.SentenceBoundary="SentenceBoundary",A.SessionEnd="SessionEnd",A.AvatarSignal="TalkingAvatarSignal"}(t.MetadataType||(t.MetadataType={}));class e{constructor(r){this.privSynthesisAudioMetadata=JSON.parse(r)}static fromJSON(r){return new e(r)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}t.SynthesisAudioMetadata=e})(N0);var Zd={},bs={};Object.defineProperty(bs,"__esModule",{value:!0}),bs.SynthesisStartedEvent=bs.ConnectingToSynthesisServiceEvent=bs.SynthesisTriggeredEvent=bs.SpeechSynthesisEvent=void 0;const VL=Mt();class fI extends VL.PlatformEvent{constructor(e,A,r=VL.EventType.Info){super(e,r),this.privRequestId=A}get requestId(){return this.privRequestId}}bs.SpeechSynthesisEvent=fI;class Z$ extends fI{constructor(e,A,r){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=A,this.privTurnAudioDestinationId=r}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}bs.SynthesisTriggeredEvent=Z$;class X$ extends fI{constructor(e,A){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=A}get authFetchEventId(){return this.privAuthFetchEventId}}bs.ConnectingToSynthesisServiceEvent=X$;class _$ extends fI{constructor(e,A){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=A}get authFetchEventId(){return this.privAuthFetchEventId}}bs.SynthesisStartedEvent=_$;var WL;function $$(){if(WL)return Zd;WL=1,Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.SynthesisTurn=void 0;const t=Mt(),e=oi,A=Ve(),r=N0,i=bs;let n=class AR{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=(0,t.createNoDashGuid)(),this.privTurnDeferral=new t.Deferred,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(s){this.privStreamId=s}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(s){this.privAudioOutputFormat=s}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get currentSentenceOffset(){return this.privSentenceOffset}get bytesReceived(){return this.privBytesReceived}get audioDuration(){return this.privAudioDuration}get extraProperties(){if(this.privWebRTCSDP){const s=new A.PropertyCollection;return s.setProperty(A.PropertyId.TalkingAvatarService_WebRTC_SDP,this.privWebRTCSDP),s}}async getAllReceivedAudio(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(await this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}async getAllReceivedAudioWithHeader(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const s=await this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=this.audioOutputFormat.addHeader(s),this.privReceivedAudioWithHeader}else return this.getAllReceivedAudio()}startNewSynthesis(s,a,c,u){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=s,this.privRawText=a,this.privIsSSML=c,this.privAudioOutputStream=new e.PullAudioOutputStreamImpl,this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privPartialVisemeAnimation="",this.privWebRTCSDP="",u!==void 0&&(this.privTurnAudioDestination=u,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new i.SynthesisTriggeredEvent(this.requestId,void 0,u===void 0?void 0:u.id()))}onPreConnectionStart(s){this.privAuthFetchEventId=s,this.onEvent(new i.ConnectingToSynthesisServiceEvent(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(s){s&&this.onComplete()}onConnectionEstablishCompleted(s){if(s===200){this.onEvent(new i.SynthesisStartedEvent(this.requestId,this.privAuthFetchEventId)),this.privBytesReceived=0;return}else s===403&&this.onComplete()}onServiceResponseMessage(s){const a=JSON.parse(s);this.streamId=a.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}onServiceTurnStartResponse(s){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch(()=>{})),this.privInTurn=!0,this.privTurnDeferral=new t.Deferred;const a=JSON.parse(s);a.webrtc&&(this.privWebRTCSDP=a.webrtc.connectionString)}onAudioChunkReceived(s){this.isSynthesizing&&(this.privAudioOutputStream.write(s),this.privBytesReceived+=s.byteLength,this.privTurnAudioDestination!==void 0&&this.privTurnAudioDestination.write(s))}onTextBoundaryEvent(s){this.updateTextOffset(s.Data.text.Text,s.Type)}onVisemeMetadataReceived(s){s.Data.AnimationChunk!==void 0&&(this.privPartialVisemeAnimation+=s.Data.AnimationChunk)}onSessionEnd(s){this.privAudioDuration=s.Data.Offset}async constructSynthesisResult(){const s=await this.getAllReceivedAudioWithHeader();return new A.SpeechSynthesisResult(this.requestId,A.ResultReason.SynthesizingAudioCompleted,s,void 0,this.extraProperties,this.audioDuration)}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const s=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",s}onEvent(s){t.Events.instance.onEvent(s)}static isXmlTag(s){return s.length>=2&&s[0]==="<"&&s[s.length-1]===">"}updateTextOffset(s,a){a===r.MetadataType.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(s,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+s.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!AR.isXmlTag(s)&&this.updateTextOffset(s,a))):(this.privSentenceOffset=this.privRawText.indexOf(s,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+s.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!AR.isXmlTag(s)&&this.updateTextOffset(s,a)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,this.privTurnAudioDestination!==void 0&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}async readAllAudioFromStream(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{await this.privAudioOutputStream.read(this.privReceivedAudio)}catch{this.privReceivedAudio=new ArrayBuffer(0)}}}withinXmlTag(s){return this.privRawText.indexOf("<",s+1)>this.privRawText.indexOf(">",s+1)}};return Zd.SynthesisTurn=n,Zd}var Xd={},ZL;function eee(){if(ZL)return Xd;ZL=1,Object.defineProperty(Xd,"__esModule",{value:!0}),Xd.SynthesisAdapterBase=void 0;const t=Mt(),e=Ve(),A=ct(),r=ho;let i=class{constructor(o,s,a,c){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!o)throw new t.ArgumentNullError("authentication");if(!s)throw new t.ArgumentNullError("connectionFactory");if(!a)throw new t.ArgumentNullError("synthesizerConfig");this.privAuthentication=o,this.privConnectionFactory=s,this.privSynthesizerConfig=a,this.privIsDisposed=!1,this.privSessionAudioDestination=c,this.privSynthesisTurn=new A.SynthesisTurn,this.privConnectionEvents=new t.EventSource,this.privServiceEvents=new t.EventSource,this.privSynthesisContext=new A.SynthesisContext,this.privAgentConfig=new A.AgentConfig,this.connectionEvents.attach(u=>{if(u.name==="ConnectionClosedEvent"){const l=u;l.statusCode!==1e3&&this.cancelSynthesisLocal(e.CancellationReason.Error,l.statusCode===1007?e.CancellationErrorCode.BadRequestParameters:e.CancellationErrorCode.ConnectionFailure,`${l.reason} websocket error code: ${l.statusCode}`)}})}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(o){this.privActivityTemplate=o}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(o){this.privAudioOutputFormat=o,this.privSynthesisTurn.audioOutputFormat=o,this.privSessionAudioDestination!==void 0&&(this.privSessionAudioDestination.format=o),this.synthesisContext!==void 0&&(this.synthesisContext.audioOutputFormat=o)}isDisposed(){return this.privIsDisposed}async dispose(o){this.privIsDisposed=!0,this.privSessionAudioDestination!==void 0&&this.privSessionAudioDestination.close(),this.privConnectionConfigurationPromise!==void 0&&await(await this.privConnectionConfigurationPromise).dispose(o)}async connect(){await this.connectImpl()}async sendNetworkMessage(o,s){const a=typeof s=="string"?t.MessageType.Text:t.MessageType.Binary,c=typeof s=="string"?"application/json":"";return(await this.fetchConnection()).send(new r.SpeechConnectionMessage(a,o,this.privSynthesisTurn.requestId,c,s))}async Speak(o,s,a,c,u,l){let g;if(s?g=o:g=this.privSynthesizer.buildSsml(o),this.speakOverride!==void 0)return this.speakOverride(g,a,c,u);this.privSuccessCallback=c,this.privErrorCallback=u,this.privSynthesisTurn.startNewSynthesis(a,o,s,l);try{await this.connectImpl();const h=await this.fetchConnection();await this.sendSynthesisContext(h),await this.sendSsmlMessage(h,g,a),this.onSynthesisStarted(a),this.receiveMessage()}catch(h){return this.cancelSynthesisLocal(e.CancellationReason.Error,e.CancellationErrorCode.ConnectionFailure,h),Promise.reject(h)}}async stopSpeaking(){return await this.connectImpl(),(await this.fetchConnection()).send(new r.SpeechConnectionMessage(t.MessageType.Text,"synthesis.control",this.privSynthesisTurn.requestId,"application/json",JSON.stringify({action:"stop"})))}cancelSynthesis(o,s,a,c){const u=new e.PropertyCollection;u.setProperty(A.CancellationErrorCodePropertyName,e.CancellationErrorCode[a]);const l=new e.SpeechSynthesisResult(o,e.ResultReason.Canceled,void 0,c,u);if(this.onSynthesisCancelled(l),this.privSuccessCallback)try{this.privSuccessCallback(l)}catch{}}cancelSynthesisLocal(o,s,a){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,o,s,a))}processTypeSpecificMessages(o){return!0}async receiveMessage(){try{const s=await(await this.fetchConnection()).read();if(this.receiveMessageOverride!==void 0)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!s)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const a=r.SpeechConnectionMessage.fromConnectionMessage(s);if(a.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(a.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse(a.textBody);break;case"response":this.privSynthesisTurn.onServiceResponseMessage(a.textBody);break;case"audio":this.privSynthesisTurn.streamId.toLowerCase()===a.streamId.toLowerCase()&&a.binaryBody&&(this.privSynthesisTurn.onAudioChunkReceived(a.binaryBody),this.onSynthesizing(a.binaryBody),this.privSessionAudioDestination!==void 0&&this.privSessionAudioDestination.write(a.binaryBody));break;case"audio.metadata":const c=A.SynthesisAudioMetadata.fromJSON(a.textBody).Metadata;for(const l of c)switch(l.Type){case A.MetadataType.WordBoundary:case A.MetadataType.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(l);const g=new e.SpeechSynthesisWordBoundaryEventArgs(l.Data.Offset,l.Data.Duration,l.Data.text.Text,l.Data.text.Length,l.Type===A.MetadataType.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,l.Data.text.BoundaryType);this.onWordBoundary(g);break;case A.MetadataType.Bookmark:const h=new e.SpeechSynthesisBookmarkEventArgs(l.Data.Offset,l.Data.Bookmark);this.onBookmarkReached(h);break;case A.MetadataType.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(l),l.Data.IsLastAnimation){const p=new e.SpeechSynthesisVisemeEventArgs(l.Data.Offset,l.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());this.onVisemeReceived(p)}break;case A.MetadataType.AvatarSignal:this.onAvatarEvent(l);break;case A.MetadataType.SessionEnd:this.privSynthesisTurn.onSessionEnd(l);break}break;case"turn.end":this.privSynthesisTurn.onServiceTurnEndResponse();let u;try{u=await this.privSynthesisTurn.constructSynthesisResult(),this.privSuccessCallback&&this.privSuccessCallback(u)}catch(l){this.privErrorCallback&&this.privErrorCallback(l)}this.onSynthesisCompleted(u);break;default:this.processTypeSpecificMessages(a)||this.privServiceEvents&&this.serviceEvents.onEvent(new t.ServiceEvent(a.path.toLowerCase(),a.textBody))}return this.receiveMessage()}catch{}}sendSynthesisContext(o){this.setSynthesisContextSynthesisSection();const s=this.synthesisContext.toJSON();if(s)return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",s))}setSpeechConfigSynthesisSection(){}connectImpl(o=!1){if(this.privConnectionPromise!=null)return this.privConnectionPromise.then(a=>a.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise,()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()));this.privAuthFetchEventId=(0,t.createNoDashGuid)(),this.privConnectionId=(0,t.createNoDashGuid)(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const s=o?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=s.then(async a=>{this.privSynthesisTurn.onAuthCompleted(!1);const c=await this.privConnectionFactory.create(this.privSynthesizerConfig,a,this.privConnectionId);c.events.attach(l=>{this.connectionEvents.onEvent(l)});const u=await c.open();return u.statusCode===200?(this.privSynthesisTurn.onConnectionEstablishCompleted(u.statusCode),Promise.resolve(c)):u.statusCode===403&&!o?this.connectImpl(!0):(this.privSynthesisTurn.onConnectionEstablishCompleted(u.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${u.statusCode},
|
|
35
|
-
${this.privSynthesizerConfig.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Url)} Reason: ${u.reason}`))},a=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(a)}),this.privConnectionPromise.catch(()=>{}),this.privConnectionPromise}sendSpeechServiceConfig(o,s){if(s)return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",s))}sendSsmlMessage(o,s,a){return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"ssml",a,"application/ssml+xml",s))}async fetchConnection(){return this.privConnectionConfigurationPromise!==void 0?this.privConnectionConfigurationPromise.then(o=>o.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()):this.privConnectionConfigurationPromise,()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection())):(this.privConnectionConfigurationPromise=this.configureConnection(),await this.privConnectionConfigurationPromise)}async configureConnection(){const o=await this.connectImpl();return this.configConnectionOverride!==void 0?this.configConnectionOverride(o):(this.setSpeechConfigSynthesisSection(),await this.sendSpeechServiceConfig(o,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),o)}onAvatarEvent(o){}onSynthesisStarted(o){}onSynthesizing(o){}onSynthesisCancelled(o){}onSynthesisCompleted(o){}onWordBoundary(o){}onVisemeReceived(o){}onBookmarkReached(o){}};return Xd.SynthesisAdapterBase=i,i.telemetryDataEnabled=!0,Xd}var _d={},XL;function tee(){if(XL)return _d;XL=1,Object.defineProperty(_d,"__esModule",{value:!0}),_d.AvatarSynthesisAdapter=void 0;const t=Ve(),e=ct();let A=class extends e.SynthesisAdapterBase{constructor(i,n,o,s,a){super(i,n,o,void 0),this.privAvatarSynthesizer=s,this.privSynthesizer=s,this.privAvatarConfig=a}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(void 0)}setSpeechConfigSynthesisSection(){var i,n,o,s,a,c,u,l,g,h,p,C,B,E,v,m,S;this.privSynthesizerConfig.synthesisVideoSection={format:{bitrate:(i=this.privAvatarConfig.videoFormat)==null?void 0:i.bitrate,codec:(n=this.privAvatarConfig.videoFormat)==null?void 0:n.codec,crop:{bottomRight:{x:(a=(s=(o=this.privAvatarConfig.videoFormat)==null?void 0:o.cropRange)==null?void 0:s.bottomRight)==null?void 0:a.x,y:(l=(u=(c=this.privAvatarConfig.videoFormat)==null?void 0:c.cropRange)==null?void 0:u.bottomRight)==null?void 0:l.y},topLeft:{x:(p=(h=(g=this.privAvatarConfig.videoFormat)==null?void 0:g.cropRange)==null?void 0:h.topLeft)==null?void 0:p.x,y:(E=(B=(C=this.privAvatarConfig.videoFormat)==null?void 0:C.cropRange)==null?void 0:B.topLeft)==null?void 0:E.y}},resolution:{height:(v=this.privAvatarConfig.videoFormat)==null?void 0:v.height,width:(m=this.privAvatarConfig.videoFormat)==null?void 0:m.width}},protocol:{name:"WebRTC",webrtcConfig:{clientDescription:btoa(this.privSynthesizerConfig.parameters.getProperty(t.PropertyId.TalkingAvatarService_WebRTC_SDP)),iceServers:this.privAvatarConfig.remoteIceServers??this.privAvatarSynthesizer.iceServers}},talkingAvatar:{background:{color:this.privAvatarConfig.backgroundColor,image:{url:(S=this.privAvatarConfig.backgroundImage)==null?void 0:S.toString()}},character:this.privAvatarConfig.character,customized:this.privAvatarConfig.customized,style:this.privAvatarConfig.style,useBuiltInVoice:this.privAvatarConfig.useBuiltInVoice}}}onAvatarEvent(i){if(this.privAvatarSynthesizer.avatarEventReceived){const n=new t.AvatarEventArgs(i.Data.Offset,i.Data.Name);try{this.privAvatarSynthesizer.avatarEventReceived(this.privAvatarSynthesizer,n)}catch{}}}};return _d.AvatarSynthesisAdapter=A,_d}var $d={},_L;function Aee(){if(_L)return $d;_L=1,Object.defineProperty($d,"__esModule",{value:!0}),$d.SpeechSynthesisAdapter=void 0;const t=Ve(),e=ct();let A=class extends e.SynthesisAdapterBase{constructor(i,n,o,s,a){super(i,n,o,a),this.privSpeechSynthesizer=s,this.privSynthesizer=s}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer)}onSynthesisStarted(i){const n=new t.SpeechSynthesisEventArgs(new t.SpeechSynthesisResult(i,t.ResultReason.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,n)}onSynthesizing(i){if(this.privSpeechSynthesizer.synthesizing)try{const n=this.privSynthesisTurn.audioOutputFormat.addHeader(i),o=new t.SpeechSynthesisEventArgs(new t.SpeechSynthesisResult(this.privSynthesisTurn.requestId,t.ResultReason.SynthesizingAudio,n));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,o)}catch{}}onSynthesisCancelled(i){if(this.privSpeechSynthesizer.SynthesisCanceled){const n=new t.SpeechSynthesisEventArgs(i);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,n)}catch{}}}onSynthesisCompleted(i){if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new t.SpeechSynthesisEventArgs(i))}catch{}}onWordBoundary(i){if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,i)}catch{}}onVisemeReceived(i){if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,i)}catch{}}onBookmarkReached(i){if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch{}}};return $d.SpeechSynthesisAdapter=A,$d}var ep={},$L;function ree(){if($L)return ep;$L=1,Object.defineProperty(ep,"__esModule",{value:!0}),ep.SynthesisRestAdapter=void 0;const t=qr(),e=Ve(),A=ls(),r=Jr;let i=class{constructor(o,s){let a=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Endpoint,void 0);if(!a){const u=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Region,"westus"),l=A.ConnectionFactoryBase.getHostSuffix(u);a=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Host,`https://${u}.tts.speech${l}`)}this.privUri=`${a}/cognitiveservices/voices/list`;const c=t.RestConfigBase.requestOptions;this.privRestAdapter=new t.RestMessageAdapter(c),this.privAuthentication=s}getVoicesList(o){return this.privRestAdapter.setHeaders(r.HeaderNames.ConnectionId,o),this.privAuthentication.fetch(o).then(s=>(this.privRestAdapter.setHeaders(s.headerName,s.token),this.privRestAdapter.request(t.RestRequestType.Get,this.privUri)))}};return ep.SynthesisRestAdapter=i,ep}var K0={},eF;function iee(){return eF||(eF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SynthesizerConfig=t.SynthesisServiceType=void 0;const e=ct();var A;(function(i){i[i.Standard=0]="Standard",i[i.Custom=1]="Custom"})(A=t.SynthesisServiceType||(t.SynthesisServiceType={}));class r{constructor(n,o){this.privSynthesisServiceType=A.Standard,this.avatarEnabled=!1,this.privSpeechServiceConfig=n||new e.SpeechServiceConfig(new e.Context(null)),this.privParameters=o}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(n){this.privSynthesisServiceType=n}set synthesisVideoSection(n){this.privSpeechServiceConfig.Context.synthesis={video:n}}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}t.SynthesizerConfig=r}(K0)),K0}var tp={},tF;function nee(){if(tF)return tp;tF=1,Object.defineProperty(tp,"__esModule",{value:!0}),tp.SynthesisContext=void 0;const t=Ve();let e=class{constructor(){this.privContext={}}setSection(r,i){this.privContext[r]=i}set audioOutputFormat(r){this.privAudioOutputFormat=r}toJSON(){return JSON.stringify(this.privContext)}setSynthesisSection(r){const i=this.buildSynthesisContext(r);this.setSection("synthesis",i)}buildSynthesisContext(r){return{audio:{metadataOptions:{bookmarkEnabled:!!(r!=null&&r.bookmarkReached),punctuationBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestPunctuationBoundary,!!(r!=null&&r.wordBoundary)),sentenceBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!(r!=null&&r.visemeReceived),wordBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestWordBoundary,!!(r!=null&&r.wordBoundary))},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:r==null?void 0:r.autoDetectSourceLanguage}}}};return tp.SynthesisContext=e,tp}var Ap={},AF;function see(){if(AF)return Ap;AF=1,Object.defineProperty(Ap,"__esModule",{value:!0}),Ap.SpeakerRecognitionConfig=void 0;const t=ct();let e=class{constructor(r,i){this.privContext=r||new t.Context(null),this.privParameters=i}get parameters(){return this.privParameters}get Context(){return this.privContext}};return Ap.SpeakerRecognitionConfig=e,Ap}var rp={},rF;function oee(){if(rF)return rp;rF=1,Object.defineProperty(rp,"__esModule",{value:!0}),rp.SpeakerServiceRecognizer=void 0;const t=qr(),e=Mt(),A=Ve(),r=ct(),i=ho;let n=class extends r.ServiceRecognizerBase{constructor(s,a,c,u,l){super(s,a,c,u,l),this.privSpeakerRecognizer=l,this.privSpeakerAudioSource=c,this.recognizeSpeaker=g=>this.recognizeSpeakerOnce(g),this.sendPrePayloadJSONOverride=()=>this.noOp()}processTypeSpecificMessages(s){let a=!1;const c=new A.PropertyCollection;switch(s.messageType===e.MessageType.Text&&c.setProperty(A.PropertyId.SpeechServiceResponse_JsonResult,s.textBody),s.path.toLowerCase()){case"speaker.response":const l=JSON.parse(s.textBody);let g;l.status.statusCode.toLowerCase()!=="success"?g=new A.SpeakerRecognitionResult(l,A.ResultReason.Canceled,A.CancellationErrorCode.ServiceError,l.status.reason):g=new A.SpeakerRecognitionResult(l,A.ResultReason.RecognizedSpeaker),this.privResultDeferral&&this.privResultDeferral.resolve(g),a=!0;break}const u=new e.Deferred;return u.resolve(a),u.promise}cancelRecognition(s,a,c,u,l){if(new A.PropertyCollection().setProperty(r.CancellationErrorCodePropertyName,A.CancellationErrorCode[u]),this.privResultDeferral){const h=new A.SpeakerRecognitionResult({scenario:this.privSpeakerModel.scenario,status:{statusCode:l,reason:l}},A.ResultReason.Canceled,u,l);try{this.privResultDeferral.resolve(h)}catch(p){this.privResultDeferral.reject(p)}}}async recognizeSpeakerOnce(s){this.privSpeakerModel=s,this.voiceProfileType=s.scenario,this.privResultDeferral||(this.privResultDeferral=new e.Deferred),this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(A.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const a=this.connectImpl(),c=this.sendPreAudioMessages(this.extractSpeakerContext(s)),u=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),l=await this.privSpeakerAudioSource.format,g=await this.privSpeakerAudioSource.deviceInfo,h=new t.ReplayableAudioNode(u,l.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(h,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:g};try{await a,await c}catch(B){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,B)}const p=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,p),this.receiveMessage(),this.sendAudio(h).then(()=>{},B=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,B)}),this.privResultDeferral.promise}async sendPreAudioMessages(s){const a=await this.fetchConnection();await this.sendSpeakerRecognition(a,s)}async sendSpeakerRecognition(s,a){const c=JSON.stringify(a);return s.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.context",this.privRequestSession.requestId,"application/json; charset=utf-8",c))}extractSpeakerContext(s){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:s.profileIds,scenario:s.scenario}}};return rp.SpeakerServiceRecognizer=n,rp}var ip={},iF;function aee(){if(iF)return ip;iF=1,Object.defineProperty(ip,"__esModule",{value:!0}),ip.VoiceServiceRecognizer=void 0;const t=qr(),e=Mt(),A=Ve(),r=ct(),i=ho;let n=class extends r.ServiceRecognizerBase{constructor(s,a,c,u,l){super(s,a,c,u,l),this.privDeferralMap=new e.DeferralMap,this.privSpeakerAudioSource=c,this.sendPrePayloadJSONOverride=()=>this.noOp()}set SpeakerAudioSource(s){this.privSpeakerAudioSource=s}processTypeSpecificMessages(s){let a=!1;const c=new A.PropertyCollection;switch(s.messageType===e.MessageType.Text&&c.setProperty(A.PropertyId.SpeechServiceResponse_JsonResult,s.textBody),s.path.toLowerCase()){case"speaker.profiles":const l=JSON.parse(s.textBody);switch(l.operation.toLowerCase()){case"create":this.handleCreateResponse(l,s.requestId);break;case"delete":case"reset":this.handleResultResponse(l,s.requestId);break;case"fetch":const C=JSON.parse(s.textBody);this.handleFetchResponse(C,s.requestId);break}a=!0;break;case"speaker.phrases":const g=JSON.parse(s.textBody);this.handlePhrasesResponse(g,s.requestId),a=!0;break;case"speaker.profile.enrollment":const h=JSON.parse(s.textBody),p=new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(h.enrollment?h.enrollment.enrollmentStatus:h.status.statusCode),h.enrollment?JSON.stringify(h.enrollment):void 0,h.status.reason);this.privDeferralMap.getId(s.requestId)&&this.privDeferralMap.complete(s.requestId,p),this.privRequestSession.onSpeechEnded(),a=!0;break}const u=new e.Deferred;return u.resolve(a),u.promise}cancelRecognition(s,a,c,u,l){new A.PropertyCollection().setProperty(r.CancellationErrorCodePropertyName,A.CancellationErrorCode[u]);const h=new A.VoiceProfileEnrollmentResult(A.ResultReason.Canceled,l,l);this.privDeferralMap.getId(a)&&this.privDeferralMap.complete(a,h)}async createProfile(s,a){this.voiceProfileType=s.toString();const c=this.connectImpl();try{const u=new e.Deferred;return await c,await this.sendCreateProfile(u,s,a),this.receiveMessage(),u.promise}catch(u){throw u}}async resetProfile(s){return this.voiceProfileType=s.profileType.toString(),this.sendCommonRequest("reset",s.profileType,s)}async deleteProfile(s){return this.voiceProfileType=s.profileType.toString(),this.sendCommonRequest("delete",s.profileType,s)}async retrieveEnrollmentResult(s){return this.voiceProfileType=s.profileType.toString(),this.privExpectedProfileId=s.profileId,this.sendCommonRequest("fetch",s.profileType,s)}async getAllProfiles(s){return this.voiceProfileType=s.toString(),this.sendCommonRequest("fetch",s)}async getActivationPhrases(s,a){this.voiceProfileType=s.toString();const c=this.connectImpl();try{const u=new e.Deferred;return await c,await this.sendPhrasesRequest(u,s,a),this.receiveMessage(),u.promise}catch(u){throw u}}async enrollProfile(s){this.voiceProfileType=s.profileType.toString();const a=new e.Deferred;this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(A.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const c=this.connectImpl(),u=this.sendPreAudioMessages(s,a),l=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),g=await this.privSpeakerAudioSource.format,h=await this.privSpeakerAudioSource.deviceInfo,p=new t.ReplayableAudioNode(l,g.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(p,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:h};try{await c,await u}catch(E){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,E)}const C=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,C),this.receiveMessage(),this.sendAudio(p).then(()=>{},E=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,E)}),a.promise}async sendPreAudioMessages(s,a){const c=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,a),await this.sendBaseRequest(c,"enroll",this.scenarioFrom(s.profileType),s)}async sendPhrasesRequest(s,a,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,s);const l=this.scenarioFrom(a),g={locale:c,scenario:l};return u.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.profile.phrases",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(g)))}async sendCreateProfile(s,a,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,s);const l=a===A.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":a===A.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification",g={locale:c,number:"1",scenario:l};return u.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.profile.create",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(g)))}async sendCommonRequest(s,a,c=void 0){const u=this.connectImpl();try{const l=new e.Deferred;this.privRequestSession.onSpeechContext(),await u;const g=await this.fetchConnection();return this.privDeferralMap.add(this.privRequestSession.requestId,l),await this.sendBaseRequest(g,s,this.scenarioFrom(a),c),this.receiveMessage(),l.promise}catch(l){throw l}}async sendBaseRequest(s,a,c,u){const l={scenario:c};return u?l.profileIds=[u.profileId]:l.maxPageSize=-1,s.send(new i.SpeechConnectionMessage(e.MessageType.Text,`speaker.profile.${a}`,this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(l)))}extractSpeakerContext(s){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:s.profileIds,scenario:s.scenario}}handlePhrasesResponse(s,a){if(this.privDeferralMap.getId(a))if(s.status.statusCode.toLowerCase()!=="success"){const c=A.ResultReason.Canceled,u=new A.VoiceProfilePhraseResult(c,s.status.statusCode,s.passPhraseType,[]);this.privDeferralMap.complete(a,u)}else if(s.phrases&&s.phrases.length>0){const c=A.ResultReason.EnrollingVoiceProfile,u=new A.VoiceProfilePhraseResult(c,s.status.statusCode,s.passPhraseType,s.phrases);this.privDeferralMap.complete(a,u)}else throw new Error("Voice Profile get activation phrases failed, no phrases received");else throw new Error(`Voice Profile get activation phrases request for requestID ${a} not found`)}handleCreateResponse(s,a){if(s.profiles&&s.profiles.length>0)if(this.privDeferralMap.getId(a)){const c=s.profiles.map(u=>u.profileId);this.privDeferralMap.complete(a,c)}else throw new Error(`Voice Profile create request for requestID ${a} not found`);else throw new Error("Voice Profile create failed, no profile id received")}handleResultResponse(s,a){if(this.privDeferralMap.getId(a)){const c=s.operation.toLowerCase()==="delete"?A.ResultReason.DeletedVoiceProfile:A.ResultReason.ResetVoiceProfile,u=s.status.statusCode.toLowerCase()==="success"?c:A.ResultReason.Canceled,l=new A.VoiceProfileResult(u,`statusCode: ${s.status.statusCode}, errorDetails: ${s.status.reason}`);this.privDeferralMap.complete(a,l)}else throw new Error(`Voice Profile create request for requestID ${a} not found`)}handleFetchResponse(s,a){if(this.privDeferralMap.getId(a)&&s.profiles[0]){if(this.privExpectedProfileId&&s.profiles.length===1&&s.profiles[0].profileId===this.privExpectedProfileId){this.privExpectedProfileId=void 0;const c=s.profiles[0],u=new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(c.enrollmentStatus),JSON.stringify(c),s.status.reason);this.privDeferralMap.complete(a,u)}else if(s.profiles.length>0){const c=s.profiles,u=[];for(const l of c)u.push(new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(l.enrollmentStatus),JSON.stringify(l),s.status.reason));this.privDeferralMap.complete(a,u)}}else throw new Error(`Voice Profile fetch request for requestID ${a} not found`)}enrollmentReasonFrom(s){switch(s.toLowerCase()){case"enrolled":return A.ResultReason.EnrolledVoiceProfile;case"invalidlocale":case"invalidphrase":case"invalidaudioformat":case"invalidscenario":case"invalidprofilecount":case"invalidoperation":case"audiotooshort":case"audiotoolong":case"toomanyenrollments":case"storageconflict":case"profilenotfound":case"incompatibleprofiles":case"incompleteenrollment":return A.ResultReason.Canceled;default:return A.ResultReason.EnrollingVoiceProfile}}scenarioFrom(s){return s===A.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":s===A.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification"}};return ip.VoiceServiceRecognizer=n,ip}var nF={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.connectivity=t.Device=t.OS=t.System=t.Context=t.SpeechServiceConfig=void 0;class e{constructor(s){this.context=s}serialize(){return JSON.stringify(this,(s,a)=>{if(a&&typeof a=="object"&&!Array.isArray(a)){const c={};for(const u in a)Object.hasOwnProperty.call(a,u)&&(c[u&&u.charAt(0).toLowerCase()+u.substring(1)]=a[u]);return c}return a})}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(s){this.recognition=s.toLowerCase()}}t.SpeechServiceConfig=e;class A{constructor(s){this.system=new r,this.os=s}}t.Context=A;class r{constructor(){const s="1.44.0";this.name="SpeechSDK",this.version=s,this.build="JavaScript",this.lang="JavaScript"}}t.System=r;class i{constructor(s,a,c){this.platform=s,this.name=a,this.version=c}}t.OS=i;class n{constructor(s,a,c){this.manufacturer=s,this.model=a,this.version=c}}t.Device=n,function(o){o.Bluetooth="Bluetooth",o.Wired="Wired",o.WiFi="WiFi",o.Cellular="Cellular",o.InBuilt="InBuilt",o.Unknown="Unknown"}(t.connectivity||(t.connectivity={})),function(o){o.Phone="Phone",o.Speaker="Speaker",o.Car="Car",o.Headset="Headset",o.Thermostat="Thermostat",o.Microphones="Microphones",o.Deskphone="Deskphone",o.RemoteControl="RemoteControl",o.Unknown="Unknown",o.File="File",o.Stream="Stream"}(t.type||(t.type={}))})(nF);var sF;function ct(){return sF||(sF=1,function(t){var e=bt&&bt.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return o[s]}})}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),A=bt&&bt.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&e(o,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoDetectSourceLanguagesOpenRangeOptionName=t.ForceDictationPropertyName=t.ServicePropertiesPropertyName=t.CancellationErrorCodePropertyName=t.OutputFormatPropertyName=t.SpeechSynthesisAdapter=t.AvatarSynthesisAdapter=void 0,A(XE,t),A(BC,t),A(pl,t),A(V4,t),A(W4,t),A(Z_(),t),A(X_(),t),A(ZC,t),A(__(),t),A($_(),t),A(e$(),t),A(lL,t),A(XC,t),A(A$(),t),A(r$(),t),A(i$(),t),A(n$(),t),A(YU(),t),A(s$(),t),A(CL,t),A(o$(),t),A(_C,t),A(c$(),t),A(u$(),t),A(eI,t),A(tI,t),A(AI,t),A(l$(),t),A(h$(),t),A(g$(),t),A(d$(),t),A(p$(),t),A(rI,t),A(E$(),t),A(iI,t),A(TL,t),A(nI,t),A(aI,t),A(cI,t),A(U$(),t),A(hI,t),A(W$(),t),A(N0,t),A($$(),t),A(eee(),t);var r=tee();Object.defineProperty(t,"AvatarSynthesisAdapter",{enumerable:!0,get:function(){return r.AvatarSynthesisAdapter}});var i=Aee();Object.defineProperty(t,"SpeechSynthesisAdapter",{enumerable:!0,get:function(){return i.SpeechSynthesisAdapter}}),A(ree(),t),A(iee(),t),A(nee(),t),A(see(),t),A(oee(),t),A(aee(),t),A(nF,t),t.OutputFormatPropertyName="OutputFormat",t.CancellationErrorCodePropertyName="CancellationErrorCode",t.ServicePropertiesPropertyName="ServiceProperties",t.ForceDictationPropertyName="ForceDictation",t.AutoDetectSourceLanguagesOpenRangeOptionName="UND"}(YS)),YS}(function(t){var e=bt&&bt.__createBinding||(Object.create?function(i,n,o,s){s===void 0&&(s=o),Object.defineProperty(i,s,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,s){s===void 0&&(s=o),i[s]=n[o]}),A=bt&&bt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(t,"__esModule",{value:!0});const r=ct();new r.AgentConfig,A(Ve(),t)})(xs);const ai=[];for(let t=0;t<256;++t)ai.push((t+256).toString(16).slice(1));function cee(t,e=0){return(ai[t[e+0]]+ai[t[e+1]]+ai[t[e+2]]+ai[t[e+3]]+"-"+ai[t[e+4]]+ai[t[e+5]]+"-"+ai[t[e+6]]+ai[t[e+7]]+"-"+ai[t[e+8]]+ai[t[e+9]]+"-"+ai[t[e+10]]+ai[t[e+11]]+ai[t[e+12]]+ai[t[e+13]]+ai[t[e+14]]+ai[t[e+15]]).toLowerCase()}let k0;const uee=new Uint8Array(16);function lee(){if(!k0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");k0=crypto.getRandomValues.bind(crypto)}return k0(uee)}const oF={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hee(t,e,A){var i;if(oF.randomUUID&&!e&&!t)return oF.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??lee();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(A=A||0,A<0||A+16>e.length)throw new RangeError(`UUID byte range ${A}:${A+15} is out of buffer bounds`);for(let n=0;n<16;++n)e[A+n]=r[n];return e}return cee(r)}const Sl=Or(),Eo=aA(),ml=ne(""),Hc=ne(""),ma=ne(""),pn=ne("");let Co=null,P0=[];const aF=ne("");let Ma=null;const cF=4e3;Ki(async()=>{Eo.authToken=await CI()});let cr=null,Ml=null,Ns=null,EI=null;const Io=()=>{Ns&&Ns.mute(),cr&&(cr.close(),cr=null),Ml=null},CI=async()=>{var t,e,A;try{const r=await Nn("/voiceTesting");return(t=r==null?void 0:r.data)==null?void 0:t.token}catch(r){if(console.error(r),Wt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Sl.setError(((A=i.response)==null?void 0:A.data).message)}else Sl.setError("There was an issue while fetching data")}},yl=()=>{Ma&&clearTimeout(Ma),EI&&(EI.stopContinuousRecognitionAsync(()=>{},t=>{console.error("Error stopping recognition",t)}),EI=null),Co&&Co.state!=="inactive"&&Co.stop()},gee=async t=>(Eo.authToken=await CI(),await Io(),new Promise((e,A)=>{const r=xs.SpeechConfig.fromAuthorizationToken(Eo.authToken,"eastus2");r.speechSynthesisVoiceName="en-US-EmmaMultilingualNeural",Ns=new xs.SpeakerAudioDestination;const i=xs.AudioConfig.fromSpeakerOutput(Ns);cr=new xs.SpeechSynthesizer(r,i);const n=hee();Ml=n,cr.speakTextAsync(t,o=>{if(n!==Ml)return Ns==null||Ns.mute(),cr==null||cr.close(),cr=null,e();o.reason===xs.ResultReason.SynthesizingAudioCompleted?e():A(new Error("Speech synthesis failed")),cr==null||cr.close(),cr=null,Ml=null},o=>{if(n!==Ml)return Ns==null||Ns.mute(),cr==null||cr.close(),cr=null,e();cr==null||cr.close(),cr=null,Ml=null,A(o)})})),dee=async t=>{Eo.authToken=await CI();const e=xs.SpeechConfig.fromAuthorizationToken(Eo.authToken,"eastus2");e.speechRecognitionLanguage="en-US";const A=xs.AudioConfig.fromDefaultMicrophoneInput(),r=new xs.SpeechRecognizer(e,A);return EI=r,ml.value="",Hc.value="",await hF(),r.recognizing=(i,n)=>{n.result.text&&n.result.text.trim()&&(ml.value=n.result.text.trim(),Io(),Eo.userspeaking=!0,Eo.userSpeechText=(Hc.value?Hc.value+" ":"")+ml.value,pn.value="user",Ma&&clearTimeout(Ma),Ma=setTimeout(()=>{ml.value&&(t(ml.value.trim()),ml.value="")},cF))},r.recognized=async(i,n)=>{if(n.result.reason===xs.ResultReason.RecognizedSpeech&&n.result.text&&n.result.text.trim()){Hc.value+=" "+n.result.text.trim(),Ma&&clearTimeout(Ma),Ma=setTimeout(async()=>{Hc.value&&(t(Hc.value),console.log("Audio stop recording"),Hc.value="")},cF);const o=await pee();console.log("Audio sentiment:",o)}},r.canceled=async(i,n)=>{console.error("Recognition canceled:",n),console.log("Audio stop recording")},r.startContinuousRecognitionAsync(),r},uF=async()=>{var t,e;ma.value="",aF.value="";try{Io(),await dee(A=>{if(A){ma.value=A;const r=hF()}})}catch(A){if(console.error(A),Wt.isAxiosError(A)){const r=A;console.log("Error found!"),console.error((t=r.response)==null?void 0:t.data),Sl.setError(((e=r.response)==null?void 0:e.data).message)}else Sl.setError("There was an issue while fetching data")}},lF=async t=>{var e,A;aF.value="";try{(pn.value=="user"||pn.value=="listening")&&Io(),await gee(t)}catch(r){if(console.error(r),Wt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Sl.setError(((A=i.response)==null?void 0:A.data).message)}else Sl.setError("There was an issue while fetching data")}};async function hF(){try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});Co=new MediaRecorder(t,{mimeType:"audio/webm"}),Co.ondataavailable=e=>{e.data.size>0&&P0.push(e.data)},Co.start(),console.log("Audio recording started")}catch(t){console.error("Error starting audio recording:",t)}}async function pee(){return new Promise((t,e)=>{if(!Co)return e("No active recorder found");Co.onstop=async()=>{const A=new Blob(P0,{type:"audio/webm"});P0=[];try{const i=await(await fee(A)).arrayBuffer();console.log("Audio recording stopped, size:",i.byteLength),console.log("Audio recording stopped, size:",i),console.log("Sending audio for analysis...");const o={audio:await Eee(i),format:"wav",finalAnalysis:!1},s=await Wt.post("/fetchPdfAssessment",o,{headers:{"Content-Type":"application/json"}});console.log("Server response:",s.data),Eo.audioAnaysis.push(s.data),console.log("store audioAnaysis",Eo.audioAnaysis),console.log("Audio analysis result:",s.data),t(s.data)}catch(r){e(r)}},Co.stop(),console.log("Audio recording stopped")})}async function fee(t){const e=await t.arrayBuffer(),r=await new AudioContext().decodeAudioData(e),i=r.numberOfChannels,n=r.sampleRate,o=r.length*i*2+44,s=new ArrayBuffer(o),a=new DataView(s);u(a,0,"RIFF"),a.setUint32(4,36+r.length*i*2,!0),u(a,8,"WAVE"),u(a,12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,i,!0),a.setUint32(24,n,!0),a.setUint32(28,n*i*2,!0),a.setUint16(32,i*2,!0),a.setUint16(34,16,!0),u(a,36,"data"),a.setUint32(40,r.length*i*2,!0);let c=44;for(let l=0;l<r.length;l++)for(let g=0;g<i;g++){const h=Math.max(-1,Math.min(1,r.getChannelData(g)[l]));a.setInt16(c,h<0?h*32768:h*32767,!0),c+=2}function u(l,g,h){for(let p=0;p<h.length;p++)l.setUint8(g+p,h.charCodeAt(p))}return new Blob([a],{type:"audio/wav"})}function Eee(t){let e="";const A=new Uint8Array(t),r=32768;for(let i=0;i<A.length;i+=r){const n=A.subarray(i,i+r);e+=String.fromCharCode(...Array.from(n))}return btoa(e)}const Cee={class:"flex items-center gap-4 py-2 rounded-full z-10"},Iee={key:0,class:"flex items-center"},Bee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},vee=[Zu('<rect x="0" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0s"></animate></rect><rect x="4" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.1s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.1s"></animate></rect><rect x="8" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate></rect><rect x="12" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.3s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.3s"></animate></rect><rect x="16" y="4" width="2" height="16" rx="1"><animate attributeName="height" values="16;20;16" dur="1s" repeatCount="indefinite" begin="0.4s"></animate><animate attributeName="y" values="4;2;4" dur="1s" repeatCount="indefinite" begin="0.4s"></animate></rect><rect x="20" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.5s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.5s"></animate></rect><rect x="24" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate></rect><rect x="28" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.7s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.7s"></animate></rect><rect x="32" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0.8s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0.8s"></animate></rect>',9)],wee={key:1,class:"flex items-center"},See={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},mee=[Zu('<rect x="0" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0s"></animate></rect><rect x="4" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.1s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.1s"></animate></rect><rect x="8" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate></rect><rect x="12" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.3s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.3s"></animate></rect><rect x="16" y="4" width="2" height="16" rx="1"><animate attributeName="height" values="16;20;16" dur="1s" repeatCount="indefinite" begin="0.4s"></animate><animate attributeName="y" values="4;2;4" dur="1s" repeatCount="indefinite" begin="0.4s"></animate></rect><rect x="20" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.5s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.5s"></animate></rect><rect x="24" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate></rect><rect x="28" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.7s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.7s"></animate></rect><rect x="32" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0.8s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0.8s"></animate></rect>',9)],Mee={key:2,class:"flex items-center"},yee=[Zu('<svg width="30" height="30" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="12" y="16" width="40" height="32" rx="8" fill="white" stroke="#9CA3AF" stroke-width="2"></rect><circle cx="24" cy="32" r="4" fill="black"></circle><circle cx="40" cy="32" r="4" fill="black"></circle><line x1="32" y1="10" x2="32" y2="16" stroke="#9CA3AF" stroke-width="2"></line><circle cx="32" cy="8" r="2" fill="white"></circle><circle cx="52" cy="14" r="3" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0s" repeatCount="indefinite"></animate></circle><circle cx="58" cy="10" r="2.5" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0.2s" repeatCount="indefinite"></animate></circle><circle cx="63" cy="6" r="2" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0.4s" repeatCount="indefinite"></animate></circle></svg>',1)],Qee={class:"tooltiptext text-genpact-darkest-teal"},Ree=[M("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[M("path",{d:"M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 14 0h-2zm-5 9a7 7 0 0 0 7-7h2a9 9 0 0 1-8 8.94V22h-2v-1.06A9 9 0 0 1 3 13h2a7 7 0 0 0 7 7z"})],-1)],Dee=[M("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[M("path",{d:"M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 14 0h-2zm-5 9a7 7 0 0 0 7-7h2a9 9 0 0 1-8 8.94V22h-2v-1.06A9 9 0 0 1 3 13h2a7 7 0 0 0 7 7z"}),M("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor","stroke-width":"2"})],-1)],Tee=Vt({__name:"NewVoiceConversation",setup(t){const e=aA(),A=Or(),r=ne(""),i=ne(!1),n=ne("Turn on mic"),o=()=>{i.value===!1?e.elevenLabs?(console.log("mic enabled true 11labs"),i.value=!0,ZE(),pn.value="user",n.value="Turn off mic"):(console.log("mic enabled true"),i.value=!0,Io(),uF(),pn.value="user",n.value="Turn off mic"):e.elevenLabs?(console.log("mic enabled false"),hl(),i.value=!1,n.value="Turn on mic"):(console.log("mic enabled false"),yl(),i.value=!1,n.value="Turn on mic")},s=()=>{e.elevenLabs?(console.log("closeConversation 11 labs"),hl(),pn.value="none",i.value=!1):(console.log("closeConversation"),yl(),Io(),pn.value="none",i.value=!1)},a=async()=>{var c,u,l,g,h,p,C,B;try{const E={question:ma.value||qE.value};e.conversations.push(E),e.dotLoader=!0,e.question="";const v={past_messages:e.past_messages,question:ma.value||qE.value,skillId:e.simulationSkill,bandCode:e.band_code,userGenomeFunction:e.genomeFunctionValue,userGenomeRole:e.genomeRoleValue},m=await Ai("/sqlTest",v);if(pn.value="bot",r.value=(u=(c=m==null?void 0:m.data)==null?void 0:c.body)==null?void 0:u.answer,r.value===""){console.log("in the if case calling api again");const S=await Ai("/sqlTest",v);e.addConversation((l=S.data)==null?void 0:l.body,"new")}else console.log("in the else case"),e.addConversation((g=m.data)==null?void 0:g.body,"new");if(e.dotLoader=!1,e.elevenLabs)await kW(r.value.replace(/[*#]/g,""));else if(r.value.includes("Feedback and Assessment")){yl();const S={pastAudioAnalysis:e.audioAnaysis,finalAnalysis:!0},O=await Wt.post("/fetchPdfAssessment",S,{headers:{"Content-Type":"application/json"}});if(console.log((h=O==null?void 0:O.data)==null?void 0:h.body),e.addConversation((p=O==null?void 0:O.data)==null?void 0:p.body,"new"),i.value=!1,r.value.includes("END ROLE PLAY")){const N=r.value.split("END ROLE PLAY")[0];if(N.length<0){e.showVoiceComponent=!1;return}await lF(N.replace(/[*#]/g,"")),e.showVoiceComponent=!1}else e.showVoiceComponent=!1}else await lF(r.value.replace(/[*#]/g,""))}catch(E){if(console.error(E),Wt.isAxiosError(E)){const v=E;console.log("Error found!"),console.error((C=v.response)==null?void 0:C.data),A.setError(((B=v.response)==null?void 0:B.data).message)}else A.setError("There was an issue, please contact helpmate")}};return Ao(ma,async c=>{if(c){if(console.log("Recognized text:",c),ma.value.toLowerCase().includes("play")&&ma.value.length<10){console.log("play command detected, ignoring input");return}pn.value="listening",e.userspeaking=!1,await a(),ma.value=""}}),Ao(qE,async c=>{c&&(console.log("Recognized text:",c),pn.value="listening",await a(),qE.value="")}),(c,u)=>(ue(),ge("div",Cee,[Ee(pn)==="bot"?(ue(),ge("div",Iee,[M("span",null,[(ue(),ge("svg",Bee,vee))])])):Ee(pn)==="user"?(ue(),ge("div",wee,[M("span",null,[(ue(),ge("svg",See,mee))])])):Ee(pn)==="listening"?(ue(),ge("div",Mee,yee)):Dt("",!0),M("div",{class:yt([i.value?"":"animate-pulse","tooltip"])},[M("span",Qee,xt(n.value),1),i.value?(ue(),ge("button",{key:0,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[0]||(u[0]=l=>o())},Ree)):(ue(),ge("button",{key:1,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[1]||(u[1]=l=>o())},Dee))],2),M("button",{class:"rounded-full bg-white p-2 hover:bg-gray-300",onClick:u[2]||(u[2]=l=>s())},[ot(Ee(A4),{class:"h-[10px] w-[10px] text-gray-700"})])]))}}),ya=t=>(Ur("data-v-9ec493aa"),t=t(),Lr(),t),Uee={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},Lee={class:"py-2"},Fee={class:"flex"},Oee={class:"z-1 relative w-full"},xee={class:"flex justify-between my-2 w-full"},bee=ya(()=>M("div",null,null,-1)),Nee={key:0,class:"flex justify-center bg-genpact-darkest-blue px-4 rounded-full"},Kee={class:"relative w-full"},kee={class:"absolute inset-y-0 left-0 flex items-center pl-3"},Pee={class:"tooltip"},Gee=ya(()=>M("span",{class:"tooltiptext text-genpact-darkest-teal"},"Restart",-1)),jee=[ya(()=>M("path",{d:"M12 4C8.229 4 6.343 4 5.172 5.172C4.001 6.344 4 8.229 4 12V18C4 18.943 4 19.414 4.293 19.707C4.586 20 5.057 20 6 20H12C15.771 20 17.657 20 18.828 18.828C19.999 17.656 20 15.771 20 12",stroke:"currentColor","stroke-width":"2"},null,-1)),ya(()=>M("path",{d:"M9 10H15M9 14H12M19 8V2M16 5H22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1))],Yee={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},Hee={key:0},zee=["disabled"],Jee=[ya(()=>M("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"},null,-1))],qee={key:1,class:"tooltip"},Vee=[ya(()=>M("span",{class:"tooltiptext text-genpact-darkest-teal"},"Processing",-1)),ya(()=>M("img",{class:"w-7 h-7",src:GS,alt:"watingIcon"},null,-1))],Wee={class:"flex justify-start gap-2 md:gap-1"},Zee=["disabled"],Xee=ya(()=>M("div",{class:"pt-1 text-start font-sans text-xs font-bold text-gray-500 md:text-sm"},[M("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),_ee=Vt({__name:"NewQuestionSimulation",setup(t,{expose:e}){const A=aA(),r=Or(),i=ne(""),n=ne("");A.question="";const o=ne(null),s=ne(!1),a=ne(0);n.value=A.recognizedText,Ki(()=>{o.value.focus()});const c=()=>{window.location.reload()},u=async()=>{var h,p,C,B,E,v,m,S,O,N,P;try{if(A.question.trim().length<1){console.log("Please enter answer!");return}s.value=!0,A.dotLoader=!0;const D={question:A.question||A.recognizedText};A.conversations.push(D);const T=ne("");T.value=A.question||A.recognizedText,A.question="",o.value&&(o.value.style.height="auto");const z={ohr_id:i.value,past_messages:A.past_messages,question:T.value||A.recognizedText,bandCode:A.band_code,userGenomeFunction:A.genomeFunctionValue,userGenomeRole:A.genomeRoleValue,skillId:A.simulationSkill||"937e84ef-e95d-4327-9afe-e7be2bf420eb"},Q=await Ai("/sqlTest",z);if(a.value+=(p=(h=Q.data)==null?void 0:h.body)==null?void 0:p.totalTokenCount,console.log("Token Count:",a.value),i.value=(B=(C=Q.data)==null?void 0:C.body)==null?void 0:B.ohr,((v=(E=Q==null?void 0:Q.data)==null?void 0:E.body)==null?void 0:v.answer)===""){console.log("in the if case calling api again");const G=await Ai("/sqlTest",z);A.addConversation((m=G.data)==null?void 0:m.body,"new")}else console.log("in the else case"),A.addConversation((S=Q.data)==null?void 0:S.body,"new");s.value=!1,A.dotLoader=!1,A.recognizedText=""}catch(D){if(console.error(D),A.dotLoader=!1,s.value=!1,Wt.isAxiosError(D)){const T=D;console.log("Error found!"),console.error((O=T.response)==null?void 0:O.data),r.setError((P=(N=T.response)==null?void 0:N.data)==null?void 0:P.message)}else r.setError("There was an issue, please contact helpmate")}},l=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),u())},g=h=>{const p=h.target;p.style.height="auto",p.style.height=p.scrollHeight+"px"};return e({sendQuestion:u}),(h,p)=>(ue(),ge("div",Uee,[M("div",Lee,[M("div",Fee,[M("div",Oee,[M("div",xee,[bee,Ee(A).showVoiceComponent?(ue(),ge("div",Nee,[ot(Tee)])):Dt("",!0)]),M("div",Kee,[M("div",kee,[M("div",Pee,[Gee,(ue(),ge("svg",{onClick:c,class:"ml-2 h-7 w-7 rounded",id:"newTopicDisable",width:"7",height:"",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",title:"restart"},jee))])]),M("div",Yee,[s.value?(ue(),ge("div",qee,Vee)):(ue(),ge("div",Hee,[(ue(),ge("svg",{disabled:Ee(A).beginFlag===!0,class:yt([Ee(A).beginFlag===!0?"cursor-not-allowed text-gray-600":"cursor-pointer","bi bi-send ml-2 h-7 w-7 rotate-45 rounded"]),onClick:p[0]||(p[0]=C=>Ee(A).searchBoxdisable===!1||Ee(A).beginFlag===!0?"":u()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},Jee,10,zee))]))]),M("div",Wee,[$t(M("textarea",{onPaste:p[1]||(p[1]=oS(()=>{},["prevent"])),onKeydown:p[2]||(p[2]=C=>s.value?"":l(C)),disabled:Ee(A).searchBoxdisable===!1||Ee(A).beginFlag===!0,"onUpdate:modelValue":p[3]||(p[3]=C=>Ee(A).question=C),class:yt(["fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] px-[70px]",Ee(A).beginFlag===!0||Ee(A).searchBoxdisable===!1?"cursor-not-allowed bg-[#e5e7eb]":"bg-white"]),placeholder:"Write your answer here...",ref_key:"AiSearch",ref:o,rows:"1",onInput:p[4]||(p[4]=C=>g(C)),style:{overflow:"hidden",transition:"height 0.2s"}},null,42,Zee),[[UA,Ee(A).question]])])]),Xee])])])]))}}),K1e="",$ee=IA(_ee,[["__scopeId","data-v-9ec493aa"]]),II=t=>(Ur("data-v-6c0980b5"),t=t(),Lr(),t),ete={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},tte={class:"py-2"},Ate={class:"flex"},rte={class:"z-1 relative w-full"},ite={class:"relative w-full"},nte={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},ste={key:0},ote=["disabled"],ate=[II(()=>M("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"},null,-1))],cte={key:1,class:"tooltip"},ute=[II(()=>M("span",{class:"tooltiptext fontFormattingAMA"},"Waiting for response",-1)),II(()=>M("img",{class:"w-7 h-7",src:GS,alt:"watingIcon"},null,-1))],lte={class:"flex justify-start gap-2 md:gap-1"},hte=["disabled"],gte=II(()=>M("div",{class:"pt-1 text-start font-sans text-[0.8125rem] md:text-[0.9375rem] font-bold text-gray-500"},[M("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),dte=Vt({__name:"NewMDMQuestionSimulation",setup(t){const e=aA(),A=Or(),r=ne("");e.question="";const i=ne(null),n=ne(!1),o=ne(oo),s=ne(!1);r.value=e.recognizedText,Ki(()=>{i.value.focus()});const a=u=>{const l=u.length;o.value=oo-l,n.value=l>=oo},c=async()=>{var u,l,g;console.log("options fdsfdscdzxfsdv",e.recognizedText);try{if(console.log("options fdsfdscdzxfsdv",e.recognizedText),e.question.trim().length<1){console.log("Please enter answer!");return}s.value=!0,e.dotLoader=!0;const h={question:e.question||e.recognizedText};console.log("ques",h),e.conversations.push(h);const p=ne("");p.value=e.question||e.recognizedText,e.question="";const C={assessmentId:e.simulationSkill,question:p.value,past_messages:e.past_messages,prompt:e.generatedPrompt,assessmentType:e.assessmentType,userFunction:"HR",empSeniority:e.empSeniority,functionRole:e.functionRole,userBand:e.band_code,storeFinalFeedback:e.storeFinalFeedback,storeFinalScore:e.storeFinalScore};console.log("Payload for MDM1==> ",C);let B;Os==="prod"?B="/ManualExportActivity":B="/fetchCompletionDemo";const E=await Ai(B,C);e.addConversation((u=E.data)==null?void 0:u.body,"new"),s.value=!1,e.dotLoader=!1,e.recognizedText=""}catch(h){if(console.error(h),Wt.isAxiosError(h)){const p=h;console.log("Error found!"),console.error((l=p.response)==null?void 0:l.data),A.setError(((g=p.response)==null?void 0:g.data).message)}else A.setError("There was an issue, please contact helpmate")}};return(u,l)=>(ue(),ge("div",ete,[M("div",tte,[M("div",Ate,[M("div",rte,[M("div",ite,[M("div",nte,[s.value?(ue(),ge("div",cte,ute)):(ue(),ge("div",ste,[(ue(),ge("svg",{disabled:Ee(e).beginFlag===!0,class:yt([Ee(e).beginFlag===!0?"cursor-not-allowed text-gray-600":"cursor-pointer","bi bi-send ml-2 h-7 w-7 rotate-45 rounded"]),onClick:l[0]||(l[0]=g=>Ee(e).searchBoxdisable===!1||Ee(e).beginFlag===!0?"":c()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},ate,10,ote))]))]),M("div",lte,[$t(M("input",{onKeyup:[l[1]||(l[1]=jD(g=>s.value?"":c(),["enter"])),l[3]||(l[3]=g=>a(Ee(e).question))],disabled:Ee(e).beginFlag===!0||Ee(e).searchBoxdisable===!1,class:yt([Ee(e).beginFlag===!0||Ee(e).searchBoxdisable===!1?"cursor-not-allowed bg-[#e5e7eb]":"bg-white","fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] pl-[30px] pr-[70px]"]),"onUpdate:modelValue":l[2]||(l[2]=g=>Ee(e).question=g),placeholder:"Write your answer here...",type:"text",ref_key:"AiSearch",ref:i},null,42,hte),[[UA,Ee(e).question]])])]),gte])])])]))}}),j1e="",pte=IA(dte,[["__scopeId","data-v-6c0980b5"]]),fte={},Ete={class:"flex min-h-screen justify-center -mt-16"},Cte=[M("div",{class:"flex items-center justify-center"},[M("img",{class:"loadercss",src:ao,alt:"Loader Gif"})],-1)];function Ite(t,e){return ue(),ge("div",Ete,Cte)}const gF=IA(fte,[["render",Ite]]);function pA(t){return pA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pA(t)}var hs=Uint8Array,fn=Uint16Array,G0=Int32Array,j0=new hs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Y0=new hs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dF=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pF=function(t,e){for(var A=new fn(31),r=0;r<31;++r)A[r]=e+=1<<t[r-1];for(var i=new G0(A[30]),r=1;r<30;++r)for(var n=A[r];n<A[r+1];++n)i[n]=n-A[r]<<5|r;return{b:A,r:i}},fF=pF(j0,2),Bte=fF.b,H0=fF.r;Bte[28]=258,H0[258]=28;for(var vte=pF(Y0,0),EF=vte.r,z0=new fn(32768),kA=0;kA<32768;++kA){var Qa=(kA&43690)>>1|(kA&21845)<<1;Qa=(Qa&52428)>>2|(Qa&13107)<<2,Qa=(Qa&61680)>>4|(Qa&3855)<<4,z0[kA]=((Qa&65280)>>8|(Qa&255)<<8)>>1}for(var np=function(t,e,A){for(var r=t.length,i=0,n=new fn(e);i<r;++i)t[i]&&++n[t[i]-1];var o=new fn(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var s;if(A){s=new fn(1<<e);var a=15-e;for(i=0;i<r;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],l=o[t[i]-1]++<<u,g=l|(1<<u)-1;l<=g;++l)s[z0[l]>>a]=c}else for(s=new fn(r),i=0;i<r;++i)t[i]&&(s[i]=z0[o[t[i]-1]++]>>15-t[i]);return s},zc=new hs(288),kA=0;kA<144;++kA)zc[kA]=8;for(var kA=144;kA<256;++kA)zc[kA]=9;for(var kA=256;kA<280;++kA)zc[kA]=7;for(var kA=280;kA<288;++kA)zc[kA]=8;for(var BI=new hs(32),kA=0;kA<32;++kA)BI[kA]=5;var wte=np(zc,9,0),Ste=np(BI,5,0),CF=function(t){return(t+7)/8|0},mte=function(t,e,A){return(e==null||e<0)&&(e=0),(A==null||A>t.length)&&(A=t.length),new hs(t.subarray(e,A))},Bo=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8},sp=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8,t[r+2]|=A>>16},J0=function(t,e){for(var A=[],r=0;r<t.length;++r)t[r]&&A.push({s:r,f:t[r]});var i=A.length,n=A.slice();if(!i)return{t:wF,l:0};if(i==1){var o=new hs(A[0].s+1);return o[A[0].s]=1,{t:o,l:1}}A.sort(function(O,N){return O.f-N.f}),A.push({s:-1,f:25001});var s=A[0],a=A[1],c=0,u=1,l=2;for(A[0]={s:-1,f:s.f+a.f,l:s,r:a};u!=i-1;)s=A[A[c].f<A[l].f?c++:l++],a=A[c!=u&&A[c].f<A[l].f?c++:l++],A[u++]={s:-1,f:s.f+a.f,l:s,r:a};for(var g=n[0].s,r=1;r<i;++r)n[r].s>g&&(g=n[r].s);var h=new fn(g+1),p=q0(A[u-1],h,0);if(p>e){var r=0,C=0,B=p-e,E=1<<B;for(n.sort(function(N,P){return h[P.s]-h[N.s]||N.f-P.f});r<i;++r){var v=n[r].s;if(h[v]>e)C+=E-(1<<p-h[v]),h[v]=e;else break}for(C>>=B;C>0;){var m=n[r].s;h[m]<e?C-=1<<e-h[m]++-1:++r}for(;r>=0&&C;--r){var S=n[r].s;h[S]==e&&(--h[S],++C)}p=e}return{t:new hs(h),l:p}},q0=function(t,e,A){return t.s==-1?Math.max(q0(t.l,e,A+1),q0(t.r,e,A+1)):e[t.s]=A},IF=function(t){for(var e=t.length;e&&!t[--e];);for(var A=new fn(++e),r=0,i=t[0],n=1,o=function(a){A[r++]=a},s=1;s<=e;++s)if(t[s]==i&&s!=e)++n;else{if(!i&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(i),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(i);n=1,i=t[s]}return{c:A.subarray(0,r),n:e}},op=function(t,e){for(var A=0,r=0;r<e.length;++r)A+=t[r]*e[r];return A},BF=function(t,e,A){var r=A.length,i=CF(e+2);t[i]=r&255,t[i+1]=r>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var n=0;n<r;++n)t[i+n+4]=A[n];return(i+4+r)*8},vF=function(t,e,A,r,i,n,o,s,a,c,u){Bo(e,u++,A),++i[256];for(var l=J0(i,15),g=l.t,h=l.l,p=J0(n,15),C=p.t,B=p.l,E=IF(g),v=E.c,m=E.n,S=IF(C),O=S.c,N=S.n,P=new fn(19),D=0;D<v.length;++D)++P[v[D]&31];for(var D=0;D<O.length;++D)++P[O[D]&31];for(var T=J0(P,7),z=T.t,Q=T.l,R=19;R>4&&!z[dF[R-1]];--R);var G=c+5<<3,k=op(i,zc)+op(n,BI)+o,$=op(i,g)+op(n,C)+o+14+3*R+op(P,z)+2*P[16]+3*P[17]+7*P[18];if(a>=0&&G<=k&&G<=$)return BF(e,u,t.subarray(a,a+c));var W,ie,_,ce;if(Bo(e,u,1+($<k)),u+=2,$<k){W=np(g,h,0),ie=g,_=np(C,B,0),ce=C;var ve=np(z,Q,0);Bo(e,u,m-257),Bo(e,u+5,N-1),Bo(e,u+10,R-4),u+=14;for(var D=0;D<R;++D)Bo(e,u+3*D,z[dF[D]]);u+=3*R;for(var fe=[v,O],U=0;U<2;++U)for(var Y=fe[U],D=0;D<Y.length;++D){var X=Y[D]&31;Bo(e,u,ve[X]),u+=z[X],X>15&&(Bo(e,u,Y[D]>>5&127),u+=Y[D]>>12)}}else W=wte,ie=zc,_=Ste,ce=BI;for(var D=0;D<s;++D){var re=r[D];if(re>255){var X=re>>18&31;sp(e,u,W[X+257]),u+=ie[X+257],X>7&&(Bo(e,u,re>>23&31),u+=j0[X]);var oe=re&31;sp(e,u,_[oe]),u+=ce[oe],oe>3&&(sp(e,u,re>>5&8191),u+=Y0[oe])}else sp(e,u,W[re]),u+=ie[re]}return sp(e,u,W[256]),u+ie[256]},Mte=new G0([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wF=new hs(0),yte=function(t,e,A,r,i,n){var o=n.z||t.length,s=new hs(r+o+5*(1+Math.ceil(o/7e3))+i),a=s.subarray(r,s.length-i),c=n.l,u=(n.r||0)&7;if(e){u&&(a[0]=n.r>>3);for(var l=Mte[e-1],g=l>>13,h=l&8191,p=(1<<A)-1,C=n.p||new fn(32768),B=n.h||new fn(p+1),E=Math.ceil(A/3),v=2*E,m=function(J){return(t[J]^t[J+1]<<E^t[J+2]<<v)&p},S=new G0(25e3),O=new fn(288),N=new fn(32),P=0,D=0,T=n.i||0,z=0,Q=n.w||0,R=0;T+2<o;++T){var G=m(T),k=T&32767,$=B[G];if(C[k]=$,B[G]=k,Q<=T){var W=o-T;if((P>7e3||z>24576)&&(W>423||!c)){u=vF(t,a,0,S,O,N,D,z,R,T-R,u),z=P=D=0,R=T;for(var ie=0;ie<286;++ie)O[ie]=0;for(var ie=0;ie<30;++ie)N[ie]=0}var _=2,ce=0,ve=h,fe=k-$&32767;if(W>2&&G==m(T-fe))for(var U=Math.min(g,W)-1,Y=Math.min(32767,T),X=Math.min(258,W);fe<=Y&&--ve&&k!=$;){if(t[T+_]==t[T+_-fe]){for(var re=0;re<X&&t[T+re]==t[T+re-fe];++re);if(re>_){if(_=re,ce=fe,re>U)break;for(var oe=Math.min(fe,re-2),Z=0,ie=0;ie<oe;++ie){var ae=T-fe+ie&32767,se=C[ae],de=ae-se&32767;de>Z&&(Z=de,$=ae)}}}k=$,$=C[k],fe+=k-$&32767}if(ce){S[z++]=268435456|H0[_]<<18|EF[ce];var De=H0[_]&31,j=EF[ce]&31;D+=j0[De]+Y0[j],++O[257+De],++N[j],Q=T+_,++P}else S[z++]=t[T],++O[t[T]]}}for(T=Math.max(T,Q);T<o;++T)S[z++]=t[T],++O[t[T]];u=vF(t,a,c,S,O,N,D,z,R,T-R,u),c||(n.r=u&7|a[u/8|0]<<3,u-=7,n.h=B,n.p=C,n.i=T,n.w=Q)}else{for(var T=n.w||0;T<o+c;T+=65535){var q=T+65535;q>=o&&(a[u/8|0]=c,q=o),u=BF(a,u+1,t.subarray(T,q))}n.i=o}return mte(s,0,r+CF(u)+i)},SF=function(){var t=1,e=0;return{p:function(A){for(var r=t,i=e,n=A.length|0,o=0;o!=n;){for(var s=Math.min(o+2655,n);o<s;++o)i+=r+=A[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},Qte=function(t,e,A,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new hs(n.length+t.length);o.set(n),o.set(t,n.length),t=o,i.w=n.length}return yte(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,A,r,i)},mF=function(t,e,A){for(;A;++e)t[e]=A,A>>>=8},Rte=function(t,e){var A=e.level,r=A==0?0:A<6?1:A==9?3:2;if(t[0]=120,t[1]=r<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=SF();i.p(e.dictionary),mF(t,2,i.d())}};function V0(t,e){e||(e={});var A=SF();A.p(t);var r=Qte(t,e,e.dictionary?6:2,4);return Rte(r,e),mF(r,r.length-4,A.d()),r}var Dte=typeof TextDecoder<"u"&&new TextDecoder,Tte=0;try{Dte.decode(wF,{stream:!0}),Tte=1}catch{}function Ute(t){if(Array.isArray(t))return t}function Lte(t,e){var A=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(A!=null){var r,i,n,o,s=[],a=!0,c=!1;try{if(n=(A=A.call(t)).next,e===0){if(Object(A)!==A)return;a=!1}else for(;!(a=(r=n.call(A)).done)&&(s.push(r.value),s.length!==e);a=!0);}catch(u){c=!0,i=u}finally{try{if(!a&&A.return!=null&&(o=A.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function MF(t,e){(e==null||e>t.length)&&(e=t.length);for(var A=0,r=Array(e);A<e;A++)r[A]=t[A];return r}function Fte(t,e){if(t){if(typeof t=="string")return MF(t,e);var A={}.toString.call(t).slice(8,-1);return A==="Object"&&t.constructor&&(A=t.constructor.name),A==="Map"||A==="Set"?Array.from(t):A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A)?MF(t,e):void 0}}function Ote(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
35
|
+
${this.privSynthesizerConfig.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Url)} Reason: ${u.reason}`))},a=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(a)}),this.privConnectionPromise.catch(()=>{}),this.privConnectionPromise}sendSpeechServiceConfig(o,s){if(s)return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",s))}sendSsmlMessage(o,s,a){return o.send(new r.SpeechConnectionMessage(t.MessageType.Text,"ssml",a,"application/ssml+xml",s))}async fetchConnection(){return this.privConnectionConfigurationPromise!==void 0?this.privConnectionConfigurationPromise.then(o=>o.state()===t.ConnectionState.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()):this.privConnectionConfigurationPromise,()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection())):(this.privConnectionConfigurationPromise=this.configureConnection(),await this.privConnectionConfigurationPromise)}async configureConnection(){const o=await this.connectImpl();return this.configConnectionOverride!==void 0?this.configConnectionOverride(o):(this.setSpeechConfigSynthesisSection(),await this.sendSpeechServiceConfig(o,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),o)}onAvatarEvent(o){}onSynthesisStarted(o){}onSynthesizing(o){}onSynthesisCancelled(o){}onSynthesisCompleted(o){}onWordBoundary(o){}onVisemeReceived(o){}onBookmarkReached(o){}};return Xd.SynthesisAdapterBase=i,i.telemetryDataEnabled=!0,Xd}var _d={},XL;function tee(){if(XL)return _d;XL=1,Object.defineProperty(_d,"__esModule",{value:!0}),_d.AvatarSynthesisAdapter=void 0;const t=Ve(),e=ct();let A=class extends e.SynthesisAdapterBase{constructor(i,n,o,s,a){super(i,n,o,void 0),this.privAvatarSynthesizer=s,this.privSynthesizer=s,this.privAvatarConfig=a}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(void 0)}setSpeechConfigSynthesisSection(){var i,n,o,s,a,c,u,l,g,h,p,C,B,E,v,m,S;this.privSynthesizerConfig.synthesisVideoSection={format:{bitrate:(i=this.privAvatarConfig.videoFormat)==null?void 0:i.bitrate,codec:(n=this.privAvatarConfig.videoFormat)==null?void 0:n.codec,crop:{bottomRight:{x:(a=(s=(o=this.privAvatarConfig.videoFormat)==null?void 0:o.cropRange)==null?void 0:s.bottomRight)==null?void 0:a.x,y:(l=(u=(c=this.privAvatarConfig.videoFormat)==null?void 0:c.cropRange)==null?void 0:u.bottomRight)==null?void 0:l.y},topLeft:{x:(p=(h=(g=this.privAvatarConfig.videoFormat)==null?void 0:g.cropRange)==null?void 0:h.topLeft)==null?void 0:p.x,y:(E=(B=(C=this.privAvatarConfig.videoFormat)==null?void 0:C.cropRange)==null?void 0:B.topLeft)==null?void 0:E.y}},resolution:{height:(v=this.privAvatarConfig.videoFormat)==null?void 0:v.height,width:(m=this.privAvatarConfig.videoFormat)==null?void 0:m.width}},protocol:{name:"WebRTC",webrtcConfig:{clientDescription:btoa(this.privSynthesizerConfig.parameters.getProperty(t.PropertyId.TalkingAvatarService_WebRTC_SDP)),iceServers:this.privAvatarConfig.remoteIceServers??this.privAvatarSynthesizer.iceServers}},talkingAvatar:{background:{color:this.privAvatarConfig.backgroundColor,image:{url:(S=this.privAvatarConfig.backgroundImage)==null?void 0:S.toString()}},character:this.privAvatarConfig.character,customized:this.privAvatarConfig.customized,style:this.privAvatarConfig.style,useBuiltInVoice:this.privAvatarConfig.useBuiltInVoice}}}onAvatarEvent(i){if(this.privAvatarSynthesizer.avatarEventReceived){const n=new t.AvatarEventArgs(i.Data.Offset,i.Data.Name);try{this.privAvatarSynthesizer.avatarEventReceived(this.privAvatarSynthesizer,n)}catch{}}}};return _d.AvatarSynthesisAdapter=A,_d}var $d={},_L;function Aee(){if(_L)return $d;_L=1,Object.defineProperty($d,"__esModule",{value:!0}),$d.SpeechSynthesisAdapter=void 0;const t=Ve(),e=ct();let A=class extends e.SynthesisAdapterBase{constructor(i,n,o,s,a){super(i,n,o,a),this.privSpeechSynthesizer=s,this.privSynthesizer=s}setSynthesisContextSynthesisSection(){this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer)}onSynthesisStarted(i){const n=new t.SpeechSynthesisEventArgs(new t.SpeechSynthesisResult(i,t.ResultReason.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,n)}onSynthesizing(i){if(this.privSpeechSynthesizer.synthesizing)try{const n=this.privSynthesisTurn.audioOutputFormat.addHeader(i),o=new t.SpeechSynthesisEventArgs(new t.SpeechSynthesisResult(this.privSynthesisTurn.requestId,t.ResultReason.SynthesizingAudio,n));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,o)}catch{}}onSynthesisCancelled(i){if(this.privSpeechSynthesizer.SynthesisCanceled){const n=new t.SpeechSynthesisEventArgs(i);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,n)}catch{}}}onSynthesisCompleted(i){if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new t.SpeechSynthesisEventArgs(i))}catch{}}onWordBoundary(i){if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,i)}catch{}}onVisemeReceived(i){if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,i)}catch{}}onBookmarkReached(i){if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,i)}catch{}}};return $d.SpeechSynthesisAdapter=A,$d}var ep={},$L;function ree(){if($L)return ep;$L=1,Object.defineProperty(ep,"__esModule",{value:!0}),ep.SynthesisRestAdapter=void 0;const t=qr(),e=Ve(),A=ls(),r=Jr;let i=class{constructor(o,s){let a=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Endpoint,void 0);if(!a){const u=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Region,"westus"),l=A.ConnectionFactoryBase.getHostSuffix(u);a=o.parameters.getProperty(e.PropertyId.SpeechServiceConnection_Host,`https://${u}.tts.speech${l}`)}this.privUri=`${a}/cognitiveservices/voices/list`;const c=t.RestConfigBase.requestOptions;this.privRestAdapter=new t.RestMessageAdapter(c),this.privAuthentication=s}getVoicesList(o){return this.privRestAdapter.setHeaders(r.HeaderNames.ConnectionId,o),this.privAuthentication.fetch(o).then(s=>(this.privRestAdapter.setHeaders(s.headerName,s.token),this.privRestAdapter.request(t.RestRequestType.Get,this.privUri)))}};return ep.SynthesisRestAdapter=i,ep}var K0={},eF;function iee(){return eF||(eF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SynthesizerConfig=t.SynthesisServiceType=void 0;const e=ct();var A;(function(i){i[i.Standard=0]="Standard",i[i.Custom=1]="Custom"})(A=t.SynthesisServiceType||(t.SynthesisServiceType={}));class r{constructor(n,o){this.privSynthesisServiceType=A.Standard,this.avatarEnabled=!1,this.privSpeechServiceConfig=n||new e.SpeechServiceConfig(new e.Context(null)),this.privParameters=o}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(n){this.privSynthesisServiceType=n}set synthesisVideoSection(n){this.privSpeechServiceConfig.Context.synthesis={video:n}}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}t.SynthesizerConfig=r}(K0)),K0}var tp={},tF;function nee(){if(tF)return tp;tF=1,Object.defineProperty(tp,"__esModule",{value:!0}),tp.SynthesisContext=void 0;const t=Ve();let e=class{constructor(){this.privContext={}}setSection(r,i){this.privContext[r]=i}set audioOutputFormat(r){this.privAudioOutputFormat=r}toJSON(){return JSON.stringify(this.privContext)}setSynthesisSection(r){const i=this.buildSynthesisContext(r);this.setSection("synthesis",i)}buildSynthesisContext(r){return{audio:{metadataOptions:{bookmarkEnabled:!!(r!=null&&r.bookmarkReached),punctuationBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestPunctuationBoundary,!!(r!=null&&r.wordBoundary)),sentenceBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!(r!=null&&r.visemeReceived),wordBoundaryEnabled:r==null?void 0:r.properties.getProperty(t.PropertyId.SpeechServiceResponse_RequestWordBoundary,!!(r!=null&&r.wordBoundary))},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:r==null?void 0:r.autoDetectSourceLanguage}}}};return tp.SynthesisContext=e,tp}var Ap={},AF;function see(){if(AF)return Ap;AF=1,Object.defineProperty(Ap,"__esModule",{value:!0}),Ap.SpeakerRecognitionConfig=void 0;const t=ct();let e=class{constructor(r,i){this.privContext=r||new t.Context(null),this.privParameters=i}get parameters(){return this.privParameters}get Context(){return this.privContext}};return Ap.SpeakerRecognitionConfig=e,Ap}var rp={},rF;function oee(){if(rF)return rp;rF=1,Object.defineProperty(rp,"__esModule",{value:!0}),rp.SpeakerServiceRecognizer=void 0;const t=qr(),e=Mt(),A=Ve(),r=ct(),i=ho;let n=class extends r.ServiceRecognizerBase{constructor(s,a,c,u,l){super(s,a,c,u,l),this.privSpeakerRecognizer=l,this.privSpeakerAudioSource=c,this.recognizeSpeaker=g=>this.recognizeSpeakerOnce(g),this.sendPrePayloadJSONOverride=()=>this.noOp()}processTypeSpecificMessages(s){let a=!1;const c=new A.PropertyCollection;switch(s.messageType===e.MessageType.Text&&c.setProperty(A.PropertyId.SpeechServiceResponse_JsonResult,s.textBody),s.path.toLowerCase()){case"speaker.response":const l=JSON.parse(s.textBody);let g;l.status.statusCode.toLowerCase()!=="success"?g=new A.SpeakerRecognitionResult(l,A.ResultReason.Canceled,A.CancellationErrorCode.ServiceError,l.status.reason):g=new A.SpeakerRecognitionResult(l,A.ResultReason.RecognizedSpeaker),this.privResultDeferral&&this.privResultDeferral.resolve(g),a=!0;break}const u=new e.Deferred;return u.resolve(a),u.promise}cancelRecognition(s,a,c,u,l){if(new A.PropertyCollection().setProperty(r.CancellationErrorCodePropertyName,A.CancellationErrorCode[u]),this.privResultDeferral){const h=new A.SpeakerRecognitionResult({scenario:this.privSpeakerModel.scenario,status:{statusCode:l,reason:l}},A.ResultReason.Canceled,u,l);try{this.privResultDeferral.resolve(h)}catch(p){this.privResultDeferral.reject(p)}}}async recognizeSpeakerOnce(s){this.privSpeakerModel=s,this.voiceProfileType=s.scenario,this.privResultDeferral||(this.privResultDeferral=new e.Deferred),this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(A.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const a=this.connectImpl(),c=this.sendPreAudioMessages(this.extractSpeakerContext(s)),u=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),l=await this.privSpeakerAudioSource.format,g=await this.privSpeakerAudioSource.deviceInfo,h=new t.ReplayableAudioNode(u,l.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(h,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:g};try{await a,await c}catch(B){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,B)}const p=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,p),this.receiveMessage(),this.sendAudio(h).then(()=>{},B=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,B)}),this.privResultDeferral.promise}async sendPreAudioMessages(s){const a=await this.fetchConnection();await this.sendSpeakerRecognition(a,s)}async sendSpeakerRecognition(s,a){const c=JSON.stringify(a);return s.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.context",this.privRequestSession.requestId,"application/json; charset=utf-8",c))}extractSpeakerContext(s){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:s.profileIds,scenario:s.scenario}}};return rp.SpeakerServiceRecognizer=n,rp}var ip={},iF;function aee(){if(iF)return ip;iF=1,Object.defineProperty(ip,"__esModule",{value:!0}),ip.VoiceServiceRecognizer=void 0;const t=qr(),e=Mt(),A=Ve(),r=ct(),i=ho;let n=class extends r.ServiceRecognizerBase{constructor(s,a,c,u,l){super(s,a,c,u,l),this.privDeferralMap=new e.DeferralMap,this.privSpeakerAudioSource=c,this.sendPrePayloadJSONOverride=()=>this.noOp()}set SpeakerAudioSource(s){this.privSpeakerAudioSource=s}processTypeSpecificMessages(s){let a=!1;const c=new A.PropertyCollection;switch(s.messageType===e.MessageType.Text&&c.setProperty(A.PropertyId.SpeechServiceResponse_JsonResult,s.textBody),s.path.toLowerCase()){case"speaker.profiles":const l=JSON.parse(s.textBody);switch(l.operation.toLowerCase()){case"create":this.handleCreateResponse(l,s.requestId);break;case"delete":case"reset":this.handleResultResponse(l,s.requestId);break;case"fetch":const C=JSON.parse(s.textBody);this.handleFetchResponse(C,s.requestId);break}a=!0;break;case"speaker.phrases":const g=JSON.parse(s.textBody);this.handlePhrasesResponse(g,s.requestId),a=!0;break;case"speaker.profile.enrollment":const h=JSON.parse(s.textBody),p=new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(h.enrollment?h.enrollment.enrollmentStatus:h.status.statusCode),h.enrollment?JSON.stringify(h.enrollment):void 0,h.status.reason);this.privDeferralMap.getId(s.requestId)&&this.privDeferralMap.complete(s.requestId,p),this.privRequestSession.onSpeechEnded(),a=!0;break}const u=new e.Deferred;return u.resolve(a),u.promise}cancelRecognition(s,a,c,u,l){new A.PropertyCollection().setProperty(r.CancellationErrorCodePropertyName,A.CancellationErrorCode[u]);const h=new A.VoiceProfileEnrollmentResult(A.ResultReason.Canceled,l,l);this.privDeferralMap.getId(a)&&this.privDeferralMap.complete(a,h)}async createProfile(s,a){this.voiceProfileType=s.toString();const c=this.connectImpl();try{const u=new e.Deferred;return await c,await this.sendCreateProfile(u,s,a),this.receiveMessage(),u.promise}catch(u){throw u}}async resetProfile(s){return this.voiceProfileType=s.profileType.toString(),this.sendCommonRequest("reset",s.profileType,s)}async deleteProfile(s){return this.voiceProfileType=s.profileType.toString(),this.sendCommonRequest("delete",s.profileType,s)}async retrieveEnrollmentResult(s){return this.voiceProfileType=s.profileType.toString(),this.privExpectedProfileId=s.profileId,this.sendCommonRequest("fetch",s.profileType,s)}async getAllProfiles(s){return this.voiceProfileType=s.toString(),this.sendCommonRequest("fetch",s)}async getActivationPhrases(s,a){this.voiceProfileType=s.toString();const c=this.connectImpl();try{const u=new e.Deferred;return await c,await this.sendPhrasesRequest(u,s,a),this.receiveMessage(),u.promise}catch(u){throw u}}async enrollProfile(s){this.voiceProfileType=s.profileType.toString();const a=new e.Deferred;this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events),this.privRecognizerConfig.parameters.setProperty(A.PropertyId.Speech_SessionId,this.privRequestSession.sessionId);const c=this.connectImpl(),u=this.sendPreAudioMessages(s,a),l=await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId),g=await this.privSpeakerAudioSource.format,h=await this.privSpeakerAudioSource.deviceInfo,p=new t.ReplayableAudioNode(l,g.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(p,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:h};try{await c,await u}catch(E){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,E)}const C=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,C),this.receiveMessage(),this.sendAudio(p).then(()=>{},E=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,E)}),a.promise}async sendPreAudioMessages(s,a){const c=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,a),await this.sendBaseRequest(c,"enroll",this.scenarioFrom(s.profileType),s)}async sendPhrasesRequest(s,a,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,s);const l=this.scenarioFrom(a),g={locale:c,scenario:l};return u.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.profile.phrases",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(g)))}async sendCreateProfile(s,a,c){const u=await this.fetchConnection();this.privRequestSession.onSpeechContext(),this.privDeferralMap.add(this.privRequestSession.requestId,s);const l=a===A.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":a===A.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification",g={locale:c,number:"1",scenario:l};return u.send(new i.SpeechConnectionMessage(e.MessageType.Text,"speaker.profile.create",this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(g)))}async sendCommonRequest(s,a,c=void 0){const u=this.connectImpl();try{const l=new e.Deferred;this.privRequestSession.onSpeechContext(),await u;const g=await this.fetchConnection();return this.privDeferralMap.add(this.privRequestSession.requestId,l),await this.sendBaseRequest(g,s,this.scenarioFrom(a),c),this.receiveMessage(),l.promise}catch(l){throw l}}async sendBaseRequest(s,a,c,u){const l={scenario:c};return u?l.profileIds=[u.profileId]:l.maxPageSize=-1,s.send(new i.SpeechConnectionMessage(e.MessageType.Text,`speaker.profile.${a}`,this.privRequestSession.requestId,"application/json; charset=utf-8",JSON.stringify(l)))}extractSpeakerContext(s){return{features:{interimResult:"enabled",progressiveDetection:"disabled"},profileIds:s.profileIds,scenario:s.scenario}}handlePhrasesResponse(s,a){if(this.privDeferralMap.getId(a))if(s.status.statusCode.toLowerCase()!=="success"){const c=A.ResultReason.Canceled,u=new A.VoiceProfilePhraseResult(c,s.status.statusCode,s.passPhraseType,[]);this.privDeferralMap.complete(a,u)}else if(s.phrases&&s.phrases.length>0){const c=A.ResultReason.EnrollingVoiceProfile,u=new A.VoiceProfilePhraseResult(c,s.status.statusCode,s.passPhraseType,s.phrases);this.privDeferralMap.complete(a,u)}else throw new Error("Voice Profile get activation phrases failed, no phrases received");else throw new Error(`Voice Profile get activation phrases request for requestID ${a} not found`)}handleCreateResponse(s,a){if(s.profiles&&s.profiles.length>0)if(this.privDeferralMap.getId(a)){const c=s.profiles.map(u=>u.profileId);this.privDeferralMap.complete(a,c)}else throw new Error(`Voice Profile create request for requestID ${a} not found`);else throw new Error("Voice Profile create failed, no profile id received")}handleResultResponse(s,a){if(this.privDeferralMap.getId(a)){const c=s.operation.toLowerCase()==="delete"?A.ResultReason.DeletedVoiceProfile:A.ResultReason.ResetVoiceProfile,u=s.status.statusCode.toLowerCase()==="success"?c:A.ResultReason.Canceled,l=new A.VoiceProfileResult(u,`statusCode: ${s.status.statusCode}, errorDetails: ${s.status.reason}`);this.privDeferralMap.complete(a,l)}else throw new Error(`Voice Profile create request for requestID ${a} not found`)}handleFetchResponse(s,a){if(this.privDeferralMap.getId(a)&&s.profiles[0]){if(this.privExpectedProfileId&&s.profiles.length===1&&s.profiles[0].profileId===this.privExpectedProfileId){this.privExpectedProfileId=void 0;const c=s.profiles[0],u=new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(c.enrollmentStatus),JSON.stringify(c),s.status.reason);this.privDeferralMap.complete(a,u)}else if(s.profiles.length>0){const c=s.profiles,u=[];for(const l of c)u.push(new A.VoiceProfileEnrollmentResult(this.enrollmentReasonFrom(l.enrollmentStatus),JSON.stringify(l),s.status.reason));this.privDeferralMap.complete(a,u)}}else throw new Error(`Voice Profile fetch request for requestID ${a} not found`)}enrollmentReasonFrom(s){switch(s.toLowerCase()){case"enrolled":return A.ResultReason.EnrolledVoiceProfile;case"invalidlocale":case"invalidphrase":case"invalidaudioformat":case"invalidscenario":case"invalidprofilecount":case"invalidoperation":case"audiotooshort":case"audiotoolong":case"toomanyenrollments":case"storageconflict":case"profilenotfound":case"incompatibleprofiles":case"incompleteenrollment":return A.ResultReason.Canceled;default:return A.ResultReason.EnrollingVoiceProfile}}scenarioFrom(s){return s===A.VoiceProfileType.TextIndependentIdentification?"TextIndependentIdentification":s===A.VoiceProfileType.TextIndependentVerification?"TextIndependentVerification":"TextDependentVerification"}};return ip.VoiceServiceRecognizer=n,ip}var nF={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.connectivity=t.Device=t.OS=t.System=t.Context=t.SpeechServiceConfig=void 0;class e{constructor(s){this.context=s}serialize(){return JSON.stringify(this,(s,a)=>{if(a&&typeof a=="object"&&!Array.isArray(a)){const c={};for(const u in a)Object.hasOwnProperty.call(a,u)&&(c[u&&u.charAt(0).toLowerCase()+u.substring(1)]=a[u]);return c}return a})}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(s){this.recognition=s.toLowerCase()}}t.SpeechServiceConfig=e;class A{constructor(s){this.system=new r,this.os=s}}t.Context=A;class r{constructor(){const s="1.44.0";this.name="SpeechSDK",this.version=s,this.build="JavaScript",this.lang="JavaScript"}}t.System=r;class i{constructor(s,a,c){this.platform=s,this.name=a,this.version=c}}t.OS=i;class n{constructor(s,a,c){this.manufacturer=s,this.model=a,this.version=c}}t.Device=n,function(o){o.Bluetooth="Bluetooth",o.Wired="Wired",o.WiFi="WiFi",o.Cellular="Cellular",o.InBuilt="InBuilt",o.Unknown="Unknown"}(t.connectivity||(t.connectivity={})),function(o){o.Phone="Phone",o.Speaker="Speaker",o.Car="Car",o.Headset="Headset",o.Thermostat="Thermostat",o.Microphones="Microphones",o.Deskphone="Deskphone",o.RemoteControl="RemoteControl",o.Unknown="Unknown",o.File="File",o.Stream="Stream"}(t.type||(t.type={}))})(nF);var sF;function ct(){return sF||(sF=1,function(t){var e=bt&&bt.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return o[s]}})}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),A=bt&&bt.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&e(o,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoDetectSourceLanguagesOpenRangeOptionName=t.ForceDictationPropertyName=t.ServicePropertiesPropertyName=t.CancellationErrorCodePropertyName=t.OutputFormatPropertyName=t.SpeechSynthesisAdapter=t.AvatarSynthesisAdapter=void 0,A(XE,t),A(BC,t),A(pl,t),A(V4,t),A(W4,t),A(Z_(),t),A(X_(),t),A(ZC,t),A(__(),t),A($_(),t),A(e$(),t),A(lL,t),A(XC,t),A(A$(),t),A(r$(),t),A(i$(),t),A(n$(),t),A(YU(),t),A(s$(),t),A(CL,t),A(o$(),t),A(_C,t),A(c$(),t),A(u$(),t),A(eI,t),A(tI,t),A(AI,t),A(l$(),t),A(h$(),t),A(g$(),t),A(d$(),t),A(p$(),t),A(rI,t),A(E$(),t),A(iI,t),A(TL,t),A(nI,t),A(aI,t),A(cI,t),A(U$(),t),A(hI,t),A(W$(),t),A(N0,t),A($$(),t),A(eee(),t);var r=tee();Object.defineProperty(t,"AvatarSynthesisAdapter",{enumerable:!0,get:function(){return r.AvatarSynthesisAdapter}});var i=Aee();Object.defineProperty(t,"SpeechSynthesisAdapter",{enumerable:!0,get:function(){return i.SpeechSynthesisAdapter}}),A(ree(),t),A(iee(),t),A(nee(),t),A(see(),t),A(oee(),t),A(aee(),t),A(nF,t),t.OutputFormatPropertyName="OutputFormat",t.CancellationErrorCodePropertyName="CancellationErrorCode",t.ServicePropertiesPropertyName="ServiceProperties",t.ForceDictationPropertyName="ForceDictation",t.AutoDetectSourceLanguagesOpenRangeOptionName="UND"}(YS)),YS}(function(t){var e=bt&&bt.__createBinding||(Object.create?function(i,n,o,s){s===void 0&&(s=o),Object.defineProperty(i,s,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,s){s===void 0&&(s=o),i[s]=n[o]}),A=bt&&bt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(t,"__esModule",{value:!0});const r=ct();new r.AgentConfig,A(Ve(),t)})(xs);const ai=[];for(let t=0;t<256;++t)ai.push((t+256).toString(16).slice(1));function cee(t,e=0){return(ai[t[e+0]]+ai[t[e+1]]+ai[t[e+2]]+ai[t[e+3]]+"-"+ai[t[e+4]]+ai[t[e+5]]+"-"+ai[t[e+6]]+ai[t[e+7]]+"-"+ai[t[e+8]]+ai[t[e+9]]+"-"+ai[t[e+10]]+ai[t[e+11]]+ai[t[e+12]]+ai[t[e+13]]+ai[t[e+14]]+ai[t[e+15]]).toLowerCase()}let k0;const uee=new Uint8Array(16);function lee(){if(!k0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");k0=crypto.getRandomValues.bind(crypto)}return k0(uee)}const oF={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hee(t,e,A){var i;if(oF.randomUUID&&!e&&!t)return oF.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??lee();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(A=A||0,A<0||A+16>e.length)throw new RangeError(`UUID byte range ${A}:${A+15} is out of buffer bounds`);for(let n=0;n<16;++n)e[A+n]=r[n];return e}return cee(r)}const Sl=Or(),Eo=aA(),ml=ne(""),Hc=ne(""),ma=ne(""),pn=ne("");let Co=null,P0=[];const aF=ne("");let Ma=null;const cF=4e3;Ki(async()=>{Eo.authToken=await CI()});let cr=null,Ml=null,Ns=null,EI=null;const Io=()=>{Ns&&Ns.mute(),cr&&(cr.close(),cr=null),Ml=null},CI=async()=>{var t,e,A;try{const r=await Nn("/voiceTesting");return(t=r==null?void 0:r.data)==null?void 0:t.token}catch(r){if(console.error(r),Wt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Sl.setError(((A=i.response)==null?void 0:A.data).message)}else Sl.setError("There was an issue while fetching data")}},yl=()=>{Ma&&clearTimeout(Ma),EI&&(EI.stopContinuousRecognitionAsync(()=>{},t=>{console.error("Error stopping recognition",t)}),EI=null),Co&&Co.state!=="inactive"&&Co.stop()},gee=async t=>(Eo.authToken=await CI(),await Io(),new Promise((e,A)=>{const r=xs.SpeechConfig.fromAuthorizationToken(Eo.authToken,"eastus2");r.speechSynthesisVoiceName="en-US-EmmaMultilingualNeural",Ns=new xs.SpeakerAudioDestination;const i=xs.AudioConfig.fromSpeakerOutput(Ns);cr=new xs.SpeechSynthesizer(r,i);const n=hee();Ml=n,cr.speakTextAsync(t,o=>{if(n!==Ml)return Ns==null||Ns.mute(),cr==null||cr.close(),cr=null,e();o.reason===xs.ResultReason.SynthesizingAudioCompleted?e():A(new Error("Speech synthesis failed")),cr==null||cr.close(),cr=null,Ml=null},o=>{if(n!==Ml)return Ns==null||Ns.mute(),cr==null||cr.close(),cr=null,e();cr==null||cr.close(),cr=null,Ml=null,A(o)})})),dee=async t=>{Eo.authToken=await CI();const e=xs.SpeechConfig.fromAuthorizationToken(Eo.authToken,"eastus2");e.speechRecognitionLanguage="en-US";const A=xs.AudioConfig.fromDefaultMicrophoneInput(),r=new xs.SpeechRecognizer(e,A);return EI=r,ml.value="",Hc.value="",await hF(),r.recognizing=(i,n)=>{n.result.text&&n.result.text.trim()&&(ml.value=n.result.text.trim(),Io(),Eo.userspeaking=!0,Eo.userSpeechText=(Hc.value?Hc.value+" ":"")+ml.value,pn.value="user",Ma&&clearTimeout(Ma),Ma=setTimeout(()=>{ml.value&&(t(ml.value.trim()),ml.value="")},cF))},r.recognized=async(i,n)=>{if(n.result.reason===xs.ResultReason.RecognizedSpeech&&n.result.text&&n.result.text.trim()){Hc.value+=" "+n.result.text.trim(),Ma&&clearTimeout(Ma),Ma=setTimeout(async()=>{Hc.value&&(t(Hc.value),console.log("Audio stop recording"),Hc.value="")},cF);const o=await pee();console.log("Audio sentiment:",o)}},r.canceled=async(i,n)=>{console.error("Recognition canceled:",n),console.log("Audio stop recording")},r.startContinuousRecognitionAsync(),r},uF=async()=>{var t,e;ma.value="",aF.value="";try{Io(),await dee(A=>{if(A){ma.value=A;const r=hF()}})}catch(A){if(console.error(A),Wt.isAxiosError(A)){const r=A;console.log("Error found!"),console.error((t=r.response)==null?void 0:t.data),Sl.setError(((e=r.response)==null?void 0:e.data).message)}else Sl.setError("There was an issue while fetching data")}},lF=async t=>{var e,A;aF.value="";try{(pn.value=="user"||pn.value=="listening")&&Io(),await gee(t)}catch(r){if(console.error(r),Wt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Sl.setError(((A=i.response)==null?void 0:A.data).message)}else Sl.setError("There was an issue while fetching data")}};async function hF(){try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});Co=new MediaRecorder(t,{mimeType:"audio/webm"}),Co.ondataavailable=e=>{e.data.size>0&&P0.push(e.data)},Co.start(),console.log("Audio recording started")}catch(t){console.error("Error starting audio recording:",t)}}async function pee(){return new Promise((t,e)=>{if(!Co)return e("No active recorder found");Co.onstop=async()=>{var r,i,n;const A=new Blob(P0,{type:"audio/webm"});P0=[];try{const s=await(await fee(A)).arrayBuffer();console.log("Audio recording stopped, size:",s.byteLength),console.log("Audio recording stopped, size:",s),console.log("Sending audio for analysis...");const c={audio:await Eee(s),format:"wav",finalAnalysis:!1},u=await Wt.post("/fetchPdfAssessment",c,{headers:{"Content-Type":"application/json"}});console.log("Server response:",(r=u==null?void 0:u.data)==null?void 0:r.body),Eo.audioAnaysis.push((n=(i=u==null?void 0:u.data)==null?void 0:i.body)==null?void 0:n.answer),console.log("store audioAnaysis",Eo.audioAnaysis),console.log("Audio analysis result:",u.data),t(u.data)}catch(o){e(o)}},Co.stop(),console.log("Audio recording stopped")})}async function fee(t){const e=await t.arrayBuffer(),r=await new AudioContext().decodeAudioData(e),i=r.numberOfChannels,n=r.sampleRate,o=r.length*i*2+44,s=new ArrayBuffer(o),a=new DataView(s);u(a,0,"RIFF"),a.setUint32(4,36+r.length*i*2,!0),u(a,8,"WAVE"),u(a,12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,i,!0),a.setUint32(24,n,!0),a.setUint32(28,n*i*2,!0),a.setUint16(32,i*2,!0),a.setUint16(34,16,!0),u(a,36,"data"),a.setUint32(40,r.length*i*2,!0);let c=44;for(let l=0;l<r.length;l++)for(let g=0;g<i;g++){const h=Math.max(-1,Math.min(1,r.getChannelData(g)[l]));a.setInt16(c,h<0?h*32768:h*32767,!0),c+=2}function u(l,g,h){for(let p=0;p<h.length;p++)l.setUint8(g+p,h.charCodeAt(p))}return new Blob([a],{type:"audio/wav"})}function Eee(t){let e="";const A=new Uint8Array(t),r=32768;for(let i=0;i<A.length;i+=r){const n=A.subarray(i,i+r);e+=String.fromCharCode(...Array.from(n))}return btoa(e)}const Cee={class:"flex items-center gap-4 py-2 rounded-full z-10"},Iee={key:0,class:"flex items-center"},Bee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},vee=[Zu('<rect x="0" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0s"></animate></rect><rect x="4" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.1s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.1s"></animate></rect><rect x="8" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate></rect><rect x="12" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.3s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.3s"></animate></rect><rect x="16" y="4" width="2" height="16" rx="1"><animate attributeName="height" values="16;20;16" dur="1s" repeatCount="indefinite" begin="0.4s"></animate><animate attributeName="y" values="4;2;4" dur="1s" repeatCount="indefinite" begin="0.4s"></animate></rect><rect x="20" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.5s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.5s"></animate></rect><rect x="24" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate></rect><rect x="28" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.7s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.7s"></animate></rect><rect x="32" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0.8s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0.8s"></animate></rect>',9)],wee={key:1,class:"flex items-center"},See={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},mee=[Zu('<rect x="0" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0s"></animate></rect><rect x="4" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.1s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.1s"></animate></rect><rect x="8" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.2s"></animate></rect><rect x="12" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.3s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.3s"></animate></rect><rect x="16" y="4" width="2" height="16" rx="1"><animate attributeName="height" values="16;20;16" dur="1s" repeatCount="indefinite" begin="0.4s"></animate><animate attributeName="y" values="4;2;4" dur="1s" repeatCount="indefinite" begin="0.4s"></animate></rect><rect x="20" y="6" width="2" height="12" rx="1"><animate attributeName="height" values="12;16;12" dur="1s" repeatCount="indefinite" begin="0.5s"></animate><animate attributeName="y" values="6;4;6" dur="1s" repeatCount="indefinite" begin="0.5s"></animate></rect><rect x="24" y="8" width="2" height="8" rx="1"><animate attributeName="height" values="8;12;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate><animate attributeName="y" values="8;6;8" dur="1s" repeatCount="indefinite" begin="0.6s"></animate></rect><rect x="28" y="10" width="2" height="4" rx="1"><animate attributeName="height" values="4;8;4" dur="1s" repeatCount="indefinite" begin="0.7s"></animate><animate attributeName="y" values="10;8;10" dur="1s" repeatCount="indefinite" begin="0.7s"></animate></rect><rect x="32" y="11" width="2" height="2" rx="1"><animate attributeName="height" values="2;6;2" dur="1s" repeatCount="indefinite" begin="0.8s"></animate><animate attributeName="y" values="11;9;11" dur="1s" repeatCount="indefinite" begin="0.8s"></animate></rect>',9)],Mee={key:2,class:"flex items-center"},yee=[Zu('<svg width="30" height="30" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="12" y="16" width="40" height="32" rx="8" fill="white" stroke="#9CA3AF" stroke-width="2"></rect><circle cx="24" cy="32" r="4" fill="black"></circle><circle cx="40" cy="32" r="4" fill="black"></circle><line x1="32" y1="10" x2="32" y2="16" stroke="#9CA3AF" stroke-width="2"></line><circle cx="32" cy="8" r="2" fill="white"></circle><circle cx="52" cy="14" r="3" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0s" repeatCount="indefinite"></animate></circle><circle cx="58" cy="10" r="2.5" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0.2s" repeatCount="indefinite"></animate></circle><circle cx="63" cy="6" r="2" fill="white"><animate attributeName="opacity" values="0;1;0" dur="1.2s" begin="0.4s" repeatCount="indefinite"></animate></circle></svg>',1)],Qee={class:"tooltiptext text-genpact-darkest-teal"},Ree=[M("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[M("path",{d:"M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 14 0h-2zm-5 9a7 7 0 0 0 7-7h2a9 9 0 0 1-8 8.94V22h-2v-1.06A9 9 0 0 1 3 13h2a7 7 0 0 0 7 7z"})],-1)],Dee=[M("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[M("path",{d:"M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 14 0h-2zm-5 9a7 7 0 0 0 7-7h2a9 9 0 0 1-8 8.94V22h-2v-1.06A9 9 0 0 1 3 13h2a7 7 0 0 0 7 7z"}),M("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor","stroke-width":"2"})],-1)],Tee=Vt({__name:"NewVoiceConversation",setup(t){const e=aA(),A=Or(),r=ne(""),i=ne(!1),n=ne("Turn on mic"),o=()=>{i.value===!1?e.elevenLabs?(console.log("mic enabled true 11labs"),i.value=!0,ZE(),pn.value="user",n.value="Turn off mic"):(console.log("mic enabled true"),i.value=!0,Io(),uF(),pn.value="user",n.value="Turn off mic"):e.elevenLabs?(console.log("mic enabled false"),hl(),i.value=!1,n.value="Turn on mic"):(console.log("mic enabled false"),yl(),i.value=!1,n.value="Turn on mic")},s=()=>{e.elevenLabs?(console.log("closeConversation 11 labs"),hl(),pn.value="none",i.value=!1):(console.log("closeConversation"),yl(),Io(),pn.value="none",i.value=!1)},a=async()=>{var c,u,l,g,h,p,C,B;try{const E={question:ma.value||qE.value};e.conversations.push(E),e.dotLoader=!0,e.question="";const v={past_messages:e.past_messages,question:ma.value||qE.value,skillId:e.simulationSkill,bandCode:e.band_code,userGenomeFunction:e.genomeFunctionValue,userGenomeRole:e.genomeRoleValue},m=await Ai("/sqlTest",v);if(pn.value="bot",r.value=(u=(c=m==null?void 0:m.data)==null?void 0:c.body)==null?void 0:u.answer,r.value===""){console.log("in the if case calling api again");const S=await Ai("/sqlTest",v);e.addConversation((l=S.data)==null?void 0:l.body,"new")}else console.log("in the else case"),e.addConversation((g=m.data)==null?void 0:g.body,"new");if(e.dotLoader=!1,e.elevenLabs)await kW(r.value.replace(/[*#]/g,""));else if(r.value.includes("Feedback and Assessment")){yl();const S={pastAudioAnalysis:e.audioAnaysis,finalAnalysis:!0},O=await Wt.post("/fetchPdfAssessment",S,{headers:{"Content-Type":"application/json"}});if(console.log((h=O==null?void 0:O.data)==null?void 0:h.body),e.addConversation((p=O==null?void 0:O.data)==null?void 0:p.body,"new"),i.value=!1,r.value.includes("END ROLE PLAY")){const N=r.value.split("END ROLE PLAY")[0];if(N.length<0){e.showVoiceComponent=!1;return}await lF(N.replace(/[*#]/g,"")),e.showVoiceComponent=!1}else e.showVoiceComponent=!1}else await lF(r.value.replace(/[*#]/g,""))}catch(E){if(console.error(E),Wt.isAxiosError(E)){const v=E;console.log("Error found!"),console.error((C=v.response)==null?void 0:C.data),A.setError(((B=v.response)==null?void 0:B.data).message)}else A.setError("There was an issue, please contact helpmate")}};return Ao(ma,async c=>{if(c){if(console.log("Recognized text:",c),ma.value.toLowerCase().includes("play")&&ma.value.length<10){console.log("play command detected, ignoring input");return}pn.value="listening",e.userspeaking=!1,await a(),ma.value=""}}),Ao(qE,async c=>{c&&(console.log("Recognized text:",c),pn.value="listening",await a(),qE.value="")}),(c,u)=>(ue(),ge("div",Cee,[Ee(pn)==="bot"?(ue(),ge("div",Iee,[M("span",null,[(ue(),ge("svg",Bee,vee))])])):Ee(pn)==="user"?(ue(),ge("div",wee,[M("span",null,[(ue(),ge("svg",See,mee))])])):Ee(pn)==="listening"?(ue(),ge("div",Mee,yee)):Dt("",!0),M("div",{class:yt([i.value?"":"animate-pulse","tooltip"])},[M("span",Qee,xt(n.value),1),i.value?(ue(),ge("button",{key:0,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[0]||(u[0]=l=>o())},Ree)):(ue(),ge("button",{key:1,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[1]||(u[1]=l=>o())},Dee))],2),M("button",{class:"rounded-full bg-white p-2 hover:bg-gray-300",onClick:u[2]||(u[2]=l=>s())},[ot(Ee(A4),{class:"h-[10px] w-[10px] text-gray-700"})])]))}}),ya=t=>(Ur("data-v-9ec493aa"),t=t(),Lr(),t),Uee={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},Lee={class:"py-2"},Fee={class:"flex"},Oee={class:"z-1 relative w-full"},xee={class:"flex justify-between my-2 w-full"},bee=ya(()=>M("div",null,null,-1)),Nee={key:0,class:"flex justify-center bg-genpact-darkest-blue px-4 rounded-full"},Kee={class:"relative w-full"},kee={class:"absolute inset-y-0 left-0 flex items-center pl-3"},Pee={class:"tooltip"},Gee=ya(()=>M("span",{class:"tooltiptext text-genpact-darkest-teal"},"Restart",-1)),jee=[ya(()=>M("path",{d:"M12 4C8.229 4 6.343 4 5.172 5.172C4.001 6.344 4 8.229 4 12V18C4 18.943 4 19.414 4.293 19.707C4.586 20 5.057 20 6 20H12C15.771 20 17.657 20 18.828 18.828C19.999 17.656 20 15.771 20 12",stroke:"currentColor","stroke-width":"2"},null,-1)),ya(()=>M("path",{d:"M9 10H15M9 14H12M19 8V2M16 5H22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1))],Yee={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},Hee={key:0},zee=["disabled"],Jee=[ya(()=>M("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"},null,-1))],qee={key:1,class:"tooltip"},Vee=[ya(()=>M("span",{class:"tooltiptext text-genpact-darkest-teal"},"Processing",-1)),ya(()=>M("img",{class:"w-7 h-7",src:GS,alt:"watingIcon"},null,-1))],Wee={class:"flex justify-start gap-2 md:gap-1"},Zee=["disabled"],Xee=ya(()=>M("div",{class:"pt-1 text-start font-sans text-xs font-bold text-gray-500 md:text-sm"},[M("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),_ee=Vt({__name:"NewQuestionSimulation",setup(t,{expose:e}){const A=aA(),r=Or(),i=ne(""),n=ne("");A.question="";const o=ne(null),s=ne(!1),a=ne(0);n.value=A.recognizedText,Ki(()=>{o.value.focus()});const c=()=>{window.location.reload()},u=async()=>{var h,p,C,B,E,v,m,S,O,N,P;try{if(A.question.trim().length<1){console.log("Please enter answer!");return}s.value=!0,A.dotLoader=!0;const D={question:A.question||A.recognizedText};A.conversations.push(D);const T=ne("");T.value=A.question||A.recognizedText,A.question="",o.value&&(o.value.style.height="auto");const z={ohr_id:i.value,past_messages:A.past_messages,question:T.value||A.recognizedText,bandCode:A.band_code,userGenomeFunction:A.genomeFunctionValue,userGenomeRole:A.genomeRoleValue,skillId:A.simulationSkill||"937e84ef-e95d-4327-9afe-e7be2bf420eb"},Q=await Ai("/sqlTest",z);if(a.value+=(p=(h=Q.data)==null?void 0:h.body)==null?void 0:p.totalTokenCount,console.log("Token Count:",a.value),i.value=(B=(C=Q.data)==null?void 0:C.body)==null?void 0:B.ohr,((v=(E=Q==null?void 0:Q.data)==null?void 0:E.body)==null?void 0:v.answer)===""){console.log("in the if case calling api again");const G=await Ai("/sqlTest",z);A.addConversation((m=G.data)==null?void 0:m.body,"new")}else console.log("in the else case"),A.addConversation((S=Q.data)==null?void 0:S.body,"new");s.value=!1,A.dotLoader=!1,A.recognizedText=""}catch(D){if(console.error(D),A.dotLoader=!1,s.value=!1,Wt.isAxiosError(D)){const T=D;console.log("Error found!"),console.error((O=T.response)==null?void 0:O.data),r.setError((P=(N=T.response)==null?void 0:N.data)==null?void 0:P.message)}else r.setError("There was an issue, please contact helpmate")}},l=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),u())},g=h=>{const p=h.target;p.style.height="auto",p.style.height=p.scrollHeight+"px"};return e({sendQuestion:u}),(h,p)=>(ue(),ge("div",Uee,[M("div",Lee,[M("div",Fee,[M("div",Oee,[M("div",xee,[bee,Ee(A).showVoiceComponent?(ue(),ge("div",Nee,[ot(Tee)])):Dt("",!0)]),M("div",Kee,[M("div",kee,[M("div",Pee,[Gee,(ue(),ge("svg",{onClick:c,class:"ml-2 h-7 w-7 rounded",id:"newTopicDisable",width:"7",height:"",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",title:"restart"},jee))])]),M("div",Yee,[s.value?(ue(),ge("div",qee,Vee)):(ue(),ge("div",Hee,[(ue(),ge("svg",{disabled:Ee(A).beginFlag===!0,class:yt([Ee(A).beginFlag===!0?"cursor-not-allowed text-gray-600":"cursor-pointer","bi bi-send ml-2 h-7 w-7 rotate-45 rounded"]),onClick:p[0]||(p[0]=C=>Ee(A).searchBoxdisable===!1||Ee(A).beginFlag===!0?"":u()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},Jee,10,zee))]))]),M("div",Wee,[$t(M("textarea",{onPaste:p[1]||(p[1]=oS(()=>{},["prevent"])),onKeydown:p[2]||(p[2]=C=>s.value?"":l(C)),disabled:Ee(A).searchBoxdisable===!1||Ee(A).beginFlag===!0,"onUpdate:modelValue":p[3]||(p[3]=C=>Ee(A).question=C),class:yt(["fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] px-[70px]",Ee(A).beginFlag===!0||Ee(A).searchBoxdisable===!1?"cursor-not-allowed bg-[#e5e7eb]":"bg-white"]),placeholder:"Write your answer here...",ref_key:"AiSearch",ref:o,rows:"1",onInput:p[4]||(p[4]=C=>g(C)),style:{overflow:"hidden",transition:"height 0.2s"}},null,42,Zee),[[UA,Ee(A).question]])])]),Xee])])])]))}}),K1e="",$ee=IA(_ee,[["__scopeId","data-v-9ec493aa"]]),II=t=>(Ur("data-v-6c0980b5"),t=t(),Lr(),t),ete={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},tte={class:"py-2"},Ate={class:"flex"},rte={class:"z-1 relative w-full"},ite={class:"relative w-full"},nte={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},ste={key:0},ote=["disabled"],ate=[II(()=>M("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"},null,-1))],cte={key:1,class:"tooltip"},ute=[II(()=>M("span",{class:"tooltiptext fontFormattingAMA"},"Waiting for response",-1)),II(()=>M("img",{class:"w-7 h-7",src:GS,alt:"watingIcon"},null,-1))],lte={class:"flex justify-start gap-2 md:gap-1"},hte=["disabled"],gte=II(()=>M("div",{class:"pt-1 text-start font-sans text-[0.8125rem] md:text-[0.9375rem] font-bold text-gray-500"},[M("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),dte=Vt({__name:"NewMDMQuestionSimulation",setup(t){const e=aA(),A=Or(),r=ne("");e.question="";const i=ne(null),n=ne(!1),o=ne(oo),s=ne(!1);r.value=e.recognizedText,Ki(()=>{i.value.focus()});const a=u=>{const l=u.length;o.value=oo-l,n.value=l>=oo},c=async()=>{var u,l,g;console.log("options fdsfdscdzxfsdv",e.recognizedText);try{if(console.log("options fdsfdscdzxfsdv",e.recognizedText),e.question.trim().length<1){console.log("Please enter answer!");return}s.value=!0,e.dotLoader=!0;const h={question:e.question||e.recognizedText};console.log("ques",h),e.conversations.push(h);const p=ne("");p.value=e.question||e.recognizedText,e.question="";const C={assessmentId:e.simulationSkill,question:p.value,past_messages:e.past_messages,prompt:e.generatedPrompt,assessmentType:e.assessmentType,userFunction:"HR",empSeniority:e.empSeniority,functionRole:e.functionRole,userBand:e.band_code,storeFinalFeedback:e.storeFinalFeedback,storeFinalScore:e.storeFinalScore};console.log("Payload for MDM1==> ",C);let B;Os==="prod"?B="/ManualExportActivity":B="/fetchCompletionDemo";const E=await Ai(B,C);e.addConversation((u=E.data)==null?void 0:u.body,"new"),s.value=!1,e.dotLoader=!1,e.recognizedText=""}catch(h){if(console.error(h),Wt.isAxiosError(h)){const p=h;console.log("Error found!"),console.error((l=p.response)==null?void 0:l.data),A.setError(((g=p.response)==null?void 0:g.data).message)}else A.setError("There was an issue, please contact helpmate")}};return(u,l)=>(ue(),ge("div",ete,[M("div",tte,[M("div",Ate,[M("div",rte,[M("div",ite,[M("div",nte,[s.value?(ue(),ge("div",cte,ute)):(ue(),ge("div",ste,[(ue(),ge("svg",{disabled:Ee(e).beginFlag===!0,class:yt([Ee(e).beginFlag===!0?"cursor-not-allowed text-gray-600":"cursor-pointer","bi bi-send ml-2 h-7 w-7 rotate-45 rounded"]),onClick:l[0]||(l[0]=g=>Ee(e).searchBoxdisable===!1||Ee(e).beginFlag===!0?"":c()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},ate,10,ote))]))]),M("div",lte,[$t(M("input",{onKeyup:[l[1]||(l[1]=jD(g=>s.value?"":c(),["enter"])),l[3]||(l[3]=g=>a(Ee(e).question))],disabled:Ee(e).beginFlag===!0||Ee(e).searchBoxdisable===!1,class:yt([Ee(e).beginFlag===!0||Ee(e).searchBoxdisable===!1?"cursor-not-allowed bg-[#e5e7eb]":"bg-white","fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] pl-[30px] pr-[70px]"]),"onUpdate:modelValue":l[2]||(l[2]=g=>Ee(e).question=g),placeholder:"Write your answer here...",type:"text",ref_key:"AiSearch",ref:i},null,42,hte),[[UA,Ee(e).question]])])]),gte])])])]))}}),j1e="",pte=IA(dte,[["__scopeId","data-v-6c0980b5"]]),fte={},Ete={class:"flex min-h-screen justify-center -mt-16"},Cte=[M("div",{class:"flex items-center justify-center"},[M("img",{class:"loadercss",src:ao,alt:"Loader Gif"})],-1)];function Ite(t,e){return ue(),ge("div",Ete,Cte)}const gF=IA(fte,[["render",Ite]]);function pA(t){return pA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pA(t)}var hs=Uint8Array,fn=Uint16Array,G0=Int32Array,j0=new hs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Y0=new hs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dF=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pF=function(t,e){for(var A=new fn(31),r=0;r<31;++r)A[r]=e+=1<<t[r-1];for(var i=new G0(A[30]),r=1;r<30;++r)for(var n=A[r];n<A[r+1];++n)i[n]=n-A[r]<<5|r;return{b:A,r:i}},fF=pF(j0,2),Bte=fF.b,H0=fF.r;Bte[28]=258,H0[258]=28;for(var vte=pF(Y0,0),EF=vte.r,z0=new fn(32768),kA=0;kA<32768;++kA){var Qa=(kA&43690)>>1|(kA&21845)<<1;Qa=(Qa&52428)>>2|(Qa&13107)<<2,Qa=(Qa&61680)>>4|(Qa&3855)<<4,z0[kA]=((Qa&65280)>>8|(Qa&255)<<8)>>1}for(var np=function(t,e,A){for(var r=t.length,i=0,n=new fn(e);i<r;++i)t[i]&&++n[t[i]-1];var o=new fn(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var s;if(A){s=new fn(1<<e);var a=15-e;for(i=0;i<r;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],l=o[t[i]-1]++<<u,g=l|(1<<u)-1;l<=g;++l)s[z0[l]>>a]=c}else for(s=new fn(r),i=0;i<r;++i)t[i]&&(s[i]=z0[o[t[i]-1]++]>>15-t[i]);return s},zc=new hs(288),kA=0;kA<144;++kA)zc[kA]=8;for(var kA=144;kA<256;++kA)zc[kA]=9;for(var kA=256;kA<280;++kA)zc[kA]=7;for(var kA=280;kA<288;++kA)zc[kA]=8;for(var BI=new hs(32),kA=0;kA<32;++kA)BI[kA]=5;var wte=np(zc,9,0),Ste=np(BI,5,0),CF=function(t){return(t+7)/8|0},mte=function(t,e,A){return(e==null||e<0)&&(e=0),(A==null||A>t.length)&&(A=t.length),new hs(t.subarray(e,A))},Bo=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8},sp=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8,t[r+2]|=A>>16},J0=function(t,e){for(var A=[],r=0;r<t.length;++r)t[r]&&A.push({s:r,f:t[r]});var i=A.length,n=A.slice();if(!i)return{t:wF,l:0};if(i==1){var o=new hs(A[0].s+1);return o[A[0].s]=1,{t:o,l:1}}A.sort(function(O,N){return O.f-N.f}),A.push({s:-1,f:25001});var s=A[0],a=A[1],c=0,u=1,l=2;for(A[0]={s:-1,f:s.f+a.f,l:s,r:a};u!=i-1;)s=A[A[c].f<A[l].f?c++:l++],a=A[c!=u&&A[c].f<A[l].f?c++:l++],A[u++]={s:-1,f:s.f+a.f,l:s,r:a};for(var g=n[0].s,r=1;r<i;++r)n[r].s>g&&(g=n[r].s);var h=new fn(g+1),p=q0(A[u-1],h,0);if(p>e){var r=0,C=0,B=p-e,E=1<<B;for(n.sort(function(N,P){return h[P.s]-h[N.s]||N.f-P.f});r<i;++r){var v=n[r].s;if(h[v]>e)C+=E-(1<<p-h[v]),h[v]=e;else break}for(C>>=B;C>0;){var m=n[r].s;h[m]<e?C-=1<<e-h[m]++-1:++r}for(;r>=0&&C;--r){var S=n[r].s;h[S]==e&&(--h[S],++C)}p=e}return{t:new hs(h),l:p}},q0=function(t,e,A){return t.s==-1?Math.max(q0(t.l,e,A+1),q0(t.r,e,A+1)):e[t.s]=A},IF=function(t){for(var e=t.length;e&&!t[--e];);for(var A=new fn(++e),r=0,i=t[0],n=1,o=function(a){A[r++]=a},s=1;s<=e;++s)if(t[s]==i&&s!=e)++n;else{if(!i&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(i),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(i);n=1,i=t[s]}return{c:A.subarray(0,r),n:e}},op=function(t,e){for(var A=0,r=0;r<e.length;++r)A+=t[r]*e[r];return A},BF=function(t,e,A){var r=A.length,i=CF(e+2);t[i]=r&255,t[i+1]=r>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var n=0;n<r;++n)t[i+n+4]=A[n];return(i+4+r)*8},vF=function(t,e,A,r,i,n,o,s,a,c,u){Bo(e,u++,A),++i[256];for(var l=J0(i,15),g=l.t,h=l.l,p=J0(n,15),C=p.t,B=p.l,E=IF(g),v=E.c,m=E.n,S=IF(C),O=S.c,N=S.n,P=new fn(19),D=0;D<v.length;++D)++P[v[D]&31];for(var D=0;D<O.length;++D)++P[O[D]&31];for(var T=J0(P,7),z=T.t,Q=T.l,R=19;R>4&&!z[dF[R-1]];--R);var G=c+5<<3,k=op(i,zc)+op(n,BI)+o,$=op(i,g)+op(n,C)+o+14+3*R+op(P,z)+2*P[16]+3*P[17]+7*P[18];if(a>=0&&G<=k&&G<=$)return BF(e,u,t.subarray(a,a+c));var W,ie,_,ce;if(Bo(e,u,1+($<k)),u+=2,$<k){W=np(g,h,0),ie=g,_=np(C,B,0),ce=C;var ve=np(z,Q,0);Bo(e,u,m-257),Bo(e,u+5,N-1),Bo(e,u+10,R-4),u+=14;for(var D=0;D<R;++D)Bo(e,u+3*D,z[dF[D]]);u+=3*R;for(var fe=[v,O],U=0;U<2;++U)for(var Y=fe[U],D=0;D<Y.length;++D){var X=Y[D]&31;Bo(e,u,ve[X]),u+=z[X],X>15&&(Bo(e,u,Y[D]>>5&127),u+=Y[D]>>12)}}else W=wte,ie=zc,_=Ste,ce=BI;for(var D=0;D<s;++D){var re=r[D];if(re>255){var X=re>>18&31;sp(e,u,W[X+257]),u+=ie[X+257],X>7&&(Bo(e,u,re>>23&31),u+=j0[X]);var oe=re&31;sp(e,u,_[oe]),u+=ce[oe],oe>3&&(sp(e,u,re>>5&8191),u+=Y0[oe])}else sp(e,u,W[re]),u+=ie[re]}return sp(e,u,W[256]),u+ie[256]},Mte=new G0([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wF=new hs(0),yte=function(t,e,A,r,i,n){var o=n.z||t.length,s=new hs(r+o+5*(1+Math.ceil(o/7e3))+i),a=s.subarray(r,s.length-i),c=n.l,u=(n.r||0)&7;if(e){u&&(a[0]=n.r>>3);for(var l=Mte[e-1],g=l>>13,h=l&8191,p=(1<<A)-1,C=n.p||new fn(32768),B=n.h||new fn(p+1),E=Math.ceil(A/3),v=2*E,m=function(J){return(t[J]^t[J+1]<<E^t[J+2]<<v)&p},S=new G0(25e3),O=new fn(288),N=new fn(32),P=0,D=0,T=n.i||0,z=0,Q=n.w||0,R=0;T+2<o;++T){var G=m(T),k=T&32767,$=B[G];if(C[k]=$,B[G]=k,Q<=T){var W=o-T;if((P>7e3||z>24576)&&(W>423||!c)){u=vF(t,a,0,S,O,N,D,z,R,T-R,u),z=P=D=0,R=T;for(var ie=0;ie<286;++ie)O[ie]=0;for(var ie=0;ie<30;++ie)N[ie]=0}var _=2,ce=0,ve=h,fe=k-$&32767;if(W>2&&G==m(T-fe))for(var U=Math.min(g,W)-1,Y=Math.min(32767,T),X=Math.min(258,W);fe<=Y&&--ve&&k!=$;){if(t[T+_]==t[T+_-fe]){for(var re=0;re<X&&t[T+re]==t[T+re-fe];++re);if(re>_){if(_=re,ce=fe,re>U)break;for(var oe=Math.min(fe,re-2),Z=0,ie=0;ie<oe;++ie){var ae=T-fe+ie&32767,se=C[ae],de=ae-se&32767;de>Z&&(Z=de,$=ae)}}}k=$,$=C[k],fe+=k-$&32767}if(ce){S[z++]=268435456|H0[_]<<18|EF[ce];var De=H0[_]&31,j=EF[ce]&31;D+=j0[De]+Y0[j],++O[257+De],++N[j],Q=T+_,++P}else S[z++]=t[T],++O[t[T]]}}for(T=Math.max(T,Q);T<o;++T)S[z++]=t[T],++O[t[T]];u=vF(t,a,c,S,O,N,D,z,R,T-R,u),c||(n.r=u&7|a[u/8|0]<<3,u-=7,n.h=B,n.p=C,n.i=T,n.w=Q)}else{for(var T=n.w||0;T<o+c;T+=65535){var q=T+65535;q>=o&&(a[u/8|0]=c,q=o),u=BF(a,u+1,t.subarray(T,q))}n.i=o}return mte(s,0,r+CF(u)+i)},SF=function(){var t=1,e=0;return{p:function(A){for(var r=t,i=e,n=A.length|0,o=0;o!=n;){for(var s=Math.min(o+2655,n);o<s;++o)i+=r+=A[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},Qte=function(t,e,A,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new hs(n.length+t.length);o.set(n),o.set(t,n.length),t=o,i.w=n.length}return yte(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,A,r,i)},mF=function(t,e,A){for(;A;++e)t[e]=A,A>>>=8},Rte=function(t,e){var A=e.level,r=A==0?0:A<6?1:A==9?3:2;if(t[0]=120,t[1]=r<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=SF();i.p(e.dictionary),mF(t,2,i.d())}};function V0(t,e){e||(e={});var A=SF();A.p(t);var r=Qte(t,e,e.dictionary?6:2,4);return Rte(r,e),mF(r,r.length-4,A.d()),r}var Dte=typeof TextDecoder<"u"&&new TextDecoder,Tte=0;try{Dte.decode(wF,{stream:!0}),Tte=1}catch{}function Ute(t){if(Array.isArray(t))return t}function Lte(t,e){var A=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(A!=null){var r,i,n,o,s=[],a=!0,c=!1;try{if(n=(A=A.call(t)).next,e===0){if(Object(A)!==A)return;a=!1}else for(;!(a=(r=n.call(A)).done)&&(s.push(r.value),s.length!==e);a=!0);}catch(u){c=!0,i=u}finally{try{if(!a&&A.return!=null&&(o=A.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function MF(t,e){(e==null||e>t.length)&&(e=t.length);for(var A=0,r=Array(e);A<e;A++)r[A]=t[A];return r}function Fte(t,e){if(t){if(typeof t=="string")return MF(t,e);var A={}.toString.call(t).slice(8,-1);return A==="Object"&&t.constructor&&(A=t.constructor.name),A==="Map"||A==="Set"?Array.from(t):A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A)?MF(t,e):void 0}}function Ote(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
36
36
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yF(t,e){return Ute(t)||Lte(t,e)||Fte(t,e)||Ote()}function QF(t,e="utf8"){return new TextDecoder(e).decode(t)}const xte=new TextEncoder;function bte(t){return xte.encode(t)}const Nte=1024*8,Kte=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),W0={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class Z0{constructor(e=Nte,A={}){RA(this,"buffer");RA(this,"byteLength");RA(this,"byteOffset");RA(this,"length");RA(this,"offset");RA(this,"lastWrittenByte");RA(this,"littleEndian");RA(this,"_data");RA(this,"_mark");RA(this,"_marks");let r=!1;typeof e=="number"?e=new ArrayBuffer(e):(r=!0,this.lastWrittenByte=e.byteLength);const i=A.offset?A.offset>>>0:0,n=e.byteLength-i;let o=i;(ArrayBuffer.isView(e)||e instanceof Z0)&&(e.byteLength!==e.buffer.byteLength&&(o=e.byteOffset+i),e=e.buffer),r?this.lastWrittenByte=n:this.lastWrittenByte=0,this.buffer=e,this.length=n,this.byteLength=n,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,n),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const r=(this.offset+e)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,A){const r=W0[A].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,n=this.buffer.slice(i,i+r);if(this.littleEndian===Kte&&A!=="uint8"&&A!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const a=new W0[A](s.buffer);return this.offset+=r,a.reverse(),a}const o=new W0[A](n);return this.offset+=r,o}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let A="";for(let r=0;r<e;r++)A+=this.readChar();return A}readUtf8(e=1){return QF(this.readBytes(e))}decodeText(e=1,A="utf8"){return QF(this.readBytes(e),A)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let A=0;A<e.length;A++)this._data.setUint8(this.offset++,e[A]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let A=0;A<e.length;A++)this.writeUint8(e.charCodeAt(A));return this}writeUtf8(e){return this.writeBytes(bte(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const kte=4,RF=0,DF=1,Pte=2;function Ql(t){let e=t.length;for(;--e>=0;)t[e]=0}const Gte=0,TF=1,jte=2,Yte=3,Hte=258,X0=29,ap=256,cp=ap+1+X0,Rl=30,_0=19,UF=2*cp+1,Jc=15,$0=16,zte=7,em=256,LF=16,FF=17,OF=18,tm=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),vI=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Jte=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),xF=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qte=512,vo=new Array((cp+2)*2);Ql(vo);const up=new Array(Rl*2);Ql(up);const lp=new Array(qte);Ql(lp);const hp=new Array(Hte-Yte+1);Ql(hp);const Am=new Array(X0);Ql(Am);const wI=new Array(Rl);Ql(wI);function rm(t,e,A,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=A,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let bF,NF,KF;function im(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const kF=t=>t<256?lp[t]:lp[256+(t>>>7)],gp=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},An=(t,e,A)=>{t.bi_valid>$0-A?(t.bi_buf|=e<<t.bi_valid&65535,gp(t,t.bi_buf),t.bi_buf=e>>$0-t.bi_valid,t.bi_valid+=A-$0):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=A)},Ks=(t,e,A)=>{An(t,A[e*2],A[e*2+1])},PF=(t,e)=>{let A=0;do A|=t&1,t>>>=1,A<<=1;while(--e>0);return A>>>1},Vte=t=>{t.bi_valid===16?(gp(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Wte=(t,e)=>{const A=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,a=e.stat_desc.max_length;let c,u,l,g,h,p,C=0;for(g=0;g<=Jc;g++)t.bl_count[g]=0;for(A[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<UF;c++)u=t.heap[c],g=A[A[u*2+1]*2+1]+1,g>a&&(g=a,C++),A[u*2+1]=g,!(u>r)&&(t.bl_count[g]++,h=0,u>=s&&(h=o[u-s]),p=A[u*2],t.opt_len+=p*(g+h),n&&(t.static_len+=p*(i[u*2+1]+h)));if(C!==0){do{for(g=a-1;t.bl_count[g]===0;)g--;t.bl_count[g]--,t.bl_count[g+1]+=2,t.bl_count[a]--,C-=2}while(C>0);for(g=a;g!==0;g--)for(u=t.bl_count[g];u!==0;)l=t.heap[--c],!(l>r)&&(A[l*2+1]!==g&&(t.opt_len+=(g-A[l*2+1])*A[l*2],A[l*2+1]=g),u--)}},GF=(t,e,A)=>{const r=new Array(Jc+1);let i=0,n,o;for(n=1;n<=Jc;n++)i=i+A[n-1]<<1,r[n]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=PF(r[s]++,s))}},Zte=()=>{let t,e,A,r,i;const n=new Array(Jc+1);for(A=0,r=0;r<X0-1;r++)for(Am[r]=A,t=0;t<1<<tm[r];t++)hp[A++]=r;for(hp[A-1]=r,i=0,r=0;r<16;r++)for(wI[r]=i,t=0;t<1<<vI[r];t++)lp[i++]=r;for(i>>=7;r<Rl;r++)for(wI[r]=i<<7,t=0;t<1<<vI[r]-7;t++)lp[256+i++]=r;for(e=0;e<=Jc;e++)n[e]=0;for(t=0;t<=143;)vo[t*2+1]=8,t++,n[8]++;for(;t<=255;)vo[t*2+1]=9,t++,n[9]++;for(;t<=279;)vo[t*2+1]=7,t++,n[7]++;for(;t<=287;)vo[t*2+1]=8,t++,n[8]++;for(GF(vo,cp+1,n),t=0;t<Rl;t++)up[t*2+1]=5,up[t*2]=PF(t,5);bF=new rm(vo,tm,ap+1,cp,Jc),NF=new rm(up,vI,0,Rl,Jc),KF=new rm(new Array(0),Jte,0,_0,zte)},jF=t=>{let e;for(e=0;e<cp;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Rl;e++)t.dyn_dtree[e*2]=0;for(e=0;e<_0;e++)t.bl_tree[e*2]=0;t.dyn_ltree[em*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},YF=t=>{t.bi_valid>8?gp(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},HF=(t,e,A,r)=>{const i=e*2,n=A*2;return t[i]<t[n]||t[i]===t[n]&&r[e]<=r[A]},nm=(t,e,A)=>{const r=t.heap[A];let i=A<<1;for(;i<=t.heap_len&&(i<t.heap_len&&HF(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!HF(e,r,t.heap[i],t.depth));)t.heap[A]=t.heap[i],A=i,i<<=1;t.heap[A]=r},zF=(t,e,A)=>{let r,i,n=0,o,s;if(t.sym_next!==0)do r=t.pending_buf[t.sym_buf+n++]&255,r+=(t.pending_buf[t.sym_buf+n++]&255)<<8,i=t.pending_buf[t.sym_buf+n++],r===0?Ks(t,i,e):(o=hp[i],Ks(t,o+ap+1,e),s=tm[o],s!==0&&(i-=Am[o],An(t,i,s)),r--,o=kF(r),Ks(t,o,A),s=vI[o],s!==0&&(r-=wI[o],An(t,r,s)));while(n<t.sym_next);Ks(t,em,e)},sm=(t,e)=>{const A=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,n=e.stat_desc.elems;let o,s,a=-1,c;for(t.heap_len=0,t.heap_max=UF,o=0;o<n;o++)A[o*2]!==0?(t.heap[++t.heap_len]=a=o,t.depth[o]=0):A[o*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=a<2?++a:0,A[c*2]=1,t.depth[c]=0,t.opt_len--,i&&(t.static_len-=r[c*2+1]);for(e.max_code=a,o=t.heap_len>>1;o>=1;o--)nm(t,A,o);c=n;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],nm(t,A,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,A[c*2]=A[o*2]+A[s*2],t.depth[c]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,A[o*2+1]=A[s*2+1]=c,t.heap[1]=c++,nm(t,A,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Wte(t,e),GF(A,a,t.bl_count)},JF=(t,e,A)=>{let r,i=-1,n,o=e[0*2+1],s=0,a=7,c=4;for(o===0&&(a=138,c=3),e[(A+1)*2+1]=65535,r=0;r<=A;r++)n=o,o=e[(r+1)*2+1],!(++s<a&&n===o)&&(s<c?t.bl_tree[n*2]+=s:n!==0?(n!==i&&t.bl_tree[n*2]++,t.bl_tree[LF*2]++):s<=10?t.bl_tree[FF*2]++:t.bl_tree[OF*2]++,s=0,i=n,o===0?(a=138,c=3):n===o?(a=6,c=3):(a=7,c=4))},qF=(t,e,A)=>{let r,i=-1,n,o=e[0*2+1],s=0,a=7,c=4;for(o===0&&(a=138,c=3),r=0;r<=A;r++)if(n=o,o=e[(r+1)*2+1],!(++s<a&&n===o)){if(s<c)do Ks(t,n,t.bl_tree);while(--s!==0);else n!==0?(n!==i&&(Ks(t,n,t.bl_tree),s--),Ks(t,LF,t.bl_tree),An(t,s-3,2)):s<=10?(Ks(t,FF,t.bl_tree),An(t,s-3,3)):(Ks(t,OF,t.bl_tree),An(t,s-11,7));s=0,i=n,o===0?(a=138,c=3):n===o?(a=6,c=3):(a=7,c=4)}},Xte=t=>{let e;for(JF(t,t.dyn_ltree,t.l_desc.max_code),JF(t,t.dyn_dtree,t.d_desc.max_code),sm(t,t.bl_desc),e=_0-1;e>=3&&t.bl_tree[xF[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},_te=(t,e,A,r)=>{let i;for(An(t,e-257,5),An(t,A-1,5),An(t,r-4,4),i=0;i<r;i++)An(t,t.bl_tree[xF[i]*2+1],3);qF(t,t.dyn_ltree,e-1),qF(t,t.dyn_dtree,A-1)},$te=t=>{let e=4093624447,A;for(A=0;A<=31;A++,e>>>=1)if(e&1&&t.dyn_ltree[A*2]!==0)return RF;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return DF;for(A=32;A<ap;A++)if(t.dyn_ltree[A*2]!==0)return DF;return RF};let VF=!1;const eAe=t=>{VF||(Zte(),VF=!0),t.l_desc=new im(t.dyn_ltree,bF),t.d_desc=new im(t.dyn_dtree,NF),t.bl_desc=new im(t.bl_tree,KF),t.bi_buf=0,t.bi_valid=0,jF(t)},WF=(t,e,A,r)=>{An(t,(Gte<<1)+(r?1:0),3),YF(t),gp(t,A),gp(t,~A),A&&t.pending_buf.set(t.window.subarray(e,e+A),t.pending),t.pending+=A},tAe=t=>{An(t,TF<<1,3),Ks(t,em,vo),Vte(t)},AAe=(t,e,A,r)=>{let i,n,o=0;t.level>0?(t.strm.data_type===Pte&&(t.strm.data_type=$te(t)),sm(t,t.l_desc),sm(t,t.d_desc),o=Xte(t),i=t.opt_len+3+7>>>3,n=t.static_len+3+7>>>3,n<=i&&(i=n)):i=n=A+5,A+4<=i&&e!==-1?WF(t,e,A,r):t.strategy===kte||n===i?(An(t,(TF<<1)+(r?1:0),3),zF(t,vo,up)):(An(t,(jte<<1)+(r?1:0),3),_te(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),zF(t,t.dyn_ltree,t.dyn_dtree)),jF(t),r&&YF(t)},rAe=(t,e,A)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=A,e===0?t.dyn_ltree[A*2]++:(t.matches++,e--,t.dyn_ltree[(hp[A]+ap+1)*2]++,t.dyn_dtree[kF(e)*2]++),t.sym_next===t.sym_end);var iAe=eAe,nAe=WF,sAe=AAe,oAe=rAe,aAe=tAe,cAe={_tr_init:iAe,_tr_stored_block:nAe,_tr_flush_block:sAe,_tr_tally:oAe,_tr_align:aAe},dp=(t,e,A,r)=>{let i=t&65535|0,n=t>>>16&65535|0,o=0;for(;A!==0;){o=A>2e3?2e3:A,A-=o;do i=i+e[r++]|0,n=n+i|0;while(--o);i%=65521,n%=65521}return i|n<<16|0};const uAe=()=>{let t,e=[];for(var A=0;A<256;A++){t=A;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[A]=t}return e},lAe=new Uint32Array(uAe());var Vr=(t,e,A,r)=>{const i=lAe,n=r+A;t^=-1;for(let o=r;o<n;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Dl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},pp={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:hAe,_tr_stored_block:om,_tr_flush_block:gAe,_tr_tally:Ra,_tr_align:dAe}=cAe,{Z_NO_FLUSH:Da,Z_PARTIAL_FLUSH:pAe,Z_FULL_FLUSH:fAe,Z_FINISH:Gn,Z_BLOCK:ZF,Z_OK:ci,Z_STREAM_END:XF,Z_STREAM_ERROR:ks,Z_DATA_ERROR:EAe,Z_BUF_ERROR:am,Z_DEFAULT_COMPRESSION:CAe,Z_FILTERED:IAe,Z_HUFFMAN_ONLY:SI,Z_RLE:BAe,Z_FIXED:vAe,Z_DEFAULT_STRATEGY:wAe,Z_UNKNOWN:SAe,Z_DEFLATED:mI}=pp,mAe=9,MAe=15,yAe=8,QAe=29,cm=256+1+QAe,RAe=30,DAe=19,TAe=2*cm+1,UAe=15,nA=3,Ta=258,Ps=Ta+nA+1,LAe=32,Tl=42,um=57,lm=69,hm=73,gm=91,dm=103,qc=113,fp=666,ji=1,Ul=2,Vc=3,Ll=4,FAe=3,Wc=(t,e)=>(t.msg=Dl[e],e),_F=t=>t*2-(t>4?9:0),Ua=t=>{let e=t.length;for(;--e>=0;)t[e]=0},OAe=t=>{let e,A,r,i=t.w_size;e=t.hash_size,r=e;do A=t.head[--r],t.head[r]=A>=i?A-i:0;while(--e);e=i,r=e;do A=t.prev[--r],t.prev[r]=A>=i?A-i:0;while(--e)};let La=(t,e,A)=>(e<<t.hash_shift^A)&t.hash_mask;const En=t=>{const e=t.state;let A=e.pending;A>t.avail_out&&(A=t.avail_out),A!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+A),t.next_out),t.next_out+=A,e.pending_out+=A,t.total_out+=A,t.avail_out-=A,e.pending-=A,e.pending===0&&(e.pending_out=0))},Cn=(t,e)=>{gAe(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,En(t.strm)},EA=(t,e)=>{t.pending_buf[t.pending++]=e},Ep=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},pm=(t,e,A,r)=>{let i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),A),t.state.wrap===1?t.adler=dp(t.adler,e,i,A):t.state.wrap===2&&(t.adler=Vr(t.adler,e,i,A)),t.next_in+=i,t.total_in+=i,i)},$F=(t,e)=>{let A=t.max_chain_length,r=t.strstart,i,n,o=t.prev_length,s=t.nice_match;const a=t.strstart>t.w_size-Ps?t.strstart-(t.w_size-Ps):0,c=t.window,u=t.w_mask,l=t.prev,g=t.strstart+Ta;let h=c[r+o-1],p=c[r+o];t.prev_length>=t.good_match&&(A>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(c[i+o]!==p||c[i+o-1]!==h||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<g);if(n=Ta-(g-r),r=g-Ta,n>o){if(t.match_start=e,o=n,n>=s)break;h=c[r+o-1],p=c[r+o]}}while((e=l[e&u])>a&&--A!==0);return o<=t.lookahead?o:t.lookahead},Fl=t=>{const e=t.w_size;let A,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Ps)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),OAe(t),r+=e),t.strm.avail_in===0)break;if(A=pm(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=A,t.lookahead+t.insert>=nA)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=La(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=La(t,t.ins_h,t.window[i+nA-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<nA)););}while(t.lookahead<Ps&&t.strm.avail_in!==0)},eO=(t,e)=>{let A=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r,i,n,o=0,s=t.strm.avail_in;do{if(r=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n||(n=t.strm.avail_out-n,i=t.strstart-t.block_start,r>i+t.strm.avail_in&&(r=i+t.strm.avail_in),r>n&&(r=n),r<A&&(r===0&&e!==Gn||e===Da||r!==i+t.strm.avail_in)))break;o=e===Gn&&r===i+t.strm.avail_in?1:0,om(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,En(t.strm),i&&(i>r&&(i=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,r-=i),r&&(pm(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?Ll:e!==Da&&e!==Gn&&t.strm.avail_in===0&&t.strstart===t.block_start?Ul:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(pm(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,A=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=A||(i||e===Gn)&&e!==Da&&t.strm.avail_in===0&&i<=n)&&(r=i>n?n:i,o=e===Gn&&t.strm.avail_in===0&&r===i?1:0,om(t,t.block_start,r,o),t.block_start+=r,En(t.strm)),o?Vc:ji)},fm=(t,e)=>{let A,r;for(;;){if(t.lookahead<Ps){if(Fl(t),t.lookahead<Ps&&e===Da)return ji;if(t.lookahead===0)break}if(A=0,t.lookahead>=nA&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+nA-1]),A=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),A!==0&&t.strstart-A<=t.w_size-Ps&&(t.match_length=$F(t,A)),t.match_length>=nA)if(r=Ra(t,t.strstart-t.match_start,t.match_length-nA),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=nA){t.match_length--;do t.strstart++,t.ins_h=La(t,t.ins_h,t.window[t.strstart+nA-1]),A=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=La(t,t.ins_h,t.window[t.strstart+1]);else r=Ra(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Cn(t,!1),t.strm.avail_out===0))return ji}return t.insert=t.strstart<nA-1?t.strstart:nA-1,e===Gn?(Cn(t,!0),t.strm.avail_out===0?Vc:Ll):t.sym_next&&(Cn(t,!1),t.strm.avail_out===0)?ji:Ul},Ol=(t,e)=>{let A,r,i;for(;;){if(t.lookahead<Ps){if(Fl(t),t.lookahead<Ps&&e===Da)return ji;if(t.lookahead===0)break}if(A=0,t.lookahead>=nA&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+nA-1]),A=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=nA-1,A!==0&&t.prev_length<t.max_lazy_match&&t.strstart-A<=t.w_size-Ps&&(t.match_length=$F(t,A),t.match_length<=5&&(t.strategy===IAe||t.match_length===nA&&t.strstart-t.match_start>4096)&&(t.match_length=nA-1)),t.prev_length>=nA&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-nA,r=Ra(t,t.strstart-1-t.prev_match,t.prev_length-nA),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+nA-1]),A=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=nA-1,t.strstart++,r&&(Cn(t,!1),t.strm.avail_out===0))return ji}else if(t.match_available){if(r=Ra(t,0,t.window[t.strstart-1]),r&&Cn(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return ji}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Ra(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<nA-1?t.strstart:nA-1,e===Gn?(Cn(t,!0),t.strm.avail_out===0?Vc:Ll):t.sym_next&&(Cn(t,!1),t.strm.avail_out===0)?ji:Ul},xAe=(t,e)=>{let A,r,i,n;const o=t.window;for(;;){if(t.lookahead<=Ta){if(Fl(t),t.lookahead<=Ta&&e===Da)return ji;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=nA&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){n=t.strstart+Ta;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<n);t.match_length=Ta-(n-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=nA?(A=Ra(t,1,t.match_length-nA),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(A=Ra(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),A&&(Cn(t,!1),t.strm.avail_out===0))return ji}return t.insert=0,e===Gn?(Cn(t,!0),t.strm.avail_out===0?Vc:Ll):t.sym_next&&(Cn(t,!1),t.strm.avail_out===0)?ji:Ul},bAe=(t,e)=>{let A;for(;;){if(t.lookahead===0&&(Fl(t),t.lookahead===0)){if(e===Da)return ji;break}if(t.match_length=0,A=Ra(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,A&&(Cn(t,!1),t.strm.avail_out===0))return ji}return t.insert=0,e===Gn?(Cn(t,!0),t.strm.avail_out===0?Vc:Ll):t.sym_next&&(Cn(t,!1),t.strm.avail_out===0)?ji:Ul};function Gs(t,e,A,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=A,this.max_chain=r,this.func=i}const Cp=[new Gs(0,0,0,0,eO),new Gs(4,4,8,4,fm),new Gs(4,5,16,8,fm),new Gs(4,6,32,32,fm),new Gs(4,4,16,16,Ol),new Gs(8,16,32,32,Ol),new Gs(8,16,128,128,Ol),new Gs(8,32,128,256,Ol),new Gs(32,128,258,1024,Ol),new Gs(32,258,258,4096,Ol)],NAe=t=>{t.window_size=2*t.w_size,Ua(t.head),t.max_lazy_match=Cp[t.level].max_lazy,t.good_match=Cp[t.level].good_length,t.nice_match=Cp[t.level].nice_length,t.max_chain_length=Cp[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=nA-1,t.match_available=0,t.ins_h=0};function KAe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mI,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(TAe*2),this.dyn_dtree=new Uint16Array((2*RAe+1)*2),this.bl_tree=new Uint16Array((2*DAe+1)*2),Ua(this.dyn_ltree),Ua(this.dyn_dtree),Ua(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(UAe+1),this.heap=new Uint16Array(2*cm+1),Ua(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*cm+1),Ua(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ip=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Tl&&e.status!==um&&e.status!==lm&&e.status!==hm&&e.status!==gm&&e.status!==dm&&e.status!==qc&&e.status!==fp?1:0},tO=t=>{if(Ip(t))return Wc(t,ks);t.total_in=t.total_out=0,t.data_type=SAe;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?um:e.wrap?Tl:qc,t.adler=e.wrap===2?0:1,e.last_flush=-2,hAe(e),ci},AO=t=>{const e=tO(t);return e===ci&&NAe(t.state),e},kAe=(t,e)=>Ip(t)||t.state.wrap!==2?ks:(t.state.gzhead=e,ci),rO=(t,e,A,r,i,n)=>{if(!t)return ks;let o=1;if(e===CAe&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>mAe||A!==mI||r<8||r>15||e<0||e>9||n<0||n>vAe||r===8&&o!==1)return Wc(t,ks);r===8&&(r=9);const s=new KAe;return t.state=s,s.strm=t,s.status=Tl,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+nA-1)/nA),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=n,s.method=A,AO(t)},PAe=(t,e)=>rO(t,e,mI,MAe,yAe,wAe),GAe=(t,e)=>{if(Ip(t)||e>ZF||e<0)return t?Wc(t,ks):ks;const A=t.state;if(!t.output||t.avail_in!==0&&!t.input||A.status===fp&&e!==Gn)return Wc(t,t.avail_out===0?am:ks);const r=A.last_flush;if(A.last_flush=e,A.pending!==0){if(En(t),t.avail_out===0)return A.last_flush=-1,ci}else if(t.avail_in===0&&_F(e)<=_F(r)&&e!==Gn)return Wc(t,am);if(A.status===fp&&t.avail_in!==0)return Wc(t,am);if(A.status===Tl&&A.wrap===0&&(A.status=qc),A.status===Tl){let i=mI+(A.w_bits-8<<4)<<8,n=-1;if(A.strategy>=SI||A.level<2?n=0:A.level<6?n=1:A.level===6?n=2:n=3,i|=n<<6,A.strstart!==0&&(i|=LAe),i+=31-i%31,Ep(A,i),A.strstart!==0&&(Ep(A,t.adler>>>16),Ep(A,t.adler&65535)),t.adler=1,A.status=qc,En(t),A.pending!==0)return A.last_flush=-1,ci}if(A.status===um){if(t.adler=0,EA(A,31),EA(A,139),EA(A,8),A.gzhead)EA(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),EA(A,A.gzhead.time&255),EA(A,A.gzhead.time>>8&255),EA(A,A.gzhead.time>>16&255),EA(A,A.gzhead.time>>24&255),EA(A,A.level===9?2:A.strategy>=SI||A.level<2?4:0),EA(A,A.gzhead.os&255),A.gzhead.extra&&A.gzhead.extra.length&&(EA(A,A.gzhead.extra.length&255),EA(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(t.adler=Vr(t.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=lm;else if(EA(A,0),EA(A,0),EA(A,0),EA(A,0),EA(A,0),EA(A,A.level===9?2:A.strategy>=SI||A.level<2?4:0),EA(A,FAe),A.status=qc,En(t),A.pending!==0)return A.last_flush=-1,ci}if(A.status===lm){if(A.gzhead.extra){let i=A.pending,n=(A.gzhead.extra.length&65535)-A.gzindex;for(;A.pending+n>A.pending_buf_size;){let s=A.pending_buf_size-A.pending;if(A.pending_buf.set(A.gzhead.extra.subarray(A.gzindex,A.gzindex+s),A.pending),A.pending=A.pending_buf_size,A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex+=s,En(t),A.pending!==0)return A.last_flush=-1,ci;i=0,n-=s}let o=new Uint8Array(A.gzhead.extra);A.pending_buf.set(o.subarray(A.gzindex,A.gzindex+n),A.pending),A.pending+=n,A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=hm}if(A.status===hm){if(A.gzhead.name){let i=A.pending,n;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i)),En(t),A.pending!==0)return A.last_flush=-1,ci;i=0}A.gzindex<A.gzhead.name.length?n=A.gzhead.name.charCodeAt(A.gzindex++)&255:n=0,EA(A,n)}while(n!==0);A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=gm}if(A.status===gm){if(A.gzhead.comment){let i=A.pending,n;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i)),En(t),A.pending!==0)return A.last_flush=-1,ci;i=0}A.gzindex<A.gzhead.comment.length?n=A.gzhead.comment.charCodeAt(A.gzindex++)&255:n=0,EA(A,n)}while(n!==0);A.gzhead.hcrc&&A.pending>i&&(t.adler=Vr(t.adler,A.pending_buf,A.pending-i,i))}A.status=dm}if(A.status===dm){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(En(t),A.pending!==0))return A.last_flush=-1,ci;EA(A,t.adler&255),EA(A,t.adler>>8&255),t.adler=0}if(A.status=qc,En(t),A.pending!==0)return A.last_flush=-1,ci}if(t.avail_in!==0||A.lookahead!==0||e!==Da&&A.status!==fp){let i=A.level===0?eO(A,e):A.strategy===SI?bAe(A,e):A.strategy===BAe?xAe(A,e):Cp[A.level].func(A,e);if((i===Vc||i===Ll)&&(A.status=fp),i===ji||i===Vc)return t.avail_out===0&&(A.last_flush=-1),ci;if(i===Ul&&(e===pAe?dAe(A):e!==ZF&&(om(A,0,0,!1),e===fAe&&(Ua(A.head),A.lookahead===0&&(A.strstart=0,A.block_start=0,A.insert=0))),En(t),t.avail_out===0))return A.last_flush=-1,ci}return e!==Gn?ci:A.wrap<=0?XF:(A.wrap===2?(EA(A,t.adler&255),EA(A,t.adler>>8&255),EA(A,t.adler>>16&255),EA(A,t.adler>>24&255),EA(A,t.total_in&255),EA(A,t.total_in>>8&255),EA(A,t.total_in>>16&255),EA(A,t.total_in>>24&255)):(Ep(A,t.adler>>>16),Ep(A,t.adler&65535)),En(t),A.wrap>0&&(A.wrap=-A.wrap),A.pending!==0?ci:XF)},jAe=t=>{if(Ip(t))return ks;const e=t.state.status;return t.state=null,e===qc?Wc(t,EAe):ci},YAe=(t,e)=>{let A=e.length;if(Ip(t))return ks;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==Tl||r.lookahead)return ks;if(i===1&&(t.adler=dp(t.adler,e,A,0)),r.wrap=0,A>=r.w_size){i===0&&(Ua(r.head),r.strstart=0,r.block_start=0,r.insert=0);let a=new Uint8Array(r.w_size);a.set(e.subarray(A-r.w_size,A),0),e=a,A=r.w_size}const n=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=A,t.next_in=0,t.input=e,Fl(r);r.lookahead>=nA;){let a=r.strstart,c=r.lookahead-(nA-1);do r.ins_h=La(r,r.ins_h,r.window[a+nA-1]),r.prev[a&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=a,a++;while(--c);r.strstart=a,r.lookahead=nA-1,Fl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=nA-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=n,r.wrap=i,ci};var HAe=PAe,zAe=rO,JAe=AO,qAe=tO,VAe=kAe,WAe=GAe,ZAe=jAe,XAe=YAe,_Ae="pako deflate (from Nodeca project)",Bp={deflateInit:HAe,deflateInit2:zAe,deflateReset:JAe,deflateResetKeep:qAe,deflateSetHeader:VAe,deflate:WAe,deflateEnd:ZAe,deflateSetDictionary:XAe,deflateInfo:_Ae};const $Ae=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var ere=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const A=e.shift();if(A){if(typeof A!="object")throw new TypeError(A+"must be non-object");for(const r in A)$Ae(A,r)&&(t[r]=A[r])}}return t},tre=t=>{let e=0;for(let r=0,i=t.length;r<i;r++)e+=t[r].length;const A=new Uint8Array(e);for(let r=0,i=0,n=t.length;r<n;r++){let o=t[r];A.set(o,i),i+=o.length}return A},MI={assign:ere,flattenChunks:tre};let iO=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{iO=!1}const vp=new Uint8Array(256);for(let t=0;t<256;t++)vp[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;vp[254]=vp[254]=1;var Are=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,A,r,i,n,o=t.length,s=0;for(i=0;i<o;i++)A=t.charCodeAt(i),(A&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(A=65536+(A-55296<<10)+(r-56320),i++)),s+=A<128?1:A<2048?2:A<65536?3:4;for(e=new Uint8Array(s),n=0,i=0;n<s;i++)A=t.charCodeAt(i),(A&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(A=65536+(A-55296<<10)+(r-56320),i++)),A<128?e[n++]=A:A<2048?(e[n++]=192|A>>>6,e[n++]=128|A&63):A<65536?(e[n++]=224|A>>>12,e[n++]=128|A>>>6&63,e[n++]=128|A&63):(e[n++]=240|A>>>18,e[n++]=128|A>>>12&63,e[n++]=128|A>>>6&63,e[n++]=128|A&63);return e};const rre=(t,e)=>{if(e<65534&&t.subarray&&iO)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let A="";for(let r=0;r<e;r++)A+=String.fromCharCode(t[r]);return A};var ire=(t,e)=>{const A=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,i;const n=new Array(A*2);for(i=0,r=0;r<A;){let o=t[r++];if(o<128){n[i++]=o;continue}let s=vp[o];if(s>4){n[i++]=65533,r+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&r<A;)o=o<<6|t[r++]&63,s--;if(s>1){n[i++]=65533;continue}o<65536?n[i++]=o:(o-=65536,n[i++]=55296|o>>10&1023,n[i++]=56320|o&1023)}return rre(n,i)},nre=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let A=e-1;for(;A>=0&&(t[A]&192)===128;)A--;return A<0||A===0?e:A+vp[t[A]]>e?A:e},wp={string2buf:Are,buf2string:ire,utf8border:nre};function sre(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var nO=sre;const sO=Object.prototype.toString,{Z_NO_FLUSH:ore,Z_SYNC_FLUSH:are,Z_FULL_FLUSH:cre,Z_FINISH:ure,Z_OK:yI,Z_STREAM_END:lre,Z_DEFAULT_COMPRESSION:hre,Z_DEFAULT_STRATEGY:gre,Z_DEFLATED:dre}=pp;function Em(t){this.options=MI.assign({level:hre,method:dre,chunkSize:16384,windowBits:15,memLevel:8,strategy:gre},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new nO,this.strm.avail_out=0;let A=Bp.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(A!==yI)throw new Error(Dl[A]);if(e.header&&Bp.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=wp.string2buf(e.dictionary):sO.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,A=Bp.deflateSetDictionary(this.strm,r),A!==yI)throw new Error(Dl[A]);this._dict_set=!0}}Em.prototype.push=function(t,e){const A=this.strm,r=this.options.chunkSize;let i,n;if(this.ended)return!1;for(e===~~e?n=e:n=e===!0?ure:ore,typeof t=="string"?A.input=wp.string2buf(t):sO.call(t)==="[object ArrayBuffer]"?A.input=new Uint8Array(t):A.input=t,A.next_in=0,A.avail_in=A.input.length;;){if(A.avail_out===0&&(A.output=new Uint8Array(r),A.next_out=0,A.avail_out=r),(n===are||n===cre)&&A.avail_out<=6){this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;continue}if(i=Bp.deflate(A,n),i===lre)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),i=Bp.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===yI;if(A.avail_out===0){this.onData(A.output);continue}if(n>0&&A.next_out>0){this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;continue}if(A.avail_in===0)break}return!0},Em.prototype.onData=function(t){this.chunks.push(t)},Em.prototype.onEnd=function(t){t===yI&&(this.result=MI.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const QI=16209,pre=16191;var fre=function(e,A){let r,i,n,o,s,a,c,u,l,g,h,p,C,B,E,v,m,S,O,N,P,D,T,z;const Q=e.state;r=e.next_in,T=e.input,i=r+(e.avail_in-5),n=e.next_out,z=e.output,o=n-(A-e.avail_out),s=n+(e.avail_out-257),a=Q.dmax,c=Q.wsize,u=Q.whave,l=Q.wnext,g=Q.window,h=Q.hold,p=Q.bits,C=Q.lencode,B=Q.distcode,E=(1<<Q.lenbits)-1,v=(1<<Q.distbits)-1;e:do{p<15&&(h+=T[r++]<<p,p+=8,h+=T[r++]<<p,p+=8),m=C[h&E];t:for(;;){if(S=m>>>24,h>>>=S,p-=S,S=m>>>16&255,S===0)z[n++]=m&65535;else if(S&16){O=m&65535,S&=15,S&&(p<S&&(h+=T[r++]<<p,p+=8),O+=h&(1<<S)-1,h>>>=S,p-=S),p<15&&(h+=T[r++]<<p,p+=8,h+=T[r++]<<p,p+=8),m=B[h&v];A:for(;;){if(S=m>>>24,h>>>=S,p-=S,S=m>>>16&255,S&16){if(N=m&65535,S&=15,p<S&&(h+=T[r++]<<p,p+=8,p<S&&(h+=T[r++]<<p,p+=8)),N+=h&(1<<S)-1,N>a){e.msg="invalid distance too far back",Q.mode=QI;break e}if(h>>>=S,p-=S,S=n-o,N>S){if(S=N-S,S>u&&Q.sane){e.msg="invalid distance too far back",Q.mode=QI;break e}if(P=0,D=g,l===0){if(P+=c-S,S<O){O-=S;do z[n++]=g[P++];while(--S);P=n-N,D=z}}else if(l<S){if(P+=c+l-S,S-=l,S<O){O-=S;do z[n++]=g[P++];while(--S);if(P=0,l<O){S=l,O-=S;do z[n++]=g[P++];while(--S);P=n-N,D=z}}}else if(P+=l-S,S<O){O-=S;do z[n++]=g[P++];while(--S);P=n-N,D=z}for(;O>2;)z[n++]=D[P++],z[n++]=D[P++],z[n++]=D[P++],O-=3;O&&(z[n++]=D[P++],O>1&&(z[n++]=D[P++]))}else{P=n-N;do z[n++]=z[P++],z[n++]=z[P++],z[n++]=z[P++],O-=3;while(O>2);O&&(z[n++]=z[P++],O>1&&(z[n++]=z[P++]))}}else if(S&64){e.msg="invalid distance code",Q.mode=QI;break e}else{m=B[(m&65535)+(h&(1<<S)-1)];continue A}break}}else if(S&64)if(S&32){Q.mode=pre;break e}else{e.msg="invalid literal/length code",Q.mode=QI;break e}else{m=C[(m&65535)+(h&(1<<S)-1)];continue t}break}}while(r<i&&n<s);O=p>>3,r-=O,p-=O<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=n,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=n<s?257+(s-n):257-(n-s),Q.hold=h,Q.bits=p};const xl=15,oO=852,aO=592,cO=0,Cm=1,uO=2,Ere=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Cre=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ire=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Bre=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Sp=(t,e,A,r,i,n,o,s)=>{const a=s.bits;let c=0,u=0,l=0,g=0,h=0,p=0,C=0,B=0,E=0,v=0,m,S,O,N,P,D=null,T;const z=new Uint16Array(xl+1),Q=new Uint16Array(xl+1);let R=null,G,k,$;for(c=0;c<=xl;c++)z[c]=0;for(u=0;u<r;u++)z[e[A+u]]++;for(h=a,g=xl;g>=1&&z[g]===0;g--);if(h>g&&(h=g),g===0)return i[n++]=1<<24|64<<16|0,i[n++]=1<<24|64<<16|0,s.bits=1,0;for(l=1;l<g&&z[l]===0;l++);for(h<l&&(h=l),B=1,c=1;c<=xl;c++)if(B<<=1,B-=z[c],B<0)return-1;if(B>0&&(t===cO||g!==1))return-1;for(Q[1]=0,c=1;c<xl;c++)Q[c+1]=Q[c]+z[c];for(u=0;u<r;u++)e[A+u]!==0&&(o[Q[e[A+u]]++]=u);if(t===cO?(D=R=o,T=20):t===Cm?(D=Ere,R=Cre,T=257):(D=Ire,R=Bre,T=0),v=0,u=0,c=l,P=n,p=h,C=0,O=-1,E=1<<h,N=E-1,t===Cm&&E>oO||t===uO&&E>aO)return 1;for(;;){G=c-C,o[u]+1<T?(k=0,$=o[u]):o[u]>=T?(k=R[o[u]-T],$=D[o[u]-T]):(k=32+64,$=0),m=1<<c-C,S=1<<p,l=S;do S-=m,i[P+(v>>C)+S]=G<<24|k<<16|$|0;while(S!==0);for(m=1<<c-1;v&m;)m>>=1;if(m!==0?(v&=m-1,v+=m):v=0,u++,--z[c]===0){if(c===g)break;c=e[A+o[u]]}if(c>h&&(v&N)!==O){for(C===0&&(C=h),P+=l,p=c-C,B=1<<p;p+C<g&&(B-=z[p+C],!(B<=0));)p++,B<<=1;if(E+=1<<p,t===Cm&&E>oO||t===uO&&E>aO)return 1;O=v&N,i[O]=h<<24|p<<16|P-n|0}}return v!==0&&(i[P+v]=c-C<<24|64<<16|0),s.bits=h,0};const vre=0,lO=1,hO=2,{Z_FINISH:gO,Z_BLOCK:wre,Z_TREES:RI,Z_OK:Zc,Z_STREAM_END:Sre,Z_NEED_DICT:mre,Z_STREAM_ERROR:jn,Z_DATA_ERROR:dO,Z_MEM_ERROR:pO,Z_BUF_ERROR:Mre,Z_DEFLATED:fO}=pp,DI=16180,EO=16181,CO=16182,IO=16183,BO=16184,vO=16185,wO=16186,SO=16187,mO=16188,MO=16189,TI=16190,wo=16191,Im=16192,yO=16193,Bm=16194,QO=16195,RO=16196,DO=16197,TO=16198,UI=16199,LI=16200,UO=16201,LO=16202,FO=16203,OO=16204,xO=16205,vm=16206,bO=16207,NO=16208,HA=16209,KO=16210,kO=16211,yre=852,Qre=592,Rre=15,PO=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Dre(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xc=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<DI||e.mode>kO?1:0},GO=t=>{if(Xc(t))return jn;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=DI,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(yre),e.distcode=e.distdyn=new Int32Array(Qre),e.sane=1,e.back=-1,Zc},jO=t=>{if(Xc(t))return jn;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,GO(t)},YO=(t,e)=>{let A;if(Xc(t))return jn;const r=t.state;return e<0?(A=0,e=-e):(A=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jn:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=A,r.wbits=e,jO(t))},HO=(t,e)=>{if(!t)return jn;const A=new Dre;t.state=A,A.strm=t,A.window=null,A.mode=DI;const r=YO(t,e);return r!==Zc&&(t.state=null),r},Tre=t=>HO(t,Rre);let zO=!0,wm,Sm;const Ure=t=>{if(zO){wm=new Int32Array(512),Sm=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Sp(lO,t.lens,0,288,wm,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Sp(hO,t.lens,0,32,Sm,0,t.work,{bits:5}),zO=!1}t.lencode=wm,t.lenbits=9,t.distcode=Sm,t.distbits=5},JO=(t,e,A,r)=>{let i;const n=t.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),r>=n.wsize?(n.window.set(e.subarray(A-n.wsize,A),0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>r&&(i=r),n.window.set(e.subarray(A-r,A-r+i),n.wnext),r-=i,r?(n.window.set(e.subarray(A-r,A),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0},Lre=(t,e)=>{let A,r,i,n,o,s,a,c,u,l,g,h,p,C,B=0,E,v,m,S,O,N,P,D;const T=new Uint8Array(4);let z,Q;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xc(t)||!t.output||!t.input&&t.avail_in!==0)return jn;A=t.state,A.mode===wo&&(A.mode=Im),o=t.next_out,i=t.output,a=t.avail_out,n=t.next_in,r=t.input,s=t.avail_in,c=A.hold,u=A.bits,l=s,g=a,D=Zc;e:for(;;)switch(A.mode){case DI:if(A.wrap===0){A.mode=Im;break}for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.wrap&2&&c===35615){A.wbits===0&&(A.wbits=15),A.check=0,T[0]=c&255,T[1]=c>>>8&255,A.check=Vr(A.check,T,2,0),c=0,u=0,A.mode=EO;break}if(A.head&&(A.head.done=!1),!(A.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",A.mode=HA;break}if((c&15)!==fO){t.msg="unknown compression method",A.mode=HA;break}if(c>>>=4,u-=4,P=(c&15)+8,A.wbits===0&&(A.wbits=P),P>15||P>A.wbits){t.msg="invalid window size",A.mode=HA;break}A.dmax=1<<A.wbits,A.flags=0,t.adler=A.check=1,A.mode=c&512?MO:wo,c=0,u=0;break;case EO:for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.flags=c,(A.flags&255)!==fO){t.msg="unknown compression method",A.mode=HA;break}if(A.flags&57344){t.msg="unknown header flags set",A.mode=HA;break}A.head&&(A.head.text=c>>8&1),A.flags&512&&A.wrap&4&&(T[0]=c&255,T[1]=c>>>8&255,A.check=Vr(A.check,T,2,0)),c=0,u=0,A.mode=CO;case CO:for(;u<32;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.head&&(A.head.time=c),A.flags&512&&A.wrap&4&&(T[0]=c&255,T[1]=c>>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,A.check=Vr(A.check,T,4,0)),c=0,u=0,A.mode=IO;case IO:for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.head&&(A.head.xflags=c&255,A.head.os=c>>8),A.flags&512&&A.wrap&4&&(T[0]=c&255,T[1]=c>>>8&255,A.check=Vr(A.check,T,2,0)),c=0,u=0,A.mode=BO;case BO:if(A.flags&1024){for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.length=c,A.head&&(A.head.extra_len=c),A.flags&512&&A.wrap&4&&(T[0]=c&255,T[1]=c>>>8&255,A.check=Vr(A.check,T,2,0)),c=0,u=0}else A.head&&(A.head.extra=null);A.mode=vO;case vO:if(A.flags&1024&&(h=A.length,h>s&&(h=s),h&&(A.head&&(P=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(r.subarray(n,n+h),P)),A.flags&512&&A.wrap&4&&(A.check=Vr(A.check,r,h,n)),s-=h,n+=h,A.length-=h),A.length))break e;A.length=0,A.mode=wO;case wO:if(A.flags&2048){if(s===0)break e;h=0;do P=r[n+h++],A.head&&P&&A.length<65536&&(A.head.name+=String.fromCharCode(P));while(P&&h<s);if(A.flags&512&&A.wrap&4&&(A.check=Vr(A.check,r,h,n)),s-=h,n+=h,P)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=SO;case SO:if(A.flags&4096){if(s===0)break e;h=0;do P=r[n+h++],A.head&&P&&A.length<65536&&(A.head.comment+=String.fromCharCode(P));while(P&&h<s);if(A.flags&512&&A.wrap&4&&(A.check=Vr(A.check,r,h,n)),s-=h,n+=h,P)break e}else A.head&&(A.head.comment=null);A.mode=mO;case mO:if(A.flags&512){for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.wrap&4&&c!==(A.check&65535)){t.msg="header crc mismatch",A.mode=HA;break}c=0,u=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),t.adler=A.check=0,A.mode=wo;break;case MO:for(;u<32;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}t.adler=A.check=PO(c),c=0,u=0,A.mode=TI;case TI:if(A.havedict===0)return t.next_out=o,t.avail_out=a,t.next_in=n,t.avail_in=s,A.hold=c,A.bits=u,mre;t.adler=A.check=1,A.mode=wo;case wo:if(e===wre||e===RI)break e;case Im:if(A.last){c>>>=u&7,u-=u&7,A.mode=vm;break}for(;u<3;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}switch(A.last=c&1,c>>>=1,u-=1,c&3){case 0:A.mode=yO;break;case 1:if(Ure(A),A.mode=UI,e===RI){c>>>=2,u-=2;break e}break;case 2:A.mode=RO;break;case 3:t.msg="invalid block type",A.mode=HA}c>>>=2,u-=2;break;case yO:for(c>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",A.mode=HA;break}if(A.length=c&65535,c=0,u=0,A.mode=Bm,e===RI)break e;case Bm:A.mode=QO;case QO:if(h=A.length,h){if(h>s&&(h=s),h>a&&(h=a),h===0)break e;i.set(r.subarray(n,n+h),o),s-=h,n+=h,a-=h,o+=h,A.length-=h;break}A.mode=wo;break;case RO:for(;u<14;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.nlen=(c&31)+257,c>>>=5,u-=5,A.ndist=(c&31)+1,c>>>=5,u-=5,A.ncode=(c&15)+4,c>>>=4,u-=4,A.nlen>286||A.ndist>30){t.msg="too many length or distance symbols",A.mode=HA;break}A.have=0,A.mode=DO;case DO:for(;A.have<A.ncode;){for(;u<3;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.lens[R[A.have++]]=c&7,c>>>=3,u-=3}for(;A.have<19;)A.lens[R[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,z={bits:A.lenbits},D=Sp(vre,A.lens,0,19,A.lencode,0,A.work,z),A.lenbits=z.bits,D){t.msg="invalid code lengths set",A.mode=HA;break}A.have=0,A.mode=TO;case TO:for(;A.have<A.nlen+A.ndist;){for(;B=A.lencode[c&(1<<A.lenbits)-1],E=B>>>24,v=B>>>16&255,m=B&65535,!(E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(m<16)c>>>=E,u-=E,A.lens[A.have++]=m;else{if(m===16){for(Q=E+2;u<Q;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(c>>>=E,u-=E,A.have===0){t.msg="invalid bit length repeat",A.mode=HA;break}P=A.lens[A.have-1],h=3+(c&3),c>>>=2,u-=2}else if(m===17){for(Q=E+3;u<Q;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=E,u-=E,P=0,h=3+(c&7),c>>>=3,u-=3}else{for(Q=E+7;u<Q;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=E,u-=E,P=0,h=11+(c&127),c>>>=7,u-=7}if(A.have+h>A.nlen+A.ndist){t.msg="invalid bit length repeat",A.mode=HA;break}for(;h--;)A.lens[A.have++]=P}}if(A.mode===HA)break;if(A.lens[256]===0){t.msg="invalid code -- missing end-of-block",A.mode=HA;break}if(A.lenbits=9,z={bits:A.lenbits},D=Sp(lO,A.lens,0,A.nlen,A.lencode,0,A.work,z),A.lenbits=z.bits,D){t.msg="invalid literal/lengths set",A.mode=HA;break}if(A.distbits=6,A.distcode=A.distdyn,z={bits:A.distbits},D=Sp(hO,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,z),A.distbits=z.bits,D){t.msg="invalid distances set",A.mode=HA;break}if(A.mode=UI,e===RI)break e;case UI:A.mode=LI;case LI:if(s>=6&&a>=258){t.next_out=o,t.avail_out=a,t.next_in=n,t.avail_in=s,A.hold=c,A.bits=u,fre(t,g),o=t.next_out,i=t.output,a=t.avail_out,n=t.next_in,r=t.input,s=t.avail_in,c=A.hold,u=A.bits,A.mode===wo&&(A.back=-1);break}for(A.back=0;B=A.lencode[c&(1<<A.lenbits)-1],E=B>>>24,v=B>>>16&255,m=B&65535,!(E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(v&&!(v&240)){for(S=E,O=v,N=m;B=A.lencode[N+((c&(1<<S+O)-1)>>S)],E=B>>>24,v=B>>>16&255,m=B&65535,!(S+E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=S,u-=S,A.back+=S}if(c>>>=E,u-=E,A.back+=E,A.length=m,v===0){A.mode=xO;break}if(v&32){A.back=-1,A.mode=wo;break}if(v&64){t.msg="invalid literal/length code",A.mode=HA;break}A.extra=v&15,A.mode=UO;case UO:if(A.extra){for(Q=A.extra;u<Q;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.length+=c&(1<<A.extra)-1,c>>>=A.extra,u-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=LO;case LO:for(;B=A.distcode[c&(1<<A.distbits)-1],E=B>>>24,v=B>>>16&255,m=B&65535,!(E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(!(v&240)){for(S=E,O=v,N=m;B=A.distcode[N+((c&(1<<S+O)-1)>>S)],E=B>>>24,v=B>>>16&255,m=B&65535,!(S+E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=S,u-=S,A.back+=S}if(c>>>=E,u-=E,A.back+=E,v&64){t.msg="invalid distance code",A.mode=HA;break}A.offset=m,A.extra=v&15,A.mode=FO;case FO:if(A.extra){for(Q=A.extra;u<Q;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}A.offset+=c&(1<<A.extra)-1,c>>>=A.extra,u-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){t.msg="invalid distance too far back",A.mode=HA;break}A.mode=OO;case OO:if(a===0)break e;if(h=g-a,A.offset>h){if(h=A.offset-h,h>A.whave&&A.sane){t.msg="invalid distance too far back",A.mode=HA;break}h>A.wnext?(h-=A.wnext,p=A.wsize-h):p=A.wnext-h,h>A.length&&(h=A.length),C=A.window}else C=i,p=o-A.offset,h=A.length;h>a&&(h=a),a-=h,A.length-=h;do i[o++]=C[p++];while(--h);A.length===0&&(A.mode=LI);break;case xO:if(a===0)break e;i[o++]=A.length,a--,A.mode=LI;break;case vm:if(A.wrap){for(;u<32;){if(s===0)break e;s--,c|=r[n++]<<u,u+=8}if(g-=a,t.total_out+=g,A.total+=g,A.wrap&4&&g&&(t.adler=A.check=A.flags?Vr(A.check,i,g,o-g):dp(A.check,i,g,o-g)),g=a,A.wrap&4&&(A.flags?c:PO(c))!==A.check){t.msg="incorrect data check",A.mode=HA;break}c=0,u=0}A.mode=bO;case bO:if(A.wrap&&A.flags){for(;u<32;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.wrap&4&&c!==(A.total&4294967295)){t.msg="incorrect length check",A.mode=HA;break}c=0,u=0}A.mode=NO;case NO:D=Sre;break e;case HA:D=dO;break e;case KO:return pO;case kO:default:return jn}return t.next_out=o,t.avail_out=a,t.next_in=n,t.avail_in=s,A.hold=c,A.bits=u,(A.wsize||g!==t.avail_out&&A.mode<HA&&(A.mode<vm||e!==gO))&&JO(t,t.output,t.next_out,g-t.avail_out),l-=t.avail_in,g-=t.avail_out,t.total_in+=l,t.total_out+=g,A.total+=g,A.wrap&4&&g&&(t.adler=A.check=A.flags?Vr(A.check,i,g,t.next_out-g):dp(A.check,i,g,t.next_out-g)),t.data_type=A.bits+(A.last?64:0)+(A.mode===wo?128:0)+(A.mode===UI||A.mode===Bm?256:0),(l===0&&g===0||e===gO)&&D===Zc&&(D=Mre),D},Fre=t=>{if(Xc(t))return jn;let e=t.state;return e.window&&(e.window=null),t.state=null,Zc},Ore=(t,e)=>{if(Xc(t))return jn;const A=t.state;return A.wrap&2?(A.head=e,e.done=!1,Zc):jn},xre=(t,e)=>{const A=e.length;let r,i,n;return Xc(t)||(r=t.state,r.wrap!==0&&r.mode!==TI)?jn:r.mode===TI&&(i=1,i=dp(i,e,A,0),i!==r.check)?dO:(n=JO(t,e,A,A),n?(r.mode=KO,pO):(r.havedict=1,Zc))};var bre=jO,Nre=YO,Kre=GO,kre=Tre,Pre=HO,Gre=Lre,jre=Fre,Yre=Ore,Hre=xre,zre="pako inflate (from Nodeca project)",So={inflateReset:bre,inflateReset2:Nre,inflateResetKeep:Kre,inflateInit:kre,inflateInit2:Pre,inflate:Gre,inflateEnd:jre,inflateGetHeader:Yre,inflateSetDictionary:Hre,inflateInfo:zre};function Jre(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var qre=Jre;const qO=Object.prototype.toString,{Z_NO_FLUSH:Vre,Z_FINISH:Wre,Z_OK:mp,Z_STREAM_END:mm,Z_NEED_DICT:Mm,Z_STREAM_ERROR:Zre,Z_DATA_ERROR:VO,Z_MEM_ERROR:Xre}=pp;function Mp(t){this.options=MI.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new nO,this.strm.avail_out=0;let A=So.inflateInit2(this.strm,e.windowBits);if(A!==mp)throw new Error(Dl[A]);if(this.header=new qre,So.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=wp.string2buf(e.dictionary):qO.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(A=So.inflateSetDictionary(this.strm,e.dictionary),A!==mp)))throw new Error(Dl[A])}Mp.prototype.push=function(t,e){const A=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let n,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Wre:Vre,qO.call(t)==="[object ArrayBuffer]"?A.input=new Uint8Array(t):A.input=t,A.next_in=0,A.avail_in=A.input.length;;){for(A.avail_out===0&&(A.output=new Uint8Array(r),A.next_out=0,A.avail_out=r),n=So.inflate(A,o),n===Mm&&i&&(n=So.inflateSetDictionary(A,i),n===mp?n=So.inflate(A,o):n===VO&&(n=Mm));A.avail_in>0&&n===mm&&A.state.wrap>0&&t[A.next_in]!==0;)So.inflateReset(A),n=So.inflate(A,o);switch(n){case Zre:case VO:case Mm:case Xre:return this.onEnd(n),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(A.avail_out===0||n===mm))if(this.options.to==="string"){let a=wp.utf8border(A.output,A.next_out),c=A.next_out-a,u=wp.buf2string(A.output,a);A.next_out=c,A.avail_out=r-c,c&&A.output.set(A.output.subarray(a,a+c),0),this.onData(u)}else this.onData(A.output.length===A.next_out?A.output:A.output.subarray(0,A.next_out));if(!(n===mp&&s===0)){if(n===mm)return n=So.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(A.avail_in===0)break}}return!0},Mp.prototype.onData=function(t){this.chunks.push(t)},Mp.prototype.onEnd=function(t){t===mp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=MI.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ym(t,e){const A=new Mp(e);if(A.push(t),A.err)throw A.msg||Dl[A.err];return A.result}function _re(t,e){return e=e||{},e.raw=!0,ym(t,e)}var $re=Mp,eie=ym,tie=_re,Aie=ym,rie=pp,iie={Inflate:$re,inflate:eie,inflateRaw:tie,ungzip:Aie,constants:rie};const{Inflate:nie,inflate:sie,inflateRaw:Z1e,ungzip:X1e}=iie;var WO=nie,oie=sie;const ZO=[];for(let t=0;t<256;t++){let e=t;for(let A=0;A<8;A++)e&1?e=3988292384^e>>>1:e=e>>>1;ZO[t]=e}const XO=4294967295;function aie(t,e,A){let r=t;for(let i=0;i<A;i++)r=ZO[(r^e[i])&255]^r>>>8;return r}function cie(t,e){return(aie(XO,t,e)^XO)>>>0}function _O(t,e,A){const r=t.readUint32(),i=cie(new Uint8Array(t.buffer,t.byteOffset+t.offset-e-4,e),e);if(i!==r)throw new Error(`CRC mismatch for chunk ${A}. Expected ${r}, found ${i}`)}function $O(t,e,A){for(let r=0;r<A;r++)e[r]=t[r]}function ex(t,e,A,r){let i=0;for(;i<r;i++)e[i]=t[i];for(;i<A;i++)e[i]=t[i]+e[i-r]&255}function tx(t,e,A,r){let i=0;if(A.length===0)for(;i<r;i++)e[i]=t[i];else for(;i<r;i++)e[i]=t[i]+A[i]&255}function Ax(t,e,A,r,i){let n=0;if(A.length===0){for(;n<i;n++)e[n]=t[n];for(;n<r;n++)e[n]=t[n]+(e[n-i]>>1)&255}else{for(;n<i;n++)e[n]=t[n]+(A[n]>>1)&255;for(;n<r;n++)e[n]=t[n]+(e[n-i]+A[n]>>1)&255}}function rx(t,e,A,r,i){let n=0;if(A.length===0){for(;n<i;n++)e[n]=t[n];for(;n<r;n++)e[n]=t[n]+e[n-i]&255}else{for(;n<i;n++)e[n]=t[n]+A[n]&255;for(;n<r;n++)e[n]=t[n]+uie(e[n-i],A[n],A[n-i])&255}}function uie(t,e,A){const r=t+e-A,i=Math.abs(r-t),n=Math.abs(r-e),o=Math.abs(r-A);return i<=n&&i<=o?t:n<=o?e:A}function lie(t,e,A,r,i,n){switch(t){case 0:$O(e,A,i);break;case 1:ex(e,A,i,n);break;case 2:tx(e,A,r,i);break;case 3:Ax(e,A,r,i,n);break;case 4:rx(e,A,r,i,n);break;default:throw new Error(`Unsupported filter: ${t}`)}}const hie=new Uint16Array([255]),gie=new Uint8Array(hie.buffer)[0]===255;function die(t){const{data:e,width:A,height:r,channels:i,depth:n}=t,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],s=Math.ceil(n/8)*i,a=new Uint8Array(r*A*s);let c=0;for(let u=0;u<7;u++){const l=o[u],g=Math.ceil((A-l.x)/l.xStep),h=Math.ceil((r-l.y)/l.yStep);if(g<=0||h<=0)continue;const p=g*s,C=new Uint8Array(p);for(let B=0;B<h;B++){const E=e[c++],v=e.subarray(c,c+p);c+=p;const m=new Uint8Array(p);lie(E,v,m,C,p,s),C.set(m);for(let S=0;S<g;S++){const O=l.x+S*l.xStep,N=l.y+B*l.yStep;if(!(O>=A||N>=r))for(let P=0;P<s;P++)a[(N*A+O)*s+P]=m[S*s+P]}}}if(n===16){const u=new Uint16Array(a.buffer);if(gie)for(let l=0;l<u.length;l++)u[l]=pie(u[l]);return u}else return a}function pie(t){return(t&255)<<8|t>>8&255}const fie=new Uint16Array([255]),Eie=new Uint8Array(fie.buffer)[0]===255,Cie=new Uint8Array(0);function ix(t){const{data:e,width:A,height:r,channels:i,depth:n}=t,o=Math.ceil(n/8)*i,s=Math.ceil(n/8*i*A),a=new Uint8Array(r*s);let c=Cie,u=0,l,g;for(let h=0;h<r;h++){switch(l=e.subarray(u+1,u+1+s),g=a.subarray(h*s,(h+1)*s),e[u]){case 0:$O(l,g,s);break;case 1:ex(l,g,s,o);break;case 2:tx(l,g,c,s);break;case 3:Ax(l,g,c,s,o);break;case 4:rx(l,g,c,s,o);break;default:throw new Error(`Unsupported filter: ${e[u]}`)}c=g,u+=s+1}if(n===16){const h=new Uint16Array(a.buffer);if(Eie)for(let p=0;p<h.length;p++)h[p]=Iie(h[p]);return h}else return a}function Iie(t){return(t&255)<<8|t>>8&255}const FI=Uint8Array.of(137,80,78,71,13,10,26,10);function nx(t){if(!Bie(t.readBytes(FI.length)))throw new Error("wrong PNG signature")}function Bie(t){if(t.length<FI.length)return!1;for(let e=0;e<FI.length;e++)if(t[e]!==FI[e])return!1;return!0}const vie="tEXt",wie=0,sx=new TextDecoder("latin1");function Sie(t){if(Mie(t),t.length===0||t.length>79)throw new Error("keyword length must be between 1 and 79")}const mie=/^[\u0000-\u00FF]*$/;function Mie(t){if(!mie.test(t))throw new Error("invalid latin1 text")}function yie(t,e,A){const r=ox(e);t[r]=Qie(e,A-r.length-1)}function ox(t){for(t.mark();t.readByte()!==wie;);const e=t.offset;t.reset();const A=sx.decode(t.readBytes(e-t.offset-1));return t.skip(1),Sie(A),A}function Qie(t,e){return sx.decode(t.readBytes(e))}const In={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},Qm={UNKNOWN:-1,DEFLATE:0},ax={UNKNOWN:-1,ADAPTIVE:0},Rm={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},OI={NONE:0,BACKGROUND:1,PREVIOUS:2},Dm={SOURCE:0,OVER:1};class Rie extends Z0{constructor(A,r={}){super(A);RA(this,"_checkCrc");RA(this,"_inflator");RA(this,"_png");RA(this,"_apng");RA(this,"_end");RA(this,"_hasPalette");RA(this,"_palette");RA(this,"_hasTransparency");RA(this,"_transparency");RA(this,"_compressionMethod");RA(this,"_filterMethod");RA(this,"_interlaceMethod");RA(this,"_colorType");RA(this,"_isAnimated");RA(this,"_numberOfFrames");RA(this,"_numberOfPlays");RA(this,"_frames");RA(this,"_writingDataChunks");const{checkCrc:i=!1}=r;this._checkCrc=i,this._inflator=new WO,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=Qm.UNKNOWN,this._filterMethod=ax.UNKNOWN,this._interlaceMethod=Rm.UNKNOWN,this._colorType=In.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(nx(this);!this._end;){const A=this.readUint32(),r=this.readChars(4);this.decodeChunk(A,r)}return this.decodeImage(),this._png}decodeApng(){for(nx(this);!this._end;){const A=this.readUint32(),r=this.readChars(4);this.decodeApngChunk(A,r)}return this.decodeApngImage(),this._apng}decodeChunk(A,r){const i=this.offset;switch(r){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(A);break;case"IDAT":this.decodeIDAT(A);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(A);break;case"iCCP":this.decodeiCCP(A);break;case vie:yie(this._png.text,this,A);break;case"pHYs":this.decodepHYs();break;default:this.skip(A);break}if(this.offset-i!==A)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?_O(this,A+4,r):this.skip(4)}decodeApngChunk(A,r){const i=this.offset;switch(r!=="fdAT"&&r!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),r){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(A);break;default:this.decodeChunk(A,r),this.offset=i+A;break}if(this.offset-i!==A)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?_O(this,A+4,r):this.skip(4)}decodeIHDR(){const A=this._png;A.width=this.readUint32(),A.height=this.readUint32(),A.depth=Die(this.readUint8());const r=this.readUint8();this._colorType=r;let i;switch(r){case In.GREYSCALE:i=1;break;case In.TRUECOLOUR:i=3;break;case In.INDEXED_COLOUR:i=1;break;case In.GREYSCALE_ALPHA:i=2;break;case In.TRUECOLOUR_ALPHA:i=4;break;case In.UNKNOWN:default:throw new Error(`Unknown color type: ${r}`)}if(this._png.channels=i,this._compressionMethod=this.readUint8(),this._compressionMethod!==Qm.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const A={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(A)}decodePLTE(A){if(A%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${A}`);const r=A/3;this._hasPalette=!0;const i=[];this._palette=i;for(let n=0;n<r;n++)i.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(A){this._writingDataChunks=!0;const r=A,i=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(A)}decodeFDAT(A){this._writingDataChunks=!0;let r=A,i=this.offset+this.byteOffset;if(i+=4,r-=4,this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(A)}decodetRNS(A){switch(this._colorType){case In.GREYSCALE:case In.TRUECOLOUR:{if(A%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${A}`);if(A/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${A/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(A/2);for(let r=0;r<A/2;r++)this._transparency[r]=this.readUint16();break}case In.INDEXED_COLOUR:{if(A>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${A} vs ${this._palette.length})`);let r=0;for(;r<A;r++){const i=this.readByte();this._palette[r].push(i)}for(;r<this._palette.length;r++)this._palette[r].push(255);break}case In.UNKNOWN:case In.GREYSCALE_ALPHA:case In.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(A){const r=ox(this),i=this.readUint8();if(i!==Qm.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${i}`);const n=this.readBytes(A-r.length-2);this._png.iccEmbeddedProfile={name:r,profile:oie(n)}}decodepHYs(){const A=this.readUint32(),r=this.readUint32(),i=this.readByte();this._png.resolution={x:A,y:r,unit:i}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let A=0;A<this._numberOfFrames;A++){const r={sequenceNumber:this._frames[A].sequenceNumber,delayNumber:this._frames[A].delayNumber,delayDenominator:this._frames[A].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},i=this._frames.at(A);if(i){if(i.data=ix({data:i.data,width:i.width,height:i.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),A===0||i.xOffset===0&&i.yOffset===0&&i.width===this._png.width&&i.height===this._png.height)r.data=i.data;else{const n=this._apng.frames.at(A-1);this.disposeFrame(i,n,r),this.addFrameDataToCanvas(r,i)}this._apng.frames.push(r)}}return this._apng}disposeFrame(A,r,i){switch(A.disposeOp){case OI.NONE:break;case OI.BACKGROUND:for(let n=0;n<this._png.height;n++)for(let o=0;o<this._png.width;o++){const s=(n*A.width+o)*this._png.channels;for(let a=0;a<this._png.channels;a++)i.data[s+a]=0}break;case OI.PREVIOUS:i.data.set(r.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(A,r){const i=1<<this._png.depth,n=(o,s)=>{const a=((o+r.yOffset)*this._png.width+r.xOffset+s)*this._png.channels,c=(o*r.width+s)*this._png.channels;return{index:a,frameIndex:c}};switch(r.blendOp){case Dm.SOURCE:for(let o=0;o<r.height;o++)for(let s=0;s<r.width;s++){const{index:a,frameIndex:c}=n(o,s);for(let u=0;u<this._png.channels;u++)A.data[a+u]=r.data[c+u]}break;case Dm.OVER:for(let o=0;o<r.height;o++)for(let s=0;s<r.width;s++){const{index:a,frameIndex:c}=n(o,s);for(let u=0;u<this._png.channels;u++){const l=r.data[c+this._png.channels-1]/i,g=u%(this._png.channels-1)===0?1:r.data[c+u],h=Math.floor(l*g+(1-l)*A.data[a+u]);A.data[a+u]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var r;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const A=this._isAnimated?((r=this._frames)==null?void 0:r.at(0)).data:this._inflator.result;if(this._filterMethod!==ax.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===Rm.NO_INTERLACE)this._png.data=ix({data:A,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===Rm.ADAM7)this._png.data=die({data:A,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const A=this._inflator.result,r=this._frames.at(-1);r?r.data=A:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:OI.NONE,blendOp:Dm.SOURCE,data:A}),this._inflator=new WO,this._writingDataChunks=!1}}function Die(t){if(t!==1&&t!==2&&t!==4&&t!==8&&t!==16)throw new Error(`invalid bit depth: ${t}`);return t}var cx;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.METRE=1]="METRE"})(cx||(cx={}));function Tie(t,e){return new Rie(t,e).decode()}/** @license
|
|
37
37
|
*
|
|
38
38
|
* jsPDF - PDF Document creation from JavaScript
|