@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":["useEffect","useUnit","useAnimatedStyle","useSharedValue","withTiming","interpolate","DROPDOWN_MAX_CONTENT_HEIGHT","useDropdownAnimation","model","isExpanded","$isExpanded","contentHeight","animationProgress","onListLayout","event","measuredHeight","nativeEvent","layout","height","value","duration","listAnimatedStyle","opacity","iconAnimatedStyle","rotation","transform","rotate"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useDropdownAnimation.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC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AAMsB,QAAQ,GAAGnB,WAAW,CAACO,iBAAiB,CAACO,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEvE,OAAO;MACLM,SAAS,EAAE,CAAC;QAAEC,MAAM,EAAE,GAAGF,QAAQ;MAAM,CAAC;IAC1C,CAAC;EACH,CAAC,EAAE,CAACZ,iBAAiB,CAAC,CAAC;EAEvBZ,SAAS,CAAC,MAAM;IACdY,iBAAiB,CAACO,KAAK,GAAGf,UAAU,CAACK,UAAU,GAAG,CAAC,GAAG,CAAC,EAAE;MAAEW,QAAQ,EAAE;IAAI,CAAC,CAAC;EAC7E,CAAC,EAAE,CAACX,UAAU,EAAEG,iBAAiB,CAAC,CAAC;EAEnC,OAAO;IACLH,UAAU;IACVY,iBAAiB;IACjBE,iBAAiB;IACjBV;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useUnit } from 'effector-react';
|
|
4
|
-
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { NO_AUDIO_BE_MESSAGE } from "../../constants.js";
|
|
7
|
-
import { getActiveAttempt } from "../../helpers.js";
|
|
8
|
-
import { resolveGoogleLanguageCode } from "../../../translation/providers/google/supportedLanguages.js";
|
|
9
|
-
import { useText } from "../../../../i18n/i18n.js";
|
|
10
|
-
export const useVoiceTranscriptionController = ({
|
|
11
|
-
model,
|
|
12
|
-
answers,
|
|
13
|
-
attemptOffset,
|
|
14
|
-
attemptsCount,
|
|
15
|
-
problemId
|
|
16
|
-
}) => {
|
|
17
|
-
const t = useText();
|
|
18
|
-
const {
|
|
19
|
-
i18n
|
|
20
|
-
} = useTranslation();
|
|
21
|
-
const [playerState, isLoadingTranscripts, isTranslationActive, translations, isTranslating] = useUnit([model.$playerState, model.loader.loadTranscriptForAttempt.pending, model.translation.$isActive, model.translation.$translations, model.translation.translate.pending]);
|
|
22
|
-
const activeAttempt = getActiveAttempt(attemptOffset, attemptsCount);
|
|
23
|
-
const answersKey = useMemo(() => answers.map(a => `${a._id}:${a.audioFileId ?? ''}`).join(','), [answers]);
|
|
24
|
-
const activeAudioFileId = activeAttempt !== null ? answers?.[activeAttempt - 1]?.audioFileId : undefined;
|
|
25
|
-
const hasActiveAudio = activeAudioFileId !== undefined;
|
|
26
|
-
const anyAttemptHasAudio = useMemo(() => answers.some(a => !!a.audioFileId), [answers]);
|
|
27
|
-
const cachedEntry = activeAudioFileId ? model.loader.getCachedTranscript(activeAudioFileId) : undefined;
|
|
28
|
-
const activeTranscript = cachedEntry?.text ?? null;
|
|
29
|
-
const hasTranscriptText = !!activeTranscript && activeTranscript !== NO_AUDIO_BE_MESSAGE;
|
|
30
|
-
const isActiveTranscriptLoading = isLoadingTranscripts && hasActiveAudio && !activeTranscript;
|
|
31
|
-
const isSourceSameAsTarget = !!cachedEntry?.language && resolveGoogleLanguageCode(cachedEntry.language) === resolveGoogleLanguageCode(i18n.language);
|
|
32
|
-
const canTranslate = hasTranscriptText && !isSourceSameAsTarget;
|
|
33
|
-
const cachedTranslation = activeAttempt !== null ? translations[activeAttempt] : undefined;
|
|
34
|
-
const showTranslation = isTranslationActive && canTranslate;
|
|
35
|
-
const isTranslationLoading = showTranslation && !cachedTranslation && isTranslating;
|
|
36
|
-
const displayText = showTranslation ? cachedTranslation ?? activeTranscript : hasTranscriptText ? activeTranscript : t('voice.transcriptNotAvailable');
|
|
37
|
-
|
|
38
|
-
// Lifecycle effects
|
|
39
|
-
const answersRef = useRef(answers);
|
|
40
|
-
answersRef.current = answers;
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
model.reinitializePlayer();
|
|
43
|
-
return () => {
|
|
44
|
-
model.stopAudio();
|
|
45
|
-
model.dropdown.setExpanded(false);
|
|
46
|
-
};
|
|
47
|
-
}, [model]);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
model.dropdown.setExpanded(false);
|
|
50
|
-
model.resetPlayer();
|
|
51
|
-
}, [problemId]);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (answersRef.current.some(a => a.audioFileId)) {
|
|
54
|
-
model.initializeWithAudios(answersRef.current);
|
|
55
|
-
}
|
|
56
|
-
}, [model, answersKey]);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
model.stopAudio();
|
|
59
|
-
model.setCurrentAttempt(activeAttempt);
|
|
60
|
-
if (activeAttempt !== null) {
|
|
61
|
-
model.loader.loadTranscriptForAttempt(activeAttempt);
|
|
62
|
-
}
|
|
63
|
-
}, [model, activeAttempt, answersKey]);
|
|
64
|
-
|
|
65
|
-
// Auto-activate translation once per (problemId, activeAttempt) when translatable
|
|
66
|
-
const autoActivatedAttempts = useRef(new Set());
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
autoActivatedAttempts.current.clear();
|
|
69
|
-
}, [problemId]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (canTranslate && activeAttempt !== null && !autoActivatedAttempts.current.has(activeAttempt)) {
|
|
72
|
-
autoActivatedAttempts.current.add(activeAttempt);
|
|
73
|
-
model.translation.setActive(true);
|
|
74
|
-
}
|
|
75
|
-
}, [canTranslate, activeAttempt, model]);
|
|
76
|
-
|
|
77
|
-
// Trigger translate when we should show translation but don't have it cached
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (showTranslation && activeAttempt !== null && !cachedTranslation && !isTranslating) {
|
|
80
|
-
model.translation.translate({
|
|
81
|
-
attemptNumber: activeAttempt,
|
|
82
|
-
targetLanguage: i18n.language
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}, [showTranslation, activeAttempt, cachedTranslation, isTranslating, i18n.language, model]);
|
|
86
|
-
|
|
87
|
-
// Auto-open dropdown when a translation successfully completes
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
return model.translation.translate.doneData.watch(result => {
|
|
90
|
-
if (result) {
|
|
91
|
-
model.dropdown.setExpanded(true);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}, [model]);
|
|
95
|
-
const onPlayPress = useCallback(() => {
|
|
96
|
-
if (activeAttempt) {
|
|
97
|
-
model.translation.setActive(false);
|
|
98
|
-
model.togglePlayPause(activeAttempt);
|
|
99
|
-
}
|
|
100
|
-
}, [model, activeAttempt]);
|
|
101
|
-
const onTranslationToggle = useCallback(() => {
|
|
102
|
-
model.translation.toggle();
|
|
103
|
-
model.dropdown.setExpanded(true);
|
|
104
|
-
}, [model]);
|
|
105
|
-
return {
|
|
106
|
-
display: {
|
|
107
|
-
text: displayText,
|
|
108
|
-
isLoading: isActiveTranscriptLoading || isTranslationLoading
|
|
109
|
-
},
|
|
110
|
-
flags: {
|
|
111
|
-
playerState: playerState,
|
|
112
|
-
hasActiveAudio,
|
|
113
|
-
anyAttemptHasAudio,
|
|
114
|
-
canTranslate,
|
|
115
|
-
isTranslationActive
|
|
116
|
-
},
|
|
117
|
-
actions: {
|
|
118
|
-
onPlayPress,
|
|
119
|
-
onTranslationToggle
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=useVoiceTranscriptionController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useUnit","useCallback","useEffect","useMemo","useRef","useTranslation","NO_AUDIO_BE_MESSAGE","getActiveAttempt","resolveGoogleLanguageCode","useText","useVoiceTranscriptionController","model","answers","attemptOffset","attemptsCount","problemId","t","i18n","playerState","isLoadingTranscripts","isTranslationActive","translations","isTranslating","$playerState","loader","loadTranscriptForAttempt","pending","translation","$isActive","$translations","translate","activeAttempt","answersKey","map","a","_id","audioFileId","join","activeAudioFileId","undefined","hasActiveAudio","anyAttemptHasAudio","some","cachedEntry","getCachedTranscript","activeTranscript","text","hasTranscriptText","isActiveTranscriptLoading","isSourceSameAsTarget","language","canTranslate","cachedTranslation","showTranslation","isTranslationLoading","displayText","answersRef","current","reinitializePlayer","stopAudio","dropdown","setExpanded","resetPlayer","initializeWithAudios","setCurrentAttempt","autoActivatedAttempts","Set","clear","has","add","setActive","attemptNumber","targetLanguage","doneData","watch","result","onPlayPress","togglePlayPause","onTranslationToggle","toggle","display","isLoading","flags","actions"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionController.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,gBAAgB;AACxC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC/D,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,mBAAmB,QAAQ,oBAAiB;AACrD,SAASC,gBAAgB,QAAQ,kBAAe;AAEhD,SAASC,yBAAyB,QAAQ,6DAA0D;AACpG,SAASC,OAAO,QAAQ,0BAAuB;AAc/C,OAAO,MAAMC,+BAA+B,GAAGA,CAAC;EAC9CC,KAAK;EACLC,OAAO;EACPC,aAAa;EACbC,aAAa;EACbC;AACM,CAAC,KAAK;EACZ,MAAMC,CAAC,GAAGP,OAAO,CAAC,CAAC;EACnB,MAAM;IAAEQ;EAAK,CAAC,GAAGZ,cAAc,CAAC,CAAC;EAEjC,MAAM,CAACa,WAAW,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,YAAY,EAAEC,aAAa,CAAC,GACzFtB,OAAO,CAAC,CACNW,KAAK,CAACY,YAAY,EAClBZ,KAAK,CAACa,MAAM,CAACC,wBAAwB,CAACC,OAAO,EAC7Cf,KAAK,CAACgB,WAAW,CAACC,SAAS,EAC3BjB,KAAK,CAACgB,WAAW,CAACE,aAAa,EAC/BlB,KAAK,CAACgB,WAAW,CAACG,SAAS,CAACJ,OAAO,CACpC,CAAC;EAEJ,MAAMK,aAAa,GAAGxB,gBAAgB,CAACM,aAAa,EAAEC,aAAa,CAAC;EAEpE,MAAMkB,UAAU,GAAG7B,OAAO,CACxB,MAAMS,OAAO,CAACqB,GAAG,CAAEC,CAAC,IAA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SAAS,CAAC,KAAK,CAAC;MAClC3D,KAAK,CAACkE,eAAe,CAAC9C,aAAa,CAAC;IACtC;EACF,CAAC,EAAE,CAACpB,KAAK,EAAEoB,aAAa,CAAC,CAAC;EAE1B,MAAM+C,mBAAmB,GAAG7E,WAAW,CAAC,MAAM;IAC5CU,KAAK,CAACgB,WAAW,CAACoD,MAAM,CAAC,CAAC;IAC1BpE,KAAK,CAACiD,QAAQ,CAACC,WAAW,CAAC,IAAI,CAAC;EAClC,CAAC,EAAE,CAAClD,KAAK,CAAC,CAAC;EAEX,OAAO;IACLqE,OAAO,EAAE;MACPlC,IAAI,EAAES,WAAW;MACjB0B,SAAS,EAAEjC,yBAAyB,IAAIM;IAC1C,CAAC;IACD4B,KAAK,EAAE;MACLhE,WAAW,EAAEA,WAA0B;MACvCsB,cAAc;MACdC,kBAAkB;MAClBU,YAAY;MACZ/B;IACF,CAAC;IACD+D,OAAO,EAAE;MACPP,WAAW;MACXE;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEvent","restore","DropdownModel","toggleExpand","setExpanded","reset","$isExpanded","on","state"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Dropdown.model.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAE/C,OAAO,MAAMC,aAAa,CAAC;EACTC,YAAY,GAAGH,WAAW,CAAC,CAAC;EAC5BI,WAAW,GAAGJ,WAAW,CAAU,CAAC;EACpCK,KAAK,GAAGL,WAAW,CAAC,CAAC;EAErBM,WAAW,GAAGL,OAAO,CAAC,IAAI,CAACG,WAAW,EAAE,KAAK,CAAC,CAC3DG,EAAE,CAAC,IAAI,CAACJ,YAAY,EAAGK,KAAK,IAAK,CAACA,KAAK,CAAC,CACxCH,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;AACtB","ignoreList":[]}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { createEffect } from 'effector';
|
|
4
|
-
import { PlayerState } from "./Player.model.js";
|
|
5
|
-
export class PlaybackController {
|
|
6
|
-
currentPlayingAttempt = null;
|
|
7
|
-
shouldPreventPlayback = false;
|
|
8
|
-
constructor(deps) {
|
|
9
|
-
this.collection = deps.collection;
|
|
10
|
-
this.player = deps.player;
|
|
11
|
-
this.downloader = deps.downloader;
|
|
12
|
-
this.player.playbackFinished.watch(() => this.clearCurrentAttempt());
|
|
13
|
-
}
|
|
14
|
-
togglePlayPause = attemptNumber => {
|
|
15
|
-
const playerState = this.player.$playerState.getState();
|
|
16
|
-
if (this.currentPlayingAttempt === attemptNumber && playerState === PlayerState.PLAYING) {
|
|
17
|
-
this.player.pause();
|
|
18
|
-
} else {
|
|
19
|
-
this.handlePlayAttempt(attemptNumber);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
preloadAudio = createEffect(async attemptNumber => {
|
|
23
|
-
const item = this.collection.get(attemptNumber);
|
|
24
|
-
if (!item) return;
|
|
25
|
-
if (this.collection.hasAudio(attemptNumber)) {
|
|
26
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (item.audioDownloadPromise) {
|
|
30
|
-
try {
|
|
31
|
-
await item.audioDownloadPromise;
|
|
32
|
-
} catch {}
|
|
33
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
await this.downloadAudio(attemptNumber);
|
|
38
|
-
this.primePlayerIfIdle(attemptNumber);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (error instanceof Error && error.name === 'AbortError') return;
|
|
41
|
-
console.error('Audio preload error:', error);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
primePlayerIfIdle(attemptNumber) {
|
|
45
|
-
if (this.player.$playerState.getState() !== PlayerState.IDLE) return;
|
|
46
|
-
if (this.currentPlayingAttempt !== null) return;
|
|
47
|
-
const audioUri = this.collection.get(attemptNumber)?.audioUri;
|
|
48
|
-
if (!audioUri) return;
|
|
49
|
-
this.player.prime(audioUri);
|
|
50
|
-
}
|
|
51
|
-
halt() {
|
|
52
|
-
this.shouldPreventPlayback = true;
|
|
53
|
-
this.abortAllDownloads();
|
|
54
|
-
this.player.stop();
|
|
55
|
-
this.clearCurrentAttempt();
|
|
56
|
-
}
|
|
57
|
-
releaseResources() {
|
|
58
|
-
this.collection.getAll().forEach(item => {
|
|
59
|
-
if (item.controller) {
|
|
60
|
-
this.downloader.abortDownload(item.controller);
|
|
61
|
-
}
|
|
62
|
-
if (item.audioUri?.startsWith('blob:')) {
|
|
63
|
-
try {
|
|
64
|
-
URL.revokeObjectURL(item.audioUri);
|
|
65
|
-
} catch (e) {}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
clearCurrentAttempt() {
|
|
70
|
-
this.currentPlayingAttempt = null;
|
|
71
|
-
}
|
|
72
|
-
abortAllDownloads() {
|
|
73
|
-
this.collection.getAll().forEach(item => {
|
|
74
|
-
if (item.controller && item.audioLoading) {
|
|
75
|
-
this.downloader.abortDownload(item.controller);
|
|
76
|
-
this.collection.update(item.attemptNumber, {
|
|
77
|
-
audioLoading: false,
|
|
78
|
-
controller: undefined,
|
|
79
|
-
audioDownloadPromise: undefined
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
async downloadAudio(attemptNumber) {
|
|
85
|
-
const item = this.collection.get(attemptNumber);
|
|
86
|
-
if (!item) return;
|
|
87
|
-
const {
|
|
88
|
-
collectionItem,
|
|
89
|
-
downloadPromise
|
|
90
|
-
} = await this.downloader.download({
|
|
91
|
-
audioFileId: item.audioFileId,
|
|
92
|
-
attemptNumber
|
|
93
|
-
});
|
|
94
|
-
this.collection.update(attemptNumber, collectionItem);
|
|
95
|
-
try {
|
|
96
|
-
const result = await downloadPromise;
|
|
97
|
-
this.collection.update(attemptNumber, {
|
|
98
|
-
audioUri: result.uri,
|
|
99
|
-
audioLoading: false,
|
|
100
|
-
audioError: undefined,
|
|
101
|
-
controller: undefined,
|
|
102
|
-
audioDownloadPromise: undefined
|
|
103
|
-
});
|
|
104
|
-
} catch (error) {
|
|
105
|
-
const isAbort = error instanceof Error && error.name === 'AbortError';
|
|
106
|
-
this.collection.update(attemptNumber, {
|
|
107
|
-
audioLoading: false,
|
|
108
|
-
audioError: isAbort ? undefined : error instanceof Error ? error.message : 'Failed to download audio',
|
|
109
|
-
controller: undefined,
|
|
110
|
-
audioDownloadPromise: undefined
|
|
111
|
-
});
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
handlePlayAttempt = createEffect(async attemptNumber => {
|
|
116
|
-
this.shouldPreventPlayback = false;
|
|
117
|
-
const item = this.collection.get(attemptNumber);
|
|
118
|
-
if (!item) return;
|
|
119
|
-
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
120
|
-
this.abortAllDownloads();
|
|
121
|
-
}
|
|
122
|
-
if (this.collection.hasAudio(attemptNumber)) {
|
|
123
|
-
this.playAudioFx(attemptNumber);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
this.player.setPlayerState(PlayerState.LOADING);
|
|
128
|
-
if (item.audioDownloadPromise) {
|
|
129
|
-
await item.audioDownloadPromise;
|
|
130
|
-
} else {
|
|
131
|
-
await this.downloadAudio(attemptNumber);
|
|
132
|
-
}
|
|
133
|
-
if (this.shouldPreventPlayback) {
|
|
134
|
-
this.player.setPlayerState(PlayerState.IDLE);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
this.player.setPlayerState(PlayerState.IDLE);
|
|
138
|
-
this.playAudioFx(attemptNumber);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
if (error instanceof Error && error.name === 'AbortError') {
|
|
141
|
-
this.player.setPlayerState(PlayerState.IDLE);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
console.error('Audio download error:', error);
|
|
145
|
-
this.player.setPlayerState(PlayerState.IDLE);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
playAudioFx = createEffect(async attemptNumber => {
|
|
149
|
-
if (this.shouldPreventPlayback) return;
|
|
150
|
-
const item = this.collection.get(attemptNumber);
|
|
151
|
-
if (!item?.audioUri) {
|
|
152
|
-
console.warn('No audio URI available for attempt:', attemptNumber);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
157
|
-
this.player.player?.remove();
|
|
158
|
-
}
|
|
159
|
-
if (this.currentPlayingAttempt === attemptNumber && this.player.player?.playing) {
|
|
160
|
-
this.player.pause();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (this.currentPlayingAttempt === attemptNumber && !this.player.player?.playing) {
|
|
164
|
-
this.player.resume();
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
this.currentPlayingAttempt = attemptNumber;
|
|
168
|
-
await this.player.play(item.audioUri);
|
|
169
|
-
} catch (error) {
|
|
170
|
-
console.error('Error playing audio:', error);
|
|
171
|
-
this.player.setPlayerState(PlayerState.IDLE);
|
|
172
|
-
this.collection.update(attemptNumber, {
|
|
173
|
-
audioError: error instanceof Error ? error.message : 'Failed to play audio'
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=PlaybackController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","PlayerState","PlaybackController","currentPlayingAttempt","shouldPreventPlayback","constructor","deps","collection","player","downloader","playbackFinished","watch","clearCurrentAttempt","togglePlayPause","attemptNumber","playerState","$playerState","getState","PLAYING","pause","handlePlayAttempt","preloadAudio","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"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/PlaybackController.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAAsBC,WAAW,QAAQ,mBAAgB;AAUzD,OAAO,MAAMC,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,KAAKd,WAAW,CAACiB,OAAO,EAAE;MACvF,IAAI,CAACV,MAAM,CAACW,KAAK,CAAC,CAAC;IACrB,CAAC,MAAM;MACL,IAAI,CAACC,iBAAiB,CAACN,aAAa,CAAC;IACvC;EACF,CAAC;EAEeO,YAAY,GAAGrB,YAAY,CAAC,MAAOc,aAAqB,IAAK;IAC3E,MAAMQ,IAAI,GAAG,IAAI,CAACf,UAAU,CAACgB,GAAG,CAACT,aAAa,CAAC;IAC/C,IAAI,CAACQ,IAAI,EAAE;IACX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AACN,MAAM,CAACA,MAAM,EAAEuD,MAAM,CAAC,CAAC;MAC9B;MAEA,IAAI,IAAI,CAAC5D,qBAAqB,KAAKW,aAAa,IAAI,IAAI,CAACN,MAAM,CAACA,MAAM,EAAEwD,OAAO,EAAE;QAC/E,IAAI,CAACxD,MAAM,CAACW,KAAK,CAAC,CAAC;QACnB;MACF;MAEA,IAAI,IAAI,CAAChB,qBAAqB,KAAKW,aAAa,IAAI,CAAC,IAAI,CAACN,MAAM,CAACA,MAAM,EAAEwD,OAAO,EAAE;QAChF,IAAI,CAACxD,MAAM,CAACyD,MAAM,CAAC,CAAC;QACpB;MACF;MAEA,IAAI,CAAC9D,qBAAqB,GAAGW,aAAa;MAC1C,MAAM,IAAI,CAACN,MAAM,CAAC0D,IAAI,CAAC5C,IAAI,CAACW,QAAQ,CAAC;IACvC,CAAC,CAAC,OAAOL,KAAK,EAAE;MACdG,OAAO,CAACH,KAAK,CAAC,sBAAsB,EAAEA,KAAK,CAAC;MAC5C,IAAI,CAACpB,MAAM,CAACoD,cAAc,CAAC3D,WAAW,CAAC+B,IAAI,CAAC;MAE5C,IAAI,CAACzB,UAAU,CAACyC,MAAM,CAAClC,aAAa,EAAE;QACpC0C,UAAU,EAAE5B,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAAC8B,OAAO,GAAG;MACvD,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ","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"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsCollection.ts"],"mappings":";;AAEA,OAAO,MAAMA,wBAAwB,CAAC;EACpBC,UAAU,GAAwC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,GAAGA,CAACC,aAAqB,EAAEC,IAA4B,EAAE;IAC9D,IAAI,CAACJ,UAAU,CAACK,GAAG,CAACF,aAAa,EAAEC,IAAI,CAAC;EAC1C;EAEOE,MAAMA,CAACH,aAAqB,EAAEC,IAAqC,EAAE;IAC1E,MAAMG,YAAY,GAAG,IAAI,CAACP,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC,IAAK,CAAC,CAA4B;IACzF,IAAI,CAACH,UAAU,CAACK,GAAG,CAACF,aAAa,EAAE;MAAE,GAAGI,YAAY;MAAE,GAAGH;IAAK,CAAC,CAAC;EAClE;EAEOK,MAAMA,CAACN,aAAqB,EAAE;IACnC,IAAI,CAACH,UAAU,CAACS,MAAM,CAACN,aAAa,CAAC;EACvC;EAEOK,GAAGA,CAACL,aAAqB,EAAE;IAChC,OAAO,IAAI,CAACH,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;EAC3C;EAEOO,MAAMA,CAAA,EAAG;IACd,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACZ,UAAU,CAACa,MAAM,CAAC,CAAC,CAAC;EAC7C;EAEOC,KAAKA,CAAA,EAAG;IACb,IAAI,CAACd,UAAU,CAACc,KAAK,CAAC,CAAC;EACzB;EAEOC,aAAaA,CAACZ,aAAqB,EAAE;IAC1C,MAAMC,IAAI,GAAG,IAAI,CAACJ,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;IAC/C,OAAO,CAAC,CAACC,IAAI,EAAEY,UAAU;EAC3B;EAEOC,QAAQA,CAACd,aAAqB,EAAE;IACrC,MAAMC,IAAI,GAAG,IAAI,CAACJ,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;IAC/C,OAAO,CAAC,CAACC,IAAI,EAAEc,QAAQ;EACzB;AACF","ignoreList":[]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { createEffect } from 'effector';
|
|
4
|
-
import { NO_AUDIO_BE_MESSAGE, TRANSCRIPT_MAX_RETRIES, TRANSCRIPT_RETRY_INTERVAL_MS } from "../../constants.js";
|
|
5
|
-
export class TranscriptionsDownloaderModel {
|
|
6
|
-
inflightFetches = new Map();
|
|
7
|
-
transcriptCache = new Map();
|
|
8
|
-
constructor(collection, api) {
|
|
9
|
-
this.collection = collection;
|
|
10
|
-
this.api = api;
|
|
11
|
-
}
|
|
12
|
-
fetchTranscriptWithRetry(audioFileId) {
|
|
13
|
-
const cached = this.transcriptCache.get(audioFileId);
|
|
14
|
-
if (cached) return Promise.resolve(cached);
|
|
15
|
-
const existing = this.inflightFetches.get(audioFileId);
|
|
16
|
-
if (existing) return existing;
|
|
17
|
-
const promise = this.runFetchWithRetry(audioFileId).then(result => {
|
|
18
|
-
this.transcriptCache.set(audioFileId, result);
|
|
19
|
-
return result;
|
|
20
|
-
}).finally(() => {
|
|
21
|
-
this.inflightFetches.delete(audioFileId);
|
|
22
|
-
});
|
|
23
|
-
this.inflightFetches.set(audioFileId, promise);
|
|
24
|
-
return promise;
|
|
25
|
-
}
|
|
26
|
-
async runFetchWithRetry(audioFileId) {
|
|
27
|
-
for (let attempt = 0; attempt < TRANSCRIPT_MAX_RETRIES; attempt++) {
|
|
28
|
-
const response = await this.api.getAudioFileTranscript(audioFileId);
|
|
29
|
-
if (response.status === 'completed') {
|
|
30
|
-
return {
|
|
31
|
-
text: response.text,
|
|
32
|
-
language: response.language
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
if (response.status === 'failed') {
|
|
36
|
-
return {
|
|
37
|
-
text: NO_AUDIO_BE_MESSAGE
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
if (attempt < TRANSCRIPT_MAX_RETRIES - 1) {
|
|
41
|
-
await new Promise(resolve => setTimeout(resolve, TRANSCRIPT_RETRY_INTERVAL_MS));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
text: NO_AUDIO_BE_MESSAGE
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
loadTranscriptForAttempt = createEffect(async attemptNumber => {
|
|
49
|
-
const item = this.collection.get(attemptNumber);
|
|
50
|
-
if (!item?.audioFileId) return;
|
|
51
|
-
if (item.transcript || item.transcriptLoading) return;
|
|
52
|
-
this.collection.update(attemptNumber, {
|
|
53
|
-
transcriptLoading: true
|
|
54
|
-
});
|
|
55
|
-
try {
|
|
56
|
-
const {
|
|
57
|
-
text,
|
|
58
|
-
language
|
|
59
|
-
} = await this.fetchTranscriptWithRetry(item.audioFileId);
|
|
60
|
-
this.collection.update(attemptNumber, {
|
|
61
|
-
transcript: text,
|
|
62
|
-
transcriptLanguage: language,
|
|
63
|
-
transcriptLoading: false,
|
|
64
|
-
transcriptError: undefined
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
this.collection.update(attemptNumber, {
|
|
68
|
-
transcriptLoading: false,
|
|
69
|
-
transcriptError: error instanceof Error ? error.message : 'Failed to load transcript'
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
getCachedTranscript(audioFileId) {
|
|
74
|
-
return this.transcriptCache.get(audioFileId);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=TranscriptionsDownloader.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","NO_AUDIO_BE_MESSAGE","TRANSCRIPT_MAX_RETRIES","TRANSCRIPT_RETRY_INTERVAL_MS","TranscriptionsDownloaderModel","inflightFetches","Map","transcriptCache","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","cached","get","Promise","resolve","existing","promise","runFetchWithRetry","then","result","set","finally","delete","attempt","response","getAudioFileTranscript","status","text","language","setTimeout","loadTranscriptForAttempt","attemptNumber","item","transcript","transcriptLoading","update","transcriptLanguage","transcriptError","undefined","error","Error","message","getCachedTranscript"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsDownloader.model.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,UAAU;AAGvC,SACEC,mBAAmB,EACnBC,sB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ACxBG,eAAe,EAAEE,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAG;MAC5D,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EAEKC,mBAAmBA,CAAChC,WAAmB,EAAgC;IAC5E,OAAO,IAAI,CAACL,eAAe,CAACO,GAAG,CAACF,WAAW,CAAC;EAC9C;AACF","ignoreList":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { createEffect, createEvent, createStore, restore } from 'effector';
|
|
4
|
-
import { TranslationService } from "../../../translation/model/TranslationService.js";
|
|
5
|
-
import { GoogleTranslationProvider } from "../../../translation/providers/google/GoogleTranslationProvider.js";
|
|
6
|
-
import { preservedWordsReplacers, wordsToPreserve } from "../../../translation/preserve/wordsToPreserve.js";
|
|
7
|
-
export class TranslationModel {
|
|
8
|
-
toggle = createEvent();
|
|
9
|
-
setActive = createEvent();
|
|
10
|
-
clearCache = createEvent();
|
|
11
|
-
reset = createEvent();
|
|
12
|
-
$isActive = restore(this.setActive, false).on(this.toggle, state => !state).reset(this.reset);
|
|
13
|
-
translate = createEffect(async ({
|
|
14
|
-
attemptNumber,
|
|
15
|
-
targetLanguage
|
|
16
|
-
}) => {
|
|
17
|
-
const item = this.collection.get(attemptNumber);
|
|
18
|
-
if (!item?.transcript) return null;
|
|
19
|
-
const text = await this.service.translate(item.transcript, {
|
|
20
|
-
targetLang: targetLanguage,
|
|
21
|
-
sourceLang: item.transcriptLanguage,
|
|
22
|
-
cacheKey: `voice::${attemptNumber}::${targetLanguage}`
|
|
23
|
-
});
|
|
24
|
-
if (!text) return null;
|
|
25
|
-
return {
|
|
26
|
-
attemptNumber,
|
|
27
|
-
text
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
$translations = createStore({}).on(this.translate.doneData, (state, result) => {
|
|
31
|
-
if (!result) return state;
|
|
32
|
-
return {
|
|
33
|
-
...state,
|
|
34
|
-
[result.attemptNumber]: result.text
|
|
35
|
-
};
|
|
36
|
-
}).reset(this.reset, this.clearCache);
|
|
37
|
-
constructor(collection, api) {
|
|
38
|
-
this.collection = collection;
|
|
39
|
-
this.service = new TranslationService({
|
|
40
|
-
preserve: {
|
|
41
|
-
map: wordsToPreserve,
|
|
42
|
-
replacers: preservedWordsReplacers
|
|
43
|
-
},
|
|
44
|
-
providers: [new GoogleTranslationProvider({
|
|
45
|
-
api: {
|
|
46
|
-
translateRequest: api.translateText
|
|
47
|
-
}
|
|
48
|
-
})]
|
|
49
|
-
});
|
|
50
|
-
this.clearCache.watch(() => this.service.reset());
|
|
51
|
-
this.reset.watch(() => this.service.reset());
|
|
52
|
-
}
|
|
53
|
-
getTranslation(attemptNumber) {
|
|
54
|
-
return this.$translations.getState()[attemptNumber];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=Translation.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","createEvent","createStore","restore","TranslationService","GoogleTranslationProvider","preservedWordsReplacers","wordsToPreserve","TranslationModel","toggle","setActive","clearCache","reset","$isActive","on","state","translate","attemptNumber","targetLanguage","item","collection","get","transcript","text","service","targetLang","sourceLang","transcriptLanguage","cacheKey","$translations","doneData","result","constructor","api","preserve","map","replacers","providers","translateRequest","translateText","watch","getTranslation","getState"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Translation.model.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAG1E,SAASC,kBAAkB,QAAQ,kDAA+C;AAClF,SAASC,yBAAyB,QAAQ,oEAAiE;AAC3G,SACEC,uBAAuB,EACvBC,eAAe,QACV,kDAA+C;AAYtD,OAAO,MAAMC,gBAAgB,CAAC;EAIZC,MAAM,GAAGR,WAAW,CAAC,CAAC;EACtBS,SAAS,GAAGT,WAAW,CAAU,CAAC;EAClCU,UAAU,GAAGV,WAAW,CAAC,CA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5B,IAAI,CAACI,OAAO,GAAG,IAAIpB,kBAAkB,CAAC;MACpC8B,QAAQ,EAAE;QACRC,GAAG,EAAE5B,eAAe;QACpB6B,SAAS,EAAE9B;MACb,CAAC;MACD+B,SAAS,EAAE,CAAC,IAAIhC,yBAAyB,CAAC;QAAE4B,GAAG,EAAE;UAAEK,gBAAgB,EAAEL,GAAG,CAACM;QAAc;MAAE,CAAC,CAAC;IAC7F,CAAC,CAAC;IAEF,IAAI,CAAC5B,UAAU,CAAC6B,KAAK,CAAC,MAAM,IAAI,CAAChB,OAAO,CAACZ,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,CAACA,KAAK,CAAC4B,KAAK,CAAC,MAAM,IAAI,CAAChB,OAAO,CAACZ,KAAK,CAAC,CAAC,CAAC;EAC9C;EAEO6B,cAAcA,CAACxB,aAAqB,EAAsB;IAC/D,OAAO,IAAI,CAACY,aAAa,CAACa,QAAQ,CAAC,CAAC,CAACzB,aAAa,CAAC;EACrD;AACF","ignoreList":[]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const GBD_TEXT_CACHE_SUFFIX = "::gbd";
|
|
2
|
-
export declare const DESCRIPTION_CACHE_KEY_SUFFIX = "::description";
|
|
3
|
-
export declare const CHOICES_CACHE_KEY_SUFFIX = "::choices";
|
|
4
|
-
export declare const PRACTICE_THEORY_CACHE_KEY_SUFFIX = "::practice-theory";
|
|
5
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAU,CAAA;AAC5C,eAAO,MAAM,4BAA4B,kBAAkB,CAAA;AAC3D,eAAO,MAAM,wBAAwB,cAAc,CAAA;AACnD,eAAO,MAAM,gCAAgC,sBAAsB,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MaskSegmentParams } from './types';
|
|
2
|
-
export declare function replaceMappedTokens(input: string, map: Record<string, string>): string;
|
|
3
|
-
/**
|
|
4
|
-
* Masks text segments matched by `regex` with a placeholder,
|
|
5
|
-
* while preserving spaces around the original match.
|
|
6
|
-
*/
|
|
7
|
-
export declare const maskSegment: ({ text, regex, placeholder, replacements, shouldSkip, }: MaskSegmentParams) => string;
|
|
8
|
-
export declare const decodeHtmlEntities: (text: string) => string;
|
|
9
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWtF;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,4DAMrB,iBAAiB,KAAG,MAkBtB,CAAA;AAWD,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAQjD,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { TranslationModel } from './model/TranslationModel';
|
|
2
|
-
export { TranslationService, type TranslateConfigProps } from './model/TranslationService';
|
|
3
|
-
export { TranslationKatexPreprocessor } from './model/TranslationPreprocessor';
|
|
4
|
-
export { TranslationProvider, type LanguageGlossary } from './providers/translation.interface';
|
|
5
|
-
export { GoogleTranslationProvider } from './providers/google/GoogleTranslationProvider';
|
|
6
|
-
export { GoogleTranslateLanguage } from './providers/google/supportedLanguages';
|
|
7
|
-
export type { GoogleTranslateProps, GoogleTranslateResponse, GoogleTranslation, } from './providers/google.types';
|
|
8
|
-
export { wordsToPreserve, preservedWordsReplacers } from './preserve/wordsToPreserve';
|
|
9
|
-
export { GBD_TEXT_CACHE_SUFFIX, DESCRIPTION_CACHE_KEY_SUFFIX, CHOICES_CACHE_KEY_SUFFIX, PRACTICE_THEORY_CACHE_KEY_SUFFIX, } from './constants';
|
|
10
|
-
export { replaceMappedTokens, maskSegment, decodeHtmlEntities, } from './helpers';
|
|
11
|
-
export type { TranslatableProblem, TranslateAllFxParams, TranslateFxParams, Replacement, MaskSegmentParams, } from './types';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Store, Unit } from 'effector';
|
|
2
|
-
import { GoogleTranslateProps, GoogleTranslateResponse } from '../providers/google.types';
|
|
3
|
-
import { TranslatableProblem, TranslateFxParams } from '../types';
|
|
4
|
-
type TranslationModelProps<TProblem extends TranslatableProblem> = {
|
|
5
|
-
$problem: Store<TProblem | null>;
|
|
6
|
-
$problemId: Store<string>;
|
|
7
|
-
$assignmentId: Store<string>;
|
|
8
|
-
$currentProblemIndex: Store<number>;
|
|
9
|
-
$translationLanguageCode: Store<string>;
|
|
10
|
-
$contentLanguageCode?: Store<string>;
|
|
11
|
-
$isTranslationLocked: Store<boolean>;
|
|
12
|
-
languageChanged: Unit<unknown>;
|
|
13
|
-
api: {
|
|
14
|
-
translateRequest: (payload: GoogleTranslateProps) => Promise<GoogleTranslateResponse>;
|
|
15
|
-
};
|
|
16
|
-
getGreatWorkFeedbackText?: () => string;
|
|
17
|
-
};
|
|
18
|
-
export declare class TranslationModel<TProblem extends TranslatableProblem = TranslatableProblem> {
|
|
19
|
-
private readonly service;
|
|
20
|
-
readonly toggle: import("effector").EventCallable<void>;
|
|
21
|
-
readonly setTranslated: import("effector").EventCallable<boolean>;
|
|
22
|
-
readonly reset: import("effector").EventCallable<void>;
|
|
23
|
-
readonly $isTranslationActive: import("effector").StoreWritable<boolean>;
|
|
24
|
-
readonly $isTranslated: import("effector").StoreWritable<boolean>;
|
|
25
|
-
readonly $isTranslationPending: Store<boolean>;
|
|
26
|
-
readonly translateFx: import("effector").Effect<TranslateFxParams, string, Error>;
|
|
27
|
-
readonly translateAllFx: import("effector").Effect<void, unknown[] | undefined, Error>;
|
|
28
|
-
constructor({ $problem, $problemId, $assignmentId, $currentProblemIndex, $translationLanguageCode, $contentLanguageCode, $isTranslationLocked, languageChanged, api, getGreatWorkFeedbackText, }: TranslationModelProps<TProblem>);
|
|
29
|
-
getTranslated<T extends string | string[]>(key: string): T | undefined;
|
|
30
|
-
clearCache(): void;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=TranslationModel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,EACL,IAAI,EACL,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,2BAA2B,CAAA;AAWlC,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAEjB,KAAK,qBAAqB,CAAC,QAAQ,SAAS,mBAAmB,IAAI;IACjE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAChC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACzB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnC,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACvC,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpC,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9B,GAAG,EAAE;QACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;KACtF,CAAA;IACD,wBAAwB,CAAC,EAAE,MAAM,MAAM,CAAA;CACxC,CAAA;AAED,qBAAa,gBAAgB,CAAC,QAAQ,SAAS,mBAAmB,GAAG,mBAAmB;IACtF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAE5C,SAAgB,MAAM,yCAAgB;IACtC,SAAgB,aAAa,4CAAyB;IACtD,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,oBAAoB,4CAAuD;IAC3F,SAAgB,aAAa,4CAA4B;IACzD,SAAgB,qBAAqB,iBAAA;IAErC,SAAgB,WAAW,8DAAA;IAC3B,SAAgB,cAAc,gEAAA;gBAElB,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,wBAAwB,GACzB,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IA8F3B,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItE,UAAU;CAGlB"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { LanguageGlossary } from '../providers/translation.interface';
|
|
2
|
-
import { Replacement } from '../types';
|
|
3
|
-
type SetupPreservableProps = {
|
|
4
|
-
glossaryToPreserve: LanguageGlossary;
|
|
5
|
-
preserveWordsReplacers: [RegExp, string][];
|
|
6
|
-
};
|
|
7
|
-
export declare class TranslationKatexPreprocessor {
|
|
8
|
-
private static plaintextConverter;
|
|
9
|
-
static setPlaintextConverter(converter: (text: string) => string): void;
|
|
10
|
-
static shouldSkipTranslation(text?: string | string[]): boolean;
|
|
11
|
-
static isMathExpressionOnly(text: string): boolean;
|
|
12
|
-
static isSingleLetter(text: string): boolean;
|
|
13
|
-
static isMathSymbolsOnly(text: string): boolean;
|
|
14
|
-
private globalTargetLanguage;
|
|
15
|
-
private preserveWordsMap;
|
|
16
|
-
private preserveWordsReplacers;
|
|
17
|
-
private normalizePlaceholderSpacing;
|
|
18
|
-
sanitize(text: string): {
|
|
19
|
-
sanitized: string;
|
|
20
|
-
replacements: Replacement[];
|
|
21
|
-
};
|
|
22
|
-
restore(text: string, replacements: Replacement[]): string;
|
|
23
|
-
sanitizeBatch(texts: string[]): {
|
|
24
|
-
sanitized: string[];
|
|
25
|
-
replacements: Replacement[][];
|
|
26
|
-
};
|
|
27
|
-
restoreBatch(texts: string[], replacementsArray: Replacement[][]): string[];
|
|
28
|
-
setupPreservable({ glossaryToPreserve, preserveWordsReplacers }: SetupPreservableProps): void;
|
|
29
|
-
setupTarget(language: string): void;
|
|
30
|
-
private skipCustomReplacerSanitizeWithoutGlossary;
|
|
31
|
-
private applyPreserved;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=TranslationPreprocessor.d.ts.map
|
package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationPreprocessor.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationPreprocessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AA2BtC,KAAK,qBAAqB,GAAG;IAC3B,kBAAkB,EAAE,gBAAgB,CAAA;IACpC,sBAAsB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC3C,CAAA;AAED,qBAAa,4BAA4B;IACvC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA2C;WAE9D,qBAAqB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;WAIzD,qBAAqB,CAAC,IAAI,GAAE,MAAM,GAAG,MAAM,EAAO;WAYlD,oBAAoB,CAAC,IAAI,EAAE,MAAM;WAIjC,cAAc,CAAC,IAAI,EAAE,MAAM;WAI3B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAO5C,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,sBAAsB,CAAyB;IAEvD,OAAO,CAAC,2BAA2B;IAM5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,CAAA;KAAE;IA8B1E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE;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