1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.VoiceProfileEnrollmentCancellationDetails = exports.VoiceProfileEnrollmentResult = void 0;\n/* eslint-disable max-classes-per-file */\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\n/**\n * Output format\n * @class VoiceProfileEnrollmentResult\n */\nclass VoiceProfileEnrollmentResult {\n constructor(reason, json, statusText) {\n this.privReason = reason;\n this.privProperties = new Exports_js_2.PropertyCollection();\n if (this.privReason !== Exports_js_2.ResultReason.Canceled) {\n if (!!json) {\n this.privDetails = JSON.parse(json);\n if (this.privDetails.enrollmentStatus.toLowerCase() === \"enrolling\") {\n this.privReason = Exports_js_2.ResultReason.EnrollingVoiceProfile;\n }\n }\n } else {\n this.privErrorDetails = statusText;\n this.privProperties.setProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.ServiceError]);\n }\n }\n get reason() {\n return this.privReason;\n }\n get enrollmentsCount() {\n return this.privDetails.enrollmentsCount;\n }\n get enrollmentsLength() {\n return this.privDetails.enrollmentsLength;\n }\n get properties() {\n return this.privProperties;\n }\n get enrollmentResultDetails() {\n return this.privDetails;\n }\n get errorDetails() {\n return this.privErrorDetails;\n }\n static FromIdentificationProfileList(json) {\n const results = [];\n for (const item of json.value) {\n const reason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ? Exports_js_2.ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ? Exports_js_2.ResultReason.EnrolledVoiceProfile : Exports_js_2.ResultReason.Canceled;\n const result = new VoiceProfileEnrollmentResult(reason, null, null);\n result.privDetails = this.getIdentificationDetails(item);\n results.push(result);\n }\n return results;\n }\n static FromVerificationProfileList(json) {\n const results = [];\n for (const item of json.value) {\n const reason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ? Exports_js_2.ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ? Exports_js_2.ResultReason.EnrolledVoiceProfile : Exports_js_2.ResultReason.Canceled;\n const result = new VoiceProfileEnrollmentResult(reason, null, null);\n result.privDetails = this.getVerificationDetails(item);\n results.push(result);\n }\n return results;\n }\n static getIdentificationDetails(json) {\n return {\n audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\n audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\n enrollmentStatus: json.enrollmentStatus,\n enrollmentsCount: json.enrollmentsCount || 0,\n enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\n enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\n profileId: json.profileId || json.identificationProfileId,\n remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\n };\n }\n static getVerificationDetails(json) {\n return {\n audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\n audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\n enrollmentStatus: json.enrollmentStatus,\n enrollmentsCount: json.enrollmentsCount,\n enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\n enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\n profileId: json.profileId || json.verificationProfileId,\n remainingEnrollmentsCount: json.remainingEnrollments || json.remainingEnrollmentsCount,\n remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\n };\n }\n}\nexports.VoiceProfileEnrollmentResult = VoiceProfileEnrollmentResult;\n/**\n * @class VoiceProfileEnrollmentCancellationDetails\n */\nclass VoiceProfileEnrollmentCancellationDetails extends Exports_js_2.CancellationDetailsBase {\n constructor(reason, errorDetails, errorCode) {\n super(reason, errorDetails, errorCode);\n }\n /**\n * Creates an instance of VoiceProfileEnrollmentCancellationDetails object for the canceled VoiceProfileEnrollmentResult.\n * @member VoiceProfileEnrollmentCancellationDetails.fromResult\n * @function\n * @public\n * @param {VoiceProfileEnrollmentResult} result - The result that was canceled.\n * @returns {VoiceProfileEnrollmentCancellationDetails} The cancellation details object being created.\n */\n static fromResult(result) {\n const reason = Exports_js_2.CancellationReason.Error;\n let errorCode = Exports_js_2.CancellationErrorCode.NoError;\n if (!!result.properties) {\n errorCode = Exports_js_2.CancellationErrorCode[result.properties.getProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.NoError])]; //eslint-disable-line\n }\n return new VoiceProfileEnrollmentCancellationDetails(reason, result.errorDetails, errorCode);\n }\n}\nexports.VoiceProfileEnrollmentCancellationDetails = VoiceProfileEnrollmentCancellationDetails;","map":{"version":3,"names":["Object","defineProperty","exports","value","VoiceProfileEnrollmentCancellationDetails","VoiceProfileEnrollmentResult","Exports_js_1","require","Exports_js_2","constructor","reason","json","statusText","privReason","privProperties","PropertyCollection","ResultReason","Canceled","privDetails","JSON","parse","enrollmentStatus","toLowerCase","EnrollingVoiceProfile","privErrorDetails","setProperty","CancellationErrorCodePropertyName","CancellationErrorCode","ServiceError","enrollmentsCount","enrollmentsLength","properties","enrollmentResultDetails","errorDetails","FromIdentificationProfileList","results","item","EnrolledVoiceProfile","result","getIdentificationDetails","push","FromVerificationProfileList","getVerificationDetails","audioLength","parseFloat","audioSpeechLength","enrollmentsSpeechLength","profileId","identificationProfileId","remainingEnrollmentsSpeechLength","verificationProfileId","remainingEnrollmentsCount","remainingEnrollments","CancellationDetailsBase","errorCode","fromResult","CancellationReason","Error","NoError","getProperty"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/VoiceProfileEnrollmentResult.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VoiceProfileEnrollmentCancellationDetails = exports.VoiceProfileEnrollmentResult = void 0;\n/* eslint-disable max-classes-per-file */\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"./Exports.js\");\n/**\n * Output format\n * @class VoiceProfileEnrollmentResult\n */\nclass VoiceProfileEnrollmentResult {\n constructor(reason, json, statusText) {\n this.privReason = reason;\n this.privProperties = new Exports_js_2.PropertyCollection();\n if (this.privReason !== Exports_js_2.ResultReason.Canceled) {\n if (!!json) {\n this.privDetails = JSON.parse(json);\n if (this.privDetails.enrollmentStatus.toLowerCase() === \"enrolling\") {\n this.privReason = Exports_js_2.ResultReason.EnrollingVoiceProfile;\n }\n }\n }\n else {\n this.privErrorDetails = statusText;\n this.privProperties.setProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.ServiceError]);\n }\n }\n get reason() {\n return this.privReason;\n }\n get enrollmentsCount() {\n return this.privDetails.enrollmentsCount;\n }\n get enrollmentsLength() {\n return this.privDetails.enrollmentsLength;\n }\n get properties() {\n return this.privProperties;\n }\n get enrollmentResultDetails() {\n return this.privDetails;\n }\n get errorDetails() {\n return this.privErrorDetails;\n }\n static FromIdentificationProfileList(json) {\n const results = [];\n for (const item of json.value) {\n const reason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ?\n Exports_js_2.ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ?\n Exports_js_2.ResultReason.EnrolledVoiceProfile : Exports_js_2.ResultReason.Canceled;\n const result = new VoiceProfileEnrollmentResult(reason, null, null);\n result.privDetails = this.getIdentificationDetails(item);\n results.push(result);\n }\n return results;\n }\n static FromVerificationProfileList(json) {\n const results = [];\n for (const item of json.value) {\n const reason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ?\n Exports_js_2.ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ?\n Exports_js_2.ResultReason.EnrolledVoiceProfile : Exports_js_2.ResultReason.Canceled;\n const result = new VoiceProfileEnrollmentResult(reason, null, null);\n result.privDetails = this.getVerificationDetails(item);\n results.push(result);\n }\n return results;\n }\n static getIdentificationDetails(json) {\n return {\n audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\n audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\n enrollmentStatus: json.enrollmentStatus,\n enrollmentsCount: json.enrollmentsCount || 0,\n enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\n enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\n profileId: json.profileId || json.identificationProfileId,\n remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\n };\n }\n static getVerificationDetails(json) {\n return {\n audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\n audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\n enrollmentStatus: json.enrollmentStatus,\n enrollmentsCount: json.enrollmentsCount,\n enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\n enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\n profileId: json.profileId || json.verificationProfileId,\n remainingEnrollmentsCount: json.remainingEnrollments || json.remainingEnrollmentsCount,\n remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\n };\n }\n}\nexports.VoiceProfileEnrollmentResult = VoiceProfileEnrollmentResult;\n/**\n * @class VoiceProfileEnrollmentCancellationDetails\n */\nclass VoiceProfileEnrollmentCancellationDetails extends Exports_js_2.CancellationDetailsBase {\n constructor(reason, errorDetails, errorCode) {\n super(reason, errorDetails, errorCode);\n }\n /**\n * Creates an instance of VoiceProfileEnrollmentCancellationDetails object for the canceled VoiceProfileEnrollmentResult.\n * @member VoiceProfileEnrollmentCancellationDetails.fromResult\n * @function\n * @public\n * @param {VoiceProfileEnrollmentResult} result - The result that was canceled.\n * @returns {VoiceProfileEnrollmentCancellationDetails} The cancellation details object being created.\n */\n static fromResult(result) {\n const reason = Exports_js_2.CancellationReason.Error;\n let errorCode = Exports_js_2.CancellationErrorCode.NoError;\n if (!!result.properties) {\n errorCode = Exports_js_2.CancellationErrorCode[result.properties.getProperty(Exports_js_1.CancellationErrorCodePropertyName, Exports_js_2.CancellationErrorCode[Exports_js_2.CancellationErrorCode.NoError])]; //eslint-disable-line\n }\n return new VoiceProfileEnrollmentCancellationDetails(reason, result.errorDetails, errorCode);\n }\n}\nexports.VoiceProfileEnrollmentCancellationDetails = VoiceProfileEnrollmentCancellationDetails;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,yCAAyC,GAAGF,OAAO,CAACG,4BAA4B,GAAG,KAAK,CAAC;AACjG;AACA,MAAMC,YAAY,GAAGC,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAMC,YAAY,GAAGD,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA,MAAMF,4BAA4B,CAAC;EAC/BI,WAAWA,CAACC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE;IAClC,IAAI,CAACC,UAAU,GAAGH,MAAM;IACxB,IAAI,CAACI,cAAc,GAAG,IAAIN,YAAY,CAACO,kBAAkB,CAAC,CAAC;IAC3D,IAAI,IAAI,CAACF,UAAU,KAAKL,YAAY,CAACQ,YAAY,CAACC,QAAQ,EAAE;MACxD,IAAI,CAAC,CAACN,IAAI,EAAE;Q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UAAU,CAACjC,IAAI,CAACsC,gCAAgC,CAAC,GAAG;IAClI,CAAC;EACL;AACJ;AACA/C,OAAO,CAACG,4BAA4B,GAAGA,4BAA4B;AACnE;AACA;AACA;AACA,MAAMD,yCAAyC,SAASI,YAAY,CAAC6C,uBAAuB,CAAC;EACzF5C,WAAWA,CAACC,MAAM,EAAEuB,YAAY,EAAEqB,SAAS,EAAE;IACzC,KAAK,CAAC5C,MAAM,EAAEuB,YAAY,EAAEqB,SAAS,CAAC;EAC1C;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACI,OAAOC,UAAUA,CAACjB,MAAM,EAAE;IACtB,MAAM5B,MAAM,GAAGF,YAAY,CAACgD,kBAAkB,CAACC,KAAK;IACpD,IAAIH,SAAS,GAAG9C,YAAY,CAACmB,qBAAqB,CAAC+B,OAAO;IAC1D,IAAI,CAAC,CAACpB,MAAM,CAACP,UAAU,EAAE;MACrBuB,SAAS,GAAG9C,YAAY,CAACmB,qBAAqB,CAACW,MAAM,CAACP,UAAU,CAAC4B,WAAW,CAACrD,YAAY,CAACoB,iCAAiC,EAAElB,YAAY,CAACmB,qBAAqB,CAACnB,YAAY,CAACmB,qBAAqB,CAAC+B,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACnN;IACA,OAAO,IAAItD,yCAAyC,CAACM,MAAM,EAAE4B,MAAM,CAACL,YAAY,EAAEqB,SAAS,CAAC;EAChG;AACJ;AACApD,OAAO,CAACE,yCAAyC,GAAGA,yCAAyC","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}
|