@magmamath/students-features 1.3.23-rc.21 → 1.3.23-rc.3
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/commonjs/features/voice/playing/components/VoiceTranscription.js +48 -39
- package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +8 -7
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
- package/dist/commonjs/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +7 -8
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +37 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js +1 -24
- package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +66 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +175 -46
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +15 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/commonjs/features/voice/types.js.map +1 -1
- package/dist/commonjs/index.js +0 -12
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscription.js +47 -40
- package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +7 -8
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
- package/dist/module/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +5 -6
- package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +32 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
- package/dist/module/features/voice/playing/model/Player.model.js +1 -24
- package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +61 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +177 -48
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +2 -2
- package/dist/module/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +10 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +2 -2
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/module/features/voice/types.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/commonjs/features/voice/index.d.ts +0 -1
- package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +0 -3
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/{module/features/voice/playing/model/TranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/types.d.ts +1 -4
- package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +0 -1
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/index.d.ts +0 -1
- package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +0 -3
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/{commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts → module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/types.d.ts +1 -4
- package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +0 -1
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/package.json +1 -28
- package/src/features/voice/index.ts +0 -1
- package/src/features/voice/playing/components/VoiceTranscription.tsx +60 -43
- package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +4 -4
- package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +9 -8
- package/src/features/voice/playing/hooks/{useDropdownAnimation.ts → useVoiceTranscription.ts} +5 -5
- package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +44 -0
- package/src/features/voice/playing/model/Player.model.ts +1 -26
- package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +80 -0
- package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
- package/src/features/voice/playing/model/VoicePlayer.model.ts +196 -56
- package/src/features/voice/playing/model/{Dropdown.model.ts → VoiceTranscription.model.ts} +1 -1
- package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +11 -0
- package/src/features/voice/playing/model/{TranscriptionsCollection.ts → VoiceTranscriptionsCollection.ts} +1 -1
- package/src/features/voice/types.ts +0 -9
- package/src/index.ts +0 -1
- package/dist/commonjs/features/translation/constants.js +0 -11
- package/dist/commonjs/features/translation/constants.js.map +0 -1
- package/dist/commonjs/features/translation/helpers.js +0 -60
- package/dist/commonjs/features/translation/helpers.js.map +0 -1
- package/dist/commonjs/features/translation/index.js +0 -105
- package/dist/commonjs/features/translation/index.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationModel.js +0 -122
- package/dist/commonjs/features/translation/model/TranslationModel.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +0 -142
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationService.js +0 -112
- package/dist/commonjs/features/translation/model/TranslationService.js.map +0 -1
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +0 -314
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +0 -50
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +0 -230
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google.types.js +0 -2
- package/dist/commonjs/features/translation/providers/google.types.js.map +0 -1
- package/dist/commonjs/features/translation/providers/translation.interface.js +0 -49
- package/dist/commonjs/features/translation/providers/translation.interface.js.map +0 -1
- package/dist/commonjs/features/translation/types.js +0 -2
- package/dist/commonjs/features/translation/types.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -128
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js +0 -183
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -82
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/Translation.model.js +0 -62
- package/dist/commonjs/features/voice/playing/model/Translation.model.js.map +0 -1
- package/dist/module/features/translation/constants.js +0 -7
- package/dist/module/features/translation/constants.js.map +0 -1
- package/dist/module/features/translation/helpers.js +0 -53
- package/dist/module/features/translation/helpers.js.map +0 -1
- package/dist/module/features/translation/index.js +0 -12
- package/dist/module/features/translation/index.js.map +0 -1
- package/dist/module/features/translation/model/TranslationModel.js +0 -117
- package/dist/module/features/translation/model/TranslationModel.js.map +0 -1
- package/dist/module/features/translation/model/TranslationPreprocessor.js +0 -137
- package/dist/module/features/translation/model/TranslationPreprocessor.js.map +0 -1
- package/dist/module/features/translation/model/TranslationService.js +0 -107
- package/dist/module/features/translation/model/TranslationService.js.map +0 -1
- package/dist/module/features/translation/preserve/wordsToPreserve.js +0 -310
- package/dist/module/features/translation/preserve/wordsToPreserve.js.map +0 -1
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +0 -45
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
- package/dist/module/features/translation/providers/google/supportedLanguages.js +0 -225
- package/dist/module/features/translation/providers/google/supportedLanguages.js.map +0 -1
- package/dist/module/features/translation/providers/google.types.js +0 -2
- package/dist/module/features/translation/providers/google.types.js.map +0 -1
- package/dist/module/features/translation/providers/translation.interface.js +0 -44
- package/dist/module/features/translation/providers/translation.interface.js.map +0 -1
- package/dist/module/features/translation/types.js +0 -2
- package/dist/module/features/translation/types.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -123
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
- package/dist/module/features/voice/playing/model/Dropdown.model.js.map +0 -1
- package/dist/module/features/voice/playing/model/PlaybackController.js +0 -178
- package/dist/module/features/voice/playing/model/PlaybackController.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -77
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
- package/dist/module/features/voice/playing/model/Translation.model.js +0 -57
- package/dist/module/features/voice/playing/model/Translation.model.js.map +0 -1
- package/dist/typescript/commonjs/features/translation/constants.d.ts +0 -5
- package/dist/typescript/commonjs/features/translation/constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/helpers.d.ts +0 -9
- package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/index.d.ts +0 -12
- package/dist/typescript/commonjs/features/translation/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +0 -33
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +0 -34
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +0 -40
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +0 -3
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +0 -209
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +0 -15
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +0 -30
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/types.d.ts +0 -27
- package/dist/typescript/commonjs/features/translation/types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +0 -28
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +0 -25
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/constants.d.ts +0 -5
- package/dist/typescript/module/features/translation/constants.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/helpers.d.ts +0 -9
- package/dist/typescript/module/features/translation/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/index.d.ts +0 -12
- package/dist/typescript/module/features/translation/index.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +0 -33
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +0 -34
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts +0 -40
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +0 -3
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +0 -209
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google.types.d.ts +0 -15
- package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +0 -30
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/types.d.ts +0 -27
- package/dist/typescript/module/features/translation/types.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +0 -28
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +0 -25
- package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts.map +0 -1
- package/src/features/translation/constants.ts +0 -4
- package/src/features/translation/helpers.ts +0 -63
- package/src/features/translation/index.ts +0 -30
- package/src/features/translation/model/TranslationModel.ts +0 -174
- package/src/features/translation/model/TranslationPreprocessor.ts +0 -171
- package/src/features/translation/model/TranslationService.ts +0 -148
- package/src/features/translation/preserve/wordsToPreserve.ts +0 -87
- package/src/features/translation/providers/google/GoogleTranslationProvider.ts +0 -50
- package/src/features/translation/providers/google/supportedLanguages.ts +0 -229
- package/src/features/translation/providers/google.types.ts +0 -16
- package/src/features/translation/providers/translation.interface.ts +0 -63
- package/src/features/translation/types.ts +0 -30
- package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +0 -171
- package/src/features/voice/playing/model/PlaybackController.ts +0 -213
- package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +0 -88
- package/src/features/voice/playing/model/Translation.model.ts +0 -75
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_helpers","require","TranslationProvider","glossaries","constructor","supportedLanguages","Set","isTargetSupported","language","resolveLanguage","has","base","split","getSupportedLanguages","values","applyGlossary","text","targetLanguage","glossary","replaceMappedTokens","exports"],"sourceRoot":"../../../../../src","sources":["features/translation/providers/translation.interface.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAWO,MAAeC,mBAAmB,CAAC;EAErBC,UAAU,GAAqB,CAAC,CAAC;EAE1CC,WAAWA,CAAC;IAAEC,kBAAkB;IAAEF,UAAU,GAAG,CAAC;EAA4B,CAAC,EAAE;IACvF,IAAI,CAACE,kBAAkB,GAAG,IAAIC,GAAG,CAACD,kBAAkB,CAAC;IACrD,IAAI,CAACF,UAAU,GAAGA,UAAU;EAC9B;EAaOI,iBAAiBA,CAACC,QAAgB,EAAE;IACzC,OAAO,IAAI,CAACC,eAAe,CAACD,QAAQ,CAAC,KAAK,IAAI;EAChD;;EAEA;AACF;AACA;AACA;AACA;AACA;EACSC,eAAeA,CAACD,QAAgB,EAAiB;IACtD,IAAI,CAACA,QAAQ,EAAE,OAAO,IAAI;IAC1B,IAAI,IAAI,CAACH,kBAAkB,CAACK,GAAG,CAACF,QAAQ,CAAC,EAAE,OAAOA,QAAQ;IAC1D,MAAMG,IAAI,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnC,IAAID,IAAI,KAAKH,QAAQ,IAAI,IAAI,CAACH,kBAAkB,CAACK,GAAG,CAACC,IAAI,CAAC,EAAE,OAAOA,IAAI;IACvE,OAAO,IAAI;EACb;EAEOE,qBAAqBA,CAAA,EAAG;IAC7B,OAAO,IAAI,CAACR,kBAAkB,CAACS,MAAM,CAAC,CAAC;EACzC;;EAEA;AACF;AACA;AACA;EACSC,aAAaA,CAACC,IAAY,EAAEC,cAAsB,EAAU;IACjE,MAAMC,QAAQ,GAAG,IAAI,CAACf,UAAU,CAACc,cAAc,CAAC;IAChD,IAAI,CAACC,QAAQ,EAAE,OAAOF,IAAI;IAC1B,OAAO,IAAAG,4BAAmB,EAACH,IAAI,EAAEE,QAAQ,CAAC;EAC5C;AACF;AAACE,OAAA,CAAAlB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["features/translation/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_effectorReact","_reactNativeReanimated","_constants","useDropdownAnimation","model","isExpanded","useUnit","$isExpanded","contentHeight","useSharedValue","animationProgress","onListLayout","event","measuredHeight","nativeEvent","layout","height","value","withTiming","duration","listAnimatedStyle","useAnimatedStyle","interpolate","DROPDOWN_MAX_CONTENT_HEIGHT","opacity","iconAnimatedStyle","rotation","transform","rotate","useEffect","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useDropdownAnimation.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAGO,MAAMI,oBAAoB,GAAIC,KAAoB,IAAK;EAC5D,MAAMC,UAAU,GAAG,IAAAC,sBAAO,EAACF,KAAK,CAACG,WAAW,CAAC;EAE7C,MAAMC,aAAa,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EACvC,MAAMC,iBAAiB,GAAG,IAAAD,qCAAc,EAACJ,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC;EAE5D,MAAMM,YAAY,GAAIC,KAAwB,IAAK;IACjD,MAAMC,cAAc,GAAGD,KAAK,CAACE,WAAW,CAACC,MAAM,CAACC,MAAM;IACtD,IAAIH,cAAc,IAAI,CAAC,EAAE;IACzBL,aAAa,CAACS,KAAK,GACjBT,aAAa,CAACS,KAAK,KAAK,CAAC,GAAGJ,cAAc,GAAG,IAAAK,iCAAU,EAACL,cAAc,EAAE;MAAEM,QAAQ,EAAE;IAAI,CAAC,CAAC;EAC9F,CAAC;EAED,MAAMC,iBAAiB,GAAG,IAAAC,uCAAgB,EAAC,MAAM;IAC/C,MAAML,MAAM,GAAG,IAAAM,kCAAW,EACxBZ,iBAAiB,CAACO,KAAK,EACvB,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,CAAC,CAAC,EAAET,aAAa,CAACS,KAAK,IAAIM,sCAA2B,CACxD,CAAC;IAED,MAAMC,OAAO,GAAG,IAAAF,kCAAW,EAACZ,iBAAiB,CAACO,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO;MACLD,MAAM;MACNQ;IACF,CAAC;EACH,CAAC,EAAE,CAACd,iBAAiB,EAAEF,aAAa,CAAC,CAAC;EAEtC,MAAMiB,iBAAiB,GAAG,IAAAJ,uCAAgB,EAAC,MAAM;IAC/C,MAAMK,QAAQ,GAAG,IAAAJ,kCAAW,EAACZ,iBAAiB,CAACO,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEvE,OAAO;MACLU,SAAS,EAAE,CAAC;QAAEC,MAAM,EAAE,GAAGF,QAAQ;MAAM,CAAC;IAC1C,CAAC;EACH,CAAC,EAAE,CAAChB,iBAAiB,CAAC,CAAC;EAEvB,IAAAmB,gBAAS,EAAC,MAAM;IACdnB,iBAAiB,CAACO,KAAK,GAAG,IAAAC,iCAAU,EAACb,UAAU,GAAG,CAAC,GAAG,CAAC,EAAE;MAAEc,QAAQ,EAAE;IAAI,CAAC,CAAC;EAC7E,CAAC,EAAE,CAACd,UAAU,EAAEK,iBAAiB,CAAC,CAAC;EAEnC,OAAO;IACLL,UAAU;IACVe,iBAAiB;IACjBK,iBAAiB;IACjBd;EACF,CAAC;AACH,CAAC;AAAAmB,OAAA,CAAA3B,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useVoiceTranscriptionController = void 0;
|
|
7
|
-
var _effectorReact = require("effector-react");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactI18next = require("react-i18next");
|
|
10
|
-
var _constants = require("../../constants.js");
|
|
11
|
-
var _helpers = require("../../helpers.js");
|
|
12
|
-
var _supportedLanguages = require("../../../translation/providers/google/supportedLanguages.js");
|
|
13
|
-
var _i18n = require("../../../../i18n/i18n.js");
|
|
14
|
-
const useVoiceTranscriptionController = ({
|
|
15
|
-
model,
|
|
16
|
-
answers,
|
|
17
|
-
attemptOffset,
|
|
18
|
-
attemptsCount,
|
|
19
|
-
problemId
|
|
20
|
-
}) => {
|
|
21
|
-
const t = (0, _i18n.useText)();
|
|
22
|
-
const {
|
|
23
|
-
i18n
|
|
24
|
-
} = (0, _reactI18next.useTranslation)();
|
|
25
|
-
const [playerState, isLoadingTranscripts, isTranslationActive, translations, isTranslating] = (0, _effectorReact.useUnit)([model.$playerState, model.loader.loadTranscriptForAttempt.pending, model.translation.$isActive, model.translation.$translations, model.translation.translate.pending]);
|
|
26
|
-
const activeAttempt = (0, _helpers.getActiveAttempt)(attemptOffset, attemptsCount);
|
|
27
|
-
const answersKey = (0, _react.useMemo)(() => answers.map(a => `${a._id}:${a.audioFileId ?? ''}`).join(','), [answers]);
|
|
28
|
-
const activeAudioFileId = activeAttempt !== null ? answers?.[activeAttempt - 1]?.audioFileId : undefined;
|
|
29
|
-
const hasActiveAudio = activeAudioFileId !== undefined;
|
|
30
|
-
const anyAttemptHasAudio = (0, _react.useMemo)(() => answers.some(a => !!a.audioFileId), [answers]);
|
|
31
|
-
const cachedEntry = activeAudioFileId ? model.loader.getCachedTranscript(activeAudioFileId) : undefined;
|
|
32
|
-
const activeTranscript = cachedEntry?.text ?? null;
|
|
33
|
-
const hasTranscriptText = !!activeTranscript && activeTranscript !== _constants.NO_AUDIO_BE_MESSAGE;
|
|
34
|
-
const isActiveTranscriptLoading = isLoadingTranscripts && hasActiveAudio && !activeTranscript;
|
|
35
|
-
const isSourceSameAsTarget = !!cachedEntry?.language && (0, _supportedLanguages.resolveGoogleLanguageCode)(cachedEntry.language) === (0, _supportedLanguages.resolveGoogleLanguageCode)(i18n.language);
|
|
36
|
-
const canTranslate = hasTranscriptText && !isSourceSameAsTarget;
|
|
37
|
-
const cachedTranslation = activeAttempt !== null ? translations[activeAttempt] : undefined;
|
|
38
|
-
const showTranslation = isTranslationActive && canTranslate;
|
|
39
|
-
const isTranslationLoading = showTranslation && !cachedTranslation && isTranslating;
|
|
40
|
-
const displayText = showTranslation ? cachedTranslation ?? activeTranscript : hasTranscriptText ? activeTranscript : t('voice.transcriptNotAvailable');
|
|
41
|
-
|
|
42
|
-
// Lifecycle effects
|
|
43
|
-
const answersRef = (0, _react.useRef)(answers);
|
|
44
|
-
answersRef.current = answers;
|
|
45
|
-
(0, _react.useEffect)(() => {
|
|
46
|
-
model.reinitializePlayer();
|
|
47
|
-
return () => {
|
|
48
|
-
model.stopAudio();
|
|
49
|
-
model.dropdown.setExpanded(false);
|
|
50
|
-
};
|
|
51
|
-
}, [model]);
|
|
52
|
-
(0, _react.useEffect)(() => {
|
|
53
|
-
model.dropdown.setExpanded(false);
|
|
54
|
-
model.resetPlayer();
|
|
55
|
-
}, [problemId]);
|
|
56
|
-
(0, _react.useEffect)(() => {
|
|
57
|
-
if (answersRef.current.some(a => a.audioFileId)) {
|
|
58
|
-
model.initializeWithAudios(answersRef.current);
|
|
59
|
-
}
|
|
60
|
-
}, [model, answersKey]);
|
|
61
|
-
(0, _react.useEffect)(() => {
|
|
62
|
-
model.stopAudio();
|
|
63
|
-
model.setCurrentAttempt(activeAttempt);
|
|
64
|
-
if (activeAttempt !== null) {
|
|
65
|
-
model.loader.loadTranscriptForAttempt(activeAttempt);
|
|
66
|
-
}
|
|
67
|
-
}, [model, activeAttempt, answersKey]);
|
|
68
|
-
|
|
69
|
-
// Auto-activate translation once per (problemId, activeAttempt) when translatable
|
|
70
|
-
const autoActivatedAttempts = (0, _react.useRef)(new Set());
|
|
71
|
-
(0, _react.useEffect)(() => {
|
|
72
|
-
autoActivatedAttempts.current.clear();
|
|
73
|
-
}, [problemId]);
|
|
74
|
-
(0, _react.useEffect)(() => {
|
|
75
|
-
if (canTranslate && activeAttempt !== null && !autoActivatedAttempts.current.has(activeAttempt)) {
|
|
76
|
-
autoActivatedAttempts.current.add(activeAttempt);
|
|
77
|
-
model.translation.setActive(true);
|
|
78
|
-
}
|
|
79
|
-
}, [canTranslate, activeAttempt, model]);
|
|
80
|
-
|
|
81
|
-
// Trigger translate when we should show translation but don't have it cached
|
|
82
|
-
(0, _react.useEffect)(() => {
|
|
83
|
-
if (showTranslation && activeAttempt !== null && !cachedTranslation && !isTranslating) {
|
|
84
|
-
model.translation.translate({
|
|
85
|
-
attemptNumber: activeAttempt,
|
|
86
|
-
targetLanguage: i18n.language
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}, [showTranslation, activeAttempt, cachedTranslation, isTranslating, i18n.language, model]);
|
|
90
|
-
|
|
91
|
-
// Auto-open dropdown when a translation successfully completes
|
|
92
|
-
(0, _react.useEffect)(() => {
|
|
93
|
-
return model.translation.translate.doneData.watch(result => {
|
|
94
|
-
if (result) {
|
|
95
|
-
model.dropdown.setExpanded(true);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}, [model]);
|
|
99
|
-
const onPlayPress = (0, _react.useCallback)(() => {
|
|
100
|
-
if (activeAttempt) {
|
|
101
|
-
model.translation.setActive(false);
|
|
102
|
-
model.togglePlayPause(activeAttempt);
|
|
103
|
-
}
|
|
104
|
-
}, [model, activeAttempt]);
|
|
105
|
-
const onTranslationToggle = (0, _react.useCallback)(() => {
|
|
106
|
-
model.translation.toggle();
|
|
107
|
-
model.dropdown.setExpanded(true);
|
|
108
|
-
}, [model]);
|
|
109
|
-
return {
|
|
110
|
-
display: {
|
|
111
|
-
text: displayText,
|
|
112
|
-
isLoading: isActiveTranscriptLoading || isTranslationLoading
|
|
113
|
-
},
|
|
114
|
-
flags: {
|
|
115
|
-
playerState: playerState,
|
|
116
|
-
hasActiveAudio,
|
|
117
|
-
anyAttemptHasAudio,
|
|
118
|
-
canTranslate,
|
|
119
|
-
isTranslationActive
|
|
120
|
-
},
|
|
121
|
-
actions: {
|
|
122
|
-
onPlayPress,
|
|
123
|
-
onTranslationToggle
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
exports.useVoiceTranscriptionController = useVoiceTranscriptionController;
|
|
128
|
-
//# sourceMappingURL=useVoiceTranscriptionController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effectorReact","require","_react","_reactI18next","_constants","_helpers","_supportedLanguages","_i18n","useVoiceTranscriptionController","model","answers","attemptOffset","attemptsCount","problemId","t","useText","i18n","useTranslation","playerState","isLoadingTranscripts","isTranslationActive","translations","isTranslating","useUnit","$playerState","loader","loadTranscriptForAttempt","pending","translation","$isActive","$translations","translate","activeAttempt","getActiveAttempt","answersKey","useMemo","map","a","_id","audioFileId","join","activeAudioFileId","undefined","hasActiveAudio","anyAttemptHasAudio","some","cachedEntry","getCachedTranscript","activeTranscript","text","hasTranscriptText","NO_AUDIO_BE_MESSAGE","isActiveTranscriptLoading","isSourceSameAsTarget","language","resolveGoogleLanguageCode","canTranslate","cachedTranslation","showTranslation","isTranslationLoading","displayText","answersRef","useRef","current","useEffect","reinitializePlayer","stopAudio","dropdown","setExpanded","resetPlayer","initializeWithAudios","setCurrentAttempt","autoActivatedAttempts","Set","clear","has","add","setActive","attemptNumber","targetLanguage","doneData","watch","result","onPlayPress","useCallback","togglePlayPause","onTranslationToggle","toggle","display","isLoading","flags","actions","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionController.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAc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,WAAW;MACjB6B,SAAS,EAAErC,yBAAyB,IAAIO;IAC1C,CAAC;IACD+B,KAAK,EAAE;MACLxE,WAAW,EAAEA,WAA0B;MACvCyB,cAAc;MACdC,kBAAkB;MAClBY,YAAY;MACZpC;IACF,CAAC;IACDuE,OAAO,EAAE;MACPR,WAAW;MACXG;IACF;EACF,CAAC;AACH,CAAC;AAAAM,OAAA,CAAApF,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","DropdownModel","toggleExpand","createEvent","setExpanded","reset","$isExpanded","restore","on","state","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Dropdown.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,aAAa,CAAC;EACTC,YAAY,GAAG,IAAAC,qBAAW,EAAC,CAAC;EAC5BC,WAAW,GAAG,IAAAD,qBAAW,EAAU,CAAC;EACpCE,KAAK,GAAG,IAAAF,qBAAW,EAAC,CAAC;EAErBG,WAAW,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACH,WAAW,EAAE,KAAK,CAAC,CAC3DI,EAAE,CAAC,IAAI,CAACN,YAAY,EAAGO,KAAK,IAAK,CAACA,KAAK,CAAC,CACxCJ,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;AACtB;AAACK,OAAA,CAAAT,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PlaybackController = void 0;
|
|
7
|
-
var _effector = require("effector");
|
|
8
|
-
var _PlayerModel = require("./Player.model.js");
|
|
9
|
-
class PlaybackController {
|
|
10
|
-
currentPlayingAttempt = null;
|
|
11
|
-
shouldPreventPlayback = false;
|
|
12
|
-
constructor(deps) {
|
|
13
|
-
this.collection = deps.collection;
|
|
14
|
-
this.player = deps.player;
|
|
15
|
-
this.downloader = deps.downloader;
|
|
16
|
-
this.player.playbackFinished.watch(() => this.clearCurrentAttempt());
|
|
17
|
-
}
|
|
18
|
-
togglePlayPause = attemptNumber => {
|
|
19
|
-
const playerState = this.player.$playerState.getState();
|
|
20
|
-
if (this.currentPlayingAttempt === attemptNumber && playerState === _PlayerModel.PlayerState.PLAYING) {
|
|
21
|
-
this.player.pause();
|
|
22
|
-
} else {
|
|
23
|
-
this.handlePlayAttempt(attemptNumber);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
preloadAudio = (0, _effector.createEffect)(async attemptNumber => {
|
|
27
|
-
const item = this.collection.get(attemptNumber);
|
|
28
|
-
if (!item) return;
|
|
29
|
-
if (this.collection.hasAudio(attemptNumber)) {
|
|
30
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (item.audioDownloadPromise) {
|
|
34
|
-
try {
|
|
35
|
-
await item.audioDownloadPromise;
|
|
36
|
-
} catch {}
|
|
37
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
await this.downloadAudio(attemptNumber);
|
|
42
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (error instanceof Error && error.name === 'AbortError') return;
|
|
45
|
-
console.error('Audio preload error:', error);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
primePlayerIfIdle(attemptNumber) {
|
|
49
|
-
if (this.player.$playerState.getState() !== _PlayerModel.PlayerState.IDLE) return;
|
|
50
|
-
if (this.currentPlayingAttempt !== null) return;
|
|
51
|
-
const audioUri = this.collection.get(attemptNumber)?.audioUri;
|
|
52
|
-
if (!audioUri) return;
|
|
53
|
-
this.player.prime(audioUri);
|
|
54
|
-
}
|
|
55
|
-
halt() {
|
|
56
|
-
this.shouldPreventPlayback = true;
|
|
57
|
-
this.abortAllDownloads();
|
|
58
|
-
this.player.stop();
|
|
59
|
-
this.clearCurrentAttempt();
|
|
60
|
-
}
|
|
61
|
-
releaseResources() {
|
|
62
|
-
this.collection.getAll().forEach(item => {
|
|
63
|
-
if (item.controller) {
|
|
64
|
-
this.downloader.abortDownload(item.controller);
|
|
65
|
-
}
|
|
66
|
-
if (item.audioUri?.startsWith('blob:')) {
|
|
67
|
-
try {
|
|
68
|
-
URL.revokeObjectURL(item.audioUri);
|
|
69
|
-
} catch (e) {}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
clearCurrentAttempt() {
|
|
74
|
-
this.currentPlayingAttempt = null;
|
|
75
|
-
}
|
|
76
|
-
abortAllDownloads() {
|
|
77
|
-
this.collection.getAll().forEach(item => {
|
|
78
|
-
if (item.controller && item.audioLoading) {
|
|
79
|
-
this.downloader.abortDownload(item.controller);
|
|
80
|
-
this.collection.update(item.attemptNumber, {
|
|
81
|
-
audioLoading: false,
|
|
82
|
-
controller: undefined,
|
|
83
|
-
audioDownloadPromise: undefined
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async downloadAudio(attemptNumber) {
|
|
89
|
-
const item = this.collection.get(attemptNumber);
|
|
90
|
-
if (!item) return;
|
|
91
|
-
const {
|
|
92
|
-
collectionItem,
|
|
93
|
-
downloadPromise
|
|
94
|
-
} = await this.downloader.download({
|
|
95
|
-
audioFileId: item.audioFileId,
|
|
96
|
-
attemptNumber
|
|
97
|
-
});
|
|
98
|
-
this.collection.update(attemptNumber, collectionItem);
|
|
99
|
-
try {
|
|
100
|
-
const result = await downloadPromise;
|
|
101
|
-
this.collection.update(attemptNumber, {
|
|
102
|
-
audioUri: result.uri,
|
|
103
|
-
audioLoading: false,
|
|
104
|
-
audioError: undefined,
|
|
105
|
-
controller: undefined,
|
|
106
|
-
audioDownloadPromise: undefined
|
|
107
|
-
});
|
|
108
|
-
} catch (error) {
|
|
109
|
-
const isAbort = error instanceof Error && error.name === 'AbortError';
|
|
110
|
-
this.collection.update(attemptNumber, {
|
|
111
|
-
audioLoading: false,
|
|
112
|
-
audioError: isAbort ? undefined : error instanceof Error ? error.message : 'Failed to download audio',
|
|
113
|
-
controller: undefined,
|
|
114
|
-
audioDownloadPromise: undefined
|
|
115
|
-
});
|
|
116
|
-
throw error;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
handlePlayAttempt = (0, _effector.createEffect)(async attemptNumber => {
|
|
120
|
-
this.shouldPreventPlayback = false;
|
|
121
|
-
const item = this.collection.get(attemptNumber);
|
|
122
|
-
if (!item) return;
|
|
123
|
-
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
124
|
-
this.abortAllDownloads();
|
|
125
|
-
}
|
|
126
|
-
if (this.collection.hasAudio(attemptNumber)) {
|
|
127
|
-
this.playAudioFx(attemptNumber);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.LOADING);
|
|
132
|
-
if (item.audioDownloadPromise) {
|
|
133
|
-
await item.audioDownloadPromise;
|
|
134
|
-
} else {
|
|
135
|
-
await this.downloadAudio(attemptNumber);
|
|
136
|
-
}
|
|
137
|
-
if (this.shouldPreventPlayback) {
|
|
138
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
142
|
-
this.playAudioFx(attemptNumber);
|
|
143
|
-
} catch (error) {
|
|
144
|
-
if (error instanceof Error && error.name === 'AbortError') {
|
|
145
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
console.error('Audio download error:', error);
|
|
149
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
playAudioFx = (0, _effector.createEffect)(async attemptNumber => {
|
|
153
|
-
if (this.shouldPreventPlayback) return;
|
|
154
|
-
const item = this.collection.get(attemptNumber);
|
|
155
|
-
if (!item?.audioUri) {
|
|
156
|
-
console.warn('No audio URI available for attempt:', attemptNumber);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
161
|
-
this.player.player?.remove();
|
|
162
|
-
}
|
|
163
|
-
if (this.currentPlayingAttempt === attemptNumber && this.player.player?.playing) {
|
|
164
|
-
this.player.pause();
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (this.currentPlayingAttempt === attemptNumber && !this.player.player?.playing) {
|
|
168
|
-
this.player.resume();
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
this.currentPlayingAttempt = attemptNumber;
|
|
172
|
-
await this.player.play(item.audioUri);
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.error('Error playing audio:', error);
|
|
175
|
-
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
176
|
-
this.collection.update(attemptNumber, {
|
|
177
|
-
audioError: error instanceof Error ? error.message : 'Failed to play audio'
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
exports.PlaybackController = PlaybackController;
|
|
183
|
-
//# sourceMappingURL=PlaybackController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_PlayerModel","PlaybackController","currentPlayingAttempt","shouldPreventPlayback","constructor","deps","collection","player","downloader","playbackFinished","watch","clearCurrentAttempt","togglePlayPause","attemptNumber","playerState","$playerState","getState","PlayerState","PLAYING","pause","handlePlayAttempt","preloadAudio","createEffect","item","get","hasAudio","primePlayerIfIdle","audioDownloadPromise","downloadAudio","error","Error","name","console","IDLE","audioUri","prime","halt","abortAllDownloads","stop","releaseResources","getAll","forEach","controller","abortDownload","startsWith","URL","revokeObjectURL","e","audioLoading","update","undefined","collectionItem","downloadPromise","download","audioFileId","result","uri","audioError","isAbort","message","playAudioFx","setPlayerState","LOADING","warn","remove","playing","resume","play","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/PlaybackController.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAUO,MAAME,kBAAkB,CAAC;EAItBC,qBAAqB,GAAkB,IAAI;EAC3CC,qBAAqB,GAAG,KAAK;EAErCC,WAAWA,CAACC,IAA4B,EAAE;IACxC,IAAI,CAACC,UAAU,GAAGD,IAAI,CAACC,UAAU;IACjC,IAAI,CAACC,MAAM,GAAGF,IAAI,CAACE,MAAM;IACzB,IAAI,CAACC,UAAU,GAAGH,IAAI,CAACG,UAAU;IACjC,IAAI,CAACD,MAAM,CAACE,gBAAgB,CAACC,KAAK,CAAC,MAAM,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC;EACtE;EAEgBC,eAAe,GAAIC,aAAqB,IAAK;IAC3D,MAAMC,WAAW,GAAG,IAAI,CAACP,MAAM,CAACQ,YAAY,CAACC,QAAQ,CAAC,CAAC;IACvD,IAAI,IAAI,CAACd,qBAAqB,KAAKW,aAAa,IAAIC,WAAW,KAAKG,wBAAW,CAACC,OAAO,EAAE;MACvF,IAAI,CAACX,MAAM,CAACY,KAAK,CAAC,CAAC;IACrB,CAAC,MAAM;MACL,IAAI,CAACC,iBAAiB,CAACP,aAAa,CAAC;IACvC;EACF,CAAC;EAEeQ,YAAY,GAAG,IAAAC,sBAAY,EAAC,MAAOT,aAAqB,IAAK;IAC3E,MAAMU,IAAI,GAAG,IAAI,CAACjB,UAAU,CAACkB,GAAG,CAACX,aAAa,CAAC;IAC/C,IAAI,CAACU,IAAI,EAAE;IACX,IAAI,IAAI,CAACjB,UAAU,CAACmB,QA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A,MAAM,EAAEyD,MAAM,CAAC,CAAC;MAC9B;MAEA,IAAI,IAAI,CAAC9D,qBAAqB,KAAKW,aAAa,IAAI,IAAI,CAACN,MAAM,CAACA,MAAM,EAAE0D,OAAO,EAAE;QAC/E,IAAI,CAAC1D,MAAM,CAACY,KAAK,CAAC,CAAC;QACnB;MACF;MAEA,IAAI,IAAI,CAACjB,qBAAqB,KAAKW,aAAa,IAAI,CAAC,IAAI,CAACN,MAAM,CAACA,MAAM,EAAE0D,OAAO,EAAE;QAChF,IAAI,CAAC1D,MAAM,CAAC2D,MAAM,CAAC,CAAC;QACpB;MACF;MAEA,IAAI,CAAChE,qBAAqB,GAAGW,aAAa;MAC1C,MAAM,IAAI,CAACN,MAAM,CAAC4D,IAAI,CAAC5C,IAAI,CAACW,QAAQ,CAAC;IACvC,CAAC,CAAC,OAAOL,KAAK,EAAE;MACdG,OAAO,CAACH,KAAK,CAAC,sBAAsB,EAAEA,KAAK,CAAC;MAC5C,IAAI,CAACtB,MAAM,CAACsD,cAAc,CAAC5C,wBAAW,CAACgB,IAAI,CAAC;MAE5C,IAAI,CAAC3B,UAAU,CAAC2C,MAAM,CAACpC,aAAa,EAAE;QACpC4C,UAAU,EAAE5B,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAAC8B,OAAO,GAAG;MACvD,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ;AAACS,OAAA,CAAAnE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TranscriptionsCollection","collection","Map","add","attemptNumber","item","set","update","existingItem","get","delete","getAll","Array","from","values","clear","hasTranscript","transcript","hasAudio","audioUri","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsCollection.ts"],"mappings":";;;;;;AAEO,MAAMA,wBAAwB,CAAC;EACpBC,UAAU,GAAwC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,GAAGA,CAACC,aAAqB,EAA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: true
|
|
5
|
-
});
|
|
6
|
-
exports.TranscriptionsDownloaderModel = void 0;
|
|
7
|
-
var _effector = require("effector");
|
|
8
|
-
var _constants = require("../../constants.js");
|
|
9
|
-
class TranscriptionsDownloaderModel {
|
|
10
|
-
inflightFetches = new Map();
|
|
11
|
-
transcriptCache = new Map();
|
|
12
|
-
constructor(collection, api) {
|
|
13
|
-
this.collection = collection;
|
|
14
|
-
this.api = api;
|
|
15
|
-
}
|
|
16
|
-
fetchTranscriptWithRetry(audioFileId) {
|
|
17
|
-
const cached = this.transcriptCache.get(audioFileId);
|
|
18
|
-
if (cached) return Promise.resolve(cached);
|
|
19
|
-
const existing = this.inflightFetches.get(audioFileId);
|
|
20
|
-
if (existing) return existing;
|
|
21
|
-
const promise = this.runFetchWithRetry(audioFileId).then(result => {
|
|
22
|
-
this.transcriptCache.set(audioFileId, result);
|
|
23
|
-
return result;
|
|
24
|
-
}).finally(() => {
|
|
25
|
-
this.inflightFetches.delete(audioFileId);
|
|
26
|
-
});
|
|
27
|
-
this.inflightFetches.set(audioFileId, promise);
|
|
28
|
-
return promise;
|
|
29
|
-
}
|
|
30
|
-
async runFetchWithRetry(audioFileId) {
|
|
31
|
-
for (let attempt = 0; attempt < _constants.TRANSCRIPT_MAX_RETRIES; attempt++) {
|
|
32
|
-
const response = await this.api.getAudioFileTranscript(audioFileId);
|
|
33
|
-
if (response.status === 'completed') {
|
|
34
|
-
return {
|
|
35
|
-
text: response.text,
|
|
36
|
-
language: response.language
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (response.status === 'failed') {
|
|
40
|
-
return {
|
|
41
|
-
text: _constants.NO_AUDIO_BE_MESSAGE
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (attempt < _constants.TRANSCRIPT_MAX_RETRIES - 1) {
|
|
45
|
-
await new Promise(resolve => setTimeout(resolve, _constants.TRANSCRIPT_RETRY_INTERVAL_MS));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
text: _constants.NO_AUDIO_BE_MESSAGE
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
loadTranscriptForAttempt = (0, _effector.createEffect)(async attemptNumber => {
|
|
53
|
-
const item = this.collection.get(attemptNumber);
|
|
54
|
-
if (!item?.audioFileId) return;
|
|
55
|
-
if (item.transcript || item.transcriptLoading) return;
|
|
56
|
-
this.collection.update(attemptNumber, {
|
|
57
|
-
transcriptLoading: true
|
|
58
|
-
});
|
|
59
|
-
try {
|
|
60
|
-
const {
|
|
61
|
-
text,
|
|
62
|
-
language
|
|
63
|
-
} = await this.fetchTranscriptWithRetry(item.audioFileId);
|
|
64
|
-
this.collection.update(attemptNumber, {
|
|
65
|
-
transcript: text,
|
|
66
|
-
transcriptLanguage: language,
|
|
67
|
-
transcriptLoading: false,
|
|
68
|
-
transcriptError: undefined
|
|
69
|
-
});
|
|
70
|
-
} catch (error) {
|
|
71
|
-
this.collection.update(attemptNumber, {
|
|
72
|
-
transcriptLoading: false,
|
|
73
|
-
transcriptError: error instanceof Error ? error.message : 'Failed to load transcript'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
getCachedTranscript(audioFileId) {
|
|
78
|
-
return this.transcriptCache.get(audioFileId);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.TranscriptionsDownloaderModel = TranscriptionsDownloaderModel;
|
|
82
|
-
//# sourceMappingURL=TranscriptionsDownloader.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_constants","TranscriptionsDownloaderModel","inflightFetches","Map","transcriptCache","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","cached","get","Promise","resolve","existing","promise","runFetchWithRetry","then","result","set","finally","delete","attempt","TRANSCRIPT_MAX_RETRIES","response","getAudioFileTranscript","status","text","language","NO_AUDIO_BE_MESSAGE","setTimeout","TRANSCRIPT_RETRY_INTERVAL_MS","loadTranscriptForAttempt","createEffect","attemptNumber","item","transcript","transcriptLoading","update","transcriptLanguage","transcriptError","undefined","error","Error","message","getCachedTranscript","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsDownloader.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAQO,MAAME,6BAA6B,CAAC;EAGxBC,eAAe,GAAG,IAAIC,GAAG,CAAoC,CAAC;EAC9DC,eAAe,GAAG,IAAID,GAAG,CAA2B,CAAC;EAEtEE,WAAWA,CAACC,UAAoC,EAAEC,GAAmB,EAAE;IACrE,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,GAAG,GAAGA,GAAG;EAChB;EAEQC,wBAAwBA,CAACC,WAAmB,EAA6B;IAC/E,MAAMC,MAAM,GAAG,IAAI,CAACN,eAAe,CAACO,GAAG,CAACF,WAAW,CAAC;IACpD,IAAIC,MAAM,EAAE,OAAOE,OAAO,CAACC,OAAO,CAACH,MAAM,CAAC;IAE1C,MAAMI,QAAQ,GAAG,IAAI,CAACZ,eAAe,CAACS,GAAG,CAACF,WAAW,CAAC;IACtD,IAAIK,QAAQ,EAAE,OAAOA,QAAQ;IAE7B,MAAMC,OAAO,GAAG,IAAI,CAACC,iBAAiB,CAACP,WAAW,CAAC,CAChDQ,IAAI,CAAEC,MAAM,IAAK;MAChB,IAAI,CAACd,eAAe,CAACe,GAAG,CAACV,WAAW,EAAES,MAAM,CAAC;MAC7C,OAAOA,MAAM;IACf,CAAC,CAAC,CACDE,OAAO,CAAC,MAAM;MACb,IAAI,CAAClB,eAAe,CAACmB,MAAM,CAACZ,WAAW,CAAC;IAC1C,CAAC,CAAC;IACJ,IAAI,CAACP,eAAe,CAACiB,GAAG,CAACV,WAAW,EAAEM,OAAO,CAAC;IAC9C,OAAOA,OAAO;EAChB;EAEA,MAAcC,iBAAiBA,CAACP,WAAmB,EAA6B;IAC9E,KAAK,IAAIa,OAAO,GA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,KAAK;QACxBG,eAAe,EAAEC;MACnB,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,IAAI,CAACpC,UAAU,CAACgC,MAAM,CAACJ,aAAa,EAAE;QACpCG,iBAAiB,EAAE,KAAK;QACxBG,eAAe,EAAEE,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAG;MAC5D,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EAEKC,mBAAmBA,CAACpC,WAAmB,EAAgC;IAC5E,OAAO,IAAI,CAACL,eAAe,CAACO,GAAG,CAACF,WAAW,CAAC;EAC9C;AACF;AAACqC,OAAA,CAAA7C,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TranslationModel = void 0;
|
|
7
|
-
var _effector = require("effector");
|
|
8
|
-
var _TranslationService = require("../../../translation/model/TranslationService.js");
|
|
9
|
-
var _GoogleTranslationProvider = require("../../../translation/providers/google/GoogleTranslationProvider.js");
|
|
10
|
-
var _wordsToPreserve = require("../../../translation/preserve/wordsToPreserve.js");
|
|
11
|
-
class TranslationModel {
|
|
12
|
-
toggle = (0, _effector.createEvent)();
|
|
13
|
-
setActive = (0, _effector.createEvent)();
|
|
14
|
-
clearCache = (0, _effector.createEvent)();
|
|
15
|
-
reset = (0, _effector.createEvent)();
|
|
16
|
-
$isActive = (0, _effector.restore)(this.setActive, false).on(this.toggle, state => !state).reset(this.reset);
|
|
17
|
-
translate = (0, _effector.createEffect)(async ({
|
|
18
|
-
attemptNumber,
|
|
19
|
-
targetLanguage
|
|
20
|
-
}) => {
|
|
21
|
-
const item = this.collection.get(attemptNumber);
|
|
22
|
-
if (!item?.transcript) return null;
|
|
23
|
-
const text = await this.service.translate(item.transcript, {
|
|
24
|
-
targetLang: targetLanguage,
|
|
25
|
-
sourceLang: item.transcriptLanguage,
|
|
26
|
-
cacheKey: `voice::${attemptNumber}::${targetLanguage}`
|
|
27
|
-
});
|
|
28
|
-
if (!text) return null;
|
|
29
|
-
return {
|
|
30
|
-
attemptNumber,
|
|
31
|
-
text
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
$translations = (0, _effector.createStore)({}).on(this.translate.doneData, (state, result) => {
|
|
35
|
-
if (!result) return state;
|
|
36
|
-
return {
|
|
37
|
-
...state,
|
|
38
|
-
[result.attemptNumber]: result.text
|
|
39
|
-
};
|
|
40
|
-
}).reset(this.reset, this.clearCache);
|
|
41
|
-
constructor(collection, api) {
|
|
42
|
-
this.collection = collection;
|
|
43
|
-
this.service = new _TranslationService.TranslationService({
|
|
44
|
-
preserve: {
|
|
45
|
-
map: _wordsToPreserve.wordsToPreserve,
|
|
46
|
-
replacers: _wordsToPreserve.preservedWordsReplacers
|
|
47
|
-
},
|
|
48
|
-
providers: [new _GoogleTranslationProvider.GoogleTranslationProvider({
|
|
49
|
-
api: {
|
|
50
|
-
translateRequest: api.translateText
|
|
51
|
-
}
|
|
52
|
-
})]
|
|
53
|
-
});
|
|
54
|
-
this.clearCache.watch(() => this.service.reset());
|
|
55
|
-
this.reset.watch(() => this.service.reset());
|
|
56
|
-
}
|
|
57
|
-
getTranslation(attemptNumber) {
|
|
58
|
-
return this.$translations.getState()[attemptNumber];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.TranslationModel = TranslationModel;
|
|
62
|
-
//# sourceMappingURL=Translation.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_TranslationService","_GoogleTranslationProvider","_wordsToPreserve","TranslationModel","toggle","createEvent","setActive","clearCache","reset","$isActive","restore","on","state","translate","createEffect","attemptNumber","targetLanguage","item","collection","get","transcript","text","service","targetLang","sourceLang","transcriptLanguage","cacheKey","$translations","createStore","doneData","result","constructor","api","TranslationService","preserve","map","wordsToPreserve","replacers","preservedWordsReplacers","providers","GoogleTranslationProvider","translateRequest","translateText","watch","getTranslation","getState","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Translation.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAeO,MAAMI,gBAAgB,CAAC;EAIZC,MAAM,GAAG,IAAAC,qBAAW,EAAC,CAAC;EACtBC,SAAS,GAAG,IAAAD,qBAAW,EAAU,CAAC;EAClCE,UAAU,GAAG,IAAAF,qBAAW,EAAC,CAAC;EAC1BG,KAAK,GAAG,IAAAH,qBAAW,EAAC,CAAC;EAErBI,SAAS,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACJ,SAAS,EAAE,KAAK,CAAC,CACvDK,EAAE,CAAC,IAAI,CAACP,MAAM,EAAGQ,KAAK,IAAK,CAACA,KAAK,CAAC,CAClCJ,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EAEJK,SAAS,GAAG,IAAAC,sBAAY,EACtC,OAAO;IAAEC,aAAa;IAAEC;EAAe,CAAC,KAAK;IAC3C,MAAMC,IAAI,GAAG,IAAI,CAACC,UAAU,CAACC,GAAG,CAACJ,aAAa,CAAC;IAC/C,IAAI,CAACE,IAAI,EAAEG,UAAU,EAAE,OAAO,IAAI;IAElC,MAAMC,IAAI,GAAG,MAAM,IAAI,CAACC,OAAO,CAACT,SAAS,CAACI,IAAI,CAACG,UAAU,EAAE;MACzDG,UAAU,EAAEP,cAAc;MAC1BQ,UAAU,EAAEP,IAAI,CAACQ,kBAAkB;MACnCC,QAAQ,EAAE,UAAUX,aAAa,KAAKC,cAAc;IACtD,CAAC,CAAC;IAEF,IAAI,CAACK,IAAI,EAAE,OAAO,IAAI;IAEtB,OAAO;MAAEN,aAAa;MAAEM;IAAK,CAAC;EAChC,CACF,CAAC;EAEe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|
-
export const DESCRIPTION_CACHE_KEY_SUFFIX = '::description';
|
|
5
|
-
export const CHOICES_CACHE_KEY_SUFFIX = '::choices';
|
|
6
|
-
export const PRACTICE_THEORY_CACHE_KEY_SUFFIX = '::practice-theory';
|
|
7
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["GBD_TEXT_CACHE_SUFFIX","DESCRIPTION_CACHE_KEY_SUFFIX","CHOICES_CACHE_KEY_SUFFIX","PRACTICE_THEORY_CACHE_KEY_SUFFIX"],"sourceRoot":"../../../../src","sources":["features/translation/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,qBAAqB,GAAG,OAAO;AAC5C,OAAO,MAAMC,4BAA4B,GAAG,eAAe;AAC3D,OAAO,MAAMC,wBAAwB,GAAG,WAAW;AACnD,OAAO,MAAMC,gCAAgC,GAAG,mBAAmB","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export function replaceMappedTokens(input, map) {
|
|
4
|
-
let result = input;
|
|
5
|
-
for (const [original, override] of Object.entries(map)) {
|
|
6
|
-
const escaped = original.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
|
-
const regex = new RegExp(`\\b${escaped}\\b`, 'gi');
|
|
8
|
-
result = result.replace(regex, override);
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Masks text segments matched by `regex` with a placeholder,
|
|
15
|
-
* while preserving spaces around the original match.
|
|
16
|
-
*/
|
|
17
|
-
export const maskSegment = ({
|
|
18
|
-
text,
|
|
19
|
-
regex,
|
|
20
|
-
placeholder,
|
|
21
|
-
replacements,
|
|
22
|
-
shouldSkip
|
|
23
|
-
}) => {
|
|
24
|
-
return text.replace(regex, (match, ...args) => {
|
|
25
|
-
if (shouldSkip?.(match)) return match;
|
|
26
|
-
const offset = args[args.length - 2];
|
|
27
|
-
const input = args[args.length - 1];
|
|
28
|
-
const before = offset > 0 ? input[offset - 1] : '';
|
|
29
|
-
const afterIdx = offset + match.length;
|
|
30
|
-
const after = afterIdx < input.length ? input[afterIdx] : '';
|
|
31
|
-
const leftPad = /\s/.test(before);
|
|
32
|
-
const rightPad = /\s/.test(after);
|
|
33
|
-
replacements.push({
|
|
34
|
-
placeholder,
|
|
35
|
-
original: match,
|
|
36
|
-
leftPad,
|
|
37
|
-
rightPad
|
|
38
|
-
});
|
|
39
|
-
return placeholder;
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const HTML_NAMED_ENTITIES = {
|
|
43
|
-
'&': '&',
|
|
44
|
-
'<': '<',
|
|
45
|
-
'>': '>',
|
|
46
|
-
'"': '"',
|
|
47
|
-
''': "'",
|
|
48
|
-
' ': ' '
|
|
49
|
-
};
|
|
50
|
-
export const decodeHtmlEntities = text => {
|
|
51
|
-
return text.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCharCode(parseInt(code, 16))).replace(/&(amp|lt|gt|quot|apos|nbsp);/g, match => HTML_NAMED_ENTITIES[match] ?? match);
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["replaceMappedTokens","input","map","result","original","override","Object","entries","escaped","replace","regex","RegExp","maskSegment","text","placeholder","replacements","shouldSkip","match","args","offset","length","before","afterIdx","after","leftPad","test","rightPad","push","HTML_NAMED_ENTITIES","decodeHtmlEntities","_","code","String","fromCharCode","parseInt"],"sourceRoot":"../../../../src","sources":["features/translation/helpers.ts"],"mappings":";;AAEA,OAAO,SAASA,mBAAmBA,CAACC,KAAa,EAAEC,GAA2B,EAAU;EACtF,IAAIC,MAAM,GAAGF,KAAK;EAElB,KAAK,MAAM,CAACG,QAAQ,EAAEC,QAAQ,CAAC,IAAIC,MAAM,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AC,CAAC;IAEtE,OAAOZ,WAAW;EACpB,CAAC,CAAC;AACJ,CAAC;AAED,MAAMc,mBAA2C,GAAG;EAClD,OAAO,EAAE,GAAG;EACZ,MAAM,EAAE,GAAG;EACX,MAAM,EAAE,GAAG;EACX,QAAQ,EAAE,GAAG;EACb,QAAQ,EAAE,GAAG;EACb,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAIhB,IAAY,IAAa;EAC1D,OAAOA,IAAI,CACRJ,OAAO,CAAC,WAAW,EAAE,CAACqB,CAAC,EAAEC,IAAY,KAAKC,MAAM,CAACC,YAAY,CAACC,QAAQ,CAACH,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAClFtB,OAAO,CAAC,mBAAmB,EAAE,CAACqB,CAAC,EAAEC,IAAY,KAAKC,MAAM,CAACC,YAAY,CAACC,QAAQ,CAACH,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAC1FtB,OAAO,CACN,+BAA+B,EAC9BQ,KAAK,IAAKW,mBAAmB,CAACX,KAAK,CAAC,IAAIA,KAC3C,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { TranslationModel } from "./model/TranslationModel.js";
|
|
4
|
-
export { TranslationService } from "./model/TranslationService.js";
|
|
5
|
-
export { TranslationKatexPreprocessor } from "./model/TranslationPreprocessor.js";
|
|
6
|
-
export { TranslationProvider } from "./providers/translation.interface.js";
|
|
7
|
-
export { GoogleTranslationProvider } from "./providers/google/GoogleTranslationProvider.js";
|
|
8
|
-
export { GoogleTranslateLanguage } from "./providers/google/supportedLanguages.js";
|
|
9
|
-
export { wordsToPreserve, preservedWordsReplacers } from "./preserve/wordsToPreserve.js";
|
|
10
|
-
export { GBD_TEXT_CACHE_SUFFIX, DESCRIPTION_CACHE_KEY_SUFFIX, CHOICES_CACHE_KEY_SUFFIX, PRACTICE_THEORY_CACHE_KEY_SUFFIX } from "./constants.js";
|
|
11
|
-
export { replaceMappedTokens, maskSegment, decodeHtmlEntities } from "./helpers.js";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TranslationModel","TranslationService","TranslationKatexPreprocessor","TranslationProvider","GoogleTranslationProvider","GoogleTranslateLanguage","wordsToPreserve","preservedWordsReplacers","GBD_TEXT_CACHE_SUFFIX","DESCRIPTION_CACHE_KEY_SUFFIX","CHOICES_CACHE_KEY_SUFFIX","PRACTICE_THEORY_CACHE_KEY_SUFFIX","replaceMappedTokens","maskSegment","decodeHtmlEntities"],"sourceRoot":"../../../../src","sources":["features/translation/index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,6BAA0B;AAC3D,SAASC,kBAAkB,QAAmC,+BAA4B;AAC1F,SAASC,4BAA4B,QAAQ,oCAAiC;AAC9E,SAASC,mBAAmB,QAA+B,sCAAmC;AAC9F,SAASC,yBAAyB,QAAQ,iDAA8C;AACxF,SAASC,uBAAuB,QAAQ,0CAAuC;AAM/E,SAASC,eAAe,EAAEC,uBAAuB,QAAQ,+BAA4B;AACrF,SACEC,qBAAqB,EACrBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,gCAAgC,QAC3B,gBAAa;AACpB,SACEC,mBAAmB,EACnBC,WAAW,EACXC,kBAAkB,QACb,cAAW","ignoreList":[]}
|