@genpact/genome.mfe.mgtwin-app 1.1.359-alpha → 1.1.360-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-f4ee1092.mjs → AssessmentAMA-172ff730.mjs} +4 -4
- package/dist/{AssessmentSimulation-475bee26.mjs → AssessmentSimulation-a2d2dc5e.mjs} +7 -7
- package/dist/{EditSkillAdminData-fb293779.mjs → EditSkillAdminData-49c6c6af.mjs} +2 -2
- package/dist/{EditSkillData-02a11dce.mjs → EditSkillData-ebc2b643.mjs} +2 -2
- package/dist/{HomeView-ff9146bd.mjs → HomeView-83e0b323.mjs} +5 -5
- package/dist/{Loading-8b5bc980.mjs → Loading-1da03bc8.mjs} +1 -1
- package/dist/{LoadingSimulation-c6134e66.mjs → LoadingSimulation-37de85bc.mjs} +1 -1
- package/dist/{Modal-4c062a21.mjs → Modal-ec1d6fe9.mjs} +1 -1
- package/dist/{PaperAirplaneIcon-5628e238.mjs → PaperAirplaneIcon-bbe507b0.mjs} +1 -1
- package/dist/{PromptTesting-dcf9ed27.mjs → PromptTesting-687dc181.mjs} +3 -3
- package/dist/{SkillAutomation-eba53010.mjs → SkillAutomation-10359b3e.mjs} +3 -3
- package/dist/{SkillData-c9ed69aa.mjs → SkillData-82216a7d.mjs} +3 -3
- package/dist/{Testcase-11afbbd3.mjs → Testcase-a16ba1c6.mjs} +3 -3
- package/dist/{UnderMaintenance-992d4832.mjs → UnderMaintenance-b8f0ca29.mjs} +1 -1
- package/dist/{VoiceTestcase-4a4d52c4.mjs → VoiceTestcase-6f6a88a2.mjs} +3 -3
- package/dist/{XMarkIcon-3debd257.mjs → XMarkIcon-e3dd1c9f.mjs} +1 -1
- package/dist/{api-dc566510.mjs → api-91d1decc.mjs} +1 -1
- package/dist/{index.es-d1868bdf.mjs → index.es-bf7c4e5d.mjs} +7 -7
- package/dist/{main-8ab9bb25.mjs → main-17eb0aa9.mjs} +966 -966
- package/dist/mgtwin.es.min.js +1 -1
- package/dist/mgtwin.umd.min.js +1 -1
- package/dist/{voiceServices-07b39220.mjs → voiceServices-a32e4e86.mjs} +3 -3
- package/package.json +1 -1
- package/dist/assets/ffmpeg/ffmpeg-core.js +0 -16
- package/dist/assets/ffmpeg/ffmpeg-core.wasm +0 -0
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 zn.Deferred;try{if(e.messageType===zn.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 zn.ConnectionMessage(e.messageType,n,i,e.id))}else if(e.messageType===zn.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 zn.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 zn.Deferred;try{if(e.messageType===zn.MessageType.Text){const r=`${this.makeHeaders(e)}${yL}${e.textBody?e.textBody:""}`;A.resolve(new zn.RawWebsocketMessage(zn.MessageType.Text,r,e.id))}else if(e.messageType===zn.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 zn.RawWebsocketMessage(zn.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]}${yL}`);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}}aI.WebsocketMessageFormatter=T$;var Pd={},QL;function U$(){if(QL)return Pd;QL=1,Object.defineProperty(Pd,"__esModule",{value:!0}),Pd.SpeechConnectionFactory=void 0;const t=Zr(),e=ut(),A=Ve(),r=ps(),i=ut(),n=Wr,o=ds,s=vn;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),I=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=I+this.dictationRelativeUri:u.recognitionEndpointVersion!==void 0&&parseInt(u.recognitionEndpointVersion,10)>1?h=`${I}${this.universalUri}${u.recognitionEndpointVersion}`:h=I+this.conversationRelativeUri;break;case s.RecognitionMode.Dictation:h=I+this.dictationRelativeUri;break;default:u.recognitionEndpointVersion!==void 0&&parseInt(u.recognitionEndpointVersion,10)>1?h=`${I}${this.universalUri}${u.recognitionEndpointVersion}`:h=I+this.interactiveRelativeUri;break}const M={};l.token!==void 0&&l.token!==""&&(M[l.headerName]=l.token),M[n.HeaderNames.ConnectionId]=g,M.connectionId=g;const O=u.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",x=new t.WebsocketConnection(h,E,M,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(u),O,g),P=x.uri;return u.parameters.setProperty(A.PropertyId.SpeechServiceConnection_Url,P),x}};return Pd.SpeechConnectionFactory=a,Pd}var Gd={},RL;function L$(){if(RL)return Gd;RL=1,Object.defineProperty(Gd,"__esModule",{value:!0}),Gd.ConversationTranscriberConnectionFactory=void 0;const t=Zr(),e=Ve(),A=ut(),r=ps(),i=ut(),n=Wr,o=ds;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),I={},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)&&(I[o.QueryParameterNames.CustomSpeechDeploymentId]=E):v&&(!g||g.search(o.QueryParameterNames.Language)===-1)&&(I[o.QueryParameterNames.Language]=v),c.autoDetectSourceLanguages!==void 0&&(I[o.QueryParameterNames.EnableLanguageId]="true"),this.setV2UrlParams(c,I,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 M=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true",O=new t.WebsocketConnection(g,I,m,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(c),M,l),x=O.uri;return c.parameters.setProperty(e.PropertyId.SpeechServiceConnection_Url,x),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 Gd.ConversationTranscriberConnectionFactory=s,Gd}var jd={},DL;function F$(){if(DL)return jd;DL=1,Object.defineProperty(jd,"__esModule",{value:!0}),jd.TranscriberConnectionFactory=void 0;const t=Zr(),e=Ve(),A=ps(),r=ut(),i=Wr,n=ds;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),I={};this.setQueryParams(I,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,I,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 jd.TranscriberConnectionFactory=o,jd}var Yd={},TL;function O$(){if(TL)return Yd;TL=1,Object.defineProperty(Yd,"__esModule",{value:!0}),Yd.TranslationConnectionFactory=void 0;const t=Zr(),e=vd,A=Ve(),r=ps(),i=ut(),n=Wr,o=ds,s=vn;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 I=u.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return new t.WebsocketConnection(h,p,C,new i.WebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(u),I,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 Yd.TranslationConnectionFactory=a,Yd}var Hd={},UL;function b$(){if(UL)return Hd;UL=1,Object.defineProperty(Hd,"__esModule",{value:!0}),Hd.EnumTranslation=void 0;const t=Ve(),e=ut();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 Hd.EnumTranslation=A,Hd}var LL={};(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={}))})(LL);var zd={},FL;function x$(){if(FL)return zd;FL=1,Object.defineProperty(zd,"__esModule",{value:!0}),zd.TranslationSynthesisEnd=void 0;const t=ut();let e=class lj{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 lj(r)}get SynthesisStatus(){return this.privSynthesisEnd.SynthesisStatus}get FailureReason(){return this.privSynthesisEnd.FailureReason}};return zd.TranslationSynthesisEnd=e,zd}var cI={};Object.defineProperty(cI,"__esModule",{value:!0}),cI.TranslationHypothesis=void 0;const N$=Ut,OL=DC;class uI{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 uI(JSON.parse(e),A)}static fromTranslationResponse(e,A){N$.Contracts.throwIfNullOrUndefined(e,"translationHypothesis");const r=e.SpeechHypothesis;return e.SpeechHypothesis=void 0,r.Translation=e,new uI(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:OL.TranslationStatus[e.Translation.TranslationStatus]}):JSON.stringify(e)}mapTranslationStatus(e){if(typeof e=="string")return OL.TranslationStatus[e];if(typeof e=="number")return e}}cI.TranslationHypothesis=uI;var Jd={},bL;function K$(){if(bL)return Jd;bL=1,Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.TranslationPhrase=void 0;const t=Ut,e=ut(),A=DC;let r=class hR{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 hR(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 hR(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 Jd.TranslationPhrase=r,Jd}var qd={},xL;function k$(){if(xL)return qd;xL=1,Object.defineProperty(qd,"__esModule",{value:!0}),qd.TranslationServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ut();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 qd.TranslationServiceRecognizer=r,qd}var lI={};Object.defineProperty(lI,"__esModule",{value:!0}),lI.SpeechDetected=void 0;class N0{constructor(e,A){this.privSpeechStartDetected=JSON.parse(e),this.privSpeechStartDetected.Offset+=A}static fromJSON(e,A){return new N0(e,A)}get Offset(){return this.privSpeechStartDetected.Offset}}lI.SpeechDetected=N0;var hI={};Object.defineProperty(hI,"__esModule",{value:!0}),hI.SpeechHypothesis=void 0;class K0{constructor(e,A){this.privSpeechHypothesis=JSON.parse(e),this.updateOffset(A)}static fromJSON(e,A){return new K0(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}}hI.SpeechHypothesis=K0;var gI={};Object.defineProperty(gI,"__esModule",{value:!0}),gI.SpeechKeyword=void 0;class k0{constructor(e,A){this.privSpeechKeyword=JSON.parse(e),this.privSpeechKeyword.Offset+=A}static fromJSON(e,A){return new k0(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)}}gI.SpeechKeyword=k0;var Vd={},NL;function P$(){if(NL)return Vd;NL=1,Object.defineProperty(Vd,"__esModule",{value:!0}),Vd.SpeechServiceRecognizer=void 0;const t=Ve(),e=ut();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 Vd.SpeechServiceRecognizer=A,Vd}var Wd={},KL={};(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={}))})(KL);var kL;function G$(){if(kL)return Wd;kL=1,Object.defineProperty(Wd,"__esModule",{value:!0}),Wd.ConversationTranscriptionServiceRecognizer=void 0;const t=Ve(),e=ut(),A=KL,r=vn;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 Wd.ConversationTranscriptionServiceRecognizer=i,Wd}var Zd={},PL;function j$(){if(PL)return Zd;PL=1,Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.TranscriptionServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ut(),r=Co;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 Zd.TranscriptionServiceRecognizer=i,Zd}var Xd={},GL;function Y$(){if(GL)return Xd;GL=1,Object.defineProperty(Xd,"__esModule",{value:!0}),Xd.DetailedSpeechPhrase=void 0;const t=ut();let e=class hj{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 hj(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 Xd.DetailedSpeechPhrase=e,Xd}var _d={},jL;function H$(){if(jL)return _d;jL=1,Object.defineProperty(_d,"__esModule",{value:!0}),_d.SimpleSpeechPhrase=void 0;const t=ut();let e=class gj{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 gj(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 _d.SimpleSpeechPhrase=e,_d}var dI={};Object.defineProperty(dI,"__esModule",{value:!0}),dI.AddedLmIntent=void 0;class z${constructor(e,A){this.modelImpl=e,this.intentName=A}}dI.AddedLmIntent=z$;var $d={},YL;function J$(){if(YL)return $d;YL=1,Object.defineProperty($d,"__esModule",{value:!0}),$d.IntentServiceRecognizer=void 0;const t=Mt(),e=Ve(),A=ut();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 I=C===void 0||C.intentName===void 0?p.topScoringIntent.intent:C.intentName;let E=s.result.reason;I!==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(I,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 $d.IntentServiceRecognizer=r,$d}var pI={};Object.defineProperty(pI,"__esModule",{value:!0}),pI.IntentResponse=void 0;class P0{constructor(e){e===""?this.privIntentResponse={}:this.privIntentResponse=JSON.parse(e)}static fromJSON(e){return new P0(e)}get query(){return this.privIntentResponse.query}get topScoringIntent(){return this.privIntentResponse.topScoringIntent}get entities(){return this.privIntentResponse.entities}}pI.IntentResponse=P0;var HL={};Object.defineProperty(HL,"__esModule",{value:!0});var fI={},EI={};Object.defineProperty(EI,"__esModule",{value:!0}),EI.ServiceTelemetryListener=void 0;const Bo=Mt(),zL=oI;class q${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 zL.RecognitionTriggeredEvent&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof Bo.AudioStreamNodeAttachingEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Bo.AudioStreamNodeAttachedEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Bo.AudioSourceErrorEvent&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Bo.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 Bo.AudioStreamNodeDetachedEvent&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof zL.ConnectingToServiceEvent&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof Bo.ConnectionStartEvent&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof Bo.ConnectionEstablishedEvent&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof Bo.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 Bo.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()}}}EI.ServiceTelemetryListener=q$,Object.defineProperty(fI,"__esModule",{value:!0}),fI.RequestSession=void 0;const Dl=Mt(),CI=oI,V$=EI;class W${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,Dl.createNoDashGuid)(),this.privAudioNodeId=(0,Dl.createNoDashGuid)(),this.privTurnDeferral=new Dl.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 V$.ServiceTelemetryListener(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new CI.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 CI.ListeningStartedEvent(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onPreConnectionStart(e,A){this.privAuthFetchEventId=e,this.privSessionId=A,this.onEvent(new CI.ConnectingToServiceEvent(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}async onAuthCompleted(e){e&&await this.onComplete()}async onConnectionEstablishCompleted(e,A){if(e===200){this.onEvent(new CI.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,Dl.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 Dl.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),Dl.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())}}fI.RequestSession=W$;var II={},JL={};(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={}))})(JL),Object.defineProperty(II,"__esModule",{value:!0}),II.SpeechContext=void 0;const Z$=vn,Da=JL;class X${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=Z$.RecognitionMode.Conversation),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push(Da.PhraseOption.PronunciationAssessment),this.privContext.phraseOutput.detailed.options.indexOf(Da.PhraseOption.SNR)===-1&&this.privContext.phraseOutput.detailed.options.push(Da.PhraseOption.SNR),A&&(this.privContext.phraseDetection.enrichment.contentAssessment={topic:A},this.privContext.phraseOutput.detailed.options.push(Da.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=Da.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=Da.OutputFormat.Detailed,this.privContext.phraseOutput.detailed.options.indexOf(Da.PhraseOption.WordTimings)===-1&&this.privContext.phraseOutput.detailed.options.push(Da.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)}}II.SpeechContext=X$;var BI={},qL={};(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={}))})(qL),Object.defineProperty(BI,"__esModule",{value:!0}),BI.DynamicGrammarBuilder=void 0;const _$=qL;class $${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:_$.GroupType.Generic,items:A}]}return e}}BI.DynamicGrammarBuilder=$$;var ep={},vI={},wI={},G0={};(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={}))})(G0),Object.defineProperty(wI,"__esModule",{value:!0}),wI.DialogServiceTurnState=void 0;const eee=Qa,tee=li,Aee=G0;class ree{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===Aee.MessageDataStreamType.TextToSpeechAudio&&(this.privAudioStream=tee.AudioOutputStream.createPullStream(),this.privAudioStream.format=A!==void 0?A:eee.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)}}wI.DialogServiceTurnState=ree,Object.defineProperty(vI,"__esModule",{value:!0}),vI.DialogServiceTurnStateManager=void 0;const VL=ai,iee=wI;class nee{constructor(){this.privTurnMap=new Map}StartTurn(e){if(this.privTurnMap.has(e))throw new VL.InvalidOperationError("Service error: There is already a turn with id:"+e);const A=new iee.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 VL.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}}vI.DialogServiceTurnStateManager=nee;var WL={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvocationSource=void 0,function(e){e.None="None",e.VoiceActivationWithKeyword="VoiceActivationWithKeyword"}(t.InvocationSource||(t.InvocationSource={}))})(WL);var ZL={};(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={}))})(ZL);var XL;function see(){if(XL)return ep;XL=1,Object.defineProperty(ep,"__esModule",{value:!0}),ep.DialogServiceAdapter=void 0;const t=Zr(),e=bc,A=Mt(),r=Qa,i=Ve(),n=vI,o=ut(),s=G0,a=WL,c=ZL,u=Co;let l=class extends o.ServiceRecognizerBase{constructor(h,p,C,I,E){super(h,p,C,I,E),this.privEvents=new A.EventSource,this.privDialogServiceConnector=E,this.receiveMessageOverride=()=>this.receiveDialogMessageOverride(),this.privTurnStateManager=new n.DialogServiceTurnStateManager,this.recognizeOverride=(v,m,M)=>this.listenOnce(v,m,M),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)(),I={context:{interactionId:p},messagePayload:JSON.parse(h),version:.5},E=JSON.stringify(I);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,I;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{}}I=!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 M=new i.SpeechRecognitionEventArgs(C,m.Offset,this.privRequestSession.sessionId);if(this.privDialogServiceConnector.recognizing)try{this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector,M)}catch{}I=!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 x=new i.SpeechRecognitionEventArgs(C,C.duration,C.resultId);if(this.privDialogServiceConnector.recognized)try{this.privDialogServiceConnector.recognized(this.privDialogServiceConnector,x)}catch{}I=!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{}}I=!0;break;case"response":this.handleResponseMessage(h),I=!0;break}const E=new A.Deferred;return E.resolve(I),E.promise}async cancelRecognition(h,p,C,I,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[I]);const m=new i.SpeechRecognitionCanceledEventArgs(C,E,I,void 0,h);try{this.privDialogServiceConnector.canceled(this.privDialogServiceConnector,m)}catch{}if(this.privSuccessCallback){const M=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(M),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 I=this.connectImpl(),E=this.sendPreAudioMessages(),v=await this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId),m=await this.privDialogAudioSource.format,M=await this.privDialogAudioSource.deviceInfo,O=new t.ReplayableAudioNode(v,m.avgBytesPerSec);await this.privRequestSession.onAudioSourceAttachCompleted(O,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:M};try{await I,await E}catch(D){return await this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,i.CancellationReason.Error,i.CancellationErrorCode.ConnectionFailure,D),Promise.resolve()}const x=new i.SessionEventArgs(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,x),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(),I=!this.isDisposed()&&this.terminateMessageLoop;if(C||I){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 q=m.requestId.toUpperCase(),Q=this.privRequestSession.requestId.toUpperCase();q!==Q?this.privTurnStateManager.StartTurn(q):this.privRequestSession.onServiceTurnStartResponse()}break;case"speech.startdetected":const O=o.SpeechDetected.fromJSON(m.textBody,this.privRequestSession.currentTurnAudioOffset),x=new i.RecognitionEventArgs(O.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,x);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 q=m.requestId.toUpperCase(),Q=this.privRequestSession.requestId.toUpperCase();if(q!==Q)this.privTurnStateManager.CompleteTurn(q);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),I=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(I,h.Offset,this.privRequestSession.sessionId)}handleResponseMessage(h){const p=JSON.parse(h.textBody);switch(p.messageType.toLowerCase()){case"message":const C=h.requestId.toUpperCase(),I=s.ActivityPayloadResponse.fromJSON(h.textBody),E=this.privTurnStateManager.GetTurn(C);if(I.conversationId){const M=this.agentConfig.get();M.botInfo.conversationId=I.conversationId,this.agentConfig.set(M)}const v=E.processActivityPayload(I,r.AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(this.privDialogServiceConnector.properties.getProperty(i.PropertyId.SpeechServiceConnection_SynthOutputFormat,void 0))),m=new i.ActivityReceivedEventArgs(I.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"),I=h.split(";"),E=p===void 0?[]:p.split(";"),v=C===void 0?[]:C.split(";"),m=[];for(let M=0;M<I.length;M++){const O={text:I[M]};M<E.length&&(O.startOffset=Number(E[M])),M<v.length&&(O.duration=Number(v[M])),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 ep.DialogServiceAdapter=l,ep}var SI={};Object.defineProperty(SI,"__esModule",{value:!0}),SI.AgentConfig=void 0;class oee{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}SI.AgentConfig=oee;var j0={},tp={},Tl={};Object.defineProperty(Tl,"__esModule",{value:!0}),Tl.ConversationConnectionConfig=void 0;const aee=Nd;class Di extends aee.RestConfigBase{static get host(){return Di.privHost}static get apiVersion(){return Di.privApiVersion}static get clientAppId(){return Di.privClientAppId}static get defaultLanguageCode(){return Di.privDefaultLanguageCode}static get restPath(){return Di.privRestPath}static get webSocketPath(){return Di.privWebSocketPath}static get transcriptionEventKeys(){return Di.privTranscriptionEventKeys}}Tl.ConversationConnectionConfig=Di,Di.privHost="dev.microsofttranslator.com",Di.privRestPath="/capito/room",Di.privApiVersion="2.0",Di.privDefaultLanguageCode="en-US",Di.privClientAppId="FC539C22-1767-4F1F-84BC-B4D811114F15",Di.privWebSocketPath="/capito/translate",Di.privTranscriptionEventKeys=["iCalUid","callId","organizer","FLAC","MTUri","DifferentiateGuestSpeakers","audiorecording","Threadid","OrganizerMri","OrganizerTenantId","UserToken"];var _L;function cee(){if(_L)return tp;_L=1,Object.defineProperty(tp,"__esModule",{value:!0}),tp.ConversationManager=void 0;const t=Zr(),e=Ut,A=Ve(),r=Tl;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),I=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:I?v[this.privRequestParams.authorization]=`Bearer ${I}`:e.Contracts.throwIfNullOrUndefined(p,this.privErrors.authInvalidSubscriptionKey));const m={};m.headers=v,this.privRestAdapter.options=m;const M=`https://${g}${this.privRestPath}`;this.privRestAdapter.request(t.RestRequestType.Post,M,E,null).then(O=>{const x=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}]`}x&&(D+=` ${x}`),c(D)}return}const P=JSON.parse(O.data);if(P&&(P.requestId=x),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(I=>{I.ok,a()}).catch(()=>{})}catch(u){if(u instanceof Error){const l=u;c(l.name+": "+l.message)}else c(u)}})}};return tp.ConversationManager=i,tp}var Zc={},Ap={},mI={},rp={};Object.defineProperty(rp,"__esModule",{value:!0}),rp.ConversationConnectionMessage=void 0;const uee=Mt();class lee extends uee.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}}rp.ConversationConnectionMessage=lee,Object.defineProperty(mI,"__esModule",{value:!0}),mI.ConversationWebsocketMessageFormatter=void 0;const Xc=Mt(),$L=rp;class hee{toConnectionMessage(e){const A=new Xc.Deferred;try{if(e.messageType===Xc.MessageType.Text){const r=new $L.ConversationConnectionMessage(e.messageType,e.textContent,{},e.id);A.resolve(r)}else e.messageType===Xc.MessageType.Binary&&A.resolve(new $L.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 Xc.Deferred;try{if(e.messageType===Xc.MessageType.Text){const r=`${e.textBody?e.textBody:""}`;A.resolve(new Xc.RawWebsocketMessage(Xc.MessageType.Text,r,e.id))}}catch(r){A.reject(`Error formatting the message. ${r}`)}return A.promise}}mI.ConversationWebsocketMessageFormatter=hee;var eF;function gee(){if(eF)return Ap;eF=1,Object.defineProperty(Ap,"__esModule",{value:!0}),Ap.ConversationConnectionFactory=void 0;const t=Zr(),e=Mt(),A=Ut,r=Ve(),i=ps(),n=Tl,o=mI;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 I={};I[n.ConversationConnectionConfig.configParams.apiVersion]=n.ConversationConnectionConfig.apiVersion,I[n.ConversationConnectionConfig.configParams.token]=C,I[n.ConversationConnectionConfig.configParams.correlationId]=h;const E=c.parameters.getProperty("SPEECH-EnableWebsocketCompression","false")==="true";return Promise.resolve(new t.WebsocketConnection(p,I,{},new o.ConversationWebsocketMessageFormatter,t.ProxyInfo.fromRecognizerConfig(c),E,l))}};return Ap.ConversationConnectionFactory=s,Ap}var ip={},MI={};Object.defineProperty(MI,"__esModule",{value:!0}),MI.ConversationRequestSession=void 0;const Y0=Mt();class dee{constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privSessionId=e,this.privRequestId=(0,Y0.createNoDashGuid)(),this.privRequestCompletionDeferral=new Y0.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,Y0.createNoDashGuid)():this.onComplete()}async dispose(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)await e.detach()}}onComplete(){}}MI.ConversationRequestSession=dee;var Hi={},tF;function AF(){if(tF)return Hi;tF=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.ConversationReceivedTranslationEventArgs=Hi.ParticipantsListEventArgs=Hi.ParticipantAttributeEventArgs=Hi.ParticipantEventArgs=Hi.LockRoomEventArgs=Hi.MuteAllEventArgs=void 0;const t=Ve();class e extends t.SessionEventArgs{constructor(a,c){super(c),this.privIsMuted=a}get isMuted(){return this.privIsMuted}}Hi.MuteAllEventArgs=e;class A extends t.SessionEventArgs{constructor(a,c){super(c),this.privIsLocked=a}get isMuted(){return this.privIsLocked}}Hi.LockRoomEventArgs=A;class r extends t.SessionEventArgs{constructor(a,c){super(c),this.privParticipant=a}get participant(){return this.privParticipant}}Hi.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}}Hi.ParticipantAttributeEventArgs=i;class n extends t.SessionEventArgs{constructor(a,c,u,l,g,h,p,C,I){super(I),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}}Hi.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 Hi.ConversationReceivedTranslationEventArgs=o,Hi}var vo={};Object.defineProperty(vo,"__esModule",{value:!0}),vo.ConversationTranslatorCommandTypes=vo.ConversationTranslatorMessageTypes=vo.InternalParticipants=void 0;class pee{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)}}vo.InternalParticipants=pee,vo.ConversationTranslatorMessageTypes={command:"command",final:"final",info:"info",instantMessage:"instant_message",keepAlive:"keep_alive",partial:"partial",participantCommand:"participant_command",translatedMessage:"translated_message"},vo.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 rF={},yI={};Object.defineProperty(yI,"__esModule",{value:!0}),yI.CommandResponsePayload=void 0;const fee=t=>JSON.parse(t);class H0{constructor(e){this.privCommandResponse=fee(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 H0(e)}}yI.CommandResponsePayload=H0;var Ul={};Object.defineProperty(Ul,"__esModule",{value:!0}),Ul.ParticipantPayloadResponse=Ul.ParticipantsListPayloadResponse=void 0;const Eee=t=>JSON.parse(t),Cee=t=>JSON.parse(t);class z0{constructor(e){this.privParticipantsPayloadResponse=Eee(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 z0(e)}}Ul.ParticipantsListPayloadResponse=z0;class J0{constructor(e){this.privParticipantPayloadResponse=Cee(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 J0(e)}}Ul.ParticipantPayloadResponse=J0;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.TextResponsePayload=Ll.SpeechResponsePayload=void 0;const Iee=t=>JSON.parse(t),Bee=t=>JSON.parse(t);class q0{constructor(e){this.privSpeechResponse=Iee(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 q0(e)}}Ll.SpeechResponsePayload=q0;class V0{constructor(e){this.privTextResponse=Bee(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 V0(e)}}Ll.TextResponsePayload=V0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TextResponsePayload=t.SpeechResponsePayload=t.ParticipantPayloadResponse=t.ParticipantsListPayloadResponse=t.CommandResponsePayload=void 0;var e=yI;Object.defineProperty(t,"CommandResponsePayload",{enumerable:!0,get:function(){return e.CommandResponsePayload}});var A=Ul;Object.defineProperty(t,"ParticipantsListPayloadResponse",{enumerable:!0,get:function(){return A.ParticipantsListPayloadResponse}}),Object.defineProperty(t,"ParticipantPayloadResponse",{enumerable:!0,get:function(){return A.ParticipantPayloadResponse}});var r=Ll;Object.defineProperty(t,"SpeechResponsePayload",{enumerable:!0,get:function(){return r.SpeechResponsePayload}}),Object.defineProperty(t,"TextResponsePayload",{enumerable:!0,get:function(){return r.TextResponsePayload}})}(rF);var iF;function vee(){if(iF)return ip;iF=1,Object.defineProperty(ip,"__esModule",{value:!0}),ip.ConversationServiceAdapter=void 0;const t=Mt(),e=Ve(),A=ut(),r=rp,i=MI,n=AF(),o=vo,s=rF;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 I=s.CommandResponsePayload.fromJSON(g.textBody);switch(I.command.toLowerCase()){case"participantlist":const x=s.ParticipantsListPayloadResponse.fromJSON(g.textBody),P=x.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(x.roomid,x.token,x.translateTo,x.profanityFilter,x.roomProfanityFilter,x.roomLocked,x.muteAll,P,h));break;case"settranslatetolanguages":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(I.participantId,o.ConversationTranslatorCommandTypes.setTranslateToLanguages,I.value,h));break;case"setprofanityfiltering":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(I.participantId,o.ConversationTranslatorCommandTypes.setProfanityFiltering,I.value,h));break;case"setmute":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(I.participantId,o.ConversationTranslatorCommandTypes.setMute,I.value,h));break;case"setmuteall":this.privConversationServiceConnector.muteAllCommandReceived&&this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector,new n.MuteAllEventArgs(I.value,h));break;case"roomexpirationwarning":this.privConversationServiceConnector.conversationExpiration&&this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector,new e.ConversationExpirationEventArgs(I.value,this.privConversationRequestSession.sessionId));break;case"setusetts":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(I.participantId,o.ConversationTranslatorCommandTypes.setUseTTS,I.value,h));break;case"setlockstate":this.privConversationServiceConnector.lockRoomCommandReceived&&this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector,new n.LockRoomEventArgs(I.value,h));break;case"changenickname":this.privConversationServiceConnector.participantUpdateCommandReceived&&this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,new n.ParticipantAttributeEventArgs(I.participantId,o.ConversationTranslatorCommandTypes.changeNickname,I.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 q={id:I.participantId};this.privConversationServiceConnector.participantLeaveCommandReceived&&this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector,new n.ParticipantEventArgs(q,h));break;case"disconnectsession":const Q={id:I.participantId};break;case"token":const R=new A.CognitiveTokenAuthentication(()=>{const G=I.token;return Promise.resolve(G)},()=>{const G=I.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 M=s.TextResponsePayload.fromJSON(g.textBody),O=new e.ConversationTranslationResult(M.participantId,this.getTranslations(M.translations),M.language,void 0,void 0,M.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 ip.ConversationServiceAdapter=a,ip}var nF;function wee(){if(nF)return Zc;nF=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.ConversationTranslatorRecognizer=Zc.ConversationRecognizerFactory=void 0;const t=ut(),e=Mt(),A=Ut,r=Ve(),i=gee(),n=vee();class o{static fromConfig(c,u,l){return new s(c,u,l)}}Zc.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,I)=>{p!==void 0?p.then(()=>{try{C&&C()}catch(E){I&&I(`'Unhandled error on promise callback: ${E}'`)}},E=>{try{I&&I(E)}catch{}}):I&&I("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 Zc.ConversationTranslatorRecognizer=s,Zc}var np={},sF;function See(){if(sF)return np;sF=1,Object.defineProperty(np,"__esModule",{value:!0}),np.TranscriberRecognizer=void 0;const t=Mt(),e=Ut,A=Ve(),r=ut(),i=vn;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 np.TranscriberRecognizer=n,np}var oF;function mee(){return oF||(oF=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=cee();Object.defineProperty(t,"ConversationManager",{enumerable:!0,get:function(){return e.ConversationManager}});var A=Tl;Object.defineProperty(t,"ConversationConnectionConfig",{enumerable:!0,get:function(){return A.ConversationConnectionConfig}});var r=wee();Object.defineProperty(t,"ConversationRecognizerFactory",{enumerable:!0,get:function(){return r.ConversationRecognizerFactory}});var i=See();Object.defineProperty(t,"TranscriberRecognizer",{enumerable:!0,get:function(){return i.TranscriberRecognizer}});var n=AF();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=vo;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}})}(j0)),j0}var W0={};(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})(W0);var sp={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.SynthesisStartedEvent=Gs.ConnectingToSynthesisServiceEvent=Gs.SynthesisTriggeredEvent=Gs.SpeechSynthesisEvent=void 0;const aF=Mt();class QI extends aF.PlatformEvent{constructor(e,A,r=aF.EventType.Info){super(e,r),this.privRequestId=A}get requestId(){return this.privRequestId}}Gs.SpeechSynthesisEvent=QI;class Mee extends QI{constructor(e,A,r){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=A,this.privTurnAudioDestinationId=r}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}Gs.SynthesisTriggeredEvent=Mee;class yee extends QI{constructor(e,A){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=A}get authFetchEventId(){return this.privAuthFetchEventId}}Gs.ConnectingToSynthesisServiceEvent=yee;class Qee extends QI{constructor(e,A){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=A}get authFetchEventId(){return this.privAuthFetchEventId}}Gs.SynthesisStartedEvent=Qee;var cF;function Ree(){if(cF)return sp;cF=1,Object.defineProperty(sp,"__esModule",{value:!0}),sp.SynthesisTurn=void 0;const t=Mt(),e=li,A=Ve(),r=W0,i=Gs;let n=class gR{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)&&!gR.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)&&!gR.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 sp.SynthesisTurn=n,sp}var op={},uF;function Dee(){if(uF)return op;uF=1,Object.defineProperty(op,"__esModule",{value:!0}),op.SynthesisAdapterBase=void 0;const t=Mt(),e=Ve(),A=ut(),r=Co;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 op.SynthesisAdapterBase=i,i.telemetryDataEnabled=!0,op}var ap={},lF;function Tee(){if(lF)return ap;lF=1,Object.defineProperty(ap,"__esModule",{value:!0}),ap.AvatarSynthesisAdapter=void 0;const t=Ve(),e=ut();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,I,E,v,m,M;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=(I=(C=this.privAvatarConfig.videoFormat)==null?void 0:C.cropRange)==null?void 0:I.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:(M=this.privAvatarConfig.backgroundImage)==null?void 0:M.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 ap.AvatarSynthesisAdapter=A,ap}var cp={},hF;function Uee(){if(hF)return cp;hF=1,Object.defineProperty(cp,"__esModule",{value:!0}),cp.SpeechSynthesisAdapter=void 0;const t=Ve(),e=ut();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 cp.SpeechSynthesisAdapter=A,cp}var up={},gF;function Lee(){if(gF)return up;gF=1,Object.defineProperty(up,"__esModule",{value:!0}),up.SynthesisRestAdapter=void 0;const t=Zr(),e=Ve(),A=ps(),r=Wr;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 up.SynthesisRestAdapter=i,up}var Z0={},dF;function Fee(){return dF||(dF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SynthesizerConfig=t.SynthesisServiceType=void 0;const e=ut();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}(Z0)),Z0}var lp={},pF;function Oee(){if(pF)return lp;pF=1,Object.defineProperty(lp,"__esModule",{value:!0}),lp.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 lp.SynthesisContext=e,lp}var hp={},fF;function bee(){if(fF)return hp;fF=1,Object.defineProperty(hp,"__esModule",{value:!0}),hp.SpeakerRecognitionConfig=void 0;const t=ut();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 hp.SpeakerRecognitionConfig=e,hp}var gp={},EF;function xee(){if(EF)return gp;EF=1,Object.defineProperty(gp,"__esModule",{value:!0}),gp.SpeakerServiceRecognizer=void 0;const t=Zr(),e=Mt(),A=Ve(),r=ut(),i=Co;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(I){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,I)}const p=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,p),this.receiveMessage(),this.sendAudio(h).then(()=>{},I=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,I)}),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 gp.SpeakerServiceRecognizer=n,gp}var dp={},CF;function Nee(){if(CF)return dp;CF=1,Object.defineProperty(dp,"__esModule",{value:!0}),dp.VoiceServiceRecognizer=void 0;const t=Zr(),e=Mt(),A=Ve(),r=ut(),i=Co;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 dp.VoiceServiceRecognizer=n,dp}var IF={};(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={}))})(IF);var BF;function ut(){return BF||(BF=1,function(t){var e=xt&&xt.__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=xt&&xt.__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(aC,t),A(UC,t),A(Ml,t),A(a2,t),A(c2,t),A(M$(),t),A(y$(),t),A(oI,t),A(Q$(),t),A(R$(),t),A(D$(),t),A(ML,t),A(aI,t),A(U$(),t),A(L$(),t),A(F$(),t),A(O$(),t),A(rL(),t),A(b$(),t),A(LL,t),A(x$(),t),A(cI,t),A(K$(),t),A(k$(),t),A(lI,t),A(hI,t),A(gI,t),A(P$(),t),A(G$(),t),A(j$(),t),A(Y$(),t),A(H$(),t),A(dI,t),A(J$(),t),A(pI,t),A(HL,t),A(fI,t),A(II,t),A(BI,t),A(see(),t),A(SI,t),A(mee(),t),A(W0,t),A(Ree(),t),A(Dee(),t);var r=Tee();Object.defineProperty(t,"AvatarSynthesisAdapter",{enumerable:!0,get:function(){return r.AvatarSynthesisAdapter}});var i=Uee();Object.defineProperty(t,"SpeechSynthesisAdapter",{enumerable:!0,get:function(){return i.SpeechSynthesisAdapter}}),A(Lee(),t),A(Fee(),t),A(Oee(),t),A(bee(),t),A(xee(),t),A(Nee(),t),A(IF,t),t.OutputFormatPropertyName="OutputFormat",t.CancellationErrorCodePropertyName="CancellationErrorCode",t.ServicePropertiesPropertyName="ServiceProperties",t.ForceDictationPropertyName="ForceDictation",t.AutoDetectSourceLanguagesOpenRangeOptionName="UND"}(t0)),t0}(function(t){var e=xt&&xt.__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=xt&&xt.__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=ut();new r.AgentConfig,A(Ve(),t)})(Ps);const hi=[];for(let t=0;t<256;++t)hi.push((t+256).toString(16).slice(1));function Kee(t,e=0){return(hi[t[e+0]]+hi[t[e+1]]+hi[t[e+2]]+hi[t[e+3]]+"-"+hi[t[e+4]]+hi[t[e+5]]+"-"+hi[t[e+6]]+hi[t[e+7]]+"-"+hi[t[e+8]]+hi[t[e+9]]+"-"+hi[t[e+10]]+hi[t[e+11]]+hi[t[e+12]]+hi[t[e+13]]+hi[t[e+14]]+hi[t[e+15]]).toLowerCase()}let X0;const kee=new Uint8Array(16);function Pee(){if(!X0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");X0=crypto.getRandomValues.bind(crypto)}return X0(kee)}const vF={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Gee(t,e,A){var i;if(vF.randomUUID&&!e&&!t)return vF.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??Pee();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 Kee(r)}const Fl=kr(),wo=dA(),Ol=ne(""),_c=ne(""),Ta=ne(""),wn=ne("");let So=null,_0=[];const wF=ne("");let Ua=null;const SF=4e3;sn(async()=>{wo.authToken=await DI()});let gr=null,bl=null,js=null,RI=null,xl=null;const mF="/assets/ffmpeg",mo=()=>{js&&js.mute(),gr&&(gr.close(),gr=null),bl=null},DI=async()=>{var t,e,A;try{const r=await jn("/voiceTesting");return(t=r==null?void 0:r.data)==null?void 0:t.token}catch(r){if(console.error(r),Xt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Fl.setError(((A=i.response)==null?void 0:A.data).message)}else Fl.setError("There was an issue while fetching data")}},Nl=()=>{Ua&&clearTimeout(Ua),RI&&(RI.stopContinuousRecognitionAsync(()=>{},t=>{console.error("Error stopping recognition",t)}),RI=null),So&&So.state!=="inactive"&&So.stop()},jee=async t=>(wo.authToken=await DI(),await mo(),new Promise((e,A)=>{const r=Ps.SpeechConfig.fromAuthorizationToken(wo.authToken,"eastus2");r.speechSynthesisVoiceName="en-US-EmmaMultilingualNeural",js=new Ps.SpeakerAudioDestination;const i=Ps.AudioConfig.fromSpeakerOutput(js);gr=new Ps.SpeechSynthesizer(r,i);const n=Gee();bl=n,gr.speakTextAsync(t,o=>{if(n!==bl)return js==null||js.mute(),gr==null||gr.close(),gr=null,e();o.reason===Ps.ResultReason.SynthesizingAudioCompleted?e():A(new Error("Speech synthesis failed")),gr==null||gr.close(),gr=null,bl=null},o=>{if(n!==bl)return js==null||js.mute(),gr==null||gr.close(),gr=null,e();gr==null||gr.close(),gr=null,bl=null,A(o)})})),Yee=async t=>{wo.authToken=await DI();const e=Ps.SpeechConfig.fromAuthorizationToken(wo.authToken,"eastus2");e.speechRecognitionLanguage="en-US";const A=Ps.AudioConfig.fromDefaultMicrophoneInput(),r=new Ps.SpeechRecognizer(e,A);return RI=r,Ol.value="",_c.value="",await QF(),r.recognizing=(i,n)=>{n.result.text&&n.result.text.trim()&&(Ol.value=n.result.text.trim(),mo(),wo.userspeaking=!0,wo.userSpeechText=(_c.value?_c.value+" ":"")+Ol.value,wn.value="user",Ua&&clearTimeout(Ua),Ua=setTimeout(()=>{Ol.value&&(t(Ol.value.trim()),Ol.value="")},SF))},r.recognized=async(i,n)=>{n.result.reason===Ps.ResultReason.RecognizedSpeech&&n.result.text&&n.result.text.trim()&&(_c.value+=" "+n.result.text.trim(),Ua&&clearTimeout(Ua),Ua=setTimeout(async()=>{_c.value&&(t(_c.value),console.log("Audio stop recording"),_c.value="")},SF))},r.canceled=async(i,n)=>{console.error("Recognition canceled:",n),console.log("Audio stop recording")},r.startContinuousRecognitionAsync(),r},MF=async()=>{var t,e;Ta.value="",wF.value="";try{mo(),await Yee(async A=>{if(A){console.log("triggering Audio sentiment:");const r=await Hee();console.log("Audio sentiment:",r),Ta.value=A;const i=QF()}})}catch(A){if(console.error(A),Xt.isAxiosError(A)){const r=A;console.log("Error found!"),console.error((t=r.response)==null?void 0:t.data),Fl.setError(((e=r.response)==null?void 0:e.data).message)}else Fl.setError("There was an issue while fetching data")}},yF=async t=>{var e,A;wF.value="";try{(wn.value=="user"||wn.value=="listening")&&mo(),await jee(t)}catch(r){if(console.error(r),Xt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Fl.setError(((A=i.response)==null?void 0:A.data).message)}else Fl.setError("There was an issue while fetching data")}};async function QF(){try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});So=new MediaRecorder(t,{mimeType:"audio/webm"}),So.ondataavailable=e=>{e.data.size>0&&_0.push(e.data)},So.start(),console.log("Audio recording started")}catch(t){console.error("Error starting audio recording:",t)}}async function Hee(){return new Promise((t,e)=>{if(!So)return e("No active recorder found");So.onstop=async()=>{var r,i,n;const A=new Blob(_0,{type:"audio/webm"});_0=[];try{console.log("Sending audio for analysis...");const o=await zee(A);console.log("Converting WebM to MP3...",o);const a={audio:await qee(o),format:"mp3",finalAnalysis:!1};console.log("Payload for analysis:",a);const c=await Xt.post("/fetchPdfAssessment",a,{headers:{"Content-Type":"application/json"}});console.log("Server response:",(r=c==null?void 0:c.data)==null?void 0:r.body),wo.audioAnaysis.push((n=(i=c==null?void 0:c.data)==null?void 0:i.body)==null?void 0:n.answer),console.log("store audioAnaysis",wo.audioAnaysis),console.log("Audio analysis result:",c.data),t(c.data)}catch(o){e(o)}},So.stop(),console.log("Audio recording stopped")})}async function zee(t){try{console.log("⏳ Initializing FFmpeg...");const e=await Jee();console.log("✅ FFmpeg loaded");const A=await gZ(t);e.writeFile("input.webm",A),await e.exec(["-i","input.webm","-vn","-acodec","libmp3lame","-ar","16000","-ac","1","-ab","32k","output.mp3"]),console.log("Conversion complete");const r=await e.readFile("output.mp3");return await e.deleteFile("input.webm"),await e.deleteFile("output.mp3"),new Blob([r],{type:"audio/mpeg"})}catch(e){throw console.error("❌ Error:",e),e}}async function Jee(){if(xl!=null&&xl.loaded)return xl;const t=xl||new aZ;return t.on("log",({message:e})=>{console.log(e)}),await t.load({coreURL:await R4(`${mF}/ffmpeg-core.js`,"text/javascript"),wasmURL:await R4(`${mF}/ffmpeg-core.wasm`,"application/wasm")}),xl=t,t}const qee=t=>new Promise((e,A)=>{const r=new FileReader;r.onloadend=()=>{const i=r.result.split(",")[1];e(i)},r.onerror=A,r.readAsDataURL(t)}),Vee={class:"flex items-center gap-4 py-2 rounded-full z-10"},Wee={key:0,class:"flex items-center"},Zee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},Xee=[sl('<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)],_ee={key:1,class:"flex items-center"},$ee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},ete=[sl('<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)],tte={key:2,class:"flex items-center"},Ate=[sl('<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)],rte={class:"tooltiptext text-genpact-darkest-teal"},ite=[S("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[S("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)],nte=[S("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[S("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"}),S("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor","stroke-width":"2"})],-1)],ste=Zt({__name:"NewVoiceConversation",setup(t){const e=dA(),A=kr(),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,oC(),wn.value="user",n.value="Turn off mic"):(console.log("mic enabled true"),i.value=!0,mo(),MF(),wn.value="user",n.value="Turn off mic"):e.elevenLabs?(console.log("mic enabled false"),wl(),i.value=!1,n.value="Turn on mic"):(console.log("mic enabled false"),Nl(),i.value=!1,n.value="Turn on mic")},s=()=>{e.elevenLabs?(console.log("closeConversation 11 labs"),wl(),wn.value="none",i.value=!1):(console.log("closeConversation"),Nl(),mo(),wn.value="none",i.value=!1)},a=async()=>{var c,u,l,g,h,p,C,I;try{const E={question:Ta.value||iC.value};e.conversations.push(E),e.dotLoader=!0,e.question="";const v={past_messages:e.past_messages,question:Ta.value||iC.value,skillId:e.simulationSkill,bandCode:e.band_code,userGenomeFunction:e.genomeFunctionValue,userGenomeRole:e.genomeRoleValue},m=await si("/sqlTest",v);if(wn.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 M=await si("/sqlTest",v);e.addConversation((l=M.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 iZ(r.value.replace(/[*#]/g,""));else if(r.value.includes("Feedback and Assessment")){Nl();const M={pastAudioAnalysis:e.audioAnaysis,finalAnalysis:!0},O=await Xt.post("/fetchPdfAssessment",M,{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 x=r.value.split("END ROLE PLAY")[0];if(x.length<0){e.showVoiceComponent=!1;return}await yF(x.replace(/[*#]/g,"")),e.showVoiceComponent=!1}else e.showVoiceComponent=!1}else await yF(r.value.replace(/[*#]/g,""))}catch(E){if(console.error(E),Xt.isAxiosError(E)){const v=E;console.log("Error found!"),console.error((C=v.response)==null?void 0:C.data),A.setError(((I=v.response)==null?void 0:I.data).message)}else A.setError("There was an issue, please contact helpmate")}};return oo(Ta,async c=>{if(c){if(console.log("Recognized text:",c),Ta.value.toLowerCase().includes("play")&&Ta.value.length<10){console.log("play command detected, ignoring input");return}wn.value="listening",e.userspeaking=!1,await a(),Ta.value=""}}),oo(iC,async c=>{c&&(console.log("Recognized text:",c),wn.value="listening",await a(),iC.value="")}),(c,u)=>(ue(),ge("div",Vee,[fe(wn)==="bot"?(ue(),ge("div",Wee,[S("span",null,[(ue(),ge("svg",Zee,Xee))])])):fe(wn)==="user"?(ue(),ge("div",_ee,[S("span",null,[(ue(),ge("svg",$ee,ete))])])):fe(wn)==="listening"?(ue(),ge("div",tte,Ate)):Dt("",!0),S("div",{class:mt([i.value?"":"animate-pulse","tooltip"])},[S("span",rte,bt(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())},ite)):(ue(),ge("button",{key:1,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[1]||(u[1]=l=>o())},nte))],2),S("button",{class:"rounded-full bg-white p-2 hover:bg-gray-300",onClick:u[2]||(u[2]=l=>s())},[ot(fe(d4),{class:"h-[10px] w-[10px] text-gray-700"})])]))}}),La=t=>(xr("data-v-9ec493aa"),t=t(),Nr(),t),ote={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},ate={class:"py-2"},cte={class:"flex"},ute={class:"z-1 relative w-full"},lte={class:"flex justify-between my-2 w-full"},hte=La(()=>S("div",null,null,-1)),gte={key:0,class:"flex justify-center bg-genpact-darkest-blue px-4 rounded-full"},dte={class:"relative w-full"},pte={class:"absolute inset-y-0 left-0 flex items-center pl-3"},fte={class:"tooltip"},Ete=La(()=>S("span",{class:"tooltiptext text-genpact-darkest-teal"},"Restart",-1)),Cte=[La(()=>S("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)),La(()=>S("path",{d:"M9 10H15M9 14H12M19 8V2M16 5H22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1))],Ite={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},Bte={key:0},vte=["disabled"],wte=[La(()=>S("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))],Ste={key:1,class:"tooltip"},mte=[La(()=>S("span",{class:"tooltiptext text-genpact-darkest-teal"},"Processing",-1)),La(()=>S("img",{class:"w-7 h-7",src:$S,alt:"watingIcon"},null,-1))],Mte={class:"flex justify-start gap-2 md:gap-1"},yte=["disabled"],Qte=La(()=>S("div",{class:"pt-1 text-start font-sans text-xs font-bold text-gray-500 md:text-sm"},[S("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),Rte=Zt({__name:"NewQuestionSimulation",setup(t,{expose:e}){const A=dA(),r=kr(),i=ne(""),n=ne("");A.question="";const o=ne(null),s=ne(!1),a=ne(0);n.value=A.recognizedText,sn(()=>{o.value.focus()});const c=()=>{window.location.reload()},u=async()=>{var h,p,C,I,E,v,m,M,O,x,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 q={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 si("/sqlTest",q);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=(I=(C=Q.data)==null?void 0:C.body)==null?void 0:I.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 si("/sqlTest",q);A.addConversation((m=G.data)==null?void 0:m.body,"new")}else console.log("in the else case"),A.addConversation((M=Q.data)==null?void 0:M.body,"new");s.value=!1,A.dotLoader=!1,A.recognizedText=""}catch(D){if(console.error(D),A.dotLoader=!1,s.value=!1,Xt.isAxiosError(D)){const T=D;console.log("Error found!"),console.error((O=T.response)==null?void 0:O.data),r.setError((P=(x=T.response)==null?void 0:x.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",ote,[S("div",ate,[S("div",cte,[S("div",ute,[S("div",lte,[hte,fe(A).showVoiceComponent?(ue(),ge("div",gte,[ot(ste)])):Dt("",!0)]),S("div",dte,[S("div",pte,[S("div",fte,[Ete,(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"},Cte))])]),S("div",Ite,[s.value?(ue(),ge("div",Ste,mte)):(ue(),ge("div",Bte,[(ue(),ge("svg",{disabled:fe(A).beginFlag===!0,class:mt([fe(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=>fe(A).searchBoxdisable===!1||fe(A).beginFlag===!0?"":u()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},wte,10,vte))]))]),S("div",Mte,[tA(S("textarea",{onPaste:p[1]||(p[1]=IS(()=>{},["prevent"])),onKeydown:p[2]||(p[2]=C=>s.value?"":l(C)),disabled:fe(A).searchBoxdisable===!1||fe(A).beginFlag===!0,"onUpdate:modelValue":p[3]||(p[3]=C=>fe(A).question=C),class:mt(["fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] px-[70px]",fe(A).beginFlag===!0||fe(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,yte),[[bA,fe(A).question]])])]),Qte])])])]))}}),IRe="",Dte=SA(Rte,[["__scopeId","data-v-9ec493aa"]]),TI=t=>(xr("data-v-6c0980b5"),t=t(),Nr(),t),Tte={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},Ute={class:"py-2"},Lte={class:"flex"},Fte={class:"z-1 relative w-full"},Ote={class:"relative w-full"},bte={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},xte={key:0},Nte=["disabled"],Kte=[TI(()=>S("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))],kte={key:1,class:"tooltip"},Pte=[TI(()=>S("span",{class:"tooltiptext fontFormattingAMA"},"Waiting for response",-1)),TI(()=>S("img",{class:"w-7 h-7",src:$S,alt:"watingIcon"},null,-1))],Gte={class:"flex justify-start gap-2 md:gap-1"},jte=["disabled"],Yte=TI(()=>S("div",{class:"pt-1 text-start font-sans text-[0.8125rem] md:text-[0.9375rem] font-bold text-gray-500"},[S("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),Hte=Zt({__name:"NewMDMQuestionSimulation",setup(t){const e=dA(),A=kr(),r=ne("");e.question="";const i=ne(null),n=ne(!1),o=ne(ho),s=ne(!1);r.value=e.recognizedText,sn(()=>{i.value.focus()});const a=u=>{const l=u.length;o.value=ho-l,n.value=l>=ho},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 I;Ks==="prod"?I="/ManualExportActivity":I="/fetchCompletionDemo";const E=await si(I,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),Xt.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",Tte,[S("div",Ute,[S("div",Lte,[S("div",Fte,[S("div",Ote,[S("div",bte,[s.value?(ue(),ge("div",kte,Pte)):(ue(),ge("div",xte,[(ue(),ge("svg",{disabled:fe(e).beginFlag===!0,class:mt([fe(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=>fe(e).searchBoxdisable===!1||fe(e).beginFlag===!0?"":c()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},Kte,10,Nte))]))]),S("div",Gte,[tA(S("input",{onKeyup:[l[1]||(l[1]=eT(g=>s.value?"":c(),["enter"])),l[3]||(l[3]=g=>a(fe(e).question))],disabled:fe(e).beginFlag===!0||fe(e).searchBoxdisable===!1,class:mt([fe(e).beginFlag===!0||fe(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=>fe(e).question=g),placeholder:"Write your answer here...",type:"text",ref_key:"AiSearch",ref:i},null,42,jte),[[bA,fe(e).question]])])]),Yte])])])]))}}),SRe="",zte=SA(Hte,[["__scopeId","data-v-6c0980b5"]]),Jte={},qte={class:"flex min-h-screen justify-center -mt-16"},Vte=[S("div",{class:"flex items-center justify-center"},[S("img",{class:"loadercss",src:go,alt:"Loader Gif"})],-1)];function Wte(t,e){return ue(),ge("div",qte,Vte)}const RF=SA(Jte,[["render",Wte]]);function BA(t){return BA=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},BA(t)}var fs=Uint8Array,Sn=Uint16Array,$0=Int32Array,em=new fs([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]),tm=new fs([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 fs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),TF=function(t,e){for(var A=new Sn(31),r=0;r<31;++r)A[r]=e+=1<<t[r-1];for(var i=new $0(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}},UF=TF(em,2),Zte=UF.b,Am=UF.r;Zte[28]=258,Am[258]=28;for(var Xte=TF(tm,0),LF=Xte.r,rm=new Sn(32768),YA=0;YA<32768;++YA){var Fa=(YA&43690)>>1|(YA&21845)<<1;Fa=(Fa&52428)>>2|(Fa&13107)<<2,Fa=(Fa&61680)>>4|(Fa&3855)<<4,rm[YA]=((Fa&65280)>>8|(Fa&255)<<8)>>1}for(var pp=function(t,e,A){for(var r=t.length,i=0,n=new Sn(e);i<r;++i)t[i]&&++n[t[i]-1];var o=new Sn(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var s;if(A){s=new Sn(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[rm[l]>>a]=c}else for(s=new Sn(r),i=0;i<r;++i)t[i]&&(s[i]=rm[o[t[i]-1]++]>>15-t[i]);return s},$c=new fs(288),YA=0;YA<144;++YA)$c[YA]=8;for(var YA=144;YA<256;++YA)$c[YA]=9;for(var YA=256;YA<280;++YA)$c[YA]=7;for(var YA=280;YA<288;++YA)$c[YA]=8;for(var UI=new fs(32),YA=0;YA<32;++YA)UI[YA]=5;var _te=pp($c,9,0),$te=pp(UI,5,0),FF=function(t){return(t+7)/8|0},eAe=function(t,e,A){return(e==null||e<0)&&(e=0),(A==null||A>t.length)&&(A=t.length),new fs(t.subarray(e,A))},Mo=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8},fp=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},im=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:NF,l:0};if(i==1){var o=new fs(A[0].s+1);return o[A[0].s]=1,{t:o,l:1}}A.sort(function(O,x){return O.f-x.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 Sn(g+1),p=nm(A[u-1],h,0);if(p>e){var r=0,C=0,I=p-e,E=1<<I;for(n.sort(function(x,P){return h[P.s]-h[x.s]||x.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>>=I;C>0;){var m=n[r].s;h[m]<e?C-=1<<e-h[m]++-1:++r}for(;r>=0&&C;--r){var M=n[r].s;h[M]==e&&(--h[M],++C)}p=e}return{t:new fs(h),l:p}},nm=function(t,e,A){return t.s==-1?Math.max(nm(t.l,e,A+1),nm(t.r,e,A+1)):e[t.s]=A},OF=function(t){for(var e=t.length;e&&!t[--e];);for(var A=new Sn(++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}},Ep=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=FF(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},xF=function(t,e,A,r,i,n,o,s,a,c,u){Mo(e,u++,A),++i[256];for(var l=im(i,15),g=l.t,h=l.l,p=im(n,15),C=p.t,I=p.l,E=OF(g),v=E.c,m=E.n,M=OF(C),O=M.c,x=M.n,P=new Sn(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=im(P,7),q=T.t,Q=T.l,R=19;R>4&&!q[DF[R-1]];--R);var G=c+5<<3,k=Ep(i,$c)+Ep(n,UI)+o,te=Ep(i,g)+Ep(n,C)+o+14+3*R+Ep(P,q)+2*P[16]+3*P[17]+7*P[18];if(a>=0&&G<=k&&G<=te)return bF(e,u,t.subarray(a,a+c));var X,ie,W,se;if(Mo(e,u,1+(te<k)),u+=2,te<k){X=pp(g,h,0),ie=g,W=pp(C,I,0),se=C;var Be=pp(q,Q,0);Mo(e,u,m-257),Mo(e,u+5,x-1),Mo(e,u+10,R-4),u+=14;for(var D=0;D<R;++D)Mo(e,u+3*D,q[DF[D]]);u+=3*R;for(var Ee=[v,O],U=0;U<2;++U)for(var Y=Ee[U],D=0;D<Y.length;++D){var _=Y[D]&31;Mo(e,u,Be[_]),u+=q[_],_>15&&(Mo(e,u,Y[D]>>5&127),u+=Y[D]>>12)}}else X=_te,ie=$c,W=$te,se=UI;for(var D=0;D<s;++D){var re=r[D];if(re>255){var _=re>>18&31;fp(e,u,X[_+257]),u+=ie[_+257],_>7&&(Mo(e,u,re>>23&31),u+=em[_]);var ae=re&31;fp(e,u,W[ae]),u+=se[ae],ae>3&&(fp(e,u,re>>5&8191),u+=tm[ae])}else fp(e,u,X[re]),u+=ie[re]}return fp(e,u,X[256]),u+ie[256]},tAe=new $0([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),NF=new fs(0),AAe=function(t,e,A,r,i,n){var o=n.z||t.length,s=new fs(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=tAe[e-1],g=l>>13,h=l&8191,p=(1<<A)-1,C=n.p||new Sn(32768),I=n.h||new Sn(p+1),E=Math.ceil(A/3),v=2*E,m=function(z){return(t[z]^t[z+1]<<E^t[z+2]<<v)&p},M=new $0(25e3),O=new Sn(288),x=new Sn(32),P=0,D=0,T=n.i||0,q=0,Q=n.w||0,R=0;T+2<o;++T){var G=m(T),k=T&32767,te=I[G];if(C[k]=te,I[G]=k,Q<=T){var X=o-T;if((P>7e3||q>24576)&&(X>423||!c)){u=xF(t,a,0,M,O,x,D,q,R,T-R,u),q=P=D=0,R=T;for(var ie=0;ie<286;++ie)O[ie]=0;for(var ie=0;ie<30;++ie)x[ie]=0}var W=2,se=0,Be=h,Ee=k-te&32767;if(X>2&&G==m(T-Ee))for(var U=Math.min(g,X)-1,Y=Math.min(32767,T),_=Math.min(258,X);Ee<=Y&&--Be&&k!=te;){if(t[T+W]==t[T+W-Ee]){for(var re=0;re<_&&t[T+re]==t[T+re-Ee];++re);if(re>W){if(W=re,se=Ee,re>U)break;for(var ae=Math.min(Ee,re-2),Z=0,ie=0;ie<ae;++ie){var ce=T-Ee+ie&32767,oe=C[ce],de=ce-oe&32767;de>Z&&(Z=de,te=ce)}}}k=te,te=C[k],Ee+=k-te&32767}if(se){M[q++]=268435456|Am[W]<<18|LF[se];var De=Am[W]&31,j=LF[se]&31;D+=em[De]+tm[j],++O[257+De],++x[j],Q=T+W,++P}else M[q++]=t[T],++O[t[T]]}}for(T=Math.max(T,Q);T<o;++T)M[q++]=t[T],++O[t[T]];u=xF(t,a,c,M,O,x,D,q,R,T-R,u),c||(n.r=u&7|a[u/8|0]<<3,u-=7,n.h=I,n.p=C,n.i=T,n.w=Q)}else{for(var T=n.w||0;T<o+c;T+=65535){var J=T+65535;J>=o&&(a[u/8|0]=c,J=o),u=bF(a,u+1,t.subarray(T,J))}n.i=o}return eAe(s,0,r+FF(u)+i)},KF=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}}},rAe=function(t,e,A,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new fs(n.length+t.length);o.set(n),o.set(t,n.length),t=o,i.w=n.length}return AAe(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)},kF=function(t,e,A){for(;A;++e)t[e]=A,A>>>=8},iAe=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=KF();i.p(e.dictionary),kF(t,2,i.d())}};function sm(t,e){e||(e={});var A=KF();A.p(t);var r=rAe(t,e,e.dictionary?6:2,4);return iAe(r,e),kF(r,r.length-4,A.d()),r}var nAe=typeof TextDecoder<"u"&&new TextDecoder,sAe=0;try{nAe.decode(NF,{stream:!0}),sAe=1}catch{}function oAe(t){if(Array.isArray(t))return t}function aAe(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 PF(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 cAe(t,e){if(t){if(typeof t=="string")return PF(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)?PF(t,e):void 0}}function uAe(){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 op.SynthesisAdapterBase=i,i.telemetryDataEnabled=!0,op}var ap={},lF;function Tee(){if(lF)return ap;lF=1,Object.defineProperty(ap,"__esModule",{value:!0}),ap.AvatarSynthesisAdapter=void 0;const t=Ve(),e=ut();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,I,E,v,m,M;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=(I=(C=this.privAvatarConfig.videoFormat)==null?void 0:C.cropRange)==null?void 0:I.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:(M=this.privAvatarConfig.backgroundImage)==null?void 0:M.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 ap.AvatarSynthesisAdapter=A,ap}var cp={},hF;function Uee(){if(hF)return cp;hF=1,Object.defineProperty(cp,"__esModule",{value:!0}),cp.SpeechSynthesisAdapter=void 0;const t=Ve(),e=ut();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 cp.SpeechSynthesisAdapter=A,cp}var up={},gF;function Lee(){if(gF)return up;gF=1,Object.defineProperty(up,"__esModule",{value:!0}),up.SynthesisRestAdapter=void 0;const t=Zr(),e=Ve(),A=ps(),r=Wr;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 up.SynthesisRestAdapter=i,up}var Z0={},dF;function Fee(){return dF||(dF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SynthesizerConfig=t.SynthesisServiceType=void 0;const e=ut();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}(Z0)),Z0}var lp={},pF;function Oee(){if(pF)return lp;pF=1,Object.defineProperty(lp,"__esModule",{value:!0}),lp.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 lp.SynthesisContext=e,lp}var hp={},fF;function bee(){if(fF)return hp;fF=1,Object.defineProperty(hp,"__esModule",{value:!0}),hp.SpeakerRecognitionConfig=void 0;const t=ut();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 hp.SpeakerRecognitionConfig=e,hp}var gp={},EF;function xee(){if(EF)return gp;EF=1,Object.defineProperty(gp,"__esModule",{value:!0}),gp.SpeakerServiceRecognizer=void 0;const t=Zr(),e=Mt(),A=Ve(),r=ut(),i=Co;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(I){this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.ConnectionFailure,I)}const p=new A.SessionEventArgs(this.privRequestSession.sessionId);return this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,p),this.receiveMessage(),this.sendAudio(h).then(()=>{},I=>{this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,A.CancellationReason.Error,A.CancellationErrorCode.RuntimeError,I)}),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 gp.SpeakerServiceRecognizer=n,gp}var dp={},CF;function Nee(){if(CF)return dp;CF=1,Object.defineProperty(dp,"__esModule",{value:!0}),dp.VoiceServiceRecognizer=void 0;const t=Zr(),e=Mt(),A=Ve(),r=ut(),i=Co;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 dp.VoiceServiceRecognizer=n,dp}var IF={};(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={}))})(IF);var BF;function ut(){return BF||(BF=1,function(t){var e=xt&&xt.__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=xt&&xt.__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(aC,t),A(UC,t),A(Ml,t),A(a2,t),A(c2,t),A(M$(),t),A(y$(),t),A(oI,t),A(Q$(),t),A(R$(),t),A(D$(),t),A(ML,t),A(aI,t),A(U$(),t),A(L$(),t),A(F$(),t),A(O$(),t),A(rL(),t),A(b$(),t),A(LL,t),A(x$(),t),A(cI,t),A(K$(),t),A(k$(),t),A(lI,t),A(hI,t),A(gI,t),A(P$(),t),A(G$(),t),A(j$(),t),A(Y$(),t),A(H$(),t),A(dI,t),A(J$(),t),A(pI,t),A(HL,t),A(fI,t),A(II,t),A(BI,t),A(see(),t),A(SI,t),A(mee(),t),A(W0,t),A(Ree(),t),A(Dee(),t);var r=Tee();Object.defineProperty(t,"AvatarSynthesisAdapter",{enumerable:!0,get:function(){return r.AvatarSynthesisAdapter}});var i=Uee();Object.defineProperty(t,"SpeechSynthesisAdapter",{enumerable:!0,get:function(){return i.SpeechSynthesisAdapter}}),A(Lee(),t),A(Fee(),t),A(Oee(),t),A(bee(),t),A(xee(),t),A(Nee(),t),A(IF,t),t.OutputFormatPropertyName="OutputFormat",t.CancellationErrorCodePropertyName="CancellationErrorCode",t.ServicePropertiesPropertyName="ServiceProperties",t.ForceDictationPropertyName="ForceDictation",t.AutoDetectSourceLanguagesOpenRangeOptionName="UND"}(t0)),t0}(function(t){var e=xt&&xt.__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=xt&&xt.__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=ut();new r.AgentConfig,A(Ve(),t)})(Ps);const hi=[];for(let t=0;t<256;++t)hi.push((t+256).toString(16).slice(1));function Kee(t,e=0){return(hi[t[e+0]]+hi[t[e+1]]+hi[t[e+2]]+hi[t[e+3]]+"-"+hi[t[e+4]]+hi[t[e+5]]+"-"+hi[t[e+6]]+hi[t[e+7]]+"-"+hi[t[e+8]]+hi[t[e+9]]+"-"+hi[t[e+10]]+hi[t[e+11]]+hi[t[e+12]]+hi[t[e+13]]+hi[t[e+14]]+hi[t[e+15]]).toLowerCase()}let X0;const kee=new Uint8Array(16);function Pee(){if(!X0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");X0=crypto.getRandomValues.bind(crypto)}return X0(kee)}const vF={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Gee(t,e,A){var i;if(vF.randomUUID&&!e&&!t)return vF.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??Pee();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 Kee(r)}const Fl=kr(),wo=dA(),Ol=ne(""),_c=ne(""),Ta=ne(""),wn=ne("");let So=null,_0=[];const wF=ne("");let Ua=null;const SF=4e3;sn(async()=>{wo.authToken=await DI()});let gr=null,bl=null,js=null,RI=null,xl=null;const mF="/src/assets/ffmpeg",mo=()=>{js&&js.mute(),gr&&(gr.close(),gr=null),bl=null},DI=async()=>{var t,e,A;try{const r=await jn("/voiceTesting");return(t=r==null?void 0:r.data)==null?void 0:t.token}catch(r){if(console.error(r),Xt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Fl.setError(((A=i.response)==null?void 0:A.data).message)}else Fl.setError("There was an issue while fetching data")}},Nl=()=>{Ua&&clearTimeout(Ua),RI&&(RI.stopContinuousRecognitionAsync(()=>{},t=>{console.error("Error stopping recognition",t)}),RI=null),So&&So.state!=="inactive"&&So.stop()},jee=async t=>(wo.authToken=await DI(),await mo(),new Promise((e,A)=>{const r=Ps.SpeechConfig.fromAuthorizationToken(wo.authToken,"eastus2");r.speechSynthesisVoiceName="en-US-EmmaMultilingualNeural",js=new Ps.SpeakerAudioDestination;const i=Ps.AudioConfig.fromSpeakerOutput(js);gr=new Ps.SpeechSynthesizer(r,i);const n=Gee();bl=n,gr.speakTextAsync(t,o=>{if(n!==bl)return js==null||js.mute(),gr==null||gr.close(),gr=null,e();o.reason===Ps.ResultReason.SynthesizingAudioCompleted?e():A(new Error("Speech synthesis failed")),gr==null||gr.close(),gr=null,bl=null},o=>{if(n!==bl)return js==null||js.mute(),gr==null||gr.close(),gr=null,e();gr==null||gr.close(),gr=null,bl=null,A(o)})})),Yee=async t=>{wo.authToken=await DI();const e=Ps.SpeechConfig.fromAuthorizationToken(wo.authToken,"eastus2");e.speechRecognitionLanguage="en-US";const A=Ps.AudioConfig.fromDefaultMicrophoneInput(),r=new Ps.SpeechRecognizer(e,A);return RI=r,Ol.value="",_c.value="",await QF(),r.recognizing=(i,n)=>{n.result.text&&n.result.text.trim()&&(Ol.value=n.result.text.trim(),mo(),wo.userspeaking=!0,wo.userSpeechText=(_c.value?_c.value+" ":"")+Ol.value,wn.value="user",Ua&&clearTimeout(Ua),Ua=setTimeout(()=>{Ol.value&&(t(Ol.value.trim()),Ol.value="")},SF))},r.recognized=async(i,n)=>{n.result.reason===Ps.ResultReason.RecognizedSpeech&&n.result.text&&n.result.text.trim()&&(_c.value+=" "+n.result.text.trim(),Ua&&clearTimeout(Ua),Ua=setTimeout(async()=>{_c.value&&(t(_c.value),console.log("Audio stop recording"),_c.value="")},SF))},r.canceled=async(i,n)=>{console.error("Recognition canceled:",n),console.log("Audio stop recording")},r.startContinuousRecognitionAsync(),r},MF=async()=>{var t,e;Ta.value="",wF.value="";try{mo(),await Yee(async A=>{if(A){console.log("triggering Audio sentiment:");const r=await Hee();console.log("Audio sentiment:",r),Ta.value=A;const i=QF()}})}catch(A){if(console.error(A),Xt.isAxiosError(A)){const r=A;console.log("Error found!"),console.error((t=r.response)==null?void 0:t.data),Fl.setError(((e=r.response)==null?void 0:e.data).message)}else Fl.setError("There was an issue while fetching data")}},yF=async t=>{var e,A;wF.value="";try{(wn.value=="user"||wn.value=="listening")&&mo(),await jee(t)}catch(r){if(console.error(r),Xt.isAxiosError(r)){const i=r;console.log("Error found!"),console.error((e=i.response)==null?void 0:e.data),Fl.setError(((A=i.response)==null?void 0:A.data).message)}else Fl.setError("There was an issue while fetching data")}};async function QF(){try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});So=new MediaRecorder(t,{mimeType:"audio/webm"}),So.ondataavailable=e=>{e.data.size>0&&_0.push(e.data)},So.start(),console.log("Audio recording started")}catch(t){console.error("Error starting audio recording:",t)}}async function Hee(){return new Promise((t,e)=>{if(!So)return e("No active recorder found");So.onstop=async()=>{var r,i,n;const A=new Blob(_0,{type:"audio/webm"});_0=[];try{console.log("Sending audio for analysis...");const o=await zee(A);console.log("Converting WebM to MP3...",o);const a={audio:await qee(o),format:"mp3",finalAnalysis:!1};console.log("Payload for analysis:",a);const c=await Xt.post("/fetchPdfAssessment",a,{headers:{"Content-Type":"application/json"}});console.log("Server response:",(r=c==null?void 0:c.data)==null?void 0:r.body),wo.audioAnaysis.push((n=(i=c==null?void 0:c.data)==null?void 0:i.body)==null?void 0:n.answer),console.log("store audioAnaysis",wo.audioAnaysis),console.log("Audio analysis result:",c.data),t(c.data)}catch(o){e(o)}},So.stop(),console.log("Audio recording stopped")})}async function zee(t){try{console.log("⏳ Initializing FFmpeg...");const e=await Jee();console.log("✅ FFmpeg loaded");const A=await gZ(t);e.writeFile("input.webm",A),await e.exec(["-i","input.webm","-vn","-acodec","libmp3lame","-ar","16000","-ac","1","-ab","32k","output.mp3"]),console.log("Conversion complete");const r=await e.readFile("output.mp3");return await e.deleteFile("input.webm"),await e.deleteFile("output.mp3"),new Blob([r],{type:"audio/mpeg"})}catch(e){throw console.error("❌ Error:",e),e}}async function Jee(){if(xl!=null&&xl.loaded)return xl;const t=xl||new aZ;return t.on("log",({message:e})=>{console.log(e)}),await t.load({coreURL:await R4(`${mF}/ffmpeg-core.js`,"text/javascript"),wasmURL:await R4(`${mF}/ffmpeg-core.wasm`,"application/wasm")}),xl=t,t}const qee=t=>new Promise((e,A)=>{const r=new FileReader;r.onloadend=()=>{const i=r.result.split(",")[1];e(i)},r.onerror=A,r.readAsDataURL(t)}),Vee={class:"flex items-center gap-4 py-2 rounded-full z-10"},Wee={key:0,class:"flex items-center"},Zee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},Xee=[sl('<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)],_ee={key:1,class:"flex items-center"},$ee={width:"30",height:"30",viewBox:"0 0 36 24",class:"fill-white",style:{transform:"scaleX(-1)"}},ete=[sl('<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)],tte={key:2,class:"flex items-center"},Ate=[sl('<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)],rte={class:"tooltiptext text-genpact-darkest-teal"},ite=[S("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[S("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)],nte=[S("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-[10px] w-[10px] text-gray-700",fill:"currentColor",viewBox:"0 0 24 24"},[S("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"}),S("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor","stroke-width":"2"})],-1)],ste=Zt({__name:"NewVoiceConversation",setup(t){const e=dA(),A=kr(),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,oC(),wn.value="user",n.value="Turn off mic"):(console.log("mic enabled true"),i.value=!0,mo(),MF(),wn.value="user",n.value="Turn off mic"):e.elevenLabs?(console.log("mic enabled false"),wl(),i.value=!1,n.value="Turn on mic"):(console.log("mic enabled false"),Nl(),i.value=!1,n.value="Turn on mic")},s=()=>{e.elevenLabs?(console.log("closeConversation 11 labs"),wl(),wn.value="none",i.value=!1):(console.log("closeConversation"),Nl(),mo(),wn.value="none",i.value=!1)},a=async()=>{var c,u,l,g,h,p,C,I;try{const E={question:Ta.value||iC.value};e.conversations.push(E),e.dotLoader=!0,e.question="";const v={past_messages:e.past_messages,question:Ta.value||iC.value,skillId:e.simulationSkill,bandCode:e.band_code,userGenomeFunction:e.genomeFunctionValue,userGenomeRole:e.genomeRoleValue},m=await si("/sqlTest",v);if(wn.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 M=await si("/sqlTest",v);e.addConversation((l=M.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 iZ(r.value.replace(/[*#]/g,""));else if(r.value.includes("Feedback and Assessment")){Nl();const M={pastAudioAnalysis:e.audioAnaysis,finalAnalysis:!0},O=await Xt.post("/fetchPdfAssessment",M,{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 x=r.value.split("END ROLE PLAY")[0];if(x.length<0){e.showVoiceComponent=!1;return}await yF(x.replace(/[*#]/g,"")),e.showVoiceComponent=!1}else e.showVoiceComponent=!1}else await yF(r.value.replace(/[*#]/g,""))}catch(E){if(console.error(E),Xt.isAxiosError(E)){const v=E;console.log("Error found!"),console.error((C=v.response)==null?void 0:C.data),A.setError(((I=v.response)==null?void 0:I.data).message)}else A.setError("There was an issue, please contact helpmate")}};return oo(Ta,async c=>{if(c){if(console.log("Recognized text:",c),Ta.value.toLowerCase().includes("play")&&Ta.value.length<10){console.log("play command detected, ignoring input");return}wn.value="listening",e.userspeaking=!1,await a(),Ta.value=""}}),oo(iC,async c=>{c&&(console.log("Recognized text:",c),wn.value="listening",await a(),iC.value="")}),(c,u)=>(ue(),ge("div",Vee,[fe(wn)==="bot"?(ue(),ge("div",Wee,[S("span",null,[(ue(),ge("svg",Zee,Xee))])])):fe(wn)==="user"?(ue(),ge("div",_ee,[S("span",null,[(ue(),ge("svg",$ee,ete))])])):fe(wn)==="listening"?(ue(),ge("div",tte,Ate)):Dt("",!0),S("div",{class:mt([i.value?"":"animate-pulse","tooltip"])},[S("span",rte,bt(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())},ite)):(ue(),ge("button",{key:1,class:"rounded-full bg-white p-2 transition hover:bg-gray-300",onClick:u[1]||(u[1]=l=>o())},nte))],2),S("button",{class:"rounded-full bg-white p-2 hover:bg-gray-300",onClick:u[2]||(u[2]=l=>s())},[ot(fe(d4),{class:"h-[10px] w-[10px] text-gray-700"})])]))}}),La=t=>(xr("data-v-9ec493aa"),t=t(),Nr(),t),ote={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},ate={class:"py-2"},cte={class:"flex"},ute={class:"z-1 relative w-full"},lte={class:"flex justify-between my-2 w-full"},hte=La(()=>S("div",null,null,-1)),gte={key:0,class:"flex justify-center bg-genpact-darkest-blue px-4 rounded-full"},dte={class:"relative w-full"},pte={class:"absolute inset-y-0 left-0 flex items-center pl-3"},fte={class:"tooltip"},Ete=La(()=>S("span",{class:"tooltiptext text-genpact-darkest-teal"},"Restart",-1)),Cte=[La(()=>S("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)),La(()=>S("path",{d:"M9 10H15M9 14H12M19 8V2M16 5H22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1))],Ite={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},Bte={key:0},vte=["disabled"],wte=[La(()=>S("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))],Ste={key:1,class:"tooltip"},mte=[La(()=>S("span",{class:"tooltiptext text-genpact-darkest-teal"},"Processing",-1)),La(()=>S("img",{class:"w-7 h-7",src:$S,alt:"watingIcon"},null,-1))],Mte={class:"flex justify-start gap-2 md:gap-1"},yte=["disabled"],Qte=La(()=>S("div",{class:"pt-1 text-start font-sans text-xs font-bold text-gray-500 md:text-sm"},[S("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),Rte=Zt({__name:"NewQuestionSimulation",setup(t,{expose:e}){const A=dA(),r=kr(),i=ne(""),n=ne("");A.question="";const o=ne(null),s=ne(!1),a=ne(0);n.value=A.recognizedText,sn(()=>{o.value.focus()});const c=()=>{window.location.reload()},u=async()=>{var h,p,C,I,E,v,m,M,O,x,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 q={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 si("/sqlTest",q);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=(I=(C=Q.data)==null?void 0:C.body)==null?void 0:I.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 si("/sqlTest",q);A.addConversation((m=G.data)==null?void 0:m.body,"new")}else console.log("in the else case"),A.addConversation((M=Q.data)==null?void 0:M.body,"new");s.value=!1,A.dotLoader=!1,A.recognizedText=""}catch(D){if(console.error(D),A.dotLoader=!1,s.value=!1,Xt.isAxiosError(D)){const T=D;console.log("Error found!"),console.error((O=T.response)==null?void 0:O.data),r.setError((P=(x=T.response)==null?void 0:x.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",ote,[S("div",ate,[S("div",cte,[S("div",ute,[S("div",lte,[hte,fe(A).showVoiceComponent?(ue(),ge("div",gte,[ot(ste)])):Dt("",!0)]),S("div",dte,[S("div",pte,[S("div",fte,[Ete,(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"},Cte))])]),S("div",Ite,[s.value?(ue(),ge("div",Ste,mte)):(ue(),ge("div",Bte,[(ue(),ge("svg",{disabled:fe(A).beginFlag===!0,class:mt([fe(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=>fe(A).searchBoxdisable===!1||fe(A).beginFlag===!0?"":u()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},wte,10,vte))]))]),S("div",Mte,[tA(S("textarea",{onPaste:p[1]||(p[1]=IS(()=>{},["prevent"])),onKeydown:p[2]||(p[2]=C=>s.value?"":l(C)),disabled:fe(A).searchBoxdisable===!1||fe(A).beginFlag===!0,"onUpdate:modelValue":p[3]||(p[3]=C=>fe(A).question=C),class:mt(["fontFormattingAMA rounded-lg flex w-full border border-genpact-darkest-teal py-[18px] px-[70px]",fe(A).beginFlag===!0||fe(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,yte),[[bA,fe(A).question]])])]),Qte])])])]))}}),IRe="",Dte=SA(Rte,[["__scopeId","data-v-9ec493aa"]]),TI=t=>(xr("data-v-6c0980b5"),t=t(),Nr(),t),Tte={class:"z-3 absolute bottom-0 mt-4 w-full bg-white px-2 md:px-6"},Ute={class:"py-2"},Lte={class:"flex"},Fte={class:"z-1 relative w-full"},Ote={class:"relative w-full"},bte={class:"absolute inset-y-0 right-0 flex items-center md:pr-8 pr-3"},xte={key:0},Nte=["disabled"],Kte=[TI(()=>S("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))],kte={key:1,class:"tooltip"},Pte=[TI(()=>S("span",{class:"tooltiptext fontFormattingAMA"},"Waiting for response",-1)),TI(()=>S("img",{class:"w-7 h-7",src:$S,alt:"watingIcon"},null,-1))],Gte={class:"flex justify-start gap-2 md:gap-1"},jte=["disabled"],Yte=TI(()=>S("div",{class:"pt-1 text-start font-sans text-[0.8125rem] md:text-[0.9375rem] font-bold text-gray-500"},[S("div",null," Note: AI-generated response may not be fully accurate; check with experts for critical information. ")],-1)),Hte=Zt({__name:"NewMDMQuestionSimulation",setup(t){const e=dA(),A=kr(),r=ne("");e.question="";const i=ne(null),n=ne(!1),o=ne(ho),s=ne(!1);r.value=e.recognizedText,sn(()=>{i.value.focus()});const a=u=>{const l=u.length;o.value=ho-l,n.value=l>=ho},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 I;Ks==="prod"?I="/ManualExportActivity":I="/fetchCompletionDemo";const E=await si(I,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),Xt.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",Tte,[S("div",Ute,[S("div",Lte,[S("div",Fte,[S("div",Ote,[S("div",bte,[s.value?(ue(),ge("div",kte,Pte)):(ue(),ge("div",xte,[(ue(),ge("svg",{disabled:fe(e).beginFlag===!0,class:mt([fe(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=>fe(e).searchBoxdisable===!1||fe(e).beginFlag===!0?"":c()),xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"},Kte,10,Nte))]))]),S("div",Gte,[tA(S("input",{onKeyup:[l[1]||(l[1]=eT(g=>s.value?"":c(),["enter"])),l[3]||(l[3]=g=>a(fe(e).question))],disabled:fe(e).beginFlag===!0||fe(e).searchBoxdisable===!1,class:mt([fe(e).beginFlag===!0||fe(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=>fe(e).question=g),placeholder:"Write your answer here...",type:"text",ref_key:"AiSearch",ref:i},null,42,jte),[[bA,fe(e).question]])])]),Yte])])])]))}}),SRe="",zte=SA(Hte,[["__scopeId","data-v-6c0980b5"]]),Jte={},qte={class:"flex min-h-screen justify-center -mt-16"},Vte=[S("div",{class:"flex items-center justify-center"},[S("img",{class:"loadercss",src:go,alt:"Loader Gif"})],-1)];function Wte(t,e){return ue(),ge("div",qte,Vte)}const RF=SA(Jte,[["render",Wte]]);function BA(t){return BA=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},BA(t)}var fs=Uint8Array,Sn=Uint16Array,$0=Int32Array,em=new fs([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]),tm=new fs([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 fs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),TF=function(t,e){for(var A=new Sn(31),r=0;r<31;++r)A[r]=e+=1<<t[r-1];for(var i=new $0(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}},UF=TF(em,2),Zte=UF.b,Am=UF.r;Zte[28]=258,Am[258]=28;for(var Xte=TF(tm,0),LF=Xte.r,rm=new Sn(32768),YA=0;YA<32768;++YA){var Fa=(YA&43690)>>1|(YA&21845)<<1;Fa=(Fa&52428)>>2|(Fa&13107)<<2,Fa=(Fa&61680)>>4|(Fa&3855)<<4,rm[YA]=((Fa&65280)>>8|(Fa&255)<<8)>>1}for(var pp=function(t,e,A){for(var r=t.length,i=0,n=new Sn(e);i<r;++i)t[i]&&++n[t[i]-1];var o=new Sn(e);for(i=1;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var s;if(A){s=new Sn(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[rm[l]>>a]=c}else for(s=new Sn(r),i=0;i<r;++i)t[i]&&(s[i]=rm[o[t[i]-1]++]>>15-t[i]);return s},$c=new fs(288),YA=0;YA<144;++YA)$c[YA]=8;for(var YA=144;YA<256;++YA)$c[YA]=9;for(var YA=256;YA<280;++YA)$c[YA]=7;for(var YA=280;YA<288;++YA)$c[YA]=8;for(var UI=new fs(32),YA=0;YA<32;++YA)UI[YA]=5;var _te=pp($c,9,0),$te=pp(UI,5,0),FF=function(t){return(t+7)/8|0},eAe=function(t,e,A){return(e==null||e<0)&&(e=0),(A==null||A>t.length)&&(A=t.length),new fs(t.subarray(e,A))},Mo=function(t,e,A){A<<=e&7;var r=e/8|0;t[r]|=A,t[r+1]|=A>>8},fp=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},im=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:NF,l:0};if(i==1){var o=new fs(A[0].s+1);return o[A[0].s]=1,{t:o,l:1}}A.sort(function(O,x){return O.f-x.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 Sn(g+1),p=nm(A[u-1],h,0);if(p>e){var r=0,C=0,I=p-e,E=1<<I;for(n.sort(function(x,P){return h[P.s]-h[x.s]||x.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>>=I;C>0;){var m=n[r].s;h[m]<e?C-=1<<e-h[m]++-1:++r}for(;r>=0&&C;--r){var M=n[r].s;h[M]==e&&(--h[M],++C)}p=e}return{t:new fs(h),l:p}},nm=function(t,e,A){return t.s==-1?Math.max(nm(t.l,e,A+1),nm(t.r,e,A+1)):e[t.s]=A},OF=function(t){for(var e=t.length;e&&!t[--e];);for(var A=new Sn(++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}},Ep=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=FF(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},xF=function(t,e,A,r,i,n,o,s,a,c,u){Mo(e,u++,A),++i[256];for(var l=im(i,15),g=l.t,h=l.l,p=im(n,15),C=p.t,I=p.l,E=OF(g),v=E.c,m=E.n,M=OF(C),O=M.c,x=M.n,P=new Sn(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=im(P,7),q=T.t,Q=T.l,R=19;R>4&&!q[DF[R-1]];--R);var G=c+5<<3,k=Ep(i,$c)+Ep(n,UI)+o,te=Ep(i,g)+Ep(n,C)+o+14+3*R+Ep(P,q)+2*P[16]+3*P[17]+7*P[18];if(a>=0&&G<=k&&G<=te)return bF(e,u,t.subarray(a,a+c));var X,ie,W,se;if(Mo(e,u,1+(te<k)),u+=2,te<k){X=pp(g,h,0),ie=g,W=pp(C,I,0),se=C;var Be=pp(q,Q,0);Mo(e,u,m-257),Mo(e,u+5,x-1),Mo(e,u+10,R-4),u+=14;for(var D=0;D<R;++D)Mo(e,u+3*D,q[DF[D]]);u+=3*R;for(var Ee=[v,O],U=0;U<2;++U)for(var Y=Ee[U],D=0;D<Y.length;++D){var _=Y[D]&31;Mo(e,u,Be[_]),u+=q[_],_>15&&(Mo(e,u,Y[D]>>5&127),u+=Y[D]>>12)}}else X=_te,ie=$c,W=$te,se=UI;for(var D=0;D<s;++D){var re=r[D];if(re>255){var _=re>>18&31;fp(e,u,X[_+257]),u+=ie[_+257],_>7&&(Mo(e,u,re>>23&31),u+=em[_]);var ae=re&31;fp(e,u,W[ae]),u+=se[ae],ae>3&&(fp(e,u,re>>5&8191),u+=tm[ae])}else fp(e,u,X[re]),u+=ie[re]}return fp(e,u,X[256]),u+ie[256]},tAe=new $0([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),NF=new fs(0),AAe=function(t,e,A,r,i,n){var o=n.z||t.length,s=new fs(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=tAe[e-1],g=l>>13,h=l&8191,p=(1<<A)-1,C=n.p||new Sn(32768),I=n.h||new Sn(p+1),E=Math.ceil(A/3),v=2*E,m=function(z){return(t[z]^t[z+1]<<E^t[z+2]<<v)&p},M=new $0(25e3),O=new Sn(288),x=new Sn(32),P=0,D=0,T=n.i||0,q=0,Q=n.w||0,R=0;T+2<o;++T){var G=m(T),k=T&32767,te=I[G];if(C[k]=te,I[G]=k,Q<=T){var X=o-T;if((P>7e3||q>24576)&&(X>423||!c)){u=xF(t,a,0,M,O,x,D,q,R,T-R,u),q=P=D=0,R=T;for(var ie=0;ie<286;++ie)O[ie]=0;for(var ie=0;ie<30;++ie)x[ie]=0}var W=2,se=0,Be=h,Ee=k-te&32767;if(X>2&&G==m(T-Ee))for(var U=Math.min(g,X)-1,Y=Math.min(32767,T),_=Math.min(258,X);Ee<=Y&&--Be&&k!=te;){if(t[T+W]==t[T+W-Ee]){for(var re=0;re<_&&t[T+re]==t[T+re-Ee];++re);if(re>W){if(W=re,se=Ee,re>U)break;for(var ae=Math.min(Ee,re-2),Z=0,ie=0;ie<ae;++ie){var ce=T-Ee+ie&32767,oe=C[ce],de=ce-oe&32767;de>Z&&(Z=de,te=ce)}}}k=te,te=C[k],Ee+=k-te&32767}if(se){M[q++]=268435456|Am[W]<<18|LF[se];var De=Am[W]&31,j=LF[se]&31;D+=em[De]+tm[j],++O[257+De],++x[j],Q=T+W,++P}else M[q++]=t[T],++O[t[T]]}}for(T=Math.max(T,Q);T<o;++T)M[q++]=t[T],++O[t[T]];u=xF(t,a,c,M,O,x,D,q,R,T-R,u),c||(n.r=u&7|a[u/8|0]<<3,u-=7,n.h=I,n.p=C,n.i=T,n.w=Q)}else{for(var T=n.w||0;T<o+c;T+=65535){var J=T+65535;J>=o&&(a[u/8|0]=c,J=o),u=bF(a,u+1,t.subarray(T,J))}n.i=o}return eAe(s,0,r+FF(u)+i)},KF=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}}},rAe=function(t,e,A,r,i){if(!i&&(i={l:1},e.dictionary)){var n=e.dictionary.subarray(-32768),o=new fs(n.length+t.length);o.set(n),o.set(t,n.length),t=o,i.w=n.length}return AAe(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)},kF=function(t,e,A){for(;A;++e)t[e]=A,A>>>=8},iAe=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=KF();i.p(e.dictionary),kF(t,2,i.d())}};function sm(t,e){e||(e={});var A=KF();A.p(t);var r=rAe(t,e,e.dictionary?6:2,4);return iAe(r,e),kF(r,r.length-4,A.d()),r}var nAe=typeof TextDecoder<"u"&&new TextDecoder,sAe=0;try{nAe.decode(NF,{stream:!0}),sAe=1}catch{}function oAe(t){if(Array.isArray(t))return t}function aAe(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 PF(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 cAe(t,e){if(t){if(typeof t=="string")return PF(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)?PF(t,e):void 0}}function uAe(){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 GF(t,e){return oAe(t)||aAe(t,e)||cAe(t,e)||uAe()}function jF(t,e="utf8"){return new TextDecoder(e).decode(t)}const lAe=new TextEncoder;function hAe(t){return lAe.encode(t)}const gAe=1024*8,dAe=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),om={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 am{constructor(e=gAe,A={}){Ht(this,"buffer");Ht(this,"byteLength");Ht(this,"byteOffset");Ht(this,"length");Ht(this,"offset");Ht(this,"lastWrittenByte");Ht(this,"littleEndian");Ht(this,"_data");Ht(this,"_mark");Ht(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 am)&&(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=om[A].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,n=this.buffer.slice(i,i+r);if(this.littleEndian===dAe&&A!=="uint8"&&A!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const a=new om[A](s.buffer);return this.offset+=r,a.reverse(),a}const o=new om[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 jF(this.readBytes(e))}decodeText(e=1,A="utf8"){return jF(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(hAe(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 pAe=4,YF=0,HF=1,fAe=2;function Kl(t){let e=t.length;for(;--e>=0;)t[e]=0}const EAe=0,zF=1,CAe=2,IAe=3,BAe=258,cm=29,Cp=256,Ip=Cp+1+cm,kl=30,um=19,JF=2*Ip+1,eu=15,lm=16,vAe=7,hm=256,qF=16,VF=17,WF=18,gm=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]),LI=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]),wAe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ZF=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),SAe=512,yo=new Array((Ip+2)*2);Kl(yo);const Bp=new Array(kl*2);Kl(Bp);const vp=new Array(SAe);Kl(vp);const wp=new Array(BAe-IAe+1);Kl(wp);const dm=new Array(cm);Kl(dm);const FI=new Array(kl);Kl(FI);function pm(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 XF,_F,$F;function fm(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const eO=t=>t<256?vp[t]:vp[256+(t>>>7)],Sp=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},cn=(t,e,A)=>{t.bi_valid>lm-A?(t.bi_buf|=e<<t.bi_valid&65535,Sp(t,t.bi_buf),t.bi_buf=e>>lm-t.bi_valid,t.bi_valid+=A-lm):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=A)},Ys=(t,e,A)=>{cn(t,A[e*2],A[e*2+1])},tO=(t,e)=>{let A=0;do A|=t&1,t>>>=1,A<<=1;while(--e>0);return A>>>1},mAe=t=>{t.bi_valid===16?(Sp(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)},MAe=(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<=eu;g++)t.bl_count[g]=0;for(A[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<JF;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--)}},AO=(t,e,A)=>{const r=new Array(eu+1);let i=0,n,o;for(n=1;n<=eu;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]=tO(r[s]++,s))}},yAe=()=>{let t,e,A,r,i;const n=new Array(eu+1);for(A=0,r=0;r<cm-1;r++)for(dm[r]=A,t=0;t<1<<gm[r];t++)wp[A++]=r;for(wp[A-1]=r,i=0,r=0;r<16;r++)for(FI[r]=i,t=0;t<1<<LI[r];t++)vp[i++]=r;for(i>>=7;r<kl;r++)for(FI[r]=i<<7,t=0;t<1<<LI[r]-7;t++)vp[256+i++]=r;for(e=0;e<=eu;e++)n[e]=0;for(t=0;t<=143;)yo[t*2+1]=8,t++,n[8]++;for(;t<=255;)yo[t*2+1]=9,t++,n[9]++;for(;t<=279;)yo[t*2+1]=7,t++,n[7]++;for(;t<=287;)yo[t*2+1]=8,t++,n[8]++;for(AO(yo,Ip+1,n),t=0;t<kl;t++)Bp[t*2+1]=5,Bp[t*2]=tO(t,5);XF=new pm(yo,gm,Cp+1,Ip,eu),_F=new pm(Bp,LI,0,kl,eu),$F=new pm(new Array(0),wAe,0,um,vAe)},rO=t=>{let e;for(e=0;e<Ip;e++)t.dyn_ltree[e*2]=0;for(e=0;e<kl;e++)t.dyn_dtree[e*2]=0;for(e=0;e<um;e++)t.bl_tree[e*2]=0;t.dyn_ltree[hm*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},iO=t=>{t.bi_valid>8?Sp(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},nO=(t,e,A,r)=>{const i=e*2,n=A*2;return t[i]<t[n]||t[i]===t[n]&&r[e]<=r[A]},Em=(t,e,A)=>{const r=t.heap[A];let i=A<<1;for(;i<=t.heap_len&&(i<t.heap_len&&nO(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!nO(e,r,t.heap[i],t.depth));)t.heap[A]=t.heap[i],A=i,i<<=1;t.heap[A]=r},sO=(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?Ys(t,i,e):(o=wp[i],Ys(t,o+Cp+1,e),s=gm[o],s!==0&&(i-=dm[o],cn(t,i,s)),r--,o=eO(r),Ys(t,o,A),s=LI[o],s!==0&&(r-=FI[o],cn(t,r,s)));while(n<t.sym_next);Ys(t,hm,e)},Cm=(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=JF,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--)Em(t,A,o);c=n;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Em(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++,Em(t,A,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],MAe(t,e),AO(A,a,t.bl_count)},oO=(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[qF*2]++):s<=10?t.bl_tree[VF*2]++:t.bl_tree[WF*2]++,s=0,i=n,o===0?(a=138,c=3):n===o?(a=6,c=3):(a=7,c=4))},aO=(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 Ys(t,n,t.bl_tree);while(--s!==0);else n!==0?(n!==i&&(Ys(t,n,t.bl_tree),s--),Ys(t,qF,t.bl_tree),cn(t,s-3,2)):s<=10?(Ys(t,VF,t.bl_tree),cn(t,s-3,3)):(Ys(t,WF,t.bl_tree),cn(t,s-11,7));s=0,i=n,o===0?(a=138,c=3):n===o?(a=6,c=3):(a=7,c=4)}},QAe=t=>{let e;for(oO(t,t.dyn_ltree,t.l_desc.max_code),oO(t,t.dyn_dtree,t.d_desc.max_code),Cm(t,t.bl_desc),e=um-1;e>=3&&t.bl_tree[ZF[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},RAe=(t,e,A,r)=>{let i;for(cn(t,e-257,5),cn(t,A-1,5),cn(t,r-4,4),i=0;i<r;i++)cn(t,t.bl_tree[ZF[i]*2+1],3);aO(t,t.dyn_ltree,e-1),aO(t,t.dyn_dtree,A-1)},DAe=t=>{let e=4093624447,A;for(A=0;A<=31;A++,e>>>=1)if(e&1&&t.dyn_ltree[A*2]!==0)return YF;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return HF;for(A=32;A<Cp;A++)if(t.dyn_ltree[A*2]!==0)return HF;return YF};let cO=!1;const TAe=t=>{cO||(yAe(),cO=!0),t.l_desc=new fm(t.dyn_ltree,XF),t.d_desc=new fm(t.dyn_dtree,_F),t.bl_desc=new fm(t.bl_tree,$F),t.bi_buf=0,t.bi_valid=0,rO(t)},uO=(t,e,A,r)=>{cn(t,(EAe<<1)+(r?1:0),3),iO(t),Sp(t,A),Sp(t,~A),A&&t.pending_buf.set(t.window.subarray(e,e+A),t.pending),t.pending+=A},UAe=t=>{cn(t,zF<<1,3),Ys(t,hm,yo),mAe(t)},LAe=(t,e,A,r)=>{let i,n,o=0;t.level>0?(t.strm.data_type===fAe&&(t.strm.data_type=DAe(t)),Cm(t,t.l_desc),Cm(t,t.d_desc),o=QAe(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?uO(t,e,A,r):t.strategy===pAe||n===i?(cn(t,(zF<<1)+(r?1:0),3),sO(t,yo,Bp)):(cn(t,(CAe<<1)+(r?1:0),3),RAe(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),sO(t,t.dyn_ltree,t.dyn_dtree)),rO(t),r&&iO(t)},FAe=(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[(wp[A]+Cp+1)*2]++,t.dyn_dtree[eO(e)*2]++),t.sym_next===t.sym_end);var OAe=TAe,bAe=uO,xAe=LAe,NAe=FAe,KAe=UAe,kAe={_tr_init:OAe,_tr_stored_block:bAe,_tr_flush_block:xAe,_tr_tally:NAe,_tr_align:KAe},mp=(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 PAe=()=>{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},GAe=new Uint32Array(PAe());var Xr=(t,e,A,r)=>{const i=GAe,n=r+A;t^=-1;for(let o=r;o<n;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Pl={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"},Mp={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:jAe,_tr_stored_block:Im,_tr_flush_block:YAe,_tr_tally:Oa,_tr_align:HAe}=kAe,{Z_NO_FLUSH:ba,Z_PARTIAL_FLUSH:zAe,Z_FULL_FLUSH:JAe,Z_FINISH:Jn,Z_BLOCK:lO,Z_OK:gi,Z_STREAM_END:hO,Z_STREAM_ERROR:Hs,Z_DATA_ERROR:qAe,Z_BUF_ERROR:Bm,Z_DEFAULT_COMPRESSION:VAe,Z_FILTERED:WAe,Z_HUFFMAN_ONLY:OI,Z_RLE:ZAe,Z_FIXED:XAe,Z_DEFAULT_STRATEGY:_Ae,Z_UNKNOWN:$Ae,Z_DEFLATED:bI}=Mp,ere=9,tre=15,Are=8,rre=29,vm=256+1+rre,ire=30,nre=19,sre=2*vm+1,ore=15,cA=3,xa=258,zs=xa+cA+1,are=32,Gl=42,wm=57,Sm=69,mm=73,Mm=91,ym=103,tu=113,yp=666,zi=1,jl=2,Au=3,Yl=4,cre=3,ru=(t,e)=>(t.msg=Pl[e],e),gO=t=>t*2-(t>4?9:0),Na=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ure=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 Ka=(t,e,A)=>(e<<t.hash_shift^A)&t.hash_mask;const mn=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))},Mn=(t,e)=>{YAe(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,mn(t.strm)},vA=(t,e)=>{t.pending_buf[t.pending++]=e},Qp=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Qm=(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=mp(t.adler,e,i,A):t.state.wrap===2&&(t.adler=Xr(t.adler,e,i,A)),t.next_in+=i,t.total_in+=i,i)},dO=(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-zs?t.strstart-(t.w_size-zs):0,c=t.window,u=t.w_mask,l=t.prev,g=t.strstart+xa;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=xa-(g-r),r=g-xa,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},Hl=t=>{const e=t.w_size;let A,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-zs)&&(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),ure(t),r+=e),t.strm.avail_in===0)break;if(A=Qm(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=A,t.lookahead+t.insert>=cA)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Ka(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Ka(t,t.ins_h,t.window[i+cA-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<cA)););}while(t.lookahead<zs&&t.strm.avail_in!==0)},pO=(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!==Jn||e===ba||r!==i+t.strm.avail_in)))break;o=e===Jn&&r===i+t.strm.avail_in?1:0,Im(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,mn(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&&(Qm(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?Yl:e!==ba&&e!==Jn&&t.strm.avail_in===0&&t.strstart===t.block_start?jl:(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&&(Qm(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===Jn)&&e!==ba&&t.strm.avail_in===0&&i<=n)&&(r=i>n?n:i,o=e===Jn&&t.strm.avail_in===0&&r===i?1:0,Im(t,t.block_start,r,o),t.block_start+=r,mn(t.strm)),o?Au:zi)},Rm=(t,e)=>{let A,r;for(;;){if(t.lookahead<zs){if(Hl(t),t.lookahead<zs&&e===ba)return zi;if(t.lookahead===0)break}if(A=0,t.lookahead>=cA&&(t.ins_h=Ka(t,t.ins_h,t.window[t.strstart+cA-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-zs&&(t.match_length=dO(t,A)),t.match_length>=cA)if(r=Oa(t,t.strstart-t.match_start,t.match_length-cA),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=cA){t.match_length--;do t.strstart++,t.ins_h=Ka(t,t.ins_h,t.window[t.strstart+cA-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=Ka(t,t.ins_h,t.window[t.strstart+1]);else r=Oa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Mn(t,!1),t.strm.avail_out===0))return zi}return t.insert=t.strstart<cA-1?t.strstart:cA-1,e===Jn?(Mn(t,!0),t.strm.avail_out===0?Au:Yl):t.sym_next&&(Mn(t,!1),t.strm.avail_out===0)?zi:jl},zl=(t,e)=>{let A,r,i;for(;;){if(t.lookahead<zs){if(Hl(t),t.lookahead<zs&&e===ba)return zi;if(t.lookahead===0)break}if(A=0,t.lookahead>=cA&&(t.ins_h=Ka(t,t.ins_h,t.window[t.strstart+cA-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=cA-1,A!==0&&t.prev_length<t.max_lazy_match&&t.strstart-A<=t.w_size-zs&&(t.match_length=dO(t,A),t.match_length<=5&&(t.strategy===WAe||t.match_length===cA&&t.strstart-t.match_start>4096)&&(t.match_length=cA-1)),t.prev_length>=cA&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-cA,r=Oa(t,t.strstart-1-t.prev_match,t.prev_length-cA),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Ka(t,t.ins_h,t.window[t.strstart+cA-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=cA-1,t.strstart++,r&&(Mn(t,!1),t.strm.avail_out===0))return zi}else if(t.match_available){if(r=Oa(t,0,t.window[t.strstart-1]),r&&Mn(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return zi}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Oa(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<cA-1?t.strstart:cA-1,e===Jn?(Mn(t,!0),t.strm.avail_out===0?Au:Yl):t.sym_next&&(Mn(t,!1),t.strm.avail_out===0)?zi:jl},lre=(t,e)=>{let A,r,i,n;const o=t.window;for(;;){if(t.lookahead<=xa){if(Hl(t),t.lookahead<=xa&&e===ba)return zi;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=cA&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){n=t.strstart+xa;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=xa-(n-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=cA?(A=Oa(t,1,t.match_length-cA),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(A=Oa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),A&&(Mn(t,!1),t.strm.avail_out===0))return zi}return t.insert=0,e===Jn?(Mn(t,!0),t.strm.avail_out===0?Au:Yl):t.sym_next&&(Mn(t,!1),t.strm.avail_out===0)?zi:jl},hre=(t,e)=>{let A;for(;;){if(t.lookahead===0&&(Hl(t),t.lookahead===0)){if(e===ba)return zi;break}if(t.match_length=0,A=Oa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,A&&(Mn(t,!1),t.strm.avail_out===0))return zi}return t.insert=0,e===Jn?(Mn(t,!0),t.strm.avail_out===0?Au:Yl):t.sym_next&&(Mn(t,!1),t.strm.avail_out===0)?zi:jl};function Js(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 Rp=[new Js(0,0,0,0,pO),new Js(4,4,8,4,Rm),new Js(4,5,16,8,Rm),new Js(4,6,32,32,Rm),new Js(4,4,16,16,zl),new Js(8,16,32,32,zl),new Js(8,16,128,128,zl),new Js(8,32,128,256,zl),new Js(32,128,258,1024,zl),new Js(32,258,258,4096,zl)],gre=t=>{t.window_size=2*t.w_size,Na(t.head),t.max_lazy_match=Rp[t.level].max_lazy,t.good_match=Rp[t.level].good_length,t.nice_match=Rp[t.level].nice_length,t.max_chain_length=Rp[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=cA-1,t.match_available=0,t.ins_h=0};function dre(){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=bI,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(sre*2),this.dyn_dtree=new Uint16Array((2*ire+1)*2),this.bl_tree=new Uint16Array((2*nre+1)*2),Na(this.dyn_ltree),Na(this.dyn_dtree),Na(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ore+1),this.heap=new Uint16Array(2*vm+1),Na(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*vm+1),Na(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 Dp=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Gl&&e.status!==wm&&e.status!==Sm&&e.status!==mm&&e.status!==Mm&&e.status!==ym&&e.status!==tu&&e.status!==yp?1:0},fO=t=>{if(Dp(t))return ru(t,Hs);t.total_in=t.total_out=0,t.data_type=$Ae;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?wm:e.wrap?Gl:tu,t.adler=e.wrap===2?0:1,e.last_flush=-2,jAe(e),gi},EO=t=>{const e=fO(t);return e===gi&&gre(t.state),e},pre=(t,e)=>Dp(t)||t.state.wrap!==2?Hs:(t.state.gzhead=e,gi),CO=(t,e,A,r,i,n)=>{if(!t)return Hs;let o=1;if(e===VAe&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>ere||A!==bI||r<8||r>15||e<0||e>9||n<0||n>XAe||r===8&&o!==1)return ru(t,Hs);r===8&&(r=9);const s=new dre;return t.state=s,s.strm=t,s.status=Gl,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+cA-1)/cA),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,EO(t)},fre=(t,e)=>CO(t,e,bI,tre,Are,_Ae),Ere=(t,e)=>{if(Dp(t)||e>lO||e<0)return t?ru(t,Hs):Hs;const A=t.state;if(!t.output||t.avail_in!==0&&!t.input||A.status===yp&&e!==Jn)return ru(t,t.avail_out===0?Bm:Hs);const r=A.last_flush;if(A.last_flush=e,A.pending!==0){if(mn(t),t.avail_out===0)return A.last_flush=-1,gi}else if(t.avail_in===0&&gO(e)<=gO(r)&&e!==Jn)return ru(t,Bm);if(A.status===yp&&t.avail_in!==0)return ru(t,Bm);if(A.status===Gl&&A.wrap===0&&(A.status=tu),A.status===Gl){let i=bI+(A.w_bits-8<<4)<<8,n=-1;if(A.strategy>=OI||A.level<2?n=0:A.level<6?n=1:A.level===6?n=2:n=3,i|=n<<6,A.strstart!==0&&(i|=are),i+=31-i%31,Qp(A,i),A.strstart!==0&&(Qp(A,t.adler>>>16),Qp(A,t.adler&65535)),t.adler=1,A.status=tu,mn(t),A.pending!==0)return A.last_flush=-1,gi}if(A.status===wm){if(t.adler=0,vA(A,31),vA(A,139),vA(A,8),A.gzhead)vA(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)),vA(A,A.gzhead.time&255),vA(A,A.gzhead.time>>8&255),vA(A,A.gzhead.time>>16&255),vA(A,A.gzhead.time>>24&255),vA(A,A.level===9?2:A.strategy>=OI||A.level<2?4:0),vA(A,A.gzhead.os&255),A.gzhead.extra&&A.gzhead.extra.length&&(vA(A,A.gzhead.extra.length&255),vA(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(t.adler=Xr(t.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=Sm;else if(vA(A,0),vA(A,0),vA(A,0),vA(A,0),vA(A,0),vA(A,A.level===9?2:A.strategy>=OI||A.level<2?4:0),vA(A,cre),A.status=tu,mn(t),A.pending!==0)return A.last_flush=-1,gi}if(A.status===Sm){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=Xr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex+=s,mn(t),A.pending!==0)return A.last_flush=-1,gi;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=Xr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=mm}if(A.status===mm){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=Xr(t.adler,A.pending_buf,A.pending-i,i)),mn(t),A.pending!==0)return A.last_flush=-1,gi;i=0}A.gzindex<A.gzhead.name.length?n=A.gzhead.name.charCodeAt(A.gzindex++)&255:n=0,vA(A,n)}while(n!==0);A.gzhead.hcrc&&A.pending>i&&(t.adler=Xr(t.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=Mm}if(A.status===Mm){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=Xr(t.adler,A.pending_buf,A.pending-i,i)),mn(t),A.pending!==0)return A.last_flush=-1,gi;i=0}A.gzindex<A.gzhead.comment.length?n=A.gzhead.comment.charCodeAt(A.gzindex++)&255:n=0,vA(A,n)}while(n!==0);A.gzhead.hcrc&&A.pending>i&&(t.adler=Xr(t.adler,A.pending_buf,A.pending-i,i))}A.status=ym}if(A.status===ym){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(mn(t),A.pending!==0))return A.last_flush=-1,gi;vA(A,t.adler&255),vA(A,t.adler>>8&255),t.adler=0}if(A.status=tu,mn(t),A.pending!==0)return A.last_flush=-1,gi}if(t.avail_in!==0||A.lookahead!==0||e!==ba&&A.status!==yp){let i=A.level===0?pO(A,e):A.strategy===OI?hre(A,e):A.strategy===ZAe?lre(A,e):Rp[A.level].func(A,e);if((i===Au||i===Yl)&&(A.status=yp),i===zi||i===Au)return t.avail_out===0&&(A.last_flush=-1),gi;if(i===jl&&(e===zAe?HAe(A):e!==lO&&(Im(A,0,0,!1),e===JAe&&(Na(A.head),A.lookahead===0&&(A.strstart=0,A.block_start=0,A.insert=0))),mn(t),t.avail_out===0))return A.last_flush=-1,gi}return e!==Jn?gi:A.wrap<=0?hO:(A.wrap===2?(vA(A,t.adler&255),vA(A,t.adler>>8&255),vA(A,t.adler>>16&255),vA(A,t.adler>>24&255),vA(A,t.total_in&255),vA(A,t.total_in>>8&255),vA(A,t.total_in>>16&255),vA(A,t.total_in>>24&255)):(Qp(A,t.adler>>>16),Qp(A,t.adler&65535)),mn(t),A.wrap>0&&(A.wrap=-A.wrap),A.pending!==0?gi:hO)},Cre=t=>{if(Dp(t))return Hs;const e=t.state.status;return t.state=null,e===tu?ru(t,qAe):gi},Ire=(t,e)=>{let A=e.length;if(Dp(t))return Hs;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==Gl||r.lookahead)return Hs;if(i===1&&(t.adler=mp(t.adler,e,A,0)),r.wrap=0,A>=r.w_size){i===0&&(Na(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,Hl(r);r.lookahead>=cA;){let a=r.strstart,c=r.lookahead-(cA-1);do r.ins_h=Ka(r,r.ins_h,r.window[a+cA-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=cA-1,Hl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=cA-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=n,r.wrap=i,gi};var Bre=fre,vre=CO,wre=EO,Sre=fO,mre=pre,Mre=Ere,yre=Cre,Qre=Ire,Rre="pako deflate (from Nodeca project)",Tp={deflateInit:Bre,deflateInit2:vre,deflateReset:wre,deflateResetKeep:Sre,deflateSetHeader:mre,deflate:Mre,deflateEnd:yre,deflateSetDictionary:Qre,deflateInfo:Rre};const Dre=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Tre=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)Dre(A,r)&&(t[r]=A[r])}}return t},Ure=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},xI={assign:Tre,flattenChunks:Ure};let IO=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{IO=!1}const Up=new Uint8Array(256);for(let t=0;t<256;t++)Up[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Up[254]=Up[254]=1;var Lre=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 Fre=(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 Ore=(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=Up[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 Fre(n,i)},bre=(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+Up[t[A]]>e?A:e},Lp={string2buf:Lre,buf2string:Ore,utf8border:bre};function xre(){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 BO=xre;const vO=Object.prototype.toString,{Z_NO_FLUSH:Nre,Z_SYNC_FLUSH:Kre,Z_FULL_FLUSH:kre,Z_FINISH:Pre,Z_OK:NI,Z_STREAM_END:Gre,Z_DEFAULT_COMPRESSION:jre,Z_DEFAULT_STRATEGY:Yre,Z_DEFLATED:Hre}=Mp;function Dm(t){this.options=xI.assign({level:jre,method:Hre,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yre},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 BO,this.strm.avail_out=0;let A=Tp.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(A!==NI)throw new Error(Pl[A]);if(e.header&&Tp.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Lp.string2buf(e.dictionary):vO.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,A=Tp.deflateSetDictionary(this.strm,r),A!==NI)throw new Error(Pl[A]);this._dict_set=!0}}Dm.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?Pre:Nre,typeof t=="string"?A.input=Lp.string2buf(t):vO.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===Kre||n===kre)&&A.avail_out<=6){this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;continue}if(i=Tp.deflate(A,n),i===Gre)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),i=Tp.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===NI;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},Dm.prototype.onData=function(t){this.chunks.push(t)},Dm.prototype.onEnd=function(t){t===NI&&(this.result=xI.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const KI=16209,zre=16191;var Jre=function(e,A){let r,i,n,o,s,a,c,u,l,g,h,p,C,I,E,v,m,M,O,x,P,D,T,q;const Q=e.state;r=e.next_in,T=e.input,i=r+(e.avail_in-5),n=e.next_out,q=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,I=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(M=m>>>24,h>>>=M,p-=M,M=m>>>16&255,M===0)q[n++]=m&65535;else if(M&16){O=m&65535,M&=15,M&&(p<M&&(h+=T[r++]<<p,p+=8),O+=h&(1<<M)-1,h>>>=M,p-=M),p<15&&(h+=T[r++]<<p,p+=8,h+=T[r++]<<p,p+=8),m=I[h&v];A:for(;;){if(M=m>>>24,h>>>=M,p-=M,M=m>>>16&255,M&16){if(x=m&65535,M&=15,p<M&&(h+=T[r++]<<p,p+=8,p<M&&(h+=T[r++]<<p,p+=8)),x+=h&(1<<M)-1,x>a){e.msg="invalid distance too far back",Q.mode=KI;break e}if(h>>>=M,p-=M,M=n-o,x>M){if(M=x-M,M>u&&Q.sane){e.msg="invalid distance too far back",Q.mode=KI;break e}if(P=0,D=g,l===0){if(P+=c-M,M<O){O-=M;do q[n++]=g[P++];while(--M);P=n-x,D=q}}else if(l<M){if(P+=c+l-M,M-=l,M<O){O-=M;do q[n++]=g[P++];while(--M);if(P=0,l<O){M=l,O-=M;do q[n++]=g[P++];while(--M);P=n-x,D=q}}}else if(P+=l-M,M<O){O-=M;do q[n++]=g[P++];while(--M);P=n-x,D=q}for(;O>2;)q[n++]=D[P++],q[n++]=D[P++],q[n++]=D[P++],O-=3;O&&(q[n++]=D[P++],O>1&&(q[n++]=D[P++]))}else{P=n-x;do q[n++]=q[P++],q[n++]=q[P++],q[n++]=q[P++],O-=3;while(O>2);O&&(q[n++]=q[P++],O>1&&(q[n++]=q[P++]))}}else if(M&64){e.msg="invalid distance code",Q.mode=KI;break e}else{m=I[(m&65535)+(h&(1<<M)-1)];continue A}break}}else if(M&64)if(M&32){Q.mode=zre;break e}else{e.msg="invalid literal/length code",Q.mode=KI;break e}else{m=C[(m&65535)+(h&(1<<M)-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 Jl=15,wO=852,SO=592,mO=0,Tm=1,MO=2,qre=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]),Vre=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]),Wre=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]),Zre=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 Fp=(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,I=0,E=0,v=0,m,M,O,x,P,D=null,T;const q=new Uint16Array(Jl+1),Q=new Uint16Array(Jl+1);let R=null,G,k,te;for(c=0;c<=Jl;c++)q[c]=0;for(u=0;u<r;u++)q[e[A+u]]++;for(h=a,g=Jl;g>=1&&q[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&&q[l]===0;l++);for(h<l&&(h=l),I=1,c=1;c<=Jl;c++)if(I<<=1,I-=q[c],I<0)return-1;if(I>0&&(t===mO||g!==1))return-1;for(Q[1]=0,c=1;c<Jl;c++)Q[c+1]=Q[c]+q[c];for(u=0;u<r;u++)e[A+u]!==0&&(o[Q[e[A+u]]++]=u);if(t===mO?(D=R=o,T=20):t===Tm?(D=qre,R=Vre,T=257):(D=Wre,R=Zre,T=0),v=0,u=0,c=l,P=n,p=h,C=0,O=-1,E=1<<h,x=E-1,t===Tm&&E>wO||t===MO&&E>SO)return 1;for(;;){G=c-C,o[u]+1<T?(k=0,te=o[u]):o[u]>=T?(k=R[o[u]-T],te=D[o[u]-T]):(k=32+64,te=0),m=1<<c-C,M=1<<p,l=M;do M-=m,i[P+(v>>C)+M]=G<<24|k<<16|te|0;while(M!==0);for(m=1<<c-1;v&m;)m>>=1;if(m!==0?(v&=m-1,v+=m):v=0,u++,--q[c]===0){if(c===g)break;c=e[A+o[u]]}if(c>h&&(v&x)!==O){for(C===0&&(C=h),P+=l,p=c-C,I=1<<p;p+C<g&&(I-=q[p+C],!(I<=0));)p++,I<<=1;if(E+=1<<p,t===Tm&&E>wO||t===MO&&E>SO)return 1;O=v&x,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 Xre=0,yO=1,QO=2,{Z_FINISH:RO,Z_BLOCK:_re,Z_TREES:kI,Z_OK:iu,Z_STREAM_END:$re,Z_NEED_DICT:eie,Z_STREAM_ERROR:qn,Z_DATA_ERROR:DO,Z_MEM_ERROR:TO,Z_BUF_ERROR:tie,Z_DEFLATED:UO}=Mp,PI=16180,LO=16181,FO=16182,OO=16183,bO=16184,xO=16185,NO=16186,KO=16187,kO=16188,PO=16189,GI=16190,Qo=16191,Um=16192,GO=16193,Lm=16194,jO=16195,YO=16196,HO=16197,zO=16198,jI=16199,YI=16200,JO=16201,qO=16202,VO=16203,WO=16204,ZO=16205,Fm=16206,XO=16207,_O=16208,qA=16209,$O=16210,eb=16211,Aie=852,rie=592,iie=15,tb=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function nie(){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 nu=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<PI||e.mode>eb?1:0},Ab=t=>{if(nu(t))return qn;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=PI,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(Aie),e.distcode=e.distdyn=new Int32Array(rie),e.sane=1,e.back=-1,iu},rb=t=>{if(nu(t))return qn;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Ab(t)},ib=(t,e)=>{let A;if(nu(t))return qn;const r=t.state;return e<0?(A=0,e=-e):(A=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?qn:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=A,r.wbits=e,rb(t))},nb=(t,e)=>{if(!t)return qn;const A=new nie;t.state=A,A.strm=t,A.window=null,A.mode=PI;const r=ib(t,e);return r!==iu&&(t.state=null),r},sie=t=>nb(t,iie);let sb=!0,Om,bm;const oie=t=>{if(sb){Om=new Int32Array(512),bm=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(Fp(yO,t.lens,0,288,Om,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Fp(QO,t.lens,0,32,bm,0,t.work,{bits:5}),sb=!1}t.lencode=Om,t.lenbits=9,t.distcode=bm,t.distbits=5},ob=(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},aie=(t,e)=>{let A,r,i,n,o,s,a,c,u,l,g,h,p,C,I=0,E,v,m,M,O,x,P,D;const T=new Uint8Array(4);let q,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(nu(t)||!t.output||!t.input&&t.avail_in!==0)return qn;A=t.state,A.mode===Qo&&(A.mode=Um),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=iu;e:for(;;)switch(A.mode){case PI:if(A.wrap===0){A.mode=Um;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=Xr(A.check,T,2,0),c=0,u=0,A.mode=LO;break}if(A.head&&(A.head.done=!1),!(A.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",A.mode=qA;break}if((c&15)!==UO){t.msg="unknown compression method",A.mode=qA;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=qA;break}A.dmax=1<<A.wbits,A.flags=0,t.adler=A.check=1,A.mode=c&512?PO:Qo,c=0,u=0;break;case LO:for(;u<16;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(A.flags=c,(A.flags&255)!==UO){t.msg="unknown compression method",A.mode=qA;break}if(A.flags&57344){t.msg="unknown header flags set",A.mode=qA;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=Xr(A.check,T,2,0)),c=0,u=0,A.mode=FO;case FO: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=Xr(A.check,T,4,0)),c=0,u=0,A.mode=OO;case OO: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=Xr(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=Xr(A.check,T,2,0)),c=0,u=0}else A.head&&(A.head.extra=null);A.mode=xO;case xO: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=Xr(A.check,r,h,n)),s-=h,n+=h,A.length-=h),A.length))break e;A.length=0,A.mode=NO;case NO: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=Xr(A.check,r,h,n)),s-=h,n+=h,P)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=KO;case KO: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=Xr(A.check,r,h,n)),s-=h,n+=h,P)break e}else A.head&&(A.head.comment=null);A.mode=kO;case kO: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=qA;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=Qo;break;case PO:for(;u<32;){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}t.adler=A.check=tb(c),c=0,u=0,A.mode=GI;case GI: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,eie;t.adler=A.check=1,A.mode=Qo;case Qo:if(e===_re||e===kI)break e;case Um:if(A.last){c>>>=u&7,u-=u&7,A.mode=Fm;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=GO;break;case 1:if(oie(A),A.mode=jI,e===kI){c>>>=2,u-=2;break e}break;case 2:A.mode=YO;break;case 3:t.msg="invalid block type",A.mode=qA}c>>>=2,u-=2;break;case GO: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=qA;break}if(A.length=c&65535,c=0,u=0,A.mode=Lm,e===kI)break e;case Lm:A.mode=jO;case jO: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=Qo;break;case YO: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=qA;break}A.have=0,A.mode=HO;case HO: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,q={bits:A.lenbits},D=Fp(Xre,A.lens,0,19,A.lencode,0,A.work,q),A.lenbits=q.bits,D){t.msg="invalid code lengths set",A.mode=qA;break}A.have=0,A.mode=zO;case zO:for(;A.have<A.nlen+A.ndist;){for(;I=A.lencode[c&(1<<A.lenbits)-1],E=I>>>24,v=I>>>16&255,m=I&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=qA;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=qA;break}for(;h--;)A.lens[A.have++]=P}}if(A.mode===qA)break;if(A.lens[256]===0){t.msg="invalid code -- missing end-of-block",A.mode=qA;break}if(A.lenbits=9,q={bits:A.lenbits},D=Fp(yO,A.lens,0,A.nlen,A.lencode,0,A.work,q),A.lenbits=q.bits,D){t.msg="invalid literal/lengths set",A.mode=qA;break}if(A.distbits=6,A.distcode=A.distdyn,q={bits:A.distbits},D=Fp(QO,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,q),A.distbits=q.bits,D){t.msg="invalid distances set",A.mode=qA;break}if(A.mode=jI,e===kI)break e;case jI:A.mode=YI;case YI: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,Jre(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===Qo&&(A.back=-1);break}for(A.back=0;I=A.lencode[c&(1<<A.lenbits)-1],E=I>>>24,v=I>>>16&255,m=I&65535,!(E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(v&&!(v&240)){for(M=E,O=v,x=m;I=A.lencode[x+((c&(1<<M+O)-1)>>M)],E=I>>>24,v=I>>>16&255,m=I&65535,!(M+E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=M,u-=M,A.back+=M}if(c>>>=E,u-=E,A.back+=E,A.length=m,v===0){A.mode=ZO;break}if(v&32){A.back=-1,A.mode=Qo;break}if(v&64){t.msg="invalid literal/length code",A.mode=qA;break}A.extra=v&15,A.mode=JO;case JO: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=qO;case qO:for(;I=A.distcode[c&(1<<A.distbits)-1],E=I>>>24,v=I>>>16&255,m=I&65535,!(E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}if(!(v&240)){for(M=E,O=v,x=m;I=A.distcode[x+((c&(1<<M+O)-1)>>M)],E=I>>>24,v=I>>>16&255,m=I&65535,!(M+E<=u);){if(s===0)break e;s--,c+=r[n++]<<u,u+=8}c>>>=M,u-=M,A.back+=M}if(c>>>=E,u-=E,A.back+=E,v&64){t.msg="invalid distance code",A.mode=qA;break}A.offset=m,A.extra=v&15,A.mode=VO;case VO: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=qA;break}A.mode=WO;case WO: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=qA;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=YI);break;case ZO:if(a===0)break e;i[o++]=A.length,a--,A.mode=YI;break;case Fm: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?Xr(A.check,i,g,o-g):mp(A.check,i,g,o-g)),g=a,A.wrap&4&&(A.flags?c:tb(c))!==A.check){t.msg="incorrect data check",A.mode=qA;break}c=0,u=0}A.mode=XO;case XO: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=qA;break}c=0,u=0}A.mode=_O;case _O:D=$re;break e;case qA:D=DO;break e;case $O:return TO;case eb:default:return qn}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<qA&&(A.mode<Fm||e!==RO))&&ob(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?Xr(A.check,i,g,t.next_out-g):mp(A.check,i,g,t.next_out-g)),t.data_type=A.bits+(A.last?64:0)+(A.mode===Qo?128:0)+(A.mode===jI||A.mode===Lm?256:0),(l===0&&g===0||e===RO)&&D===iu&&(D=tie),D},cie=t=>{if(nu(t))return qn;let e=t.state;return e.window&&(e.window=null),t.state=null,iu},uie=(t,e)=>{if(nu(t))return qn;const A=t.state;return A.wrap&2?(A.head=e,e.done=!1,iu):qn},lie=(t,e)=>{const A=e.length;let r,i,n;return nu(t)||(r=t.state,r.wrap!==0&&r.mode!==GI)?qn:r.mode===GI&&(i=1,i=mp(i,e,A,0),i!==r.check)?DO:(n=ob(t,e,A,A),n?(r.mode=$O,TO):(r.havedict=1,iu))};var hie=rb,gie=ib,die=Ab,pie=sie,fie=nb,Eie=aie,Cie=cie,Iie=uie,Bie=lie,vie="pako inflate (from Nodeca project)",Ro={inflateReset:hie,inflateReset2:gie,inflateResetKeep:die,inflateInit:pie,inflateInit2:fie,inflate:Eie,inflateEnd:Cie,inflateGetHeader:Iie,inflateSetDictionary:Bie,inflateInfo:vie};function wie(){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 Sie=wie;const ab=Object.prototype.toString,{Z_NO_FLUSH:mie,Z_FINISH:Mie,Z_OK:Op,Z_STREAM_END:xm,Z_NEED_DICT:Nm,Z_STREAM_ERROR:yie,Z_DATA_ERROR:cb,Z_MEM_ERROR:Qie}=Mp;function bp(t){this.options=xI.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 BO,this.strm.avail_out=0;let A=Ro.inflateInit2(this.strm,e.windowBits);if(A!==Op)throw new Error(Pl[A]);if(this.header=new Sie,Ro.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Lp.string2buf(e.dictionary):ab.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(A=Ro.inflateSetDictionary(this.strm,e.dictionary),A!==Op)))throw new Error(Pl[A])}bp.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?Mie:mie,ab.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=Ro.inflate(A,o),n===Nm&&i&&(n=Ro.inflateSetDictionary(A,i),n===Op?n=Ro.inflate(A,o):n===cb&&(n=Nm));A.avail_in>0&&n===xm&&A.state.wrap>0&&t[A.next_in]!==0;)Ro.inflateReset(A),n=Ro.inflate(A,o);switch(n){case yie:case cb:case Nm:case Qie:return this.onEnd(n),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(A.avail_out===0||n===xm))if(this.options.to==="string"){let a=Lp.utf8border(A.output,A.next_out),c=A.next_out-a,u=Lp.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===Op&&s===0)){if(n===xm)return n=Ro.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(A.avail_in===0)break}}return!0},bp.prototype.onData=function(t){this.chunks.push(t)},bp.prototype.onEnd=function(t){t===Op&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=xI.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Km(t,e){const A=new bp(e);if(A.push(t),A.err)throw A.msg||Pl[A.err];return A.result}function Rie(t,e){return e=e||{},e.raw=!0,Km(t,e)}var Die=bp,Tie=Km,Uie=Rie,Lie=Km,Fie=Mp,Oie={Inflate:Die,inflate:Tie,inflateRaw:Uie,ungzip:Lie,constants:Fie};const{Inflate:bie,inflate:xie,inflateRaw:URe,ungzip:LRe}=Oie;var ub=bie,Nie=xie;const lb=[];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;lb[t]=e}const hb=4294967295;function Kie(t,e,A){let r=t;for(let i=0;i<A;i++)r=lb[(r^e[i])&255]^r>>>8;return r}function kie(t,e){return(Kie(hb,t,e)^hb)>>>0}function gb(t,e,A){const r=t.readUint32(),i=kie(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 db(t,e,A){for(let r=0;r<A;r++)e[r]=t[r]}function pb(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 fb(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 Eb(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 Cb(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]+Pie(e[n-i],A[n],A[n-i])&255}}function Pie(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 Gie(t,e,A,r,i,n){switch(t){case 0:db(e,A,i);break;case 1:pb(e,A,i,n);break;case 2:fb(e,A,r,i);break;case 3:Eb(e,A,r,i,n);break;case 4:Cb(e,A,r,i,n);break;default:throw new Error(`Unsupported filter: ${t}`)}}const jie=new Uint16Array([255]),Yie=new Uint8Array(jie.buffer)[0]===255;function Hie(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 I=0;I<h;I++){const E=e[c++],v=e.subarray(c,c+p);c+=p;const m=new Uint8Array(p);Gie(E,v,m,C,p,s),C.set(m);for(let M=0;M<g;M++){const O=l.x+M*l.xStep,x=l.y+I*l.yStep;if(!(O>=A||x>=r))for(let P=0;P<s;P++)a[(x*A+O)*s+P]=m[M*s+P]}}}if(n===16){const u=new Uint16Array(a.buffer);if(Yie)for(let l=0;l<u.length;l++)u[l]=zie(u[l]);return u}else return a}function zie(t){return(t&255)<<8|t>>8&255}const Jie=new Uint16Array([255]),qie=new Uint8Array(Jie.buffer)[0]===255,Vie=new Uint8Array(0);function Ib(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=Vie,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:db(l,g,s);break;case 1:pb(l,g,s,o);break;case 2:fb(l,g,c,s);break;case 3:Eb(l,g,c,s,o);break;case 4:Cb(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(qie)for(let p=0;p<h.length;p++)h[p]=Wie(h[p]);return h}else return a}function Wie(t){return(t&255)<<8|t>>8&255}const HI=Uint8Array.of(137,80,78,71,13,10,26,10);function Bb(t){if(!Zie(t.readBytes(HI.length)))throw new Error("wrong PNG signature")}function Zie(t){if(t.length<HI.length)return!1;for(let e=0;e<HI.length;e++)if(t[e]!==HI[e])return!1;return!0}const Xie="tEXt",_ie=0,vb=new TextDecoder("latin1");function $ie(t){if(tne(t),t.length===0||t.length>79)throw new Error("keyword length must be between 1 and 79")}const ene=/^[\u0000-\u00FF]*$/;function tne(t){if(!ene.test(t))throw new Error("invalid latin1 text")}function Ane(t,e,A){const r=wb(e);t[r]=rne(e,A-r.length-1)}function wb(t){for(t.mark();t.readByte()!==_ie;);const e=t.offset;t.reset();const A=vb.decode(t.readBytes(e-t.offset-1));return t.skip(1),$ie(A),A}function rne(t,e){return vb.decode(t.readBytes(e))}const yn={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},km={UNKNOWN:-1,DEFLATE:0},Sb={UNKNOWN:-1,ADAPTIVE:0},Pm={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},zI={NONE:0,BACKGROUND:1,PREVIOUS:2},Gm={SOURCE:0,OVER:1};class ine extends am{constructor(A,r={}){super(A);Ht(this,"_checkCrc");Ht(this,"_inflator");Ht(this,"_png");Ht(this,"_apng");Ht(this,"_end");Ht(this,"_hasPalette");Ht(this,"_palette");Ht(this,"_hasTransparency");Ht(this,"_transparency");Ht(this,"_compressionMethod");Ht(this,"_filterMethod");Ht(this,"_interlaceMethod");Ht(this,"_colorType");Ht(this,"_isAnimated");Ht(this,"_numberOfFrames");Ht(this,"_numberOfPlays");Ht(this,"_frames");Ht(this,"_writingDataChunks");const{checkCrc:i=!1}=r;this._checkCrc=i,this._inflator=new ub,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=km.UNKNOWN,this._filterMethod=Sb.UNKNOWN,this._interlaceMethod=Pm.UNKNOWN,this._colorType=yn.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(Bb(this);!this._end;){const A=this.readUint32(),r=this.readChars(4);this.decodeChunk(A,r)}return this.decodeImage(),this._png}decodeApng(){for(Bb(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 Xie:Ane(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?gb(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?gb(this,A+4,r):this.skip(4)}decodeIHDR(){const A=this._png;A.width=this.readUint32(),A.height=this.readUint32(),A.depth=nne(this.readUint8());const r=this.readUint8();this._colorType=r;let i;switch(r){case yn.GREYSCALE:i=1;break;case yn.TRUECOLOUR:i=3;break;case yn.INDEXED_COLOUR:i=1;break;case yn.GREYSCALE_ALPHA:i=2;break;case yn.TRUECOLOUR_ALPHA:i=4;break;case yn.UNKNOWN:default:throw new Error(`Unknown color type: ${r}`)}if(this._png.channels=i,this._compressionMethod=this.readUint8(),this._compressionMethod!==km.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 yn.GREYSCALE:case yn.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 yn.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 yn.UNKNOWN:case yn.GREYSCALE_ALPHA:case yn.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(A){const r=wb(this),i=this.readUint8();if(i!==km.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${i}`);const n=this.readBytes(A-r.length-2);this._png.iccEmbeddedProfile={name:r,profile:Nie(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=Ib({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 zI.NONE:break;case zI.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 zI.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 Gm.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 Gm.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!==Sb.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===Pm.NO_INTERLACE)this._png.data=Ib({data:A,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===Pm.ADAM7)this._png.data=Hie({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:zI.NONE,blendOp:Gm.SOURCE,data:A}),this._inflator=new ub,this._writingDataChunks=!1}}function nne(t){if(t!==1&&t!==2&&t!==4&&t!==8&&t!==16)throw new Error(`invalid bit depth: ${t}`);return t}var mb;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.METRE=1]="METRE"})(mb||(mb={}));function sne(t,e){return new ine(t,e).decode()}/** @license
|
|
37
37
|
*
|
|
38
38
|
* jsPDF - PDF Document creation from JavaScript
|